Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
yotta
/
pictogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
60
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6c649e07
authored
Jan 18, 2017
by
Fernando Martínez Santiago
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
issues #811, #814 closed
parent
51e16563
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
7 deletions
android/Pictogram/commonlibrary/src/main/java/com/yottacode/net/RestapiWrapper.java
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/dao/User.java
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/net/NetService.java
android/Pictogram/commonlibrary/src/main/java/com/yottacode/net/RestapiWrapper.java
View file @
6c649e07
...
...
@@ -278,8 +278,8 @@ public class RestapiWrapper {
@Override
protected
void
onPostExecute
(
HttpAsyncTaskParams
params
)
{
if
(
params
.
error
!=
null
)
{
if
(
params
.
error
.
getCode
()==
401
&&
silentLogin
!=
null
)
{
//
silentLogin.login();
if
(
silentLogin
!=
null
&&
!
silentLogin
.
isValidToken
(
params
.
error
,
params
.
result
)
)
{
silentLogin
.
login
();
Log
.
e
(
LOG_TAG
,
"Silent login executed because of invalid token:"
+
params
.
error
.
getMessage
());
}
else
...
...
@@ -319,5 +319,6 @@ public class RestapiWrapper {
*/
public
interface
iSilentLogin
{
void
login
();
boolean
isValidToken
(
HTTPException
error
,
Object
result
);
}
}
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/dao/User.java
View file @
6c649e07
...
...
@@ -266,11 +266,7 @@ public class User {
* @return input feedback of the student configuration (default: "vibration")
*/
public
boolean
delete_tape_after_delivery
()
{
try
{
return
this
.
attributes_stu
.
getBoolean
(
JSON_STUDENT_ATTTRS
.
DELETE_STRIP
);
}
catch
(
JSONException
e
)
{
return
false
;
}
return
input_feedback_on
(
JSON_STUDENT_ATTTRS
.
DELETE_STRIP
);
}
/**
...
...
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/net/NetService.java
View file @
6c649e07
...
...
@@ -110,6 +110,17 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin {
}
});
}
@Override
public
boolean
isValidToken
(
RestapiWrapper
.
HTTPException
error
,
Object
result
)
{
try
{
return
error
.
getCode
()!=
401
||
(((
JSONObject
)
result
).
getString
(
"err"
).
equalsIgnoreCase
(
"Invalid token undefined"
));
}
catch
(
JSONException
e
)
{
Log
.
e
(
LOG_TAG
,
e
.
getMessage
());
return
true
;
}
}
public
boolean
online
()
{
return
updated
;}
public
void
restart_app
(
boolean
direct_login
)
{
...
...
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