Compare commits

..

No commits in common. "f10e0306478f7e1f35308d2f73c8ce0faccdd841" and "d88bb723786e6074e05d540b9b28bccbc8e58234" have entirely different histories.

2 changed files with 2 additions and 13 deletions

View File

@ -1,9 +0,0 @@
# Breeze
My Mobile App for the Uek 335
## Linter
Start:
``` bash
./gradlew ktlintCheck
```

View File

@ -53,8 +53,6 @@ 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")
@ -67,14 +65,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) } ?: defaultPlzList return preferences[SHARED_PLZ_KEY]?.let { Json.decodeFromString(it) } ?: emptyList()
} }
// ### 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 = defaultPlzList arr = listOf("8005", "8005", "8005", "8400", "8400", "8500", "8500")
} }
plzArrayStatus = arr plzArrayStatus = arr
return arr[index] return arr[index]