mirror of
https://github.com/russok/FitoTrack.git
synced 2025-10-29 00:32:11 -07:00
Clear access token of not valid anymore
This commit is contained in:
parent
59c1781dd4
commit
832f6441cb
@ -118,12 +118,12 @@ public class OAuthAuthentication {
|
||||
.putBoolean("authenticated", true).apply();
|
||||
}
|
||||
|
||||
public void clearAccessToken(){
|
||||
void clearAccessToken() {
|
||||
preferences.edit().putBoolean("authenticated", false).apply();
|
||||
}
|
||||
|
||||
private void retrieveAccessToken(String verificationCode){
|
||||
handler.post(() -> dialogController.show());
|
||||
handler.post(dialogController::show);
|
||||
try{
|
||||
oAuthProvider.retrieveAccessToken(oAuthConsumer, verificationCode);
|
||||
handler.post(() -> {
|
||||
|
||||
@ -93,8 +93,12 @@ public class OsmTraceUploader {
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
handler.post(() -> {
|
||||
@StringRes int textRes= e instanceof OsmAuthorizationException ?
|
||||
R.string.uploadFailedOsmNotAuthorized : R.string.uploadFailed;
|
||||
@StringRes int textRes = R.string.uploadFailed;
|
||||
|
||||
if (e instanceof OsmAuthorizationException) {
|
||||
textRes = R.string.uploadFailedOsmNotAuthorized;
|
||||
new OAuthAuthentication(handler, activity, null).clearAccessToken();
|
||||
}
|
||||
|
||||
Toast.makeText(activity, textRes, Toast.LENGTH_LONG).show();
|
||||
dialogController.cancel();
|
||||
@ -104,7 +108,7 @@ public class OsmTraceUploader {
|
||||
}
|
||||
|
||||
private void executeTask(){
|
||||
handler.post(() -> dialogController.show());
|
||||
handler.post(dialogController::show);
|
||||
setProgress(0);
|
||||
if(cut){ cut(); }
|
||||
setProgress(20);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user