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
8035b4a7
Commit
8035b4a7
authored
Nov 11, 2016
by
Yusuke Iwaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ativeUsers subscription ; add subscriptions/get logic.
parent
e9ceb7f9
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
231 additions
and
77 deletions
+231
-77
MainActivity.java
.../main/java/chat/rocket/android/activity/MainActivity.java
+5
-5
RoomFragment.java
...a/chat/rocket/android/fragment/chatroom/RoomFragment.java
+8
-8
MethodCallHelper.java
...ain/java/chat/rocket/android/helper/MethodCallHelper.java
+71
-22
RoomListManager.java
...rocket/android/layouthelper/chatroom/RoomListManager.java
+18
-18
Email.java
app/src/main/java/chat/rocket/android/model/Email.java
+11
-0
MeteorLoginServiceConfiguration.java
...rocket/android/model/MeteorLoginServiceConfiguration.java
+7
-6
RoomSubscription.java
...main/java/chat/rocket/android/model/RoomSubscription.java
+32
-13
User.java
app/src/main/java/chat/rocket/android/model/User.java
+44
-0
RocketChatWebSocketThread.java
...hat/rocket/android/service/RocketChatWebSocketThread.java
+2
-0
AbstractDDPDocEventSubscriber.java
...service/ddp_subscriber/AbstractDDPDocEventSubscriber.java
+3
-3
ActiveUsersSubscriber.java
...android/service/ddp_subscriber/ActiveUsersSubscriber.java
+27
-0
SessionObserver.java
...chat/rocket/android/service/observer/SessionObserver.java
+2
-1
RoomListItemView.java
...chat/rocket/android/widget/internal/RoomListItemView.java
+1
-1
No files found.
app/src/main/java/chat/rocket/android/activity/MainActivity.java
View file @
8035b4a7
...
...
@@ -11,7 +11,7 @@ import chat.rocket.android.fragment.chatroom.HomeFragment;
import
chat.rocket.android.fragment.chatroom.RoomFragment
;
import
chat.rocket.android.helper.Avatar
;
import
chat.rocket.android.layouthelper.chatroom.RoomListManager
;
import
chat.rocket.android.model.Room
;
import
chat.rocket.android.model.Room
Subscription
;
import
com.jakewharton.rxbinding.view.RxView
;
import
com.jakewharton.rxbinding.widget.RxCompoundButton
;
import
io.realm.Realm
;
...
...
@@ -75,12 +75,12 @@ public class MainActivity extends AbstractAuthedActivity {
.
subscribe
(
RxView
.
visibility
(
findViewById
(
R
.
id
.
user_action_container
)));
}
private
RealmListObserver
<
Room
>
roomsObserver
=
new
RealmListObserver
<
Room
>()
{
@Override
protected
RealmResults
<
Room
>
queryItems
(
Realm
realm
)
{
return
realm
.
where
(
Room
.
class
).
findAll
();
private
RealmListObserver
<
Room
Subscription
>
roomsObserver
=
new
RealmListObserver
<
RoomSubscription
>()
{
@Override
protected
RealmResults
<
Room
Subscription
>
queryItems
(
Realm
realm
)
{
return
realm
.
where
(
Room
Subscription
.
class
).
findAll
();
}
@Override
protected
void
onCollectionChanged
(
List
<
Room
>
list
)
{
@Override
protected
void
onCollectionChanged
(
List
<
Room
Subscription
>
list
)
{
roomListManager
.
setRooms
(
list
);
}
};
...
...
app/src/main/java/chat/rocket/android/fragment/chatroom/RoomFragment.java
View file @
8035b4a7
...
...
@@ -3,7 +3,7 @@ package chat.rocket.android.fragment.chatroom;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
chat.rocket.android.R
;
import
chat.rocket.android.model.Room
;
import
chat.rocket.android.model.Room
Subscription
;
import
io.realm.Realm
;
import
io.realm.RealmQuery
;
import
jp.co.crowdworks.realm_java_helpers.RealmObjectObserver
;
...
...
@@ -44,18 +44,18 @@ public class RoomFragment extends AbstractChatRoomFragment {
}
private
RealmObjectObserver
<
Room
>
roomObserver
=
new
RealmObjectObserver
<
Room
>()
{
@Override
protected
RealmQuery
<
Room
>
query
(
Realm
realm
)
{
return
realm
.
where
(
Room
.
class
).
equalTo
(
"_
id"
,
roomId
);
private
RealmObjectObserver
<
Room
Subscription
>
roomObserver
=
new
RealmObjectObserver
<
RoomSubscription
>()
{
@Override
protected
RealmQuery
<
Room
Subscription
>
query
(
Realm
realm
)
{
return
realm
.
where
(
Room
Subscription
.
class
).
equalTo
(
"r
id"
,
roomId
);
}
@Override
protected
void
onChange
(
Room
room
)
{
onRenderRoom
(
room
);
@Override
protected
void
onChange
(
Room
Subscription
roomSubscription
)
{
onRenderRoom
(
room
Subscription
);
}
};
private
void
onRenderRoom
(
Room
room
)
{
activityToolbar
.
setTitle
(
room
.
getName
());
private
void
onRenderRoom
(
Room
Subscription
roomSubscription
)
{
activityToolbar
.
setTitle
(
room
Subscription
.
getName
());
}
@Override
public
void
onResume
()
{
...
...
app/src/main/java/chat/rocket/android/helper/MethodCallHelper.java
View file @
8035b4a7
...
...
@@ -4,7 +4,7 @@ import android.util.Patterns;
import
bolts.Continuation
;
import
bolts.Task
;
import
chat.rocket.android.model.MethodCall
;
import
chat.rocket.android.model.Room
;
import
chat.rocket.android.model.Room
Subscription
;
import
chat.rocket.android.model.ServerConfig
;
import
chat.rocket.android.ws.RocketChatWebSocketAPI
;
import
java.util.UUID
;
...
...
@@ -145,34 +145,83 @@ public class MethodCallHelper {
}
/**
* request "rooms/get".
* request "
subscriptions/get" and "
rooms/get".
*/
public
Task
<
Void
>
getRooms
()
{
return
call
(
"rooms/get"
,
param
->
param
.
put
(
"$date"
,
0
),
this
::
updateRooms
);
return
getRoomSubscriptionRecursive
(
0
)
.
onSuccessTask
(
task
->
getRoomRecursive
(
0
))
.
onSuccessTask
(
task
->
Task
.
forResult
(
null
));
}
private
Task
<
Void
>
updateRooms
(
Task
<
JSONObject
>
task
)
{
private
Task
<
Long
>
getRoomSubscriptionRecursive
(
long
timestamp
)
{
return
call
(
"subscriptions/get"
,
param
->
param
.
put
(
"$date"
,
timestamp
),
task
->
{
JSONObject
result
=
task
.
getResult
();
long
nextTimestamp
=
0
;
try
{
nextTimestamp
=
result
.
getJSONArray
(
"remove"
)
.
getJSONObject
(
0
).
getJSONObject
(
"_deletedAt"
).
getLong
(
"$date"
);
}
catch
(
JSONException
exception
)
{
}
try
{
JSONArray
updatedRooms
=
result
.
getJSONArray
(
"update"
);
for
(
int
i
=
0
;
i
<
updatedRooms
.
length
();
i
++)
{
updatedRooms
.
getJSONObject
(
i
).
put
(
"serverConfigId"
,
serverConfigId
);
}
return
RealmHelperBolts
.
executeTransaction
(
realm
->
{
realm
.
createOrUpdateAllFromJson
(
Room
.
class
,
result
.
getJSONArray
(
"update"
));
JSONArray
removedRooms
=
result
.
getJSONArray
(
"remove"
);
for
(
int
i
=
0
;
i
<
removedRooms
.
length
();
i
++)
{
realm
.
where
(
Room
.
class
)
.
equalTo
(
"serverConfigId"
,
serverConfigId
)
.
equalTo
(
"_id"
,
removedRooms
.
getJSONObject
(
i
).
getString
(
"_id"
))
.
findAll
().
deleteAllFromRealm
();
Task
<
Void
>
saveToDB
=
RealmHelperBolts
.
executeTransaction
(
realm
->
{
realm
.
createOrUpdateAllFromJson
(
RoomSubscription
.
class
,
result
.
getJSONArray
(
"update"
));
return
null
;
});
if
(
nextTimestamp
>
0
&&
(
timestamp
==
0
||
nextTimestamp
<
timestamp
))
{
final
long
_next
=
nextTimestamp
;
return
saveToDB
.
onSuccessTask
(
_task
->
getRoomSubscriptionRecursive
(
_next
));
}
else
{
return
saveToDB
.
onSuccessTask
(
_task
->
Task
.
forResult
(
0L
));
}
}
catch
(
JSONException
exception
)
{
return
Task
.
forError
(
exception
);
}
});
}
private
Task
<
Long
>
getRoomRecursive
(
long
timestamp
)
{
return
call
(
"rooms/get"
,
param
->
param
.
put
(
"$date"
,
timestamp
),
task
->
{
JSONObject
result
=
task
.
getResult
();
long
nextTimestamp
=
0
;
try
{
nextTimestamp
=
result
.
getJSONArray
(
"remove"
)
.
getJSONObject
(
0
).
getJSONObject
(
"_deletedAt"
).
getLong
(
"$date"
);
}
catch
(
JSONException
exception
)
{
}
try
{
JSONArray
updatedRooms
=
result
.
getJSONArray
(
"update"
);
for
(
int
i
=
0
;
i
<
updatedRooms
.
length
();
i
++)
{
JSONObject
roomJson
=
updatedRooms
.
getJSONObject
(
i
);
String
rid
=
roomJson
.
getString
(
"_id"
);
roomJson
.
put
(
"rid"
,
rid
)
.
put
(
"serverConfigId"
,
serverConfigId
)
.
remove
(
"_id"
);
}
Task
<
Void
>
saveToDB
=
RealmHelperBolts
.
executeTransaction
(
realm
->
{
realm
.
createOrUpdateAllFromJson
(
RoomSubscription
.
class
,
result
.
getJSONArray
(
"update"
));
return
null
;
});
if
(
nextTimestamp
>
0
&&
(
timestamp
==
0
||
nextTimestamp
<
timestamp
))
{
final
long
_next
=
nextTimestamp
;
return
saveToDB
.
onSuccessTask
(
_task
->
getRoomRecursive
(
_next
));
}
else
{
return
saveToDB
.
onSuccessTask
(
_task
->
Task
.
forResult
(
0L
));
}
}
catch
(
JSONException
exception
)
{
return
Task
.
forError
(
exception
);
}
});
}
}
app/src/main/java/chat/rocket/android/layouthelper/chatroom/RoomListManager.java
View file @
8035b4a7
...
...
@@ -3,7 +3,7 @@ package chat.rocket.android.layouthelper.chatroom;
import
android.view.View
;
import
android.view.ViewGroup
;
import
chat.rocket.android.helper.TextUtils
;
import
chat.rocket.android.model.Room
;
import
chat.rocket.android.model.Room
Subscription
;
import
chat.rocket.android.widget.internal.RoomListItemView
;
import
java.util.List
;
...
...
@@ -34,21 +34,21 @@ public class RoomListManager {
/**
* update ViewGroups with room list.
*/
public
void
setRooms
(
List
<
Room
>
room
List
)
{
for
(
Room
room
:
room
List
)
{
String
name
=
room
.
getName
();
public
void
setRooms
(
List
<
Room
Subscription
>
roomSubscription
List
)
{
for
(
Room
Subscription
roomSubscription
:
roomSubscription
List
)
{
String
name
=
room
Subscription
.
getName
();
if
(
TextUtils
.
isEmpty
(
name
))
{
continue
;
}
String
type
=
room
.
getT
();
String
type
=
room
Subscription
.
getT
();
if
(
Room
.
TYPE_CHANNEL
.
equals
(
type
)
||
Room
.
TYPE_PRIVATE
.
equals
(
type
))
{
insertOrUpdateItem
(
channelsContainer
,
room
);
if
(
Room
Subscription
.
TYPE_CHANNEL
.
equals
(
type
)
||
RoomSubscription
.
TYPE_PRIVATE
.
equals
(
type
))
{
insertOrUpdateItem
(
channelsContainer
,
room
Subscription
);
removeItemIfExists
(
dmContainer
,
name
);
}
else
if
(
Room
.
TYPE_DIRECT_MESSAGE
.
equals
(
type
))
{
}
else
if
(
Room
Subscription
.
TYPE_DIRECT_MESSAGE
.
equals
(
type
))
{
removeItemIfExists
(
channelsContainer
,
name
);
insertOrUpdateItem
(
dmContainer
,
room
);
insertOrUpdateItem
(
dmContainer
,
room
Subscription
);
}
}
}
...
...
@@ -60,15 +60,15 @@ public class RoomListManager {
this
.
listener
=
listener
;
}
private
void
insertOrUpdateItem
(
ViewGroup
parent
,
Room
room
)
{
final
String
roomName
=
room
.
getName
();
private
void
insertOrUpdateItem
(
ViewGroup
parent
,
Room
Subscription
roomSubscription
)
{
final
String
roomName
=
room
Subscription
.
getName
();
int
index
;
for
(
index
=
0
;
index
<
parent
.
getChildCount
();
index
++)
{
RoomListItemView
roomListItemView
=
(
RoomListItemView
)
parent
.
getChildAt
(
index
);
final
String
targetRoomName
=
roomListItemView
.
getRoomName
();
if
(
roomName
.
equals
(
targetRoomName
))
{
updateRoomItemView
(
roomListItemView
,
room
);
updateRoomItemView
(
roomListItemView
,
room
Subscription
);
return
;
}
if
(
roomName
.
compareToIgnoreCase
(
targetRoomName
)
<
0
)
{
...
...
@@ -77,7 +77,7 @@ public class RoomListManager {
}
RoomListItemView
roomListItemView
=
new
RoomListItemView
(
parent
.
getContext
());
updateRoomItemView
(
roomListItemView
,
room
);
updateRoomItemView
(
roomListItemView
,
room
Subscription
);
if
(
index
==
parent
.
getChildCount
())
{
parent
.
addView
(
roomListItemView
);
}
else
{
...
...
@@ -85,12 +85,12 @@ public class RoomListManager {
}
}
private
void
updateRoomItemView
(
RoomListItemView
roomListItemView
,
Room
room
)
{
private
void
updateRoomItemView
(
RoomListItemView
roomListItemView
,
Room
Subscription
roomSubscription
)
{
roomListItemView
.
setRoomId
(
room
.
get_
id
())
.
setRoomName
(
room
.
getName
())
.
setRoomType
(
room
.
getT
())
.
set
AlertCount
(
0
);
// TODO not implemented yet.
.
setRoomId
(
room
Subscription
.
getR
id
())
.
setRoomName
(
room
Subscription
.
getName
())
.
setRoomType
(
room
Subscription
.
getT
())
.
set
UnreadCount
(
roomSubscription
.
getUnread
());
roomListItemView
.
setOnClickListener
(
this
::
onItemClick
);
}
...
...
app/src/main/java/chat/rocket/android/model/Email.java
0 → 100644
View file @
8035b4a7
package
chat
.
rocket
.
android
.
model
;
import
io.realm.RealmObject
;
import
io.realm.annotations.PrimaryKey
;
/**
*/
public
class
Email
extends
RealmObject
{
@PrimaryKey
private
String
address
;
private
boolean
verified
;
}
app/src/main/java/chat/rocket/android/model/MeteorLoginServiceConfiguration.java
View file @
8035b4a7
...
...
@@ -6,22 +6,23 @@ import io.realm.annotations.PrimaryKey;
/**
* subscription model for "meteor_accounts_loginServiceConfiguration".
*/
@SuppressWarnings
(
"PMD.ShortVariable"
)
@SuppressWarnings
({
"PMD.ShortClassName"
,
"PMD.ShortVariable"
,
"PMD.MethodNamingConventions"
,
"PMD.VariableNamingConventions"
})
public
class
MeteorLoginServiceConfiguration
extends
RealmObject
{
@PrimaryKey
private
String
id
;
@PrimaryKey
private
String
_
id
;
private
String
serverConfigId
;
private
String
service
;
private
String
consumerKey
;
//for Twitter
private
String
appId
;
//for Facebook
private
String
clientId
;
//for other auth providers
public
String
get
I
d
()
{
return
id
;
public
String
get
_i
d
()
{
return
_
id
;
}
public
void
set
Id
(
String
id
)
{
this
.
id
=
id
;
public
void
set
_id
(
String
_
id
)
{
this
.
_id
=
_
id
;
}
public
String
getServerConfigId
()
{
...
...
app/src/main/java/chat/rocket/android/model/Room.java
→
app/src/main/java/chat/rocket/android/model/Room
Subscription
.java
View file @
8035b4a7
...
...
@@ -4,21 +4,24 @@ import io.realm.RealmObject;
import
io.realm.annotations.PrimaryKey
;
/**
* Chat Room.
* Chat Room
(Subscription)
.
*/
@SuppressWarnings
({
"PMD.ShortClassName"
,
"PMD.ShortVariable"
,
"PMD.MethodNamingConventions"
,
"PMD.VariableNamingConventions"
})
public
class
Room
extends
RealmObject
{
public
class
Room
Subscription
extends
RealmObject
{
public
static
final
String
TYPE_CHANNEL
=
"c"
;
public
static
final
String
TYPE_PRIVATE
=
"p"
;
public
static
final
String
TYPE_DIRECT_MESSAGE
=
"d"
;
@PrimaryKey
private
String
_id
;
private
String
_id
;
//subscriptionId
private
String
serverConfigId
;
@PrimaryKey
private
String
rid
;
//roomId
private
String
name
;
//private User u; // REMARK: do not save u, because it is just me.
private
String
t
;
//type { c: channel, d: direct message, p: private }
private
User
u
;
//User who created this room.
private
String
topic
;
private
boolean
open
;
private
boolean
alert
;
private
int
unread
;
public
String
get_id
()
{
return
_id
;
...
...
@@ -36,6 +39,14 @@ public class Room extends RealmObject {
this
.
serverConfigId
=
serverConfigId
;
}
public
String
getRid
()
{
return
rid
;
}
public
void
setRid
(
String
rid
)
{
this
.
rid
=
rid
;
}
public
String
getName
()
{
return
name
;
}
...
...
@@ -52,19 +63,27 @@ public class Room extends RealmObject {
this
.
t
=
t
;
}
public
User
getU
()
{
return
u
;
public
boolean
isOpen
()
{
return
open
;
}
public
void
setOpen
(
boolean
open
)
{
this
.
open
=
open
;
}
public
boolean
isAlert
()
{
return
alert
;
}
public
void
set
U
(
User
u
)
{
this
.
u
=
u
;
public
void
set
Alert
(
boolean
alert
)
{
this
.
alert
=
alert
;
}
public
String
getTopic
()
{
return
topic
;
public
int
getUnread
()
{
return
unread
;
}
public
void
set
Topic
(
String
topic
)
{
this
.
topic
=
topic
;
public
void
set
Unread
(
int
unread
)
{
this
.
unread
=
unread
;
}
}
app/src/main/java/chat/rocket/android/model/User.java
View file @
8035b4a7
package
chat
.
rocket
.
android
.
model
;
import
io.realm.RealmList
;
import
io.realm.RealmObject
;
import
io.realm.annotations.PrimaryKey
;
...
...
@@ -11,4 +12,47 @@ import io.realm.annotations.PrimaryKey;
public
class
User
extends
RealmObject
{
@PrimaryKey
private
String
_id
;
private
String
username
;
private
String
status
;
private
double
utcOffset
;
private
RealmList
<
Email
>
emails
;
public
String
get_id
()
{
return
_id
;
}
public
void
set_id
(
String
_id
)
{
this
.
_id
=
_id
;
}
public
String
getUsername
()
{
return
username
;
}
public
void
setUsername
(
String
username
)
{
this
.
username
=
username
;
}
public
String
getStatus
()
{
return
status
;
}
public
void
setStatus
(
String
status
)
{
this
.
status
=
status
;
}
public
double
getUtcOffset
()
{
return
utcOffset
;
}
public
void
setUtcOffset
(
double
utcOffset
)
{
this
.
utcOffset
=
utcOffset
;
}
public
RealmList
<
Email
>
getEmails
()
{
return
emails
;
}
public
void
setEmails
(
RealmList
<
Email
>
emails
)
{
this
.
emails
=
emails
;
}
}
app/src/main/java/chat/rocket/android/service/RocketChatWebSocketThread.java
View file @
8035b4a7
...
...
@@ -9,6 +9,7 @@ import bolts.TaskCompletionSource;
import
chat.rocket.android.helper.LogcatIfError
;
import
chat.rocket.android.helper.TextUtils
;
import
chat.rocket.android.model.ServerConfig
;
import
chat.rocket.android.service.ddp_subscriber.ActiveUsersSubscriber
;
import
chat.rocket.android.service.ddp_subscriber.LoginServiceConfigurationSubscriber
;
import
chat.rocket.android.service.observer.MethodCallObserver
;
import
chat.rocket.android.service.observer.SessionObserver
;
...
...
@@ -30,6 +31,7 @@ import timber.log.Timber;
public
class
RocketChatWebSocketThread
extends
HandlerThread
{
private
static
final
Class
[]
REGISTERABLE_CLASSES
=
{
LoginServiceConfigurationSubscriber
.
class
,
ActiveUsersSubscriber
.
class
,
TokenLoginObserver
.
class
,
MethodCallObserver
.
class
,
SessionObserver
.
class
...
...
app/src/main/java/chat/rocket/android/service/ddp_subscriber/AbstractDDPDocEventSubscriber.java
View file @
8035b4a7
...
...
@@ -92,7 +92,7 @@ abstract class AbstractDDPDocEventSubscriber implements Registerable {
private
void
onDocumentAdded
(
Realm
realm
,
DDPSubscription
.
Added
docEvent
)
throws
JSONException
{
//executed in RealmTransaction
JSONObject
json
=
new
JSONObject
().
put
(
"id"
,
docEvent
.
docID
);
JSONObject
json
=
new
JSONObject
().
put
(
"
_
id"
,
docEvent
.
docID
);
json
.
put
(
"serverConfigId"
,
serverConfigId
);
mergeJson
(
json
,
docEvent
.
fields
);
realm
.
createOrUpdateObjectFromJson
(
getModelClass
(),
customizeFieldJson
(
json
));
...
...
@@ -108,7 +108,7 @@ abstract class AbstractDDPDocEventSubscriber implements Registerable {
private
void
onDocumentChanged
(
Realm
realm
,
DDPSubscription
.
Changed
docEvent
)
throws
JSONException
{
//executed in RealmTransaction
JSONObject
json
=
new
JSONObject
().
put
(
"id"
,
docEvent
.
docID
);
JSONObject
json
=
new
JSONObject
().
put
(
"
_
id"
,
docEvent
.
docID
);
json
.
put
(
"serverConfigId"
,
serverConfigId
);
for
(
int
i
=
0
;
i
<
docEvent
.
cleared
.
length
();
i
++)
{
String
fieldToDelete
=
docEvent
.
cleared
.
getString
(
i
);
...
...
@@ -128,7 +128,7 @@ abstract class AbstractDDPDocEventSubscriber implements Registerable {
private
void
onDocumentRemoved
(
Realm
realm
,
DDPSubscription
.
Removed
docEvent
)
throws
JSONException
{
//executed in RealmTransaction
realm
.
where
(
getModelClass
()).
equalTo
(
"id"
,
docEvent
.
docID
).
findAll
().
deleteAllFromRealm
();
realm
.
where
(
getModelClass
()).
equalTo
(
"
_
id"
,
docEvent
.
docID
).
findAll
().
deleteAllFromRealm
();
}
private
void
mergeJson
(
JSONObject
target
,
JSONObject
src
)
throws
JSONException
{
...
...
app/src/main/java/chat/rocket/android/service/ddp_subscriber/ActiveUsersSubscriber.java
0 → 100644
View file @
8035b4a7
package
chat
.
rocket
.
android
.
service
.
ddp_subscriber
;
import
android.content.Context
;
import
chat.rocket.android.model.User
;
import
chat.rocket.android.ws.RocketChatWebSocketAPI
;
import
io.realm.RealmObject
;
/**
*/
public
class
ActiveUsersSubscriber
extends
AbstractDDPDocEventSubscriber
{
public
ActiveUsersSubscriber
(
Context
context
,
String
serverConfigId
,
RocketChatWebSocketAPI
api
)
{
super
(
context
,
serverConfigId
,
api
);
}
@Override
protected
String
getSubscriptionName
()
{
return
"activeUsers"
;
}
@Override
protected
String
getSubscriptionCallbackName
()
{
return
"users"
;
}
@Override
protected
Class
<?
extends
RealmObject
>
getModelClass
()
{
return
User
.
class
;
}
}
app/src/main/java/chat/rocket/android/service/observer/SessionObserver.java
View file @
8035b4a7
...
...
@@ -52,7 +52,8 @@ public class SessionObserver extends AbstractModelObserver<ServerConfig> {
}
@DebugLog
private
void
onLogin
()
{
new
MethodCallHelper
(
serverConfigId
).
getRooms
()
final
MethodCallHelper
methodCallHelper
=
new
MethodCallHelper
(
serverConfigId
);
methodCallHelper
.
getRooms
()
.
continueWith
(
new
LogcatIfError
());
}
...
...
rocket-chat-android-widgets/src/main/java/chat/rocket/android/widget/internal/RoomListItemView.java
View file @
8035b4a7
...
...
@@ -77,7 +77,7 @@ public class RoomListItemView extends LinearLayout {
return
this
;
}
public
RoomListItemView
set
Alert
Count
(
int
count
)
{
public
RoomListItemView
set
Unread
Count
(
int
count
)
{
View
alertCountContainer
=
findViewById
(
R
.
id
.
alert_count_container
);
TextView
alertCount
=
(
TextView
)
findViewById
(
R
.
id
.
alert_count
);
if
(
count
>
0
)
{
...
...
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