Cache locked state of connected accounts (#3790)

Small improvement to the behavior on bad/disconnected networks

Fixes https://github.com/tuskyapp/Tusky/issues/3773
This commit is contained in:
Konrad Pozniak 2023-07-27 00:09:26 +02:00 committed by GitHub
commit ee711598c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 1027 additions and 19 deletions

View file

@ -100,7 +100,11 @@ data class AccountEntity(
* ID of the status at the top of the visible list in the home timeline when the
* user navigated away.
*/
var lastVisibleHomeTimelineStatusId: String? = null
var lastVisibleHomeTimelineStatusId: String? = null,
/** true if the connected Mastodon account is locked (has to manually approve all follow requests **/
@ColumnInfo(defaultValue = "0")
var locked: Boolean = false
) {
val identifier: String

View file

@ -156,6 +156,7 @@ class AccountManager @Inject constructor(db: AppDatabase) {
it.defaultPostLanguage = account.source?.language.orEmpty()
it.defaultMediaSensitivity = account.source?.sensitive ?: false
it.emojis = account.emojis.orEmpty()
it.locked = account.locked
Log.d(TAG, "updateActiveAccount: saving account with id " + it.id)
accountDao.insertOrReplace(it)

View file

@ -42,11 +42,12 @@ import java.io.File;
TimelineAccountEntity.class,
ConversationEntity.class
},
version = 51,
version = 52,
autoMigrations = {
@AutoMigration(from = 48, to = 49),
@AutoMigration(from = 49, to = 50, spec = AppDatabase.MIGRATION_49_50.class),
@AutoMigration(from = 50, to = 51)
@AutoMigration(from = 50, to = 51),
@AutoMigration(from = 51, to = 52)
}
)
public abstract class AppDatabase extends RoomDatabase {