From 827e1c2e4fd53e08615f762be238d2ca824c07f6 Mon Sep 17 00:00:00 2001 From: Nazli Yurdakul <69359432+nazli-stripe@users.noreply.github.com> Date: Sat, 23 Dec 2023 00:07:57 +0300 Subject: [PATCH] AoD support (#578) * move onCreate call to MainApplication * remove runOnUiThread. * clean up * revert RNModule.kt changes --------- Co-authored-by: Ian Lin --- .../TerminalApplicationDelegate.kt | 13 +++++++++++++ .../stripeterminalreactnative/MainApplication.java | 2 ++ 2 files changed, 15 insertions(+) create mode 100644 android/src/main/java/com/stripeterminalreactnative/TerminalApplicationDelegate.kt diff --git a/android/src/main/java/com/stripeterminalreactnative/TerminalApplicationDelegate.kt b/android/src/main/java/com/stripeterminalreactnative/TerminalApplicationDelegate.kt new file mode 100644 index 00000000..cbfbbb06 --- /dev/null +++ b/android/src/main/java/com/stripeterminalreactnative/TerminalApplicationDelegate.kt @@ -0,0 +1,13 @@ +package com.stripeterminalreactnative + +import android.app.Application +import com.facebook.react.bridge.UiThreadUtil +import com.stripe.stripeterminal.TerminalApplicationDelegate + +object TerminalApplicationDelegate { + + @JvmStatic + fun onCreate(application: Application) { + TerminalApplicationDelegate.onCreate(application) + } +} diff --git a/dev-app/android/app/src/main/java/com/dev/app/stripeterminalreactnative/MainApplication.java b/dev-app/android/app/src/main/java/com/dev/app/stripeterminalreactnative/MainApplication.java index 2f694c4d..773e654a 100644 --- a/dev-app/android/app/src/main/java/com/dev/app/stripeterminalreactnative/MainApplication.java +++ b/dev-app/android/app/src/main/java/com/dev/app/stripeterminalreactnative/MainApplication.java @@ -10,6 +10,7 @@ import com.facebook.soloader.SoLoader; import java.util.List; import com.stripeterminalreactnative.StripeTerminalReactNativePackage; +import com.stripeterminalreactnative.TerminalApplicationDelegate; public class MainApplication extends Application implements ReactApplication { @@ -54,6 +55,7 @@ public ReactNativeHost getReactNativeHost() { @Override public void onCreate() { super.onCreate(); + TerminalApplicationDelegate.onCreate(this); SoLoader.init(this, /* native exopackage */ false); if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { // If you opted-in for the New Architecture, we load the native entry point for this app.