From d8773c27c3ff7f9c59e34ff602e8a7e7bad80355 Mon Sep 17 00:00:00 2001 From: Akash Malhotra Date: Fri, 22 Nov 2024 11:34:35 +0530 Subject: [PATCH 1/2] added support for promptForPushPermission method in JS Interface --- CleverTapSDK/CleverTapJSInterface.m | 3 +++ ObjCStarter/ObjCStarter/sampleHTMLCode.html | 14 ++++++++++++++ .../Supporting Files/sampleHTMLCode.html | 14 ++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/CleverTapSDK/CleverTapJSInterface.m b/CleverTapSDK/CleverTapJSInterface.m index 4609998e..7ecd0469 100644 --- a/CleverTapSDK/CleverTapJSInterface.m +++ b/CleverTapSDK/CleverTapJSInterface.m @@ -9,6 +9,7 @@ #import "CTInAppDisplayViewController.h" #import "CleverTapBuildInfo.h" +#import "CleverTap+PushPermission.h" @interface CleverTapJSInterface (){} @@ -87,6 +88,8 @@ - (void)handleMessageFromWebview:(NSDictionary *)message forInsta [cleverTap profileDecrementValueBy: message[@"value"] forKey: message[@"key"]]; } else if ([action isEqual: @"triggerInAppAction"]) { [self triggerInAppAction:message[@"actionJson"] callToAction:message[@"callToAction"] buttonId:message[@"buttonId"]]; + } else if ([action isEqual: @"promptForPushPermission"]) { + [cleverTap promptForPushPermission:message[@"showFallbackSettings"]]; } } diff --git a/ObjCStarter/ObjCStarter/sampleHTMLCode.html b/ObjCStarter/ObjCStarter/sampleHTMLCode.html index 906d9f27..9bf98cd9 100755 --- a/ObjCStarter/ObjCStarter/sampleHTMLCode.html +++ b/ObjCStarter/ObjCStarter/sampleHTMLCode.html @@ -24,6 +24,8 @@

CleverTap Webview



+ +

diff --git a/SwiftStarter/SwiftStarter/Supporting Files/sampleHTMLCode.html b/SwiftStarter/SwiftStarter/Supporting Files/sampleHTMLCode.html index 935a0b1f..a4839ae1 100644 --- a/SwiftStarter/SwiftStarter/Supporting Files/sampleHTMLCode.html +++ b/SwiftStarter/SwiftStarter/Supporting Files/sampleHTMLCode.html @@ -24,6 +24,8 @@

CleverTap Webview



+ +

From 99a149f9d186415ab8758e7991daa859b752f388 Mon Sep 17 00:00:00 2001 From: Akash Malhotra Date: Fri, 22 Nov 2024 15:02:27 +0530 Subject: [PATCH 2/2] dismissed inapp when the prompt method is called from an html in-app --- CleverTapSDK/CleverTapJSInterface.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CleverTapSDK/CleverTapJSInterface.m b/CleverTapSDK/CleverTapJSInterface.m index 7ecd0469..47aa13b0 100644 --- a/CleverTapSDK/CleverTapJSInterface.m +++ b/CleverTapSDK/CleverTapJSInterface.m @@ -89,6 +89,9 @@ - (void)handleMessageFromWebview:(NSDictionary *)message forInsta } else if ([action isEqual: @"triggerInAppAction"]) { [self triggerInAppAction:message[@"actionJson"] callToAction:message[@"callToAction"] buttonId:message[@"buttonId"]]; } else if ([action isEqual: @"promptForPushPermission"]) { + if (self.controller) { + [self.controller hide:NO]; + } [cleverTap promptForPushPermission:message[@"showFallbackSettings"]]; } }