diff options
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java | 11 | ||||
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/activities/LoginActivity.java | 3 |
2 files changed, 11 insertions, 3 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java index a385ff4a..6c975dec 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java @@ -35,7 +35,7 @@ import ml.docilealligator.infinityforreddit.user.UserData; @Database(entities = {Account.class, SubredditData.class, SubscribedSubredditData.class, UserData.class, SubscribedUserData.class, MultiReddit.class, CustomTheme.class, RecentSearchQuery.class, - ReadPost.class, PostFilter.class, PostFilterUsage.class}, version = 16) + ReadPost.class, PostFilter.class, PostFilterUsage.class}, version = 17) public abstract class RedditDataRoomDatabase extends RoomDatabase { private static RedditDataRoomDatabase INSTANCE; @@ -48,7 +48,7 @@ public abstract class RedditDataRoomDatabase extends RoomDatabase { .addMigrations(MIGRATION_1_2, MIGRATION_2_3, MIGRATION_3_4, MIGRATION_4_5, MIGRATION_5_6, MIGRATION_6_7, MIGRATION_7_8, MIGRATION_8_9, MIGRATION_9_10, MIGRATION_10_11, MIGRATION_11_12, MIGRATION_12_13, - MIGRATION_13_14, MIGRATION_14_15, MIGRATION_15_16) + MIGRATION_13_14, MIGRATION_14_15, MIGRATION_15_16, MIGRATION_16_17) .build(); } } @@ -309,4 +309,11 @@ public abstract class RedditDataRoomDatabase extends RoomDatabase { database.execSQL("DROP TABLE subreddit_filter"); } }; + + private static final Migration MIGRATION_16_17 = new Migration(16, 17) { + @Override + public void migrate(@NonNull SupportSQLiteDatabase database) { + database.execSQL("UPDATE accounts SET is_current_user = 0"); + } + }; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LoginActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LoginActivity.java index a55567e8..210a81c7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LoginActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LoginActivity.java @@ -161,7 +161,8 @@ public class LoginActivity extends BaseActivity { @Override public void onFetchMyInfoSuccess(String name, String profileImageUrl, String bannerImageUrl, int karma) { mCurrentAccountSharedPreferences.edit().putString(SharedPreferencesUtils.ACCESS_TOKEN, accessToken) - .putString(SharedPreferencesUtils.ACCOUNT_NAME, name).apply(); + .putString(SharedPreferencesUtils.ACCOUNT_NAME, name) + .putString(SharedPreferencesUtils.ACCOUNT_IMAGE_URL, profileImageUrl).apply(); new ParseAndInsertNewAccountAsyncTask(name, accessToken, refreshToken, profileImageUrl, bannerImageUrl, karma, authCode, mRedditDataRoomDatabase.accountDao(), () -> { |