Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This is a modified version of the codegen file. Since old arch does not support mEventEmitterCallback
// we implement event emitting with RCTDeviceEventEmitter.
// To update this file run ./scripts/old-arch-codegen-android

/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
Expand All @@ -21,6 +24,7 @@
import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

public abstract class NativeOnrampSdkModuleSpec extends ReactContextBaseJavaModule implements TurboModule {
public static final String NAME = "OnrampSdk";
Expand All @@ -40,6 +44,10 @@ private void invoke(String eventName, Object params) {
.emit(eventName, params);
}

private void invoke(String eventName) {
invoke(eventName, null);
}

protected final void emitOnCheckoutClientSecretRequested(ReadableMap value) {
invoke("onCheckoutClientSecretRequested", value);
}
Expand Down Expand Up @@ -86,7 +94,7 @@ protected final void emitOnCheckoutClientSecretRequested(ReadableMap value) {

@ReactMethod
@DoNotStrip
public abstract void provideCheckoutClientSecret(String clientSecret);
public abstract void provideCheckoutClientSecret(@Nullable String clientSecret);

@ReactMethod
@DoNotStrip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,74 +54,6 @@ private void invoke(String eventName) {
invoke(eventName, null);
}

protected final void emitOnConfirmHandlerCallback(ReadableMap value) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we get these changes to NativeStripeSdkModuleSpec.java merged in a separate PR to master? It'll make it easier to merge the beta branch later.

Choose a reason for hiding this comment

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

@lng-stripe I believe that's addressed by this PR: #2151

invoke("onConfirmHandlerCallback", value);
}

protected final void emitOnFinancialConnectionsEvent(ReadableMap value) {
invoke("onFinancialConnectionsEvent", value);
}

protected final void emitOnOrderTrackingCallback() {
invoke("onOrderTrackingCallback");
}

protected final void emitOnCustomerAdapterFetchPaymentMethodsCallback() {
invoke("onCustomerAdapterFetchPaymentMethodsCallback");
}

protected final void emitOnCustomerAdapterAttachPaymentMethodCallback(ReadableMap value) {
invoke("onCustomerAdapterAttachPaymentMethodCallback", value);
}

protected final void emitOnCustomerAdapterDetachPaymentMethodCallback(ReadableMap value) {
invoke("onCustomerAdapterDetachPaymentMethodCallback", value);
}

protected final void emitOnCustomerAdapterSetSelectedPaymentOptionCallback(ReadableMap value) {
invoke("onCustomerAdapterSetSelectedPaymentOptionCallback", value);
}

protected final void emitOnCustomerAdapterFetchSelectedPaymentOptionCallback() {
invoke("onCustomerAdapterFetchSelectedPaymentOptionCallback");
}

protected final void emitOnCustomerAdapterSetupIntentClientSecretForCustomerAttachCallback() {
invoke("onCustomerAdapterSetupIntentClientSecretForCustomerAttachCallback");
}

protected final void emitEmbeddedPaymentElementDidUpdateHeight(ReadableMap value) {
invoke("embeddedPaymentElementDidUpdateHeight", value);
}

protected final void emitEmbeddedPaymentElementWillPresent() {
invoke("embeddedPaymentElementWillPresent");
}

protected final void emitEmbeddedPaymentElementDidUpdatePaymentOption(ReadableMap value) {
invoke("embeddedPaymentElementDidUpdatePaymentOption", value);
}

protected final void emitEmbeddedPaymentElementFormSheetConfirmComplete(ReadableMap value) {
invoke("embeddedPaymentElementFormSheetConfirmComplete", value);
}

protected final void emitEmbeddedPaymentElementRowSelectionImmediateAction() {
invoke("embeddedPaymentElementRowSelectionImmediateAction");
}

protected final void emitEmbeddedPaymentElementLoadingFailed(ReadableMap value) {
invoke("embeddedPaymentElementLoadingFailed", value);
}

protected final void emitOnCustomPaymentMethodConfirmHandlerCallback(ReadableMap value) {
invoke("onCustomPaymentMethodConfirmHandlerCallback", value);
}

protected final void emitOnCheckoutClientSecretRequested(ReadableMap value) {
invoke("onCheckoutClientSecretRequested", value);
}

@ReactMethod
@DoNotStrip
public abstract void initialise(ReadableMap params, Promise promise);
Expand Down
34 changes: 34 additions & 0 deletions scripts/NativeOnrampSdkModuleSpec.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
--- android/src/oldarch/java/com/reactnativestripesdk/NativeOnrampSdkModuleSpec.java 2025-05-05 16:53:11
+++ android/src/oldarch/java/com/reactnativestripesdk/NativeOnrampSdkModuleSpecNew.java 2025-05-05 16:54:44
@@ -1,3 +1,6 @@
+// This is a modified version of the codegen file. Since old arch does not support mEventEmitterCallback
+// we implement event emitting with RCTDeviceEventEmitter.
+// To update this file run ./scripts/old-arch-codegen-android

/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
@@ -20,6 +23,7 @@
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableMap;
+import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -38,6 +42,16 @@
@Override
public @Nonnull String getName() {
return NAME;
+ }
+
+ private void invoke(String eventName, Object params) {
+ getReactApplicationContext()
+ .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
+ .emit(eventName, params);
+ }
+
+ private void invoke(String eventName) {
+ invoke(eventName, null);
}

protected final void emitOnCheckoutClientSecretRequested(ReadableMap value) {
5 changes: 5 additions & 0 deletions scripts/old-arch-codegen-android
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ done
# diff -u android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpecNew.java > scripts/NativeStripeSdkModuleSpec.patch
patch android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java < scripts/NativeStripeSdkModuleSpec.patch
sed -i '' 's/mEventEmitterCallback\.invoke/invoke/g' android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java

patch android/src/oldarch/java/com/reactnativestripesdk/NativeOnrampSdkModuleSpec.java < scripts/NativeOnrampSdkModuleSpec.patch
sed -i '' 's/mEventEmitterCallback\.invoke/invoke/g' android/src/oldarch/java/com/reactnativestripesdk/NativeOnrampSdkModuleSpec.java

find android/src/oldarch/java -type f -name '*.orig' -delete
Loading