-
Notifications
You must be signed in to change notification settings - Fork 661
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Identity] Show alert dialog to cancel when falling back to document …
…consent (#7051)
- Loading branch information
1 parent
39388dd
commit 08e9164
Showing
6 changed files
with
112 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
identity/src/main/java/com/stripe/android/identity/utils/AlertUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.stripe.android.identity.utils | ||
|
||
import android.content.Context | ||
import android.content.DialogInterface.OnClickListener | ||
import androidx.annotation.StringRes | ||
import androidx.appcompat.app.AlertDialog | ||
|
||
internal data class AlertButton( | ||
@StringRes val buttonRes: Int, | ||
val onClickListener: OnClickListener? = null | ||
) | ||
|
||
internal fun showAlertDialog( | ||
context: Context, | ||
@StringRes titleRes: Int, | ||
positiveButton: AlertButton? = null, | ||
negativeButton: AlertButton? = null | ||
) { | ||
val builder = AlertDialog.Builder(context) | ||
builder.setMessage(titleRes) | ||
positiveButton?.let { | ||
builder.setPositiveButton(positiveButton.buttonRes, positiveButton.onClickListener) | ||
} | ||
negativeButton?.let { | ||
builder.setNegativeButton(negativeButton.buttonRes, negativeButton.onClickListener) | ||
} | ||
builder.show() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters