-
-
Notifications
You must be signed in to change notification settings - Fork 257
Consolidate volume stream control into volume up/down actions #1854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
92597f4
8e11e92
df609da
3c97a49
99e7780
3a6ac16
b8f32da
39ca2c4
4055f09
3b4104a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -131,13 +131,39 @@ sealed class ActionData : Comparable<ActionData> { | |
| } | ||
|
|
||
| @Serializable | ||
| data class Up(val showVolumeUi: Boolean) : Volume() { | ||
| data class Up( | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you delete the streams in ActionData. Mark the ActionIds as deprecated. The ActionDataEntityMapper should be backwards compatible with the old Stream ActionIds.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Deprecated
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot delete ActionData.Stream classes.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Deleted ActionData.Volume.Stream classes completely. Old stream actions are now automatically migrated to Volume.Up/Down with stream parameter via ActionDataEntityMapper. See commit 39ca2c4
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Deleted ActionData.Volume.Stream classes completely. Old stream actions are now automatically migrated to Volume.Up/Down with stream parameter via ActionDataEntityMapper. See commit 39ca2c4 |
||
| val showVolumeUi: Boolean, | ||
| val volumeStream: VolumeStream? = null, | ||
| ) : Volume() { | ||
| override val id = ActionId.VOLUME_UP | ||
|
|
||
| override fun compareTo(other: ActionData) = when (other) { | ||
| is Up -> compareValuesBy( | ||
| this, | ||
| other, | ||
| { it.showVolumeUi }, | ||
| { it.volumeStream }, | ||
| ) | ||
| else -> super.compareTo(other) | ||
| } | ||
| } | ||
|
|
||
| @Serializable | ||
| data class Down(val showVolumeUi: Boolean) : Volume() { | ||
| data class Down( | ||
| val showVolumeUi: Boolean, | ||
| val volumeStream: VolumeStream? = null, | ||
| ) : Volume() { | ||
| override val id = ActionId.VOLUME_DOWN | ||
|
|
||
| override fun compareTo(other: ActionData) = when (other) { | ||
| is Down -> compareValuesBy( | ||
| this, | ||
| other, | ||
| { it.showVolumeUi }, | ||
| { it.volumeStream }, | ||
| ) | ||
| else -> super.compareTo(other) | ||
| } | ||
| } | ||
|
|
||
| @Serializable | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,6 +54,8 @@ class CreateActionDelegate( | |
|
|
||
| var httpRequestBottomSheetState: ActionData.HttpRequest? by mutableStateOf(null) | ||
| var smsActionBottomSheetState: SmsActionBottomSheetState? by mutableStateOf(null) | ||
| var volumeUpActionState: VolumeActionBottomSheetState? by mutableStateOf(null) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just use the same volumeActionState and store which ActionId is being used. Then use that to figure out which action to create when done is clicked. Also show different bottom sheet title depending on the action.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consolidated into single |
||
| var volumeDownActionState: VolumeActionBottomSheetState? by mutableStateOf(null) | ||
|
|
||
| init { | ||
| coroutineScope.launch { | ||
|
|
@@ -160,6 +162,30 @@ class CreateActionDelegate( | |
| actionResult.update { action } | ||
| } | ||
|
|
||
| fun onDoneConfigVolumeUpClick() { | ||
| volumeUpActionState?.also { state -> | ||
| val action = ActionData.Volume.Up( | ||
| showVolumeUi = state.showVolumeUi, | ||
| volumeStream = state.volumeStream, | ||
| ) | ||
|
|
||
| volumeUpActionState = null | ||
| actionResult.update { action } | ||
| } | ||
| } | ||
|
|
||
| fun onDoneConfigVolumeDownClick() { | ||
| volumeDownActionState?.also { state -> | ||
| val action = ActionData.Volume.Down( | ||
| showVolumeUi = state.showVolumeUi, | ||
| volumeStream = state.volumeStream, | ||
| ) | ||
|
|
||
| volumeDownActionState = null | ||
| actionResult.update { action } | ||
| } | ||
| } | ||
|
|
||
| fun onTestSmsClick() { | ||
| coroutineScope.launch { | ||
| (smsActionBottomSheetState as? SmsActionBottomSheetState.SendSms)?.also { state -> | ||
|
|
@@ -263,17 +289,31 @@ class CreateActionDelegate( | |
| return action | ||
| } | ||
|
|
||
| ActionId.VOLUME_UP, | ||
| ActionId.VOLUME_DOWN, | ||
| ActionId.VOLUME_UP -> { | ||
| val oldVolumeUpData = oldData as? ActionData.Volume.Up | ||
| volumeUpActionState = VolumeActionBottomSheetState( | ||
| volumeStream = oldVolumeUpData?.volumeStream, | ||
| showVolumeUi = oldVolumeUpData?.showVolumeUi ?: false, | ||
| ) | ||
| return null | ||
| } | ||
|
|
||
| ActionId.VOLUME_DOWN -> { | ||
| val oldVolumeDownData = oldData as? ActionData.Volume.Down | ||
| volumeDownActionState = VolumeActionBottomSheetState( | ||
| volumeStream = oldVolumeDownData?.volumeStream, | ||
| showVolumeUi = oldVolumeDownData?.showVolumeUi ?: false, | ||
| ) | ||
| return null | ||
| } | ||
|
|
||
| ActionId.VOLUME_MUTE, | ||
| ActionId.VOLUME_UNMUTE, | ||
| ActionId.VOLUME_TOGGLE_MUTE, | ||
| -> { | ||
| val showVolumeUiId = 0 | ||
| val isVolumeUiChecked = | ||
| when (oldData) { | ||
| is ActionData.Volume.Up -> oldData.showVolumeUi | ||
| is ActionData.Volume.Down -> oldData.showVolumeUi | ||
| is ActionData.Volume.Mute -> oldData.showVolumeUi | ||
| is ActionData.Volume.UnMute -> oldData.showVolumeUi | ||
| is ActionData.Volume.ToggleMute -> oldData.showVolumeUi | ||
|
|
@@ -295,8 +335,6 @@ class CreateActionDelegate( | |
| val showVolumeUi = chosenFlags.contains(showVolumeUiId) | ||
|
|
||
| val action = when (actionId) { | ||
| ActionId.VOLUME_UP -> ActionData.Volume.Up(showVolumeUi) | ||
| ActionId.VOLUME_DOWN -> ActionData.Volume.Down(showVolumeUi) | ||
| ActionId.VOLUME_MUTE -> ActionData.Volume.Mute(showVolumeUi) | ||
| ActionId.VOLUME_UNMUTE -> ActionData.Volume.UnMute(showVolumeUi) | ||
| ActionId.VOLUME_TOGGLE_MUTE -> ActionData.Volume.ToggleMute( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Reword this to something like "consolidated volume and stream actions"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to "Consolidated volume and stream actions." in commit 3a6ac16