Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
liberty-chat-android
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
12
Issues
12
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liberty
chat
liberty-chat-android
Commits
874fd637
Commit
874fd637
authored
Nov 21, 2019
by
Valere
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Infinite restart loop after expired token error
Fixes #3249
parent
219b14fb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
24 deletions
+10
-24
vector/src/main/java/im/vector/activity/CommonActivityUtils.java
...src/main/java/im/vector/activity/CommonActivityUtils.java
+9
-23
vector/src/main/java/im/vector/store/LoginStorage.java
vector/src/main/java/im/vector/store/LoginStorage.java
+1
-1
No files found.
vector/src/main/java/im/vector/activity/CommonActivityUtils.java
View file @
874fd637
...
...
@@ -316,39 +316,34 @@ public class CommonActivityUtils {
private
static
boolean
isRecoveringFromInvalidatedToken
=
false
;
public
static
void
recoverInvalidatedToken
()
{
Log
.
e
(
LOG_TAG
,
"## recoverInvalidatedToken: Start Recover "
);
if
(
isRecoveringFromInvalidatedToken
)
{
//ignore, we are doing it
Log
.
e
(
LOG_TAG
,
"## recoverInvalidatedToken: ignore, we are doing it"
);
return
;
}
isRecoveringFromInvalidatedToken
=
true
;
Context
context
=
VectorApp
.
getCurrentActivity
()
!=
null
?
VectorApp
.
getCurrentActivity
()
:
VectorApp
.
getInstance
();
try
{
// Clear the credentials
Matrix
.
getInstance
(
context
).
getLoginStorage
().
clear
()
;
VectorApp
.
getInstance
().
getNotificationDrawerManager
().
clearAllEvents
();
EventStreamServiceX
.
Companion
.
onLogout
(
context
);
// stopEventStream(context);
EventStreamServiceX
.
Companion
.
onApplicationStopped
(
context
);
BadgeProxy
.
INSTANCE
.
updateBadgeCount
(
context
,
0
);
MXSession
session
=
Matrix
.
getInstance
(
context
).
getDefaultSession
();
// Publish to the server that we're now offline
MyPresenceManager
.
getInstance
(
context
,
session
).
advertiseOffline
();
MyPresenceManager
.
remove
(
session
);
// clear the preferences
PreferencesManager
.
clearPreferences
(
context
);
// reset the FCM
Matrix
.
getInstance
(
context
).
getPushManager
().
resetFCMRegistration
();
// clear the preferences
Matrix
.
getInstance
(
context
).
getPushManager
().
clearPreferences
();
// Clear the credentials
Matrix
.
getInstance
(
context
).
getLoginStorage
().
clear
();
// clear the tmp store list
Matrix
.
getInstance
(
context
).
clearTmpStoresList
();
...
...
@@ -358,20 +353,11 @@ public class CommonActivityUtils {
MXMediaCache
.
clearThumbnailsCache
(
context
);
Matrix
.
getInstance
(
context
).
clearSessions
(
context
,
true
,
new
SimpleApiCallback
<
Void
>()
{
@Override
public
void
onSuccess
(
Void
info
)
{
}
});
session
.
clear
(
context
);
}
catch
(
Exception
e
)
{
Log
.
e
(
LOG_TAG
,
"## recoverInvalidatedToken: Error while cleaning: "
,
e
);
}
finally
{
// go to login page
CommonActivityUtils
.
restartApp
(
context
,
true
);
isRecoveringFromInvalidatedToken
=
false
;
CommonActivityUtils
.
restartApp
(
context
,
true
);
}
}
...
...
vector/src/main/java/im/vector/store/LoginStorage.java
View file @
874fd637
...
...
@@ -199,6 +199,6 @@ public class LoginStorage {
SharedPreferences
prefs
=
mContext
.
getSharedPreferences
(
PREFS_LOGIN
,
Context
.
MODE_PRIVATE
);
SharedPreferences
.
Editor
editor
=
prefs
.
edit
();
editor
.
remove
(
PREFS_KEY_CONNECTION_CONFIGS
);
editor
.
apply
();
editor
.
commit
();
}
}
\ No newline at end of file
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