2 Commits

Author SHA1 Message Date
Bazsalanszky
3a9638e236 Fix typos 2024-07-28 10:00:46 +02:00
Bazsalanszky
f5b8206959 Fix token checking (again)
Failure to call the API (e.g. network error) with the token caused incorrect relogin requests.
2024-07-28 10:00:45 +02:00
3 changed files with 11 additions and 3 deletions

View File

@@ -54,6 +54,7 @@ import com.google.android.material.appbar.CollapsingToolbarLayout;
import com.google.android.material.appbar.MaterialToolbar;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
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.TabLayoutMediator;
import com.google.android.material.textfield.TextInputEditText;
@@ -1113,6 +1114,11 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
.setCancelable(false)
.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();
}
});
}
}

View File

@@ -124,7 +124,7 @@ public class FetchUserData {
@Override
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 onValidateAuthTokenFailed();
void onCheckFailed(String message);
}
public interface FetchUserUnreadCountListener {

View File

@@ -992,7 +992,7 @@
<string name="set_to_both">Set to Both</string>
<string name="default_font_font_preview">Default</string>
<string name="top_score">%1$s pts</string>
<string name="login_activity_2fa_prompt">If you have 2-factor authentication enabled, you need to fill the 2FA token filed. Leave empty otherwise</string>
<string name="login_activity_2fa_prompt">If you have 2-factor authentication enabled, you need to fill the 2FA token field. Leave empty otherwise</string>
<string name="block_user">Block User</string>
<string name="block_user_success">Blocked</string>
<string name="block_user_failed">Failed to block user</string>
@@ -1316,7 +1316,7 @@
<string name="settings_credits_new_icon_summary">Made by David Gerla</string>
<string name="original_app">The original Reddit app</string>
<string name="settings_credits_original_app_description">"Infinity was created by u/Hostilenemy "</string>
<string name="the_url_of_you_prefered_lemmy_instance_with_or_without_the_https_prefix">The URL of you prefered Lemmy instance with or without the https:// prefix</string>
<string name="the_url_of_you_prefered_lemmy_instance_with_or_without_the_https_prefix">The URL of you preferred Lemmy instance with or without the https:// prefix</string>
<string name="sort_scaled">Scaled</string>
<string name="token_expired">Token Expired</string>
<string name="token_expired_message">"Your token has been expired. As Eternity does not store your password, you need to manually log back in! "</string>
@@ -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="deleted_by_creator">deleted by creator</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>