From e1508fd2df1046573b275d4e0fd74209c73d0515 Mon Sep 17 00:00:00 2001 From: Andrew Rowson Date: Sat, 5 Oct 2024 18:51:43 +0100 Subject: [PATCH] fix: preferences that are enums can be set either by integer or case-insensitive string fixes #1874 --- CHANGELOG.md | 2 ++ .../android/mqtt/MQTTMessagePublishTests.kt | 2 +- .../owntracks/android/ui/ClickOnPreference.kt | 2 +- .../android/ui/ContactsActivityTests.kt | 2 +- .../android/ui/PreferencesActivityTests.kt | 2 +- .../preferences/DefaultsProviderImpl.kt | 2 +- .../owntracks/android/ui/map/MapLayerStyle.kt | 2 +- .../main/java/org/owntracks/android/App.kt | 6 ++--- .../android/geocoding/GeocoderProvider.kt | 6 ++--- .../android/location/LocatorPriority.kt | 21 ++++++++++------ .../android/preferences/DefaultsProvider.kt | 8 +++---- .../preferences/PreferenceDataStoreShim.kt | 2 +- .../android/preferences/Preferences.kt | 4 ++-- .../android/preferences/PreferencesStore.kt | 5 ++-- .../android/preferences/types/AppTheme.kt | 16 ++++++------- .../preferences/types/ConnectionMode.kt | 4 +++- .../preferences/types/MonitoringMode.kt | 22 +++++++++-------- .../preferences/types/MqttProtocolLevel.kt | 4 +++- .../android/preferences/types/MqttQos.kt | 12 ++++++---- .../types/ReverseGeocodeProvider.kt | 12 ++++------ .../android/services/BackgroundService.kt | 8 +++---- .../android/services/LocationProcessor.kt | 6 ++--- .../android/services/OngoingNotification.kt | 8 +++---- .../owntracks/android/ui/map/MapActivity.kt | 12 ++++------ .../ui/map/MonitoringModeBottomSheetDialog.kt | 8 +++---- .../ui/preferences/AdvancedFragment.kt | 4 ++-- .../preferences/DefaultsProviderImpl.kt | 2 +- .../owntracks/android/ui/map/MapLayerStyle.kt | 2 +- .../android/geocoding/TestGeocoderProvider.kt | 7 +++--- .../org/owntracks/android/model/ParserTest.kt | 4 ++-- .../android/preferences/ImportExportTest.kt | 16 ++++++------- .../android/preferences/MonitoringModeTest.kt | 18 +++++++------- .../PreferencesGettersAndSetters.kt | 24 +++++++++---------- .../owntracks/android/preferences/Defaults.kt | 2 +- .../owntracks/android/preferences/Defaults.kt | 2 +- util/mqtt-local/push-mqtt-config-to-device.sh | 2 +- 36 files changed, 136 insertions(+), 125 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index acc7fac27f..aad43fa417 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ - Try to not block the main thread when generating an Status Message, which causes an ANR - Messages that fail to send because the endpoint isn't ready now retry every 10 seconds, not every second - Import config screen displays JSON config LTR under RTL locales +- setting / importing configuration options that are enums are now case-insensitive +- Fix regression where setting the locatorPriority preference using a number wasn't working (#1874) ## Version 2.5.3 diff --git a/project/app/src/androidTest/java/org/owntracks/android/mqtt/MQTTMessagePublishTests.kt b/project/app/src/androidTest/java/org/owntracks/android/mqtt/MQTTMessagePublishTests.kt index 2a910b4368..27d189758e 100644 --- a/project/app/src/androidTest/java/org/owntracks/android/mqtt/MQTTMessagePublishTests.kt +++ b/project/app/src/androidTest/java/org/owntracks/android/mqtt/MQTTMessagePublishTests.kt @@ -196,7 +196,7 @@ class MQTTMessagePublishTests : private fun setupTestActivity() { PreferenceManager.getDefaultSharedPreferences(app) .edit() - .putInt(Preferences::monitoring.name, MonitoringMode.QUIET.value) + .putInt(Preferences::monitoring.name, MonitoringMode.Quiet.value) .putString(Preferences::reverseGeocodeProvider.name, "None") .apply() setNotFirstStartPreferences() diff --git a/project/app/src/androidTest/java/org/owntracks/android/ui/ClickOnPreference.kt b/project/app/src/androidTest/java/org/owntracks/android/ui/ClickOnPreference.kt index f5580e7aa9..bae10d6f02 100644 --- a/project/app/src/androidTest/java/org/owntracks/android/ui/ClickOnPreference.kt +++ b/project/app/src/androidTest/java/org/owntracks/android/ui/ClickOnPreference.kt @@ -9,7 +9,7 @@ import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn import com.adevinta.android.barista.interaction.BaristaSleepInteractions.sleep import org.hamcrest.Matchers.allOf -private const val SLEEP_MILLIS = 100L +private const val SLEEP_MILLIS = 10L fun clickOnDrawerAndWait(text: Int) { Espresso.onView( diff --git a/project/app/src/androidTest/java/org/owntracks/android/ui/ContactsActivityTests.kt b/project/app/src/androidTest/java/org/owntracks/android/ui/ContactsActivityTests.kt index 66c7c3f35a..3a414377c2 100644 --- a/project/app/src/androidTest/java/org/owntracks/android/ui/ContactsActivityTests.kt +++ b/project/app/src/androidTest/java/org/owntracks/android/ui/ContactsActivityTests.kt @@ -43,7 +43,7 @@ class ContactsActivityTests : setNotFirstStartPreferences() getPreferences() .edit() - .putInt(Preferences::monitoring.name, MonitoringMode.QUIET.value) + .putInt(Preferences::monitoring.name, MonitoringMode.Quiet.value) .putString(Preferences::reverseGeocodeProvider.name, "None") .apply() launchActivity() diff --git a/project/app/src/androidTest/java/org/owntracks/android/ui/PreferencesActivityTests.kt b/project/app/src/androidTest/java/org/owntracks/android/ui/PreferencesActivityTests.kt index a49ae2c3c2..fe78f78bea 100644 --- a/project/app/src/androidTest/java/org/owntracks/android/ui/PreferencesActivityTests.kt +++ b/project/app/src/androidTest/java/org/owntracks/android/ui/PreferencesActivityTests.kt @@ -190,7 +190,7 @@ class PreferencesActivityTests : val expected = baristaRule.activityTestRule.activity.resources.run { getStringArray(R.array.geocoders)[ - getStringArray(R.array.geocoderValues).indexOfFirst { it == defaultGeocoder.value }] + getStringArray(R.array.geocoderValues).indexOfFirst { it == defaultGeocoder.name }] } assertContains(android.R.id.summary, expected) } diff --git a/project/app/src/gms/java/org/owntracks/android/preferences/DefaultsProviderImpl.kt b/project/app/src/gms/java/org/owntracks/android/preferences/DefaultsProviderImpl.kt index ae99e0b198..fd33c2a70f 100644 --- a/project/app/src/gms/java/org/owntracks/android/preferences/DefaultsProviderImpl.kt +++ b/project/app/src/gms/java/org/owntracks/android/preferences/DefaultsProviderImpl.kt @@ -9,7 +9,7 @@ class DefaultsProviderImpl : DefaultsProvider { override fun getDefaultValue(preferences: Preferences, property: KProperty<*>): T { return when (property) { Preferences::mapLayerStyle -> MapLayerStyle.GoogleMapDefault - Preferences::reverseGeocodeProvider -> ReverseGeocodeProvider.DEVICE + Preferences::reverseGeocodeProvider -> ReverseGeocodeProvider.Device else -> super.getDefaultValue(preferences, property) } as T diff --git a/project/app/src/gms/java/org/owntracks/android/ui/map/MapLayerStyle.kt b/project/app/src/gms/java/org/owntracks/android/ui/map/MapLayerStyle.kt index 5e01d2c47c..9fb989b150 100644 --- a/project/app/src/gms/java/org/owntracks/android/ui/map/MapLayerStyle.kt +++ b/project/app/src/gms/java/org/owntracks/android/ui/map/MapLayerStyle.kt @@ -34,7 +34,7 @@ enum class MapLayerStyle { @JvmStatic @FromConfiguration fun getByValue(value: String): MapLayerStyle = - entries.firstOrNull { it.name == value } ?: GoogleMapDefault + entries.firstOrNull { it.name.equals(value, true) } ?: GoogleMapDefault } } diff --git a/project/app/src/main/java/org/owntracks/android/App.kt b/project/app/src/main/java/org/owntracks/android/App.kt index 5e985914ec..42b46f6fec 100644 --- a/project/app/src/main/java/org/owntracks/android/App.kt +++ b/project/app/src/main/java/org/owntracks/android/App.kt @@ -193,9 +193,9 @@ class App : @MainThread private fun setThemeFromPreferences() { when (preferences.theme) { - AppTheme.AUTO -> AppCompatDelegate.setDefaultNightMode(Preferences.SYSTEM_NIGHT_AUTO_MODE) - AppTheme.DARK -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES) - AppTheme.LIGHT -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO) + AppTheme.Auto -> AppCompatDelegate.setDefaultNightMode(Preferences.SYSTEM_NIGHT_AUTO_MODE) + AppTheme.Dark -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES) + AppTheme.Light -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO) } } diff --git a/project/app/src/main/java/org/owntracks/android/geocoding/GeocoderProvider.kt b/project/app/src/main/java/org/owntracks/android/geocoding/GeocoderProvider.kt index 38963bf28b..4dfb12d816 100644 --- a/project/app/src/main/java/org/owntracks/android/geocoding/GeocoderProvider.kt +++ b/project/app/src/main/java/org/owntracks/android/geocoding/GeocoderProvider.kt @@ -51,10 +51,10 @@ constructor( withContext(ioDispatcher) { geocoder = when (preferences.reverseGeocodeProvider) { - ReverseGeocodeProvider.OPENCAGE -> + ReverseGeocodeProvider.OpenCage -> OpenCageGeocoder(preferences.opencageApiKey, httpClient) - ReverseGeocodeProvider.DEVICE -> DeviceGeocoder(context) - ReverseGeocodeProvider.NONE -> GeocoderNone() + ReverseGeocodeProvider.Device -> DeviceGeocoder(context) + ReverseGeocodeProvider.None -> GeocoderNone() } } } diff --git a/project/app/src/main/java/org/owntracks/android/location/LocatorPriority.kt b/project/app/src/main/java/org/owntracks/android/location/LocatorPriority.kt index e6bab37fdb..7f42e8aad0 100644 --- a/project/app/src/main/java/org/owntracks/android/location/LocatorPriority.kt +++ b/project/app/src/main/java/org/owntracks/android/location/LocatorPriority.kt @@ -2,16 +2,23 @@ package org.owntracks.android.location import org.owntracks.android.preferences.types.FromConfiguration -enum class LocatorPriority { - HighAccuracy, - BalancedPowerAccuracy, - LowPower, - NoPower; +enum class LocatorPriority(private val value: Int) { + HighAccuracy(3), + BalancedPowerAccuracy(2), + LowPower(1), + NoPower(0); companion object { @JvmStatic @FromConfiguration - fun getByValue(value: String?): LocatorPriority? = - LocatorPriority.entries.firstOrNull { it.name == value } + fun getByValue(value: Int): LocatorPriority = + LocatorPriority.entries.firstOrNull { it.value == value } ?: BalancedPowerAccuracy + + @JvmStatic + @FromConfiguration + fun getByValue(value: String): LocatorPriority = + value.toIntOrNull()?.run(::getByValue) + ?: entries.firstOrNull { it.name.equals(value, true) } + ?: BalancedPowerAccuracy } } diff --git a/project/app/src/main/java/org/owntracks/android/preferences/DefaultsProvider.kt b/project/app/src/main/java/org/owntracks/android/preferences/DefaultsProvider.kt index 35d0dbfc7d..47102eb802 100644 --- a/project/app/src/main/java/org/owntracks/android/preferences/DefaultsProvider.kt +++ b/project/app/src/main/java/org/owntracks/android/preferences/DefaultsProvider.kt @@ -41,7 +41,7 @@ interface DefaultsProvider { Preferences::locatorInterval -> 60 Preferences::locatorPriority -> null Preferences::mode -> ConnectionMode.MQTT - Preferences::monitoring -> MonitoringMode.SIGNIFICANT + Preferences::monitoring -> MonitoringMode.Significant Preferences::moveModeLocatorInterval -> 10 Preferences::mqttProtocolLevel -> MqttProtocolLevel.MQTT_3_1 Preferences::notificationEvents -> true @@ -55,7 +55,7 @@ interface DefaultsProvider { Preferences::ping -> 15 Preferences::port -> 8883 Preferences::extendedData -> true - Preferences::pubQos -> MqttQos.ONE + Preferences::pubQos -> MqttQos.One Preferences::pubRetain -> true Preferences::pubTopicBase -> "owntracks/%u/%d" Preferences::publishLocationOnConnect -> false @@ -64,9 +64,9 @@ interface DefaultsProvider { Preferences::setupCompleted -> false Preferences::showRegionsOnMap -> false Preferences::sub -> true - Preferences::subQos -> MqttQos.TWO + Preferences::subQos -> MqttQos.Two Preferences::subTopic -> DEFAULT_SUB_TOPIC - Preferences::theme -> AppTheme.AUTO + Preferences::theme -> AppTheme.Auto Preferences::tls -> true Preferences::tlsClientCrt -> "" Preferences::tid -> diff --git a/project/app/src/main/java/org/owntracks/android/preferences/PreferenceDataStoreShim.kt b/project/app/src/main/java/org/owntracks/android/preferences/PreferenceDataStoreShim.kt index 3d75ab670a..7ac6a38ea0 100644 --- a/project/app/src/main/java/org/owntracks/android/preferences/PreferenceDataStoreShim.kt +++ b/project/app/src/main/java/org/owntracks/android/preferences/PreferenceDataStoreShim.kt @@ -44,7 +44,7 @@ class PreferenceDataStoreShim @Inject constructor(private val preferences: Prefe override fun getString(key: String?, defValue: String?): String { val stringPreferenceValue = when (val preferenceValue = key?.run(preferences::getPreferenceByName) ?: defValue) { - is ReverseGeocodeProvider -> preferenceValue.value + is ReverseGeocodeProvider -> preferenceValue.name is StringMaxTwoAlphaNumericChars -> preferenceValue.toString() else -> preferenceValue } diff --git a/project/app/src/main/java/org/owntracks/android/preferences/Preferences.kt b/project/app/src/main/java/org/owntracks/android/preferences/Preferences.kt index a5bbfa0883..3736b98118 100644 --- a/project/app/src/main/java/org/owntracks/android/preferences/Preferences.kt +++ b/project/app/src/main/java/org/owntracks/android/preferences/Preferences.kt @@ -330,9 +330,9 @@ constructor( return pubQos } - val pubQosWaypoints = MqttQos.ZERO + val pubQosWaypoints = MqttQos.Zero - val pubQosStatus = MqttQos.ZERO + val pubQosStatus = MqttQos.Zero val pubRetainLocations: Boolean get() { diff --git a/project/app/src/main/java/org/owntracks/android/preferences/PreferencesStore.kt b/project/app/src/main/java/org/owntracks/android/preferences/PreferencesStore.kt index aacb289ae4..296c464f42 100644 --- a/project/app/src/main/java/org/owntracks/android/preferences/PreferencesStore.kt +++ b/project/app/src/main/java/org/owntracks/android/preferences/PreferencesStore.kt @@ -121,7 +121,8 @@ abstract class PreferencesStore : typeOf() -> AppTheme.getByValue(getInt(property.name, 0)) typeOf() -> StringMaxTwoAlphaNumericChars(getString(property.name, "") ?: "") - typeOf() -> LocatorPriority.getByValue(getString(property.name, "")) + typeOf() -> + LocatorPriority.getByValue(getString(property.name, "") ?: "") else -> throw UnsupportedPreferenceTypeException( "Trying to get property ${property.name} has type ${property.returnType}") @@ -212,7 +213,7 @@ abstract class PreferencesStore : is Int -> putInt(property.name, coercedValue) is Float -> putFloat(property.name, coercedValue) is Set<*> -> putStringSet(property.name, value as Set) - is ReverseGeocodeProvider -> putString(property.name, coercedValue.value) + is ReverseGeocodeProvider -> putString(property.name, coercedValue.name) is MapLayerStyle -> putString(property.name, coercedValue.name) is ConnectionMode -> putInt(property.name, coercedValue.value) is MonitoringMode -> putInt(property.name, coercedValue.value) diff --git a/project/app/src/main/java/org/owntracks/android/preferences/types/AppTheme.kt b/project/app/src/main/java/org/owntracks/android/preferences/types/AppTheme.kt index f38a5bf8bb..e1dc29f2d3 100644 --- a/project/app/src/main/java/org/owntracks/android/preferences/types/AppTheme.kt +++ b/project/app/src/main/java/org/owntracks/android/preferences/types/AppTheme.kt @@ -1,20 +1,20 @@ package org.owntracks.android.preferences.types -import com.fasterxml.jackson.annotation.JsonValue - -enum class AppTheme(@JsonValue val value: Int) { - LIGHT(0), - DARK(1), - AUTO(2); +enum class AppTheme(val value: Int) { + Light(0), + Dark(1), + Auto(2); companion object { @JvmStatic @FromConfiguration - fun getByValue(value: Int): AppTheme = entries.firstOrNull { it.value == value } ?: LIGHT + fun getByValue(value: Int): AppTheme = entries.firstOrNull { it.value == value } ?: Auto @JvmStatic @FromConfiguration fun getByValue(value: String): AppTheme = - (value.toIntOrNull() ?: Int.MIN_VALUE).run(::getByValue) + value.toIntOrNull()?.run(::getByValue) + ?: entries.firstOrNull { it.name.equals(value, true) } + ?: Auto } } diff --git a/project/app/src/main/java/org/owntracks/android/preferences/types/ConnectionMode.kt b/project/app/src/main/java/org/owntracks/android/preferences/types/ConnectionMode.kt index a918f57e72..bba4667737 100644 --- a/project/app/src/main/java/org/owntracks/android/preferences/types/ConnectionMode.kt +++ b/project/app/src/main/java/org/owntracks/android/preferences/types/ConnectionMode.kt @@ -14,6 +14,8 @@ enum class ConnectionMode(@JsonValue val value: Int) { @JvmStatic @FromConfiguration fun getByValue(value: String): ConnectionMode = - (value.toIntOrNull() ?: Int.MIN_VALUE).run(::getByValue) + value.toIntOrNull()?.run(::getByValue) + ?: entries.firstOrNull { it.name.equals(value, true) } + ?: MQTT } } diff --git a/project/app/src/main/java/org/owntracks/android/preferences/types/MonitoringMode.kt b/project/app/src/main/java/org/owntracks/android/preferences/types/MonitoringMode.kt index a22b992070..7eec5f749c 100644 --- a/project/app/src/main/java/org/owntracks/android/preferences/types/MonitoringMode.kt +++ b/project/app/src/main/java/org/owntracks/android/preferences/types/MonitoringMode.kt @@ -3,28 +3,30 @@ package org.owntracks.android.preferences.types import com.fasterxml.jackson.annotation.JsonValue enum class MonitoringMode(@JsonValue val value: Int) { - QUIET(-1), - MANUAL(0), - SIGNIFICANT(1), - MOVE(2); + Quiet(-1), + Manual(0), + Significant(1), + Move(2); fun next(): MonitoringMode = when (this) { - QUIET -> MANUAL - MANUAL -> SIGNIFICANT - SIGNIFICANT -> MOVE - MOVE -> QUIET + Quiet -> Manual + Manual -> Significant + Significant -> Move + Move -> Quiet } companion object { @JvmStatic @FromConfiguration fun getByValue(value: Int): MonitoringMode = - entries.firstOrNull { it.value == value } ?: SIGNIFICANT + entries.firstOrNull { it.value == value } ?: Significant @JvmStatic @FromConfiguration fun getByValue(value: String): MonitoringMode = - (value.toIntOrNull() ?: Int.MIN_VALUE).run(::getByValue) + value.toIntOrNull()?.run(::getByValue) + ?: entries.firstOrNull { it.name.equals(value, true) } + ?: Significant } } diff --git a/project/app/src/main/java/org/owntracks/android/preferences/types/MqttProtocolLevel.kt b/project/app/src/main/java/org/owntracks/android/preferences/types/MqttProtocolLevel.kt index 4aab0ed158..f44c0850de 100644 --- a/project/app/src/main/java/org/owntracks/android/preferences/types/MqttProtocolLevel.kt +++ b/project/app/src/main/java/org/owntracks/android/preferences/types/MqttProtocolLevel.kt @@ -15,6 +15,8 @@ enum class MqttProtocolLevel(@JsonValue val value: Int) { @JvmStatic @FromConfiguration fun getByValue(value: String): MqttProtocolLevel = - (value.toIntOrNull() ?: Int.MIN_VALUE).run(::getByValue) + value.toIntOrNull()?.run(::getByValue) + ?: entries.firstOrNull { it.name.equals(value, true) } + ?: MQTT_3_1 } } diff --git a/project/app/src/main/java/org/owntracks/android/preferences/types/MqttQos.kt b/project/app/src/main/java/org/owntracks/android/preferences/types/MqttQos.kt index 1bc2719d47..a19041ff24 100644 --- a/project/app/src/main/java/org/owntracks/android/preferences/types/MqttQos.kt +++ b/project/app/src/main/java/org/owntracks/android/preferences/types/MqttQos.kt @@ -3,18 +3,20 @@ package org.owntracks.android.preferences.types import com.fasterxml.jackson.annotation.JsonValue enum class MqttQos(@JsonValue val value: Int) { - ZERO(0), - ONE(1), - TWO(2); + Zero(0), + One(1), + Two(2); companion object { @JvmStatic @FromConfiguration - fun getByValue(value: Int): MqttQos = entries.firstOrNull { it.value == value } ?: ONE + fun getByValue(value: Int): MqttQos = entries.firstOrNull { it.value == value } ?: One @JvmStatic @FromConfiguration fun getByValue(value: String): MqttQos = - (value.toIntOrNull() ?: Int.MIN_VALUE).run(::getByValue) + value.toIntOrNull()?.run(::getByValue) + ?: entries.firstOrNull { it.name.equals(value, true) } + ?: One } } diff --git a/project/app/src/main/java/org/owntracks/android/preferences/types/ReverseGeocodeProvider.kt b/project/app/src/main/java/org/owntracks/android/preferences/types/ReverseGeocodeProvider.kt index e1cadd2c3b..9e9c63b5f2 100644 --- a/project/app/src/main/java/org/owntracks/android/preferences/types/ReverseGeocodeProvider.kt +++ b/project/app/src/main/java/org/owntracks/android/preferences/types/ReverseGeocodeProvider.kt @@ -1,16 +1,14 @@ package org.owntracks.android.preferences.types -import com.fasterxml.jackson.annotation.JsonValue - -enum class ReverseGeocodeProvider(@JsonValue val value: String) { - NONE("None"), - DEVICE("Device"), - OPENCAGE("OpenCage"); +enum class ReverseGeocodeProvider { + None, + Device, + OpenCage; companion object { @JvmStatic @FromConfiguration fun getByValue(value: String): ReverseGeocodeProvider = - entries.firstOrNull { it.value == value } ?: NONE + entries.firstOrNull { it.name.equals(value, true) } ?: None } } diff --git a/project/app/src/main/java/org/owntracks/android/services/BackgroundService.kt b/project/app/src/main/java/org/owntracks/android/services/BackgroundService.kt index b5c09a9493..e90d6645b0 100644 --- a/project/app/src/main/java/org/owntracks/android/services/BackgroundService.kt +++ b/project/app/src/main/java/org/owntracks/android/services/BackgroundService.kt @@ -520,20 +520,20 @@ class BackgroundService : LifecycleService(), Preferences.OnPreferenceChangeList var smallestDisplacement: Float? = null val priority: LocatorPriority when (monitoring) { - MonitoringMode.QUIET, - MonitoringMode.MANUAL -> { + MonitoringMode.Quiet, + MonitoringMode.Manual -> { interval = Duration.ofSeconds(preferences.locatorInterval.toLong()) smallestDisplacement = preferences.locatorDisplacement.toFloat() priority = preferences.locatorPriority ?: LocatorPriority.LowPower } - MonitoringMode.SIGNIFICANT -> { + MonitoringMode.Significant -> { interval = Duration.ofSeconds(preferences.locatorInterval.toLong()) smallestDisplacement = preferences.locatorDisplacement.toFloat() priority = preferences.locatorPriority ?: LocatorPriority.BalancedPowerAccuracy } - MonitoringMode.MOVE -> { + MonitoringMode.Move -> { interval = Duration.ofSeconds(preferences.moveModeLocatorInterval.toLong()) priority = preferences.locatorPriority ?: LocatorPriority.HighAccuracy } diff --git a/project/app/src/main/java/org/owntracks/android/services/LocationProcessor.kt b/project/app/src/main/java/org/owntracks/android/services/LocationProcessor.kt index 2d99a147e3..d0bdc563d4 100644 --- a/project/app/src/main/java/org/owntracks/android/services/LocationProcessor.kt +++ b/project/app/src/main/java/org/owntracks/android/services/LocationProcessor.kt @@ -93,12 +93,12 @@ constructor( MessageTransition.TRIGGER_LOCATION) } } - if (preferences.monitoring === MonitoringMode.QUIET && + if (preferences.monitoring === MonitoringMode.Quiet && MessageLocation.ReportType.USER != trigger) { Timber.v("message suppressed by monitoring settings: quiet") return Result.failure(Exception("message suppressed by monitoring settings: quiet")) } - if (preferences.monitoring === MonitoringMode.MANUAL && + if (preferences.monitoring === MonitoringMode.Manual && MessageLocation.ReportType.USER != trigger && MessageLocation.ReportType.CIRCULAR != trigger) { Timber.v("message suppressed by monitoring settings: manual") @@ -189,7 +189,7 @@ constructor( waypointModel.lastTransition = transition waypointModel.lastTriggered = Instant.now() waypointsRepo.update(waypointModel, false) - if (preferences.monitoring === MonitoringMode.QUIET) { + if (preferences.monitoring === MonitoringMode.Quiet) { Timber.v("message suppressed by monitoring settings: ${preferences.monitoring}") } else { publishTransitionMessage(waypointModel, location, transition, trigger) diff --git a/project/app/src/main/java/org/owntracks/android/services/OngoingNotification.kt b/project/app/src/main/java/org/owntracks/android/services/OngoingNotification.kt index 4d359a353c..af0ea905a2 100644 --- a/project/app/src/main/java/org/owntracks/android/services/OngoingNotification.kt +++ b/project/app/src/main/java/org/owntracks/android/services/OngoingNotification.kt @@ -126,10 +126,10 @@ class OngoingNotification(private val context: Context, private val initialMode: private fun getMonitoringLabel(monitoringMode: MonitoringMode) = context.run { when (monitoringMode) { - MonitoringMode.QUIET -> getString(R.string.monitoring_quiet) - MonitoringMode.MANUAL -> getString(R.string.monitoring_manual) - MonitoringMode.SIGNIFICANT -> getString(R.string.monitoring_significant) - MonitoringMode.MOVE -> getString(R.string.monitoring_move) + MonitoringMode.Quiet -> getString(R.string.monitoring_quiet) + MonitoringMode.Manual -> getString(R.string.monitoring_manual) + MonitoringMode.Significant -> getString(R.string.monitoring_significant) + MonitoringMode.Move -> getString(R.string.monitoring_move) } } diff --git a/project/app/src/main/java/org/owntracks/android/ui/map/MapActivity.kt b/project/app/src/main/java/org/owntracks/android/ui/map/MapActivity.kt index 74cd90ee8a..b85898e7db 100644 --- a/project/app/src/main/java/org/owntracks/android/ui/map/MapActivity.kt +++ b/project/app/src/main/java/org/owntracks/android/ui/map/MapActivity.kt @@ -17,7 +17,6 @@ import android.os.Bundle import android.os.IBinder import android.provider.Settings import android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS -import android.text.TextUtils.replace import android.util.TypedValue import android.view.Menu import android.view.MenuItem @@ -31,10 +30,7 @@ import androidx.annotation.VisibleForTesting import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.widget.LinearLayoutCompat import androidx.appcompat.widget.TooltipCompat -import androidx.core.app.ActivityCompat.shouldShowRequestPermissionRationale import androidx.core.app.NotificationManagerCompat -import androidx.core.content.ContextCompat.getSystemService -import androidx.core.content.ContextCompat.startActivity import androidx.core.view.setPadding import androidx.core.widget.ImageViewCompat import androidx.databinding.BindingAdapter @@ -609,19 +605,19 @@ class MapActivity : private fun updateMonitoringModeMenu() { menu?.findItem(R.id.menu_monitoring)?.run { when (preferences.monitoring) { - MonitoringMode.QUIET -> { + MonitoringMode.Quiet -> { setIcon(R.drawable.ic_baseline_stop_36) setTitle(R.string.monitoring_quiet) } - MonitoringMode.MANUAL -> { + MonitoringMode.Manual -> { setIcon(R.drawable.ic_baseline_pause_36) setTitle(R.string.monitoring_manual) } - MonitoringMode.SIGNIFICANT -> { + MonitoringMode.Significant -> { setIcon(R.drawable.ic_baseline_play_arrow_36) setTitle(R.string.monitoring_significant) } - MonitoringMode.MOVE -> { + MonitoringMode.Move -> { setIcon(R.drawable.ic_step_forward_2) setTitle(R.string.monitoring_move) } diff --git a/project/app/src/main/java/org/owntracks/android/ui/map/MonitoringModeBottomSheetDialog.kt b/project/app/src/main/java/org/owntracks/android/ui/map/MonitoringModeBottomSheetDialog.kt index 417aaf1ddf..2600388acf 100644 --- a/project/app/src/main/java/org/owntracks/android/ui/map/MonitoringModeBottomSheetDialog.kt +++ b/project/app/src/main/java/org/owntracks/android/ui/map/MonitoringModeBottomSheetDialog.kt @@ -20,10 +20,10 @@ class MonitoringModeBottomSheetDialog : BottomSheetDialogFragment() { ): View { binding = ModeBottomSheetDialogBinding.inflate(inflater, container, false) mapOf( - binding.fabMonitoringModeQuiet to MonitoringMode.QUIET, - binding.fabMonitoringModeManual to MonitoringMode.MANUAL, - binding.fabMonitoringModeSignificantChanges to MonitoringMode.SIGNIFICANT, - binding.fabMonitoringModeMove to MonitoringMode.MOVE) + binding.fabMonitoringModeQuiet to MonitoringMode.Quiet, + binding.fabMonitoringModeManual to MonitoringMode.Manual, + binding.fabMonitoringModeSignificantChanges to MonitoringMode.Significant, + binding.fabMonitoringModeMove to MonitoringMode.Move) .forEach { it.key.setOnClickListener { _ -> viewModel.setMonitoringMode(it.value) diff --git a/project/app/src/main/java/org/owntracks/android/ui/preferences/AdvancedFragment.kt b/project/app/src/main/java/org/owntracks/android/ui/preferences/AdvancedFragment.kt index 3f88362709..d5a0cfc058 100644 --- a/project/app/src/main/java/org/owntracks/android/ui/preferences/AdvancedFragment.kt +++ b/project/app/src/main/java/org/owntracks/android/ui/preferences/AdvancedFragment.kt @@ -62,7 +62,7 @@ class AdvancedFragment @Inject constructor() : findPreference(Preferences::reverseGeocodeProvider.name) ?.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { preference, newValue -> - if (newValue == ReverseGeocodeProvider.OPENCAGE.value) { + if (newValue == ReverseGeocodeProvider.OpenCage.name) { MaterialAlertDialogBuilder(requireContext()) .setTitle(R.string.preferencesAdvancedOpencagePrivacyDialogTitle) .setMessage(R.string.preferencesAdvancedOpencagePrivacyDialogMessage) @@ -86,7 +86,7 @@ class AdvancedFragment @Inject constructor() : private fun setOpenCageAPIKeyPreferenceVisibility() { setOf(Preferences::opencageApiKey.name, "opencagePrivacy").forEach { findPreference(it)?.isVisible = - preferences.reverseGeocodeProvider == ReverseGeocodeProvider.OPENCAGE + preferences.reverseGeocodeProvider == ReverseGeocodeProvider.OpenCage } } diff --git a/project/app/src/oss/java/org/owntracks/android/preferences/DefaultsProviderImpl.kt b/project/app/src/oss/java/org/owntracks/android/preferences/DefaultsProviderImpl.kt index 703b2d0d93..173b305d67 100644 --- a/project/app/src/oss/java/org/owntracks/android/preferences/DefaultsProviderImpl.kt +++ b/project/app/src/oss/java/org/owntracks/android/preferences/DefaultsProviderImpl.kt @@ -9,7 +9,7 @@ class DefaultsProviderImpl : DefaultsProvider { override fun getDefaultValue(preferences: Preferences, property: KProperty<*>): T { return when (property) { Preferences::mapLayerStyle -> MapLayerStyle.OpenStreetMapNormal - Preferences::reverseGeocodeProvider -> ReverseGeocodeProvider.NONE + Preferences::reverseGeocodeProvider -> ReverseGeocodeProvider.None else -> super.getDefaultValue(preferences, property) } as T diff --git a/project/app/src/oss/java/org/owntracks/android/ui/map/MapLayerStyle.kt b/project/app/src/oss/java/org/owntracks/android/ui/map/MapLayerStyle.kt index 8ad2c529ae..a2d0b568b6 100644 --- a/project/app/src/oss/java/org/owntracks/android/ui/map/MapLayerStyle.kt +++ b/project/app/src/oss/java/org/owntracks/android/ui/map/MapLayerStyle.kt @@ -13,7 +13,7 @@ enum class MapLayerStyle { @JvmStatic @FromConfiguration fun getByValue(value: String): MapLayerStyle = - MapLayerStyle.values().firstOrNull { it.name == value } ?: OpenStreetMapNormal + MapLayerStyle.values().firstOrNull { it.name.equals(value, true) } ?: OpenStreetMapNormal } } diff --git a/project/app/src/test/java/org/owntracks/android/geocoding/TestGeocoderProvider.kt b/project/app/src/test/java/org/owntracks/android/geocoding/TestGeocoderProvider.kt index 354cc18afc..4955ca5d01 100644 --- a/project/app/src/test/java/org/owntracks/android/geocoding/TestGeocoderProvider.kt +++ b/project/app/src/test/java/org/owntracks/android/geocoding/TestGeocoderProvider.kt @@ -15,7 +15,6 @@ import okhttp3.Response import okhttp3.ResponseBody.Companion.toResponseBody import org.junit.Assert.assertEquals import org.junit.Test -import org.mockito.Mockito.spy import org.mockito.Mockito.times import org.mockito.Mockito.verify import org.mockito.kotlin.any @@ -39,7 +38,7 @@ class TestGeocoderProvider { val mockContext: Context = mock {} val notificationManager: NotificationManagerCompat = mock {} val preferences = Preferences(InMemoryPreferencesStore(), mockIdlingResource) - preferences.reverseGeocodeProvider = ReverseGeocodeProvider.NONE + preferences.reverseGeocodeProvider = ReverseGeocodeProvider.None val provider = GeocoderProvider( mockContext, @@ -59,7 +58,7 @@ class TestGeocoderProvider { val mockContext: Context = mock {} val notificationManager: NotificationManagerCompat = mock {} val preferences = Preferences(InMemoryPreferencesStore(), mockIdlingResource) - preferences.reverseGeocodeProvider = ReverseGeocodeProvider.NONE + preferences.reverseGeocodeProvider = ReverseGeocodeProvider.None val provider = GeocoderProvider( mockContext, @@ -94,7 +93,7 @@ class TestGeocoderProvider { val mockContext: Context = mock {} val notificationManager: NotificationManagerCompat = mock {} val preferences = Preferences(InMemoryPreferencesStore(), mockIdlingResource) - preferences.reverseGeocodeProvider = ReverseGeocodeProvider.OPENCAGE + preferences.reverseGeocodeProvider = ReverseGeocodeProvider.OpenCage val provider = GeocoderProvider( mockContext, diff --git a/project/app/src/test/java/org/owntracks/android/model/ParserTest.kt b/project/app/src/test/java/org/owntracks/android/model/ParserTest.kt index 09d5a2deb8..4001ea8a6e 100644 --- a/project/app/src/test/java/org/owntracks/android/model/ParserTest.kt +++ b/project/app/src/test/java/org/owntracks/android/model/ParserTest.kt @@ -51,7 +51,7 @@ class ParserTest { batteryStatus = BatteryStatus.CHARGING bssid = "12:34:56:78" conn = "TestConn" - monitoringMode = MonitoringMode.SIGNIFICANT + monitoringMode = MonitoringMode.Significant ssid = "Wifi SSID" } private val messageLocation = @@ -81,7 +81,7 @@ class ParserTest { testPreferences = mock { on { encryptionKey } doReturn "testEncryptionKey" on { pubTopicLocations } doReturn "owntracks/testUsername/testDevice" - on { pubQosLocations } doReturn MqttQos.ONE + on { pubQosLocations } doReturn MqttQos.One } encryptionProvider = mock { on { isPayloadEncryptionEnabled } doReturn false } } diff --git a/project/app/src/test/java/org/owntracks/android/preferences/ImportExportTest.kt b/project/app/src/test/java/org/owntracks/android/preferences/ImportExportTest.kt index bbfcc712ad..88e19c0b47 100644 --- a/project/app/src/test/java/org/owntracks/android/preferences/ImportExportTest.kt +++ b/project/app/src/test/java/org/owntracks/android/preferences/ImportExportTest.kt @@ -113,7 +113,7 @@ class ImportExportTest { assertEquals(60, locatorInterval) assertEquals(LocatorPriority.LowPower, locatorPriority) assertEquals(ConnectionMode.MQTT, mode) - assertEquals(MonitoringMode.SIGNIFICANT, monitoring) + assertEquals(MonitoringMode.Significant, monitoring) assertEquals(10, moveModeLocatorInterval) assertEquals(MqttProtocolLevel.MQTT_3_1, mqttProtocolLevel) assert(!notificationHigherPriority) @@ -123,12 +123,12 @@ class ImportExportTest { assertEquals(30, ping) assertEquals(1883, port) assert(extendedData) - assertEquals(MqttQos.ONE, pubQos) + assertEquals(MqttQos.One, pubQos) assert(pubRetain) assertEquals("owntracks/%u/%d", pubTopicBase) assert(remoteConfiguration) assert(sub) - assertEquals(MqttQos.TWO, subQos) + assertEquals(MqttQos.Two, subQos) assertEquals("owntracks/+/+", subTopic) assert(!tls) assertEquals("testusername", username) @@ -155,7 +155,7 @@ class ImportExportTest { locatorInterval = 60 locatorPriority = null mode = ConnectionMode.MQTT - monitoring = MonitoringMode.SIGNIFICANT + monitoring = MonitoringMode.Significant moveModeLocatorInterval = 10 mqttProtocolLevel = MqttProtocolLevel.MQTT_3_1 notificationHigherPriority = false @@ -165,12 +165,12 @@ class ImportExportTest { ping = 30 port = 1883 extendedData = true - pubQos = MqttQos.ONE + pubQos = MqttQos.One pubRetain = true pubTopicBase = "owntracks/%u/%d" remoteConfiguration = true sub = true - subQos = MqttQos.TWO + subQos = MqttQos.Two subTopic = "owntracks/+/+" tls = false username = "testusername" @@ -225,12 +225,12 @@ class ImportExportTest { assertFalse(jsonNode.get("publishLocationOnConnect").asBoolean()) assertTrue(jsonNode.get("remoteConfiguration").asBoolean()) assertEquals( - defaultReverseGeocodeProvider.value, jsonNode.get("reverseGeocodeProvider").asText()) + defaultReverseGeocodeProvider.name, jsonNode.get("reverseGeocodeProvider").asText()) assertFalse(jsonNode.get("showRegionsOnMap").asBoolean()) assertTrue(jsonNode.get("sub").asBoolean()) assertEquals(2, jsonNode.get("subQos").asInt()) assertEquals("owntracks/+/+", jsonNode.get("subTopic").asText()) - assertEquals(2, jsonNode.get("theme").asInt()) + assertEquals("Auto", jsonNode.get("theme").asText()) assertEquals("wn", jsonNode.get("tid").asText()) assertFalse(jsonNode.get("tls").asBoolean()) assertEquals("", jsonNode.get("tlsClientCrt").asText()) diff --git a/project/app/src/test/java/org/owntracks/android/preferences/MonitoringModeTest.kt b/project/app/src/test/java/org/owntracks/android/preferences/MonitoringModeTest.kt index f9b2a903e7..ab4201c642 100644 --- a/project/app/src/test/java/org/owntracks/android/preferences/MonitoringModeTest.kt +++ b/project/app/src/test/java/org/owntracks/android/preferences/MonitoringModeTest.kt @@ -8,46 +8,46 @@ class MonitoringModeTest { @Test fun `Resolving quiet mode by value gets quiet mode`() { - assertEquals(MonitoringMode.QUIET, MonitoringMode.getByValue(-1)) + assertEquals(MonitoringMode.Quiet, MonitoringMode.getByValue(-1)) } @Test fun `Resolving manual mode by value gets quiet mode`() { - assertEquals(MonitoringMode.MANUAL, MonitoringMode.getByValue(0)) + assertEquals(MonitoringMode.Manual, MonitoringMode.getByValue(0)) } @Test fun `Resolving significant mode by value gets quiet mode`() { - assertEquals(MonitoringMode.SIGNIFICANT, MonitoringMode.getByValue(1)) + assertEquals(MonitoringMode.Significant, MonitoringMode.getByValue(1)) } @Test fun `Resolving move mode by value gets quiet mode`() { - assertEquals(MonitoringMode.MOVE, MonitoringMode.getByValue(2)) + assertEquals(MonitoringMode.Move, MonitoringMode.getByValue(2)) } @Test fun `Resolving unknown value gets default significant mode`() { - assertEquals(MonitoringMode.SIGNIFICANT, MonitoringMode.getByValue(50)) + assertEquals(MonitoringMode.Significant, MonitoringMode.getByValue(50)) } @Test fun `The next mode after quiet is manual`() { - assertEquals(MonitoringMode.MANUAL, MonitoringMode.QUIET.next()) + assertEquals(MonitoringMode.Manual, MonitoringMode.Quiet.next()) } @Test fun `The next mode after manual is significant`() { - assertEquals(MonitoringMode.SIGNIFICANT, MonitoringMode.MANUAL.next()) + assertEquals(MonitoringMode.Significant, MonitoringMode.Manual.next()) } @Test fun `The next mode after significant is move`() { - assertEquals(MonitoringMode.MOVE, MonitoringMode.SIGNIFICANT.next()) + assertEquals(MonitoringMode.Move, MonitoringMode.Significant.next()) } @Test fun `The next mode after move is quiet`() { - assertEquals(MonitoringMode.QUIET, MonitoringMode.MOVE.next()) + assertEquals(MonitoringMode.Quiet, MonitoringMode.Move.next()) } } diff --git a/project/app/src/test/java/org/owntracks/android/preferences/PreferencesGettersAndSetters.kt b/project/app/src/test/java/org/owntracks/android/preferences/PreferencesGettersAndSetters.kt index 33ee62e6a2..87ff8faffe 100644 --- a/project/app/src/test/java/org/owntracks/android/preferences/PreferencesGettersAndSetters.kt +++ b/project/app/src/test/java/org/owntracks/android/preferences/PreferencesGettersAndSetters.kt @@ -96,25 +96,25 @@ class PreferencesGettersAndSetters(private val parameter: Parameter) { Parameter("fusedRegionDetection", true, Boolean::class, false), Parameter( "reverseGeocodeProvider", - ReverseGeocodeProvider.DEVICE, + ReverseGeocodeProvider.Device, ReverseGeocodeProvider::class, false, preferenceValueInConfiguration = "Device"), Parameter( "reverseGeocodeProvider", - ReverseGeocodeProvider.OPENCAGE, + ReverseGeocodeProvider.OpenCage, ReverseGeocodeProvider::class, false, preferenceValueInConfiguration = "OpenCage"), Parameter( "reverseGeocodeProvider", - ReverseGeocodeProvider.NONE, + ReverseGeocodeProvider.None, ReverseGeocodeProvider::class, false, preferenceValueInConfiguration = "None"), Parameter( "reverseGeocodeProvider", - ReverseGeocodeProvider.NONE, + ReverseGeocodeProvider.None, ReverseGeocodeProvider::class, false, preferenceValueInConfiguration = "Nonsense"), @@ -155,19 +155,19 @@ class PreferencesGettersAndSetters(private val parameter: Parameter) { preferenceValueInConfiguration = -1), Parameter( "monitoring", - MonitoringMode.SIGNIFICANT, + MonitoringMode.Significant, MonitoringMode::class, false, preferenceValueInConfiguration = 1), Parameter( "monitoring", - MonitoringMode.SIGNIFICANT, + MonitoringMode.Significant, MonitoringMode::class, false, preferenceValueInConfiguration = -5), Parameter( "monitoring", - MonitoringMode.QUIET, + MonitoringMode.Quiet, MonitoringMode::class, false, preferenceValueInConfiguration = -1), @@ -211,17 +211,17 @@ class PreferencesGettersAndSetters(private val parameter: Parameter) { Parameter("port", 65535, Int::class, false), Parameter("extendedData", true, Boolean::class, false), Parameter( - "pubQos", MqttQos.ONE, MqttQos::class, false, preferenceValueInConfiguration = 1), + "pubQos", MqttQos.One, MqttQos::class, false, preferenceValueInConfiguration = 1), Parameter( "pubQos", - MqttQos.ZERO, + MqttQos.Zero, MqttQos::class, false, preferenceValueInConfiguration = 0), Parameter( - "pubQos", MqttQos.TWO, MqttQos::class, false, preferenceValueInConfiguration = 2), + "pubQos", MqttQos.Two, MqttQos::class, false, preferenceValueInConfiguration = 2), Parameter( - "pubQos", MqttQos.ONE, MqttQos::class, false, preferenceValueInConfiguration = 5), + "pubQos", MqttQos.One, MqttQos::class, false, preferenceValueInConfiguration = 5), Parameter("pubRetain", true, Boolean::class, false), Parameter("pubTopicBase", "testDeviceTopic", String::class, false), Parameter("cmd", true, Boolean::class, false), @@ -229,7 +229,7 @@ class PreferencesGettersAndSetters(private val parameter: Parameter) { Parameter("publishLocationOnConnect", true, Boolean::class, false), Parameter("sub", true, Boolean::class, false), Parameter( - "subQos", MqttQos.ONE, MqttQos::class, false, preferenceValueInConfiguration = 1), + "subQos", MqttQos.One, MqttQos::class, false, preferenceValueInConfiguration = 1), Parameter("subTopic", "testSubTopic", String::class, false), Parameter("tls", true, Boolean::class, false), Parameter("tlsClientCrt", "clientCertName", String::class, false), diff --git a/project/app/src/testGms/java/org/owntracks/android/preferences/Defaults.kt b/project/app/src/testGms/java/org/owntracks/android/preferences/Defaults.kt index 977df77999..e8df610d70 100644 --- a/project/app/src/testGms/java/org/owntracks/android/preferences/Defaults.kt +++ b/project/app/src/testGms/java/org/owntracks/android/preferences/Defaults.kt @@ -3,5 +3,5 @@ package org.owntracks.android.preferences import org.owntracks.android.preferences.types.ReverseGeocodeProvider import org.owntracks.android.ui.map.MapLayerStyle -val defaultReverseGeocodeProvider = ReverseGeocodeProvider.DEVICE +val defaultReverseGeocodeProvider = ReverseGeocodeProvider.Device val defaultMapLayerStyle = MapLayerStyle.GoogleMapDefault diff --git a/project/app/src/testOss/java/org/owntracks/android/preferences/Defaults.kt b/project/app/src/testOss/java/org/owntracks/android/preferences/Defaults.kt index 0cac454948..084816fd62 100644 --- a/project/app/src/testOss/java/org/owntracks/android/preferences/Defaults.kt +++ b/project/app/src/testOss/java/org/owntracks/android/preferences/Defaults.kt @@ -3,5 +3,5 @@ package org.owntracks.android.preferences import org.owntracks.android.preferences.types.ReverseGeocodeProvider import org.owntracks.android.ui.map.MapLayerStyle -val defaultReverseGeocodeProvider = ReverseGeocodeProvider.NONE +val defaultReverseGeocodeProvider = ReverseGeocodeProvider.None val defaultMapLayerStyle = MapLayerStyle.OpenStreetMapNormal diff --git a/util/mqtt-local/push-mqtt-config-to-device.sh b/util/mqtt-local/push-mqtt-config-to-device.sh index 93eacf5062..480a84d776 100755 --- a/util/mqtt-local/push-mqtt-config-to-device.sh +++ b/util/mqtt-local/push-mqtt-config-to-device.sh @@ -1 +1 @@ -adb shell am start -a android.intent.action.VIEW -d owntracks:///config?inline=eyJfdHlwZSI6ImNvbmZpZ3VyYXRpb24iLCJ3YXlwb2ludHMiOltdLCJjbGllbnRJZCI6ImVtdTY0eGEiLCJkZWJ1Z0xvZyI6ZmFsc2UsImRldmljZUlkIjoiZW11NjR4YSIsImhvc3QiOiJtcXR0LmRvY2tlci5sb2NhbCIsIm1xdHRQcm90b2NvbExldmVsIjozLCJwYXNzd29yZCI6InRlc3QiLCJwb3J0IjoxODgzLCJwdWJRb3MiOjEsInRpZCI6InhhIiwidGxzIjpmYWxzZSwidXNlcm5hbWUiOiJ0ZXN0Iiwia2VlcGFsaXZlIjoxMCwibW9kZSI6MH0= +adb shell am start -a android.intent.action.VIEW -d owntracks:///config?inline=eyJfdHlwZSI6ImNvbmZpZ3VyYXRpb24iLCJ3YXlwb2ludHMiOltdLCJjbGllbnRJZCI6ImVtdTY0eGEiLCJkZWJ1Z0xvZyI6ZmFsc2UsImRldmljZUlkIjoiZW11NjR4YSIsImhvc3QiOiIxMC4wLjIuMiIsIm1xdHRQcm90b2NvbExldmVsIjozLCJwYXNzd29yZCI6InRlc3QiLCJwb3J0IjoxODgzLCJwdWJRb3MiOjEsInRpZCI6InhhIiwidGxzIjpmYWxzZSwidXNlcm5hbWUiOiJ0ZXN0Iiwia2VlcGFsaXZlIjoxMCwibW9kZSI6MH0=