Skip to content

Commit

Permalink
actions: bump kotlin_version to 2.0.10 (fixes #2106) (#2100)
Browse files Browse the repository at this point in the history
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Gideon Okuro <[email protected]>
Co-authored-by: dogi <[email protected]>
  • Loading branch information
3 people authored Aug 13, 2024
1 parent bbe7abd commit 3bc4b7e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
6 changes: 6 additions & 0 deletions app/src/main/kotlin/io/treehouses/remote/LiveDataWrapper.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package io.treehouses.remote

import androidx.lifecycle.MutableLiveData
import io.treehouses.remote.pojo.enum.Resource

class LiveDataWrapper<T>(val liveData: MutableLiveData<Resource<T>>)
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import androidx.lifecycle.map
import androidx.preference.PreferenceManager
import com.google.gson.Gson
import com.google.gson.JsonParseException
import io.treehouses.remote.LiveDataWrapper
import io.treehouses.remote.R
import io.treehouses.remote.bases.FragmentViewModel
import io.treehouses.remote.pojo.ServiceInfo
Expand Down Expand Up @@ -96,7 +97,12 @@ class ServicesViewModel(application: Application) : FragmentViewModel(applicatio
/**
* Easy array to iterate over livedatas and update their values upon error
*/
private val lives = listOf(serviceAction, autoRunAction, getLinkAction, editEnvAction)
private val lives = listOf(
LiveDataWrapper(serviceAction),
LiveDataWrapper(autoRunAction),
LiveDataWrapper(getLinkAction),
LiveDataWrapper(editEnvAction)
)
val error = MutableLiveData<String>()

/**
Expand Down Expand Up @@ -135,7 +141,9 @@ class ServicesViewModel(application: Application) : FragmentViewModel(applicatio
when {
match(output) == RESULTS.ERROR && !output.contains("kill [") && !output.contains("tput: No") -> { //kill to fix temporary issue
error.value = output
lives.forEach { it.value = Resource.nothing() }
lives.forEach { wrapper ->
wrapper.liveData.value = Resource.nothing()
}
}
editEnvAction.value?.status == LOADING && output.startsWith("treehouses services") -> editEnvAction.value = Resource.success(output.split(" ").toMutableList())
serverServiceData.value?.status == LOADING -> receiveJSON(output)
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.9.24'
ext.kotlin_version = '2.0.10'
repositories {
jcenter()
google()
Expand Down

0 comments on commit 3bc4b7e

Please sign in to comment.