Skip to content

Commit

Permalink
Fix inserting the anonymous account even when it was already inserted.
Browse files Browse the repository at this point in the history
  • Loading branch information
Docile-Alligator committed Jan 13, 2024
1 parent d98c02d commit de7bc2d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public Request authenticate(Route route, @NonNull Response response) {
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, "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public Request authenticate(Route route, @NonNull Response response) {

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, "");
Expand Down

0 comments on commit de7bc2d

Please sign in to comment.