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
ffaa0baf
Commit
ffaa0baf
authored
Mar 02, 2017
by
Tiago Cunha
Committed by
GitHub
Mar 02, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #227 from RocketChat/fix/server-registering
Fixes server incorret register
parents
cff73c9b
7f52279f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
17 deletions
+4
-17
RealmBasedConnectivityManager.java
...rocket/android/service/RealmBasedConnectivityManager.java
+1
-2
RealmBasedServerInfo.java
...rocket/persistence/realm/models/RealmBasedServerInfo.java
+3
-15
No files found.
app/src/main/java/chat/rocket/android/service/RealmBasedConnectivityManager.java
View file @
ffaa0baf
...
@@ -74,8 +74,7 @@ import rx.subjects.PublishSubject;
...
@@ -74,8 +74,7 @@ import rx.subjects.PublishSubject;
@Override
@Override
public
void
addOrUpdateServer
(
String
hostname
,
@Nullable
String
name
,
boolean
insecure
)
{
public
void
addOrUpdateServer
(
String
hostname
,
@Nullable
String
name
,
boolean
insecure
)
{
RealmBasedServerInfo
.
addOrUpdate
(
hostname
,
name
);
RealmBasedServerInfo
.
addOrUpdate
(
hostname
,
name
,
insecure
);
RealmBasedServerInfo
.
setInsecure
(
hostname
,
insecure
);
if
(!
serverConnectivityList
.
containsKey
(
hostname
))
{
if
(!
serverConnectivityList
.
containsKey
(
hostname
))
{
serverConnectivityList
.
put
(
hostname
,
ServerConnectivity
.
STATE_DISCONNECTED
);
serverConnectivityList
.
put
(
hostname
,
ServerConnectivity
.
STATE_DISCONNECTED
);
}
}
...
...
persistence-realm/src/main/java/chat/rocket/persistence/realm/models/RealmBasedServerInfo.java
View file @
ffaa0baf
...
@@ -44,11 +44,12 @@ public class RealmBasedServerInfo extends RealmObject {
...
@@ -44,11 +44,12 @@ public class RealmBasedServerInfo extends RealmObject {
return
RealmStore
.
getOrCreateForServerScope
(
DB_NAME
);
return
RealmStore
.
getOrCreateForServerScope
(
DB_NAME
);
}
}
public
static
void
addOrUpdate
(
String
hostname
,
String
name
)
{
public
static
void
addOrUpdate
(
String
hostname
,
String
name
,
boolean
insecure
)
{
getRealm
().
executeTransaction
(
realm
->
getRealm
().
executeTransaction
(
realm
->
realm
.
createOrUpdateObjectFromJson
(
RealmBasedServerInfo
.
class
,
new
JSONObject
()
realm
.
createOrUpdateObjectFromJson
(
RealmBasedServerInfo
.
class
,
new
JSONObject
()
.
put
(
ColumnName
.
HOSTNAME
,
hostname
)
.
put
(
ColumnName
.
HOSTNAME
,
hostname
)
.
put
(
ColumnName
.
NAME
,
TextUtils
.
isEmpty
(
name
)
?
JSONObject
.
NULL
:
name
)));
.
put
(
ColumnName
.
NAME
,
TextUtils
.
isEmpty
(
name
)
?
JSONObject
.
NULL
:
name
)
.
put
(
ColumnName
.
INSECURE
,
insecure
)));
}
}
public
static
void
remove
(
String
hostname
)
{
public
static
void
remove
(
String
hostname
)
{
...
@@ -80,19 +81,6 @@ public class RealmBasedServerInfo extends RealmObject {
...
@@ -80,19 +81,6 @@ public class RealmBasedServerInfo extends RealmObject {
return
impl
==
null
?
null
:
impl
.
getServerInfo
();
return
impl
==
null
?
null
:
impl
.
getServerInfo
();
}
}
public
static
void
setInsecure
(
String
hostname
,
boolean
insecure
)
{
RealmBasedServerInfo
impl
=
getRealm
().
executeTransactionForRead
(
realm
->
realm
.
where
(
RealmBasedServerInfo
.
class
).
equalTo
(
ColumnName
.
HOSTNAME
,
hostname
).
findFirst
());
if
(
impl
!=
null
)
{
impl
.
insecure
=
insecure
;
getRealm
().
executeTransaction
(
realm
->
{
realm
.
copyToRealmOrUpdate
(
impl
);
return
null
;
});
}
}
public
static
List
<
ServerInfo
>
getServerInfoList
()
{
public
static
List
<
ServerInfo
>
getServerInfoList
()
{
List
<
RealmBasedServerInfo
>
results
=
getRealm
().
executeTransactionForReadResults
(
realm
->
List
<
RealmBasedServerInfo
>
results
=
getRealm
().
executeTransactionForReadResults
(
realm
->
realm
.
where
(
RealmBasedServerInfo
.
class
).
findAll
());
realm
.
where
(
RealmBasedServerInfo
.
class
).
findAll
());
...
...
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