Skip to content

Commit 5db16e7

Browse files
Refactor move method
1 parent 5aec83a commit 5db16e7

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

Iterable.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@ class IterableConfig {
2626
inAppDisplayInterval: number = 30.0
2727
urlDelegate?: (url: String, context: IterableActionContext) => Boolean
2828
customActionDelegate?: (action: IterableAction, context: IterableActionContext) => Boolean
29+
30+
toDict(): any {
31+
return {
32+
"pushIntegrationName": this.pushIntegrationName,
33+
"sandboxPushIntegrationName": this.sandboxPushIntegrationName,
34+
"pushPlatform": this.pushPlatform,
35+
"autoPushRegistration": this.autoPushRegistration,
36+
"checkForDeferredDeeplink": this.checkForDeferredDeeplink,
37+
"inAppDisplayInterval": this.inAppDisplayInterval,
38+
"urlDelegatePresent": this.urlDelegate != undefined,
39+
"customActionDelegatePresent": this.customActionDelegate != undefined,
40+
}
41+
}
2942
}
3043

3144
class IterableAction {
@@ -122,7 +135,7 @@ class Iterable {
122135
)
123136
}
124137

125-
RNIterableAPI.initializeWithApiKey(apiKey, Iterable.createConfigDict(config))
138+
RNIterableAPI.initializeWithApiKey(apiKey, config.toDict())
126139
}
127140

128141
/**
@@ -219,19 +232,6 @@ class Iterable {
219232
RNIterableAPI.trackPurchaseWithTotal(total, items, dataFields)
220233
}
221234

222-
private static createConfigDict(config: IterableConfig): any {
223-
return {
224-
"pushIntegrationName": config.pushIntegrationName,
225-
"sandboxPushIntegrationName": config.sandboxPushIntegrationName,
226-
"pushPlatform": config.pushPlatform,
227-
"autoPushRegistration": config.autoPushRegistration,
228-
"checkForDeferredDeeplink": config.checkForDeferredDeeplink,
229-
"inAppDisplayInterval": config.inAppDisplayInterval,
230-
"urlDelegatePresent": config.urlDelegate != undefined,
231-
"customActionDelegatePresent": config.customActionDelegate != undefined,
232-
}
233-
}
234-
235235
static async getInAppMessages() {
236236
console.log("getInAppMessages");
237237
try {

0 commit comments

Comments
 (0)