-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d48e40b
commit 2e47427
Showing
4 changed files
with
52 additions
and
16 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
.../wallet/instance/app/src/main/java/com/tonapps/tonkeeper/extensions/SettingsRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.tonapps.tonkeeper.extensions | ||
|
||
import com.tonapps.wallet.api.API | ||
import com.tonapps.wallet.data.settings.SettingsRepository | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.flow.flowOn | ||
import kotlinx.coroutines.flow.map | ||
import java.util.Locale | ||
|
||
fun SettingsRepository.getNormalizeCountryFlow(api: API) = countryFlow.map { country -> | ||
if (country.equals("AUTO", true) || country.isEmpty()) { | ||
api.resolveCountry() ?: getLocale().country | ||
} else { | ||
country | ||
} | ||
}.flowOn(Dispatchers.IO) | ||
|
||
fun SettingsRepository.getLocaleCountryFlow(api: API) = getNormalizeCountryFlow(api).map { | ||
Locale("", it) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters