Compare commits

...

2 Commits

Author SHA1 Message Date
Lorenz Hohermuth f10e030647 APK Fix 2025-03-25 13:19:36 +01:00
Lorenz Hohermuth 3af4543949 added how to run linter in readme 2025-03-25 13:19:26 +01:00
2 changed files with 13 additions and 2 deletions

9
README.md Normal file
View File

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

View File

@ -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]