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
0a926198
Commit
0a926198
authored
Jan 19, 2017
by
Tiago Cunha
Committed by
GitHub
Jan 19, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into fix/attachment-ui
parents
044a9d5b
ec29bb97
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
ActiveUsersSubscriber.java
...ocket/android/service/ddp/base/ActiveUsersSubscriber.java
+23
-0
No files found.
app/src/main/java/chat/rocket/android/service/ddp/base/ActiveUsersSubscriber.java
View file @
0a926198
...
...
@@ -3,6 +3,9 @@ package chat.rocket.android.service.ddp.base;
import
android.content.Context
;
import
io.realm.RealmObject
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
chat.rocket.android.api.DDPClientWrapper
;
import
chat.rocket.android.model.ddp.User
;
import
chat.rocket.android.realm_helper.RealmHelper
;
...
...
@@ -30,4 +33,24 @@ public class ActiveUsersSubscriber extends AbstractBaseSubscriber {
protected
Class
<?
extends
RealmObject
>
getModelClass
()
{
return
User
.
class
;
}
@Override
protected
JSONObject
customizeFieldJson
(
JSONObject
json
)
throws
JSONException
{
json
=
super
.
customizeFieldJson
(
json
);
// The user object may have some children without a proper primary key (ex.: settings)
// Here we identify this and add a local key
// Only happens here when the logged user receives its own data
if
(
json
.
has
(
"settings"
))
{
final
JSONObject
settingsJson
=
json
.
getJSONObject
(
"settings"
);
settingsJson
.
put
(
"id"
,
json
.
getString
(
"_id"
));
if
(
settingsJson
.
has
(
"preferences"
))
{
final
JSONObject
preferencesJson
=
settingsJson
.
getJSONObject
(
"preferences"
);
preferencesJson
.
put
(
"id"
,
json
.
getString
(
"_id"
));
}
}
return
json
;
}
}
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