Skip to content

Commit dc95ebe

Browse files
authored
Widen Activity Parameter Type (#118)
* Widen Activity reference in BrowserSwitchClient for better compatability with Flutter. * Update CHANGELOG.
1 parent 919a4d0 commit dc95ebe

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# browser-switch-android Release Notes
22

3+
## unreleased
4+
5+
* Widen BraintreeClient.start() activity reference from `ComponentActivity` to plain `Activity`
6+
37
## 3.1.0
48

59
* Add `LaunchType` to `BrowserSwitchOptions` to specify how the browser switch should be launched

browser-switch/src/main/java/com/braintreepayments/api/BrowserSwitchClient.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package com.braintreepayments.api;
22

3+
import android.app.Activity;
34
import android.content.ActivityNotFoundException;
45
import android.content.Context;
56
import android.content.Intent;
67
import android.net.Uri;
78

8-
import androidx.activity.ComponentActivity;
99
import androidx.annotation.NonNull;
1010
import androidx.annotation.VisibleForTesting;
1111

@@ -47,7 +47,7 @@ public BrowserSwitchClient() {
4747
* or {@link BrowserSwitchStartResult.Failure} if browser could not be launched.
4848
*/
4949
@NonNull
50-
public BrowserSwitchStartResult start(@NonNull ComponentActivity activity, @NonNull BrowserSwitchOptions browserSwitchOptions) {
50+
public BrowserSwitchStartResult start(@NonNull Activity activity, @NonNull BrowserSwitchOptions browserSwitchOptions) {
5151
try {
5252
assertCanPerformBrowserSwitch(activity, browserSwitchOptions);
5353
} catch (BrowserSwitchException e) {
@@ -92,7 +92,7 @@ public BrowserSwitchStartResult start(@NonNull ComponentActivity activity, @NonN
9292
* @throws BrowserSwitchException exception containing the error message on why browser switch cannot be started
9393
*/
9494
public void assertCanPerformBrowserSwitch(
95-
ComponentActivity activity,
95+
Activity activity,
9696
BrowserSwitchOptions browserSwitchOptions
9797
) throws BrowserSwitchException {
9898
Context appContext = activity.getApplicationContext();
@@ -127,7 +127,7 @@ private boolean isValidRequestCode(int requestCode) {
127127
* @param intent the intent to return to your application containing a deep link result from the
128128
* browser flow
129129
* @param pendingRequest the pending request string returned from {@link BrowserSwitchStartResult.Started} via
130-
* {@link BrowserSwitchClient#start(ComponentActivity, BrowserSwitchOptions)}
130+
* {@link BrowserSwitchClient#start(Activity, BrowserSwitchOptions)}
131131
* @return a {@link BrowserSwitchFinalResult.Success} if the browser switch was successfully
132132
* completed, or {@link BrowserSwitchFinalResult.NoResult} if no result can be found for the given
133133
* pending request String. A {@link BrowserSwitchFinalResult.NoResult} will be

browser-switch/src/main/java/com/braintreepayments/api/BrowserSwitchOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
/**
1010
* Object that contains a set of browser switch parameters for use with
11-
* {@link BrowserSwitchClient#start(androidx.activity.ComponentActivity, BrowserSwitchOptions)}.
11+
* {@link BrowserSwitchClient#start(android.app.Activity, BrowserSwitchOptions)}.
1212
*/
1313
public class BrowserSwitchOptions {
1414

0 commit comments

Comments
 (0)