mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-09-19 16:24:41 +01:00
Add payment unavailable support article link.
This commit is contained in:
@@ -743,6 +743,8 @@ private fun EntryProviderScope<NavKey>.navigationEntries(
|
||||
when (action) {
|
||||
SignalLoginPaymentScreenActions.OpenLearnMoreArticle -> openUrl(context, "https://support.signal.org/hc/articles/11197884108826")
|
||||
|
||||
SignalLoginPaymentScreenActions.OpenPaymentUnavailableArticle -> openUrl(context, "https://support.signal.org/hc/articles/11228705649690")
|
||||
|
||||
is SignalLoginPaymentScreenActions.LaunchPurchaseFlow -> {
|
||||
purchaseScope.launch {
|
||||
val result = if (activity != null) {
|
||||
|
||||
+1
-1
@@ -272,7 +272,7 @@ private fun PaymentUnavailableDialog(
|
||||
) {
|
||||
val onDismiss = { onEvent(SignalLoginPaymentScreenEvents.PaymentUnavailableDialogDismissed) }
|
||||
val onMakeAvailable = { onEvent(SignalLoginPaymentScreenEvents.MakeGooglePlayServicesAvailableClicked) }
|
||||
val onLearnMore = { onEvent(SignalLoginPaymentScreenEvents.LearnMoreClicked) }
|
||||
val onLearnMore = { onEvent(SignalLoginPaymentScreenEvents.PaymentUnavailableLearnMoreClicked) }
|
||||
|
||||
val dialogModifier = Modifier.testTag(TestTags.SIGNAL_LOGIN_PAYMENT_UNAVAILABLE_DIALOG)
|
||||
|
||||
|
||||
+3
@@ -11,6 +11,9 @@ sealed interface SignalLoginPaymentScreenActions {
|
||||
/** Open the article explaining Signal Login. */
|
||||
data object OpenLearnMoreArticle : SignalLoginPaymentScreenActions
|
||||
|
||||
/** Open the article explaining why Google Play is required to buy a Signal Login. */
|
||||
data object OpenPaymentUnavailableArticle : SignalLoginPaymentScreenActions
|
||||
|
||||
/**
|
||||
* Launch the Google Play purchase sheet. The UI layer owns the activity, launches [launcher], and reports the
|
||||
* outcome back as [SignalLoginPaymentScreenEvents.PurchaseFlowCompleted].
|
||||
|
||||
+3
@@ -20,6 +20,9 @@ sealed class SignalLoginPaymentScreenEvents {
|
||||
/** The user tapped the "learn more" link in the description. */
|
||||
data object LearnMoreClicked : SignalLoginPaymentScreenEvents()
|
||||
|
||||
/** The user tapped "learn more" on the dialog explaining that Google Play cannot take a payment. */
|
||||
data object PaymentUnavailableLearnMoreClicked : SignalLoginPaymentScreenEvents()
|
||||
|
||||
/** The user selected one of the two options. */
|
||||
data class OptionSelected(val option: SignalLoginPaymentState.Option) : SignalLoginPaymentScreenEvents()
|
||||
|
||||
|
||||
+4
@@ -145,6 +145,10 @@ class SignalLoginPaymentViewModel(
|
||||
_actions.trySend(SignalLoginPaymentScreenActions.OpenLearnMoreArticle)
|
||||
}
|
||||
|
||||
is SignalLoginPaymentScreenEvents.PaymentUnavailableLearnMoreClicked -> {
|
||||
_actions.trySend(SignalLoginPaymentScreenActions.OpenPaymentUnavailableArticle)
|
||||
}
|
||||
|
||||
is SignalLoginPaymentScreenEvents.OptionSelected -> {
|
||||
if (event.option == SignalLoginPaymentState.Option.Purchase && !state.isPurchaseOptionEnabled) {
|
||||
Log.w(TAG, "[OptionSelected] Ignoring a purchase selection that cannot be acted on.")
|
||||
|
||||
+9
@@ -91,6 +91,15 @@ class SignalLoginPaymentViewModelTest {
|
||||
assertThat(actions).containsExactly(SignalLoginPaymentScreenActions.OpenLearnMoreArticle)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `PaymentUnavailableLearnMoreClicked emits an action to open the payment unavailable article`() = runTest(testDispatcher) {
|
||||
val actions = collectActions()
|
||||
|
||||
viewModel.applyEvent(SignalLoginPaymentState(), SignalLoginPaymentScreenEvents.PaymentUnavailableLearnMoreClicked, parentEventEmitter) {}
|
||||
|
||||
assertThat(actions).containsExactly(SignalLoginPaymentScreenActions.OpenPaymentUnavailableArticle)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Initialize loads the price from the billing library`() = runTest(testDispatcher) {
|
||||
coEvery { mockRepository.getSignalLoginPrice() } returns SignalLoginPriceResult.Available("$1.99")
|
||||
|
||||
Reference in New Issue
Block a user