-
Notifications
You must be signed in to change notification settings - Fork 38
New-arch/android-from-test #692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: new-arch/master
Are you sure you want to change the base?
Conversation
…r React Native integration
…NIterableAPIModuleImpl for improved modularity and API method handling
… new modular architecture
17 new issues
This is from Qlty Cloud, the successor to Code Climate Quality. Learn more. |
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@Override | ||
public void initializeWithApiKey(String apiKey, ReadableMap configReadableMap, String version, Promise promise) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@ReactMethod | ||
public void initializeWithApiKey(String apiKey, ReadableMap configReadableMap, String version, Promise promise) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@ReactMethod | ||
public void initialize2WithApiKey(String apiKey, ReadableMap configReadableMap, String apiEndPointOverride, String version, Promise promise) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@ReactMethod | ||
public void trackPushOpenWithCampaignId(double campaignId, Double templateId, String messageId, boolean appAlreadyRunning, ReadableMap dataFields) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@ReactMethod | ||
public void updateSubscriptions(ReadableArray emailListIds, ReadableArray unsubscribedChannelIds, ReadableArray unsubscribedMessageTypeIds, ReadableArray subscribedMessageTypeIds, double campaignId, double templateId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@ReactMethod | ||
public void trackInAppClose(String messageId, double location, double source, @Nullable String clickedUrl) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@Override | ||
public void initializeWithApiKey(String apiKey, ReadableMap configReadableMap, String version, Promise promise) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@ReactMethod | ||
public void initializeWithApiKey(String apiKey, ReadableMap configReadableMap, String version, Promise promise) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@ReactMethod | ||
public void initialize2WithApiKey(String apiKey, ReadableMap configReadableMap, String apiEndPointOverride, String version, Promise promise) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@ReactMethod | ||
public void trackPushOpenWithCampaignId(double campaignId, Double templateId, String messageId, boolean appAlreadyRunning, ReadableMap dataFields) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@ReactMethod | ||
public void updateSubscriptions(ReadableArray emailListIds, ReadableArray unsubscribedChannelIds, ReadableArray unsubscribedMessageTypeIds, ReadableArray subscribedMessageTypeIds, double campaignId, double templateId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@ReactMethod | ||
public void trackInAppClose(String messageId, double location, double source, @Nullable String clickedUrl) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…tance of RNIterableAPIModuleImpl for API method 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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@Override | ||
public void initializeWithApiKey(String apiKey, ReadableMap configReadableMap, String version, Promise promise) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@ReactMethod | ||
public void initializeWithApiKey(String apiKey, ReadableMap configReadableMap, String version, Promise promise) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@ReactMethod | ||
public void initialize2WithApiKey(String apiKey, ReadableMap configReadableMap, String apiEndPointOverride, String version, Promise promise) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@ReactMethod | ||
public void trackPushOpenWithCampaignId(double campaignId, Double templateId, String messageId, boolean appAlreadyRunning, ReadableMap dataFields) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@ReactMethod | ||
public void updateSubscriptions(ReadableArray emailListIds, ReadableArray unsubscribedChannelIds, ReadableArray unsubscribedMessageTypeIds, ReadableArray subscribedMessageTypeIds, double campaignId, double templateId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@ReactMethod | ||
public void trackInAppClose(String messageId, double location, double source, @Nullable String clickedUrl) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@Override | ||
public void initializeWithApiKey(String apiKey, ReadableMap configReadableMap, String version, Promise promise) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@ReactMethod | ||
public void initializeWithApiKey(String apiKey, ReadableMap configReadableMap, String version, Promise promise) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@ReactMethod | ||
public void initialize2WithApiKey(String apiKey, ReadableMap configReadableMap, String apiEndPointOverride, String version, Promise promise) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@ReactMethod | ||
public void trackPushOpenWithCampaignId(double campaignId, Double templateId, String messageId, boolean appAlreadyRunning, ReadableMap dataFields) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@ReactMethod | ||
public void updateSubscriptions(ReadableArray emailListIds, ReadableArray unsubscribedChannelIds, ReadableArray unsubscribedMessageTypeIds, ReadableArray subscribedMessageTypeIds, double campaignId, double templateId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
@ReactMethod | ||
public void trackInAppClose(String messageId, double location, double source, @Nullable String clickedUrl) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔹 JIRA Ticket(s) if any
✏️ Description