diff --git a/android/src/main/java/com/iterable/reactnative/RNIterableAPIModuleImpl.java b/android/src/main/java/com/iterable/reactnative/RNIterableAPIModuleImpl.java index f6c417103..981358be6 100644 --- a/android/src/main/java/com/iterable/reactnative/RNIterableAPIModuleImpl.java +++ b/android/src/main/java/com/iterable/reactnative/RNIterableAPIModuleImpl.java @@ -97,7 +97,7 @@ public void initializeWithApiKey(String apiKey, ReadableMap configReadableMap, S promise.resolve(true); } - public void initialize2WithApiKey(String apiKey, ReadableMap configReadableMap, String apiEndPointOverride, String version, Promise promise) { + public void initialize2WithApiKey(String apiKey, ReadableMap configReadableMap, String version, String apiEndPointOverride, Promise promise) { IterableLogger.d(TAG, "initialize2WithApiKey: " + apiKey); IterableConfig.Builder configBuilder = Serialization.getConfigFromReadableMap(configReadableMap); @@ -167,7 +167,7 @@ public void getUserId(Promise promise) { promise.resolve(RNIterableInternal.getUserId()); } - public void trackEvent(String name, ReadableMap dataFields) { + public void trackEvent(String name, @Nullable ReadableMap dataFields) { IterableLogger.v(TAG, "trackEvent"); IterableApi.getInstance().track(name, optSerializedDataFields(dataFields)); } @@ -177,16 +177,16 @@ public void updateCart(ReadableArray items) { IterableApi.getInstance().updateCart(Serialization.commerceItemsFromReadableArray(items)); } - public void trackPurchase(double total, ReadableArray items, ReadableMap dataFields) { + public void trackPurchase(double total, ReadableArray items, @Nullable ReadableMap dataFields) { IterableLogger.v(TAG, "trackPurchase"); IterableApi.getInstance().trackPurchase(total, Serialization.commerceItemsFromReadableArray(items), optSerializedDataFields(dataFields)); } - public void trackPushOpenWithCampaignId(double campaignId, Double templateId, String messageId, boolean appAlreadyRunning, ReadableMap dataFields) { + public void trackPushOpenWithCampaignId(double campaignId, @Nullable Double templateId, String messageId, boolean appAlreadyRunning, @Nullable ReadableMap dataFields) { RNIterableInternal.trackPushOpenWithCampaignId((int) campaignId, templateId != null ? templateId.intValue() : null, messageId, optSerializedDataFields(dataFields)); } - public void updateSubscriptions(ReadableArray emailListIds, ReadableArray unsubscribedChannelIds, ReadableArray unsubscribedMessageTypeIds, ReadableArray subscribedMessageTypeIds, double campaignId, double templateId) { + public void updateSubscriptions(@Nullable ReadableArray emailListIds, @Nullable ReadableArray unsubscribedChannelIds, @Nullable ReadableArray unsubscribedMessageTypeIds, @Nullable ReadableArray subscribedMessageTypeIds, double campaignId, double templateId) { IterableLogger.v(TAG, "updateSubscriptions"); Integer finalCampaignId = null, finalTemplateId = null; if (campaignId > 0) { @@ -265,7 +265,7 @@ public void getAttributionInfo(Promise promise) { } } - public void setAttributionInfo(ReadableMap attributionInfoReadableMap) { + public void setAttributionInfo(@Nullable ReadableMap attributionInfoReadableMap) { IterableLogger.printInfo(); try { JSONObject attributionInfoJson = Serialization.convertMapToJson(attributionInfoReadableMap); @@ -593,7 +593,7 @@ public void removeListeners(double count) { // Keep: Required for RN built in Event Emitter Calls. } - public void passAlongAuthToken(String authToken) { + public void passAlongAuthToken(@Nullable String authToken) { passedAuthToken = authToken; if (authHandlerCallbackLatch != null) { diff --git a/android/src/newarch/java/com/RNIterableAPIModule.java b/android/src/newarch/java/com/RNIterableAPIModule.java index 2a6d22302..4386e0d7f 100644 --- a/android/src/newarch/java/com/RNIterableAPIModule.java +++ b/android/src/newarch/java/com/RNIterableAPIModule.java @@ -32,8 +32,8 @@ public void initializeWithApiKey(String apiKey, ReadableMap configReadableMap, S } @Override - public void initialize2WithApiKey(String apiKey, ReadableMap configReadableMap, String apiEndPointOverride, String version, Promise promise) { - moduleImpl.initialize2WithApiKey(apiKey, configReadableMap, apiEndPointOverride, version, promise); + public void initialize2WithApiKey(String apiKey, ReadableMap configReadableMap, String version, String apiEndPointOverride, Promise promise) { + moduleImpl.initialize2WithApiKey(apiKey, configReadableMap, version, apiEndPointOverride, promise); } @Override @@ -71,7 +71,7 @@ public void getUserId(Promise promise) { } @Override - public void trackEvent(String name, ReadableMap dataFields) { + public void trackEvent(String name, @Nullable ReadableMap dataFields) { moduleImpl.trackEvent(name, dataFields); } @@ -81,17 +81,17 @@ public void updateCart(ReadableArray items) { } @Override - public void trackPurchase(double total, ReadableArray items, ReadableMap dataFields) { + public void trackPurchase(double total, ReadableArray items, @Nullable ReadableMap dataFields) { moduleImpl.trackPurchase(total, items, dataFields); } @Override - public void trackPushOpenWithCampaignId(double campaignId, Double templateId, String messageId, boolean appAlreadyRunning, ReadableMap dataFields) { + public void trackPushOpenWithCampaignId(double campaignId, @Nullable Double templateId, String messageId, boolean appAlreadyRunning, @Nullable 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) { + public void updateSubscriptions(@Nullable ReadableArray emailListIds, @Nullable ReadableArray unsubscribedChannelIds, @Nullable ReadableArray unsubscribedMessageTypeIds, @Nullable ReadableArray subscribedMessageTypeIds, double campaignId, double templateId) { moduleImpl.updateSubscriptions(emailListIds, unsubscribedChannelIds, unsubscribedMessageTypeIds, subscribedMessageTypeIds, campaignId, templateId); } @@ -121,7 +121,7 @@ public void getAttributionInfo(Promise promise) { } @Override - public void setAttributionInfo(ReadableMap attributionInfoReadableMap) { + public void setAttributionInfo(@Nullable ReadableMap attributionInfoReadableMap) { moduleImpl.setAttributionInfo(attributionInfoReadableMap); } @@ -185,7 +185,6 @@ public void setAutoDisplayPaused(final boolean paused) { moduleImpl.setAutoDisplayPaused(paused); } - @Override public void wakeApp() { moduleImpl.wakeApp(); } @@ -200,7 +199,6 @@ public void endSession() { moduleImpl.endSession(); } - @Override public void updateVisibleRows(ReadableArray visibleRows) { moduleImpl.updateVisibleRows(visibleRows); } @@ -215,8 +213,7 @@ public void removeListeners(double count) { moduleImpl.removeListeners(count); } - @Override - public void passAlongAuthToken(String authToken) { + public void passAlongAuthToken(@Nullable String authToken) { moduleImpl.passAlongAuthToken(authToken); } diff --git a/android/src/oldarch/java/com/RNIterableAPIModule.java b/android/src/oldarch/java/com/RNIterableAPIModule.java index 68b6ae79b..27b04ea17 100644 --- a/android/src/oldarch/java/com/RNIterableAPIModule.java +++ b/android/src/oldarch/java/com/RNIterableAPIModule.java @@ -34,8 +34,8 @@ public void initializeWithApiKey(String apiKey, ReadableMap configReadableMap, S } @ReactMethod - public void initialize2WithApiKey(String apiKey, ReadableMap configReadableMap, String apiEndPointOverride, String version, Promise promise) { - moduleImpl.initialize2WithApiKey(apiKey, configReadableMap, apiEndPointOverride, version, promise); + public void initialize2WithApiKey(String apiKey, ReadableMap configReadableMap, String version, String apiEndPointOverride, Promise promise) { + moduleImpl.initialize2WithApiKey(apiKey, configReadableMap, version, apiEndPointOverride, promise); } @ReactMethod @@ -74,7 +74,7 @@ public void getUserId(Promise promise) { } @ReactMethod - public void trackEvent(String name, ReadableMap dataFields) { + public void trackEvent(String name, @Nullable ReadableMap dataFields) { moduleImpl.trackEvent(name, dataFields); } @@ -84,17 +84,17 @@ public void updateCart(ReadableArray items) { } @ReactMethod - public void trackPurchase(double total, ReadableArray items, ReadableMap dataFields) { + public void trackPurchase(double total, ReadableArray items, @Nullable ReadableMap dataFields) { moduleImpl.trackPurchase(total, items, dataFields); } @ReactMethod - public void trackPushOpenWithCampaignId(double campaignId, Double templateId, String messageId, boolean appAlreadyRunning, ReadableMap dataFields) { + public void trackPushOpenWithCampaignId(double campaignId, @Nullable Double templateId, String messageId, boolean appAlreadyRunning, @Nullable 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) { + public void updateSubscriptions(@Nullable ReadableArray emailListIds, @Nullable ReadableArray unsubscribedChannelIds, @Nullable ReadableArray unsubscribedMessageTypeIds, @Nullable ReadableArray subscribedMessageTypeIds, double campaignId, double templateId) { moduleImpl.updateSubscriptions(emailListIds, unsubscribedChannelIds, unsubscribedMessageTypeIds, subscribedMessageTypeIds, campaignId, templateId); } @@ -124,7 +124,7 @@ public void getAttributionInfo(Promise promise) { } @ReactMethod - public void setAttributionInfo(ReadableMap attributionInfoReadableMap) { + public void setAttributionInfo(@Nullable ReadableMap attributionInfoReadableMap) { moduleImpl.setAttributionInfo(attributionInfoReadableMap); } @@ -219,7 +219,7 @@ public void removeListeners(double count) { } @ReactMethod - public void passAlongAuthToken(String authToken) { + public void passAlongAuthToken(@Nullable String authToken) { moduleImpl.passAlongAuthToken(authToken); } diff --git a/ios/RNIterableAPI/RNIterableAPI.mm b/ios/RNIterableAPI/RNIterableAPI.mm index a33a32d1d..a7490f2ee 100644 --- a/ios/RNIterableAPI/RNIterableAPI.mm +++ b/ios/RNIterableAPI/RNIterableAPI.mm @@ -80,8 +80,8 @@ - (void)initialize2WithApiKey:(NSString *)apiKey reject:(RCTPromiseRejectBlock)reject { [_swiftAPI initialize2WithApiKey:apiKey config:config - apiEndPointOverride:apiEndPointOverride version:version + apiEndPointOverride:apiEndPointOverride resolver:resolve rejecter:reject]; } @@ -106,7 +106,7 @@ - (void)getUserId:(RCTPromiseResolveBlock)resolve [_swiftAPI getUserId:resolve rejecter:reject]; } -- (void)setInAppShowResponse:(NSNumber *)inAppShowResponse { +- (void)setInAppShowResponse:(double)inAppShowResponse { [_swiftAPI setInAppShowResponse:inAppShowResponse]; } @@ -137,8 +137,8 @@ - (void)showMessage:(NSString *)messageId } - (void)removeMessage:(NSString *)messageId - location:(NSNumber *)location - source:(NSNumber *)source { + location:(double)location + source:(double)source { [_swiftAPI removeMessage:messageId location:location source:source]; } @@ -154,7 +154,7 @@ - (void)trackEvent:(NSString *)name dataFields:(NSDictionary *)dataFields { [_swiftAPI trackEvent:name dataFields:dataFields]; } -- (void)trackPushOpenWithCampaignId:(NSNumber *)campaignId +- (void)trackPushOpenWithCampaignId:(double)campaignId templateId:(NSNumber *)templateId messageId:(NSString *)messageId appAlreadyRunning:(BOOL)appAlreadyRunning @@ -166,20 +166,20 @@ - (void)trackPushOpenWithCampaignId:(NSNumber *)campaignId dataFields:dataFields]; } -- (void)trackInAppOpen:(NSString *)messageId location:(NSNumber *)location { +- (void)trackInAppOpen:(NSString *)messageId location:(double)location { [_swiftAPI trackInAppOpen:messageId location:location]; } - (void)trackInAppClick:(NSString *)messageId - location:(NSNumber *)location + location:(double)location clickedUrl:(NSString *)clickedUrl { [_swiftAPI trackInAppClick:messageId location:location clickedUrl:clickedUrl]; } - (void)trackInAppClose:(NSString *)messageId - location:(NSNumber *)location - source:(NSNumber *)source - clickedUrl:(NSString *)clickedUrl { + location:(double)location + source:(double)source + clickedUrl:(NSString *_Nullable)clickedUrl { [_swiftAPI trackInAppClose:messageId location:location source:source @@ -187,8 +187,8 @@ - (void)trackInAppClose:(NSString *)messageId } - (void)inAppConsume:(NSString *)messageId - location:(NSNumber *)location - source:(NSNumber *)source { + location:(double)location + source:(double)source { [_swiftAPI inAppConsume:messageId location:location source:source]; } @@ -196,7 +196,7 @@ - (void)updateCart:(NSArray *)items { [_swiftAPI updateCart:items]; } -- (void)trackPurchase:(NSNumber *)total +- (void)trackPurchase:(double)total items:(NSArray *)items dataFields:(NSDictionary *)dataFields { [_swiftAPI trackPurchase:total items:items dataFields:dataFields]; @@ -216,7 +216,7 @@ - (void)getAttributionInfo:(RCTPromiseResolveBlock)resolve [_swiftAPI getAttributionInfo:resolve rejecter:reject]; } -- (void)setAttributionInfo:(NSDictionary *)attributionInfo { +- (void)setAttributionInfo:(NSDictionary *_Nullable)attributionInfo { [_swiftAPI setAttributionInfo:attributionInfo]; } @@ -243,12 +243,12 @@ - (void)handleAppLink:(NSString *)appLink [_swiftAPI handleAppLink:appLink resolver:resolve rejecter:reject]; } -- (void)updateSubscriptions:(NSArray *)emailListIds - unsubscribedChannelIds:(NSArray *)unsubscribedChannelIds - unsubscribedMessageTypeIds:(NSArray *)unsubscribedMessageTypeIds - subscribedMessageTypeIds:(NSArray *)subscribedMessageTypeIds - campaignId:(NSNumber *)campaignId - templateId:(NSNumber *)templateId { +- (void)updateSubscriptions:(NSArray *_Nullable)emailListIds + unsubscribedChannelIds:(NSArray *_Nullable)unsubscribedChannelIds + unsubscribedMessageTypeIds:(NSArray *_Nullable)unsubscribedMessageTypeIds + subscribedMessageTypeIds:(NSArray *_Nullable)subscribedMessageTypeIds + campaignId:(double)campaignId + templateId:(double)templateId { [_swiftAPI updateSubscriptions:emailListIds unsubscribedChannelIds:unsubscribedChannelIds unsubscribedMessageTypeIds:unsubscribedMessageTypeIds @@ -269,10 +269,14 @@ - (void)updateVisibleRows:(NSArray *)visibleRows { [_swiftAPI updateVisibleRows:visibleRows]; } -- (void)passAlongAuthToken:(NSString *)authToken { +- (void)passAlongAuthToken:(NSString *_Nullable)authToken { [_swiftAPI passAlongAuthToken:authToken]; } +- (void)wakeApp { + // Placeholder function -- this method is only used in Android +} + // MARK: - TurboModule integration - (std::shared_ptr)getTurboModule: (const facebook::react::ObjCTurboModule::InitParams &)params { @@ -309,8 +313,8 @@ - (void)passAlongAuthToken:(NSString *)authToken { resolve reject : (RCTPromiseRejectBlock)reject) { [_swiftAPI initialize2WithApiKey:apiKey config:config - apiEndPointOverride:apiEndPointOverride version:version + apiEndPointOverride:apiEndPointOverride resolver:resolve rejecter:reject]; } @@ -335,7 +339,7 @@ - (void)passAlongAuthToken:(NSString *)authToken { [_swiftAPI getUserId:resolve rejecter:reject]; } -RCT_EXPORT_METHOD(setInAppShowResponse : (NSNumber *)inAppShowResponse) { +RCT_EXPORT_METHOD(setInAppShowResponse : (double)inAppShowResponse) { [_swiftAPI setInAppShowResponse:inAppShowResponse]; } @@ -363,8 +367,8 @@ - (void)passAlongAuthToken:(NSString *)authToken { rejecter:reject]; } -RCT_EXPORT_METHOD(removeMessage : (NSString *)messageId location : (NSNumber *) - location source : (NSNumber *)source) { +RCT_EXPORT_METHOD(removeMessage : (NSString *)messageId location : (double) + location source : (double)source) { [_swiftAPI removeMessage:messageId location:location source:source]; } @@ -382,10 +386,9 @@ - (void)passAlongAuthToken:(NSString *)authToken { } RCT_EXPORT_METHOD( - trackPushOpenWithCampaignId : (NSNumber *) - campaignId templateId : (NSNumber *)templateId messageId : (NSString *) - messageId appAlreadyRunning : (BOOL) - appAlreadyRunning dataFields : (NSDictionary *)dataFields) { + trackPushOpenWithCampaignId : (double)campaignId templateId : (NSNumber *) + templateId messageId : (NSString *)messageId appAlreadyRunning : (BOOL) + appAlreadyRunning dataFields : (NSDictionary *)dataFields) { [_swiftAPI trackPushOpenWithCampaignId:campaignId templateId:templateId messageId:messageId @@ -393,27 +396,27 @@ - (void)passAlongAuthToken:(NSString *)authToken { dataFields:dataFields]; } -RCT_EXPORT_METHOD(trackInAppOpen : (NSString *)messageId location : (NSNumber *) +RCT_EXPORT_METHOD(trackInAppOpen : (NSString *)messageId location : (double) location) { [_swiftAPI trackInAppOpen:messageId location:location]; } -RCT_EXPORT_METHOD(trackInAppClick : (NSString *)messageId location : ( - NSNumber *)location clickedUrl : (NSString *)clickedUrl) { +RCT_EXPORT_METHOD(trackInAppClick : (NSString *)messageId location : (double) + location clickedUrl : (NSString *)clickedUrl) { [_swiftAPI trackInAppClick:messageId location:location clickedUrl:clickedUrl]; } -RCT_EXPORT_METHOD(trackInAppClose : (NSString *)messageId location : ( - NSNumber *)location source : (NSNumber *)source clickedUrl : (NSString *) - clickedUrl) { +RCT_EXPORT_METHOD(trackInAppClose : (NSString *)messageId location : (double) + location source : (double)source clickedUrl : (NSString *) + clickedUrl) { [_swiftAPI trackInAppClose:messageId location:location source:source clickedUrl:clickedUrl]; } -RCT_EXPORT_METHOD(inAppConsume : (NSString *)messageId location : (NSNumber *) - location source : (NSNumber *)source) { +RCT_EXPORT_METHOD(inAppConsume : (NSString *)messageId location : (double) + location source : (double)source) { [_swiftAPI inAppConsume:messageId location:location source:source]; } @@ -421,7 +424,7 @@ - (void)passAlongAuthToken:(NSString *)authToken { [_swiftAPI updateCart:items]; } -RCT_EXPORT_METHOD(trackPurchase : (NSNumber *)total items : (NSArray *) +RCT_EXPORT_METHOD(trackPurchase : (double)total items : (NSArray *) items dataFields : (NSDictionary *)dataFields) { [_swiftAPI trackPurchase:total items:items dataFields:dataFields]; } @@ -430,6 +433,7 @@ - (void)passAlongAuthToken:(NSString *)authToken { BOOL)mergeNestedObjects) { [_swiftAPI updateUser:dataFields mergeNestedObjects:mergeNestedObjects]; } + RCT_EXPORT_METHOD(updateEmail : (NSString *)email authToken : (NSString *) authToken) { [_swiftAPI updateEmail:email authToken:authToken]; @@ -471,8 +475,8 @@ - (void)passAlongAuthToken:(NSString *)authToken { NSArray *) unsubscribedChannelIds unsubscribedMessageTypeIds : (NSArray *) unsubscribedMessageTypeIds subscribedMessageTypeIds : (NSArray *) - subscribedMessageTypeIds campaignId : (NSNumber *) - campaignId templateId : (NSNumber *)templateId) { + subscribedMessageTypeIds campaignId : (double) + campaignId templateId : (double)templateId) { [_swiftAPI updateSubscriptions:emailListIds unsubscribedChannelIds:unsubscribedChannelIds unsubscribedMessageTypeIds:unsubscribedMessageTypeIds @@ -491,10 +495,14 @@ - (void)passAlongAuthToken:(NSString *)authToken { [_swiftAPI updateVisibleRows:visibleRows]; } -RCT_EXPORT_METHOD(passAlongAuthToken : (NSString *)authToken) { +RCT_EXPORT_METHOD(passAlongAuthToken : (NSString *_Nullable)authToken) { [_swiftAPI passAlongAuthToken:authToken]; } +RCT_EXPORT_METHOD(wakeApp) { + // Placeholder function -- this method is only used in Android +} + #endif @end diff --git a/ios/RNIterableAPI/ReactIterableAPI.swift b/ios/RNIterableAPI/ReactIterableAPI.swift index 38566f7f7..163e34199 100644 --- a/ios/RNIterableAPI/ReactIterableAPI.swift +++ b/ios/RNIterableAPI/ReactIterableAPI.swift @@ -71,7 +71,7 @@ import React rejecter: rejecter) } - @objc(initialize2WithApiKey:config:apiEndPointOverride:version:resolver:rejecter:) + @objc(initialize2WithApiKey:config:version:apiEndPointOverride:resolver:rejecter:) public func initialize2WithApiKey( apiKey: String, config configDict: NSDictionary, @@ -130,9 +130,9 @@ import React // MARK: - Iterable API Request Functions @objc(setInAppShowResponse:) - public func setInAppShowResponse(inAppShowResponse number: NSNumber) { + public func setInAppShowResponse(inAppShowResponse number: Double) { ITBInfo() - self.inAppShowResponse = InAppShowResponse.from(number: number) + self.inAppShowResponse = InAppShowResponse.from(number: number as NSNumber) inAppHandlerSemaphore.signal() } @@ -169,7 +169,7 @@ import React @objc(trackPushOpenWithCampaignId:templateId:messageId:appAlreadyRunning:dataFields:) public func trackPushOpenWithCampaignId( - campaignId: NSNumber, + campaignId: Double, templateId: NSNumber?, messageId: String, appAlreadyRunning: Bool, @@ -179,7 +179,7 @@ import React let swiftDict = dataFields as? [AnyHashable: Any] IterableAPI.track( - pushOpen: campaignId, + pushOpen: campaignId as NSNumber, templateId: templateId, messageId: messageId, appAlreadyRunning: appAlreadyRunning, @@ -194,13 +194,13 @@ import React @objc(trackPurchase:items:dataFields:) public func trackPurchase( - total: NSNumber, + total: Double, items: [[AnyHashable: Any]], dataFields: [AnyHashable: Any]? ) { ITBInfo() IterableAPI.track( - purchase: total, + purchase: total as NSNumber, items: items.compactMap(CommerceItem.from(dict:)), dataFields: dataFields) } @@ -208,20 +208,20 @@ import React @objc(trackInAppOpen:location:) public func trackInAppOpen( messageId: String, - location locationNumber: NSNumber + location locationNumber: Double ) { ITBInfo() guard let message = IterableAPI.inAppManager.getMessage(withId: messageId) else { ITBError("Could not find message with id: \(messageId)") return } - IterableAPI.track(inAppOpen: message, location: InAppLocation.from(number: locationNumber)) + IterableAPI.track(inAppOpen: message, location: InAppLocation.from(number: locationNumber as NSNumber)) } @objc(trackInAppClick:location:clickedUrl:) public func trackInAppClick( messageId: String, - location locationNumber: NSNumber, + location locationNumber: Double, clickedUrl: String ) { ITBInfo() @@ -230,15 +230,15 @@ import React return } IterableAPI.track( - inAppClick: message, location: InAppLocation.from(number: locationNumber), + inAppClick: message, location: InAppLocation.from(number: locationNumber as NSNumber), clickedUrl: clickedUrl) } @objc(trackInAppClose:location:source:clickedUrl:) public func trackInAppClose( messageId: String, - location locationNumber: NSNumber, - source sourceNumber: NSNumber, + location locationNumber: Double, + source sourceNumber: Double, clickedUrl: String? ) { ITBInfo() @@ -246,16 +246,16 @@ import React ITBError("Could not find message with id: \(messageId)") return } - if let inAppCloseSource = InAppCloseSource.from(number: sourceNumber) { + if let inAppCloseSource = InAppCloseSource.from(number: sourceNumber as NSNumber) { IterableAPI.track( inAppClose: message, - location: InAppLocation.from(number: locationNumber), + location: InAppLocation.from(number: locationNumber as NSNumber), source: inAppCloseSource, clickedUrl: clickedUrl) } else { IterableAPI.track( inAppClose: message, - location: InAppLocation.from(number: locationNumber), + location: InAppLocation.from(number: locationNumber as NSNumber), clickedUrl: clickedUrl) } } @@ -263,23 +263,23 @@ import React @objc(inAppConsume:location:source:) public func inAppConsume( messageId: String, - location locationNumber: NSNumber, - source sourceNumber: NSNumber + location locationNumber: Double, + source sourceNumber: Double ) { ITBInfo() guard let message = IterableAPI.inAppManager.getMessage(withId: messageId) else { ITBError("Could not find message with id: \(messageId)") return } - if let inAppDeleteSource = InAppDeleteSource.from(number: sourceNumber) { + if let inAppDeleteSource = InAppDeleteSource.from(number: sourceNumber as NSNumber) { IterableAPI.inAppConsume( message: message, - location: InAppLocation.from(number: locationNumber), + location: InAppLocation.from(number: locationNumber as NSNumber), source: inAppDeleteSource) } else { IterableAPI.inAppConsume( message: message, - location: InAppLocation.from(number: locationNumber)) + location: InAppLocation.from(number: locationNumber as NSNumber)) } } @@ -382,22 +382,22 @@ import React @objc(removeMessage:location:source:) public func removeMessage( - messageId: String, location locationNumber: NSNumber, source sourceNumber: NSNumber + messageId: String, location locationNumber: Double, source sourceNumber: Double ) { ITBInfo() guard let message = IterableAPI.inAppManager.getMessage(withId: messageId) else { ITBError("Could not find message with id: \(messageId)") return } - if let inAppDeleteSource = InAppDeleteSource.from(number: sourceNumber) { + if let inAppDeleteSource = InAppDeleteSource.from(number: sourceNumber as NSNumber) { IterableAPI.inAppManager.remove( message: message, - location: InAppLocation.from(number: locationNumber), + location: InAppLocation.from(number: locationNumber as NSNumber), source: inAppDeleteSource) } else { IterableAPI.inAppManager.remove( message: message, - location: InAppLocation.from(number: locationNumber)) + location: InAppLocation.from(number: locationNumber as NSNumber)) } } @@ -410,12 +410,12 @@ import React unsubscribedChannelIds: [NSNumber]?, unsubscribedMessageTypeIds: [NSNumber]?, subscribedMessageTypeIds: [NSNumber]?, - campaignId: NSNumber, - templateId: NSNumber + campaignId: Double, + templateId: Double ) { ITBInfo() - let finalCampaignId: NSNumber? = campaignId.intValue <= 0 ? nil : campaignId - let finalTemplateId: NSNumber? = templateId.intValue <= 0 ? nil : templateId + let finalCampaignId: NSNumber? = (campaignId as NSNumber).intValue <= 0 ? nil : campaignId as NSNumber + let finalTemplateId: NSNumber? = (templateId as NSNumber).intValue <= 0 ? nil : templateId as NSNumber IterableAPI.updateSubscriptions( emailListIds, unsubscribedChannelIds: unsubscribedChannelIds, diff --git a/src/api/NativeRNIterableAPI.ts b/src/api/NativeRNIterableAPI.ts index 0ffc66799..de903cece 100644 --- a/src/api/NativeRNIterableAPI.ts +++ b/src/api/NativeRNIterableAPI.ts @@ -12,8 +12,8 @@ export interface Spec extends TurboModule { initialize2WithApiKey( apiKey: string, config: { [key: string]: string | number | boolean | undefined | string[] }, - apiEndPointOverride: string, - version: string + version: string, + apiEndPointOverride: string ): Promise; // User management @@ -54,7 +54,7 @@ export interface Spec extends TurboModule { messageId: string, location: number, source: number, - clickedUrl?: string + clickedUrl?: string | null ): void; inAppConsume(messageId: string, location: number, source: number): void;