From c14687cf7a6a175132d15c0c6476fe5e3432d428 Mon Sep 17 00:00:00 2001 From: Nan Date: Thu, 20 Nov 2025 00:48:33 -0800 Subject: [PATCH 1/9] chore(tests): Add Swift `IAMIntegrationTests` file Add Swift `IAMIntegrationTests` test file and check for accessibility of `OSMessagingController` from the test file --- .../OneSignal.xcodeproj/project.pbxproj | 11 ++++- .../IAMIntegrationTests.swift | 43 +++++++++++++++++++ ...SignalInAppMessagesTests-Bridging-Header.h | 4 ++ 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 iOS_SDK/OneSignalSDK/OneSignalInAppMessagesTests/IAMIntegrationTests.swift create mode 100644 iOS_SDK/OneSignalSDK/OneSignalInAppMessagesTests/OneSignalInAppMessagesTests-Bridging-Header.h diff --git a/iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj b/iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj index 230d0317d..3a3ac9b1c 100644 --- a/iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj +++ b/iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj @@ -98,6 +98,7 @@ 3C67F77A2BEB2B710085A0F0 /* SwitchUserIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C67F7792BEB2B710085A0F0 /* SwitchUserIntegrationTests.swift */; }; 3C7021E32ECF0821001768C6 /* OneSignalFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E2400381D4FFC31008BDE70 /* OneSignalFramework.framework */; }; 3C7021E42ECF0821001768C6 /* OneSignalFramework.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3E2400381D4FFC31008BDE70 /* OneSignalFramework.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 3C7021E92ECF0CF4001768C6 /* IAMIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C7021E82ECF0CF4001768C6 /* IAMIntegrationTests.swift */; }; 3C70FA672D0B68A100031066 /* OneSignalClientError.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C70FA652D0B68A100031066 /* OneSignalClientError.h */; settings = {ATTRIBUTES = (Public, ); }; }; 3C70FA682D0B68A100031066 /* OneSignalClientError.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C70FA662D0B68A100031066 /* OneSignalClientError.m */; }; 3C789DBD293C2206004CF83D /* OSFocusInfluenceParam.m in Sources */ = {isa = PBXBuildFile; fileRef = 7A600B432453790700514A53 /* OSFocusInfluenceParam.m */; }; @@ -1286,6 +1287,8 @@ 3C6299A82BEEA46C00649187 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; 3C6299AA2BEEA4C000649187 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; 3C67F7792BEB2B710085A0F0 /* SwitchUserIntegrationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwitchUserIntegrationTests.swift; sourceTree = ""; }; + 3C7021E72ECF0CF3001768C6 /* OneSignalInAppMessagesTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "OneSignalInAppMessagesTests-Bridging-Header.h"; sourceTree = ""; }; + 3C7021E82ECF0CF4001768C6 /* IAMIntegrationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IAMIntegrationTests.swift; sourceTree = ""; }; 3C70FA652D0B68A100031066 /* OneSignalClientError.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OneSignalClientError.h; sourceTree = ""; }; 3C70FA662D0B68A100031066 /* OneSignalClientError.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OneSignalClientError.m; sourceTree = ""; }; 3C7A39D42B7C18EE0082665E /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; @@ -2103,6 +2106,8 @@ isa = PBXGroup; children = ( 3C01519B2C2E29F90079E076 /* IAMRequestTests.m */, + 3C7021E82ECF0CF4001768C6 /* IAMIntegrationTests.swift */, + 3C7021E72ECF0CF3001768C6 /* OneSignalInAppMessagesTests-Bridging-Header.h */, ); path = OneSignalInAppMessagesTests; sourceTree = ""; @@ -3779,7 +3784,7 @@ }; 3C01518D2C2E298E0079E076 = { CreatedOnToolsVersion = 15.2; - LastSwiftMigration = 1520; + LastSwiftMigration = 1640; TestTargetID = DEF5CCF02539321A0003E9CC; }; 3C115160289A259500565C41 = { @@ -4189,6 +4194,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 3C7021E92ECF0CF4001768C6 /* IAMIntegrationTests.swift in Sources */, 3C01519C2C2E29F90079E076 /* IAMRequestTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -5019,6 +5025,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_OBJC_BRIDGING_HEADER = "OneSignalInAppMessagesTests/OneSignalInAppMessagesTests-Bridging-Header.h"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/UnitTestApp.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/UnitTestApp"; @@ -5072,6 +5079,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_OBJC_BRIDGING_HEADER = "OneSignalInAppMessagesTests/OneSignalInAppMessagesTests-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -5119,6 +5127,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_OBJC_BRIDGING_HEADER = "OneSignalInAppMessagesTests/OneSignalInAppMessagesTests-Bridging-Header.h"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/UnitTestApp.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/UnitTestApp"; diff --git a/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesTests/IAMIntegrationTests.swift b/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesTests/IAMIntegrationTests.swift new file mode 100644 index 000000000..85bce1be2 --- /dev/null +++ b/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesTests/IAMIntegrationTests.swift @@ -0,0 +1,43 @@ +/* + Modified MIT License + + Copyright 2025 OneSignal + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + 1. The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + 2. All copies of substantial portions of the Software may only be used in connection +with services provided by OneSignal. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + */ + +import XCTest +@testable import OneSignalInAppMessages + +final class IAMIntegrationTests: XCTestCase { + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + } + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + func testExample() throws { + OneSignalLog.setLogLevel(.LL_VERBOSE) + OneSignalInAppMessages.getFromServer("foobar") + // OSMessagingController.sharedInstance() + } +} diff --git a/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesTests/OneSignalInAppMessagesTests-Bridging-Header.h b/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesTests/OneSignalInAppMessagesTests-Bridging-Header.h new file mode 100644 index 000000000..1b2cb5d6d --- /dev/null +++ b/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesTests/OneSignalInAppMessagesTests-Bridging-Header.h @@ -0,0 +1,4 @@ +// +// Use this file to import your target's public headers that you would like to expose to Swift. +// + From fac17c0c6b3827e2cc64d1d6640e543ada9a7202 Mon Sep 17 00:00:00 2001 From: Nan Date: Mon, 27 Jan 2025 20:07:03 -0800 Subject: [PATCH 2/9] nit: remove unused methods `getTriggerValueForKey` * no longer used, dead code --- .../Controller/OSMessagingController.h | 1 - .../Controller/OSMessagingController.m | 5 ----- .../OneSignalInAppMessages/Controller/OSTriggerController.h | 1 - .../OneSignalInAppMessages/Controller/OSTriggerController.m | 6 ------ 4 files changed, 13 deletions(-) diff --git a/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSMessagingController.h b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSMessagingController.h index b5d443112..49c0b2124 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSMessagingController.h +++ b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSMessagingController.h @@ -61,7 +61,6 @@ NS_ASSUME_NONNULL_BEGIN - (void)removeTriggersForKeys:(NSArray *)keys; - (void)clearTriggers; - (NSDictionary *)getTriggers; -- (id)getTriggerValueForKey:(NSString *)key; - (void)addInAppMessageClickListener:(NSObject *_Nullable)listener; - (void)removeInAppMessageClickListener:(NSObject *_Nullable)listener; diff --git a/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSMessagingController.m b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSMessagingController.m index c388dd8ea..5c2fa8876 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSMessagingController.m +++ b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSMessagingController.m @@ -815,10 +815,6 @@ - (void)clearTriggers { return self.triggerController.getTriggers; } -- (id)getTriggerValueForKey:(NSString *)key { - return [self.triggerController getTriggerValueForKey:key]; -} - #pragma mark OSInAppMessageViewControllerDelegate Methods - (void)messageViewControllerDidDisplay:(OSInAppMessageInternal *)message { [self onDidDisplayInAppMessage:message]; @@ -1227,7 +1223,6 @@ - (void)addTriggers:(NSDictionary *)triggers {} - (void)removeTriggersForKeys:(NSArray *)keys {} - (void)clearTriggers {} - (NSDictionary *)getTriggers { return @{}; } -- (id)getTriggerValueForKey:(NSString *)key { return 0; } #pragma mark OSInAppMessageViewControllerDelegate Methods - (void)messageViewControllerWasDismissed {} - (void)messageViewDidSelectAction:(OSInAppMessageInternal *)message withAction:(OSInAppMessageClickResult *)action {} diff --git a/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSTriggerController.h b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSTriggerController.h index ce99b69db..e036086d3 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSTriggerController.h +++ b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSTriggerController.h @@ -52,7 +52,6 @@ NS_ASSUME_NONNULL_BEGIN - (void)addTriggers:(NSDictionary *)triggers; - (void)removeTriggersForKeys:(NSArray *)keys; - (NSDictionary *)getTriggers; -- (id)getTriggerValueForKey:(NSString *)key; - (void)timeSinceLastMessage:(NSDate *)date; @end diff --git a/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSTriggerController.m b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSTriggerController.m index 8499192ab..f3b99da28 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSTriggerController.m +++ b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSTriggerController.m @@ -69,12 +69,6 @@ - (void)removeTriggersForKeys:(NSArray *)keys { } } -- (id)getTriggerValueForKey:(NSString *)key { - @synchronized (self.triggers) { - return self.triggers[key]; - } -} - /* * Part of redisplay logic * From a814fcb8f55e41aae640a51a0b27361be51110f1 Mon Sep 17 00:00:00 2001 From: Nan Date: Wed, 15 Jan 2025 15:47:06 -0800 Subject: [PATCH 3/9] nit: remove methods from OSMessagingController header * Aren't called by anything so no need to be on the interface, these are called by the class itself. --- .../Controller/OSMessagingController.h | 5 ----- .../Controller/OSMessagingController.m | 1 + .../UnitTests/Shadows/OSMessagingControllerOverrider.m | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSMessagingController.h b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSMessagingController.h index 49c0b2124..aa1709e65 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSMessagingController.h +++ b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSMessagingController.h @@ -49,18 +49,13 @@ NS_ASSUME_NONNULL_BEGIN + (OSMessagingController *)sharedInstance; + (void)start; -+ (void)removeInstance; -- (void)presentInAppMessage:(OSInAppMessageInternal *)message; - (void)getInAppMessagesFromServer:(NSString * _Nullable)subscriptionId; -- (void)messageViewImpressionRequest:(OSInAppMessageInternal *)message; -- (void)messageViewPageImpressionRequest:(OSInAppMessageInternal *)message withPageId:(NSString *)pageId; - (BOOL)isInAppMessagingPaused; - (void)setInAppMessagingPaused:(BOOL)pause; - (void)addTriggers:(NSDictionary *)triggers; - (void)removeTriggersForKeys:(NSArray *)keys; - (void)clearTriggers; -- (NSDictionary *)getTriggers; - (void)addInAppMessageClickListener:(NSObject *_Nullable)listener; - (void)removeInAppMessageClickListener:(NSObject *_Nullable)listener; diff --git a/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSMessagingController.m b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSMessagingController.m index 5c2fa8876..e5b99accf 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSMessagingController.m +++ b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSMessagingController.m @@ -165,6 +165,7 @@ + (OSMessagingController *)sharedInstance { return sharedInstance; } +/// Note: This method is used in tests only. + (void)removeInstance { sharedInstance = nil; once = 0; diff --git a/iOS_SDK/OneSignalSDK/UnitTests/Shadows/OSMessagingControllerOverrider.m b/iOS_SDK/OneSignalSDK/UnitTests/Shadows/OSMessagingControllerOverrider.m index 9d3d1d406..239700648 100644 --- a/iOS_SDK/OneSignalSDK/UnitTests/Shadows/OSMessagingControllerOverrider.m +++ b/iOS_SDK/OneSignalSDK/UnitTests/Shadows/OSMessagingControllerOverrider.m @@ -112,7 +112,7 @@ - (void)overrideShowMessage:(OSInAppMessageInternal *)message { - (void)overrideWebViewContentFinishedLoading:(OSInAppMessageInternal *)message { if (message) { - [OSMessagingController.sharedInstance messageViewImpressionRequest:message]; + // [OSMessagingController.sharedInstance messageViewImpressionRequest:message]; } } From b67fe352268855eae64e05b999f5333aced5f528 Mon Sep 17 00:00:00 2001 From: Nan Date: Mon, 27 Jan 2025 10:45:35 -0800 Subject: [PATCH 4/9] Add description to `OSRequestGetInAppMessages` * Without a description, the object will return something like ``. By adding a predictable description, we can operate on the object. --- .../Requests/OSInAppMessagingRequests.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Requests/OSInAppMessagingRequests.m b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Requests/OSInAppMessagingRequests.m index 4682ced91..de6e1c524 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Requests/OSInAppMessagingRequests.m +++ b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Requests/OSInAppMessagingRequests.m @@ -28,6 +28,10 @@ of this software and associated documentation files (the "Software"), to deal #import "OSInAppMessagingRequests.h" @implementation OSRequestGetInAppMessages +- (NSString *)description { + return [NSString stringWithFormat:@"", self.path]; +} + + (instancetype _Nonnull) withSubscriptionId:(NSString * _Nonnull)subscriptionId withSessionDuration:(NSNumber * _Nonnull)sessionDuration withRetryCount:(NSNumber *)retryCount From 7440b1aafcfb21b0a2786f361964a64c0eb0a1b5 Mon Sep 17 00:00:00 2001 From: Nan Date: Thu, 20 Nov 2025 01:13:52 -0800 Subject: [PATCH 5/9] chore(tests): Add framework for OneSignalInAppMessagesMocks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Re-usable test helpers and mock functionality * Include own swiftlint file * ❗️ After `OneSignalInAppMessagesMocks` was created, I had to then manually "convert to group" or else the CI had build errors about the following: xcodebuild: error: Unable to read project 'OneSignal.xcodeproj' Reason: The project ‘OneSignal’ is damaged and cannot be opened. Examine the project file for invalid edits or unresolved source control conflicts. Exception: didn't find classname for 'isa' key --- .../OneSignal.xcodeproj/project.pbxproj | 314 ++++++++++++++++++ .../.swiftlint.yml | 2 + .../IAMTestHelpers.swift | 98 ++++++ .../OneSignalInAppMessagesMocks.h | 36 ++ 4 files changed, 450 insertions(+) create mode 100644 iOS_SDK/OneSignalSDK/OneSignalInAppMessagesMocks/.swiftlint.yml create mode 100644 iOS_SDK/OneSignalSDK/OneSignalInAppMessagesMocks/IAMTestHelpers.swift create mode 100644 iOS_SDK/OneSignalSDK/OneSignalInAppMessagesMocks/OneSignalInAppMessagesMocks.h diff --git a/iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj b/iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj index 3a3ac9b1c..9e7e5520e 100644 --- a/iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj +++ b/iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj @@ -89,6 +89,8 @@ 3C5501402E09CF0100E77DF7 /* OSCopyOnWriteSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C55013E2E09CF0100E77DF7 /* OSCopyOnWriteSet.h */; }; 3C5501412E09CF0100E77DF7 /* OSCopyOnWriteSet.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C55013F2E09CF0100E77DF7 /* OSCopyOnWriteSet.m */; }; 3C5501432E09F3D900E77DF7 /* LoggingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C5501422E09F3D900E77DF7 /* LoggingTests.swift */; }; + 3C60BB9B2ECF860600C765F7 /* OneSignalInAppMessages.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DEBAAE282A4211D900BF2C1C /* OneSignalInAppMessages.framework */; }; + 3C60BB9C2ECF860600C765F7 /* OneSignalInAppMessages.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = DEBAAE282A4211D900BF2C1C /* OneSignalInAppMessages.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 3C62999F2BEEA34800649187 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 3C62999E2BEEA34800649187 /* PrivacyInfo.xcprivacy */; }; 3C6299A12BEEA38100649187 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 3C6299A02BEEA38100649187 /* PrivacyInfo.xcprivacy */; }; 3C6299A32BEEA3CC00649187 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 3C6299A22BEEA3CC00649187 /* PrivacyInfo.xcprivacy */; }; @@ -99,6 +101,10 @@ 3C7021E32ECF0821001768C6 /* OneSignalFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E2400381D4FFC31008BDE70 /* OneSignalFramework.framework */; }; 3C7021E42ECF0821001768C6 /* OneSignalFramework.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3E2400381D4FFC31008BDE70 /* OneSignalFramework.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 3C7021E92ECF0CF4001768C6 /* IAMIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C7021E82ECF0CF4001768C6 /* IAMIntegrationTests.swift */; }; + 3C7022222ECF124B001768C6 /* OneSignalInAppMessagesMocks.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C70221C2ECF124B001768C6 /* OneSignalInAppMessagesMocks.framework */; }; + 3C7022232ECF124B001768C6 /* OneSignalInAppMessagesMocks.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3C70221C2ECF124B001768C6 /* OneSignalInAppMessagesMocks.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 3C70222B2ECF126B001768C6 /* OneSignalInAppMessagesMocks.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C7022292ECF126B001768C6 /* OneSignalInAppMessagesMocks.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3C70222D2ECF12A5001768C6 /* IAMTestHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C70222C2ECF12A5001768C6 /* IAMTestHelpers.swift */; }; 3C70FA672D0B68A100031066 /* OneSignalClientError.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C70FA652D0B68A100031066 /* OneSignalClientError.h */; settings = {ATTRIBUTES = (Public, ); }; }; 3C70FA682D0B68A100031066 /* OneSignalClientError.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C70FA662D0B68A100031066 /* OneSignalClientError.m */; }; 3C789DBD293C2206004CF83D /* OSFocusInfluenceParam.m in Sources */ = {isa = PBXBuildFile; fileRef = 7A600B432453790700514A53 /* OSFocusInfluenceParam.m */; }; @@ -646,6 +652,13 @@ remoteGlobalIDString = 3C115160289A259500565C41; remoteInfo = OneSignalOSCore; }; + 3C60BB9D2ECF860600C765F7 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 37747F8B19147D6400558FAD /* Project object */; + proxyType = 1; + remoteGlobalIDString = DEBAAE272A4211D900BF2C1C; + remoteInfo = OneSignalInAppMessages; + }; 3C7021E52ECF0821001768C6 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 37747F8B19147D6400558FAD /* Project object */; @@ -653,6 +666,13 @@ remoteGlobalIDString = 3E2400371D4FFC31008BDE70; remoteInfo = OneSignalFramework; }; + 3C7022202ECF124B001768C6 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 37747F8B19147D6400558FAD /* Project object */; + proxyType = 1; + remoteGlobalIDString = 3C70221B2ECF124B001768C6; + remoteInfo = OneSignalInAppMessagesMocks; + }; 3C7A39C32B7BED900082665E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 37747F8B19147D6400558FAD /* Project object */; @@ -1114,6 +1134,17 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 3C60BB9F2ECF860600C765F7 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 3C60BB9C2ECF860600C765F7 /* OneSignalInAppMessages.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; 3C7A39C52B7BED910082665E /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -1216,6 +1247,7 @@ DEA4B4662888C59E00E9FE12 /* OneSignalExtension.framework in Embed Frameworks */, DEBAAE2F2A4211DA00BF2C1C /* OneSignalInAppMessages.framework in Embed Frameworks */, 475F47252B8E398E00EC05B3 /* OneSignalLiveActivities.framework in Embed Frameworks */, + 3C7022232ECF124B001768C6 /* OneSignalInAppMessagesMocks.framework in Embed Frameworks */, 3C8544BD2C5AEFF700F542A9 /* OneSignalOSCoreMocks.framework in Embed Frameworks */, 3C7021E42ECF0821001768C6 /* OneSignalFramework.framework in Embed Frameworks */, DEA4B4632888C4DC00E9FE12 /* OneSignalOutcomes.framework in Embed Frameworks */, @@ -1289,6 +1321,9 @@ 3C67F7792BEB2B710085A0F0 /* SwitchUserIntegrationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwitchUserIntegrationTests.swift; sourceTree = ""; }; 3C7021E72ECF0CF3001768C6 /* OneSignalInAppMessagesTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "OneSignalInAppMessagesTests-Bridging-Header.h"; sourceTree = ""; }; 3C7021E82ECF0CF4001768C6 /* IAMIntegrationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IAMIntegrationTests.swift; sourceTree = ""; }; + 3C70221C2ECF124B001768C6 /* OneSignalInAppMessagesMocks.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OneSignalInAppMessagesMocks.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 3C7022292ECF126B001768C6 /* OneSignalInAppMessagesMocks.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OneSignalInAppMessagesMocks.h; sourceTree = ""; }; + 3C70222C2ECF12A5001768C6 /* IAMTestHelpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IAMTestHelpers.swift; sourceTree = ""; }; 3C70FA652D0B68A100031066 /* OneSignalClientError.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OneSignalClientError.h; sourceTree = ""; }; 3C70FA662D0B68A100031066 /* OneSignalClientError.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OneSignalClientError.m; sourceTree = ""; }; 3C7A39D42B7C18EE0082665E /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; @@ -1751,6 +1786,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 3C7022192ECF124B001768C6 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 3C60BB9B2ECF860600C765F7 /* OneSignalInAppMessages.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 3C8544B32C5AEFF600F542A9 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -1966,6 +2009,7 @@ 3CEE934A2B7C73B6008440BD /* OneSignalUserMocks.framework in Frameworks */, DEF5CD52253934410003E9CC /* CoreFoundation.framework in Frameworks */, DEF5CD502539343C0003E9CC /* Foundation.framework in Frameworks */, + 3C7022222ECF124B001768C6 /* OneSignalInAppMessagesMocks.framework in Frameworks */, DEF5CD4F253934350003E9CC /* UIKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -2036,6 +2080,7 @@ 3CC0639B2B6D7A8D002BB07F /* OneSignalCoreMocks */, 3C8544B72C5AEFF700F542A9 /* OneSignalOSCoreMocks */, 3CC063DE2B6D7F2A002BB07F /* OneSignalUserMocks */, + 3C70222A2ECF126B001768C6 /* OneSignalInAppMessagesMocks */, 3CC063A52B6D7A8E002BB07F /* OneSignalCoreTests */, 3CC063EC2B6D7FE8002BB07F /* OneSignalUserTests */, 3C01518F2C2E298F0079E076 /* OneSignalInAppMessagesTests */, @@ -2070,6 +2115,7 @@ 3C01518E2C2E298E0079E076 /* OneSignalInAppMessagesTests.xctest */, 3C8544B62C5AEFF600F542A9 /* OneSignalOSCoreMocks.framework */, 5B053FB82CAE07EB002F30C4 /* OneSignalOSCoreTests.xctest */, + 3C70221C2ECF124B001768C6 /* OneSignalInAppMessagesMocks.framework */, ); name = Products; sourceTree = ""; @@ -2145,6 +2191,15 @@ path = Source; sourceTree = ""; }; + 3C70222A2ECF126B001768C6 /* OneSignalInAppMessagesMocks */ = { + isa = PBXGroup; + children = ( + 3C7022292ECF126B001768C6 /* OneSignalInAppMessagesMocks.h */, + 3C70222C2ECF12A5001768C6 /* IAMTestHelpers.swift */, + ); + path = OneSignalInAppMessagesMocks; + sourceTree = ""; + }; 3C8544B72C5AEFF700F542A9 /* OneSignalOSCoreMocks */ = { isa = PBXGroup; children = ( @@ -3096,6 +3151,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 3C7022172ECF124B001768C6 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 3C70222B2ECF126B001768C6 /* OneSignalInAppMessagesMocks.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 3C8544B12C5AEFF600F542A9 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -3360,6 +3423,28 @@ productReference = 3C115161289A259500565C41 /* OneSignalOSCore.framework */; productType = "com.apple.product-type.framework"; }; + 3C70221B2ECF124B001768C6 /* OneSignalInAppMessagesMocks */ = { + isa = PBXNativeTarget; + buildConfigurationList = 3C7022282ECF124B001768C6 /* Build configuration list for PBXNativeTarget "OneSignalInAppMessagesMocks" */; + buildPhases = ( + 3C7022172ECF124B001768C6 /* Headers */, + 3C7022182ECF124B001768C6 /* Sources */, + 3C7022192ECF124B001768C6 /* Frameworks */, + 3C70221A2ECF124B001768C6 /* Resources */, + 3C60BB9F2ECF860600C765F7 /* Embed Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 3C60BB9E2ECF860600C765F7 /* PBXTargetDependency */, + ); + name = OneSignalInAppMessagesMocks; + packageProductDependencies = ( + ); + productName = OneSignalInAppMessagesMocks; + productReference = 3C70221C2ECF124B001768C6 /* OneSignalInAppMessagesMocks.framework */; + productType = "com.apple.product-type.framework"; + }; 3C8544B52C5AEFF600F542A9 /* OneSignalOSCoreMocks */ = { isa = PBXNativeTarget; buildConfigurationList = 3C8544C12C5AEFF800F542A9 /* Build configuration list for PBXNativeTarget "OneSignalOSCoreMocks" */; @@ -3742,6 +3827,7 @@ 475F47232B8E398E00EC05B3 /* PBXTargetDependency */, 3C8544BB2C5AEFF700F542A9 /* PBXTargetDependency */, 3C7021E62ECF0821001768C6 /* PBXTargetDependency */, + 3C7022212ECF124B001768C6 /* PBXTargetDependency */, ); name = UnitTestApp; productName = UnitTestApp; @@ -3792,6 +3878,10 @@ DevelopmentTeam = 99SW8E36CT; ProvisioningStyle = Automatic; }; + 3C70221B2ECF124B001768C6 = { + CreatedOnToolsVersion = 16.4; + LastSwiftMigration = 1640; + }; 3C8544B52C5AEFF600F542A9 = { CreatedOnToolsVersion = 15.2; LastSwiftMigration = 1520; @@ -3945,6 +4035,7 @@ 3CC063992B6D7A8C002BB07F /* OneSignalCoreMocks */, 3C8544B52C5AEFF600F542A9 /* OneSignalOSCoreMocks */, 3CC063DC2B6D7F2A002BB07F /* OneSignalUserMocks */, + 3C70221B2ECF124B001768C6 /* OneSignalInAppMessagesMocks */, 3CC063A02B6D7A8D002BB07F /* OneSignalCoreTests */, 3CC063EA2B6D7FE8002BB07F /* OneSignalUserTests */, 473542492B8F93330016DB4C /* OneSignalLiveActivitiesTests */, @@ -3971,6 +4062,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 3C70221A2ECF124B001768C6 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 3C8544B42C5AEFF600F542A9 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -4227,6 +4325,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 3C7022182ECF124B001768C6 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3C70222D2ECF12A5001768C6 /* IAMTestHelpers.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 3C8544B22C5AEFF600F542A9 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -4637,11 +4743,21 @@ target = 3C115160289A259500565C41 /* OneSignalOSCore */; targetProxy = 3C115199289AF86C00565C41 /* PBXContainerItemProxy */; }; + 3C60BB9E2ECF860600C765F7 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = DEBAAE272A4211D900BF2C1C /* OneSignalInAppMessages */; + targetProxy = 3C60BB9D2ECF860600C765F7 /* PBXContainerItemProxy */; + }; 3C7021E62ECF0821001768C6 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 3E2400371D4FFC31008BDE70 /* OneSignalFramework */; targetProxy = 3C7021E52ECF0821001768C6 /* PBXContainerItemProxy */; }; + 3C7022212ECF124B001768C6 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 3C70221B2ECF124B001768C6 /* OneSignalInAppMessagesMocks */; + targetProxy = 3C7022202ECF124B001768C6 /* PBXContainerItemProxy */; + }; 3C7A39C42B7BED900082665E /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 3CC063992B6D7A8C002BB07F /* OneSignalCoreMocks */; @@ -5262,6 +5378,194 @@ }; name = Debug; }; + 3C7022242ECF124B001768C6 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = 99SW8E36CT; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2025 Hiptic. All rights reserved."; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 1.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.OneSignalInAppMessagesMocks; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 6.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 3C7022252ECF124B001768C6 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = 99SW8E36CT; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2025 Hiptic. All rights reserved."; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 1.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.OneSignalInAppMessagesMocks; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 6.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 3C7022262ECF124B001768C6 /* Test */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = 99SW8E36CT; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2025 Hiptic. All rights reserved."; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 1.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.OneSignalInAppMessagesMocks; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 6.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Test; + }; 3C8544BE2C5AEFF800F542A9 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { @@ -8945,6 +9249,16 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 3C7022282ECF124B001768C6 /* Build configuration list for PBXNativeTarget "OneSignalInAppMessagesMocks" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3C7022242ECF124B001768C6 /* Release */, + 3C7022252ECF124B001768C6 /* Debug */, + 3C7022262ECF124B001768C6 /* Test */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 3C8544C12C5AEFF800F542A9 /* Build configuration list for PBXNativeTarget "OneSignalOSCoreMocks" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesMocks/.swiftlint.yml b/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesMocks/.swiftlint.yml new file mode 100644 index 000000000..d69b4172b --- /dev/null +++ b/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesMocks/.swiftlint.yml @@ -0,0 +1,2 @@ +disabled_rules: + - identifier_name \ No newline at end of file diff --git a/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesMocks/IAMTestHelpers.swift b/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesMocks/IAMTestHelpers.swift new file mode 100644 index 000000000..8e66ded28 --- /dev/null +++ b/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesMocks/IAMTestHelpers.swift @@ -0,0 +1,98 @@ +/* + Modified MIT License + + Copyright 2025 OneSignal + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + 1. The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + 2. All copies of substantial portions of the Software may only be used in connection + with services provided by OneSignal. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + */ + +import Foundation +import OneSignalInAppMessages + +let OS_TEST_MESSAGE_ID = "a4b3gj7f-d8cc-11e4-bed1-df8f05be55ba" +let OS_TEST_MESSAGE_VARIANT_ID = "m8dh7234f-d8cc-11e4-bed1-df8f05be55ba" +let OS_TEST_ENGLISH_VARIANT_ID = "11e4-bed1-df8f05be55ba-m8dh7234f-d8cc" + +let OS_DUMMY_HTML = "

Hello World

" + +@objc +public class IAMTestHelpers: NSObject { + /// Convert OSTriggerOperatorType enum to string + private static func OS_OPERATOR_TO_STRING(_ type: Int32) -> String { + // Trigger operator strings + let OS_OPERATOR_STRINGS: [String] = [ + "greater", + "less", + "equal", + "not_equal", + "less_or_equal", + "greater_or_equal", + "exists", + "not_exists", + "in" + ] + + return OS_OPERATOR_STRINGS[Int(type)] + } + + @objc + public static func testDefaultMessageJson() -> [String: Any] { + return [ + "id": String(format: "%@_%i", OS_TEST_MESSAGE_ID, UUID().uuidString), + "variants": [ + "ios": [ + "default": OS_TEST_MESSAGE_VARIANT_ID, + "en": OS_TEST_ENGLISH_VARIANT_ID + ], + "all": [ + "default": "should_never_be_used_by_any_test" + ] + ], + "triggers": [] + ] + } + + @objc + public static func testMessageJsonWithTrigger(property: String, triggerId: String, type: Int32, value: Any) -> [String: Any] { + var testMessage = self.testDefaultMessageJson() + + testMessage["triggers"] = [ + [ + [ + "kind": property, + "property": property, + "operator": OS_OPERATOR_TO_STRING(type), + "value": value, + "id": triggerId + ] + ] + ] + return testMessage + } + + @objc + public static func testFetchMessagesResponse(messages: [[String: Any]]) -> [String: Any] { + return [ + "in_app_messages": messages + ] + } +} diff --git a/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesMocks/OneSignalInAppMessagesMocks.h b/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesMocks/OneSignalInAppMessagesMocks.h new file mode 100644 index 000000000..ed33d0be7 --- /dev/null +++ b/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesMocks/OneSignalInAppMessagesMocks.h @@ -0,0 +1,36 @@ +/* + Modified MIT License + + Copyright 2025 OneSignal + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + 1. The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + 2. All copies of substantial portions of the Software may only be used in connection + with services provided by OneSignal. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + */ + +#import + +//! Project version number for OneSignalInAppMessagesMocks. +FOUNDATION_EXPORT double OneSignalInAppMessagesMocksVersionNumber; + +//! Project version string for OneSignalInAppMessagesMocks. +FOUNDATION_EXPORT const unsigned char OneSignalInAppMessagesMocksVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import From 7dee6a8b487dd029602516bb6b76cc8a6cfc6de7 Mon Sep 17 00:00:00 2001 From: Nan Date: Thu, 20 Nov 2025 02:19:15 -0800 Subject: [PATCH 6/9] chore(tests): move `UIApplication+OneSignal` from OneSIgnal > OneSignalInAppMessages * This extension on `UIApplication` is only used in the `OneSignalInAppMessages` framework, so there is no need to keep it in the umbrella `OneSignalFramework` framework, which causes errors if only `OneSignalInAppMessages` is tested (without also importing OneSignalFramework). --- iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj | 4 ++-- .../OneSignalInAppMessages/Controller/OSMessagingController.m | 4 ++-- .../UIApplication+OneSignal.h | 0 .../UIApplication+OneSignal.m | 0 iOS_SDK/OneSignalSDK/Source/OneSignalLifecycleObserver.m | 1 - 5 files changed, 4 insertions(+), 5 deletions(-) rename iOS_SDK/OneSignalSDK/{Source => OneSignalInAppMessages}/UIApplication+OneSignal.h (100%) rename iOS_SDK/OneSignalSDK/{Source => OneSignalInAppMessages}/UIApplication+OneSignal.m (100%) diff --git a/iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj b/iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj index 9e7e5520e..7a6ae8b2d 100644 --- a/iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj +++ b/iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj @@ -2596,8 +2596,6 @@ CA1A6E6820DC2E31001C41B9 /* OneSignalDialogController.m */, CA1A6E6D20DC2E73001C41B9 /* OneSignalDialogRequest.h */, CA1A6E6E20DC2E73001C41B9 /* OneSignalDialogRequest.m */, - DE20425C24E21C1500350E4F /* UIApplication+OneSignal.h */, - DE20425D24E21C2C00350E4F /* UIApplication+OneSignal.m */, ); name = Categories; sourceTree = ""; @@ -2990,6 +2988,8 @@ DEBAAE4C2A42157B00BF2C1C /* UI */, DEBAAE2A2A4211DA00BF2C1C /* OneSignalInAppMessages.h */, DEBAAE982A42179A00BF2C1C /* OneSignalInAppMessages.m */, + DE20425C24E21C1500350E4F /* UIApplication+OneSignal.h */, + DE20425D24E21C2C00350E4F /* UIApplication+OneSignal.m */, DEBAAE962A42178800BF2C1C /* OSInAppMessagingDefines.h */, 3C14E39E2AFAE39B006ED053 /* PrivacyInfo.xcprivacy */, ); diff --git a/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSMessagingController.m b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSMessagingController.m index e5b99accf..e1143f183 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSMessagingController.m +++ b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSMessagingController.m @@ -26,8 +26,8 @@ */ #import "OSMessagingController.h" -#import "UIApplication+OneSignal.h" // Previously imported via "OneSignalHelper.h" -#import "NSDateFormatter+OneSignal.h" // Previously imported via "OneSignalHelper.h" +#import "UIApplication+OneSignal.h" +#import "NSDateFormatter+OneSignal.h" #import #import "OSInAppMessageClickResult.h" #import "OSInAppMessageClickEvent.h" diff --git a/iOS_SDK/OneSignalSDK/Source/UIApplication+OneSignal.h b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/UIApplication+OneSignal.h similarity index 100% rename from iOS_SDK/OneSignalSDK/Source/UIApplication+OneSignal.h rename to iOS_SDK/OneSignalSDK/OneSignalInAppMessages/UIApplication+OneSignal.h diff --git a/iOS_SDK/OneSignalSDK/Source/UIApplication+OneSignal.m b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/UIApplication+OneSignal.m similarity index 100% rename from iOS_SDK/OneSignalSDK/Source/UIApplication+OneSignal.m rename to iOS_SDK/OneSignalSDK/OneSignalInAppMessages/UIApplication+OneSignal.m diff --git a/iOS_SDK/OneSignalSDK/Source/OneSignalLifecycleObserver.m b/iOS_SDK/OneSignalSDK/Source/OneSignalLifecycleObserver.m index 0e1389a2b..943fb2df3 100644 --- a/iOS_SDK/OneSignalSDK/Source/OneSignalLifecycleObserver.m +++ b/iOS_SDK/OneSignalSDK/Source/OneSignalLifecycleObserver.m @@ -31,7 +31,6 @@ of this software and associated documentation files (the "Software"), to deal #import "OneSignalCommonDefines.h" #import "OneSignalTracker.h" #import -#import "UIApplication+OneSignal.h" @implementation OneSignalLifecycleObserver From 598db820532443e99eebaa7e59484596196f2e96 Mon Sep 17 00:00:00 2001 From: Nan Date: Tue, 25 Nov 2025 00:15:12 -0800 Subject: [PATCH 7/9] chore(tests): Add ConsistencyManagerTestHelpers to tests * Has helper methods for repeating functionality --- .../OneSignal.xcodeproj/project.pbxproj | 4 ++ .../ConsistencyManagerTestHelpers.swift | 39 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 iOS_SDK/OneSignalSDK/OneSignalOSCoreMocks/ConsistencyManagerTestHelpers.swift diff --git a/iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj b/iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj index 7a6ae8b2d..14c827bd5 100644 --- a/iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj +++ b/iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj @@ -149,6 +149,7 @@ 3CA6CE0A28E4F19B00CA0585 /* OSUserRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CA6CE0928E4F19B00CA0585 /* OSUserRequest.swift */; }; 3CA8B8822BEC2FCB0010ADA1 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C7A39D42B7C18EE0082665E /* XCTest.framework */; }; 3CA8B8832BEC2FCB0010ADA1 /* XCTest.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3C7A39D42B7C18EE0082665E /* XCTest.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 3CBB6C262ED59CCC000FEB02 /* ConsistencyManagerTestHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CBB6C252ED59CCC000FEB02 /* ConsistencyManagerTestHelpers.swift */; }; 3CC063942B6D6B6B002BB07F /* OneSignalCore.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CC063932B6D6B6B002BB07F /* OneSignalCore.m */; }; 3CC063A22B6D7A8E002BB07F /* OneSignalCoreMocks.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3CC0639A2B6D7A8C002BB07F /* OneSignalCoreMocks.framework */; }; 3CC063A72B6D7A8E002BB07F /* OneSignalCoreTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CC063A62B6D7A8E002BB07F /* OneSignalCoreTests.swift */; }; @@ -1351,6 +1352,7 @@ 3C9AD6D02B228B9200BC1540 /* OSRequestRemoveAlias.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSRequestRemoveAlias.swift; sourceTree = ""; }; 3C9AD6D22B228BB000BC1540 /* OSRequestUpdateProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSRequestUpdateProperties.swift; sourceTree = ""; }; 3CA6CE0928E4F19B00CA0585 /* OSUserRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSUserRequest.swift; sourceTree = ""; }; + 3CBB6C252ED59CCC000FEB02 /* ConsistencyManagerTestHelpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConsistencyManagerTestHelpers.swift; sourceTree = ""; }; 3CC063932B6D6B6B002BB07F /* OneSignalCore.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OneSignalCore.m; sourceTree = ""; }; 3CC0639A2B6D7A8C002BB07F /* OneSignalCoreMocks.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OneSignalCoreMocks.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 3CC0639C2B6D7A8D002BB07F /* OneSignalCoreMocks.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OneSignalCoreMocks.h; sourceTree = ""; }; @@ -2205,6 +2207,7 @@ children = ( 3C8544B82C5AEFF700F542A9 /* OneSignalOSCoreMocks.h */, 3C8544C22C5AF18B00F542A9 /* OSCoreMocks.swift */, + 3CBB6C252ED59CCC000FEB02 /* ConsistencyManagerTestHelpers.swift */, 3CF11E3F2C6E6DE2002856F5 /* MockNewRecordsState.swift */, ); path = OneSignalOSCoreMocks; @@ -4337,6 +4340,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 3CBB6C262ED59CCC000FEB02 /* ConsistencyManagerTestHelpers.swift in Sources */, 3C8544C32C5AF18B00F542A9 /* OSCoreMocks.swift in Sources */, 3CF11E402C6E6DE2002856F5 /* MockNewRecordsState.swift in Sources */, ); diff --git a/iOS_SDK/OneSignalSDK/OneSignalOSCoreMocks/ConsistencyManagerTestHelpers.swift b/iOS_SDK/OneSignalSDK/OneSignalOSCoreMocks/ConsistencyManagerTestHelpers.swift new file mode 100644 index 000000000..53d105943 --- /dev/null +++ b/iOS_SDK/OneSignalSDK/OneSignalOSCoreMocks/ConsistencyManagerTestHelpers.swift @@ -0,0 +1,39 @@ +/* + Modified MIT License + + Copyright 2025 OneSignal + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + 1. The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + 2. All copies of substantial portions of the Software may only be used in connection + with services provided by OneSignal. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + */ + +import OneSignalOSCore + +public class ConsistencyManagerTestHelpers { + /// Unblocks the Consistency Manager, which allows fetching of IAMs for example. + public static func setDefaultRywToken(id: String) { + let key = OSIamFetchOffsetKey.userUpdate + let rywToken = "123" + let rywDelay: NSNumber = 0 + let rywData = OSReadYourWriteData(rywToken: rywToken, rywDelay: rywDelay) + OSConsistencyManager.shared.setRywTokenAndDelay(id: id, key: key, value: rywData) + } +} From 2dfbb326bd361fa4f6d410b91ad667dbe8029bd6 Mon Sep 17 00:00:00 2001 From: Nan Date: Tue, 28 Jan 2025 10:15:17 -0800 Subject: [PATCH 8/9] Add / migrate some existing IAM integration tests * Attempt to migrate `testDisablingIAMs_stillCreatesMessageQueue_butPreventsMessageDisplay` to new tests, but behavior has changed. It becomes `testPausingIAMs_doesNotCreateMessageQueue` * Migrate `testPreviewIAMIsDisplayedOnPause` --- .../IAMTestHelpers.swift | 16 +++- .../IAMIntegrationTests.swift | 86 +++++++++++++++++-- ...SignalInAppMessagesTests-Bridging-Header.h | 8 ++ .../InAppMessagingIntegrationTests.m | 2 + 4 files changed, 104 insertions(+), 8 deletions(-) diff --git a/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesMocks/IAMTestHelpers.swift b/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesMocks/IAMTestHelpers.swift index 8e66ded28..8bdee3073 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesMocks/IAMTestHelpers.swift +++ b/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesMocks/IAMTestHelpers.swift @@ -36,6 +36,9 @@ let OS_DUMMY_HTML = "

Hello World

" @objc public class IAMTestHelpers: NSObject { + + nonisolated(unsafe) static var messageIdIncrementer = 0 + /// Convert OSTriggerOperatorType enum to string private static func OS_OPERATOR_TO_STRING(_ type: Int32) -> String { // Trigger operator strings @@ -54,10 +57,12 @@ public class IAMTestHelpers: NSObject { return OS_OPERATOR_STRINGS[Int(type)] } + /// Returns the JSON of a minimal in-app message that can be used as a building block. @objc public static func testDefaultMessageJson() -> [String: Any] { + messageIdIncrementer += 1 return [ - "id": String(format: "%@_%i", OS_TEST_MESSAGE_ID, UUID().uuidString), + "id": String(format: "%@_%i", OS_TEST_MESSAGE_ID, messageIdIncrementer), "variants": [ "ios": [ "default": OS_TEST_MESSAGE_VARIANT_ID, @@ -71,6 +76,7 @@ public class IAMTestHelpers: NSObject { ] } + /// Returns the JSON of an in-app message with trigger. @objc public static func testMessageJsonWithTrigger(property: String, triggerId: String, type: Int32, value: Any) -> [String: Any] { var testMessage = self.testDefaultMessageJson() @@ -95,4 +101,12 @@ public class IAMTestHelpers: NSObject { "in_app_messages": messages ] } + + /// Returns the JSON of a preview or test in-app message. + @objc + public static func testMessagePreviewJson() -> [String: Any] { + var message = self.testDefaultMessageJson() + message["is_preview"] = true + return message + } } diff --git a/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesTests/IAMIntegrationTests.swift b/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesTests/IAMIntegrationTests.swift index 85bce1be2..19bafe842 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesTests/IAMIntegrationTests.swift +++ b/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesTests/IAMIntegrationTests.swift @@ -27,17 +27,89 @@ with services provided by OneSignal. import XCTest @testable import OneSignalInAppMessages +import OneSignalOSCore +import OneSignalUser +import OneSignalCoreMocks +import OneSignalOSCoreMocks +import OneSignalUserMocks +import OneSignalInAppMessagesMocks +/** + These tests can include some Obj-C InAppMessagingIntegrationTests migrations. + */ final class IAMIntegrationTests: XCTestCase { override func setUpWithError() throws { - // Put setup code here. This method is called before the invocation of each test method in the class. + OneSignalCoreMocks.clearUserDefaults() + OneSignalUserMocks.reset() + OSConsistencyManager.shared.reset() + // Temp. logging to help debug during testing + OneSignalLog.setLogLevel(.LL_VERBOSE) } - override func tearDownWithError() throws { - // Put teardown code here. This method is called after the invocation of each test method in the class. + + override func tearDownWithError() throws { } + + /** + Test IAMs should display even when IAMs are paused. + */ + func testPreviewIAMIsDisplayedOnPause() throws { + /* Setup */ + OneSignalCoreImpl.setSharedClient(MockOneSignalClient()) + // App ID is set because there are guards against nil App ID + OneSignalConfigManager.setAppId("test-app-id") + + // 1. Pause IAMs + OneSignalInAppMessages.__paused(true) + + // 2. Create a preview message + let messageJson = IAMTestHelpers.testMessagePreviewJson() + let message = OSInAppMessageInternal.instance(withJson: messageJson) + XCTAssertNotNil(message, "Preview message should be created successfully") + + // 3. Present the preview message + OSMessagingController.sharedInstance().present(inAppPreviewMessage: message) + + // 4. Verify that the preview IAM is showing even when paused + XCTAssertTrue(OSMessagingController.sharedInstance().isInAppMessageShowing) } - func testExample() throws { - OneSignalLog.setLogLevel(.LL_VERBOSE) - OneSignalInAppMessages.getFromServer("foobar") - // OSMessagingController.sharedInstance() + + /** + Pausing IAMs will not evaluate messages. + */ + func testPausingIAMs_doesNotCreateMessageQueue() throws { + /* Setup */ + + let client = MockOneSignalClient() + OneSignalCoreImpl.setSharedClient(client) + + // 1. App ID is set because there are guards against nil App ID + OneSignalConfigManager.setAppId("test-app-id") + + // 2. Set up mock responses for the anonymous user, as the user needs an OSID + MockUserRequests.setDefaultCreateAnonUserResponses(with: client) + + // 3. Set up mock responses for fetching IAMs + let message = IAMTestHelpers.testMessageJsonWithTrigger(property: "session_time", triggerId: "test_id1", type: 1, value: 10.0) + let response = IAMTestHelpers.testFetchMessagesResponse(messages: [message]) + client.setMockResponseForRequest( + request: "", + response: response) + + // 4. Unblock the Consistency Manager to allow fetching of IAMs + ConsistencyManagerTestHelpers.setDefaultRywToken(id: anonUserOSID) + + // 5. Pausing should prevent messages from being evaluated and shown + OneSignalInAppMessages.__paused(true) + + // 6. Start the user manager to generate a user instance + OneSignalUserManagerImpl.sharedInstance.start() + OneSignalCoreMocks.waitForBackgroundThreads(seconds: 0.5) + + // 7. Fetch IAMs + OneSignalInAppMessages.getFromServer(testPushSubId) + OneSignalCoreMocks.waitForBackgroundThreads(seconds: 0.5) + + // Make sure no IAM is showing, and the queue has no IAMs + XCTAssertFalse(OSMessagingController.sharedInstance().isInAppMessageShowing) + XCTAssertEqual(OSMessagingController.sharedInstance().messageDisplayQueue.count, 0) } } diff --git a/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesTests/OneSignalInAppMessagesTests-Bridging-Header.h b/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesTests/OneSignalInAppMessagesTests-Bridging-Header.h index 1b2cb5d6d..09e41dc7c 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesTests/OneSignalInAppMessagesTests-Bridging-Header.h +++ b/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesTests/OneSignalInAppMessagesTests-Bridging-Header.h @@ -2,3 +2,11 @@ // Use this file to import your target's public headers that you would like to expose to Swift. // +#import "OSInAppMessageInternal.h" +#import "OSMessagingController.h" + +// Expose private properties and methods for testing +@interface OSMessagingController (Testing) +@property (strong, nonatomic, nonnull) NSMutableArray *messageDisplayQueue; +- (void)presentInAppPreviewMessage:(OSInAppMessageInternal *)message; +@end diff --git a/iOS_SDK/OneSignalSDK/UnitTests/InAppMessagingIntegrationTests.m b/iOS_SDK/OneSignalSDK/UnitTests/InAppMessagingIntegrationTests.m index 9ae73b67f..9eef44c19 100644 --- a/iOS_SDK/OneSignalSDK/UnitTests/InAppMessagingIntegrationTests.m +++ b/iOS_SDK/OneSignalSDK/UnitTests/InAppMessagingIntegrationTests.m @@ -1422,6 +1422,7 @@ of this software and associated documentation files (the "Software"), to deal // XCTAssertTrue(action.promptActions[1].hasPrompted); // } +/// ✅ Migrated to `testPausingIAMs_doesNotCreateMessageQueue`... This test statement below is no longer true as of `5.2.9`. // - (void)testDisablingIAMs_stillCreatesMessageQueue_butPreventsMessageDisplay { // let message = [OSInAppMessageTestHelper testMessageJsonWithTriggerPropertyName:OS_DYNAMIC_TRIGGER_KIND_SESSION_TIME withId:@"test_id1" withOperator:OSTriggerOperatorTypeLessThan withValue:@10.0]; // let registrationResponse = [OSInAppMessageTestHelper testRegistrationJsonWithMessages:@[message]]; @@ -1440,6 +1441,7 @@ of this software and associated documentation files (the "Software"), to deal // XCTAssertEqual(OSMessagingControllerOverrider.messageDisplayQueue.count, 1); // } +/// ✅ Migrated to `testPreviewIAMIsDisplayedOnPause` // /* // Test IAMs should display even when IAMs are paused // */ From 22674652da14ba020edf5383b2755f7af373c486 Mon Sep 17 00:00:00 2001 From: Nan Date: Mon, 1 Dec 2025 13:58:40 -0800 Subject: [PATCH 9/9] address PR feedback * `messageViewImpressionRequest` was removed from the `OSMessagingController` header file, so update `OSMessagingControllerOverrider` to expose it for internal usage. * Delete old tests that have been migrated --- .../InAppMessagingIntegrationTests.m | 33 ------------------- .../Shadows/OSMessagingControllerOverrider.m | 3 +- 2 files changed, 2 insertions(+), 34 deletions(-) diff --git a/iOS_SDK/OneSignalSDK/UnitTests/InAppMessagingIntegrationTests.m b/iOS_SDK/OneSignalSDK/UnitTests/InAppMessagingIntegrationTests.m index 9eef44c19..9fbc63777 100644 --- a/iOS_SDK/OneSignalSDK/UnitTests/InAppMessagingIntegrationTests.m +++ b/iOS_SDK/OneSignalSDK/UnitTests/InAppMessagingIntegrationTests.m @@ -1422,39 +1422,6 @@ of this software and associated documentation files (the "Software"), to deal // XCTAssertTrue(action.promptActions[1].hasPrompted); // } -/// ✅ Migrated to `testPausingIAMs_doesNotCreateMessageQueue`... This test statement below is no longer true as of `5.2.9`. -// - (void)testDisablingIAMs_stillCreatesMessageQueue_butPreventsMessageDisplay { -// let message = [OSInAppMessageTestHelper testMessageJsonWithTriggerPropertyName:OS_DYNAMIC_TRIGGER_KIND_SESSION_TIME withId:@"test_id1" withOperator:OSTriggerOperatorTypeLessThan withValue:@10.0]; -// let registrationResponse = [OSInAppMessageTestHelper testRegistrationJsonWithMessages:@[message]]; - -// // this should prevent message from being shown -// [OneSignal pauseInAppMessages:true]; - -// // the trigger should immediately evaluate to true and should -// // be shown once the SDK is fully initialized. -// [OneSignalClientOverrider setMockResponseForRequest:NSStringFromClass([OSRequestRegisterUser class]) withResponse:registrationResponse]; - -// [UnitTestCommonMethods initOneSignal_andThreadWait]; - -// // Make sure no IAM is showing, but the queue has any IAMs -// XCTAssertFalse(OSMessagingControllerOverrider.isInAppMessageShowing); -// XCTAssertEqual(OSMessagingControllerOverrider.messageDisplayQueue.count, 1); -// } - -/// ✅ Migrated to `testPreviewIAMIsDisplayedOnPause` -// /* -// Test IAMs should display even when IAMs are paused -// */ -// - (void)testPreviewIAMIsDisplayedOnPause { -// [OneSignal pauseInAppMessages:true]; - -// let message = [OSInAppMessageTestHelper testMessageWithPreview]; - -// [self initOneSignalWithInAppMessage:message]; - -// XCTAssertTrue(OSMessagingControllerOverrider.isInAppMessageShowing); -// } - // - (void)testInAppMessageIdTracked { // [OneSignal pauseInAppMessages:false]; diff --git a/iOS_SDK/OneSignalSDK/UnitTests/Shadows/OSMessagingControllerOverrider.m b/iOS_SDK/OneSignalSDK/UnitTests/Shadows/OSMessagingControllerOverrider.m index 239700648..6443fb02b 100644 --- a/iOS_SDK/OneSignalSDK/UnitTests/Shadows/OSMessagingControllerOverrider.m +++ b/iOS_SDK/OneSignalSDK/UnitTests/Shadows/OSMessagingControllerOverrider.m @@ -46,6 +46,7 @@ @interface OSMessagingController () @property (strong, nonatomic, nonnull) NSMutableSet *clickedClickIds; @property (nonatomic, readwrite) NSTimeInterval (^dateGenerator)(void); @property (nonatomic, nullable) NSObject*currentPromptAction; +- (void)messageViewImpressionRequest:(OSInAppMessageInternal *)message; @end @@ -112,7 +113,7 @@ - (void)overrideShowMessage:(OSInAppMessageInternal *)message { - (void)overrideWebViewContentFinishedLoading:(OSInAppMessageInternal *)message { if (message) { - // [OSMessagingController.sharedInstance messageViewImpressionRequest:message]; + [OSMessagingController.sharedInstance messageViewImpressionRequest:message]; } }