@@ -42,6 +42,7 @@ public class IterableApi {
42
42
43
43
IterableApiClient apiClient = new IterableApiClient (new IterableApiAuthProvider ());
44
44
private @ Nullable IterableInAppManager inAppManager ;
45
+ private @ Nullable IterableEmbeddedManager embeddedManager ;
45
46
private String inboxSessionId ;
46
47
private IterableAuthManager authManager ;
47
48
private HashMap <String , String > deviceAttributes = new HashMap <>();
@@ -517,6 +518,10 @@ public static void initialize(@NonNull Context context, @NonNull String apiKey,
517
518
sharedInstance .config .useInMemoryStorageForInApps );
518
519
}
519
520
521
+ if (sharedInstance .embeddedManager == null ) {
522
+ sharedInstance .embeddedManager = new IterableEmbeddedManager (sharedInstance .config .embeddedMessagingAutoFetchInterval , null , null );
523
+ }
524
+
520
525
loadLastSavedConfiguration (context );
521
526
IterablePushNotificationUtil .processPendingAction (context );
522
527
}
@@ -535,12 +540,20 @@ public static void setContext(Context context) {
535
540
this .inAppManager = inAppManager ;
536
541
}
537
542
543
+ @ VisibleForTesting
544
+ IterableApi (IterableInAppManager inAppManager , IterableEmbeddedManager embeddedManager ) {
545
+ config = new IterableConfig .Builder ().build ();
546
+ this .inAppManager = inAppManager ;
547
+ this .embeddedManager = embeddedManager ;
548
+ }
549
+
538
550
@ VisibleForTesting
539
551
IterableApi (IterableApiClient apiClient , IterableInAppManager inAppManager ) {
540
552
config = new IterableConfig .Builder ().build ();
541
553
this .apiClient = apiClient ;
542
554
this .inAppManager = inAppManager ;
543
555
}
556
+
544
557
//endregion
545
558
546
559
//region SDK public functions
@@ -558,6 +571,24 @@ public IterableInAppManager getInAppManager() {
558
571
return inAppManager ;
559
572
}
560
573
574
+ @ NonNull
575
+ public IterableEmbeddedManager getEmbeddedManager () {
576
+ if (embeddedManager == null ) {
577
+ throw new RuntimeException ("IterableApi must be initialized before calling getFlexManager(). " +
578
+ "Make sure you call IterableApi#initialize() in Application#onCreate" );
579
+ }
580
+ return embeddedManager ;
581
+ }
582
+
583
+ @ NonNull
584
+ public IterableEmbeddedManager embeddedManager () {
585
+ if (embeddedManager == null ) {
586
+ throw new RuntimeException ("IterableApi must be initialized before calling getFlexManager(). " +
587
+ "Make sure you call IterableApi#initialize() in Application#onCreate" );
588
+ }
589
+ return embeddedManager ;
590
+ }
591
+
561
592
/**
562
593
* Returns the attribution information ({@link IterableAttributionInfo}) for last push open
563
594
* or app link click from an email.
0 commit comments