From 5d0688b7a500b3ef2dccb4110828e74d17344c9e Mon Sep 17 00:00:00 2001 From: Vailence Date: Fri, 5 Dec 2025 14:40:45 +0800 Subject: [PATCH] WMSDK-572- Adds JS delivery bridge for RN Introduces the MindboxJsDeliveryBridge class. This bridge provides a native mechanism to emit UNNotificationResponse objects, enabling the Mindbox SDK to pass these responses to the React Native JavaScript delivery module for consistent handling within the RN environment. Relates to WMSDK-572 --- ios/MindboxJsDeliveryBridge.swift | 10 ++++++++++ ios/MindboxSdk.swift | 1 - ios/MindboxSdk.xcodeproj/project.pbxproj | 4 ++++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 ios/MindboxJsDeliveryBridge.swift diff --git a/ios/MindboxJsDeliveryBridge.swift b/ios/MindboxJsDeliveryBridge.swift new file mode 100644 index 0000000..dca2790 --- /dev/null +++ b/ios/MindboxJsDeliveryBridge.swift @@ -0,0 +1,10 @@ +import Foundation +import UserNotifications + +@objc(MindboxJsDeliveryBridge) +public final class MindboxJsDeliveryBridge: NSObject { + + @objc public static func emit(_ response: UNNotificationResponse) { + MindboxJsDelivery.emitEvent(response) + } +} diff --git a/ios/MindboxSdk.swift b/ios/MindboxSdk.swift index 49a39a3..8779d91 100644 --- a/ios/MindboxSdk.swift +++ b/ios/MindboxSdk.swift @@ -1,6 +1,5 @@ import Mindbox import MindboxLogger -import CoreFoundation enum CustomError: Error { case tokenAPNSisNull diff --git a/ios/MindboxSdk.xcodeproj/project.pbxproj b/ios/MindboxSdk.xcodeproj/project.pbxproj index ab70bfd..4fa4356 100644 --- a/ios/MindboxSdk.xcodeproj/project.pbxproj +++ b/ios/MindboxSdk.xcodeproj/project.pbxproj @@ -8,6 +8,7 @@ /* Begin PBXBuildFile section */ 61249CFA2719673B00FC4033 /* MindboxJsDelivery.m in Sources */ = {isa = PBXBuildFile; fileRef = 61249CF92719673B00FC4033 /* MindboxJsDelivery.m */; }; + D0F7B0012B1C4A1A00A1B2C3 /* MindboxJsDeliveryBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F7B0002B1C4A1A00A1B2C3 /* MindboxJsDeliveryBridge.swift */; }; F4FF95D7245B92E800C19C63 /* MindboxSdk.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FF95D6245B92E800C19C63 /* MindboxSdk.swift */; }; /* End PBXBuildFile section */ @@ -28,6 +29,7 @@ 61249CF82719673B00FC4033 /* MindboxJsDelivery.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MindboxJsDelivery.h; sourceTree = ""; }; 61249CF92719673B00FC4033 /* MindboxJsDelivery.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MindboxJsDelivery.m; sourceTree = ""; }; B3E7B5891CC2AC0600A0062D /* MindboxSdk.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MindboxSdk.m; sourceTree = ""; }; + D0F7B0002B1C4A1A00A1B2C3 /* MindboxJsDeliveryBridge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MindboxJsDeliveryBridge.swift; sourceTree = ""; }; F4FF95D5245B92E700C19C63 /* MindboxSdk-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MindboxSdk-Bridging-Header.h"; sourceTree = ""; }; F4FF95D6245B92E800C19C63 /* MindboxSdk.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MindboxSdk.swift; sourceTree = ""; }; /* End PBXFileReference section */ @@ -56,6 +58,7 @@ children = ( 61249CF82719673B00FC4033 /* MindboxJsDelivery.h */, 61249CF92719673B00FC4033 /* MindboxJsDelivery.m */, + D0F7B0002B1C4A1A00A1B2C3 /* MindboxJsDeliveryBridge.swift */, F4FF95D6245B92E800C19C63 /* MindboxSdk.swift */, B3E7B5891CC2AC0600A0062D /* MindboxSdk.m */, F4FF95D5245B92E700C19C63 /* MindboxSdk-Bridging-Header.h */, @@ -121,6 +124,7 @@ buildActionMask = 2147483647; files = ( 61249CFA2719673B00FC4033 /* MindboxJsDelivery.m in Sources */, + D0F7B0012B1C4A1A00A1B2C3 /* MindboxJsDeliveryBridge.swift in Sources */, F4FF95D7245B92E800C19C63 /* MindboxSdk.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0;