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
c389c82d
Commit
c389c82d
authored
Dec 30, 2016
by
Yusuke Iwaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove "push" related codes
parent
0ab3f4a1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
2 additions
and
79 deletions
+2
-79
RocketChatCache.java
app/src/main/java/chat/rocket/android/RocketChatCache.java
+0
-17
MethodCallHelper.java
...c/main/java/chat/rocket/android/api/MethodCallHelper.java
+2
-18
ServerConfig.java
...src/main/java/chat/rocket/android/model/ServerConfig.java
+0
-10
PushUpdate.java
...ain/java/chat/rocket/android/model/params/PushUpdate.java
+0
-34
No files found.
app/src/main/java/chat/rocket/android/RocketChatCache.java
View file @
c389c82d
...
...
@@ -3,8 +3,6 @@ package chat.rocket.android;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
java.util.UUID
;
/**
* sharedpreference-based cache.
*/
...
...
@@ -12,25 +10,10 @@ public class RocketChatCache {
public
static
final
String
KEY_SELECTED_SERVER_CONFIG_ID
=
"selectedServerConfigId"
;
public
static
final
String
KEY_SELECTED_ROOM_ID
=
"selectedRoomId"
;
private
static
final
String
PUSH_ID
=
"pushId"
;
/**
* get SharedPreference instance for RocketChat application cache.
*/
public
static
SharedPreferences
get
(
Context
context
)
{
return
context
.
getSharedPreferences
(
"cache"
,
Context
.
MODE_PRIVATE
);
}
public
static
String
getPushId
(
Context
context
)
{
SharedPreferences
preferences
=
get
(
context
);
String
pushId
=
null
;
if
(!
preferences
.
contains
(
PUSH_ID
))
{
// generates one and save
pushId
=
UUID
.
randomUUID
().
toString
();
SharedPreferences
.
Editor
editor
=
preferences
.
edit
();
editor
.
putString
(
PUSH_ID
,
pushId
);
editor
.
apply
();
}
return
preferences
.
getString
(
PUSH_ID
,
pushId
);
}
}
app/src/main/java/chat/rocket/android/api/MethodCallHelper.java
View file @
c389c82d
package
chat
.
rocket
.
android
.
api
;
import
android.content.Context
;
import
android.support.annotation.NonNull
;
import
android.support.annotation.Nullable
;
import
android.util.Patterns
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
...
...
@@ -19,7 +17,6 @@ import chat.rocket.android.model.ddp.PublicSetting;
import
chat.rocket.android.model.ddp.RoomSubscription
;
import
chat.rocket.android.model.internal.MethodCall
;
import
chat.rocket.android.model.internal.Session
;
import
chat.rocket.android.model.params.PushUpdate
;
import
chat.rocket.android.realm_helper.RealmHelper
;
import
chat.rocket.android.realm_helper.RealmStore
;
import
chat.rocket.android_ddp.DDPClientCallback
;
...
...
@@ -27,7 +24,6 @@ import hugo.weaving.DebugLog;
/**
* Utility class for creating/handling MethodCall or RPC.
*
* TODO: separate method into several manager classes (SubscriptionManager, MessageManager, ...).
*/
public
class
MethodCallHelper
{
...
...
@@ -41,8 +37,9 @@ public class MethodCallHelper {
protected
final
RealmHelper
realmHelper
;
protected
final
DDPClientWrapper
ddpClient
;
@Deprecated
/**
*
initialize with ServerConfigI
d.
*
Deprecated. use MethodCall(Context, String) instea
d.
*/
public
MethodCallHelper
(
String
serverConfigId
)
{
this
(
null
,
serverConfigId
);
...
...
@@ -307,19 +304,6 @@ public class MethodCallHelper {
.
onSuccessTask
(
task
->
Task
.
forResult
(
null
));
}
public
Task
<
Void
>
pushUpdate
(
@NonNull
String
pushId
,
@NonNull
String
token
,
@Nullable
String
userId
)
{
return
call
(
"raix:push-update"
,
TIMEOUT_MS
,
()
->
{
JSONObject
param
=
new
PushUpdate
(
pushId
,
token
,
userId
).
toJson
();
return
new
JSONArray
().
put
(
param
);
}).
onSuccessTask
(
task
->
Task
.
forResult
(
null
));
}
public
Task
<
Void
>
pushSetUser
(
String
pushId
)
{
return
call
(
"raix:push-setuser"
,
TIMEOUT_MS
,
()
->
new
JSONArray
().
put
(
pushId
))
.
onSuccessTask
(
task
->
Task
.
forResult
(
null
));
}
/**
* send message.
*/
...
...
app/src/main/java/chat/rocket/android/model/ServerConfig.java
View file @
c389c82d
...
...
@@ -20,7 +20,6 @@ public class ServerConfig extends RealmObject {
public
static
final
String
STATE
=
"state"
;
public
static
final
String
SESSION
=
"session"
;
public
static
final
String
ERROR
=
"error"
;
public
static
final
String
SYNC_PUSH_TOKEN
=
"syncPushToken"
;
public
static
final
int
STATE_READY
=
0
;
public
static
final
int
STATE_CONNECTING
=
1
;
...
...
@@ -32,7 +31,6 @@ public class ServerConfig extends RealmObject {
private
int
state
;
private
String
session
;
private
String
error
;
private
boolean
syncPushToken
;
/**
* Log the server connection is lost due to some exception.
...
...
@@ -102,12 +100,4 @@ public class ServerConfig extends RealmObject {
public
void
setError
(
String
error
)
{
this
.
error
=
error
;
}
public
boolean
shouldSyncPushToken
()
{
return
syncPushToken
;
}
public
void
setSyncPushToken
(
boolean
syncPushToken
)
{
this
.
syncPushToken
=
syncPushToken
;
}
}
app/src/main/java/chat/rocket/android/model/params/PushUpdate.java
deleted
100644 → 0
View file @
0ab3f4a1
package
chat
.
rocket
.
android
.
model
.
params
;
import
android.support.annotation.NonNull
;
import
android.support.annotation.Nullable
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
public
class
PushUpdate
{
private
String
pushId
;
private
String
gcmToken
;
private
String
userId
;
public
PushUpdate
(
@NonNull
String
pushId
,
@NonNull
String
gcmToken
,
@Nullable
String
userId
)
{
this
.
pushId
=
pushId
;
this
.
gcmToken
=
gcmToken
;
this
.
userId
=
userId
;
}
public
JSONObject
toJson
()
throws
JSONException
{
JSONObject
param
=
new
JSONObject
();
param
.
put
(
"id"
,
pushId
);
param
.
put
(
"appName"
,
"main"
);
param
.
put
(
"userId"
,
userId
);
param
.
put
(
"metadata"
,
new
JSONObject
());
JSONObject
tokenParam
=
new
JSONObject
();
tokenParam
.
put
(
"gcm"
,
gcmToken
);
param
.
put
(
"token"
,
tokenParam
);
return
param
;
}
}
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