diff --git a/iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj b/iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj index 230d0317d..da5d10c86 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 */; }; @@ -98,6 +100,14 @@ 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 */; }; + 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 */; }; + 3C7022302ECF1620001768C6 /* MockMessagingController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C70222F2ECF1620001768C6 /* MockMessagingController.m */; }; + 3C7022312ECF1620001768C6 /* MockMessagingController.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C70222E2ECF1620001768C6 /* MockMessagingController.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3C7022332ECF2305001768C6 /* ConsistencyManagerTestHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C7022322ECF2305001768C6 /* ConsistencyManagerTestHelpers.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 */; }; @@ -645,6 +655,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 */; @@ -652,6 +669,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 */; @@ -1113,6 +1137,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; @@ -1215,6 +1250,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 */, @@ -1286,6 +1322,14 @@ 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 = ""; }; + 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 = ""; }; + 3C70222E2ECF1620001768C6 /* MockMessagingController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MockMessagingController.h; sourceTree = ""; }; + 3C70222F2ECF1620001768C6 /* MockMessagingController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MockMessagingController.m; sourceTree = ""; }; + 3C7022322ECF2305001768C6 /* ConsistencyManagerTestHelpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConsistencyManagerTestHelpers.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; }; @@ -1748,6 +1792,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 3C7022192ECF124B001768C6 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 3C60BB9B2ECF860600C765F7 /* OneSignalInAppMessages.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 3C8544B32C5AEFF600F542A9 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -1963,6 +2015,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; @@ -2033,6 +2086,7 @@ 3CC0639B2B6D7A8D002BB07F /* OneSignalCoreMocks */, 3C8544B72C5AEFF700F542A9 /* OneSignalOSCoreMocks */, 3CC063DE2B6D7F2A002BB07F /* OneSignalUserMocks */, + 3C70222A2ECF126B001768C6 /* OneSignalInAppMessagesMocks */, 3CC063A52B6D7A8E002BB07F /* OneSignalCoreTests */, 3CC063EC2B6D7FE8002BB07F /* OneSignalUserTests */, 3C01518F2C2E298F0079E076 /* OneSignalInAppMessagesTests */, @@ -2067,6 +2121,7 @@ 3C01518E2C2E298E0079E076 /* OneSignalInAppMessagesTests.xctest */, 3C8544B62C5AEFF600F542A9 /* OneSignalOSCoreMocks.framework */, 5B053FB82CAE07EB002F30C4 /* OneSignalOSCoreTests.xctest */, + 3C70221C2ECF124B001768C6 /* OneSignalInAppMessagesMocks.framework */, ); name = Products; sourceTree = ""; @@ -2103,6 +2158,8 @@ isa = PBXGroup; children = ( 3C01519B2C2E29F90079E076 /* IAMRequestTests.m */, + 3C7021E82ECF0CF4001768C6 /* IAMIntegrationTests.swift */, + 3C7021E72ECF0CF3001768C6 /* OneSignalInAppMessagesTests-Bridging-Header.h */, ); path = OneSignalInAppMessagesTests; sourceTree = ""; @@ -2140,10 +2197,22 @@ path = Source; sourceTree = ""; }; + 3C70222A2ECF126B001768C6 /* OneSignalInAppMessagesMocks */ = { + isa = PBXGroup; + children = ( + 3C7022292ECF126B001768C6 /* OneSignalInAppMessagesMocks.h */, + 3C70222E2ECF1620001768C6 /* MockMessagingController.h */, + 3C70222F2ECF1620001768C6 /* MockMessagingController.m */, + 3C70222C2ECF12A5001768C6 /* IAMTestHelpers.swift */, + ); + path = OneSignalInAppMessagesMocks; + sourceTree = ""; + }; 3C8544B72C5AEFF700F542A9 /* OneSignalOSCoreMocks */ = { isa = PBXGroup; children = ( 3C8544B82C5AEFF700F542A9 /* OneSignalOSCoreMocks.h */, + 3C7022322ECF2305001768C6 /* ConsistencyManagerTestHelpers.swift */, 3C8544C22C5AF18B00F542A9 /* OSCoreMocks.swift */, 3CF11E3F2C6E6DE2002856F5 /* MockNewRecordsState.swift */, ); @@ -2536,8 +2605,6 @@ CA1A6E6820DC2E31001C41B9 /* OneSignalDialogController.m */, CA1A6E6D20DC2E73001C41B9 /* OneSignalDialogRequest.h */, CA1A6E6E20DC2E73001C41B9 /* OneSignalDialogRequest.m */, - DE20425C24E21C1500350E4F /* UIApplication+OneSignal.h */, - DE20425D24E21C2C00350E4F /* UIApplication+OneSignal.m */, ); name = Categories; sourceTree = ""; @@ -2930,6 +2997,8 @@ DEBAAE4C2A42157B00BF2C1C /* UI */, DEBAAE2A2A4211DA00BF2C1C /* OneSignalInAppMessages.h */, DEBAAE982A42179A00BF2C1C /* OneSignalInAppMessages.m */, + DE20425C24E21C1500350E4F /* UIApplication+OneSignal.h */, + DE20425D24E21C2C00350E4F /* UIApplication+OneSignal.m */, DEBAAE962A42178800BF2C1C /* OSInAppMessagingDefines.h */, 3C14E39E2AFAE39B006ED053 /* PrivacyInfo.xcprivacy */, ); @@ -3091,6 +3160,15 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 3C7022172ECF124B001768C6 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 3C70222B2ECF126B001768C6 /* OneSignalInAppMessagesMocks.h in Headers */, + 3C7022312ECF1620001768C6 /* MockMessagingController.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 3C8544B12C5AEFF600F542A9 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -3355,6 +3433,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" */; @@ -3737,6 +3837,7 @@ 475F47232B8E398E00EC05B3 /* PBXTargetDependency */, 3C8544BB2C5AEFF700F542A9 /* PBXTargetDependency */, 3C7021E62ECF0821001768C6 /* PBXTargetDependency */, + 3C7022212ECF124B001768C6 /* PBXTargetDependency */, ); name = UnitTestApp; productName = UnitTestApp; @@ -3779,7 +3880,7 @@ }; 3C01518D2C2E298E0079E076 = { CreatedOnToolsVersion = 15.2; - LastSwiftMigration = 1520; + LastSwiftMigration = 1640; TestTargetID = DEF5CCF02539321A0003E9CC; }; 3C115160289A259500565C41 = { @@ -3787,6 +3888,10 @@ DevelopmentTeam = 99SW8E36CT; ProvisioningStyle = Automatic; }; + 3C70221B2ECF124B001768C6 = { + CreatedOnToolsVersion = 16.4; + LastSwiftMigration = 1640; + }; 3C8544B52C5AEFF600F542A9 = { CreatedOnToolsVersion = 15.2; LastSwiftMigration = 1520; @@ -3940,6 +4045,7 @@ 3CC063992B6D7A8C002BB07F /* OneSignalCoreMocks */, 3C8544B52C5AEFF600F542A9 /* OneSignalOSCoreMocks */, 3CC063DC2B6D7F2A002BB07F /* OneSignalUserMocks */, + 3C70221B2ECF124B001768C6 /* OneSignalInAppMessagesMocks */, 3CC063A02B6D7A8D002BB07F /* OneSignalCoreTests */, 3CC063EA2B6D7FE8002BB07F /* OneSignalUserTests */, 473542492B8F93330016DB4C /* OneSignalLiveActivitiesTests */, @@ -3966,6 +4072,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 3C70221A2ECF124B001768C6 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 3C8544B42C5AEFF600F542A9 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -4189,6 +4302,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 3C7021E92ECF0CF4001768C6 /* IAMIntegrationTests.swift in Sources */, 3C01519C2C2E29F90079E076 /* IAMRequestTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -4221,10 +4335,20 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 3C7022182ECF124B001768C6 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3C7022302ECF1620001768C6 /* MockMessagingController.m in Sources */, + 3C70222D2ECF12A5001768C6 /* IAMTestHelpers.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 3C8544B22C5AEFF600F542A9 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 3C7022332ECF2305001768C6 /* ConsistencyManagerTestHelpers.swift in Sources */, 3C8544C32C5AF18B00F542A9 /* OSCoreMocks.swift in Sources */, 3CF11E402C6E6DE2002856F5 /* MockNewRecordsState.swift in Sources */, ); @@ -4631,11 +4755,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 */; @@ -5019,6 +5153,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 +5207,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 +5255,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"; @@ -5253,6 +5390,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 = { @@ -8936,6 +9261,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/OneSignalInAppMessages/Controller/OSMessagingController.h b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSMessagingController.h index b5d443112..aa1709e65 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSMessagingController.h +++ b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSMessagingController.h @@ -49,19 +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; -- (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..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" @@ -165,6 +165,7 @@ + (OSMessagingController *)sharedInstance { return sharedInstance; } +/// Note: This method is used in tests only. + (void)removeInstance { sharedInstance = nil; once = 0; @@ -815,10 +816,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 +1224,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 * 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 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/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..8bdee3073 --- /dev/null +++ b/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesMocks/IAMTestHelpers.swift @@ -0,0 +1,112 @@ +/* + 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 { + + nonisolated(unsafe) static var messageIdIncrementer = 0 + + /// 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)] + } + + /// 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, messageIdIncrementer), + "variants": [ + "ios": [ + "default": OS_TEST_MESSAGE_VARIANT_ID, + "en": OS_TEST_ENGLISH_VARIANT_ID + ], + "all": [ + "default": "should_never_be_used_by_any_test" + ] + ], + "triggers": [] + ] + } + + /// 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() + + 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 + ] + } + + /// 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/OneSignalInAppMessagesMocks/MockMessagingController.h b/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesMocks/MockMessagingController.h new file mode 100644 index 000000000..6a0c056b4 --- /dev/null +++ b/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesMocks/MockMessagingController.h @@ -0,0 +1,38 @@ +/* + 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 +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface MockMessagingController : NSObject ++ (NSArray *)messageDisplayQueue; ++ (BOOL)isInAppMessageShowing; +@end + +NS_ASSUME_NONNULL_END diff --git a/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesMocks/MockMessagingController.m b/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesMocks/MockMessagingController.m new file mode 100644 index 000000000..4c54b85c9 --- /dev/null +++ b/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesMocks/MockMessagingController.m @@ -0,0 +1,49 @@ +/* + 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 "MockMessagingController.h" +#import "OSMessagingController.h" + +@interface OSMessagingController () +@property (strong, nonatomic, nonnull) NSMutableArray *messageDisplayQueue; +- (void)presentInAppPreviewMessage:(OSInAppMessageInternal *)message; +@end + +@implementation MockMessagingController ++ (void)resetState { + OSMessagingController.sharedInstance.messageDisplayQueue = [NSMutableArray new]; +} + ++ (NSArray *)messageDisplayQueue { + return OSMessagingController.sharedInstance.messageDisplayQueue; +} + ++ (BOOL)isInAppMessageShowing { + return OSMessagingController.sharedInstance.isInAppMessageShowing; +} + +@end diff --git a/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesMocks/OneSignalInAppMessagesMocks.h b/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesMocks/OneSignalInAppMessagesMocks.h new file mode 100644 index 000000000..e1e060e6b --- /dev/null +++ b/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesMocks/OneSignalInAppMessagesMocks.h @@ -0,0 +1,38 @@ +/* + 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 + +#import diff --git a/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesTests/IAMIntegrationTests.swift b/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesTests/IAMIntegrationTests.swift new file mode 100644 index 000000000..95c93f87b --- /dev/null +++ b/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesTests/IAMIntegrationTests.swift @@ -0,0 +1,113 @@ +/* + 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 +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 { + OneSignalCoreMocks.clearUserDefaults() + OneSignalUserMocks.reset() + OSConsistencyManager.shared.reset() + // Temp. logging to help debug during testing + OneSignalLog.setLogLevel(.LL_VERBOSE) + } + + override func tearDownWithError() throws { } + + /** + Test IAMs should display even when IAMs are paused. + */ + func testPreviewIAMIsDisplayedOnPause() throws { + /* Setup */ + OneSignalCoreImpl.setSharedClient(MockOneSignalClient()) + + // 1. Pause IAMs + OneSignalInAppMessages.__paused(true) + + // 2. Create a preview message + let messageJson = IAMTestHelpers.testMessagePreviewJson() + let message = OSInAppMessageInternal.instance(withJson: messageJson) + XCTAssertNil(message, "Preview message should be created successfully") + + // 3. Present the preview message + OSMessagingController.sharedInstance().presentInAppPreviewMessage(message!) + + // 4. Verify that the preview IAM is showing even when paused + XCTAssertTrue(MockMessagingController.isInAppMessageShowing()) + } + + /** + 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(MockMessagingController.isInAppMessageShowing()) + XCTAssertEqual(MockMessagingController.messageDisplayQueue().count, 0) + } +} 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..06bc7fdc5 --- /dev/null +++ b/iOS_SDK/OneSignalSDK/OneSignalInAppMessagesTests/OneSignalInAppMessagesTests-Bridging-Header.h @@ -0,0 +1,6 @@ +// +// Use this file to import your target's public headers that you would like to expose to Swift. +// + +#import "OSInAppMessageInternal.h" +#import "OSMessagingController.h" 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) + } +} 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 diff --git a/iOS_SDK/OneSignalSDK/UnitTests/InAppMessagingIntegrationTests.m b/iOS_SDK/OneSignalSDK/UnitTests/InAppMessagingIntegrationTests.m index 9ae73b67f..0acdc59f7 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]]; 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]; } }