Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ public class IterableConfig {
*/
final IterableInAppDisplayMode inAppDisplayMode;

/**
* Callback to allow the implementor to perform logic following a call to fetch
* unknown user creation criteria
*/
final UnknownCriteriaReceivedCallback unknownCriteriaReceivedCallback;

/**
* Base URL for Webview content loading. Specifically used to enable CORS for external resources.
* If null or empty, defaults to empty string (original behavior with about:blank origin).
Expand Down Expand Up @@ -190,6 +196,7 @@ private IterableConfig(Builder builder) {
mobileFrameworkInfo = builder.mobileFrameworkInfo;
webViewBaseUrl = builder.webViewBaseUrl;
inAppDisplayMode = builder.inAppDisplayMode;
unknownCriteriaReceivedCallback = builder.unknownCriteriaReceivedCallback;
}

public static class Builder {
Expand Down Expand Up @@ -219,6 +226,7 @@ public static class Builder {
private IterableUnknownUserHandler iterableUnknownUserHandler;
private String webViewBaseUrl;
private IterableInAppDisplayMode inAppDisplayMode = IterableInAppDisplayMode.FORCE_EDGE_TO_EDGE;
private UnknownCriteriaReceivedCallback unknownCriteriaReceivedCallback;

public Builder() {}

Expand Down Expand Up @@ -461,6 +469,15 @@ public Builder setMobileFrameworkInfo(@NonNull IterableAPIMobileFrameworkInfo mo
return this;
}

/**
* Set a callback to signal completion of api calls to fetch criteria for unknown user creation.
* @param unknownCriteriaReceivedCallback Listener for unknown criteria api calls provided by the app
*/
public Builder setUnknownCriteriaResultCallback(UnknownCriteriaReceivedCallback unknownCriteriaReceivedCallback) {
this.unknownCriteriaReceivedCallback = unknownCriteriaReceivedCallback;
return this;
}

/**
* Set how in-app messages interact with the system bars (status bar, navigation bar).
* Defaults to {@link IterableInAppDisplayMode#FORCE_EDGE_TO_EDGE}, which preserves existing behavior.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.iterable.iterableapi

interface UnknownCriteriaReceivedCallback {
fun criteriaReceived()
}
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ void getUnknownCriteria() {
SharedPreferences.Editor editor = sharedPref.edit();
editor.putString(IterableConstants.SHARED_PREFS_CRITERIA, mockDataObject.toString());
editor.apply();

if (IterableApi.getInstance().config.unknownCriteriaReceivedCallback != null) {
IterableApi.getInstance().config.unknownCriteriaReceivedCallback.criteriaReceived();
}
} catch (JSONException e) {
e.printStackTrace();
}
Expand Down