Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class UserPreferences @Inject constructor(
val TOR_DISCLOSURE_ACCEPTED = booleanPreferencesKey("tor_disclosure_accepted")
val TOR_LAST_TEST_RESULT = stringPreferencesKey("tor_last_test_result")
val TOR_EXIT_COUNTRY = stringPreferencesKey("tor_exit_country")
val USER_COUNTRY = stringPreferencesKey("user_country")
}

// Flows
Expand Down Expand Up @@ -128,6 +129,8 @@ class UserPreferences @Inject constructor(
val unlockedAchievements: Flow<Set<String>> = dataStore.data.map { it[Keys.UNLOCKED_ACHIEVEMENTS] ?: emptySet() }
val overlayBubbleEnabled: Flow<Boolean> = dataStore.data.map { it[Keys.OVERLAY_BUBBLE_ENABLED] ?: true }

val userCountry: Flow<String> = dataStore.data.map { it[Keys.USER_COUNTRY] ?: "USA" }

suspend fun unlockAchievement(id: String) {
dataStore.edit { prefs ->
val current = prefs[Keys.UNLOCKED_ACHIEVEMENTS] ?: emptySet()
Expand Down Expand Up @@ -271,4 +274,7 @@ class UserPreferences @Inject constructor(
dataStore.edit { it[Keys.OVERLAY_BUBBLE_ENABLED] = enabled }
}

suspend fun setUserCountry(country: String) { dataStore.edit { it[Keys.USER_COUNTRY] = country } }


}
Loading