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();
|
.putBoolean("authenticated", true).apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearAccessToken(){
|
void clearAccessToken() {
|
||||||
preferences.edit().putBoolean("authenticated", false).apply();
|
preferences.edit().putBoolean("authenticated", false).apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void retrieveAccessToken(String verificationCode){
|
private void retrieveAccessToken(String verificationCode){
|
||||||
handler.post(() -> dialogController.show());
|
handler.post(dialogController::show);
|
||||||
try{
|
try{
|
||||||
oAuthProvider.retrieveAccessToken(oAuthConsumer, verificationCode);
|
oAuthProvider.retrieveAccessToken(oAuthConsumer, verificationCode);
|
||||||
handler.post(() -> {
|
handler.post(() -> {
|
||||||
|
|||||||
@ -93,8 +93,12 @@ public class OsmTraceUploader {
|
|||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
handler.post(() -> {
|
handler.post(() -> {
|
||||||
@StringRes int textRes= e instanceof OsmAuthorizationException ?
|
@StringRes int textRes = R.string.uploadFailed;
|
||||||
R.string.uploadFailedOsmNotAuthorized : 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();
|
Toast.makeText(activity, textRes, Toast.LENGTH_LONG).show();
|
||||||
dialogController.cancel();
|
dialogController.cancel();
|
||||||
@ -104,7 +108,7 @@ public class OsmTraceUploader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void executeTask(){
|
private void executeTask(){
|
||||||
handler.post(() -> dialogController.show());
|
handler.post(dialogController::show);
|
||||||
setProgress(0);
|
setProgress(0);
|
||||||
if(cut){ cut(); }
|
if(cut){ cut(); }
|
||||||
setProgress(20);
|
setProgress(20);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user