Skip to content

Commit 20d0b87

Browse files
committed
Fix (IntegratedHentaiMigration): correctly migrate old users
1 parent 1247d4e commit 20d0b87

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

app/src/main/java/mihon/core/migration/migrations/IntegratedHentaiMigration.kt

+5-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ class IntegratedHentaiMigration : Migration {
99
override val version: Float = 71f
1010

1111
override suspend fun invoke(migrationContext: MigrationContext): Boolean = withIOContext {
12-
val unsortedPreferences = migrationContext.get<UnsortedPreferences>() ?: return@withIOContext false
13-
unsortedPreferences.isHentaiEnabled().set(true)
12+
val isHentaiEnabled = migrationContext.get<UnsortedPreferences>()?.isHentaiEnabled()
13+
?: return@withIOContext false
14+
if (!isHentaiEnabled.isSet() || isHentaiEnabled.get()) {
15+
isHentaiEnabled.set(true)
16+
}
1417
return@withIOContext true
1518
}
1619
}

0 commit comments

Comments
 (0)