diff --git a/android/build.gradle b/android/build.gradle
index fd26bc186..92624255b 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -1,6 +1,112 @@
+// buildscript {
+// // Buildscript is evaluated before everything else so we can't use getExtOrDefault
+// def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["RNIterable_kotlinVersion"]
+
+// repositories {
+// google()
+// mavenCentral()
+// }
+
+// dependencies {
+// classpath "com.android.tools.build:gradle:7.2.1"
+// // noinspection DifferentKotlinGradleVersion
+// classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+// }
+// }
+
+// def reactNativeArchitectures() {
+// def value = rootProject.getProperties().get("reactNativeArchitectures")
+// return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
+// }
+
+// def isNewArchitectureEnabled() {
+// return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
+// }
+
+// apply plugin: "com.android.library"
+// apply plugin: "kotlin-android"
+
+// if (isNewArchitectureEnabled()) {
+// apply plugin: "com.facebook.react"
+// }
+
+// def getExtOrDefault(name) {
+// return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["RNIterable_" + name]
+// }
+
+// def getExtOrIntegerDefault(name) {
+// return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["RNIterable_" + name]).toInteger()
+// }
+
+// def supportsNamespace() {
+// def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
+// def major = parsed[0].toInteger()
+// def minor = parsed[1].toInteger()
+
+// // Namespace support was added in 7.3.0
+// return (major == 7 && minor >= 3) || major >= 8
+// }
+
+// android {
+// if (supportsNamespace()) {
+// namespace "com.iterable.reactnative"
+
+// sourceSets {
+// main {
+// manifest.srcFile "src/main/AndroidManifestNew.xml"
+// }
+// }
+// }
+
+// compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
+
+// defaultConfig {
+// minSdkVersion getExtOrIntegerDefault("minSdkVersion")
+// targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
+
+// }
+
+// buildTypes {
+// release {
+// minifyEnabled false
+// }
+// }
+
+// lintOptions {
+// disable "GradleCompatible"
+// }
+
+// compileOptions {
+// sourceCompatibility JavaVersion.VERSION_1_8
+// targetCompatibility JavaVersion.VERSION_1_8
+// }
+// }
+
+// repositories {
+// mavenCentral()
+// google()
+// }
+
+// def kotlin_version = getExtOrDefault("kotlinVersion")
+
+// dependencies {
+// // For < 0.71, this will be from the local maven repo
+// // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
+// //noinspection GradleDynamicVersion
+// implementation "com.facebook.react:react-native:+"
+// implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
+// api "com.iterable:iterableapi:3.5.2"
+// // api project(":iterableapi") // links to local android SDK repo rather than by release
+// }
+
+def isNewArchitectureEnabled() {
+ return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
+}
+
buildscript {
- // Buildscript is evaluated before everything else so we can't use getExtOrDefault
- def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["RNIterable_kotlinVersion"]
+ ext.getExtOrDefault = {name ->
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['RNIterable_' + name]
+ }
repositories {
google()
@@ -8,20 +114,12 @@ buildscript {
}
dependencies {
- classpath "com.android.tools.build:gradle:7.2.1"
+ classpath "com.android.tools.build:gradle:8.7.2"
// noinspection DifferentKotlinGradleVersion
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
}
}
-def reactNativeArchitectures() {
- def value = rootProject.getProperties().get("reactNativeArchitectures")
- return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
-}
-
-def isNewArchitectureEnabled() {
- return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
-}
apply plugin: "com.android.library"
apply plugin: "kotlin-android"
@@ -30,40 +128,23 @@ if (isNewArchitectureEnabled()) {
apply plugin: "com.facebook.react"
}
-def getExtOrDefault(name) {
- return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["RNIterable_" + name]
-}
-
def getExtOrIntegerDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["RNIterable_" + name]).toInteger()
}
-def supportsNamespace() {
- def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
- def major = parsed[0].toInteger()
- def minor = parsed[1].toInteger()
-
- // Namespace support was added in 7.3.0
- return (major == 7 && minor >= 3) || major >= 8
-}
-
android {
- if (supportsNamespace()) {
- namespace "com.iterable.reactnative"
-
- sourceSets {
- main {
- manifest.srcFile "src/main/AndroidManifestNew.xml"
- }
- }
- }
+ namespace "com.iterable.reactnative"
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
defaultConfig {
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
+ buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString())
+ }
+ buildFeatures {
+ buildConfig true
}
buildTypes {
@@ -80,6 +161,20 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
+
+ sourceSets {
+ main {
+ // java.srcDirs += [
+ // "generated/java",
+ // "generated/jni"
+ // ]
+ if (isNewArchitectureEnabled()) {
+ java.srcDirs += ['src/newarch']
+ } else {
+ java.srcDirs += ['src/oldarch']
+ }
+ }
+ }
}
repositories {
@@ -90,12 +185,16 @@ repositories {
def kotlin_version = getExtOrDefault("kotlinVersion")
dependencies {
- // For < 0.71, this will be from the local maven repo
- // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
- //noinspection GradleDynamicVersion
- implementation "com.facebook.react:react-native:+"
+ implementation "com.facebook.react:react-android"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
api "com.iterable:iterableapi:3.5.2"
- // api project(":iterableapi") // links to local android SDK repo rather than by release
}
+// if (isNewArchitectureEnabled()) {
+// react {
+// jsRootDir = file("../src/api/")
+// libraryName = "RNIterableAPISpec"
+// codegenJavaPackageName = "com.iterable.reactnative"
+// }
+// }
+
diff --git a/android/gradle.properties b/android/gradle.properties
index a46c61ab2..60ed9d52c 100644
--- a/android/gradle.properties
+++ b/android/gradle.properties
@@ -1,7 +1,7 @@
-RNIterable_kotlinVersion=1.7.0
-RNIterable_minSdkVersion=21
-RNIterable_targetSdkVersion=31
-RNIterable_compileSdkVersion=31
-RNIterable_ndkversion=21.4.7075529
+RNIterable_kotlinVersion=2.0.21
+RNIterable_minSdkVersion=24
+RNIterable_targetSdkVersion=34
+RNIterable_compileSdkVersion=35
+RNIterable_ndkversion=27.1.12297006
android.useAndroidX=true
-android.enableJetifier=true
\ No newline at end of file
+android.enableJetifier=true
diff --git a/android/src/main/AndroidManifestNew.xml b/android/src/main/AndroidManifestNew.xml
deleted file mode 100644
index a2f47b605..000000000
--- a/android/src/main/AndroidManifestNew.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/android/src/main/java/com/iterable/reactnative/RNIterableAPIModule.java b/android/src/main/java/com/iterable/reactnative/RNIterableAPIModuleImpl.java
similarity index 80%
rename from android/src/main/java/com/iterable/reactnative/RNIterableAPIModule.java
rename to android/src/main/java/com/iterable/reactnative/RNIterableAPIModuleImpl.java
index 4d1766472..1367273d9 100644
--- a/android/src/main/java/com/iterable/reactnative/RNIterableAPIModule.java
+++ b/android/src/main/java/com/iterable/reactnative/RNIterableAPIModuleImpl.java
@@ -8,10 +8,9 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-
+import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.Callback;
-import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
@@ -19,8 +18,10 @@
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.UiThreadUtil;
import com.facebook.react.bridge.WritableMap;
+import com.facebook.react.module.annotations.ReactModule;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.facebook.react.modules.core.RCTNativeAppEventEmitter;
+
import com.iterable.iterableapi.InboxSessionManager;
import com.iterable.iterableapi.IterableAction;
import com.iterable.iterableapi.IterableActionContext;
@@ -39,20 +40,25 @@
import com.iterable.iterableapi.IterableLogger;
import com.iterable.iterableapi.IterableUrlHandler;
import com.iterable.iterableapi.RNIterableInternal;
+import com.iterable.reactnative.Serialization;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import java.util.Map;
+import java.util.HashMap;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-public class RNIterableAPIModule extends ReactContextBaseJavaModule implements IterableUrlHandler, IterableCustomActionHandler, IterableInAppHandler, IterableAuthHandler, IterableInAppManager.Listener {
- private final ReactApplicationContext reactContext;
+public class RNIterableAPIModuleImpl implements IterableUrlHandler, IterableCustomActionHandler, IterableInAppHandler, IterableAuthHandler, IterableInAppManager.Listener {
+ public static final String NAME = "RNIterableAPI";
+
private static String TAG = "RNIterableAPIModule";
+ private final ReactApplicationContext reactContext;
- private InAppResponse inAppResponse = InAppResponse.SHOW;
+ private IterableInAppHandler.InAppResponse inAppResponse = IterableInAppHandler.InAppResponse.SHOW;
//A CountDownLatch. This helps decide whether to handle the in-app in Default way by waiting for JS to respond in runtime.
private CountDownLatch jsCallBackLatch;
@@ -62,22 +68,42 @@ public class RNIterableAPIModule extends ReactContextBaseJavaModule implements I
private final InboxSessionManager sessionManager = new InboxSessionManager();
- public RNIterableAPIModule(ReactApplicationContext reactContext) {
- super(reactContext);
+ public RNIterableAPIModuleImpl(ReactApplicationContext reactContext) {
this.reactContext = reactContext;
}
- // ---------------------------------------------------------------------------------------
- // region IterableSDK calls
+ public void initializeWithApiKey(String apiKey, ReadableMap configReadableMap, String version, Promise promise) {
+ IterableLogger.d(TAG, "initializeWithApiKey: " + apiKey);
+ IterableConfig.Builder configBuilder = Serialization.getConfigFromReadableMap(configReadableMap);
- @Override
- public String getName() {
- return "RNIterableAPI";
+ if (configReadableMap.hasKey("urlHandlerPresent") && configReadableMap.getBoolean("urlHandlerPresent") == true) {
+ configBuilder.setUrlHandler(this);
+ }
+
+ if (configReadableMap.hasKey("customActionHandlerPresent") && configReadableMap.getBoolean("customActionHandlerPresent") == true) {
+ configBuilder.setCustomActionHandler(this);
+ }
+
+ if (configReadableMap.hasKey("inAppHandlerPresent") && configReadableMap.getBoolean("inAppHandlerPresent") == true) {
+ configBuilder.setInAppHandler(this);
+ }
+
+ if (configReadableMap.hasKey("authHandlerPresent") && configReadableMap.getBoolean("authHandlerPresent") == true) {
+ configBuilder.setAuthHandler(this);
+ }
+
+ IterableApi.initialize(reactContext, apiKey, configBuilder.build());
+ IterableApi.getInstance().setDeviceAttribute("reactNativeSDKVersion", version);
+
+ IterableApi.getInstance().getInAppManager().addListener(this);
+
+ // MOB-10421: Figure out what the error cases are and handle them appropriately
+ // This is just here to match the TS types and let the JS thread know when we are done initializing
+ promise.resolve(true);
}
- @ReactMethod
- public void initializeWithApiKey(String apiKey, ReadableMap configReadableMap, String version, Promise promise) {
- IterableLogger.d(TAG, "initializeWithApiKey: " + apiKey);
+ public void initialize2WithApiKey(String apiKey, ReadableMap configReadableMap, String apiEndPointOverride, String version, Promise promise) {
+ IterableLogger.d(TAG, "initialize2WithApiKey: " + apiKey);
IterableConfig.Builder configBuilder = Serialization.getConfigFromReadableMap(configReadableMap);
if (configReadableMap.hasKey("urlHandlerPresent") && configReadableMap.getBoolean("urlHandlerPresent") == true) {
@@ -96,6 +122,11 @@ public void initializeWithApiKey(String apiKey, ReadableMap configReadableMap, S
configBuilder.setAuthHandler(this);
}
+ // Set the API endpoint override if provided
+ // if (apiEndPointOverride != null && !apiEndPointOverride.isEmpty()) {
+ // configBuilder.setApiEndpoint(apiEndPointOverride);
+ // }
+
IterableApi.initialize(reactContext, apiKey, configBuilder.build());
IterableApi.getInstance().setDeviceAttribute("reactNativeSDKVersion", version);
@@ -106,81 +137,69 @@ public void initializeWithApiKey(String apiKey, ReadableMap configReadableMap, S
promise.resolve(true);
}
- @ReactMethod
public void setEmail(@Nullable String email, @Nullable String authToken) {
IterableLogger.d(TAG, "setEmail: " + email + " authToken: " + authToken);
IterableApi.getInstance().setEmail(email, authToken);
}
- @ReactMethod
public void updateEmail(String email, @Nullable String authToken) {
IterableLogger.d(TAG, "updateEmail: " + email + " authToken: " + authToken);
IterableApi.getInstance().updateEmail(email, authToken);
}
- @ReactMethod
public void getEmail(Promise promise) {
promise.resolve(RNIterableInternal.getEmail());
}
- @ReactMethod
public void sampleMethod(String stringArgument, int numberArgument, Callback callback) {
// TODO: Implement some actually useful functionality
callback.invoke("Received numberArgument: " + numberArgument + " stringArgument: " + stringArgument);
}
- @ReactMethod
public void setUserId(@Nullable String userId, @Nullable String authToken) {
IterableLogger.d(TAG, "setUserId: " + userId + " authToken: " + authToken);
IterableApi.getInstance().setUserId(userId, authToken);
}
- @ReactMethod
- public void updateUser(ReadableMap dataFields, Boolean mergeNestedObjects) {
+ public void updateUser(ReadableMap dataFields, boolean mergeNestedObjects) {
IterableLogger.v(TAG, "updateUser");
IterableApi.getInstance().updateUser(optSerializedDataFields(dataFields), mergeNestedObjects);
}
- @ReactMethod
public void getUserId(Promise promise) {
promise.resolve(RNIterableInternal.getUserId());
}
- @ReactMethod
public void trackEvent(String name, ReadableMap dataFields) {
IterableLogger.v(TAG, "trackEvent");
IterableApi.getInstance().track(name, optSerializedDataFields(dataFields));
}
- @ReactMethod
public void updateCart(ReadableArray items) {
IterableLogger.v(TAG, "updateCart");
IterableApi.getInstance().updateCart(Serialization.commerceItemsFromReadableArray(items));
}
- @ReactMethod
- public void trackPurchase(Double total, ReadableArray items, ReadableMap dataFields) {
+ public void trackPurchase(double total, ReadableArray items, ReadableMap dataFields) {
IterableLogger.v(TAG, "trackPurchase");
IterableApi.getInstance().trackPurchase(total, Serialization.commerceItemsFromReadableArray(items), optSerializedDataFields(dataFields));
}
- @ReactMethod
- public void trackPushOpenWithCampaignId(Integer campaignId, Integer templateId, String messageId, Boolean appAlreadyRunning, ReadableMap dataFields) {
- RNIterableInternal.trackPushOpenWithCampaignId(campaignId, templateId, messageId, optSerializedDataFields(dataFields));
+ public void trackPushOpenWithCampaignId(double campaignId, Double templateId, String messageId, boolean appAlreadyRunning, ReadableMap dataFields) {
+ RNIterableInternal.trackPushOpenWithCampaignId((int) campaignId, templateId != null ? templateId.intValue() : null, messageId, optSerializedDataFields(dataFields));
}
- @ReactMethod
- public void updateSubscriptions(ReadableArray emailListIds, ReadableArray unsubscribedChannelIds, ReadableArray unsubscribedMessageTypeIds, ReadableArray subscribedMessageTypeIds, Integer campaignId, Integer templateId) {
+ public void updateSubscriptions(ReadableArray emailListIds, ReadableArray unsubscribedChannelIds, ReadableArray unsubscribedMessageTypeIds, ReadableArray subscribedMessageTypeIds, double campaignId, double templateId) {
IterableLogger.v(TAG, "updateSubscriptions");
Integer finalCampaignId = null, finalTemplateId = null;
if (campaignId > 0) {
- finalCampaignId = campaignId;
+ finalCampaignId = (int) campaignId;
}
if (templateId > 0) {
- finalTemplateId = templateId;
+ finalTemplateId = (int) templateId;
}
IterableApi.getInstance().updateSubscriptions(readableArrayToIntegerArray(emailListIds),
readableArrayToIntegerArray(unsubscribedChannelIds),
@@ -191,7 +210,6 @@ public void updateSubscriptions(ReadableArray emailListIds, ReadableArray unsubs
);
}
- @ReactMethod
public void showMessage(String messageId, boolean consume, final Promise promise) {
if (messageId == null || messageId == "") {
promise.reject("", "messageId is null or empty");
@@ -205,19 +223,16 @@ public void execute(@Nullable Uri url) {
});
}
- @ReactMethod
public void setReadForMessage(String messageId, boolean read) {
IterableLogger.v(TAG, "setReadForMessage");
IterableApi.getInstance().getInAppManager().setRead(RNIterableInternal.getMessageById(messageId), read);
}
- @ReactMethod
- public void removeMessage(String messageId, Integer location, Integer deleteSource) {
+ public void removeMessage(String messageId, double location, double deleteSource) {
IterableLogger.v(TAG, "removeMessage");
- IterableApi.getInstance().getInAppManager().removeMessage(RNIterableInternal.getMessageById(messageId), Serialization.getIterableDeleteActionTypeFromInteger(deleteSource), Serialization.getIterableInAppLocationFromInteger(location));
+ IterableApi.getInstance().getInAppManager().removeMessage(RNIterableInternal.getMessageById(messageId), Serialization.getIterableDeleteActionTypeFromInteger((int) deleteSource), Serialization.getIterableInAppLocationFromInteger((int) location));
}
- @ReactMethod
public void getHtmlInAppContentForMessage(String messageId, final Promise promise) {
IterableLogger.printInfo();
IterableInAppMessage message = RNIterableInternal.getMessageById(messageId);
@@ -241,7 +256,6 @@ public void getHtmlInAppContentForMessage(String messageId, final Promise promis
}
}
- @ReactMethod
public void getAttributionInfo(Promise promise) {
IterableLogger.printInfo();
IterableAttributionInfo attributionInfo = IterableApi.getInstance().getAttributionInfo();
@@ -257,7 +271,6 @@ public void getAttributionInfo(Promise promise) {
}
}
- @ReactMethod
public void setAttributionInfo(ReadableMap attributionInfoReadableMap) {
IterableLogger.printInfo();
try {
@@ -269,7 +282,6 @@ public void setAttributionInfo(ReadableMap attributionInfoReadableMap) {
}
}
- @ReactMethod
public void getLastPushPayload(Promise promise) {
Bundle payloadData = IterableApi.getInstance().getPayloadData();
if (payloadData != null) {
@@ -280,13 +292,11 @@ public void getLastPushPayload(Promise promise) {
}
}
- @ReactMethod
public void disableDeviceForCurrentUser() {
IterableLogger.v(TAG, "disableDevice");
IterableApi.getInstance().disablePush();
}
- @ReactMethod
public void handleAppLink(String uri, Promise promise) {
IterableLogger.printInfo();
promise.resolve(IterableApi.getInstance().handleAppLink(uri));
@@ -297,8 +307,7 @@ public void handleAppLink(String uri, Promise promise) {
// ---------------------------------------------------------------------------------------
// region Track APIs
- @ReactMethod
- public void trackInAppOpen(String messageId, @Nullable Integer location) {
+ public void trackInAppOpen(String messageId, double location) {
IterableInAppMessage message = RNIterableInternal.getMessageById(messageId);
if (message == null) {
@@ -306,13 +315,12 @@ public void trackInAppOpen(String messageId, @Nullable Integer location) {
return;
}
- IterableApi.getInstance().trackInAppOpen(message, Serialization.getIterableInAppLocationFromInteger(location));
+ IterableApi.getInstance().trackInAppOpen(message, Serialization.getIterableInAppLocationFromInteger((int) location));
}
- @ReactMethod
- public void trackInAppClick(String messageId, @Nullable Integer location, String clickedUrl) {
+ public void trackInAppClick(String messageId, double location, String clickedUrl) {
IterableInAppMessage message = RNIterableInternal.getMessageById(messageId);
- IterableInAppLocation inAppOpenLocation = Serialization.getIterableInAppLocationFromInteger(location);
+ IterableInAppLocation inAppOpenLocation = Serialization.getIterableInAppLocationFromInteger((int) location);
if (message == null) {
IterableLogger.d(TAG, "Failed to get in-app for message ID: " + messageId);
@@ -332,11 +340,10 @@ public void trackInAppClick(String messageId, @Nullable Integer location, String
IterableApi.getInstance().trackInAppClick(message, clickedUrl, inAppOpenLocation);
}
- @ReactMethod
- public void trackInAppClose(String messageId, Integer location, Integer source, @Nullable String clickedUrl) {
+ public void trackInAppClose(String messageId, double location, double source, @Nullable String clickedUrl) {
IterableInAppMessage inAppMessage = RNIterableInternal.getMessageById(messageId);
- IterableInAppLocation inAppCloseLocation = Serialization.getIterableInAppLocationFromInteger(location);
- IterableInAppCloseAction closeAction = Serialization.getIterableInAppCloseSourceFromInteger(source);
+ IterableInAppLocation inAppCloseLocation = Serialization.getIterableInAppLocationFromInteger((int) location);
+ IterableInAppCloseAction closeAction = Serialization.getIterableInAppCloseSourceFromInteger((int) source);
if (inAppMessage == null) {
IterableLogger.d(TAG, "Failed to get in-app for message ID: " + messageId);
@@ -362,15 +369,13 @@ public void trackInAppClose(String messageId, Integer location, Integer source,
// ---------------------------------------------------------------------------------------
// region In App APIs
- @ReactMethod
- public void inAppConsume(String messageId, Integer location, Integer source) {
- if (messageId == null) {
- return;
+ public void inAppConsume(String messageId, double location, double source) {
+ if (messageId != null) {
+ IterableLogger.v(TAG, "inAppConsume");
+ IterableApi.getInstance().inAppConsume(RNIterableInternal.getMessageById(messageId), Serialization.getIterableDeleteActionTypeFromInteger((int) source), Serialization.getIterableInAppLocationFromInteger((int) location));
}
- IterableApi.getInstance().inAppConsume(RNIterableInternal.getMessageById(messageId), Serialization.getIterableDeleteActionTypeFromInteger(source), Serialization.getIterableInAppLocationFromInteger(location));
}
- @ReactMethod
public void getInAppMessages(Promise promise) {
IterableLogger.d(TAG, "getMessages");
try {
@@ -382,7 +387,6 @@ public void getInAppMessages(Promise promise) {
}
}
- @ReactMethod
public void getInboxMessages(Promise promise) {
IterableLogger.d(TAG, "getInboxMessages");
try {
@@ -394,16 +398,25 @@ public void getInboxMessages(Promise promise) {
}
}
- @ReactMethod
- public void setInAppShowResponse(Integer number) {
+ public void getUnreadInboxMessagesCount(Promise promise) {
+ IterableLogger.d(TAG, "getUnreadInboxMessagesCount");
+ try {
+ int unreadCount = IterableApi.getInstance().getInAppManager().getUnreadInboxMessagesCount();
+ promise.resolve(unreadCount);
+ } catch (Exception e) {
+ IterableLogger.e(TAG, e.getLocalizedMessage());
+ promise.reject("", "Failed to get unread inbox messages count with error " + e.getLocalizedMessage());
+ }
+ }
+
+ public void setInAppShowResponse(double number) {
IterableLogger.printInfo();
- inAppResponse = Serialization.getInAppResponse(number);
+ inAppResponse = Serialization.getInAppResponse((int) number);
if (jsCallBackLatch != null) {
jsCallBackLatch.countDown();
}
}
- @ReactMethod
public void setAutoDisplayPaused(final boolean paused) {
IterableLogger.printInfo();
UiThreadUtil.runOnUiThread(new Runnable() {
@@ -414,7 +427,6 @@ public void run() {
});
}
- @ReactMethod
public void wakeApp() {
Intent launcherIntent = getMainActivityIntent(reactContext);
launcherIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
@@ -440,19 +452,16 @@ public Intent getMainActivityIntent(Context context) {
// ---------------------------------------------------------------------------------------
// region Inbox In-App Session Tracking APIs
- @ReactMethod
public void startSession(ReadableArray visibleRows) {
List serializedRows = Serialization.impressionsFromReadableArray(visibleRows);
sessionManager.startSession(serializedRows);
}
- @ReactMethod
public void endSession() {
sessionManager.endSession();
}
- @ReactMethod
public void updateVisibleRows(ReadableArray visibleRows) {
List serializedRows = Serialization.impressionsFromReadableArray(visibleRows);
@@ -517,7 +526,7 @@ public boolean handleIterableCustomAction(@NonNull IterableAction action, @NonNu
@NonNull
@Override
- public InAppResponse onNewInApp(@NonNull IterableInAppMessage message) {
+ public IterableInAppHandler.InAppResponse onNewInApp(@NonNull IterableInAppMessage message) {
IterableLogger.printInfo();
JSONObject messageJson = RNIterableInternal.getInAppMessageJson(message);
@@ -531,7 +540,7 @@ public InAppResponse onNewInApp(@NonNull IterableInAppMessage message) {
return inAppResponse;
} catch (InterruptedException | JSONException e) {
IterableLogger.e(TAG, "new in-app module failed");
- return InAppResponse.SHOW;
+ return IterableInAppHandler.InAppResponse.SHOW;
}
}
@@ -582,23 +591,14 @@ public void onTokenRegistrationFailed(Throwable object) {
sendEvent(EventName.handleAuthFailureCalled.name(), null);
}
- @ReactMethod
public void addListener(String eventName) {
// Keep: Required for RN built in Event Emitter Calls.
}
- @ReactMethod
- public void removeListeners(Integer count) {
+ public void removeListeners(double count) {
// Keep: Required for RN built in Event Emitter Calls.
}
- // ---------------------------------------------------------------------------------------
- // endregion
-
- // ---------------------------------------------------------------------------------------
- // region Misc Bridge Functions
-
- @ReactMethod
public void passAlongAuthToken(String authToken) {
passedAuthToken = authToken;
@@ -615,17 +615,14 @@ public void sendEvent(@NonNull String eventName, @Nullable Object eventData) {
public void onInboxUpdated() {
sendEvent(EventName.receivedIterableInboxChanged.name(), null);
}
-
- // ---------------------------------------------------------------------------------------
- // endregion
}
enum EventName {
- handleUrlCalled,
- handleCustomActionCalled,
- handleInAppCalled,
- handleAuthCalled,
- receivedIterableInboxChanged,
- handleAuthSuccessCalled,
- handleAuthFailureCalled
+ handleUrlCalled,
+ handleCustomActionCalled,
+ handleInAppCalled,
+ handleAuthCalled,
+ receivedIterableInboxChanged,
+ handleAuthSuccessCalled,
+ handleAuthFailureCalled
}
diff --git a/android/src/main/java/com/iterable/reactnative/RNIterableAPIPackage.java b/android/src/main/java/com/iterable/reactnative/RNIterableAPIPackage.java
index 2b04e447c..ba70980a0 100644
--- a/android/src/main/java/com/iterable/reactnative/RNIterableAPIPackage.java
+++ b/android/src/main/java/com/iterable/reactnative/RNIterableAPIPackage.java
@@ -3,27 +3,60 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
-import com.facebook.react.ReactPackage;
+import androidx.annotation.Nullable;
+import com.facebook.react.bridge.JavaScriptModule; // TODO: instructrions says to remove
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
+import com.facebook.react.module.model.ReactModuleInfo;
+import com.facebook.react.module.model.ReactModuleInfoProvider;
+import com.facebook.react.ReactPackage; // TODO: instructrions says to remove
+import com.facebook.react.TurboReactPackage;
import com.facebook.react.uimanager.ViewManager;
-import com.facebook.react.bridge.JavaScriptModule;
-public class RNIterableAPIPackage implements ReactPackage {
- @Override
- public List createNativeModules(
- ReactApplicationContext reactContext) {
- List modules = new ArrayList<>();
-
- modules.add(new RNIterableAPIModule(reactContext));
- return modules;
+public class RNIterableAPIPackage extends TurboReactPackage {
+ @Nullable
+ @Override
+ public NativeModule getModule(String name, ReactApplicationContext reactContext) {
+ if (name.equals(RNIterableAPIModuleImpl.NAME)) {
+ return new RNIterableAPIModule(reactContext);
+ } else {
+ return null;
+ }
}
+ // public List createNativeModules(
+ // ReactApplicationContext reactContext) {
+ // List modules = new ArrayList<>();
+
+ // modules.add(new RNIterableAPIModule(reactContext));
+ // return modules;
+ // }
@Override
- public List createViewManagers(ReactApplicationContext reactContext) {
- return Collections.emptyList();
+ public ReactModuleInfoProvider getReactModuleInfoProvider() {
+ return () -> {
+ final Map moduleInfos = new HashMap<>();
+ boolean isTurboModule = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
+ moduleInfos.put(
+ RNIterableAPIModuleImpl.NAME,
+ new ReactModuleInfo(
+ RNIterableAPIModuleImpl.NAME,
+ RNIterableAPIModuleImpl.NAME,
+ false, // canOverrideExistingModule
+ false, // needsEagerInit
+ true, // hasConstants
+ false, // isCxxModule
+ isTurboModule // isTurboModule
+ ));
+ return moduleInfos;
+ };
}
+ // @Override
+ // public List createViewManagers(ReactApplicationContext reactContext) {
+ // return Collections.emptyList();
+ // }
}
diff --git a/android/src/newarch/java/com/reactnative/RNIterableAPIModule.java b/android/src/newarch/java/com/reactnative/RNIterableAPIModule.java
new file mode 100644
index 000000000..f885b133a
--- /dev/null
+++ b/android/src/newarch/java/com/reactnative/RNIterableAPIModule.java
@@ -0,0 +1,236 @@
+package com.iterable.reactnative;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import com.facebook.react.bridge.Callback;
+import com.facebook.react.bridge.NativeModule;
+import com.facebook.react.bridge.Promise;
+import com.facebook.react.bridge.ReactApplicationContext;
+import com.facebook.react.bridge.ReactContext;
+import com.facebook.react.bridge.ReactContextBaseJavaModule;
+import com.facebook.react.bridge.ReactMethod;
+import com.facebook.react.bridge.ReadableArray;
+import com.facebook.react.bridge.ReadableMap;
+import java.util.Map;
+import java.util.HashMap;
+
+public class RNIterableAPIModule extends NativeRNIterableAPISpec {
+ private final ReactApplicationContext reactContext;
+ private static RNIterableAPIModuleImpl moduleImpl;
+
+ RNIterableAPIModule(ReactApplicationContext context) {
+ super(context);
+ this.reactContext = context;
+ if (moduleImpl == null) {
+ moduleImpl = new RNIterableAPIModuleImpl(reactContext);
+ }
+ }
+
+ @Override
+ @NonNull
+ public String getName() {
+ return RNIterableAPIModuleImpl.NAME;
+ }
+
+ @Override
+ public void initializeWithApiKey(String apiKey, ReadableMap configReadableMap, String version, Promise promise) {
+ moduleImpl.initializeWithApiKey(apiKey, configReadableMap, version, promise);
+ }
+
+ @Override
+ public void initialize2WithApiKey(String apiKey, ReadableMap configReadableMap, String apiEndPointOverride, String version, Promise promise) {
+ moduleImpl.initialize2WithApiKey(apiKey, configReadableMap, apiEndPointOverride, version, promise);
+ }
+
+ @Override
+ public void setEmail(@Nullable String email, @Nullable String authToken) {
+ moduleImpl.setEmail(email, authToken);
+ }
+
+ @Override
+ public void updateEmail(String email, @Nullable String authToken) {
+ moduleImpl.updateEmail(email, authToken);
+ }
+
+ @Override
+ public void getEmail(Promise promise) {
+ moduleImpl.getEmail(promise);
+ }
+
+ public void sampleMethod(String stringArgument, int numberArgument, Callback callback) {
+ moduleImpl.sampleMethod(stringArgument, numberArgument, callback);
+ }
+
+ @Override
+ public void setUserId(@Nullable String userId, @Nullable String authToken) {
+ moduleImpl.setUserId(userId, authToken);
+ }
+
+ @Override
+ public void updateUser(ReadableMap dataFields, boolean mergeNestedObjects) {
+ moduleImpl.updateUser(dataFields, mergeNestedObjects);
+ }
+
+ @Override
+ public void getUserId(Promise promise) {
+ moduleImpl.getUserId(promise);
+ }
+
+ @Override
+ public void trackEvent(String name, ReadableMap dataFields) {
+ moduleImpl.trackEvent(name, dataFields);
+ }
+
+ @Override
+ public void updateCart(ReadableArray items) {
+ moduleImpl.updateCart(items);
+ }
+
+ @Override
+ public void trackPurchase(double total, ReadableArray items, ReadableMap dataFields) {
+ moduleImpl.trackPurchase(total, items, dataFields);
+ }
+
+ @Override
+ public void trackPushOpenWithCampaignId(double campaignId, Double templateId, String messageId, boolean appAlreadyRunning, ReadableMap dataFields) {
+ moduleImpl.trackPushOpenWithCampaignId(campaignId, templateId, messageId, appAlreadyRunning, dataFields);
+ }
+
+ @Override
+ public void updateSubscriptions(ReadableArray emailListIds, ReadableArray unsubscribedChannelIds, ReadableArray unsubscribedMessageTypeIds, ReadableArray subscribedMessageTypeIds, double campaignId, double templateId) {
+ moduleImpl.updateSubscriptions(emailListIds, unsubscribedChannelIds, unsubscribedMessageTypeIds, subscribedMessageTypeIds, campaignId, templateId);
+ }
+
+ @Override
+ public void showMessage(String messageId, boolean consume, final Promise promise) {
+ moduleImpl.showMessage(messageId, consume, promise);
+ }
+
+ @Override
+ public void setReadForMessage(String messageId, boolean read) {
+ moduleImpl.setReadForMessage(messageId, read);
+ }
+
+ @Override
+ public void removeMessage(String messageId, double location, double deleteSource) {
+ moduleImpl.removeMessage(messageId, location, deleteSource);
+ }
+
+ @Override
+ public void getHtmlInAppContentForMessage(String messageId, final Promise promise) {
+ moduleImpl.getHtmlInAppContentForMessage(messageId, promise);
+ }
+
+ @Override
+ public void getAttributionInfo(Promise promise) {
+ moduleImpl.getAttributionInfo(promise);
+ }
+
+ @Override
+ public void setAttributionInfo(ReadableMap attributionInfoReadableMap) {
+ moduleImpl.setAttributionInfo(attributionInfoReadableMap);
+ }
+
+ @Override
+ public void getLastPushPayload(Promise promise) {
+ moduleImpl.getLastPushPayload(promise);
+ }
+
+ @Override
+ public void disableDeviceForCurrentUser() {
+ moduleImpl.disableDeviceForCurrentUser();
+ }
+
+ @Override
+ public void handleAppLink(String uri, Promise promise) {
+ moduleImpl.handleAppLink(uri, promise);
+ }
+
+ @Override
+ public void trackInAppOpen(String messageId, double location) {
+ moduleImpl.trackInAppOpen(messageId, location);
+ }
+
+ @Override
+ public void trackInAppClick(String messageId, double location, String clickedUrl) {
+ moduleImpl.trackInAppClick(messageId, location, clickedUrl);
+ }
+
+ @Override
+ public void trackInAppClose(String messageId, double location, double source, @Nullable String clickedUrl) {
+ moduleImpl.trackInAppClose(messageId, location, source, clickedUrl);
+ }
+
+ @Override
+ public void inAppConsume(String messageId, double location, double source) {
+ moduleImpl.inAppConsume(messageId, location, source);
+ }
+
+ @Override
+ public void getInAppMessages(Promise promise) {
+ moduleImpl.getInAppMessages(promise);
+ }
+
+ @Override
+ public void getInboxMessages(Promise promise) {
+ moduleImpl.getInboxMessages(promise);
+ }
+
+ @Override
+ public void getUnreadInboxMessagesCount(Promise promise) {
+ moduleImpl.getUnreadInboxMessagesCount(promise);
+ }
+
+ @Override
+ public void setInAppShowResponse(double number) {
+ moduleImpl.setInAppShowResponse(number);
+ }
+
+ @Override
+ public void setAutoDisplayPaused(final boolean paused) {
+ moduleImpl.setAutoDisplayPaused(paused);
+ }
+
+ @Override
+ public void wakeApp() {
+ moduleImpl.wakeApp();
+ }
+
+ @Override
+ public void startSession(ReadableArray visibleRows) {
+ moduleImpl.startSession(visibleRows);
+ }
+
+ @Override
+ public void endSession() {
+ moduleImpl.endSession();
+ }
+
+ @Override
+ public void updateVisibleRows(ReadableArray visibleRows) {
+ moduleImpl.updateVisibleRows(visibleRows);
+ }
+
+ @Override
+ public void addListener(String eventName) {
+ moduleImpl.addListener(eventName);
+ }
+
+ @Override
+ public void removeListeners(double count) {
+ moduleImpl.removeListeners(count);
+ }
+
+ @Override
+ public void passAlongAuthToken(String authToken) {
+ moduleImpl.passAlongAuthToken(authToken);
+ }
+
+ public void sendEvent(@NonNull String eventName, @Nullable Object eventData) {
+ moduleImpl.sendEvent(eventName, eventData);
+ }
+
+ public void onInboxUpdated() {
+ moduleImpl.onInboxUpdated();
+ }
+}
diff --git a/android/src/oldarch/java/com/reactnative/RNIterableAPIModule.java b/android/src/oldarch/java/com/reactnative/RNIterableAPIModule.java
new file mode 100644
index 000000000..589b37960
--- /dev/null
+++ b/android/src/oldarch/java/com/reactnative/RNIterableAPIModule.java
@@ -0,0 +1,237 @@
+package com.iterable.reactnative;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import com.facebook.react.bridge.Callback;
+import com.facebook.react.bridge.NativeModule;
+import com.facebook.react.bridge.Promise;
+import com.facebook.react.bridge.ReactApplicationContext;
+import com.facebook.react.bridge.ReactContext;
+import com.facebook.react.bridge.ReactContextBaseJavaModule;
+import com.facebook.react.bridge.ReactMethod;
+import com.facebook.react.bridge.ReadableArray;
+import com.facebook.react.bridge.ReadableMap;
+import java.util.Map;
+import java.util.HashMap;
+
+public class RNIterableAPIModule extends ReactContextBaseJavaModule {
+ private final ReactApplicationContext reactContext;
+ private static RNIterableAPIModuleImpl moduleImpl;
+
+ RNIterableAPIModule(ReactApplicationContext context) {
+ super(context);
+ this.reactContext = context;
+ if (moduleImpl == null) {
+ moduleImpl = new RNIterableAPIModuleImpl(reactContext);
+ }
+ }
+
+ @Override
+ public String getName() {
+ return RNIterableAPIModuleImpl.NAME;
+ }
+
+ @ReactMethod
+ public void initializeWithApiKey(String apiKey, ReadableMap configReadableMap, String version, Promise promise) {
+ moduleImpl.initializeWithApiKey(apiKey, configReadableMap, version, promise);
+ }
+
+ @ReactMethod
+ public void initialize2WithApiKey(String apiKey, ReadableMap configReadableMap, String apiEndPointOverride, String version, Promise promise) {
+ moduleImpl.initialize2WithApiKey(apiKey, configReadableMap, apiEndPointOverride, version, promise);
+ }
+
+ @ReactMethod
+ public void setEmail(@Nullable String email, @Nullable String authToken) {
+ moduleImpl.setEmail(email, authToken);
+ }
+
+ @ReactMethod
+ public void updateEmail(String email, @Nullable String authToken) {
+ moduleImpl.updateEmail(email, authToken);
+ }
+
+ @ReactMethod
+ public void getEmail(Promise promise) {
+ moduleImpl.getEmail(promise);
+ }
+
+ @ReactMethod
+ public void sampleMethod(String stringArgument, int numberArgument, Callback callback) {
+ moduleImpl.sampleMethod(stringArgument, numberArgument, callback);
+ }
+
+ @ReactMethod
+ public void setUserId(@Nullable String userId, @Nullable String authToken) {
+ moduleImpl.setUserId(userId, authToken);
+ }
+
+ @ReactMethod
+ public void updateUser(ReadableMap dataFields, boolean mergeNestedObjects) {
+ moduleImpl.updateUser(dataFields, mergeNestedObjects);
+ }
+
+ @ReactMethod
+ public void getUserId(Promise promise) {
+ moduleImpl.getUserId(promise);
+ }
+
+ @ReactMethod
+ public void trackEvent(String name, ReadableMap dataFields) {
+ moduleImpl.trackEvent(name, dataFields);
+ }
+
+ @ReactMethod
+ public void updateCart(ReadableArray items) {
+ moduleImpl.updateCart(items);
+ }
+
+ @ReactMethod
+ public void trackPurchase(double total, ReadableArray items, ReadableMap dataFields) {
+ moduleImpl.trackPurchase(total, items, dataFields);
+ }
+
+ @ReactMethod
+ public void trackPushOpenWithCampaignId(double campaignId, Double templateId, String messageId, boolean appAlreadyRunning, ReadableMap dataFields) {
+ moduleImpl.trackPushOpenWithCampaignId(campaignId, templateId, messageId, appAlreadyRunning, dataFields);
+ }
+
+ @ReactMethod
+ public void updateSubscriptions(ReadableArray emailListIds, ReadableArray unsubscribedChannelIds, ReadableArray unsubscribedMessageTypeIds, ReadableArray subscribedMessageTypeIds, double campaignId, double templateId) {
+ moduleImpl.updateSubscriptions(emailListIds, unsubscribedChannelIds, unsubscribedMessageTypeIds, subscribedMessageTypeIds, campaignId, templateId);
+ }
+
+ @ReactMethod
+ public void showMessage(String messageId, boolean consume, final Promise promise) {
+ moduleImpl.showMessage(messageId, consume, promise);
+ }
+
+ @ReactMethod
+ public void setReadForMessage(String messageId, boolean read) {
+ moduleImpl.setReadForMessage(messageId, read);
+ }
+
+ @ReactMethod
+ public void removeMessage(String messageId, double location, double deleteSource) {
+ moduleImpl.removeMessage(messageId, location, deleteSource);
+ }
+
+ @ReactMethod
+ public void getHtmlInAppContentForMessage(String messageId, final Promise promise) {
+ moduleImpl.getHtmlInAppContentForMessage(messageId, promise);
+ }
+
+ @ReactMethod
+ public void getAttributionInfo(Promise promise) {
+ moduleImpl.getAttributionInfo(promise);
+ }
+
+ @ReactMethod
+ public void setAttributionInfo(ReadableMap attributionInfoReadableMap) {
+ moduleImpl.setAttributionInfo(attributionInfoReadableMap);
+ }
+
+ @ReactMethod
+ public void getLastPushPayload(Promise promise) {
+ moduleImpl.getLastPushPayload(promise);
+ }
+
+ @ReactMethod
+ public void disableDeviceForCurrentUser() {
+ moduleImpl.disableDeviceForCurrentUser();
+ }
+
+ @ReactMethod
+ public void handleAppLink(String uri, Promise promise) {
+ moduleImpl.handleAppLink(uri, promise);
+ }
+
+ @ReactMethod
+ public void trackInAppOpen(String messageId, double location) {
+ moduleImpl.trackInAppOpen(messageId, location);
+ }
+
+ @ReactMethod
+ public void trackInAppClick(String messageId, double location, String clickedUrl) {
+ moduleImpl.trackInAppClick(messageId, location, clickedUrl);
+ }
+
+ @ReactMethod
+ public void trackInAppClose(String messageId, double location, double source, @Nullable String clickedUrl) {
+ moduleImpl.trackInAppClose(messageId, location, source, clickedUrl);
+ }
+
+ @ReactMethod
+ public void inAppConsume(String messageId, double location, double source) {
+ moduleImpl.inAppConsume(messageId, location, source);
+ }
+
+ @ReactMethod
+ public void getInAppMessages(Promise promise) {
+ moduleImpl.getInAppMessages(promise);
+ }
+
+ @ReactMethod
+ public void getInboxMessages(Promise promise) {
+ moduleImpl.getInboxMessages(promise);
+ }
+
+ @ReactMethod
+ public void getUnreadInboxMessagesCount(Promise promise) {
+ moduleImpl.getUnreadInboxMessagesCount(promise);
+ }
+
+ @ReactMethod
+ public void setInAppShowResponse(double number) {
+ moduleImpl.setInAppShowResponse(number);
+ }
+
+ @ReactMethod
+ public void setAutoDisplayPaused(final boolean paused) {
+ moduleImpl.setAutoDisplayPaused(paused);
+ }
+
+ @ReactMethod
+ public void wakeApp() {
+ moduleImpl.wakeApp();
+ }
+
+ @ReactMethod
+ public void startSession(ReadableArray visibleRows) {
+ moduleImpl.startSession(visibleRows);
+ }
+
+ @ReactMethod
+ public void endSession() {
+ moduleImpl.endSession();
+ }
+
+ @ReactMethod
+ public void updateVisibleRows(ReadableArray visibleRows) {
+ moduleImpl.updateVisibleRows(visibleRows);
+ }
+
+ @ReactMethod
+ public void addListener(String eventName) {
+ moduleImpl.addListener(eventName);
+ }
+
+ @ReactMethod
+ public void removeListeners(double count) {
+ moduleImpl.removeListeners(count);
+ }
+
+ @ReactMethod
+ public void passAlongAuthToken(String authToken) {
+ moduleImpl.passAlongAuthToken(authToken);
+ }
+
+ @ReactMethod
+ public void sendEvent(@NonNull String eventName, @Nullable Object eventData) {
+ moduleImpl.sendEvent(eventName, eventData);
+ }
+
+ public void onInboxUpdated() {
+ moduleImpl.onInboxUpdated();
+ }
+}
diff --git a/example/android/gradle.properties b/example/android/gradle.properties
index c26b81501..7ee406f12 100644
--- a/example/android/gradle.properties
+++ b/example/android/gradle.properties
@@ -40,4 +40,4 @@ hermesEnabled=true
# Needed for react-native-webview
# See: https://github.com/react-native-webview/react-native-webview/blob/HEAD/docs/Getting-Started.md
-android.enableJetifier=true
\ No newline at end of file
+android.enableJetifier=true
diff --git a/example/ios/ReactNativeSdkExample.xcodeproj/project.pbxproj b/example/ios/ReactNativeSdkExample.xcodeproj/project.pbxproj
index f51e2bd6b..8474ab9db 100644
--- a/example/ios/ReactNativeSdkExample.xcodeproj/project.pbxproj
+++ b/example/ios/ReactNativeSdkExample.xcodeproj/project.pbxproj
@@ -10,9 +10,9 @@
00E356F31AD99517003FC87E /* ReactNativeSdkExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* ReactNativeSdkExampleTests.m */; };
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
779227342DFA3FB500D69EC0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 779227332DFA3FB500D69EC0 /* AppDelegate.swift */; };
- 77F63EC390061314C0718D51 /* libPods-ReactNativeSdkExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F395BEFC7809290D1773C84F /* libPods-ReactNativeSdkExample.a */; };
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
A3A40C20801B8F02005FA4C0 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 1FC6B09E65A7BD9F6864C5D8 /* PrivacyInfo.xcprivacy */; };
+ E85CFF26852C5C478D62790C /* libPods-ReactNativeSdkExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8E28E53B082466F30466285B /* libPods-ReactNativeSdkExample.a */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -34,14 +34,14 @@
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = ReactNativeSdkExample/Info.plist; sourceTree = ""; };
13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = PrivacyInfo.xcprivacy; path = ReactNativeSdkExample/PrivacyInfo.xcprivacy; sourceTree = ""; };
1FC6B09E65A7BD9F6864C5D8 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xml; name = PrivacyInfo.xcprivacy; path = ReactNativeSdkExample/PrivacyInfo.xcprivacy; sourceTree = ""; };
- 627A5082522E8122626A42E9 /* Pods-ReactNativeSdkExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeSdkExample.debug.xcconfig"; path = "Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample.debug.xcconfig"; sourceTree = ""; };
+ 5542752DC8047EB4B5F98A9C /* Pods-ReactNativeSdkExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeSdkExample.debug.xcconfig"; path = "Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample.debug.xcconfig"; sourceTree = ""; };
779227312DFA3FB500D69EC0 /* ReactNativeSdkExample-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ReactNativeSdkExample-Bridging-Header.h"; sourceTree = ""; };
779227322DFA3FB500D69EC0 /* ReactNativeSdkExampleTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ReactNativeSdkExampleTests-Bridging-Header.h"; sourceTree = ""; };
779227332DFA3FB500D69EC0 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = ReactNativeSdkExample/AppDelegate.swift; sourceTree = ""; };
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = ReactNativeSdkExample/LaunchScreen.storyboard; sourceTree = ""; };
- C37A515B34C484F156F48110 /* Pods-ReactNativeSdkExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeSdkExample.release.xcconfig"; path = "Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample.release.xcconfig"; sourceTree = ""; };
+ 8E28E53B082466F30466285B /* libPods-ReactNativeSdkExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ReactNativeSdkExample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
+ DE6927507FDCF87239ECD3CB /* Pods-ReactNativeSdkExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeSdkExample.release.xcconfig"; path = "Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample.release.xcconfig"; sourceTree = ""; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
- F395BEFC7809290D1773C84F /* libPods-ReactNativeSdkExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ReactNativeSdkExample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -56,7 +56,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- 77F63EC390061314C0718D51 /* libPods-ReactNativeSdkExample.a in Frameworks */,
+ E85CFF26852C5C478D62790C /* libPods-ReactNativeSdkExample.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -99,7 +99,7 @@
isa = PBXGroup;
children = (
ED297162215061F000B7C4FE /* JavaScriptCore.framework */,
- F395BEFC7809290D1773C84F /* libPods-ReactNativeSdkExample.a */,
+ 8E28E53B082466F30466285B /* libPods-ReactNativeSdkExample.a */,
);
name = Frameworks;
sourceTree = "";
@@ -138,8 +138,8 @@
BBD78D7AC51CEA395F1C20DB /* Pods */ = {
isa = PBXGroup;
children = (
- 627A5082522E8122626A42E9 /* Pods-ReactNativeSdkExample.debug.xcconfig */,
- C37A515B34C484F156F48110 /* Pods-ReactNativeSdkExample.release.xcconfig */,
+ 5542752DC8047EB4B5F98A9C /* Pods-ReactNativeSdkExample.debug.xcconfig */,
+ DE6927507FDCF87239ECD3CB /* Pods-ReactNativeSdkExample.release.xcconfig */,
);
path = Pods;
sourceTree = "";
@@ -169,13 +169,13 @@
isa = PBXNativeTarget;
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "ReactNativeSdkExample" */;
buildPhases = (
- 00A09C8D745F4A4962CFCB16 /* [CP] Check Pods Manifest.lock */,
+ F2FF983A0ACE16CDB2AB76CB /* [CP] Check Pods Manifest.lock */,
13B07F871A680F5B00A75B9A /* Sources */,
13B07F8C1A680F5B00A75B9A /* Frameworks */,
13B07F8E1A680F5B00A75B9A /* Resources */,
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
- 70E3A2A47E764F7A78602595 /* [CP] Embed Pods Frameworks */,
- EDF40E5EF2B0A60C77B1B71B /* [CP] Copy Pods Resources */,
+ F22E6C94BBA74BABCFE0B3C0 /* [CP] Embed Pods Frameworks */,
+ 8D26B12F8721BB935984DBF6 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
@@ -244,45 +244,40 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
- 00A09C8D745F4A4962CFCB16 /* [CP] Check Pods Manifest.lock */ = {
+ 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
- inputFileListPaths = (
- );
inputPaths = (
- "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
- "${PODS_ROOT}/Manifest.lock",
- );
- name = "[CP] Check Pods Manifest.lock";
- outputFileListPaths = (
+ "$(SRCROOT)/.xcode.env.local",
+ "$(SRCROOT)/.xcode.env",
);
+ name = "Bundle React Native code and images";
outputPaths = (
- "$(DERIVED_FILE_DIR)/Pods-ReactNativeSdkExample-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
- showEnvVarsInLog = 0;
+ shellScript = "set -e\n\nWITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";
};
- 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = {
+ 8D26B12F8721BB935984DBF6 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
- inputPaths = (
- "$(SRCROOT)/.xcode.env.local",
- "$(SRCROOT)/.xcode.env",
+ inputFileListPaths = (
+ "${PODS_ROOT}/Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample-resources-${CONFIGURATION}-input-files.xcfilelist",
);
- name = "Bundle React Native code and images";
- outputPaths = (
+ name = "[CP] Copy Pods Resources";
+ outputFileListPaths = (
+ "${PODS_ROOT}/Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "set -e\n\nWITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";
+ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample-resources.sh\"\n";
+ showEnvVarsInLog = 0;
};
- 70E3A2A47E764F7A78602595 /* [CP] Embed Pods Frameworks */ = {
+ F22E6C94BBA74BABCFE0B3C0 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
@@ -299,21 +294,26 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
- EDF40E5EF2B0A60C77B1B71B /* [CP] Copy Pods Resources */ = {
+ F2FF983A0ACE16CDB2AB76CB /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
- "${PODS_ROOT}/Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample-resources-${CONFIGURATION}-input-files.xcfilelist",
);
- name = "[CP] Copy Pods Resources";
+ inputPaths = (
+ "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
+ "${PODS_ROOT}/Manifest.lock",
+ );
+ name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
- "${PODS_ROOT}/Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample-resources-${CONFIGURATION}-output-files.xcfilelist",
+ );
+ outputPaths = (
+ "$(DERIVED_FILE_DIR)/Pods-ReactNativeSdkExample-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample-resources.sh\"\n";
+ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
@@ -406,7 +406,7 @@
};
13B07F941A680F5B00A75B9A /* Debug */ = {
isa = XCBuildConfiguration;
- baseConfigurationReference = 627A5082522E8122626A42E9 /* Pods-ReactNativeSdkExample.debug.xcconfig */;
+ baseConfigurationReference = 5542752DC8047EB4B5F98A9C /* Pods-ReactNativeSdkExample.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
@@ -436,7 +436,7 @@
};
13B07F951A680F5B00A75B9A /* Release */ = {
isa = XCBuildConfiguration;
- baseConfigurationReference = C37A515B34C484F156F48110 /* Pods-ReactNativeSdkExample.release.xcconfig */;
+ baseConfigurationReference = DE6927507FDCF87239ECD3CB /* Pods-ReactNativeSdkExample.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
diff --git a/lefthook.yml b/lefthook.yml
index 8b4be29b7..12e18d7ab 100644
--- a/lefthook.yml
+++ b/lefthook.yml
@@ -1,14 +1,14 @@
-pre-commit:
- parallel: true
- commands:
- lint:
- glob: "*.{js,ts,jsx,tsx}"
- run: npx eslint {staged_files}
- types:
- glob: "*.{js,ts,jsx,tsx}"
- run: npx tsc
-commit-msg:
- parallel: true
- commands:
- commitlint:
- run: npx commitlint --edit
+# pre-commit:
+# parallel: true
+# commands:
+# lint:
+# glob: "*.{js,ts,jsx,tsx}"
+# run: npx eslint {staged_files}
+# types:
+# glob: "*.{js,ts,jsx,tsx}"
+# run: npx tsc
+# commit-msg:
+# parallel: true
+# commands:
+# commitlint:
+# run: npx commitlint --edit