@@ -288,12 +288,12 @@ import UIKit
288
288
///
289
289
/// - SeeAlso: IterableConfig
290
290
public static func disableDeviceForCurrentUser( ) {
291
- implementation ? . disableDeviceForCurrentUser ( )
291
+ disableDeviceForCurrentUser ( withOnSuccess : nil , onFailure : nil )
292
292
}
293
293
294
294
/// Disable this device's token in Iterable, for all users on this device.
295
295
public static func disableDeviceForAllUsers( ) {
296
- implementation ? . disableDeviceForAllUsers ( )
296
+ disableDeviceForAllUsers ( withOnSuccess : nil , onFailure : nil )
297
297
}
298
298
299
299
/// Disable this device's token in Iterable, for the current user, with custom completion blocks
@@ -304,7 +304,9 @@ import UIKit
304
304
///
305
305
/// - SeeAlso: OnSuccessHandler, OnFailureHandler
306
306
public static func disableDeviceForCurrentUser( withOnSuccess onSuccess: OnSuccessHandler ? , onFailure: OnFailureHandler ? ) {
307
- implementation? . disableDeviceForCurrentUser ( withOnSuccess: onSuccess, onFailure: onFailure)
307
+ guard let implementation, implementation. isSDKInitialized ( ) else { return }
308
+
309
+ implementation. disableDeviceForCurrentUser ( withOnSuccess: onSuccess, onFailure: onFailure)
308
310
}
309
311
310
312
/// Disable this device's token in Iterable, for all users of this device, with custom completion blocks.
@@ -315,7 +317,9 @@ import UIKit
315
317
///
316
318
/// - SeeAlso: OnSuccessHandler, OnFailureHandler
317
319
public static func disableDeviceForAllUsers( withOnSuccess onSuccess: OnSuccessHandler ? , onFailure: OnFailureHandler ? ) {
318
- implementation? . disableDeviceForAllUsers ( withOnSuccess: onSuccess, onFailure: onFailure)
320
+ guard let implementation, implementation. isSDKInitialized ( ) else { return }
321
+
322
+ implementation. disableDeviceForAllUsers ( withOnSuccess: onSuccess, onFailure: onFailure)
319
323
}
320
324
321
325
/// Updates the available user fields
@@ -332,9 +336,8 @@ import UIKit
332
336
mergeNestedObjects: Bool ,
333
337
onSuccess: OnSuccessHandler ? = nil ,
334
338
onFailure: OnFailureHandler ? = nil ) {
335
- guard let implementation, implementation. isSDKInitialized ( ) else { return }
336
339
337
- implementation. updateUser ( dataFields,
340
+ implementation? . updateUser ( dataFields,
338
341
mergeNestedObjects: mergeNestedObjects,
339
342
onSuccess: onSuccess,
340
343
onFailure: onFailure)
@@ -413,9 +416,8 @@ import UIKit
413
416
public static func updateCart( items: [ CommerceItem ] ,
414
417
onSuccess: OnSuccessHandler ? ,
415
418
onFailure: OnFailureHandler ? ) {
416
- guard let implementation, implementation. isSDKInitialized ( ) else { return }
417
419
418
- implementation. updateCart ( items: items, onSuccess: onSuccess, onFailure: onFailure)
420
+ implementation? . updateCart ( items: items, onSuccess: onSuccess, onFailure: onFailure)
419
421
}
420
422
421
423
/// Tracks a purchase
@@ -506,10 +508,8 @@ import UIKit
506
508
templateId: NSNumber ? ,
507
509
onSuccess: OnSuccessHandler ? ,
508
510
onFailure: OnFailureHandler ? ) {
509
-
510
- guard let implementation, implementation. isSDKInitialized ( ) else { return }
511
-
512
- implementation. trackPurchase ( withTotal,
511
+
512
+ implementation? . trackPurchase ( withTotal,
513
513
items: items,
514
514
dataFields: dataFields,
515
515
campaignId: campaignId,
@@ -525,7 +525,12 @@ import UIKit
525
525
/// - userInfo: the `userInfo` parameter from the push notification payload
526
526
@objc ( trackPushOpen: )
527
527
public static func track( pushOpen userInfo: [ AnyHashable : Any ] ) {
528
- implementation? . trackPushOpen ( userInfo)
528
+ track (
529
+ pushOpen: userInfo,
530
+ dataFields: nil ,
531
+ onSuccess: nil ,
532
+ onFailure: nil
533
+ )
529
534
}
530
535
531
536
/// Tracks a `pushOpen` event with a push notification and optional additional data
@@ -535,7 +540,12 @@ import UIKit
535
540
/// - dataFields: A `Dictionary` containing any additional information to save along with the event
536
541
@objc ( trackPushOpen: dataFields: )
537
542
public static func track( pushOpen userInfo: [ AnyHashable : Any ] , dataFields: [ AnyHashable : Any ] ? ) {
538
- implementation? . trackPushOpen ( userInfo, dataFields: dataFields)
543
+ track (
544
+ pushOpen: userInfo,
545
+ dataFields: dataFields,
546
+ onSuccess: nil ,
547
+ onFailure: nil
548
+ )
539
549
}
540
550
541
551
/// Tracks a `pushOpen` event with a push notification, optional additional data, and custom completion blocks
@@ -552,7 +562,9 @@ import UIKit
552
562
dataFields: [ AnyHashable : Any ] ? ,
553
563
onSuccess: OnSuccessHandler ? ,
554
564
onFailure: OnFailureHandler ? ) {
555
- implementation? . trackPushOpen ( userInfo,
565
+ guard let implementation, implementation. isSDKInitialized ( ) else { return }
566
+
567
+ implementation. trackPushOpen ( userInfo,
556
568
dataFields: dataFields,
557
569
onSuccess: onSuccess,
558
570
onFailure: onFailure)
@@ -576,11 +588,15 @@ import UIKit
576
588
messageId: String ,
577
589
appAlreadyRunning: Bool ,
578
590
dataFields: [ AnyHashable : Any ] ? ) {
579
- implementation? . trackPushOpen ( campaignId,
580
- templateId: templateId,
581
- messageId: messageId,
582
- appAlreadyRunning: appAlreadyRunning,
583
- dataFields: dataFields)
591
+ track (
592
+ pushOpen: campaignId,
593
+ templateId: templateId,
594
+ messageId: messageId,
595
+ appAlreadyRunning: appAlreadyRunning,
596
+ dataFields: dataFields,
597
+ onSuccess: nil ,
598
+ onFailure: nil
599
+ )
584
600
}
585
601
586
602
/// Tracks a `pushOpen` event for the specified campaign and template IDs, whether the app was already
@@ -605,7 +621,9 @@ import UIKit
605
621
dataFields: [ AnyHashable : Any ] ? ,
606
622
onSuccess: OnSuccessHandler ? ,
607
623
onFailure: OnFailureHandler ? ) {
608
- implementation? . trackPushOpen ( campaignId,
624
+ guard let implementation, implementation. isSDKInitialized ( ) else { return }
625
+
626
+ implementation. trackPushOpen ( campaignId,
609
627
templateId: templateId,
610
628
messageId: messageId,
611
629
appAlreadyRunning: appAlreadyRunning,
@@ -622,7 +640,12 @@ import UIKit
622
640
/// - Remark: Pass in the custom event data.
623
641
@objc ( track: )
624
642
public static func track( event eventName: String ) {
625
- implementation? . track ( eventName)
643
+ track (
644
+ event: eventName,
645
+ dataFields: nil ,
646
+ onSuccess: nil ,
647
+ onFailure: nil
648
+ )
626
649
}
627
650
628
651
/// Tracks a custom event
@@ -634,7 +657,12 @@ import UIKit
634
657
/// - Remark: Pass in the custom event data.
635
658
@objc ( track: dataFields: )
636
659
public static func track( event eventName: String , dataFields: [ AnyHashable : Any ] ? ) {
637
- implementation? . track ( eventName, dataFields: dataFields)
660
+ track (
661
+ event: eventName,
662
+ dataFields: dataFields,
663
+ onSuccess: nil ,
664
+ onFailure: nil
665
+ )
638
666
}
639
667
640
668
/// Tracks a custom event
@@ -691,7 +719,9 @@ import UIKit
691
719
/// - embeddedSession: the embedded session data type to track
692
720
@objc ( embeddedSession: )
693
721
public static func track( embeddedSession: IterableEmbeddedSession ) {
694
- implementation? . track ( embeddedSession: embeddedSession)
722
+ guard let implementation, implementation. isSDKInitialized ( ) else { return }
723
+
724
+ implementation. track ( embeddedSession: embeddedSession)
695
725
}
696
726
697
727
@objc ( embeddedMessageClick: buttonIdentifier: clickedUrl: )
@@ -814,7 +844,9 @@ import UIKit
814
844
/// - inboxSession: the inbox session data type to track
815
845
@objc ( trackInboxSession: )
816
846
public static func track( inboxSession: IterableInboxSession ) {
817
- implementation? . track ( inboxSession: inboxSession)
847
+ guard let implementation, implementation. isSDKInitialized ( ) else { return }
848
+
849
+ implementation. track ( inboxSession: inboxSession)
818
850
}
819
851
820
852
// MARK: - Private/Internal
0 commit comments