@@ -634,11 +634,16 @@ - (NSMutableDictionary *)getVariableValues {
634
634
635
635
RCT_EXPORT_METHOD (showInbox:(NSDictionary *)styleConfig) {
636
636
RCTLogInfo (@" [CleverTap Show Inbox]" );
637
+ UIWindow *keyWindow = [[UIApplication sharedApplication ] keyWindow ];
638
+ UIViewController *mainViewController = keyWindow.rootViewController ;
639
+ if (mainViewController.presentedViewController ) {
640
+ RCTLogInfo (@" CleverTap : Could not present App Inbox because a view controller is already being presented." );
641
+ return ;
642
+ }
643
+
637
644
CleverTapInboxViewController *inboxController = [[self cleverTapInstance ] newInboxViewControllerWithConfig: [self _dictToInboxStyleConfig: styleConfig? styleConfig : nil ] andDelegate: (id <CleverTapInboxViewControllerDelegate>)self ];
638
645
if (inboxController) {
639
646
UINavigationController *navigationController = [[UINavigationController alloc ] initWithRootViewController: inboxController];
640
- UIWindow *keyWindow = [[UIApplication sharedApplication ] keyWindow ];
641
- UIViewController *mainViewController = keyWindow.rootViewController ;
642
647
[mainViewController presentViewController: navigationController animated: YES completion: nil ];
643
648
}
644
649
}
@@ -852,6 +857,20 @@ - (void)messageDidSelect:(CleverTapInboxMessage *_Nonnull)message atIndex:(int)i
852
857
[[self cleverTapInstance ] resumeInAppNotifications ];
853
858
}
854
859
860
+ #pragma mark - InApp Controls
861
+
862
+ RCT_EXPORT_METHOD (fetchInApps:(RCTResponseSenderBlock)callback) {
863
+ RCTLogInfo (@" [CleverTap fetchInApps]" );
864
+ [[self cleverTapInstance ]fetchInApps:^(BOOL success) {
865
+ [self returnResult: @(success) withCallback: callback andError: nil ];
866
+ }];
867
+ }
868
+
869
+ RCT_EXPORT_METHOD (clearInAppResources:(BOOL )expiredOnly) {
870
+ RCTLogInfo (@" [CleverTap clearInAppResources" );
871
+ [[self cleverTapInstance ] clearInAppResources: expiredOnly];
872
+ }
873
+
855
874
#pragma mark - Push Permission
856
875
857
876
- (CTLocalInApp*)_localInAppConfigFromReadableMap : (NSDictionary *)json {
0 commit comments