Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
xx Messenger Android
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobile
android
xx Messenger Android
Commits
cf7119c0
Commit
cf7119c0
authored
Jul 28, 2022
by
Kamal Bramwell
Browse files
Options
Downloads
Patches
Plain Diff
Fixed issue preventing local results from being shown
parent
b3fce773
No related branches found
No related tags found
4 merge requests
!84
Version 2.92 build 629
,
!77
v2.9 b627
,
!72
FE-948: Invite Friend
,
!66
FE-937 Connections search results
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/src/main/java/io/xxlabs/messenger/search/UserSearchViewModel.kt
+15
-8
15 additions, 8 deletions
...in/java/io/xxlabs/messenger/search/UserSearchViewModel.kt
with
15 additions
and
8 deletions
app/src/main/java/io/xxlabs/messenger/search/UserSearchViewModel.kt
+
15
−
8
View file @
cf7119c0
...
@@ -355,27 +355,34 @@ class UserSearchViewModel @Inject constructor(
...
@@ -355,27 +355,34 @@ class UserSearchViewModel @Inject constructor(
val
requests
=
filter
{
val
requests
=
filter
{
it
.
status
!=
RequestStatus
.
ACCEPTED
.
value
it
.
status
!=
RequestStatus
.
ACCEPTED
.
value
}.
toSet
()
}.
toSet
()
// Separate into a sublist of accepted connections and requests.
val
contacts
=
this
-
requests
val
contacts
=
this
-
requests
// Wrap the requests as SearchResultItems for UI layer.
val
requestItems
=
requests
.
map
{
val
requestItems
=
requests
.
map
{
SearchResultItem
(
SearchResultItem
(
ContactRequestData
(
it
),
ContactRequestData
(
it
),
resolveBitmap
(
it
.
photo
)
resolveBitmap
(
it
.
photo
)
)
)
}
}.
toMutableList
()
// Wrap the connections as AcceptedConnectionItems for UI layer.
val
contactItems
=
contacts
.
map
{
val
contactItems
=
contacts
.
map
{
val
requestData
=
ContactRequestData
(
it
)
AcceptedConnectionItem
(
AcceptedConnectionItem
(
ContactR
equestData
(
it
)
,
r
equestData
,
resolveBitmap
(
it
.
photo
)
resolveBitmap
(
it
.
photo
)
)
)
}
}
return
requestItems
.
apply
{
val
localResults
=
if
(
contacts
.
isNotEmpty
())
{
if
(
contactItems
.
isNotEmpty
())
{
requestItems
+
ConnectionsDividerItem
()
+
contactItems
plus
(
ConnectionsDividerItem
())
}
else
{
plus
(
contactItems
)
requestItems
}
}
}
Timber
.
d
(
"RequestItems: ${requestItems.size} entries"
)
Timber
.
d
(
"ContactItems: ${contactItems.size} entries"
)
Timber
.
d
(
"LocalResults: ${localResults.size} entries"
)
return
localResults
}
}
private
suspend
fun
resolveBitmap
(
data
:
ByteArray
?):
Bitmap
?
=
withContext
(
Dispatchers
.
IO
)
{
private
suspend
fun
resolveBitmap
(
data
:
ByteArray
?):
Bitmap
?
=
withContext
(
Dispatchers
.
IO
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment