mirror of
https://github.com/home-assistant/android
synced 2024-09-06 17:23:32 +00:00
Fix current version sensor so it properly reports the flavor (#3104)
* Fix current version sensor so it properly reports the flavor * Review comments
This commit is contained in:
parent
bd044c9be0
commit
fd7a593c41
|
@ -0,0 +1,9 @@
|
|||
package io.homeassistant.companion.android.sensors
|
||||
|
||||
import io.homeassistant.companion.android.BuildConfig
|
||||
import io.homeassistant.companion.android.common.sensors.AppSensorManagerBase
|
||||
|
||||
class AppSensorManager : AppSensorManagerBase() {
|
||||
|
||||
override fun getCurrentVersion(): String = BuildConfig.VERSION_NAME
|
||||
}
|
|
@ -10,7 +10,6 @@ import android.net.wifi.WifiManager
|
|||
import android.os.PowerManager
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.homeassistant.companion.android.BuildConfig
|
||||
import io.homeassistant.companion.android.common.sensors.AppSensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.AudioSensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.BatterySensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.DNDSensorManager
|
||||
|
|
|
@ -9,11 +9,10 @@ import android.os.Process
|
|||
import android.util.Log
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.content.getSystemService
|
||||
import io.homeassistant.companion.android.common.BuildConfig
|
||||
import java.math.RoundingMode
|
||||
import io.homeassistant.companion.android.common.R as commonR
|
||||
|
||||
class AppSensorManager : SensorManager {
|
||||
abstract class AppSensorManagerBase : SensorManager {
|
||||
companion object {
|
||||
private const val TAG = "AppSensor"
|
||||
private const val GB = 1000000000
|
||||
|
@ -137,12 +136,14 @@ class AppSensorManager : SensorManager {
|
|||
}
|
||||
}
|
||||
|
||||
abstract fun getCurrentVersion(): String
|
||||
|
||||
private fun updateCurrentVersion(context: Context) {
|
||||
|
||||
if (!isEnabled(context, currentVersion.id))
|
||||
return
|
||||
|
||||
val state = BuildConfig.VERSION_NAME
|
||||
val state = getCurrentVersion()
|
||||
|
||||
onSensorUpdated(
|
||||
context,
|
|
@ -0,0 +1,9 @@
|
|||
package io.homeassistant.companion.android.sensors
|
||||
|
||||
import io.homeassistant.companion.android.BuildConfig
|
||||
import io.homeassistant.companion.android.common.sensors.AppSensorManagerBase
|
||||
|
||||
class AppSensorManager : AppSensorManagerBase() {
|
||||
|
||||
override fun getCurrentVersion(): String = BuildConfig.VERSION_NAME
|
||||
}
|
|
@ -10,7 +10,6 @@ import android.os.Build
|
|||
import android.os.PowerManager
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.homeassistant.companion.android.BuildConfig
|
||||
import io.homeassistant.companion.android.common.sensors.AppSensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.AudioSensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.BatterySensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.DNDSensorManager
|
||||
|
|
Loading…
Reference in a new issue