Skip to content

Commit 4055f09

Browse files
committed
Merge branch 'develop' into copilot/refactor-volume-actions
2 parents 39ca2c4 + 8fb08f3 commit 4055f09

File tree

62 files changed

+833
-637
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+833
-637
lines changed

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
- #727 Actions to send SMS messages: "Send SMS" and "Compose SMS"
1818
- #1819 Explain how to enable the accessibility service restricted setting
1919
- #661 Action to execute shell commands.
20-
- Consolidated volume and stream actions.
20+
- #991 Consolidated volume and stream actions.
21+
- #1066 Action to mute/unmute microphone.
2122

2223
## Removed
2324

@@ -43,7 +44,8 @@
4344
- #1818 the Key Mapper GUI Keyboard is no longer mentioned in the app. It still works but PRO mode
4445
and the auto switching feature are the preferred way to work around the limitations of the Key
4546
Mapper keyboard.
46-
- Allow selecting notification and alarm sound and not just ringtones for Sound action
47+
- Allow selecting notification and alarm sound and not just ringtones for Sound action.
48+
- #1064 wait for switch keyboard action to complete before doing next action.
4749

4850
## [3.2.1](https://github.com/sds100/KeyMapper/releases/tag/v3.2.1)
4951

app/src/main/java/io/github/sds100/keymapper/trigger/ConfigTriggerViewModel.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ class ConfigTriggerViewModel @Inject constructor(
5151

5252
override fun onEditFloatingLayoutClick() {}
5353

54-
override fun showTriggerSetup(shortcut: TriggerSetupShortcut) {
54+
override fun showTriggerSetup(shortcut: TriggerSetupShortcut, forceProMode: Boolean) {
5555
when (shortcut) {
5656
TriggerSetupShortcut.ASSISTANT -> viewModelScope.launch {
5757
navigateToAdvancedTriggers("purchase_assistant_trigger")
5858
}
5959

60-
else -> super.showTriggerSetup(shortcut)
60+
else -> super.showTriggerSetup(shortcut, forceProMode)
6161
}
6262
}
6363
}

base/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ dependencies {
9393
implementation(libs.google.flexbox)
9494
implementation(libs.squareup.okhttp)
9595
coreLibraryDesugaring(libs.desugar.jdk.libs)
96-
implementation(libs.canopas.introshowcaseview)
9796
implementation(libs.dagger.hilt.android)
9897
ksp(libs.dagger.hilt.android.compiler)
9998
implementation(libs.bundles.splitties)

base/src/main/java/io/github/sds100/keymapper/base/actions/ActionData.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,24 @@ sealed class ActionData : Comparable<ActionData> {
177177
}
178178
}
179179

180+
@Serializable
181+
sealed class Microphone : ActionData() {
182+
@Serializable
183+
data object Mute : Microphone() {
184+
override val id = ActionId.MUTE_MICROPHONE
185+
}
186+
187+
@Serializable
188+
data object Unmute : Microphone() {
189+
override val id = ActionId.UNMUTE_MICROPHONE
190+
}
191+
192+
@Serializable
193+
data object Toggle : Microphone() {
194+
override val id = ActionId.TOGGLE_MUTE_MICROPHONE
195+
}
196+
}
197+
180198
@Serializable
181199
sealed class Flashlight : ActionData() {
182200
abstract val lens: CameraLens

base/src/main/java/io/github/sds100/keymapper/base/actions/ActionDataEntityMapper.kt

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ object ActionDataEntityMapper {
274274

275275
ActionId.VOLUME_INCREASE_STREAM,
276276
ActionId.VOLUME_DECREASE_STREAM,
277-
-> {
277+
-> {
278278
val stream =
279279
entity.extras.getData(ActionEntity.EXTRA_STREAM_TYPE).then {
280280
VOLUME_STREAM_MAP.getKey(it)!!.success()
@@ -300,7 +300,7 @@ object ActionDataEntityMapper {
300300
ActionId.VOLUME_TOGGLE_MUTE,
301301
ActionId.VOLUME_UNMUTE,
302302
ActionId.VOLUME_MUTE,
303-
-> {
303+
-> {
304304
val showVolumeUi =
305305
entity.flags.hasFlag(ActionEntity.ACTION_FLAG_SHOW_VOLUME_UI)
306306

@@ -327,10 +327,14 @@ object ActionDataEntityMapper {
327327
}
328328
}
329329

330+
ActionId.MUTE_MICROPHONE -> ActionData.Microphone.Mute
331+
ActionId.UNMUTE_MICROPHONE -> ActionData.Microphone.Unmute
332+
ActionId.TOGGLE_MUTE_MICROPHONE -> ActionData.Microphone.Toggle
333+
330334
ActionId.TOGGLE_FLASHLIGHT,
331335
ActionId.ENABLE_FLASHLIGHT,
332336
ActionId.CHANGE_FLASHLIGHT_STRENGTH,
333-
-> {
337+
-> {
334338
val lens = entity.extras.getData(ActionEntity.EXTRA_LENS).then {
335339
LENS_MAP.getKey(it)!!.success()
336340
}.valueOrNull() ?: return null
@@ -356,7 +360,7 @@ object ActionDataEntityMapper {
356360
}
357361

358362
ActionId.DISABLE_FLASHLIGHT,
359-
-> {
363+
-> {
360364
val lens = entity.extras.getData(ActionEntity.EXTRA_LENS).then {
361365
LENS_MAP.getKey(it)!!.success()
362366
}.valueOrNull() ?: return null
@@ -365,7 +369,7 @@ object ActionDataEntityMapper {
365369

366370
ActionId.TOGGLE_DND_MODE,
367371
ActionId.ENABLE_DND_MODE,
368-
-> {
372+
-> {
369373
val dndMode = entity.extras.getData(ActionEntity.EXTRA_DND_MODE).then {
370374
DND_MODE_MAP.getKey(it)!!.success()
371375
}.valueOrNull() ?: return null
@@ -395,7 +399,7 @@ object ActionDataEntityMapper {
395399
ActionId.STOP_MEDIA_PACKAGE,
396400
ActionId.STEP_FORWARD_PACKAGE,
397401
ActionId.STEP_BACKWARD_PACKAGE,
398-
-> {
402+
-> {
399403
val packageName =
400404
entity.extras.getData(ActionEntity.EXTRA_PACKAGE_NAME).valueOrNull()
401405
?: return null
@@ -1167,6 +1171,9 @@ object ActionDataEntityMapper {
11671171
ActionId.VOLUME_UNMUTE to "volume_unmute",
11681172
ActionId.VOLUME_MUTE to "volume_mute",
11691173
ActionId.VOLUME_TOGGLE_MUTE to "volume_toggle_mute",
1174+
ActionId.MUTE_MICROPHONE to "mute_microphone",
1175+
ActionId.UNMUTE_MICROPHONE to "unmute_microphone",
1176+
ActionId.TOGGLE_MUTE_MICROPHONE to "toggle_mute_microphone",
11701177

11711178
ActionId.EXPAND_NOTIFICATION_DRAWER to "expand_notification_drawer",
11721179
ActionId.TOGGLE_NOTIFICATION_DRAWER to "toggle_notification_drawer",

base/src/main/java/io/github/sds100/keymapper/base/actions/ActionId.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ enum class ActionId {
5858
VOLUME_UNMUTE,
5959
VOLUME_MUTE,
6060
VOLUME_TOGGLE_MUTE,
61+
MUTE_MICROPHONE,
62+
UNMUTE_MICROPHONE,
63+
TOGGLE_MUTE_MICROPHONE,
6164

6265
EXPAND_NOTIFICATION_DRAWER,
6366
TOGGLE_NOTIFICATION_DRAWER,

base/src/main/java/io/github/sds100/keymapper/base/actions/ActionUiHelper.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,8 @@ class ActionUiHelper(
6060
}
6161

6262
if (action.device != null) {
63-
val name = if (action.device.name.isBlank()) {
63+
val name = action.device.name.ifBlank {
6464
getString(R.string.unknown_device_name)
65-
} else {
66-
action.device.name
6765
}
6866

6967
val nameToShow = if (showDeviceDescriptors) {
@@ -597,6 +595,10 @@ class ActionUiHelper(
597595
R.string.action_send_sms_description,
598596
arrayOf(action.message, action.number),
599597
)
598+
599+
ActionData.Microphone.Mute -> getString(R.string.action_mute_microphone)
600+
ActionData.Microphone.Toggle -> getString(R.string.action_toggle_mute_microphone)
601+
ActionData.Microphone.Unmute -> getString(R.string.action_unmute_microphone)
600602
}
601603

602604
fun getIcon(action: ActionData): ComposeIconInfo = when (action) {

base/src/main/java/io/github/sds100/keymapper/base/actions/ActionUtils.kt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ import androidx.compose.material.icons.outlined.Keyboard
4141
import androidx.compose.material.icons.outlined.KeyboardHide
4242
import androidx.compose.material.icons.outlined.Link
4343
import androidx.compose.material.icons.outlined.Lock
44+
import androidx.compose.material.icons.outlined.Mic
45+
import androidx.compose.material.icons.outlined.MicOff
4446
import androidx.compose.material.icons.outlined.MoreVert
4547
import androidx.compose.material.icons.outlined.Nfc
4648
import androidx.compose.material.icons.outlined.NotStarted
@@ -170,6 +172,9 @@ object ActionUtils {
170172
ActionId.VOLUME_UNMUTE -> ActionCategory.VOLUME
171173
ActionId.VOLUME_MUTE -> ActionCategory.VOLUME
172174
ActionId.VOLUME_TOGGLE_MUTE -> ActionCategory.VOLUME
175+
ActionId.MUTE_MICROPHONE -> ActionCategory.VOLUME
176+
ActionId.UNMUTE_MICROPHONE -> ActionCategory.VOLUME
177+
ActionId.TOGGLE_MUTE_MICROPHONE -> ActionCategory.VOLUME
173178

174179
ActionId.EXPAND_NOTIFICATION_DRAWER -> ActionCategory.NAVIGATION
175180
ActionId.TOGGLE_NOTIFICATION_DRAWER -> ActionCategory.NAVIGATION
@@ -289,6 +294,9 @@ object ActionUtils {
289294
ActionId.VOLUME_UNMUTE -> R.string.action_volume_unmute
290295
ActionId.VOLUME_MUTE -> R.string.action_volume_mute
291296
ActionId.VOLUME_TOGGLE_MUTE -> R.string.action_toggle_mute
297+
ActionId.MUTE_MICROPHONE -> R.string.action_mute_microphone
298+
ActionId.UNMUTE_MICROPHONE -> R.string.action_unmute_microphone
299+
ActionId.TOGGLE_MUTE_MICROPHONE -> R.string.action_toggle_mute_microphone
292300
ActionId.EXPAND_NOTIFICATION_DRAWER -> R.string.action_expand_notification_drawer
293301
ActionId.TOGGLE_NOTIFICATION_DRAWER -> R.string.action_toggle_notification_drawer
294302
ActionId.EXPAND_QUICK_SETTINGS -> R.string.action_expand_quick_settings
@@ -413,6 +421,9 @@ object ActionUtils {
413421
ActionId.VOLUME_UNMUTE -> R.drawable.ic_outline_volume_up_24
414422
ActionId.VOLUME_MUTE -> R.drawable.ic_outline_volume_mute_24
415423
ActionId.VOLUME_TOGGLE_MUTE -> R.drawable.ic_outline_volume_mute_24
424+
ActionId.MUTE_MICROPHONE -> null
425+
ActionId.UNMUTE_MICROPHONE -> null
426+
ActionId.TOGGLE_MUTE_MICROPHONE -> null
416427
ActionId.EXPAND_NOTIFICATION_DRAWER -> null
417428
ActionId.TOGGLE_NOTIFICATION_DRAWER -> null
418429
ActionId.EXPAND_QUICK_SETTINGS -> null
@@ -507,6 +518,9 @@ object ActionUtils {
507518
ActionId.VOLUME_MUTE,
508519
ActionId.VOLUME_UNMUTE,
509520
ActionId.VOLUME_TOGGLE_MUTE,
521+
ActionId.MUTE_MICROPHONE,
522+
ActionId.UNMUTE_MICROPHONE,
523+
ActionId.TOGGLE_MUTE_MICROPHONE,
510524
ActionId.TOGGLE_DND_MODE,
511525
ActionId.ENABLE_DND_MODE,
512526
ActionId.DISABLE_DND_MODE,
@@ -653,6 +667,9 @@ object ActionUtils {
653667
ActionId.VOLUME_MUTE,
654668
ActionId.VOLUME_UNMUTE,
655669
ActionId.VOLUME_TOGGLE_MUTE,
670+
ActionId.MUTE_MICROPHONE,
671+
ActionId.UNMUTE_MICROPHONE,
672+
ActionId.TOGGLE_MUTE_MICROPHONE,
656673
ActionId.TOGGLE_DND_MODE,
657674
ActionId.DISABLE_DND_MODE,
658675
ActionId.ENABLE_DND_MODE,
@@ -784,6 +801,9 @@ object ActionUtils {
784801
ActionId.VOLUME_UNMUTE -> Icons.AutoMirrored.Outlined.VolumeUp
785802
ActionId.VOLUME_MUTE -> Icons.AutoMirrored.Outlined.VolumeMute
786803
ActionId.VOLUME_TOGGLE_MUTE -> Icons.AutoMirrored.Outlined.VolumeMute
804+
ActionId.MUTE_MICROPHONE -> Icons.Outlined.MicOff
805+
ActionId.UNMUTE_MICROPHONE -> Icons.Outlined.Mic
806+
ActionId.TOGGLE_MUTE_MICROPHONE -> Icons.Outlined.MicOff
787807
ActionId.EXPAND_NOTIFICATION_DRAWER -> KeyMapperIcons.TopPanelOpen
788808
ActionId.TOGGLE_NOTIFICATION_DRAWER -> KeyMapperIcons.TopPanelClose
789809
ActionId.EXPAND_QUICK_SETTINGS -> KeyMapperIcons.TopPanelOpen

base/src/main/java/io/github/sds100/keymapper/base/actions/ChooseActionViewModel.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,16 +199,16 @@ class ChooseActionViewModel @Inject constructor(
199199
val messageToShow: Int? = when (id) {
200200
ActionId.FAST_FORWARD_PACKAGE,
201201
ActionId.FAST_FORWARD,
202-
-> R.string.action_fast_forward_message
202+
-> R.string.action_fast_forward_message
203203

204204
ActionId.REWIND_PACKAGE,
205205
ActionId.REWIND,
206-
-> R.string.action_rewind_message
206+
-> R.string.action_rewind_message
207207

208208
ActionId.TOGGLE_KEYBOARD,
209209
ActionId.SHOW_KEYBOARD,
210210
ActionId.HIDE_KEYBOARD,
211-
-> R.string.action_toggle_keyboard_message
211+
-> R.string.action_toggle_keyboard_message
212212

213213
ActionId.SECURE_LOCK_DEVICE -> R.string.action_secure_lock_device_message
214214

base/src/main/java/io/github/sds100/keymapper/base/actions/ConfigActionsUseCase.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ class ConfigActionsUseCaseImpl @Inject constructor(
2727
private val preferenceRepository: PreferenceRepository,
2828
private val configConstraints: ConfigConstraintsUseCase,
2929
defaultKeyMapOptionsUseCase: GetDefaultKeyMapOptionsUseCase,
30-
) : ConfigActionsUseCase, GetDefaultKeyMapOptionsUseCase by defaultKeyMapOptionsUseCase {
30+
) : ConfigActionsUseCase,
31+
GetDefaultKeyMapOptionsUseCase by defaultKeyMapOptionsUseCase {
3132

3233
override val keyMap: StateFlow<State<KeyMap>> = state.keyMap
3334

0 commit comments

Comments
 (0)