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
25f39958
Commit
25f39958
authored
Oct 03, 2018
by
Lucio Maciel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Status updates
parent
defea92a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
DatabaseManager.kt
app/src/main/java/chat/rocket/android/db/DatabaseManager.kt
+10
-5
No files found.
app/src/main/java/chat/rocket/android/db/DatabaseManager.kt
View file @
25f39958
...
...
@@ -36,6 +36,7 @@ import kotlinx.coroutines.experimental.newSingleThreadContext
import
kotlinx.coroutines.experimental.withContext
import
timber.log.Timber
import
java.util.HashSet
import
kotlin.system.measureTimeMillis
class
DatabaseManager
(
val
context
:
Application
,
val
serverUrl
:
String
)
{
...
...
@@ -73,13 +74,17 @@ class DatabaseManager(val context: Application,
launch
(
dbContext
)
{
val
dao
=
userDao
()
val
list
=
ArrayList
<
BaseUserEntity
>(
users
.
size
)
var
time
=
measureTimeMillis
{
users
.
forEach
{
user
->
user
.
toEntity
()
?.
let
{
entity
->
list
.
add
(
entity
)
}
}
}
Timber
.
d
(
"Converted users batch(${users.size}) in $time MS"
)
dao
.
upsert
(
list
)
time
=
measureTimeMillis
{
dao
.
upsert
(
list
)
}
Timber
.
d
(
"Upserted users batch(${users.size}) in $time MS"
)
}
}
...
...
@@ -523,7 +528,7 @@ class DatabaseManager(val context: Application,
}
fun
User
.
toEntity
():
BaseUserEntity
?
{
return
if
(
name
==
null
&&
username
==
null
&&
utcOffset
==
null
&&
status
!=
null
)
{
return
if
(
(
name
==
null
||
username
==
null
)
&&
status
!=
null
)
{
UserStatus
(
id
=
id
,
status
=
status
.
toString
())
}
else
if
(
username
!=
null
)
{
UserEntity
(
id
,
username
,
name
,
status
?.
toString
()
?:
"offline"
,
utcOffset
)
...
...
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