Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielluong committed Nov 10, 2021
1 parent 2d329eb commit b011793
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import mozilla.components.concept.storage.LoginEntry
import mozilla.components.concept.storage.LoginValidationDelegate
import mozilla.components.feature.prompts.concept.SelectablePromptView
import mozilla.components.feature.prompts.creditcard.CreditCardPicker
import mozilla.components.feature.prompts.creditcard.CreditCardSaveDialogFragment
import mozilla.components.feature.prompts.dialog.AlertDialogFragment
import mozilla.components.feature.prompts.dialog.AuthenticationDialogFragment
import mozilla.components.feature.prompts.dialog.ChoiceDialogFragment
Expand Down Expand Up @@ -509,6 +510,7 @@ class PromptFeature private constructor(

is Share -> it.onSuccess()

is SaveCreditCard -> it.onConfirm(value as CreditCard)
is SaveLoginPrompt -> it.onConfirm(value as LoginEntry)

is Confirm -> {
Expand Down Expand Up @@ -570,6 +572,9 @@ class PromptFeature private constructor(
)
}

/**
* Called from on [onPromptRequested] to handle requests for showing native dialogs.
*/
@Suppress("ComplexMethod", "LongMethod")
@VisibleForTesting(otherwise = PRIVATE)
internal fun handleDialogsRequest(
Expand All @@ -578,6 +583,11 @@ class PromptFeature private constructor(
) {
// Requests that are handled with dialogs
val dialog = when (promptRequest) {
is SaveCreditCard -> {
if (!isCreditCardAutofillEnabled.invoke()) return

CreditCardSaveDialogFragment.newInstance()
}

is SaveLoginPrompt -> {
if (!isSaveLoginEnabled.invoke()) return
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package mozilla.components.feature.prompts.creditcard

import android.os.Bundle
import mozilla.components.feature.prompts.dialog.PromptDialogFragment

internal class CreditCardSaveDialogFragment : PromptDialogFragment() {

companion object {
fun newInstance() : CreditCardSaveDialogFragment {
val fragment = CreditCardSaveDialogFragment()
val arguments = fragment.arguments ?: Bundle()

fragment.arguments = arguments
return fragment
}
}
}

1 comment on commit b011793

@firefoxci-taskcluster
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh oh! Looks like an error! Details

Failed to fetch task artifact public/github/customCheckRunText.md for GitHub integration.
Make sure the artifact exists on the worker or other location.

Please sign in to comment.