Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ad71d748 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Use activityStarter of KeyguardQuickAffordancePickerViewModel to launch...

Merge "Use activityStarter of KeyguardQuickAffordancePickerViewModel to launch button intent" into udc-dev
parents be6f23f0 eb78ed0d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ private constructor(
    private val quickAffordanceInteractor: KeyguardQuickAffordancePickerInteractor,
    private val wallpaperInteractor: WallpaperInteractor,
    private val wallpaperInfoFactory: CurrentWallpaperInfoFactory,
    activityStarter: (Intent) -> Unit,
    private val activityStarter: (Intent) -> Unit,
) : ViewModel() {

    @SuppressLint("StaticFieldLeak") private val applicationContext = context.applicationContext
@@ -361,7 +361,7 @@ private constructor(
                            style = ButtonStyle.Primary,
                            onClicked = {
                                actionComponentName.toIntent()?.let { intent ->
                                    applicationContext.startActivity(intent)
                                    activityStarter(intent)
                                }
                            }
                        ),
+7 −2
Original line number Diff line number Diff line
@@ -282,9 +282,14 @@ class KeyguardQuickAffordancePickerViewModelTest {
            assertThat(dialog()?.buttons?.first()?.text)
                .isEqualTo(Text.Loaded(enablementActionText))

            // When the button is clicked, we expect an intent of the given enablement action
            // component name is launched.
            dialog()?.buttons?.first()?.onClicked?.invoke()
            assertThat(latestStartedActivityIntent?.`package`).isEqualTo(packageName)
            assertThat(latestStartedActivityIntent?.action).isEqualTo(action)

            // Once we report that the dialog has been dismissed by the user, we expect there to be
            // no
            // dialog to be shown:
            // no dialog to be shown:
            underTest.onDialogDismissed()
            assertThat(dialog()).isNull()
        }