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
203d800d
Commit
203d800d
authored
Sep 29, 2017
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clear Realm on asynchronous thread and also clear cookies.
parent
9e1504be
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
15 deletions
+4
-15
MainActivity.java
.../main/java/chat/rocket/android/activity/MainActivity.java
+0
-11
SidebarMainFragment.java
.../rocket/android/fragment/sidebar/SidebarMainFragment.java
+0
-2
SidebarMainPresenter.java
...rocket/android/fragment/sidebar/SidebarMainPresenter.java
+3
-1
RealmHelper.java
.../main/java/chat/rocket/persistence/realm/RealmHelper.java
+1
-1
No files found.
app/src/main/java/chat/rocket/android/activity/MainActivity.java
View file @
203d800d
...
...
@@ -251,12 +251,6 @@ public class MainActivity extends AbstractAuthedActivity implements MainContract
R
.
string
.
server_config_activity_authenticating
,
Snackbar
.
LENGTH_INDEFINITE
));
}
public
void
showLogoutMessage
()
{
statusTicker
.
updateStatus
(
StatusTicker
.
STATUS_LOGGING_OUT
,
Snackbar
.
make
(
findViewById
(
getLayoutContainerForFragment
()),
"Logging Out..."
,
Snackbar
.
LENGTH_INDEFINITE
));
}
@Override
public
void
showConnectionOk
()
{
statusTicker
.
updateStatus
(
StatusTicker
.
STATUS_DISMISS
,
null
);
...
...
@@ -314,11 +308,6 @@ public class MainActivity extends AbstractAuthedActivity implements MainContract
}
}
@DebugLog
public
void
hideLogoutMessage
()
{
statusTicker
.
updateStatus
(
StatusTicker
.
STATUS_DISMISS
,
null
);
}
@DebugLog
public
void
onLogout
()
{
if
(
new
RocketChatCache
(
getApplicationContext
()).
getSelectedServerHostname
()
==
null
)
{
...
...
app/src/main/java/chat/rocket/android/fragment/sidebar/SidebarMainFragment.java
View file @
203d800d
...
...
@@ -325,7 +325,6 @@ public class SidebarMainFragment extends AbstractFragment implements SidebarMain
public
void
onLogoutCleanUp
()
{
Activity
activity
=
getActivity
();
if
(
activity
!=
null
&&
activity
instanceof
MainActivity
)
{
((
MainActivity
)
activity
).
hideLogoutMessage
();
((
MainActivity
)
activity
).
onLogout
();
presenter
.
onLogout
(
task
->
{
if
(
task
.
isFaulted
())
{
...
...
@@ -343,7 +342,6 @@ public class SidebarMainFragment extends AbstractFragment implements SidebarMain
presenter
.
beforeLogoutCleanUp
();
final
Activity
activity
=
getActivity
();
if
(
activity
!=
null
&&
activity
instanceof
MainActivity
)
{
((
MainActivity
)
activity
).
showLogoutMessage
();
// Clear subscriptions on MainPresenter.
((
MainActivity
)
activity
).
beforeLogoutCleanUp
();
}
...
...
app/src/main/java/chat/rocket/android/fragment/sidebar/SidebarMainPresenter.java
View file @
203d800d
...
...
@@ -2,6 +2,7 @@ package chat.rocket.android.fragment.sidebar;
import
android.support.annotation.NonNull
;
import
android.support.v4.util.Pair
;
import
android.webkit.CookieManager
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -154,7 +155,8 @@ public class SidebarMainPresenter extends BasePresenter<SidebarMainContract.View
String
currentHostname
=
rocketChatCache
.
getSelectedServerHostname
();
RealmHelper
realmHelper
=
RealmStore
.
getOrCreate
(
currentHostname
);
realmHelper
.
executeTransaction
(
realm
->
{
realm
.
deleteAll
();
realm
.
executeTransactionAsync
(
realmObj
->
realmObj
.
deleteAll
());
CookieManager
.
getInstance
().
removeAllCookie
();
ConnectivityManagerApi
connectivityManagerApi
=
ConnectivityManager
.
getInstance
(
RocketChatApplication
.
getInstance
());
connectivityManagerApi
.
removeServer
(
currentHostname
);
rocketChatCache
.
removeHostname
(
currentHostname
);
...
...
persistence-realm/src/main/java/chat/rocket/persistence/realm/RealmHelper.java
View file @
203d800d
...
...
@@ -122,7 +122,7 @@ public class RealmHelper {
return
task
.
getTask
();
}
p
rivate
Task
<
Void
>
executeTransactionAsync
(
final
RealmHelper
.
Transaction
transaction
)
{
p
ublic
Task
<
Void
>
executeTransactionAsync
(
final
RealmHelper
.
Transaction
transaction
)
{
final
TaskCompletionSource
<
Void
>
task
=
new
TaskCompletionSource
<>();
final
Realm
realm
=
instance
();
...
...
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