Skip to content

Commit

Permalink
minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
VREMSoftwareDevelopment committed Feb 19, 2024
1 parent c87b9ac commit c87c12f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 62 deletions.
4 changes: 2 additions & 2 deletions app/build.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 8 additions & 4 deletions app/src/main/kotlin/com/vrem/wifianalyzer/settings/Settings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -133,8 +139,6 @@ class Settings(private val repository: Repository) {

private fun <T : Enum<T>> saveSet(key: Int, values: Set<T>): 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
Expand Down

This file was deleted.

17 changes: 10 additions & 7 deletions app/src/test/kotlin/com/vrem/wifianalyzer/settings/SettingsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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.*
Expand All @@ -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() {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit c87c12f

Please sign in to comment.