Skip to content

Commit 9c3ec99

Browse files
committed
#1411 hide the fingerprint reader gesture app intro screen
1 parent 0298ae3 commit 9c3ec99

File tree

6 files changed

+31
-86
lines changed

6 files changed

+31
-86
lines changed

app/src/main/java/io/github/sds100/keymapper/SplashActivity.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package io.github.sds100.keymapper
22

33
import android.content.Intent
4-
import android.content.pm.PackageManager
54
import android.os.Build
65
import android.os.Bundle
76
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
@@ -42,10 +41,6 @@ class SplashActivity : FragmentActivity() {
4241
yield(AppIntroSlide.ACCESSIBILITY_SERVICE)
4342
yield(AppIntroSlide.BATTERY_OPTIMISATION)
4443

45-
if (systemFeatureAdapter.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)) {
46-
yield(AppIntroSlide.FINGERPRINT_GESTURE_SUPPORT)
47-
}
48-
4944
if (onboarding.showShizukuAppIntroSlide) {
5045
yield(AppIntroSlide.GRANT_SHIZUKU_PERMISSION)
5146
}

app/src/main/java/io/github/sds100/keymapper/onboarding/AppIntroSlide.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ object AppIntroSlide {
77
const val NOTE_FROM_DEV = "slide_note_from_dev"
88
const val ACCESSIBILITY_SERVICE = "accessibility_service"
99
const val BATTERY_OPTIMISATION = "battery_optimisation"
10-
const val FINGERPRINT_GESTURE_SUPPORT = "fingerprint_gesture_support"
1110
const val CONTRIBUTING = "contributing"
1211
const val SETUP_CHOSEN_DEVICES_AGAIN = "set_up_chosen_devices_again"
1312
const val GRANT_SHIZUKU_PERMISSION = "grant_shizuku_permission"

app/src/main/java/io/github/sds100/keymapper/onboarding/AppIntroUseCase.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package io.github.sds100.keymapper.onboarding
22

33
import io.github.sds100.keymapper.data.Keys
44
import io.github.sds100.keymapper.data.repositories.PreferenceRepository
5-
import io.github.sds100.keymapper.mappings.fingerprintmaps.AreFingerprintGesturesSupportedUseCase
65
import io.github.sds100.keymapper.shizuku.ShizukuAdapter
76
import io.github.sds100.keymapper.system.accessibility.ServiceAdapter
87
import io.github.sds100.keymapper.system.accessibility.ServiceState
@@ -18,17 +17,13 @@ class AppIntroUseCaseImpl(
1817
private val permissionAdapter: PermissionAdapter,
1918
private val serviceAdapter: ServiceAdapter,
2019
private val preferenceRepository: PreferenceRepository,
21-
private val fingerprintGesturesSupportedUseCase: AreFingerprintGesturesSupportedUseCase,
2220
private val shizukuAdapter: ShizukuAdapter,
2321
) : AppIntroUseCase {
2422
override val serviceState: Flow<ServiceState> = serviceAdapter.state
2523

2624
override val isBatteryOptimised: Flow<Boolean> =
2725
permissionAdapter.isGrantedFlow(Permission.IGNORE_BATTERY_OPTIMISATION).map { !it }
2826

29-
override val fingerprintGesturesSupported: Flow<Boolean?> =
30-
fingerprintGesturesSupportedUseCase.isSupported
31-
3227
override val isShizukuPermissionGranted: Flow<Boolean> =
3328
permissionAdapter.isGrantedFlow(Permission.SHIZUKU)
3429

@@ -74,7 +69,6 @@ class AppIntroUseCaseImpl(
7469
interface AppIntroUseCase {
7570
val serviceState: Flow<ServiceState>
7671
val isBatteryOptimised: Flow<Boolean>
77-
val fingerprintGesturesSupported: Flow<Boolean?>
7872
val isShizukuPermissionGranted: Flow<Boolean>
7973
val isNotificationPermissionGranted: Flow<Boolean>
8074
val isShizukuStarted: Boolean

app/src/main/java/io/github/sds100/keymapper/onboarding/AppIntroViewModel.kt

Lines changed: 31 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,11 @@ class AppIntroViewModel(
4646
private val slideModels: StateFlow<List<AppIntroSlideUi>> = combine(
4747
useCase.serviceState,
4848
useCase.isBatteryOptimised,
49-
useCase.fingerprintGesturesSupported,
5049
useCase.isShizukuPermissionGranted,
5150
useCase.isNotificationPermissionGranted,
5251
) {
5352
serviceState,
5453
isBatteryOptimised,
55-
fingerprintGesturesSupported,
5654
isShizukuPermissionGranted,
5755
isNotificationPermissionGranted,
5856
->
@@ -62,8 +60,6 @@ class AppIntroViewModel(
6260
AppIntroSlide.NOTE_FROM_DEV -> noteFromDeveloperSlide()
6361
AppIntroSlide.ACCESSIBILITY_SERVICE -> accessibilityServiceSlide(serviceState)
6462
AppIntroSlide.BATTERY_OPTIMISATION -> batteryOptimisationSlide(isBatteryOptimised)
65-
AppIntroSlide.FINGERPRINT_GESTURE_SUPPORT ->
66-
fingerprintGestureSupportSlide(fingerprintGesturesSupported)
6763

6864
AppIntroSlide.CONTRIBUTING -> contributingSlide()
6965
AppIntroSlide.SETUP_CHOSEN_DEVICES_AGAIN -> setupChosenDevicesAgainSlide()
@@ -120,8 +116,7 @@ class AppIntroViewModel(
120116
}
121117
}
122118

123-
fun getSlide(slide: String): Flow<AppIntroSlideUi> =
124-
slideModels.mapNotNull { allSlides -> allSlides.find { it.id == slide } }
119+
fun getSlide(slide: String): Flow<AppIntroSlideUi> = slideModels.mapNotNull { allSlides -> allSlides.find { it.id == slide } }
125120

126121
fun onDoneClick() {
127122
if (slideModels.value.any { it.id == AppIntroSlide.GRANT_SHIZUKU_PERMISSION }) {
@@ -139,41 +134,40 @@ class AppIntroViewModel(
139134
backgroundColor = getColor(R.color.slideRed),
140135
)
141136

142-
private fun accessibilityServiceSlide(serviceState: ServiceState): AppIntroSlideUi =
143-
when (serviceState) {
144-
ServiceState.ENABLED ->
145-
AppIntroSlideUi(
146-
id = AppIntroSlide.ACCESSIBILITY_SERVICE,
147-
image = getDrawable(R.drawable.ic_baseline_check_64),
148-
title = getString(R.string.showcase_accessibility_service_title_enabled),
149-
description = getString(R.string.showcase_accessibility_service_description_enabled),
150-
backgroundColor = getColor(R.color.slidePurple),
151-
)
137+
private fun accessibilityServiceSlide(serviceState: ServiceState): AppIntroSlideUi = when (serviceState) {
138+
ServiceState.ENABLED ->
139+
AppIntroSlideUi(
140+
id = AppIntroSlide.ACCESSIBILITY_SERVICE,
141+
image = getDrawable(R.drawable.ic_baseline_check_64),
142+
title = getString(R.string.showcase_accessibility_service_title_enabled),
143+
description = getString(R.string.showcase_accessibility_service_description_enabled),
144+
backgroundColor = getColor(R.color.slidePurple),
145+
)
152146

153-
ServiceState.CRASHED ->
154-
AppIntroSlideUi(
155-
id = AppIntroSlide.ACCESSIBILITY_SERVICE,
156-
image = getDrawable(R.drawable.ic_outline_error_outline_64),
157-
title = getString(R.string.showcase_accessibility_service_title_crashed),
158-
description = getString(R.string.showcase_accessibility_service_description_crashed),
159-
backgroundColor = getColor(R.color.slidePurple),
147+
ServiceState.CRASHED ->
148+
AppIntroSlideUi(
149+
id = AppIntroSlide.ACCESSIBILITY_SERVICE,
150+
image = getDrawable(R.drawable.ic_outline_error_outline_64),
151+
title = getString(R.string.showcase_accessibility_service_title_crashed),
152+
description = getString(R.string.showcase_accessibility_service_description_crashed),
153+
backgroundColor = getColor(R.color.slidePurple),
160154

161-
buttonId1 = ID_BUTTON_RESTART_ACCESSIBILITY_SERVICE,
162-
buttonText1 = getString(R.string.showcase_accessibility_service_button_restart),
163-
)
155+
buttonId1 = ID_BUTTON_RESTART_ACCESSIBILITY_SERVICE,
156+
buttonText1 = getString(R.string.showcase_accessibility_service_button_restart),
157+
)
164158

165-
ServiceState.DISABLED ->
166-
AppIntroSlideUi(
167-
id = AppIntroSlide.ACCESSIBILITY_SERVICE,
168-
image = getDrawable(R.drawable.ic_outline_error_outline_64),
169-
title = getString(R.string.showcase_accessibility_service_title_disabled),
170-
description = getString(R.string.showcase_accessibility_service_description_disabled),
171-
backgroundColor = getColor(R.color.slidePurple),
159+
ServiceState.DISABLED ->
160+
AppIntroSlideUi(
161+
id = AppIntroSlide.ACCESSIBILITY_SERVICE,
162+
image = getDrawable(R.drawable.ic_outline_error_outline_64),
163+
title = getString(R.string.showcase_accessibility_service_title_disabled),
164+
description = getString(R.string.showcase_accessibility_service_description_disabled),
165+
backgroundColor = getColor(R.color.slidePurple),
172166

173-
buttonId1 = ID_BUTTON_ENABLE_ACCESSIBILITY_SERVICE,
174-
buttonText1 = getString(R.string.enable),
175-
)
176-
}
167+
buttonId1 = ID_BUTTON_ENABLE_ACCESSIBILITY_SERVICE,
168+
buttonText1 = getString(R.string.enable),
169+
)
170+
}
177171

178172
private fun batteryOptimisationSlide(isBatteryOptimised: Boolean): AppIntroSlideUi {
179173
if (isBatteryOptimised) {
@@ -204,37 +198,6 @@ class AppIntroViewModel(
204198
}
205199
}
206200

207-
private fun fingerprintGestureSupportSlide(areGesturesAvailable: Boolean?): AppIntroSlideUi {
208-
when (areGesturesAvailable) {
209-
true -> return AppIntroSlideUi(
210-
id = AppIntroSlide.FINGERPRINT_GESTURE_SUPPORT,
211-
image = getDrawable(R.drawable.ic_baseline_check_64),
212-
title = getString(R.string.showcase_fingerprint_gesture_support_title_supported),
213-
description = getString(R.string.showcase_fingerprint_gesture_support_message_supported),
214-
backgroundColor = getColor(R.color.slideOrange),
215-
)
216-
217-
false -> return AppIntroSlideUi(
218-
id = AppIntroSlide.FINGERPRINT_GESTURE_SUPPORT,
219-
image = getDrawable(R.drawable.ic_baseline_cross_64),
220-
title = getString(R.string.showcase_fingerprint_gesture_support_title_not_supported),
221-
description = getString(R.string.showcase_fingerprint_gesture_support_message_not_supported),
222-
backgroundColor = getColor(R.color.slideOrange),
223-
)
224-
225-
null -> return AppIntroSlideUi(
226-
id = AppIntroSlide.FINGERPRINT_GESTURE_SUPPORT,
227-
image = getDrawable(R.drawable.ic_baseline_fingerprint_64),
228-
title = getString(R.string.showcase_fingerprint_gesture_support_title_supported_unknown),
229-
description = getString(R.string.showcase_fingerprint_gesture_support_message_supported_unknown),
230-
backgroundColor = getColor(R.color.slideOrange),
231-
232-
buttonId1 = ID_BUTTON_ENABLE_ACCESSIBILITY_SERVICE,
233-
buttonText1 = getString(R.string.enable),
234-
)
235-
}
236-
}
237-
238201
private fun requestShizukuPermissionSlide(isPermissionGranted: Boolean): AppIntroSlideUi {
239202
if (isPermissionGranted) {
240203
return AppIntroSlideUi(

app/src/main/java/io/github/sds100/keymapper/util/Inject.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ object Inject {
220220
ServiceLocator.permissionAdapter(context),
221221
ServiceLocator.accessibilityServiceAdapter(context),
222222
ServiceLocator.settingsRepository(context),
223-
UseCases.fingerprintGesturesSupported(context),
224223
ServiceLocator.shizukuAdapter(context),
225224
),
226225
slides,

app/src/main/res/values/strings.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -913,11 +913,6 @@
913913
<string name="showcase_fingerprint_gesture_support_title_supported">You can remap fingerprint reader gestures! :)</string>
914914
<string name="showcase_fingerprint_gesture_support_title_not_supported">You can not remap fingerprint reader gestures!</string>
915915

916-
<string name="showcase_fingerprint_gesture_support_message_supported_unknown">You\'ll need to enable the accessibility service so that Key Mapper can check whether your device can detect fingerprint gestures.</string>
917-
<string name="showcase_fingerprint_gesture_support_message_supported">Your device can detect fingerprint gestures! There is a tab at the top of the home screen for remapping fingerprint gestures.</string>
918-
<string name="showcase_fingerprint_gesture_support_message_not_supported">Your device does not allow 3rd party apps to detect fingerprint gestures! There isn\'t anything the developer can do about this. Some devices have the setting to swipe down on the fingerprint reader to open the notification drawer and do not allow 3rd party apps to detect fingerprint gestures.</string>
919-
<string name="showcase_fingerprint_gesture_support_button">Enable</string>
920-
921916
<string name="showcase_setup_chosen_devices_again_title">You need to setup some settings again</string>
922917
<string name="showcase_setup_chosen_devices_again_message">It looks like you were using the setting to automatically change the keyboard or show the input method picker when a Bluetooth device connects and disconnects. Key Mapper now allows you to use any input device and not just Bluetooth devices. There isn\'t a way to migrate the old settings in a way that the new functionality will work so you\'ll have to choose the devices again.</string>
923918

0 commit comments

Comments
 (0)