|
1 | 1 | package com.firebase.ui.auth.data.model; |
2 | 2 |
|
3 | 3 | import android.app.PendingIntent; |
| 4 | +import android.content.IntentSender; |
4 | 5 |
|
5 | 6 | import com.firebase.ui.auth.ErrorCodes; |
6 | 7 | import com.firebase.ui.auth.FirebaseUiException; |
|
11 | 12 | @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) |
12 | 13 | public class PendingIntentRequiredException extends FirebaseUiException { |
13 | 14 | private final PendingIntent mPendingIntent; |
| 15 | + private final IntentSender mIntentSender; |
14 | 16 | private final int mRequestCode; |
15 | 17 |
|
| 18 | + /** |
| 19 | + * Constructor for cases when a PendingIntent is available. |
| 20 | + * |
| 21 | + * @param pendingIntent The PendingIntent required to complete the operation. |
| 22 | + * @param requestCode The associated request code. |
| 23 | + */ |
16 | 24 | public PendingIntentRequiredException(@NonNull PendingIntent pendingIntent, int requestCode) { |
17 | 25 | super(ErrorCodes.UNKNOWN_ERROR); |
18 | 26 | mPendingIntent = pendingIntent; |
| 27 | + mIntentSender = null; |
19 | 28 | mRequestCode = requestCode; |
20 | 29 | } |
21 | 30 |
|
22 | | - @NonNull |
| 31 | + /** |
| 32 | + * Constructor for cases when an IntentSender is available. |
| 33 | + * |
| 34 | + * @param intentSender The IntentSender required to complete the operation. |
| 35 | + * @param requestCode The associated request code. |
| 36 | + */ |
| 37 | + public PendingIntentRequiredException(@NonNull IntentSender intentSender, int requestCode) { |
| 38 | + super(ErrorCodes.UNKNOWN_ERROR); |
| 39 | + mIntentSender = intentSender; |
| 40 | + mPendingIntent = null; |
| 41 | + mRequestCode = requestCode; |
| 42 | + } |
| 43 | + |
| 44 | + /** |
| 45 | + * Returns the PendingIntent, if available. |
| 46 | + * |
| 47 | + * @return The PendingIntent or null if not available. |
| 48 | + */ |
23 | 49 | public PendingIntent getPendingIntent() { |
24 | 50 | return mPendingIntent; |
25 | 51 | } |
26 | 52 |
|
| 53 | + /** |
| 54 | + * Returns the IntentSender, if available. |
| 55 | + * |
| 56 | + * @return The IntentSender or null if not available. |
| 57 | + */ |
| 58 | + public IntentSender getIntentSender() { |
| 59 | + return mIntentSender; |
| 60 | + } |
| 61 | + |
27 | 62 | public int getRequestCode() { |
28 | 63 | return mRequestCode; |
29 | 64 | } |
|
0 commit comments