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
61284c15
Commit
61284c15
authored
Jan 23, 2017
by
Yusuke Iwaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix RETRY button
parent
1994e656
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
MainActivity.java
.../main/java/chat/rocket/android/activity/MainActivity.java
+1
-2
Session.java
...main/java/chat/rocket/android/model/internal/Session.java
+18
-0
No files found.
app/src/main/java/chat/rocket/android/activity/MainActivity.java
View file @
61284c15
...
...
@@ -201,8 +201,7 @@ public class MainActivity extends AbstractAuthedActivity {
Snackbar
.
make
(
findViewById
(
getLayoutContainerForFragment
()),
R
.
string
.
fragment_retry_login_error_title
,
Snackbar
.
LENGTH_INDEFINITE
)
.
setAction
(
R
.
string
.
fragment_retry_login_retry_title
,
view
->
ConnectivityManager
.
getInstance
(
getApplicationContext
())
.
connect
(
hostname
).
subscribe
()));
Session
.
retryLogin
(
RealmStore
.
get
(
hostname
))));
}
else
if
(!
session
.
isTokenVerified
())
{
statusTicker
.
updateStatus
(
StatusTicker
.
STATUS_TOKEN_LOGIN
,
Snackbar
.
make
(
findViewById
(
getLayoutContainerForFragment
()),
...
...
app/src/main/java/chat/rocket/android/model/internal/Session.java
View file @
61284c15
...
...
@@ -55,6 +55,24 @@ public class Session extends RealmObject {
}
}
/**
* retry authentication.
*/
@DebugLog
public
static
void
retryLogin
(
RealmHelper
realmHelper
)
{
final
Session
session
=
realmHelper
.
executeTransactionForRead
(
realm
->
queryDefaultSession
(
realm
).
isNotNull
(
TOKEN
).
findFirst
());
if
(!
session
.
isTokenVerified
()
||
!
TextUtils
.
isEmpty
(
session
.
getError
()))
{
realmHelper
.
executeTransaction
(
realm
->
realm
.
createOrUpdateObjectFromJson
(
Session
.
class
,
new
JSONObject
()
.
put
(
ID
,
Session
.
DEFAULT_ID
)
.
put
(
TOKEN_VERIFIED
,
false
)
.
put
(
ERROR
,
JSONObject
.
NULL
)))
.
continueWith
(
new
LogcatIfError
());
}
}
public
int
getSessionId
()
{
return
sessionId
;
}
...
...
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