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
09780fe3
Commit
09780fe3
authored
Dec 19, 2016
by
Tiago Cunha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a solution for Settings and Preferences keys
Changed the way to identify an unread room
parent
f2791a03
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
1 deletion
+30
-1
RoomListManager.java
...rocket/android/layouthelper/chatroom/RoomListManager.java
+1
-1
Preferences.java
.../main/java/chat/rocket/android/model/ddp/Preferences.java
+3
-0
Settings.java
...src/main/java/chat/rocket/android/model/ddp/Settings.java
+4
-0
UserDataSubscriber.java
...t/rocket/android/service/ddp/base/UserDataSubscriber.java
+22
-0
No files found.
app/src/main/java/chat/rocket/android/layouthelper/chatroom/RoomListManager.java
View file @
09780fe3
...
...
@@ -146,7 +146,7 @@ public class RoomListManager {
String
type
=
roomSubscription
.
getType
();
if
(
unreadRoomMode
&&
roomSubscription
.
getUnread
()
>
0
)
{
if
(
unreadRoomMode
&&
roomSubscription
.
isAlert
()
)
{
insertOrUpdateItem
(
unreadRoomsContainer
,
roomSubscription
);
removeItemIfExists
(
channelsContainer
,
name
);
removeItemIfExists
(
dmContainer
,
name
);
...
...
app/src/main/java/chat/rocket/android/model/ddp/Preferences.java
View file @
09780fe3
package
chat
.
rocket
.
android
.
model
.
ddp
;
import
io.realm.RealmObject
;
import
io.realm.annotations.PrimaryKey
;
public
class
Preferences
extends
RealmObject
{
@PrimaryKey
private
String
id
;
private
boolean
newRoomNotification
;
private
boolean
newMessageNotification
;
private
boolean
useEmojis
;
...
...
app/src/main/java/chat/rocket/android/model/ddp/Settings.java
View file @
09780fe3
package
chat
.
rocket
.
android
.
model
.
ddp
;
import
io.realm.RealmObject
;
import
io.realm.annotations.PrimaryKey
;
public
class
Settings
extends
RealmObject
{
@PrimaryKey
private
String
id
;
private
Preferences
preferences
;
public
Preferences
getPreferences
()
{
...
...
app/src/main/java/chat/rocket/android/service/ddp/base/UserDataSubscriber.java
View file @
09780fe3
...
...
@@ -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,23 @@ public class UserDataSubscriber 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
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