diff --git a/app/build.properties b/app/build.properties index 73fc00953..3adb92bd8 100644 --- a/app/build.properties +++ b/app/build.properties @@ -1,6 +1,6 @@ #Build Properties -#Sat Feb 17 09:56:58 EST 2024 -version_build=11 +#Mon Feb 19 11:44:54 EST 2024 +version_build=12 version_major=3 version_minor=1 version_patch=2 diff --git a/app/src/main/kotlin/com/vrem/wifianalyzer/settings/Settings.kt b/app/src/main/kotlin/com/vrem/wifianalyzer/settings/Settings.kt index 5f2c723c9..a2e15c42b 100644 --- a/app/src/main/kotlin/com/vrem/wifianalyzer/settings/Settings.kt +++ b/app/src/main/kotlin/com/vrem/wifianalyzer/settings/Settings.kt @@ -19,7 +19,13 @@ package com.vrem.wifianalyzer.settings import android.content.SharedPreferences.OnSharedPreferenceChangeListener import com.vrem.annotation.OpenClass -import com.vrem.util.* +import com.vrem.util.buildMinVersionQ +import com.vrem.util.defaultCountryCode +import com.vrem.util.defaultLanguageTag +import com.vrem.util.findByLanguageTag +import com.vrem.util.findOne +import com.vrem.util.findSet +import com.vrem.util.ordinals import com.vrem.wifianalyzer.R import com.vrem.wifianalyzer.navigation.NavigationGroup import com.vrem.wifianalyzer.navigation.NavigationMenu @@ -83,7 +89,7 @@ class Settings(private val repository: Repository) { fun wiFiBand(): WiFiBand = find(WiFiBand.entries, R.string.wifi_band_key, WiFiBand.GHZ2) fun wiFiOffOnExit(): Boolean = - if (minVersionQ()) { + if (buildMinVersionQ()) { false } else { repository.boolean( @@ -133,8 +139,6 @@ class Settings(private val repository: Repository) { private fun > saveSet(key: Int, values: Set): Unit = repository.saveStringSet(key, ordinals(values)) - fun minVersionQ(): Boolean = buildMinVersionQ() - companion object { private const val SCAN_SPEED_DEFAULT = 5 private const val GRAPH_Y_MULTIPLIER = -10 diff --git a/app/src/test/kotlin/com/vrem/wifianalyzer/settings/SettingsAndroidQTest.kt b/app/src/test/kotlin/com/vrem/wifianalyzer/settings/SettingsAndroidQTest.kt deleted file mode 100644 index 008d9cefb..000000000 --- a/app/src/test/kotlin/com/vrem/wifianalyzer/settings/SettingsAndroidQTest.kt +++ /dev/null @@ -1,49 +0,0 @@ -/* - * WiFiAnalyzer - * Copyright (C) 2015 - 2024 VREM Software Development - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - */ -package com.vrem.wifianalyzer.settings - -import org.assertj.core.api.Assertions.assertThat -import org.junit.After -import org.junit.Before -import org.junit.Test -import org.mockito.kotlin.* - -class SettingsAndroidQTest { - private val repository: Repository = mock() - private val fixture = spy(Settings(repository)) - - @Before - fun setUp() { - doReturn(true).whenever(fixture).minVersionQ() - } - - @After - fun tearDown() { - verifyNoMoreInteractions(repository) - } - - @Test - fun wiFiOffOnExitAndroidQ() { - // execute - val actual = fixture.wiFiOffOnExit() - // validate - assertThat(actual).isFalse() - verify(fixture).minVersionQ() - } - -} \ No newline at end of file diff --git a/app/src/test/kotlin/com/vrem/wifianalyzer/settings/SettingsTest.kt b/app/src/test/kotlin/com/vrem/wifianalyzer/settings/SettingsTest.kt index 682d18c4d..a43bc8bec 100644 --- a/app/src/test/kotlin/com/vrem/wifianalyzer/settings/SettingsTest.kt +++ b/app/src/test/kotlin/com/vrem/wifianalyzer/settings/SettingsTest.kt @@ -36,7 +36,6 @@ import com.vrem.wifianalyzer.wifi.model.SortBy import com.vrem.wifianalyzer.wifi.model.Strength import org.assertj.core.api.Assertions.assertThat import org.junit.After -import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.mockito.kotlin.* @@ -52,12 +51,7 @@ class SettingsTest { private val repository: Repository = mock() private val onSharedPreferenceChangeListener: OnSharedPreferenceChangeListener = mock() - private val fixture = spy(Settings(repository)) - - @Before - fun setUp() { - doReturn(false).whenever(fixture).minVersionQ() - } + private val fixture: Settings = Settings(repository) @After fun tearDown() { @@ -382,6 +376,15 @@ class SettingsTest { @Test fun wiFiOffOnExit() { + // execute + val actual = fixture.wiFiOffOnExit() + // validate + assertThat(actual).isFalse() + } + + @Test + @Config(sdk = [Build.VERSION_CODES.P]) + fun wiFiOffOnExitLegacy() { // setup doReturn(true).whenever(repository).resourceBoolean(R.bool.wifi_off_on_exit_default) doReturn(true).whenever(repository).boolean(R.string.wifi_off_on_exit_key, true)