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
1a43611e
Commit
1a43611e
authored
Nov 28, 2017
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prune database collections after interactively logging out
parent
cbda8984
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
23 deletions
+13
-23
SidebarMainPresenter.java
...rocket/android/fragment/sidebar/SidebarMainPresenter.java
+5
-18
RealmBasedConnectivityManager.java
...rocket/android/service/RealmBasedConnectivityManager.java
+0
-1
RocketChatWebSocketThread.java
...hat/rocket/android/service/RocketChatWebSocketThread.java
+8
-4
No files found.
app/src/main/java/chat/rocket/android/fragment/sidebar/SidebarMainPresenter.java
View file @
1a43611e
...
@@ -18,9 +18,7 @@ import chat.rocket.android.helper.LogIfError;
...
@@ -18,9 +18,7 @@ import chat.rocket.android.helper.LogIfError;
import
chat.rocket.android.helper.Logger
;
import
chat.rocket.android.helper.Logger
;
import
chat.rocket.android.helper.TextUtils
;
import
chat.rocket.android.helper.TextUtils
;
import
chat.rocket.android.service.ConnectivityManager
;
import
chat.rocket.android.service.ConnectivityManager
;
import
chat.rocket.android.service.ConnectivityManagerApi
;
import
chat.rocket.android.shared.BasePresenter
;
import
chat.rocket.android.shared.BasePresenter
;
import
chat.rocket.android_ddp.DDPClient
;
import
chat.rocket.core.interactors.RoomInteractor
;
import
chat.rocket.core.interactors.RoomInteractor
;
import
chat.rocket.core.models.Room
;
import
chat.rocket.core.models.Room
;
import
chat.rocket.core.models.RoomSidebar
;
import
chat.rocket.core.models.RoomSidebar
;
...
@@ -30,16 +28,11 @@ import chat.rocket.core.repositories.SpotlightRepository;
...
@@ -30,16 +28,11 @@ import chat.rocket.core.repositories.SpotlightRepository;
import
chat.rocket.core.repositories.UserRepository
;
import
chat.rocket.core.repositories.UserRepository
;
import
chat.rocket.persistence.realm.RealmHelper
;
import
chat.rocket.persistence.realm.RealmHelper
;
import
chat.rocket.persistence.realm.RealmStore
;
import
chat.rocket.persistence.realm.RealmStore
;
import
chat.rocket.persistence.realm.models.ddp.RealmEmail
;
import
chat.rocket.persistence.realm.models.ddp.RealmUser
;
import
chat.rocket.persistence.realm.models.internal.GetUsersOfRoomsProcedure
;
import
chat.rocket.persistence.realm.models.internal.LoadMessageProcedure
;
import
chat.rocket.persistence.realm.models.internal.MethodCall
;
import
chat.rocket.persistence.realm.models.internal.RealmSession
;
import
chat.rocket.persistence.realm.repositories.RealmSpotlightRepository
;
import
chat.rocket.persistence.realm.repositories.RealmSpotlightRepository
;
import
io.reactivex.Flowable
;
import
io.reactivex.Flowable
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.disposables.Disposable
;
import
io.reactivex.disposables.Disposable
;
import
io.realm.Realm
;
public
class
SidebarMainPresenter
extends
BasePresenter
<
SidebarMainContract
.
View
>
implements
SidebarMainContract
.
Presenter
{
public
class
SidebarMainPresenter
extends
BasePresenter
<
SidebarMainContract
.
View
>
implements
SidebarMainContract
.
Presenter
{
private
final
String
hostname
;
private
final
String
hostname
;
...
@@ -164,23 +157,17 @@ public class SidebarMainPresenter extends BasePresenter<SidebarMainContract.View
...
@@ -164,23 +157,17 @@ public class SidebarMainPresenter extends BasePresenter<SidebarMainContract.View
}
}
clearSubscriptions
();
clearSubscriptions
();
DDPClient
.
get
().
close
();
String
currentHostname
=
rocketChatCache
.
getSelectedServerHostname
();
String
currentHostname
=
rocketChatCache
.
getSelectedServerHostname
();
RealmHelper
realmHelper
=
RealmStore
.
getOrCreate
(
currentHostname
);
RealmHelper
realmHelper
=
RealmStore
.
getOrCreate
(
currentHostname
);
return
realmHelper
.
executeTransaction
(
realm
->
{
return
realmHelper
.
executeTransaction
(
realm
->
{
CookieManager
.
getInstance
().
removeAllCookie
();
ConnectivityManagerApi
connectivityManagerApi
=
ConnectivityManager
.
getInstance
(
RocketChatApplication
.
getInstance
());
connectivityManagerApi
.
removeServer
(
currentHostname
);
rocketChatCache
.
removeHostname
(
currentHostname
);
rocketChatCache
.
removeHostname
(
currentHostname
);
rocketChatCache
.
removeSelectedRoomId
(
currentHostname
);
rocketChatCache
.
removeSelectedRoomId
(
currentHostname
);
rocketChatCache
.
setSelectedServerHostname
(
rocketChatCache
.
getFirstLoggedHostnameIfAny
());
rocketChatCache
.
setSelectedServerHostname
(
rocketChatCache
.
getFirstLoggedHostnameIfAny
());
realm
.
delete
(
RealmEmail
.
class
);
realm
.
executeTransactionAsync
(
Realm:
:
deleteAll
);
realm
.
delete
(
RealmUser
.
class
);
realm
.
delete
(
RealmSession
.
class
);
realm
.
delete
(
MethodCall
.
class
);
realm
.
delete
(
LoadMessageProcedure
.
class
);
realm
.
delete
(
GetUsersOfRoomsProcedure
.
class
);
view
.
onPreparedToLogOut
();
view
.
onPreparedToLogOut
();
ConnectivityManager
.
getInstance
(
RocketChatApplication
.
getInstance
())
.
removeServer
(
hostname
);
CookieManager
.
getInstance
().
removeAllCookie
();
return
null
;
return
null
;
});
});
});
});
...
...
app/src/main/java/chat/rocket/android/service/RealmBasedConnectivityManager.java
View file @
1a43611e
...
@@ -109,7 +109,6 @@ import io.reactivex.subjects.BehaviorSubject;
...
@@ -109,7 +109,6 @@ import io.reactivex.subjects.BehaviorSubject;
if
(
serverConnectivityList
.
containsKey
(
hostname
))
{
if
(
serverConnectivityList
.
containsKey
(
hostname
))
{
disconnectFromServerIfNeeded
(
hostname
)
disconnectFromServerIfNeeded
(
hostname
)
.
subscribe
(
_val
->
{
.
subscribe
(
_val
->
{
System
.
out
.
println
(
"Disconnected "
+
_val
);
},
RCLog:
:
e
);
},
RCLog:
:
e
);
}
}
}
}
...
...
app/src/main/java/chat/rocket/android/service/RocketChatWebSocketThread.java
View file @
1a43611e
...
@@ -230,7 +230,7 @@ public class RocketChatWebSocketThread extends HandlerThread {
...
@@ -230,7 +230,7 @@ public class RocketChatWebSocketThread extends HandlerThread {
if
(
result
.
code
==
DDPClient
.
REASON_NETWORK_ERROR
)
{
if
(
result
.
code
==
DDPClient
.
REASON_NETWORK_ERROR
)
{
reconnect
();
reconnect
();
}
else
{
}
else
{
unregisterListeners
();
unregisterListeners
AndClose
();
}
}
return
null
;
return
null
;
});
});
...
@@ -335,8 +335,8 @@ public class RocketChatWebSocketThread extends HandlerThread {
...
@@ -335,8 +335,8 @@ public class RocketChatWebSocketThread extends HandlerThread {
.
findAll
());
.
findAll
());
if
(
sessions
!=
null
&&
sessions
.
size
()
>
0
)
{
if
(
sessions
!=
null
&&
sessions
.
size
()
>
0
)
{
//
i
f we have a session try to resume it. At this point we're probably recovering from
//
I
f we have a session try to resume it. At this point we're probably recovering from
// a disconnection state
// a disconnection state
.
final
CompositeDisposable
disposables
=
new
CompositeDisposable
();
final
CompositeDisposable
disposables
=
new
CompositeDisposable
();
MethodCallHelper
methodCall
=
new
MethodCallHelper
(
realmHelper
);
MethodCallHelper
methodCall
=
new
MethodCallHelper
(
realmHelper
);
disposables
.
add
(
disposables
.
add
(
...
@@ -353,7 +353,11 @@ public class RocketChatWebSocketThread extends HandlerThread {
...
@@ -353,7 +353,11 @@ public class RocketChatWebSocketThread extends HandlerThread {
createObserversAndRegister
();
createObserversAndRegister
();
disposables
.
clear
();
disposables
.
clear
();
},
},
error
->
logErrorAndUnsubscribe
(
disposables
,
error
)
error
->
{
logErrorAndUnsubscribe
(
disposables
,
error
);
connectivityManager
.
notifyConnectionLost
(
hostname
,
DDPClient
.
REASON_NETWORK_ERROR
);
}
)
)
);
);
}
else
{
}
else
{
...
...
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