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
79024d78
Commit
79024d78
authored
Jun 05, 2017
by
Enzo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#1 - Change Hostname on logout - first commit
parent
0fe062dd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
3 deletions
+19
-3
MethodCallHelper.java
...c/main/java/chat/rocket/android/api/MethodCallHelper.java
+8
-0
SidebarMainFragment.java
.../rocket/android/fragment/sidebar/SidebarMainFragment.java
+2
-0
RealmBasedConnectivityManager.java
...rocket/android/service/RealmBasedConnectivityManager.java
+3
-2
RocketChatService.java
...n/java/chat/rocket/android/service/RocketChatService.java
+6
-1
No files found.
app/src/main/java/chat/rocket/android/api/MethodCallHelper.java
View file @
79024d78
...
...
@@ -12,6 +12,7 @@ import bolts.Task;
import
chat.rocket.android.helper.CheckSum
;
import
chat.rocket.android.helper.TextUtils
;
import
chat.rocket.android.service.ConnectivityManager
;
import
chat.rocket.core.models.ServerInfo
;
import
chat.rocket.persistence.realm.models.ddp.RealmPermission
;
import
chat.rocket.persistence.realm.models.ddp.RealmPublicSetting
;
import
chat.rocket.core.SyncState
;
...
...
@@ -261,6 +262,13 @@ public class MethodCallHelper {
return
call
(
"logout"
,
TIMEOUT_MS
).
onSuccessTask
(
task
->
realmHelper
.
executeTransaction
(
realm
->
{
realm
.
delete
(
RealmSession
.
class
);
//check whether the server list is empty
if
(!
ConnectivityManager
.
getInstance
(
context
).
getServerList
().
isEmpty
()){
//for each server in serverList -> remove the server
for
(
ServerInfo
server:
ConnectivityManager
.
getInstance
(
context
).
getServerList
())
{
ConnectivityManager
.
getInstance
(
context
.
getApplicationContext
()).
removeServer
(
server
.
getHostname
());
}
}
return
null
;
}));
}
...
...
app/src/main/java/chat/rocket/android/fragment/sidebar/SidebarMainFragment.java
View file @
79024d78
...
...
@@ -16,6 +16,7 @@ import android.widget.TextView;
import
com.jakewharton.rxbinding2.support.v7.widget.RxSearchView
;
import
com.jakewharton.rxbinding2.widget.RxCompoundButton
;
import
chat.rocket.android.LaunchUtil
;
import
io.reactivex.Observable
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
...
...
@@ -267,6 +268,7 @@ public class SidebarMainFragment extends AbstractFragment implements SidebarMain
rootView
.
findViewById
(
R
.
id
.
btn_logout
).
setOnClickListener
(
view
->
{
presenter
.
onLogout
();
closeUserActionContainer
();
LaunchUtil
.
showAddServerActivity
(
getContext
());
});
}
...
...
app/src/main/java/chat/rocket/android/service/RealmBasedConnectivityManager.java
View file @
79024d78
...
...
@@ -238,10 +238,11 @@ import rx.subjects.PublishSubject;
serverConnectivityList
.
put
(
hostname
,
ServerConnectivity
.
STATE_DISCONNECTING
);
if
(
serviceInterface
!=
null
)
{
return
serviceInterface
.
disconnectFromServer
(
hostname
);
return
serviceInterface
.
disconnectFromServer
(
hostname
)
.
doAfterTerminate
(()
->
serverConnectivityList
.
remove
(
hostname
));
}
else
{
return
Single
.
error
(
new
IllegalStateException
(
"not prepared"
));
}
});
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/service/RocketChatService.java
View file @
79024d78
...
...
@@ -80,7 +80,12 @@ public class RocketChatService extends Service implements ConnectivityServiceInt
RocketChatWebSocketThread
thread
=
webSocketThreads
.
get
(
hostname
);
if
(
thread
!=
null
)
{
return
thread
.
terminate
();
return
thread
.
terminate
()
//after disconnection from server, remove RCWebSocket key from HashMap
.
doAfterTerminate
(()
->
{
webSocketThreads
.
remove
(
hostname
);
stopSelf
();
});
}
else
{
return
Observable
.
timer
(
1
,
TimeUnit
.
SECONDS
).
toSingle
()
.
flatMap
(
_val
->
disconnectFromServer
(
hostname
));
...
...
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