Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
f4c71ec2
Commit
f4c71ec2
authored
Mar 02, 2019
by
dev-ritik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add support to fetch avatar realtime
parent
cf7ffd51
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
DatabaseManager.kt
app/src/main/java/chat/rocket/android/db/DatabaseManager.kt
+10
-0
No files found.
app/src/main/java/chat/rocket/android/db/DatabaseManager.kt
View file @
f4c71ec2
package
chat.rocket.android.db
import
android.app.Application
import
androidx.core.net.toUri
import
chat.rocket.android.R
import
chat.rocket.android.db.model.BaseMessageEntity
import
chat.rocket.android.db.model.BaseUserEntity
...
...
@@ -15,6 +16,7 @@ import chat.rocket.android.db.model.UrlEntity
import
chat.rocket.android.db.model.UserEntity
import
chat.rocket.android.db.model.UserStatus
import
chat.rocket.android.db.model.asEntity
import
chat.rocket.android.util.extensions.avatarUrl
import
chat.rocket.android.util.extensions.exhaustive
import
chat.rocket.android.util.extensions.removeTrailingSlash
import
chat.rocket.android.util.extensions.toEntity
...
...
@@ -33,6 +35,7 @@ import chat.rocket.core.model.Myself
import
chat.rocket.core.model.Room
import
chat.rocket.core.model.attachment.Attachment
import
chat.rocket.core.model.userId
import
com.facebook.drawee.backends.pipeline.Fresco
import
kotlinx.coroutines.experimental.Job
import
kotlinx.coroutines.experimental.channels.Channel
import
kotlinx.coroutines.experimental.launch
...
...
@@ -174,6 +177,13 @@ class DatabaseManager(val context: Application, val serverUrl: String) {
status
=
myself
.
status
?.
toString
()
?:
user
.
status
)
?:
myself
.
asUser
().
toEntity
()
if
(
myself
.
avatarOrigin
!=
null
&&
myself
.
active
==
null
&&
myself
.
name
==
null
&&
myself
.
username
==
null
)
{
user
?.
username
?.
let
{
Fresco
.
getImagePipeline
().
evictFromCache
(
serverUrl
.
avatarUrl
(
it
).
toUri
())
}
}
Timber
.
d
(
"UPDATING SELF: $entity"
)
entity
?.
let
{
sendOperation
(
Operation
.
UpsertUser
(
it
))
}
}
...
...
Write
Preview
Markdown
is supported
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