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
6ffa4788
Commit
6ffa4788
authored
Jul 18, 2018
by
Lucio Maciel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sometimes we don't have the userId, so just ignore it
parent
c3d08b98
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
FetchChatRoomsInteractor.kt
...cket/android/chatrooms/domain/FetchChatRoomsInteractor.kt
+0
-1
DatabaseManager.kt
app/src/main/java/chat/rocket/android/db/DatabaseManager.kt
+7
-6
No files found.
app/src/main/java/chat/rocket/android/chatrooms/domain/FetchChatRoomsInteractor.kt
View file @
6ffa4788
...
@@ -3,7 +3,6 @@ package chat.rocket.android.chatrooms.domain
...
@@ -3,7 +3,6 @@ package chat.rocket.android.chatrooms.domain
import
chat.rocket.android.db.DatabaseManager
import
chat.rocket.android.db.DatabaseManager
import
chat.rocket.android.db.model.ChatRoomEntity
import
chat.rocket.android.db.model.ChatRoomEntity
import
chat.rocket.android.db.model.UserEntity
import
chat.rocket.android.db.model.UserEntity
import
chat.rocket.android.infrastructure.LocalRepository
import
chat.rocket.android.util.retryIO
import
chat.rocket.android.util.retryIO
import
chat.rocket.core.RocketChatClient
import
chat.rocket.core.RocketChatClient
import
chat.rocket.core.internal.rest.chatRooms
import
chat.rocket.core.internal.rest.chatRooms
...
...
app/src/main/java/chat/rocket/android/db/DatabaseManager.kt
View file @
6ffa4788
...
@@ -154,14 +154,14 @@ class DatabaseManager(val context: Application,
...
@@ -154,14 +154,14 @@ class DatabaseManager(val context: Application,
val
chatRoom
=
current
.
chatRoom
val
chatRoom
=
current
.
chatRoom
lastMessage
?.
sender
?.
let
{
user
->
lastMessage
?.
sender
?.
let
{
user
->
if
(
findUser
(
user
.
id
!!
)
==
null
)
{
if
(
findUser
(
user
.
id
)
==
null
)
{
Timber
.
d
(
"Missing last message user, inserting: ${user.id}"
)
Timber
.
d
(
"Missing last message user, inserting: ${user.id}"
)
insert
(
UserEntity
(
user
.
id
!!
,
user
.
username
,
user
.
name
))
insert
(
UserEntity
(
user
.
id
!!
,
user
.
username
,
user
.
name
))
}
}
}
}
user
?.
let
{
user
->
user
?.
let
{
user
->
if
(
findUser
(
user
.
id
!!
)
==
null
)
{
if
(
findUser
(
user
.
id
)
==
null
)
{
Timber
.
d
(
"Missing owner user, inserting: ${user.id}"
)
Timber
.
d
(
"Missing owner user, inserting: ${user.id}"
)
insert
(
UserEntity
(
user
.
id
!!
,
user
.
username
,
user
.
name
))
insert
(
UserEntity
(
user
.
id
!!
,
user
.
username
,
user
.
name
))
}
}
...
@@ -260,15 +260,16 @@ class DatabaseManager(val context: Application,
...
@@ -260,15 +260,16 @@ class DatabaseManager(val context: Application,
Timber
.
d
(
"Missing user, inserting: $userId"
)
Timber
.
d
(
"Missing user, inserting: $userId"
)
insert
(
UserEntity
(
userId
))
insert
(
UserEntity
(
userId
))
}
}
room
.
lastMessage
?.
sender
?.
let
{
user
->
room
.
lastMessage
?.
sender
?.
let
{
user
->
if
(
findUser
(
user
.
id
!!
)
==
null
)
{
if
(
findUser
(
user
.
id
)
==
null
)
{
Timber
.
d
(
"Missing last message user, inserting: ${user.id}"
)
Timber
.
d
(
"Missing last message user, inserting: ${user.id}"
)
insert
(
UserEntity
(
user
.
id
!!
,
user
.
username
,
user
.
name
))
insert
(
UserEntity
(
user
.
id
!!
,
user
.
username
,
user
.
name
))
}
}
}
}
room
.
user
?.
let
{
user
->
room
.
user
?.
let
{
user
->
if
(
findUser
(
user
.
id
!!
)
==
null
)
{
if
(
findUser
(
user
.
id
)
==
null
)
{
Timber
.
d
(
"Missing owner user, inserting: ${user.id}"
)
Timber
.
d
(
"Missing owner user, inserting: ${user.id}"
)
insert
(
UserEntity
(
user
.
id
!!
,
user
.
username
,
user
.
name
))
insert
(
UserEntity
(
user
.
id
!!
,
user
.
username
,
user
.
name
))
}
}
...
@@ -312,13 +313,13 @@ class DatabaseManager(val context: Application,
...
@@ -312,13 +313,13 @@ class DatabaseManager(val context: Application,
}
}
}
}
fun
findUser
(
userId
:
String
):
String
?
=
userDao
().
findUser
(
userId
)
fun
findUser
(
userId
:
String
?):
String
?
=
if
(
userId
!=
null
)
userDao
().
findUser
(
userId
)
else
null
}
}
fun
User
.
toEntity
():
BaseUserEntity
?
{
fun
User
.
toEntity
():
BaseUserEntity
?
{
return
if
(
name
==
null
&&
username
==
null
&&
utcOffset
==
null
&&
status
!=
null
)
{
return
if
(
name
==
null
&&
username
==
null
&&
utcOffset
==
null
&&
status
!=
null
)
{
UserStatus
(
id
=
id
,
status
=
status
.
toString
())
UserStatus
(
id
=
id
,
status
=
status
.
toString
())
}
else
if
(
username
!=
null
){
}
else
if
(
username
!=
null
)
{
UserEntity
(
id
,
username
,
name
,
status
?.
toString
()
?:
"offline"
,
utcOffset
)
UserEntity
(
id
,
username
,
name
,
status
?.
toString
()
?:
"offline"
,
utcOffset
)
}
else
{
}
else
{
null
null
...
...
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