mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-27 01:54:45 +01:00
Fix token checking (again)
Failure to call the API (e.g. network error) with the token caused incorrect relogin requests.
This commit is contained in:
parent
ae74eeba0f
commit
f5b8206959
@ -54,6 +54,7 @@ import com.google.android.material.appbar.CollapsingToolbarLayout;
|
|||||||
import com.google.android.material.appbar.MaterialToolbar;
|
import com.google.android.material.appbar.MaterialToolbar;
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
import com.google.android.material.navigation.NavigationView;
|
import com.google.android.material.navigation.NavigationView;
|
||||||
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
import com.google.android.material.tabs.TabLayout;
|
import com.google.android.material.tabs.TabLayout;
|
||||||
import com.google.android.material.tabs.TabLayoutMediator;
|
import com.google.android.material.tabs.TabLayoutMediator;
|
||||||
import com.google.android.material.textfield.TextInputEditText;
|
import com.google.android.material.textfield.TextInputEditText;
|
||||||
@ -1113,6 +1114,11 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
.setCancelable(false)
|
.setCancelable(false)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCheckFailed(String message) {
|
||||||
|
applySnackBarTheme(Snackbar.make(findViewById(android.R.id.content), getString(R.string.failed_to_check_token_validity,message), Snackbar.LENGTH_LONG)).show();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ public class FetchUserData {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
|
||||||
validateAuthTokenListener.onValidateAuthTokenFailed();
|
validateAuthTokenListener.onCheckFailed(t.getMessage());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -133,6 +133,7 @@ public class FetchUserData {
|
|||||||
void onValidateAuthTokenSuccess();
|
void onValidateAuthTokenSuccess();
|
||||||
|
|
||||||
void onValidateAuthTokenFailed();
|
void onValidateAuthTokenFailed();
|
||||||
|
void onCheckFailed(String message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface FetchUserUnreadCountListener {
|
public interface FetchUserUnreadCountListener {
|
||||||
|
@ -1334,4 +1334,5 @@
|
|||||||
<string name="settings_dont_hide_your_own_read_posts_automatically">Don\'t hide your own read posts automatically</string>
|
<string name="settings_dont_hide_your_own_read_posts_automatically">Don\'t hide your own read posts automatically</string>
|
||||||
<string name="deleted_by_creator">deleted by creator</string>
|
<string name="deleted_by_creator">deleted by creator</string>
|
||||||
<string name="removed_by_moderator">removed by moderator</string>
|
<string name="removed_by_moderator">removed by moderator</string>
|
||||||
|
<string name="failed_to_check_token_validity">Failed to check token validity: %s</string>
|
||||||
</resources>
|
</resources>
|
Loading…
x
Reference in New Issue
Block a user