mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-30 12:57:12 +01:00
Switch to anonymous mode when updating the app. Save profile image url to SharedPreferences when logging in an account.
This commit is contained in:
parent
54ef23c357
commit
ef5ba34b87
@ -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");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -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(),
|
||||
() -> {
|
||||
|
Loading…
Reference in New Issue
Block a user