aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-01-13 05:21:23 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-01-13 05:21:23 +0000
commitde7bc2de08bb82d666cf92f9e462de4c33d487ad (patch)
treef13f8fee55fb488e589f748c7e6fa4b9a057707e
parentd98c02d0adc026dfca3bcc9a294ee3e9fddb80f3 (diff)
downloadinfinity-for-reddit-de7bc2de08bb82d666cf92f9e462de4c33d487ad.tar
infinity-for-reddit-de7bc2de08bb82d666cf92f9e462de4c33d487ad.tar.gz
infinity-for-reddit-de7bc2de08bb82d666cf92f9e462de4c33d487ad.tar.bz2
infinity-for-reddit-de7bc2de08bb82d666cf92f9e462de4c33d487ad.tar.lz
infinity-for-reddit-de7bc2de08bb82d666cf92f9e462de4c33d487ad.tar.xz
infinity-for-reddit-de7bc2de08bb82d666cf92f9e462de4c33d487ad.tar.zst
infinity-for-reddit-de7bc2de08bb82d666cf92f9e462de4c33d487ad.zip
Fix inserting the anonymous account even when it was already inserted.
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/AccessTokenAuthenticator.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ApplicationOnlyAccessTokenAuthenticator.java2
2 files changed, 2 insertions, 2 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AccessTokenAuthenticator.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AccessTokenAuthenticator.java
index 19e6d0da..f8da226a 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/AccessTokenAuthenticator.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AccessTokenAuthenticator.java
@@ -49,7 +49,7 @@ class AccessTokenAuthenticator implements Authenticator {
Account account = mRedditDataRoomDatabase.accountDao().getCurrentAccount();
if (account == null) {
//Anonymous mode
- if (mRedditDataRoomDatabase.accountDao().isAnonymousAccountInserted()) {
+ if (!mRedditDataRoomDatabase.accountDao().isAnonymousAccountInserted()) {
mRedditDataRoomDatabase.accountDao().insert(Account.getAnonymousAccount());
}
String accessTokenFromSharedPreference = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, "");
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ApplicationOnlyAccessTokenAuthenticator.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ApplicationOnlyAccessTokenAuthenticator.java
index 75f0ed13..970b81fd 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ApplicationOnlyAccessTokenAuthenticator.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ApplicationOnlyAccessTokenAuthenticator.java
@@ -46,7 +46,7 @@ class ApplicationOnlyAccessTokenAuthenticator implements Authenticator {
String accessToken = accessTokenHeader.substring(APIUtils.AUTHORIZATION_BASE.length());
synchronized (this) {
- if (mRedditDataRoomDatabase.accountDao().isAnonymousAccountInserted()) {
+ if (!mRedditDataRoomDatabase.accountDao().isAnonymousAccountInserted()) {
mRedditDataRoomDatabase.accountDao().insert(Account.getAnonymousAccount());
}
String accessTokenFromSharedPreference = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, "");