Skip to content

Commit 0c66503

Browse files
committed
fix: Show swipe gesture hint on every custom bundle addition
1 parent 40a29a9 commit 0c66503

3 files changed

Lines changed: 13 additions & 11 deletions

File tree

app/src/main/java/app/morphe/manager/domain/manager/PreferencesManager.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ class PreferencesManager(
9393
val allowMeteredUpdates = booleanPreference("allow_metered_updates", true)
9494
val firstLaunch = booleanPreference("first_launch", true)
9595

96-
/** Whether the swipe gesture hint animation on home app cards has been shown at least once. */
97-
val swipeGestureHintShown = booleanPreference("swipe_gesture_hint_shown", false)
9896
val installationTime = longPreference("manager_installation_time", 0)
9997
val disablePatchVersionCompatCheck = booleanPreference("disable_patch_version_compatibility_check", false)
10098

app/src/main/java/app/morphe/manager/ui/screen/HomeScreen.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,8 @@ fun HomeScreen(
9090
val showSearchButton by homeViewModel.showSearchButton.collectAsStateWithLifecycle()
9191
val useExpertMode by prefs.useExpertMode.getAsState()
9292

93-
// Gesture hint: shown once on first launch, after cards have loaded
94-
val swipeHintShown by prefs.swipeGestureHintShown.getAsState()
95-
val showGestureHint by remember(swipeHintShown, homeAppItems) {
96-
derivedStateOf { !swipeHintShown && homeAppItems.isNotEmpty() }
97-
}
93+
// Gesture hint: shown once per bundle addition, in-memory
94+
val showGestureHint by homeViewModel.showSwipeGestureHint.collectAsStateWithLifecycle()
9895

9996
val isDeviceRooted = homeViewModel.rootInstaller.isDeviceRooted()
10097
if (!isDeviceRooted) {

app/src/main/java/app/morphe/manager/ui/viewmodel/HomeViewModel.kt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -953,6 +953,12 @@ class HomeViewModel(
953953
withContext(NonCancellable) {
954954
patchBundleRepository.createRemote(apiUrl, autoUpdate)
955955
}
956+
patchBundleRepository.bundleUpdateProgress
957+
.dropWhile { it == null }
958+
.filter { it == null }
959+
.first()
960+
delay(1_500)
961+
showSwipeGestureHint.value = true
956962
}
957963

958964
/**
@@ -1085,12 +1091,10 @@ class HomeViewModel(
10851091
.stateIn(viewModelScope, SharingStarted.Eagerly, null)
10861092

10871093
/**
1088-
* Marks the swipe gesture hint as shown so it is never replayed.
1094+
* Resets the swipe gesture hint after it has been shown.
10891095
*/
10901096
fun markSwipeGestureHintShown() {
1091-
viewModelScope.launch {
1092-
prefs.swipeGestureHintShown.update(true)
1093-
}
1097+
showSwipeGestureHint.value = false
10941098
}
10951099

10961100
/**
@@ -1152,6 +1156,9 @@ class HomeViewModel(
11521156
?.toSet()
11531157
?: emptySet()
11541158

1159+
/** Triggers the swipe gesture hint whenever a custom bundle is added. */
1160+
val showSwipeGestureHint = MutableStateFlow(false)
1161+
11551162
/**
11561163
* Whether the "Other apps" button should be visible.
11571164
* Hidden while no apps are loaded; shown in expert mode or when a third-party source is active.

0 commit comments

Comments
 (0)