Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
briar
Briar Desktop
Commits
478f691a
Verified
Commit
478f691a
authored
Nov 05, 2021
by
Mikolai Gütschow
Browse files
addressed review comments
parent
f9adf46d
Pipeline
#8051
passed with stage
in 1 minute and 57 seconds
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
src/main/kotlin/org/briarproject/briar/desktop/contact/ContactListViewModel.kt
View file @
478f691a
...
...
@@ -57,9 +57,10 @@ constructor(
override
fun
updateFilteredList
()
{
super
.
updateFilteredList
()
_selectedContactId
.
value
?.
let
{
id
->
if
(!
contactList
.
map
{
it
.
contact
.
id
}.
contains
(
id
))
_selectedContactId
.
value
=
null
// reset selected contact to null if not available after filtering
val
id
=
_selectedContactId
.
value
if
(
id
!=
null
&&
!
contactList
.
map
{
it
.
contact
.
id
}.
contains
(
id
))
{
_selectedContactId
.
value
=
null
}
}
...
...
src/main/kotlin/org/briarproject/briar/desktop/conversation/ConversationViewModel.kt
View file @
478f691a
...
...
@@ -85,6 +85,9 @@ constructor(
val
text
=
_newMessage
.
value
_newMessage
.
value
=
""
// don't send empty or blank messages
if
(
text
.
isBlank
())
return
val
start
=
LogUtils
.
now
()
val
m
=
createMessage
(
text
)
messagingManager
.
addLocalMessage
(
m
)
...
...
@@ -125,18 +128,20 @@ constructor(
try
{
val
start
=
LogUtils
.
now
()
val
headers
=
conversationManager
.
getMessageHeaders
(
_contactId
.
value
!!
)
LogUtils
.
logDuration
(
LOG
,
"Loading messages"
,
start
)
LogUtils
.
logDuration
(
LOG
,
"Loading message
header
s"
,
start
)
// Sort headers by timestamp in *descending* order
val
sorted
=
headers
.
sortedByDescending
{
it
.
timestamp
}
_messages
.
apply
{
clear
()
val
start
=
LogUtils
.
now
()
addAll
(
// todo: use ConversationVisitor to also display Request and Notice Messages
sorted
.
filterIsInstance
<
PrivateMessageHeader
>().
map
(
::
messageHeaderToItem
)
)
LogUtils
.
logDuration
(
LOG
,
"Loading messages"
,
start
)
}
}
catch
(
e
:
NoSuchContactException
)
{
// finishOnUiThread(
)
LogUtils
.
logException
(
LOG
,
Level
.
WARNING
,
e
)
}
catch
(
e
:
DbException
)
{
LogUtils
.
logException
(
LOG
,
Level
.
WARNING
,
e
)
}
...
...
@@ -147,17 +152,15 @@ constructor(
val
item
=
ConversationMessageItem
(
h
)
if
(
h
.
hasText
())
{
item
.
text
=
loadMessageText
(
h
.
id
)
}
else
{
LOG
.
warning
{
"private message without text"
}
}
return
item
}
private
fun
loadMessageText
(
m
:
MessageId
):
String
?
{
try
{
val
start
=
LogUtils
.
now
()
val
text
=
messagingManager
.
getMessageText
(
m
)
LogUtils
.
logDuration
(
LOG
,
"Loading text"
,
start
)
return
text
return
messagingManager
.
getMessageText
(
m
)
}
catch
(
e
:
DbException
)
{
LogUtils
.
logException
(
LOG
,
Level
.
WARNING
,
e
)
}
...
...
src/main/kotlin/org/briarproject/briar/desktop/conversation/PrivateMessageView.kt
View file @
478f691a
...
...
@@ -24,13 +24,12 @@ fun PrivateMessageView(
ContactList
(
contactListViewModel
,
addContactViewModel
)
VerticalDivider
()
Column
(
modifier
=
Modifier
.
weight
(
1f
).
fillMaxHeight
())
{
contactListViewModel
.
selectedContactId
.
value
?.
also
{
contactId
->
Conversation
(
contactId
,
conversationViewModel
,
introductionViewModel
)
}
?:
UiPlaceholder
()
val
id
=
contactListViewModel
.
selectedContactId
.
value
if
(
id
!=
null
)
{
Conversation
(
id
,
conversationViewModel
,
introductionViewModel
)
}
else
{
UiPlaceholder
()
}
}
}
}
src/main/kotlin/org/briarproject/briar/desktop/conversation/TextBubble.kt
View file @
478f691a
...
...
@@ -44,7 +44,9 @@ fun TextBubble(m: ConversationMessageItem) {
if
(!
m
.
isIncoming
)
{
val
modifier
=
Modifier
.
size
(
12
.
dp
).
align
(
Alignment
.
CenterVertically
)
val
icon
=
if
(
m
.
isSeen
)
Icons
.
Filled
.
DoneAll
else
if
(
m
.
isSent
)
Icons
.
Filled
.
Done
else
Icons
.
Filled
.
Schedule
if
(
m
.
isSeen
)
Icons
.
Filled
.
DoneAll
// acknowledged
else
if
(
m
.
isSent
)
Icons
.
Filled
.
Done
// sent
else
Icons
.
Filled
.
Schedule
// waiting
Icon
(
icon
,
"sent"
,
modifier
)
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment