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
1c0e06e7
Commit
1c0e06e7
authored
Feb 16, 2017
by
Tiago Cunha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Log if error logs to firebase. Should help
parent
b5cf7b21
Changes
19
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
55 additions
and
49 deletions
+55
-49
build.gradle
app/build.gradle
+3
-3
MainActivity.java
.../main/java/chat/rocket/android/activity/MainActivity.java
+3
-3
RoomPresenter.java
.../chat/rocket/android/fragment/chatroom/RoomPresenter.java
+2
-2
UsersOfRoomDialogFragment.java
...d/fragment/chatroom/dialog/UsersOfRoomDialogFragment.java
+2
-2
AbstractOAuthFragment.java
.../rocket/android/fragment/oauth/AbstractOAuthFragment.java
+2
-2
SidebarMainPresenter.java
...rocket/android/fragment/sidebar/SidebarMainPresenter.java
+3
-3
FileUploadHelper.java
...ain/java/chat/rocket/android/helper/FileUploadHelper.java
+1
-1
LogIfError.java
app/src/main/java/chat/rocket/android/helper/LogIfError.java
+8
-2
RocketChatWebSocketThread.java
...hat/rocket/android/service/RocketChatWebSocketThread.java
+2
-2
AbstractDDPDocEventSubscriber.java
...et/android/service/ddp/AbstractDDPDocEventSubscriber.java
+7
-7
AbstractStreamNotifyEventSubscriber.java
...rvice/ddp/stream/AbstractStreamNotifyEventSubscriber.java
+3
-3
CurrentUserObserver.java
.../rocket/android/service/observer/CurrentUserObserver.java
+2
-2
FileUploadingToS3Observer.java
...t/android/service/observer/FileUploadingToS3Observer.java
+3
-3
FileUploadingWithUfsObserver.java
...ndroid/service/observer/FileUploadingWithUfsObserver.java
+2
-2
GcmPushRegistrationObserver.java
...android/service/observer/GcmPushRegistrationObserver.java
+2
-2
MethodCallObserver.java
...t/rocket/android/service/observer/MethodCallObserver.java
+3
-3
NewMessageObserver.java
...t/rocket/android/service/observer/NewMessageObserver.java
+2
-2
SessionObserver.java
...chat/rocket/android/service/observer/SessionObserver.java
+3
-3
TokenLoginObserver.java
...t/rocket/android/service/observer/TokenLoginObserver.java
+2
-2
No files found.
app/build.gradle
View file @
1c0e06e7
...
@@ -95,10 +95,10 @@ dependencies {
...
@@ -95,10 +95,10 @@ dependencies {
}
}
compile
'com.android.support:multidex:1.0.1'
compile
'com.android.support:multidex:1.0.1'
compile
'com.google.firebase:firebase-core:10.
0
.0'
compile
'com.google.firebase:firebase-core:10.
2
.0'
compile
'com.google.firebase:firebase-crash:10.
0
.0'
compile
'com.google.firebase:firebase-crash:10.
2
.0'
compile
'com.google.android.gms:play-services-gcm:10.
0
.0'
compile
'com.google.android.gms:play-services-gcm:10.
2
.0'
compile
rootProject
.
ext
.
okhttp3
compile
rootProject
.
ext
.
okhttp3
...
...
app/src/main/java/chat/rocket/android/activity/MainActivity.java
View file @
1c0e06e7
...
@@ -14,7 +14,7 @@ import chat.rocket.android.api.MethodCallHelper;
...
@@ -14,7 +14,7 @@ import chat.rocket.android.api.MethodCallHelper;
import
chat.rocket.android.fragment.chatroom.HomeFragment
;
import
chat.rocket.android.fragment.chatroom.HomeFragment
;
import
chat.rocket.android.fragment.chatroom.RoomFragment
;
import
chat.rocket.android.fragment.chatroom.RoomFragment
;
import
chat.rocket.android.fragment.sidebar.SidebarMainFragment
;
import
chat.rocket.android.fragment.sidebar.SidebarMainFragment
;
import
chat.rocket.android.helper.Log
cat
IfError
;
import
chat.rocket.android.helper.LogIfError
;
import
chat.rocket.core.interactors.CanCreateRoomInteractor
;
import
chat.rocket.core.interactors.CanCreateRoomInteractor
;
import
chat.rocket.core.interactors.RoomInteractor
;
import
chat.rocket.core.interactors.RoomInteractor
;
import
chat.rocket.core.interactors.SessionInteractor
;
import
chat.rocket.core.interactors.SessionInteractor
;
...
@@ -91,14 +91,14 @@ public class MainActivity extends AbstractAuthedActivity implements MainContract
...
@@ -91,14 +91,14 @@ public class MainActivity extends AbstractAuthedActivity implements MainContract
private
void
setUserOnlineIfServerAvailable
()
{
private
void
setUserOnlineIfServerAvailable
()
{
if
(
hostname
!=
null
)
{
if
(
hostname
!=
null
)
{
new
MethodCallHelper
(
this
,
hostname
).
setUserPresence
(
User
.
STATUS_ONLINE
)
new
MethodCallHelper
(
this
,
hostname
).
setUserPresence
(
User
.
STATUS_ONLINE
)
.
continueWith
(
new
Log
cat
IfError
());
.
continueWith
(
new
LogIfError
());
}
}
}
}
private
void
setUserAwayIfServerAvailable
()
{
private
void
setUserAwayIfServerAvailable
()
{
if
(
hostname
!=
null
)
{
if
(
hostname
!=
null
)
{
new
MethodCallHelper
(
this
,
hostname
).
setUserPresence
(
User
.
STATUS_AWAY
)
new
MethodCallHelper
(
this
,
hostname
).
setUserPresence
(
User
.
STATUS_AWAY
)
.
continueWith
(
new
Log
cat
IfError
());
.
continueWith
(
new
LogIfError
());
}
}
}
}
...
...
app/src/main/java/chat/rocket/android/fragment/chatroom/RoomPresenter.java
View file @
1c0e06e7
...
@@ -6,7 +6,7 @@ import android.support.v4.util.Pair;
...
@@ -6,7 +6,7 @@ import android.support.v4.util.Pair;
import
chat.rocket.android.BackgroundLooper
;
import
chat.rocket.android.BackgroundLooper
;
import
chat.rocket.android.api.MethodCallHelper
;
import
chat.rocket.android.api.MethodCallHelper
;
import
chat.rocket.android.helper.Log
cat
IfError
;
import
chat.rocket.android.helper.LogIfError
;
import
chat.rocket.android.shared.BasePresenter
;
import
chat.rocket.android.shared.BasePresenter
;
import
chat.rocket.core.SyncState
;
import
chat.rocket.core.SyncState
;
import
chat.rocket.core.interactors.MessageInteractor
;
import
chat.rocket.core.interactors.MessageInteractor
;
...
@@ -153,7 +153,7 @@ public class RoomPresenter extends BasePresenter<RoomContract.View>
...
@@ -153,7 +153,7 @@ public class RoomPresenter extends BasePresenter<RoomContract.View>
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
(
.
subscribe
(
room
->
methodCallHelper
.
readMessages
(
room
.
getRoomId
())
room
->
methodCallHelper
.
readMessages
(
room
.
getRoomId
())
.
continueWith
(
new
Log
cat
IfError
())
.
continueWith
(
new
LogIfError
())
);
);
addSubscription
(
subscription
);
addSubscription
(
subscription
);
...
...
app/src/main/java/chat/rocket/android/fragment/chatroom/dialog/UsersOfRoomDialogFragment.java
View file @
1c0e06e7
...
@@ -14,7 +14,7 @@ import org.json.JSONObject;
...
@@ -14,7 +14,7 @@ import org.json.JSONObject;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
chat.rocket.android.R
;
import
chat.rocket.android.R
;
import
chat.rocket.android.helper.Log
cat
IfError
;
import
chat.rocket.android.helper.LogIfError
;
import
chat.rocket.android.layouthelper.chatroom.dialog.RoomUserAdapter
;
import
chat.rocket.android.layouthelper.chatroom.dialog.RoomUserAdapter
;
import
chat.rocket.android.log.RCLog
;
import
chat.rocket.android.log.RCLog
;
import
chat.rocket.core.SyncState
;
import
chat.rocket.core.SyncState
;
...
@@ -92,7 +92,7 @@ public class UsersOfRoomDialogFragment extends AbstractChatRoomDialogFragment {
...
@@ -92,7 +92,7 @@ public class UsersOfRoomDialogFragment extends AbstractChatRoomDialogFragment {
ConnectivityManager
.
getInstance
(
getContext
().
getApplicationContext
())
ConnectivityManager
.
getInstance
(
getContext
().
getApplicationContext
())
.
keepAliveServer
();
.
keepAliveServer
();
return
task
;
return
task
;
}).
continueWith
(
new
Log
cat
IfError
());
}).
continueWith
(
new
LogIfError
());
}
}
@Override
@Override
...
...
app/src/main/java/chat/rocket/android/fragment/oauth/AbstractOAuthFragment.java
View file @
1c0e06e7
...
@@ -12,7 +12,7 @@ import org.json.JSONObject;
...
@@ -12,7 +12,7 @@ import org.json.JSONObject;
import
java.nio.charset.Charset
;
import
java.nio.charset.Charset
;
import
chat.rocket.android.api.MethodCallHelper
;
import
chat.rocket.android.api.MethodCallHelper
;
import
chat.rocket.android.fragment.AbstractWebViewFragment
;
import
chat.rocket.android.fragment.AbstractWebViewFragment
;
import
chat.rocket.android.helper.Log
cat
IfError
;
import
chat.rocket.android.helper.LogIfError
;
import
chat.rocket.android.log.RCLog
;
import
chat.rocket.android.log.RCLog
;
import
chat.rocket.persistence.realm.models.ddp.RealmMeteorLoginServiceConfiguration
;
import
chat.rocket.persistence.realm.models.ddp.RealmMeteorLoginServiceConfiguration
;
import
chat.rocket.persistence.realm.RealmStore
;
import
chat.rocket.persistence.realm.RealmStore
;
...
@@ -111,7 +111,7 @@ public abstract class AbstractOAuthFragment extends AbstractWebViewFragment {
...
@@ -111,7 +111,7 @@ public abstract class AbstractOAuthFragment extends AbstractWebViewFragment {
private
void
handleOAuthCallback
(
final
String
credentialToken
,
final
String
credentialSecret
)
{
private
void
handleOAuthCallback
(
final
String
credentialToken
,
final
String
credentialSecret
)
{
new
MethodCallHelper
(
getContext
(),
hostname
)
new
MethodCallHelper
(
getContext
(),
hostname
)
.
loginWithOAuth
(
credentialToken
,
credentialSecret
)
.
loginWithOAuth
(
credentialToken
,
credentialSecret
)
.
continueWith
(
new
Log
cat
IfError
());
.
continueWith
(
new
LogIfError
());
}
}
protected
void
onOAuthCompleted
()
{
protected
void
onOAuthCompleted
()
{
...
...
app/src/main/java/chat/rocket/android/fragment/sidebar/SidebarMainPresenter.java
View file @
1c0e06e7
...
@@ -4,7 +4,7 @@ import android.support.annotation.NonNull;
...
@@ -4,7 +4,7 @@ import android.support.annotation.NonNull;
import
chat.rocket.android.BackgroundLooper
;
import
chat.rocket.android.BackgroundLooper
;
import
chat.rocket.android.api.MethodCallHelper
;
import
chat.rocket.android.api.MethodCallHelper
;
import
chat.rocket.android.helper.Log
cat
IfError
;
import
chat.rocket.android.helper.LogIfError
;
import
chat.rocket.android.helper.TextUtils
;
import
chat.rocket.android.helper.TextUtils
;
import
chat.rocket.android.shared.BasePresenter
;
import
chat.rocket.android.shared.BasePresenter
;
import
chat.rocket.core.interactors.RoomInteractor
;
import
chat.rocket.core.interactors.RoomInteractor
;
...
@@ -67,7 +67,7 @@ public class SidebarMainPresenter extends BasePresenter<SidebarMainContract.View
...
@@ -67,7 +67,7 @@ public class SidebarMainPresenter extends BasePresenter<SidebarMainContract.View
@Override
@Override
public
void
onLogout
()
{
public
void
onLogout
()
{
if
(
methodCallHelper
!=
null
)
{
if
(
methodCallHelper
!=
null
)
{
methodCallHelper
.
logout
().
continueWith
(
new
Log
cat
IfError
());
methodCallHelper
.
logout
().
continueWith
(
new
LogIfError
());
}
}
}
}
...
@@ -95,7 +95,7 @@ public class SidebarMainPresenter extends BasePresenter<SidebarMainContract.View
...
@@ -95,7 +95,7 @@ public class SidebarMainPresenter extends BasePresenter<SidebarMainContract.View
private
void
updateCurrentUserStatus
(
String
status
)
{
private
void
updateCurrentUserStatus
(
String
status
)
{
if
(
methodCallHelper
!=
null
)
{
if
(
methodCallHelper
!=
null
)
{
methodCallHelper
.
setUserStatus
(
status
).
continueWith
(
new
Log
cat
IfError
());
methodCallHelper
.
setUserStatus
(
status
).
continueWith
(
new
LogIfError
());
}
}
}
}
}
}
app/src/main/java/chat/rocket/android/helper/FileUploadHelper.java
View file @
1c0e06e7
...
@@ -74,7 +74,7 @@ public class FileUploadHelper {
...
@@ -74,7 +74,7 @@ public class FileUploadHelper {
.
put
(
FileUploading
.
ROOM_ID
,
roomId
)
.
put
(
FileUploading
.
ROOM_ID
,
roomId
)
.
put
(
FileUploading
.
ERROR
,
JSONObject
.
NULL
)
.
put
(
FileUploading
.
ERROR
,
JSONObject
.
NULL
)
)
)
).
continueWith
(
new
Log
cat
IfError
());
).
continueWith
(
new
LogIfError
());
return
uplId
;
return
uplId
;
}
}
...
...
app/src/main/java/chat/rocket/android/helper/Log
cat
IfError.java
→
app/src/main/java/chat/rocket/android/helper/LogIfError.java
View file @
1c0e06e7
package
chat
.
rocket
.
android
.
helper
;
package
chat
.
rocket
.
android
.
helper
;
import
com.google.firebase.crash.FirebaseCrash
;
import
bolts.Continuation
;
import
bolts.Continuation
;
import
bolts.Task
;
import
bolts.Task
;
import
chat.rocket.android.BuildConfig
;
import
chat.rocket.android.log.RCLog
;
import
chat.rocket.android.log.RCLog
;
/**
/**
* Bolts-Task continuation for just logging if error occurred.
* Bolts-Task continuation for just logging if error occurred.
*/
*/
public
class
Log
cat
IfError
implements
Continuation
{
public
class
LogIfError
implements
Continuation
{
@Override
@Override
public
Object
then
(
Task
task
)
throws
Exception
{
public
Object
then
(
Task
task
)
throws
Exception
{
if
(
task
.
isFaulted
())
{
if
(
task
.
isFaulted
())
{
if
(
BuildConfig
.
DEBUG
)
{
RCLog
.
w
(
task
.
getError
());
RCLog
.
w
(
task
.
getError
());
}
}
FirebaseCrash
.
report
(
task
.
getError
());
}
return
task
;
return
task
;
}
}
}
}
app/src/main/java/chat/rocket/android/service/RocketChatWebSocketThread.java
View file @
1c0e06e7
...
@@ -11,7 +11,7 @@ import java.util.Iterator;
...
@@ -11,7 +11,7 @@ import java.util.Iterator;
import
bolts.Task
;
import
bolts.Task
;
import
chat.rocket.android.api.DDPClientWrapper
;
import
chat.rocket.android.api.DDPClientWrapper
;
import
chat.rocket.android.api.MethodCallHelper
;
import
chat.rocket.android.api.MethodCallHelper
;
import
chat.rocket.android.helper.Log
cat
IfError
;
import
chat.rocket.android.helper.LogIfError
;
import
chat.rocket.android.helper.TextUtils
;
import
chat.rocket.android.helper.TextUtils
;
import
chat.rocket.android.log.RCLog
;
import
chat.rocket.android.log.RCLog
;
import
chat.rocket.core.models.ServerInfo
;
import
chat.rocket.core.models.ServerInfo
;
...
@@ -135,7 +135,7 @@ public class RocketChatWebSocketThread extends HandlerThread {
...
@@ -135,7 +135,7 @@ public class RocketChatWebSocketThread extends HandlerThread {
session
.
setError
(
null
);
session
.
setError
(
null
);
}
}
return
null
;
return
null
;
}).
continueWith
(
new
Log
cat
IfError
());
}).
continueWith
(
new
LogIfError
());
}
}
/**
/**
...
...
app/src/main/java/chat/rocket/android/service/ddp/AbstractDDPDocEventSubscriber.java
View file @
1c0e06e7
...
@@ -9,7 +9,7 @@ import org.json.JSONException;
...
@@ -9,7 +9,7 @@ import org.json.JSONException;
import
org.json.JSONObject
;
import
org.json.JSONObject
;
import
java.util.Iterator
;
import
java.util.Iterator
;
import
chat.rocket.android.helper.Log
cat
IfError
;
import
chat.rocket.android.helper.LogIfError
;
import
chat.rocket.android.log.RCLog
;
import
chat.rocket.android.log.RCLog
;
import
chat.rocket.persistence.realm.RealmHelper
;
import
chat.rocket.persistence.realm.RealmHelper
;
import
chat.rocket.android.service.DDPClientRef
;
import
chat.rocket.android.service.DDPClientRef
;
...
@@ -68,7 +68,7 @@ public abstract class AbstractDDPDocEventSubscriber implements Registrable {
...
@@ -68,7 +68,7 @@ public abstract class AbstractDDPDocEventSubscriber implements Registrable {
ddpClientRef
.
get
().
subscribe
(
getSubscriptionName
(),
params
).
onSuccess
(
task
->
{
ddpClientRef
.
get
().
subscribe
(
getSubscriptionName
(),
params
).
onSuccess
(
task
->
{
if
(
isUnsubscribed
)
{
if
(
isUnsubscribed
)
{
ddpClientRef
.
get
().
unsubscribe
(
task
.
getResult
().
id
).
continueWith
(
new
Log
cat
IfError
());
ddpClientRef
.
get
().
unsubscribe
(
task
.
getResult
().
id
).
continueWith
(
new
LogIfError
());
}
else
{
}
else
{
subscriptionId
=
task
.
getResult
().
id
;
subscriptionId
=
task
.
getResult
().
id
;
}
}
...
@@ -87,7 +87,7 @@ public abstract class AbstractDDPDocEventSubscriber implements Registrable {
...
@@ -87,7 +87,7 @@ public abstract class AbstractDDPDocEventSubscriber implements Registrable {
}).
onSuccess
(
task
->
{
}).
onSuccess
(
task
->
{
rxSubscription
=
subscribe
();
rxSubscription
=
subscribe
();
return
null
;
return
null
;
}).
continueWith
(
new
Log
cat
IfError
());
}).
continueWith
(
new
LogIfError
());
}
else
{
}
else
{
rxSubscription
=
subscribe
();
rxSubscription
=
subscribe
();
}
}
...
@@ -122,7 +122,7 @@ public abstract class AbstractDDPDocEventSubscriber implements Registrable {
...
@@ -122,7 +122,7 @@ public abstract class AbstractDDPDocEventSubscriber implements Registrable {
realmHelper
.
executeTransaction
(
realm
->
{
realmHelper
.
executeTransaction
(
realm
->
{
onDocumentAdded
(
realm
,
docEvent
);
onDocumentAdded
(
realm
,
docEvent
);
return
null
;
return
null
;
}).
continueWith
(
new
Log
cat
IfError
());
}).
continueWith
(
new
LogIfError
());
}
}
private
void
onDocumentAdded
(
Realm
realm
,
DDPSubscription
.
Added
docEvent
)
throws
JSONException
{
private
void
onDocumentAdded
(
Realm
realm
,
DDPSubscription
.
Added
docEvent
)
throws
JSONException
{
...
@@ -136,7 +136,7 @@ public abstract class AbstractDDPDocEventSubscriber implements Registrable {
...
@@ -136,7 +136,7 @@ public abstract class AbstractDDPDocEventSubscriber implements Registrable {
realmHelper
.
executeTransaction
(
realm
->
{
realmHelper
.
executeTransaction
(
realm
->
{
onDocumentChanged
(
realm
,
docEvent
);
onDocumentChanged
(
realm
,
docEvent
);
return
null
;
return
null
;
}).
continueWith
(
new
Log
cat
IfError
());
}).
continueWith
(
new
LogIfError
());
}
}
private
void
onDocumentChanged
(
Realm
realm
,
DDPSubscription
.
Changed
docEvent
)
private
void
onDocumentChanged
(
Realm
realm
,
DDPSubscription
.
Changed
docEvent
)
...
@@ -157,7 +157,7 @@ public abstract class AbstractDDPDocEventSubscriber implements Registrable {
...
@@ -157,7 +157,7 @@ public abstract class AbstractDDPDocEventSubscriber implements Registrable {
realmHelper
.
executeTransaction
(
realm
->
{
realmHelper
.
executeTransaction
(
realm
->
{
onDocumentRemoved
(
realm
,
docEvent
);
onDocumentRemoved
(
realm
,
docEvent
);
return
null
;
return
null
;
}).
continueWith
(
new
Log
cat
IfError
());
}).
continueWith
(
new
LogIfError
());
}
}
private
void
onDocumentRemoved
(
Realm
realm
,
DDPSubscription
.
Removed
docEvent
)
private
void
onDocumentRemoved
(
Realm
realm
,
DDPSubscription
.
Removed
docEvent
)
...
@@ -182,7 +182,7 @@ public abstract class AbstractDDPDocEventSubscriber implements Registrable {
...
@@ -182,7 +182,7 @@ public abstract class AbstractDDPDocEventSubscriber implements Registrable {
rxSubscription
.
unsubscribe
();
rxSubscription
.
unsubscribe
();
}
}
if
(!
TextUtils
.
isEmpty
(
subscriptionId
))
{
if
(!
TextUtils
.
isEmpty
(
subscriptionId
))
{
ddpClientRef
.
get
().
unsubscribe
(
subscriptionId
).
continueWith
(
new
Log
cat
IfError
());
ddpClientRef
.
get
().
unsubscribe
(
subscriptionId
).
continueWith
(
new
LogIfError
());
}
}
}
}
}
}
app/src/main/java/chat/rocket/android/service/ddp/stream/AbstractStreamNotifyEventSubscriber.java
View file @
1c0e06e7
...
@@ -5,7 +5,7 @@ import org.json.JSONArray;
...
@@ -5,7 +5,7 @@ import org.json.JSONArray;
import
org.json.JSONException
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
org.json.JSONObject
;
import
chat.rocket.android.helper.Log
cat
IfError
;
import
chat.rocket.android.helper.LogIfError
;
import
chat.rocket.android.log.RCLog
;
import
chat.rocket.android.log.RCLog
;
import
chat.rocket.persistence.realm.RealmHelper
;
import
chat.rocket.persistence.realm.RealmHelper
;
import
chat.rocket.android.service.DDPClientRef
;
import
chat.rocket.android.service.DDPClientRef
;
...
@@ -69,11 +69,11 @@ abstract class AbstractStreamNotifyEventSubscriber extends AbstractDDPDocEventSu
...
@@ -69,11 +69,11 @@ abstract class AbstractStreamNotifyEventSubscriber extends AbstractDDPDocEventSu
realm
.
where
(
getModelClass
())
realm
.
where
(
getModelClass
())
.
equalTo
(
getPrimaryKeyForModel
(),
target
.
getString
(
getPrimaryKeyForModel
()))
.
equalTo
(
getPrimaryKeyForModel
(),
target
.
getString
(
getPrimaryKeyForModel
()))
.
findAll
().
deleteAllFromRealm
()
.
findAll
().
deleteAllFromRealm
()
).
continueWith
(
new
Log
cat
IfError
());
).
continueWith
(
new
LogIfError
());
}
else
{
//inserted, updated
}
else
{
//inserted, updated
realmHelper
.
executeTransaction
(
realm
->
realmHelper
.
executeTransaction
(
realm
->
realm
.
createOrUpdateObjectFromJson
(
getModelClass
(),
customizeFieldJson
(
target
))
realm
.
createOrUpdateObjectFromJson
(
getModelClass
(),
customizeFieldJson
(
target
))
).
continueWith
(
new
Log
cat
IfError
());
).
continueWith
(
new
LogIfError
());
}
}
}
}
}
}
app/src/main/java/chat/rocket/android/service/observer/CurrentUserObserver.java
View file @
1c0e06e7
...
@@ -7,7 +7,7 @@ import io.realm.RealmResults;
...
@@ -7,7 +7,7 @@ import io.realm.RealmResults;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
chat.rocket.android.api.MethodCallHelper
;
import
chat.rocket.android.api.MethodCallHelper
;
import
chat.rocket.android.helper.Log
cat
IfError
;
import
chat.rocket.android.helper.LogIfError
;
import
chat.rocket.persistence.realm.models.ddp.RealmUser
;
import
chat.rocket.persistence.realm.models.ddp.RealmUser
;
import
chat.rocket.persistence.realm.RealmHelper
;
import
chat.rocket.persistence.realm.RealmHelper
;
import
chat.rocket.android.service.DDPClientRef
;
import
chat.rocket.android.service.DDPClientRef
;
...
@@ -67,7 +67,7 @@ public class CurrentUserObserver extends AbstractModelObserver<RealmUser> {
...
@@ -67,7 +67,7 @@ public class CurrentUserObserver extends AbstractModelObserver<RealmUser> {
listeners
.
add
(
listener
);
listeners
.
add
(
listener
);
}
}
return
null
;
return
null
;
}).
continueWith
(
new
Log
cat
IfError
());
}).
continueWith
(
new
LogIfError
());
}
}
@DebugLog
@DebugLog
...
...
app/src/main/java/chat/rocket/android/service/observer/FileUploadingToS3Observer.java
View file @
1c0e06e7
...
@@ -12,7 +12,7 @@ import java.io.InputStream;
...
@@ -12,7 +12,7 @@ import java.io.InputStream;
import
java.util.List
;
import
java.util.List
;
import
bolts.Task
;
import
bolts.Task
;
import
chat.rocket.android.api.FileUploadingHelper
;
import
chat.rocket.android.api.FileUploadingHelper
;
import
chat.rocket.android.helper.Log
cat
IfError
;
import
chat.rocket.android.helper.LogIfError
;
import
chat.rocket.android.helper.OkHttpHelper
;
import
chat.rocket.android.helper.OkHttpHelper
;
import
chat.rocket.android.log.RCLog
;
import
chat.rocket.android.log.RCLog
;
import
chat.rocket.core.SyncState
;
import
chat.rocket.core.SyncState
;
...
@@ -59,7 +59,7 @@ public class FileUploadingToS3Observer extends AbstractModelObserver<FileUploadi
...
@@ -59,7 +59,7 @@ public class FileUploadingToS3Observer extends AbstractModelObserver<FileUploadi
.
equalTo
(
FileUploading
.
STORAGE_TYPE
,
FileUploading
.
STORAGE_TYPE_S3
)
.
equalTo
(
FileUploading
.
STORAGE_TYPE
,
FileUploading
.
STORAGE_TYPE_S3
)
.
findAll
().
deleteAllFromRealm
();
.
findAll
().
deleteAllFromRealm
();
return
null
;
return
null
;
}).
continueWith
(
new
Log
cat
IfError
());
}).
continueWith
(
new
LogIfError
());
}
}
@Override
@Override
...
@@ -137,7 +137,7 @@ public class FileUploadingToS3Observer extends AbstractModelObserver<FileUploadi
...
@@ -137,7 +137,7 @@ public class FileUploadingToS3Observer extends AbstractModelObserver<FileUploadi
realm
.
createOrUpdateObjectFromJson
(
FileUploading
.
class
,
new
JSONObject
()
realm
.
createOrUpdateObjectFromJson
(
FileUploading
.
class
,
new
JSONObject
()
.
put
(
FileUploading
.
ID
,
uplId
)
.
put
(
FileUploading
.
ID
,
uplId
)
.
put
(
FileUploading
.
UPLOADED_SIZE
,
numBytes
)))
.
put
(
FileUploading
.
UPLOADED_SIZE
,
numBytes
)))
.
continueWith
(
new
Log
cat
IfError
());
.
continueWith
(
new
LogIfError
());
}
}
}
}
}
}
...
...
app/src/main/java/chat/rocket/android/service/observer/FileUploadingWithUfsObserver.java
View file @
1c0e06e7
...
@@ -10,7 +10,7 @@ import java.io.InputStream;
...
@@ -10,7 +10,7 @@ import java.io.InputStream;
import
java.util.List
;
import
java.util.List
;
import
bolts.Task
;
import
bolts.Task
;
import
chat.rocket.android.api.FileUploadingHelper
;
import
chat.rocket.android.api.FileUploadingHelper
;
import
chat.rocket.android.helper.Log
cat
IfError
;
import
chat.rocket.android.helper.LogIfError
;
import
chat.rocket.android.helper.OkHttpHelper
;
import
chat.rocket.android.helper.OkHttpHelper
;
import
chat.rocket.android.log.RCLog
;
import
chat.rocket.android.log.RCLog
;
import
chat.rocket.core.SyncState
;
import
chat.rocket.core.SyncState
;
...
@@ -63,7 +63,7 @@ public class FileUploadingWithUfsObserver extends AbstractModelObserver<FileUplo
...
@@ -63,7 +63,7 @@ public class FileUploadingWithUfsObserver extends AbstractModelObserver<FileUplo
.
endGroup
()
.
endGroup
()
.
findAll
().
deleteAllFromRealm
();
.
findAll
().
deleteAllFromRealm
();
return
null
;
return
null
;
}).
continueWith
(
new
Log
cat
IfError
());
}).
continueWith
(
new
LogIfError
());
}
}
@Override
@Override
...
...
app/src/main/java/chat/rocket/android/service/observer/GcmPushRegistrationObserver.java
View file @
1c0e06e7
...
@@ -12,7 +12,7 @@ import java.util.List;
...
@@ -12,7 +12,7 @@ import java.util.List;
import
bolts.Task
;
import
bolts.Task
;
import
chat.rocket.android.RocketChatCache
;
import
chat.rocket.android.RocketChatCache
;
import
chat.rocket.android.api.RaixPushHelper
;
import
chat.rocket.android.api.RaixPushHelper
;
import
chat.rocket.android.helper.Log
cat
IfError
;
import
chat.rocket.android.helper.LogIfError
;
import
chat.rocket.core.SyncState
;
import
chat.rocket.core.SyncState
;
import
chat.rocket.persistence.realm.models.ddp.RealmPublicSetting
;
import
chat.rocket.persistence.realm.models.ddp.RealmPublicSetting
;
import
chat.rocket.core.PublicSettingsConstants
;
import
chat.rocket.core.PublicSettingsConstants
;
...
@@ -59,7 +59,7 @@ public class GcmPushRegistrationObserver extends AbstractModelObserver<GcmPushRe
...
@@ -59,7 +59,7 @@ public class GcmPushRegistrationObserver extends AbstractModelObserver<GcmPushRe
realmHelper
.
executeTransaction
(
realm
->
{
realmHelper
.
executeTransaction
(
realm
->
{
GcmPushRegistration
.
queryDefault
(
realm
).
findFirst
().
setSyncState
(
SyncState
.
FAILED
);
GcmPushRegistration
.
queryDefault
(
realm
).
findFirst
().
setSyncState
(
SyncState
.
FAILED
);
return
null
;
return
null
;
}).
continueWith
(
new
Log
cat
IfError
());
}).
continueWith
(
new
LogIfError
());
}
}
return
null
;
return
null
;
});
});
...
...
app/src/main/java/chat/rocket/android/service/observer/MethodCallObserver.java
View file @
1c0e06e7
...
@@ -7,7 +7,7 @@ import org.json.JSONObject;
...
@@ -7,7 +7,7 @@ import org.json.JSONObject;
import
java.util.List
;
import
java.util.List
;
import
chat.rocket.android.helper.CheckSum
;
import
chat.rocket.android.helper.CheckSum
;
import
chat.rocket.android.helper.Log
cat
IfError
;
import
chat.rocket.android.helper.LogIfError
;
import
chat.rocket.core.SyncState
;
import
chat.rocket.core.SyncState
;
import
chat.rocket.persistence.realm.models.internal.MethodCall
;
import
chat.rocket.persistence.realm.models.internal.MethodCall
;
import
chat.rocket.persistence.realm.RealmHelper
;
import
chat.rocket.persistence.realm.RealmHelper
;
...
@@ -45,7 +45,7 @@ public class MethodCallObserver extends AbstractModelObserver<MethodCall> {
...
@@ -45,7 +45,7 @@ public class MethodCallObserver extends AbstractModelObserver<MethodCall> {
.
endGroup
()
.
endGroup
()
.
findAll
().
deleteAllFromRealm
();
.
findAll
().
deleteAllFromRealm
();
return
null
;
return
null
;
}).
continueWith
(
new
Log
cat
IfError
());
}).
continueWith
(
new
LogIfError
());
}
}
@Override
@Override
...
@@ -120,6 +120,6 @@ public class MethodCallObserver extends AbstractModelObserver<MethodCall> {
...
@@ -120,6 +120,6 @@ public class MethodCallObserver extends AbstractModelObserver<MethodCall> {
});
});
}
}
return
task
;
return
task
;
}).
continueWith
(
new
Log
cat
IfError
());
}).
continueWith
(
new
LogIfError
());
}
}
}
}
app/src/main/java/chat/rocket/android/service/observer/NewMessageObserver.java
View file @
1c0e06e7
...
@@ -7,7 +7,7 @@ import org.json.JSONObject;
...
@@ -7,7 +7,7 @@ import org.json.JSONObject;
import
java.util.List
;
import
java.util.List
;
import
chat.rocket.android.api.MethodCallHelper
;
import
chat.rocket.android.api.MethodCallHelper
;
import
chat.rocket.android.helper.Log
cat
IfError
;
import
chat.rocket.android.helper.LogIfError
;
import
chat.rocket.android.log.RCLog
;
import
chat.rocket.android.log.RCLog
;
import
chat.rocket.core.SyncState
;
import
chat.rocket.core.SyncState
;
import
chat.rocket.persistence.realm.models.ddp.RealmMessage
;
import
chat.rocket.persistence.realm.models.ddp.RealmMessage
;
...
@@ -36,7 +36,7 @@ public class NewMessageObserver extends AbstractModelObserver<RealmMessage> {
...
@@ -36,7 +36,7 @@ public class NewMessageObserver extends AbstractModelObserver<RealmMessage> {
}
}
return
null
;
return
null
;
}).
continueWith
(
new
Log
cat
IfError
());
}).
continueWith
(
new
LogIfError
());
}
}
@Override
@Override
...
...
app/src/main/java/chat/rocket/android/service/observer/SessionObserver.java
View file @
1c0e06e7
...
@@ -7,7 +7,7 @@ import io.realm.RealmResults;
...
@@ -7,7 +7,7 @@ import io.realm.RealmResults;
import
java.util.List
;
import
java.util.List
;
import
chat.rocket.android.RocketChatCache
;
import
chat.rocket.android.RocketChatCache
;
import
chat.rocket.android.api.RaixPushHelper
;
import
chat.rocket.android.api.RaixPushHelper
;
import
chat.rocket.android.helper.Log
cat
IfError
;
import
chat.rocket.android.helper.LogIfError
;
import
chat.rocket.persistence.realm.models.internal.GetUsersOfRoomsProcedure
;
import
chat.rocket.persistence.realm.models.internal.GetUsersOfRoomsProcedure
;
import
chat.rocket.persistence.realm.models.internal.LoadMessageProcedure
;
import
chat.rocket.persistence.realm.models.internal.LoadMessageProcedure
;
import
chat.rocket.persistence.realm.models.internal.MethodCall
;
import
chat.rocket.persistence.realm.models.internal.MethodCall
;
...
@@ -73,7 +73,7 @@ public class SessionObserver extends AbstractModelObserver<RealmSession> {
...
@@ -73,7 +73,7 @@ public class SessionObserver extends AbstractModelObserver<RealmSession> {
// update push info
// update push info
pushHelper
pushHelper
.
pushSetUser
(
RocketChatCache
.
getOrCreatePushId
(
context
))
.
pushSetUser
(
RocketChatCache
.
getOrCreatePushId
(
context
))
.
continueWith
(
new
Log
cat
IfError
());
.
continueWith
(
new
LogIfError
());
}
}
@DebugLog
@DebugLog
...
@@ -86,6 +86,6 @@ public class SessionObserver extends AbstractModelObserver<RealmSession> {
...
@@ -86,6 +86,6 @@ public class SessionObserver extends AbstractModelObserver<RealmSession> {
realm
.
delete
(
LoadMessageProcedure
.
class
);
realm
.
delete
(
LoadMessageProcedure
.
class
);
realm
.
delete
(
GetUsersOfRoomsProcedure
.
class
);
realm
.
delete
(
GetUsersOfRoomsProcedure
.
class
);
return
null
;
return
null
;
}).
continueWith
(
new
Log
cat
IfError
());
}).
continueWith
(
new
LogIfError
());
}
}
}
}
app/src/main/java/chat/rocket/android/service/observer/TokenLoginObserver.java
View file @
1c0e06e7
...
@@ -6,7 +6,7 @@ import io.realm.RealmResults;
...
@@ -6,7 +6,7 @@ import io.realm.RealmResults;
import
java.util.List
;
import
java.util.List
;
import
chat.rocket.android.api.MethodCallHelper
;
import
chat.rocket.android.api.MethodCallHelper
;
import
chat.rocket.android.helper.Log
cat
IfError
;
import
chat.rocket.android.helper.LogIfError
;
import
chat.rocket.persistence.realm.models.internal.RealmSession
;
import
chat.rocket.persistence.realm.models.internal.RealmSession
;
import
chat.rocket.persistence.realm.RealmHelper
;
import
chat.rocket.persistence.realm.RealmHelper
;
import
chat.rocket.android.service.DDPClientRef
;
import
chat.rocket.android.service.DDPClientRef
;
...
@@ -37,6 +37,6 @@ public class TokenLoginObserver extends AbstractModelObserver<RealmSession> {
...
@@ -37,6 +37,6 @@ public class TokenLoginObserver extends AbstractModelObserver<RealmSession> {
}
}
RealmSession
session
=
results
.
get
(
0
);
RealmSession
session
=
results
.
get
(
0
);
methodCall
.
loginWithToken
(
session
.
getToken
()).
continueWith
(
new
Log
cat
IfError
());
methodCall
.
loginWithToken
(
session
.
getToken
()).
continueWith
(
new
LogIfError
());
}
}
}
}
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