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
aee536b9
Commit
aee536b9
authored
Jan 20, 2017
by
Yusuke Iwaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prepare to remove ServerConfig
parent
8926ab87
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
35 deletions
+1
-35
ServerConfig.java
...src/main/java/chat/rocket/android/model/ServerConfig.java
+1
-35
No files found.
app/src/main/java/chat/rocket/android/model/ServerConfig.java
View file @
aee536b9
...
...
@@ -2,16 +2,11 @@ package chat.rocket.android.model;
import
io.realm.RealmObject
;
import
io.realm.annotations.PrimaryKey
;
import
org.json.JSONObject
;
import
bolts.Task
;
import
chat.rocket.android.helper.LogcatIfError
;
import
chat.rocket.android.realm_helper.RealmStore
;
import
hugo.weaving.DebugLog
;
/**
* Server configuration.
*/
@Deprecated
public
class
ServerConfig
extends
RealmObject
{
@SuppressWarnings
({
"PMD.ShortVariable"
})
...
...
@@ -34,35 +29,6 @@ public class ServerConfig extends RealmObject {
private
boolean
secureConnection
;
private
String
error
;
/**
* Log the server connection is lost due to some exception.
*/
@DebugLog
public
static
void
logConnectionError
(
String
serverConfigId
,
Exception
exception
)
{
RealmStore
.
getDefault
().
executeTransaction
(
realm
->
realm
.
createOrUpdateObjectFromJson
(
ServerConfig
.
class
,
new
JSONObject
()
.
put
(
ID
,
serverConfigId
)
.
put
(
STATE
,
STATE_CONNECTION_ERROR
)
.
put
(
ERROR
,
exception
.
getMessage
())))
.
continueWith
(
new
LogcatIfError
());
}
/**
* Update the state of the ServerConfig with serverConfigId.
*/
public
static
Task
<
Void
>
updateState
(
final
String
serverConfigId
,
int
state
)
{
return
RealmStore
.
getDefault
().
executeTransaction
(
realm
->
{
ServerConfig
config
=
realm
.
where
(
ServerConfig
.
class
).
equalTo
(
ID
,
serverConfigId
).
findFirst
();
if
(
config
==
null
||
config
.
getState
()
!=
state
)
{
realm
.
createOrUpdateObjectFromJson
(
ServerConfig
.
class
,
new
JSONObject
()
.
put
(
ID
,
serverConfigId
)
.
put
(
STATE
,
state
));
}
return
null
;
});
}
public
String
getServerConfigId
()
{
return
serverConfigId
;
}
...
...
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