From e17ad2dcc4f80992f98f92c371d01fcca29976be Mon Sep 17 00:00:00 2001 From: AJAYJ-09 Date: Tue, 11 Jun 2024 19:10:03 +0530 Subject: [PATCH 1/5] Resolved the namespace issue and symbol R --- android/build.gradle | 2 +- android/src/main/AndroidManifest.xml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index fda35288..d832c2c9 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -16,7 +16,7 @@ def MIN_IAP_SDK_VERSION = '1.6.6' android { compileSdkVersion 33 - + namespace "sqip.react" defaultConfig { minSdkVersion 24 targetSdkVersion 33 diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index f05b80b3..9e6e4bb8 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + From 514b8d17ccaf505792446a6621db4e23457aeb81 Mon Sep 17 00:00:00 2001 From: AJAYJ-09 Date: Wed, 12 Jun 2024 16:15:52 +0530 Subject: [PATCH 2/5] Resolved listener issue --- .../sqip/react/SquareInAppPaymentsModule.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/android/src/main/java/sqip/react/SquareInAppPaymentsModule.java b/android/src/main/java/sqip/react/SquareInAppPaymentsModule.java index cb5c01c7..54142598 100644 --- a/android/src/main/java/sqip/react/SquareInAppPaymentsModule.java +++ b/android/src/main/java/sqip/react/SquareInAppPaymentsModule.java @@ -47,4 +47,24 @@ public void run() { } }); } + + @ReactMethod + public void addListener(String eventName) { + if (!listeners.containsKey(eventName)) { + listeners.put(eventName, 1); + } else { + listeners.put(eventName, listeners.get(eventName) + 1); + } } + + @ReactMethod + public void removeListeners(Integer count) { + for (Map.Entry entry : listeners.entrySet()) { + int currentCount = entry.getValue(); + if (currentCount <= count) { + listeners.remove(entry.getKey()); + } else { + listeners.put(entry.getKey(), currentCount - count); + } + } } } + From 0b1125ccd66c17e9e90a749c5f9d63071749cbd1 Mon Sep 17 00:00:00 2001 From: AJAYJ-09 Date: Wed, 12 Jun 2024 18:31:08 +0530 Subject: [PATCH 3/5] Resolved android pipeline failure --- .../src/main/java/sqip/react/SquareInAppPaymentsModule.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/sqip/react/SquareInAppPaymentsModule.java b/android/src/main/java/sqip/react/SquareInAppPaymentsModule.java index 54142598..b6c2edee 100644 --- a/android/src/main/java/sqip/react/SquareInAppPaymentsModule.java +++ b/android/src/main/java/sqip/react/SquareInAppPaymentsModule.java @@ -22,10 +22,13 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule; import com.facebook.react.bridge.ReactMethod; import sqip.InAppPaymentsSdk; - +import com.facebook.react.modules.core.DeviceEventManagerModule; +import java.util.HashMap; +import java.util.Map; class SquareInAppPaymentsModule extends ReactContextBaseJavaModule { private final Handler mainLooperHandler; + private final Map listeners; public SquareInAppPaymentsModule(ReactApplicationContext reactContext) { super(reactContext); From 86dcb46176911df365006600fdb9efd5e8f0f638 Mon Sep 17 00:00:00 2001 From: AJAYJ-09 Date: Wed, 12 Jun 2024 18:37:33 +0530 Subject: [PATCH 4/5] Added listeners --- android/src/main/java/sqip/react/SquareInAppPaymentsModule.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/android/src/main/java/sqip/react/SquareInAppPaymentsModule.java b/android/src/main/java/sqip/react/SquareInAppPaymentsModule.java index b6c2edee..2f2760ab 100644 --- a/android/src/main/java/sqip/react/SquareInAppPaymentsModule.java +++ b/android/src/main/java/sqip/react/SquareInAppPaymentsModule.java @@ -33,6 +33,8 @@ class SquareInAppPaymentsModule extends ReactContextBaseJavaModule { public SquareInAppPaymentsModule(ReactApplicationContext reactContext) { super(reactContext); mainLooperHandler = new Handler(Looper.getMainLooper()); + this.listeners = new HashMap<>(); + } @Override From 6e87aa801e8a18056a6fc6ae38608005aff1d8a4 Mon Sep 17 00:00:00 2001 From: Nilay-squareup Date: Wed, 7 Aug 2024 15:27:33 +0530 Subject: [PATCH 5/5] removed unnecessary changes from SquareInAppPaymentsModule.java --- android/src/main/java/sqip/react/SquareInAppPaymentsModule.java | 1 - 1 file changed, 1 deletion(-) diff --git a/android/src/main/java/sqip/react/SquareInAppPaymentsModule.java b/android/src/main/java/sqip/react/SquareInAppPaymentsModule.java index 2f2760ab..4aa9c82c 100644 --- a/android/src/main/java/sqip/react/SquareInAppPaymentsModule.java +++ b/android/src/main/java/sqip/react/SquareInAppPaymentsModule.java @@ -22,7 +22,6 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule; import com.facebook.react.bridge.ReactMethod; import sqip.InAppPaymentsSdk; -import com.facebook.react.modules.core.DeviceEventManagerModule; import java.util.HashMap; import java.util.Map; class SquareInAppPaymentsModule extends ReactContextBaseJavaModule {