Fix (IntegratedHentaiMigration): correctly migrate old users

This commit is contained in:
Cuong-Tran 2025-02-17 15:22:24 +07:00
parent 1247d4e466
commit 20d0b87b3a
No known key found for this signature in database
GPG key ID: 733AA7624B9315C2

View file

@ -9,8 +9,11 @@ class IntegratedHentaiMigration : Migration {
override val version: Float = 71f
override suspend fun invoke(migrationContext: MigrationContext): Boolean = withIOContext {
val unsortedPreferences = migrationContext.get<UnsortedPreferences>() ?: return@withIOContext false
unsortedPreferences.isHentaiEnabled().set(true)
val isHentaiEnabled = migrationContext.get<UnsortedPreferences>()?.isHentaiEnabled()
?: return@withIOContext false
if (!isHentaiEnabled.isSet() || isHentaiEnabled.get()) {
isHentaiEnabled.set(true)
}
return@withIOContext true
}
}