Skip to content

Commit 4eafe19

Browse files
committed
#1961 fix: disabling setup assistant shows a notification asking for pairing code immediately
1 parent afe5d70 commit 4eafe19

File tree

3 files changed

+31
-8
lines changed

3 files changed

+31
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
- [#1972](https://github.com/keymapperorg/KeyMapper/issues/1972) Expert Mode works on Android 10.
1616
- [#1976](https://github.com/keymapperorg/KeyMapper/issues/1976) Panic in Rust system bridge code on some devices.
1717
- [#1971](https://github.com/keymapperorg/KeyMapper/issues/1971) Media actions work again in some apps, like YouTube.
18+
- [#1961](https://github.com/keymapperorg/KeyMapper/issues/1961) Disabling setup assistant shows a notification asking for pairing code immediately.
1819
- Bugs with expert mode auto starting time.
1920

2021
## [4.0.0 Beta 6](https://github.com/sds100/KeyMapper/releases/tag/v4.0.0-beta.06)

base/src/main/java/io/github/sds100/keymapper/base/expertmode/SystemBridgeSetupAssistantController.kt

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -315,18 +315,37 @@ class SystemBridgeSetupAssistantController @AssistedInject constructor(
315315
}
316316

317317
SystemBridgeSetupStep.ADB_PAIRING -> {
318-
showNotification(
319-
getString(R.string.expert_mode_setup_notification_pairing_title),
320-
getString(R.string.expert_mode_setup_notification_pairing_text),
321-
)
318+
if (isInteractive.value) {
319+
showNotification(
320+
getString(R.string.expert_mode_setup_notification_pairing_title),
321+
getString(R.string.expert_mode_setup_notification_pairing_text),
322+
)
323+
interactionStep = InteractionStep.PAIR_DEVICE
324+
startInteractionTimeoutJob()
325+
} else {
326+
// Show a notification asking for pairing code straight away if interaction
327+
// is disabled.
328+
showNotification(
329+
title = getString(
330+
R.string.expert_mode_setup_notification_pairing_code_not_interactive_title,
331+
),
332+
text = getString(
333+
R.string.expert_mode_setup_notification_pairing_code_not_interactive_text,
334+
),
335+
actions = listOf(
336+
KMNotificationAction.RemoteInput.PairingCode to
337+
getString(
338+
R.string.expert_mode_setup_notification_action_input_pairing_code,
339+
),
340+
),
341+
)
322342

323-
interactionStep = InteractionStep.PAIR_DEVICE
343+
interactionStep = null
344+
}
324345
}
325346

326-
else -> return // Do not start interaction timeout job
347+
else -> return
327348
}
328-
329-
startInteractionTimeoutJob()
330349
}
331350

332351
private fun startInteractionTimeoutJob() {

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1757,6 +1757,9 @@
17571757
<string name="expert_mode_setup_notification_pairing_button_not_found_title">Unable to find pairing port and code</string>
17581758
<string name="expert_mode_setup_notification_pairing_button_not_found_text">Tap on the button to pair with pairing code and type the code in here</string>
17591759

1760+
<string name="expert_mode_setup_notification_pairing_code_not_interactive_title">Type in the pairing code</string>
1761+
<string name="expert_mode_setup_notification_pairing_code_not_interactive_text">Tap \"Pair device with pairing code\"</string>
1762+
17601763
<string name="expert_mode_setup_notification_start_system_bridge_failed_title">Starting Expert Mode failed</string>
17611764
<string name="expert_mode_setup_notification_start_system_bridge_failed_text">Tap to set up again. Try ADB pairing and rebooting your phone if it repeatedly fails.</string>
17621765

0 commit comments

Comments
 (0)