From ff44e486ee0e592c2cc5f5fb8a84599caf126324 Mon Sep 17 00:00:00 2001 From: Sarah Koop Date: Mon, 8 Jan 2024 09:44:38 -0600 Subject: [PATCH] Update to use ComponentActivity (#879) --- .../java/com/braintreepayments/api/VenmoLauncher.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Venmo/src/main/java/com/braintreepayments/api/VenmoLauncher.java b/Venmo/src/main/java/com/braintreepayments/api/VenmoLauncher.java index bd3b5b602a..ea6f1f8938 100644 --- a/Venmo/src/main/java/com/braintreepayments/api/VenmoLauncher.java +++ b/Venmo/src/main/java/com/braintreepayments/api/VenmoLauncher.java @@ -10,7 +10,6 @@ import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentActivity; import androidx.lifecycle.LifecycleOwner; /** @@ -25,7 +24,7 @@ public class VenmoLauncher { /** * Used to launch the Venmo authentication flow to tokenize a Venmo account. This class must be - * instantiated in the OnCreate method of your Fragment. + * instantiated before the Fragment is created. * * @param fragment an Android Fragment from which you will launch the Venmo app * @param callback a {@link VenmoLauncherCallback} to receive the result of the Venmo @@ -39,13 +38,13 @@ public VenmoLauncher(@NonNull Fragment fragment, /** * Used to launch the Venmo authentication flow to tokenize a Venmo account. This class must be - * instantiated in the OnCreate method of your Activity. + * instantiated before the Activity is created. * * @param activity an Android Activity from which you will launch the Venmo app * @param callback a {@link VenmoLauncherCallback} to receive the result of the Venmo * app switch authentication flow */ - public VenmoLauncher(@NonNull FragmentActivity activity, + public VenmoLauncher(@NonNull ComponentActivity activity, @NonNull VenmoLauncherCallback callback) { this(activity.getActivityResultRegistry(), activity, callback); } @@ -58,7 +57,9 @@ public VenmoLauncher(@NonNull FragmentActivity activity, } /** - * Launches the Venmo authentication flow by switching to the Venmo app. + * Launches the Venmo authentication flow by switching to the Venmo app. This method cannot be + * called until the lifecycle of the Fragment or Activity used to instantiate your + * {@link VenmoLauncher} has reached the CREATED state. * * @param venmoPaymentAuthRequest the result of * {@link VenmoClient#createPaymentAuthRequest(android.content.Context, VenmoRequest, VenmoPaymentAuthRequestCallback)}