Skip to content

Commit da0fd24

Browse files
committed
reformat style and fix tests
1 parent beb0747 commit da0fd24

20 files changed

+46
-121
lines changed

base/src/main/java/io/github/sds100/keymapper/base/BaseMainNavHost.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ fun BaseMainNavHost(
7777

7878
ShellCommandActionScreen(
7979
modifier = Modifier.fillMaxSize(),
80-
viewModel = viewModel
80+
viewModel = viewModel,
8181
)
8282
}
8383

base/src/main/java/io/github/sds100/keymapper/base/BaseViewModelHiltModule.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,5 +168,4 @@ abstract class BaseViewModelHiltModule {
168168
@Binds
169169
@ViewModelScoped
170170
abstract fun bindFixKeyEventActionDelegate(impl: FixKeyEventActionDelegateImpl): FixKeyEventActionDelegate
171-
172171
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,7 @@ sealed class ActionData : Comparable<ActionData> {
938938
val description: String,
939939
val command: String,
940940
val executionMode: ShellExecutionMode,
941-
val timeoutMillis: Int = 10000, // milliseconds (default 10 seconds)
941+
val timeoutMillis: Int = 10000,
942942
) : ActionData() {
943943
override val id: ActionId = ActionId.SHELL_COMMAND
944944

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ object ActionDataEntityMapper {
664664
useRoot -> ShellExecutionMode.ROOT
665665
else -> ShellExecutionMode.STANDARD
666666
}
667-
667+
668668
val description =
669669
entity.extras.getData(ActionEntity.EXTRA_SHELL_COMMAND_DESCRIPTION)
670670
.valueOrNull() ?: return null
@@ -783,7 +783,7 @@ object ActionDataEntityMapper {
783783
is ActionData.InteractUiElement -> data.description
784784
is ActionData.ShellCommand -> Base64.encodeToString(
785785
data.command.toByteArray(),
786-
Base64.DEFAULT
786+
Base64.DEFAULT,
787787
).trim() // Trim to remove trailing newline added by Base64.DEFAULT
788788
is ActionData.HttpRequest -> SYSTEM_ACTION_ID_MAP[data.id]!!
789789
is ActionData.ControlMediaForApp.Rewind -> SYSTEM_ACTION_ID_MAP[data.id]!!

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -576,17 +576,17 @@ class ActionUiHelper(
576576
is ActionData.ShellCommand -> when (action.executionMode) {
577577
ShellExecutionMode.ROOT -> getString(
578578
R.string.action_shell_command_description_with_root,
579-
action.description
579+
action.description,
580580
)
581581

582582
ShellExecutionMode.ADB -> getString(
583583
R.string.action_shell_command_description_with_adb,
584-
action.description
584+
action.description,
585585
)
586586

587587
ShellExecutionMode.STANDARD -> getString(
588588
R.string.action_shell_command_description_with_standard,
589-
action.description
589+
action.description,
590590
)
591591
}
592592

@@ -596,12 +596,12 @@ class ActionUiHelper(
596596
ActionData.ForceStopApp -> getString(R.string.action_force_stop_app)
597597
is ActionData.ComposeSms -> getString(
598598
R.string.action_compose_sms_description,
599-
arrayOf(action.message, action.number)
599+
arrayOf(action.message, action.number),
600600
)
601601

602602
is ActionData.SendSms -> getString(
603603
R.string.action_send_sms_description,
604-
arrayOf(action.message, action.number)
604+
arrayOf(action.message, action.number),
605605
)
606606
}
607607

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class ConfigShellCommandViewModel @Inject constructor(
120120
is KMError -> {
121121
state = state.copy(
122122
isRunning = false,
123-
testResult = flowResult
123+
testResult = flowResult,
124124
)
125125
}
126126

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ class CreateActionDelegate(
746746
SmsActionBottomSheetState.SendSms(
747747
number = number,
748748
message = message,
749-
testResult = null
749+
testResult = null,
750750
)
751751
} else {
752752
SmsActionBottomSheetState.ComposeSms(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class CreateActionUseCaseImpl @Inject constructor(
2121
private val systemFeatureAdapter: SystemFeatureAdapter,
2222
private val cameraAdapter: CameraAdapter,
2323
private val permissionAdapter: PermissionAdapter,
24-
private val phoneAdapter: PhoneAdapter
24+
private val phoneAdapter: PhoneAdapter,
2525
) : CreateActionUseCase,
2626
IsActionSupportedUseCase by IsActionSupportedUseCaseImpl(
2727
systemFeatureAdapter,

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,3 @@ class ExecuteShellCommandUseCase @Inject constructor(
7575
}
7676
}
7777
}
78-

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

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ data class ShellCommandActionState(
8484
@Composable
8585
fun ShellCommandActionScreen(
8686
modifier: Modifier = Modifier,
87-
viewModel: ConfigShellCommandViewModel
87+
viewModel: ConfigShellCommandViewModel,
8888
) {
8989
ShellCommandActionScreen(
9090
modifier = modifier,
@@ -217,7 +217,7 @@ private fun ShellCommandActionScreen(
217217
modifier = Modifier.fillMaxSize(),
218218
state = pagerState,
219219
contentPadding = PaddingValues(16.dp),
220-
pageSpacing = 16.dp
220+
pageSpacing = 16.dp,
221221
) { pageIndex ->
222222
when (pageIndex) {
223223
0 -> ShellCommandConfigurationContent(
@@ -354,7 +354,7 @@ private fun ShellCommandConfigurationContent(
354354
stringResource(R.string.action_shell_command_setup_pro_mode_unsupported)
355355
} else {
356356
stringResource(R.string.action_shell_command_setup_pro_mode)
357-
}
357+
},
358358
)
359359
}
360360
}
@@ -365,9 +365,13 @@ private fun ShellCommandConfigurationContent(
365365
keyboardController?.hide()
366366
onTestClick()
367367
},
368-
enabled = !state.isRunning && (state.executionMode != ShellExecutionMode.ADB
369-
|| (state.executionMode == ShellExecutionMode.ADB
370-
&& state.proModeStatus == ProModeStatus.ENABLED)),
368+
enabled = !state.isRunning && (
369+
state.executionMode != ShellExecutionMode.ADB ||
370+
(
371+
state.executionMode == ShellExecutionMode.ADB &&
372+
state.proModeStatus == ProModeStatus.ENABLED
373+
)
374+
),
371375
) {
372376
Icon(Icons.Rounded.PlayArrow, contentDescription = null)
373377
Spacer(modifier = Modifier.width(8.dp))
@@ -376,7 +380,7 @@ private fun ShellCommandConfigurationContent(
376380
stringResource(R.string.action_shell_command_testing)
377381
} else {
378382
stringResource(R.string.action_shell_command_test_button)
379-
}
383+
},
380384
)
381385
}
382386
}
@@ -480,7 +484,7 @@ private fun ShellCommandOutputContent(
480484
Text(
481485
text = stringResource(
482486
R.string.action_shell_command_exit_code,
483-
result.value.exitCode
487+
result.value.exitCode,
484488
),
485489
style = MaterialTheme.typography.labelMedium,
486490
color = MaterialTheme.colorScheme.onSurfaceVariant,
@@ -560,8 +564,8 @@ private fun PreviewShellCommandActionScreenShellError() {
560564
ShellResult(
561565
stdOut = "",
562566
stdErr = "ls: .: Permission denied",
563-
exitCode = 1
564-
)
567+
exitCode = 1,
568+
),
565569
),
566570
),
567571
)
@@ -649,8 +653,8 @@ private fun PreviewShellCommandOutputShellError() {
649653
ShellResult(
650654
stdOut = "",
651655
stdErr = "ls: .: Permission denied",
652-
exitCode = 1
653-
)
656+
exitCode = 1,
657+
),
654658
),
655659
),
656660
onKillClick = {},
@@ -674,8 +678,8 @@ private fun PreviewShellCommandOutputRunning() {
674678
ShellResult(
675679
"Line 1\nLine 2\nLine 3\nLine 4\nLine 5",
676680
"",
677-
0
678-
)
681+
0,
682+
),
679683
),
680684
),
681685
onKillClick = {},

0 commit comments

Comments
 (0)