APK Fix
This commit is contained in:
parent
3af4543949
commit
f10e030647
|
@ -53,6 +53,8 @@ var plzArrayStatus: List<String> = listOf(
|
||||||
"Loading...",
|
"Loading...",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
val defaultPlzList = listOf("8005", "8005", "8005", "8400", "8400", "8500", "8500")
|
||||||
|
|
||||||
// ### Start ChatGPT + Fixing
|
// ### Start ChatGPT + Fixing
|
||||||
val SHARED_PLZ_KEY = stringPreferencesKey("shared-plz")
|
val SHARED_PLZ_KEY = stringPreferencesKey("shared-plz")
|
||||||
val Context.dataStore: DataStore<Preferences> by preferencesDataStore(name = "settings")
|
val Context.dataStore: DataStore<Preferences> by preferencesDataStore(name = "settings")
|
||||||
|
@ -65,14 +67,14 @@ suspend fun setLocations(context: Context, array: List<String>) {
|
||||||
|
|
||||||
suspend fun getLocations(context: Context): List<String> {
|
suspend fun getLocations(context: Context): List<String> {
|
||||||
val preferences = context.dataStore.data.first()
|
val preferences = context.dataStore.data.first()
|
||||||
return preferences[SHARED_PLZ_KEY]?.let { Json.decodeFromString(it) } ?: emptyList()
|
return preferences[SHARED_PLZ_KEY]?.let { Json.decodeFromString(it) } ?: defaultPlzList
|
||||||
}
|
}
|
||||||
// ### End ChatGPT
|
// ### End ChatGPT
|
||||||
|
|
||||||
suspend fun getPLZ(index: Int, ctx: Context): String {
|
suspend fun getPLZ(index: Int, ctx: Context): String {
|
||||||
var arr = getLocations(ctx)
|
var arr = getLocations(ctx)
|
||||||
if (arr.isEmpty() || arr.size != 7) {
|
if (arr.isEmpty() || arr.size != 7) {
|
||||||
arr = listOf("8005", "8005", "8005", "8400", "8400", "8500", "8500")
|
arr = defaultPlzList
|
||||||
}
|
}
|
||||||
plzArrayStatus = arr
|
plzArrayStatus = arr
|
||||||
return arr[index]
|
return arr[index]
|
||||||
|
|
Loading…
Reference in New Issue