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
659952bf
Commit
659952bf
authored
Feb 20, 2017
by
Tiago Cunha
Committed by
GitHub
Feb 20, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #212 from RocketChat/fix/firebase-crashes-20170220
Fix/firebase crashes 20170220
parents
3b05bafe
32982d9f
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
194 additions
and
142 deletions
+194
-142
DDPClientImpl.java
.../src/main/java/chat/rocket/android_ddp/DDPClientImpl.java
+148
-113
build.gradle
app/build.gradle
+2
-2
AbstractAuthedActivity.java
.../chat/rocket/android/activity/AbstractAuthedActivity.java
+1
-1
AbstractDDPDocEventSubscriber.java
...et/android/service/ddp/AbstractDDPDocEventSubscriber.java
+20
-16
MethodCallObserver.java
...t/rocket/android/service/observer/MethodCallObserver.java
+11
-3
RealmPreferences.java
...rocket/persistence/realm/models/ddp/RealmPreferences.java
+5
-4
RealmUser.java
...a/chat/rocket/persistence/realm/models/ddp/RealmUser.java
+1
-1
ImageKeyboardEditText.java
.../rocket/android/widget/message/ImageKeyboardEditText.java
+3
-0
Preferences.java
...re/src/main/java/chat/rocket/core/models/Preferences.java
+3
-2
No files found.
android-ddp/src/main/java/chat/rocket/android_ddp/DDPClientImpl.java
View file @
659952bf
This diff is collapsed.
Click to expand it.
app/build.gradle
View file @
659952bf
...
...
@@ -33,8 +33,8 @@ android {
applicationId
"chat.rocket.android"
minSdkVersion
16
targetSdkVersion
25
versionCode
1
0
versionName
"1.0.
1
"
versionCode
1
1
versionName
"1.0.
2
"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
vectorDrawables
.
useSupportLibrary
=
true
...
...
app/src/main/java/chat/rocket/android/activity/AbstractAuthedActivity.java
View file @
659952bf
...
...
@@ -75,7 +75,7 @@ abstract class AbstractAuthedActivity extends AbstractFragmentActivity {
}
}
else
{
if
(
hostname
.
equals
(
newHostname
))
{
// we are good
updateHostname
(
newHostname
);
return
;
}
...
...
app/src/main/java/chat/rocket/android/service/ddp/AbstractDDPDocEventSubscriber.java
View file @
659952bf
...
...
@@ -99,23 +99,27 @@ public abstract class AbstractDDPDocEventSubscriber implements Registrable {
.
filter
(
event
->
event
instanceof
DDPSubscription
.
DocEvent
)
.
cast
(
DDPSubscription
.
DocEvent
.
class
)
.
filter
(
event
->
isTarget
(
event
.
collection
))
.
subscribe
(
docEvent
->
{
try
{
if
(
docEvent
instanceof
DDPSubscription
.
Added
.
Before
)
{
onDocumentAdded
((
DDPSubscription
.
Added
)
docEvent
);
//ignore Before
}
else
if
(
docEvent
instanceof
DDPSubscription
.
Added
)
{
onDocumentAdded
((
DDPSubscription
.
Added
)
docEvent
);
}
else
if
(
docEvent
instanceof
DDPSubscription
.
Removed
)
{
onDocumentRemoved
((
DDPSubscription
.
Removed
)
docEvent
);
}
else
if
(
docEvent
instanceof
DDPSubscription
.
Changed
)
{
onDocumentChanged
((
DDPSubscription
.
Changed
)
docEvent
);
}
else
if
(
docEvent
instanceof
DDPSubscription
.
MovedBefore
)
{
//ignore movedBefore
.
subscribe
(
docEvent
->
{
try
{
if
(
docEvent
instanceof
DDPSubscription
.
Added
.
Before
)
{
onDocumentAdded
((
DDPSubscription
.
Added
)
docEvent
);
//ignore Before
}
else
if
(
docEvent
instanceof
DDPSubscription
.
Added
)
{
onDocumentAdded
((
DDPSubscription
.
Added
)
docEvent
);
}
else
if
(
docEvent
instanceof
DDPSubscription
.
Removed
)
{
onDocumentRemoved
((
DDPSubscription
.
Removed
)
docEvent
);
}
else
if
(
docEvent
instanceof
DDPSubscription
.
Changed
)
{
onDocumentChanged
((
DDPSubscription
.
Changed
)
docEvent
);
}
else
if
(
docEvent
instanceof
DDPSubscription
.
MovedBefore
)
{
//ignore movedBefore
}
}
catch
(
Exception
exception
)
{
RCLog
.
w
(
exception
,
"failed to handle subscription callback"
);
}
},
throwable
->
{
}
}
catch
(
Exception
exception
)
{
RCLog
.
w
(
exception
,
"failed to handle subscription callback"
);
}
});
);
}
protected
void
onDocumentAdded
(
DDPSubscription
.
Added
docEvent
)
{
...
...
app/src/main/java/chat/rocket/android/service/observer/MethodCallObserver.java
View file @
659952bf
...
...
@@ -109,9 +109,17 @@ public class MethodCallObserver extends AbstractModelObserver<MethodCall> {
if
(
task
.
isFaulted
())
{
return
realmHelper
.
executeTransaction
(
realm
->
{
Exception
exception
=
task
.
getError
();
final
String
errMessage
=
(
exception
instanceof
DDPClientCallback
.
RPC
.
Error
)
?
((
DDPClientCallback
.
RPC
.
Error
)
exception
).
error
.
toString
()
:
exception
.
getMessage
();
final
String
errMessage
;
if
(
exception
instanceof
DDPClientCallback
.
RPC
.
Error
)
{
errMessage
=
((
DDPClientCallback
.
RPC
.
Error
)
exception
).
error
.
toString
();
}
else
if
(
exception
instanceof
DDPClientCallback
.
RPC
.
Timeout
)
{
// temp "fix"- we need to rewrite the connection layer a bit
errMessage
=
"{\"message\": \"Connection Timeout\"}"
;
}
else
{
errMessage
=
exception
.
getMessage
();
}
realm
.
createOrUpdateObjectFromJson
(
MethodCall
.
class
,
new
JSONObject
()
.
put
(
MethodCall
.
ID
,
methodCallId
)
.
put
(
MethodCall
.
SYNC_STATE
,
SyncState
.
FAILED
)
...
...
persistence-realm/src/main/java/chat/rocket/persistence/realm/models/ddp/RealmPreferences.java
View file @
659952bf
...
...
@@ -11,7 +11,7 @@ public class RealmPreferences extends RealmObject {
@PrimaryKey
private
String
id
;
private
String
newRoomNotification
;
private
boolean
newMessageNotification
;
private
String
newMessageNotification
;
private
boolean
useEmojis
;
private
boolean
convertAsciiEmoji
;
private
boolean
saveMobileBandwidth
;
...
...
@@ -52,7 +52,7 @@ public class RealmPreferences extends RealmObject {
return
newRoomNotification
;
}
public
boolean
is
NewMessageNotification
()
{
public
String
get
NewMessageNotification
()
{
return
newMessageNotification
;
}
...
...
@@ -123,7 +123,8 @@ public class RealmPreferences extends RealmObject {
:
that
.
newRoomNotification
==
null
)
{
return
false
;
}
if
(
newMessageNotification
!=
that
.
newMessageNotification
)
{
if
(
newMessageNotification
!=
null
?
newMessageNotification
.
equals
(
that
.
newMessageNotification
)
:
that
.
newMessageNotification
==
null
)
{
return
false
;
}
if
(
useEmojis
!=
that
.
useEmojis
)
{
...
...
@@ -174,7 +175,7 @@ public class RealmPreferences extends RealmObject {
public
int
hashCode
()
{
int
result
=
id
!=
null
?
id
.
hashCode
()
:
0
;
result
=
31
*
result
+
(
newRoomNotification
!=
null
?
newRoomNotification
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
newMessageNotification
?
1
:
0
);
result
=
31
*
result
+
(
newMessageNotification
!=
null
?
newMessageNotification
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
useEmojis
?
1
:
0
);
result
=
31
*
result
+
(
convertAsciiEmoji
?
1
:
0
);
result
=
31
*
result
+
(
saveMobileBandwidth
?
1
:
0
);
...
...
persistence-realm/src/main/java/chat/rocket/persistence/realm/models/ddp/RealmUser.java
View file @
659952bf
...
...
@@ -87,7 +87,7 @@ public class RealmUser extends RealmObject {
public
User
asUser
()
{
// convert email list
final
int
total
=
emails
.
size
()
;
final
int
total
=
emails
!=
null
?
emails
.
size
()
:
0
;
final
List
<
Email
>
coreEmails
=
new
ArrayList
<>(
total
);
for
(
int
i
=
0
;
i
<
total
;
i
++)
{
...
...
rocket-chat-android-widgets/src/main/java/chat/rocket/android/widget/message/ImageKeyboardEditText.java
View file @
659952bf
...
...
@@ -52,6 +52,9 @@ public class ImageKeyboardEditText extends EditText {
@Override
public
InputConnection
onCreateInputConnection
(
EditorInfo
editorInfo
)
{
final
InputConnection
inputConnection
=
super
.
onCreateInputConnection
(
editorInfo
);
if
(
inputConnection
==
null
)
{
return
null
;
}
EditorInfoCompat
.
setContentMimeTypes
(
editorInfo
,
mimeTypes
);
...
...
rocket-chat-core/src/main/java/chat/rocket/core/models/Preferences.java
View file @
659952bf
...
...
@@ -12,7 +12,8 @@ public abstract class Preferences {
@Nullable
public
abstract
String
getNewRoomNotification
();
public
abstract
boolean
isNewMessageNotification
();
@Nullable
public
abstract
String
getNewMessageNotification
();
public
abstract
boolean
isUseEmojis
();
...
...
@@ -51,7 +52,7 @@ public abstract class Preferences {
public
abstract
Builder
setNewRoomNotification
(
String
newRoomNotification
);
public
abstract
Builder
setNewMessageNotification
(
boolean
newMessageNotification
);
public
abstract
Builder
setNewMessageNotification
(
String
newMessageNotification
);
public
abstract
Builder
setUseEmojis
(
boolean
useEmojis
);
...
...
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