File tree Expand file tree Collapse file tree 4 files changed +6
-9
lines changed
base/src/main/java/io/github/sds100/keymapper/base Expand file tree Collapse file tree 4 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -91,10 +91,10 @@ fun BaseMainNavHost(
9191 )
9292 }
9393
94- composable<NavDestination .ConfigCreateNotification > { backStackEntry ->
94+ composable<NavDestination .ConfigNotificationAction > { backStackEntry ->
9595 val viewModel: ConfigCreateNotificationViewModel = hiltViewModel()
9696
97- backStackEntry.handleRouteArgs<NavDestination .ConfigCreateNotification > { destination ->
97+ backStackEntry.handleRouteArgs<NavDestination .ConfigNotificationAction > { destination ->
9898 destination.actionJson?.let { viewModel.loadAction(Json .decodeFromString(it)) }
9999 }
100100
Original file line number Diff line number Diff line change @@ -889,7 +889,7 @@ class CreateActionDelegate(
889889
890890 return navigate(
891891 " config_create_notification_action" ,
892- NavDestination .ConfigCreateNotification (
892+ NavDestination .ConfigNotificationAction (
893893 oldAction?.let {
894894 Json .encodeToString(oldAction)
895895 },
Original file line number Diff line number Diff line change @@ -932,11 +932,8 @@ class PerformActionsUseCaseImpl @AssistedInject constructor(
932932 }
933933
934934 is ActionData .CreateNotification -> {
935- // Generate a unique notification ID using absolute value to avoid negative IDs
936- // Combine timestamp and hash to ensure uniqueness
937- val timestamp = (System .currentTimeMillis() / 1000 ).toInt()
938- val contentHash = (action.title + action.text).hashCode()
939- val notificationId = (timestamp.toLong() + contentHash).toInt().let {
935+ // Use the hashcode of the action instance as the unique notification ID
936+ val notificationId = action.hashCode().let {
940937 if (it < 0 ) - it else it
941938 }
942939
Original file line number Diff line number Diff line change @@ -174,7 +174,7 @@ abstract class NavDestination<R>(val isCompose: Boolean = false) {
174174 }
175175
176176 @Serializable
177- data class ConfigCreateNotification (val actionJson : String? ) :
177+ data class ConfigNotificationAction (val actionJson : String? ) :
178178 NavDestination <ActionData .CreateNotification >(isCompose = true ) {
179179 override val id: String = ID_CREATE_NOTIFICATION_ACTION
180180 }
You can’t perform that action at this time.
0 commit comments