Skip to content

Commit

Permalink
Remove SettingsScreen duplication
Browse files Browse the repository at this point in the history
Instead of duplicating the entire screen across flavors,
only duplicate the toggle implementations.
  • Loading branch information
thgoebel committed Jan 31, 2025
1 parent 29a3390 commit 502c01e
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 117 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package xyz.malkki.neostumbler.ui.screens.settings

import androidx.compose.runtime.Composable

@Composable
fun AutoScanToggle() {
// Not implemented in the F-Droid flavor
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package xyz.malkki.neostumbler.ui.screens.settings

import androidx.compose.runtime.Composable

@Composable
fun FusedLocationToggle() {
// Not implemented in the F-Droid flavor
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xyz.malkki.neostumbler.ui.composables.autoscan
package xyz.malkki.neostumbler.ui.screens.settings

import android.Manifest
import android.annotation.SuppressLint
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package xyz.malkki.neostumbler.ui.screens.settings

import androidx.compose.ui.res.stringResource
import xyz.malkki.neostumbler.R
import xyz.malkki.neostumbler.constants.PreferenceKeys
import xyz.malkki.neostumbler.ui.composables.SettingsToggle

@androidx.compose.runtime.Composable
fun FusedLocationToggle() {
SettingsToggle(
title = stringResource(id = R.string.prefer_fused_location_title),
description = stringResource(id = R.string.prefer_fused_location_description),
preferenceKey = PreferenceKeys.PREFER_FUSED_LOCATION,
default = true
)
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package xyz.malkki.neostumbler.ui.screens.settings


import android.os.Build
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
Expand Down Expand Up @@ -55,6 +54,7 @@ fun SettingsScreen() {
title = stringResource(id = R.string.settings_group_scanning)
) {
MovementDetectorSettings()
FusedLocationToggle()
IgnoreScanThrottlingToggle()
SliderSetting(
title = stringResource(R.string.wifi_scan_frequency),
Expand All @@ -76,6 +76,7 @@ fun SettingsScreen() {
},
default = ScannerService.DEFAULT_CELL_SCAN_DISTANCE,
)
AutoScanToggle()
}

SettingsGroup(title = stringResource(id = R.string.settings_group_other)) {
Expand Down

0 comments on commit 502c01e

Please sign in to comment.