Skip to content

Commit 1af0c08

Browse files
committed
#1648 fix: revenuecat caching works
An ancient shared preference migration was causing the RevenueCat cache to be deleted every time it was migrated on an app launch.
1 parent a5ac810 commit 1af0c08

1 file changed

Lines changed: 1 addition & 15 deletions

File tree

app/src/main/java/io/github/sds100/keymapper/data/repositories/SettingsPreferenceRepository.kt

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
package io.github.sds100.keymapper.data.repositories
22

33
import android.content.Context
4-
import androidx.datastore.preferences.SharedPreferencesMigration
54
import androidx.datastore.preferences.core.Preferences
65
import androidx.datastore.preferences.core.edit
76
import androidx.datastore.preferences.preferencesDataStore
8-
import io.github.sds100.keymapper.Constants
97
import kotlinx.coroutines.CoroutineScope
108
import kotlinx.coroutines.flow.Flow
119
import kotlinx.coroutines.flow.distinctUntilChanged
@@ -17,21 +15,9 @@ class SettingsPreferenceRepository(
1715
private val coroutineScope: CoroutineScope,
1816
) : PreferenceRepository {
1917

20-
companion object {
21-
private const val DEFAULT_SHARED_PREFS_NAME = "${Constants.PACKAGE_NAME}_preferences"
22-
}
23-
2418
private val ctx = context.applicationContext
2519

26-
private val sharedPreferencesMigration = SharedPreferencesMigration(
27-
ctx,
28-
DEFAULT_SHARED_PREFS_NAME,
29-
)
30-
31-
private val Context.dataStore by preferencesDataStore(
32-
name = "preferences",
33-
produceMigrations = { listOf(sharedPreferencesMigration) },
34-
)
20+
private val Context.dataStore by preferencesDataStore(name = "preferences")
3521

3622
private val dataStore = ctx.dataStore
3723

0 commit comments

Comments
 (0)