diff --git a/iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj b/iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj index 5fa832dac..489e7e613 100644 --- a/iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj +++ b/iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj @@ -427,8 +427,27 @@ DE20426024E21C2C00350E4F /* UIApplication+OneSignal.m in Sources */ = {isa = PBXBuildFile; fileRef = DE20425D24E21C2C00350E4F /* UIApplication+OneSignal.m */; }; DE5EFECA24D8DBF70032632D /* OSInAppMessageViewControllerOverrider.m in Sources */ = {isa = PBXBuildFile; fileRef = DE5EFEC924D8DBF70032632D /* OSInAppMessageViewControllerOverrider.m */; }; DEE8198D24E21DF000868CBA /* UIApplication+OneSignal.h in Headers */ = {isa = PBXBuildFile; fileRef = DE20425C24E21C1500350E4F /* UIApplication+OneSignal.h */; }; + DEF5CCF52539321A0003E9CC /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = DEF5CCF42539321A0003E9CC /* AppDelegate.m */; }; + DEF5CCFB2539321A0003E9CC /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DEF5CCFA2539321A0003E9CC /* ViewController.m */; }; + DEF5CCFE2539321A0003E9CC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DEF5CCFC2539321A0003E9CC /* Main.storyboard */; }; + DEF5CD002539321D0003E9CC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DEF5CCFF2539321D0003E9CC /* Assets.xcassets */; }; + DEF5CD032539321D0003E9CC /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DEF5CD012539321D0003E9CC /* LaunchScreen.storyboard */; }; + DEF5CD062539321D0003E9CC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = DEF5CD052539321D0003E9CC /* main.m */; }; + DEF5CD4F253934350003E9CC /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 37E6B2BA19D9CAF300D0C601 /* UIKit.framework */; }; + DEF5CD502539343C0003E9CC /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E464ED91D88EE6A00DCF7E9 /* Foundation.framework */; }; + DEF5CD52253934410003E9CC /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DEF5CD51253934410003E9CC /* CoreFoundation.framework */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + DEF5CD11253932260003E9CC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 37747F8B19147D6400558FAD /* Project object */; + proxyType = 1; + remoteGlobalIDString = DEF5CCF02539321A0003E9CC; + remoteInfo = UnitTestApp; + }; +/* End PBXContainerItemProxy section */ + /* Begin PBXCopyFilesBuildPhase section */ 37747F9119147D6500558FAD /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; @@ -704,6 +723,18 @@ DE20425D24E21C2C00350E4F /* UIApplication+OneSignal.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIApplication+OneSignal.m"; sourceTree = ""; }; DE5EFEC924D8DBF70032632D /* OSInAppMessageViewControllerOverrider.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OSInAppMessageViewControllerOverrider.m; sourceTree = ""; }; DE5EFECB24D8DC0E0032632D /* OSInAppMessageViewControllerOverrider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSInAppMessageViewControllerOverrider.h; sourceTree = ""; }; + DEF5CCF12539321A0003E9CC /* UnitTestApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UnitTestApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; + DEF5CCF32539321A0003E9CC /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + DEF5CCF42539321A0003E9CC /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + DEF5CCF92539321A0003E9CC /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + DEF5CCFA2539321A0003E9CC /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + DEF5CCFD2539321A0003E9CC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + DEF5CCFF2539321D0003E9CC /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + DEF5CD022539321D0003E9CC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + DEF5CD042539321D0003E9CC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + DEF5CD052539321D0003E9CC /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + DEF5CD51253934410003E9CC /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; + DEF5CD6A253935720003E9CC /* UnitTestApp.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = UnitTestApp.entitlements; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -741,6 +772,16 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + DEF5CCEE2539321A0003E9CC /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + DEF5CD52253934410003E9CC /* CoreFoundation.framework in Frameworks */, + DEF5CD502539343C0003E9CC /* Foundation.framework in Frameworks */, + DEF5CD4F253934350003E9CC /* UIKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -761,6 +802,7 @@ 912411EE1E73342200E41FD7 /* Source */, CA08FC701FE99AE6004C445F /* API */, 911E2CBB1E398AB3003112A4 /* UnitTests */, + DEF5CCF22539321A0003E9CC /* UnitTestApp */, 37747F9519147D6500558FAD /* Frameworks */, 3E2400391D4FFC31008BDE70 /* OneSignalFramework */, 37747F9419147D6500558FAD /* Products */, @@ -773,6 +815,7 @@ 37747F9319147D6500558FAD /* libOneSignal.a */, 3E2400381D4FFC31008BDE70 /* OneSignal.framework */, 911E2CBA1E398AB3003112A4 /* UnitTests.xctest */, + DEF5CCF12539321A0003E9CC /* UnitTestApp.app */, ); name = Products; sourceTree = ""; @@ -780,6 +823,7 @@ 37747F9519147D6500558FAD /* Frameworks */ = { isa = PBXGroup; children = ( + DEF5CD51253934410003E9CC /* CoreFoundation.framework */, 9D348536233C669E00EB81C9 /* CoreLocation.framework */, 9D3300F923149DAE000F0A83 /* CoreGraphics.framework */, CACBAAAB218A662B000ACAA5 /* WebKit.framework */, @@ -1268,6 +1312,23 @@ name = InAppMessaging; sourceTree = ""; }; + DEF5CCF22539321A0003E9CC /* UnitTestApp */ = { + isa = PBXGroup; + children = ( + DEF5CD6A253935720003E9CC /* UnitTestApp.entitlements */, + DEF5CCF32539321A0003E9CC /* AppDelegate.h */, + DEF5CCF42539321A0003E9CC /* AppDelegate.m */, + DEF5CCF92539321A0003E9CC /* ViewController.h */, + DEF5CCFA2539321A0003E9CC /* ViewController.m */, + DEF5CCFC2539321A0003E9CC /* Main.storyboard */, + DEF5CCFF2539321D0003E9CC /* Assets.xcassets */, + DEF5CD012539321D0003E9CC /* LaunchScreen.storyboard */, + DEF5CD042539321D0003E9CC /* Info.plist */, + DEF5CD052539321D0003E9CC /* main.m */, + ); + path = UnitTestApp; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -1402,12 +1463,30 @@ buildRules = ( ); dependencies = ( + DEF5CD12253932260003E9CC /* PBXTargetDependency */, ); name = UnitTests; productName = UnitTests; productReference = 911E2CBA1E398AB3003112A4 /* UnitTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; + DEF5CCF02539321A0003E9CC /* UnitTestApp */ = { + isa = PBXNativeTarget; + buildConfigurationList = DEF5CD072539321D0003E9CC /* Build configuration list for PBXNativeTarget "UnitTestApp" */; + buildPhases = ( + DEF5CCED2539321A0003E9CC /* Sources */, + DEF5CCEE2539321A0003E9CC /* Frameworks */, + DEF5CCEF2539321A0003E9CC /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = UnitTestApp; + productName = UnitTestApp; + productReference = DEF5CCF12539321A0003E9CC /* UnitTestApp.app */; + productType = "com.apple.product-type.application"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -1427,6 +1506,7 @@ CreatedOnToolsVersion = 8.1; DevelopmentTeam = 99SW8E36CT; ProvisioningStyle = Automatic; + TestTargetID = DEF5CCF02539321A0003E9CC; }; CA2951BD2167F9860064227A = { DevelopmentTeam = 4ZR3G6ZK9T; @@ -1441,6 +1521,11 @@ DevelopmentTeam = 4ZR3G6ZK9T; ProvisioningStyle = Automatic; }; + DEF5CCF02539321A0003E9CC = { + CreatedOnToolsVersion = 12.0.1; + DevelopmentTeam = 99SW8E36CT; + ProvisioningStyle = Automatic; + }; }; }; buildConfigurationList = 37747F8E19147D6400558FAD /* Build configuration list for PBXProject "OneSignal" */; @@ -1450,6 +1535,7 @@ knownRegions = ( English, en, + Base, ); mainGroup = 37747F8A19147D6400558FAD; productRefGroup = 37747F9419147D6500558FAD /* Products */; @@ -1462,6 +1548,7 @@ CAA98897213F4B34009FEE5E /* OneSignal-Dynamic-Framework */, CA2951BD2167F9860064227A /* OneSignal-Static-Framework */, DEC2EA8E24B7B63800C1FD34 /* OneSignal-XCFramework */, + DEF5CCF02539321A0003E9CC /* UnitTestApp */, ); }; /* End PBXProject section */ @@ -1481,6 +1568,16 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + DEF5CCEF2539321A0003E9CC /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DEF5CD032539321D0003E9CC /* LaunchScreen.storyboard in Resources */, + DEF5CD002539321D0003E9CC /* Assets.xcassets in Resources */, + DEF5CCFE2539321A0003E9CC /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ @@ -1842,8 +1939,45 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + DEF5CCED2539321A0003E9CC /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DEF5CCFB2539321A0003E9CC /* ViewController.m in Sources */, + DEF5CCF52539321A0003E9CC /* AppDelegate.m in Sources */, + DEF5CD062539321D0003E9CC /* main.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + DEF5CD12253932260003E9CC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = DEF5CCF02539321A0003E9CC /* UnitTestApp */; + targetProxy = DEF5CD11253932260003E9CC /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + DEF5CCFC2539321A0003E9CC /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + DEF5CCFD2539321A0003E9CC /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + DEF5CD012539321D0003E9CC /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + DEF5CD022539321D0003E9CC /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + /* Begin XCBuildConfiguration section */ CA2951B62167F4120064227A /* Release */ = { isa = XCBuildConfiguration; @@ -1950,6 +2084,7 @@ CA2951B92167F4120064227A /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; CLANG_ANALYZER_NONNULL = YES; CLANG_ENABLE_MODULES = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; @@ -1959,6 +2094,7 @@ COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = 99SW8E36CT; + ENABLE_TESTABILITY = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = OS_TEST; INFOPLIST_FILE = UnitTests/Info.plist; @@ -1967,6 +2103,7 @@ MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.UnitTests; PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/UnitTestApp.app/UnitTestApp"; }; name = Release; }; @@ -2101,6 +2238,7 @@ CA2951C52167FB950064227A /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; CLANG_ANALYZER_NONNULL = YES; CLANG_ENABLE_MODULES = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; @@ -2110,6 +2248,7 @@ COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = 99SW8E36CT; + ENABLE_TESTABILITY = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = OS_TEST; INFOPLIST_FILE = UnitTests/Info.plist; @@ -2118,6 +2257,7 @@ MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.UnitTests; PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/UnitTestApp.app/UnitTestApp"; }; name = Debug; }; @@ -2173,6 +2313,95 @@ }; name = Debug; }; + DEF5CD082539321D0003E9CC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD)"; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + 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_ENTITLEMENTS = UnitTestApp/UnitTestApp.entitlements; + CODE_SIGN_STYLE = Automatic; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = 99SW8E36CT; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = UnitTestApp/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example.UnitTestApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + DEF5CD092539321D0003E9CC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD)"; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + 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_ENTITLEMENTS = UnitTestApp/UnitTestApp.entitlements; + CODE_SIGN_STYLE = Automatic; + COPY_PHASE_STRIP = NO; + DEVELOPMENT_TEAM = 99SW8E36CT; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = UnitTestApp/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = NO; + PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example.UnitTestApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -2239,6 +2468,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + DEF5CD072539321D0003E9CC /* Build configuration list for PBXNativeTarget "UnitTestApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DEF5CD082539321D0003E9CC /* Release */, + DEF5CD092539321D0003E9CC /* Debug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = 37747F8B19147D6400558FAD /* Project object */; diff --git a/iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/xcshareddata/xcschemes/UnitTestApp.xcscheme b/iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/xcshareddata/xcschemes/UnitTestApp.xcscheme new file mode 100644 index 000000000..f032e6372 --- /dev/null +++ b/iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/xcshareddata/xcschemes/UnitTestApp.xcscheme @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iOS_SDK/OneSignalSDK/Source/OSChannelTracker.h b/iOS_SDK/OneSignalSDK/Source/OSChannelTracker.h index 8a452a98c..7502d90bd 100644 --- a/iOS_SDK/OneSignalSDK/Source/OSChannelTracker.h +++ b/iOS_SDK/OneSignalSDK/Source/OSChannelTracker.h @@ -33,7 +33,7 @@ THE SOFTWARE. @interface OSChannelTracker : NSObject -@property (nonatomic, readwrite) Session influenceType; +@property (nonatomic, readwrite) OSSession influenceType; @property (strong, nonatomic, readwrite, nullable) NSString *directId; @property (strong, nonatomic, readwrite, nullable) NSArray *indirectIds; @property (strong, nonatomic, readonly, nonnull) OSInfluenceDataRepository *dataRepository; diff --git a/iOS_SDK/OneSignalSDK/Source/OSIndirectInfluence.h b/iOS_SDK/OneSignalSDK/Source/OSIndirectInfluence.h index 18b6d2e54..04a5eee30 100644 --- a/iOS_SDK/OneSignalSDK/Source/OSIndirectInfluence.h +++ b/iOS_SDK/OneSignalSDK/Source/OSIndirectInfluence.h @@ -1,21 +1,21 @@ /** Modified MIT License - + Copyright 2019 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 diff --git a/iOS_SDK/OneSignalSDK/Source/OSInfluence.h b/iOS_SDK/OneSignalSDK/Source/OSInfluence.h index 300f47597..acfaa63a1 100644 --- a/iOS_SDK/OneSignalSDK/Source/OSInfluence.h +++ b/iOS_SDK/OneSignalSDK/Source/OSInfluence.h @@ -33,7 +33,7 @@ THE SOFTWARE. @interface OSInfluenceBuilder : NSObject @property (nonatomic) OSInfluenceChannel influenceChannel; -@property (nonatomic) Session influenceType; +@property (nonatomic) OSSession influenceType; @property (nonatomic, copy) NSArray * _Nullable ids; @end @@ -41,7 +41,7 @@ THE SOFTWARE. @interface OSInfluence : NSObject @property (nonatomic, readonly) OSInfluenceChannel influenceChannel; -@property (nonatomic, readonly) Session influenceType; +@property (nonatomic, readonly) OSSession influenceType; @property (nonatomic, readwrite) NSArray * _Nullable ids; - (id _Nonnull)initWithBuilder:(OSInfluenceBuilder * _Nonnull)builder; diff --git a/iOS_SDK/OneSignalSDK/Source/OSInfluence.m b/iOS_SDK/OneSignalSDK/Source/OSInfluence.m index 1e0d00fb1..48427e4cd 100644 --- a/iOS_SDK/OneSignalSDK/Source/OSInfluence.m +++ b/iOS_SDK/OneSignalSDK/Source/OSInfluence.m @@ -40,7 +40,7 @@ - (instancetype)init @implementation OSInfluence -- (id)initWithInfluenceType:(Session)influenceType +- (id)initWithInfluenceType:(OSSession)influenceType forInfluenceChannel:(OSInfluenceChannel)influenceChannel withIds:(NSArray *)ids { if (self = [super init]) { diff --git a/iOS_SDK/OneSignalSDK/Source/OSInfluenceDataRepository.h b/iOS_SDK/OneSignalSDK/Source/OSInfluenceDataRepository.h index 0e29b9a0b..15edc48d6 100644 --- a/iOS_SDK/OneSignalSDK/Source/OSInfluenceDataRepository.h +++ b/iOS_SDK/OneSignalSDK/Source/OSInfluenceDataRepository.h @@ -32,11 +32,11 @@ THE SOFTWARE. @interface OSInfluenceDataRepository : NSObject -- (void)cacheNotificationInfluenceType:(Session) influenceType; -- (Session)notificationCachedInfluenceType; +- (void)cacheNotificationInfluenceType:(OSSession) influenceType; +- (OSSession)notificationCachedInfluenceType; -- (void)cacheIAMInfluenceType:(Session) influenceType; -- (Session)iamCachedInfluenceType; +- (void)cacheIAMInfluenceType:(OSSession) influenceType; +- (OSSession)iamCachedInfluenceType; - (void)cacheNotificationOpenId:(NSString * _Nullable)notificationId; - (NSString * _Nullable)cachedNotificationOpenId; diff --git a/iOS_SDK/OneSignalSDK/Source/OSInfluenceDataRepository.m b/iOS_SDK/OneSignalSDK/Source/OSInfluenceDataRepository.m index 10d8d7aa3..e48ddb7a7 100644 --- a/iOS_SDK/OneSignalSDK/Source/OSInfluenceDataRepository.m +++ b/iOS_SDK/OneSignalSDK/Source/OSInfluenceDataRepository.m @@ -33,20 +33,20 @@ of this software and associated documentation files (the "Software"), to deal @implementation OSInfluenceDataRepository -- (void)cacheNotificationInfluenceType:(Session) influenceType { +- (void)cacheNotificationInfluenceType:(OSSession) influenceType { [OneSignalUserDefaults.initShared saveStringForKey:OSUD_CACHED_NOTIFICATION_INFLUENCE withValue:OS_INFLUENCE_TYPE_TO_STRING(influenceType)]; } -- (Session)notificationCachedInfluenceType { +- (OSSession)notificationCachedInfluenceType { NSString *sessionString = [OneSignalUserDefaults.initShared getSavedStringForKey:OSUD_CACHED_NOTIFICATION_INFLUENCE defaultValue:OS_INFLUENCE_TYPE_TO_STRING(UNATTRIBUTED)]; return OS_INFLUENCE_TYPE_FROM_STRING(sessionString); } -- (void)cacheIAMInfluenceType:(Session) influenceType { +- (void)cacheIAMInfluenceType:(OSSession) influenceType { [OneSignalUserDefaults.initShared saveStringForKey:OSUD_CACHED_IAM_INFLUENCE withValue:OS_INFLUENCE_TYPE_TO_STRING(influenceType)]; } -- (Session)iamCachedInfluenceType { +- (OSSession)iamCachedInfluenceType { NSString *sessionString = [OneSignalUserDefaults.initShared getSavedStringForKey:OSUD_CACHED_IAM_INFLUENCE defaultValue:OS_INFLUENCE_TYPE_TO_STRING(UNATTRIBUTED)]; return OS_INFLUENCE_TYPE_FROM_STRING(sessionString); } diff --git a/iOS_SDK/OneSignalSDK/Source/OSNotificationTracker.m b/iOS_SDK/OneSignalSDK/Source/OSNotificationTracker.m index 122da1ded..7aa6e3fb0 100644 --- a/iOS_SDK/OneSignalSDK/Source/OSNotificationTracker.m +++ b/iOS_SDK/OneSignalSDK/Source/OSNotificationTracker.m @@ -66,7 +66,7 @@ - (void)saveChannelObjects:(NSArray * _Nonnull)channelObjects { } - (void)initInfluencedTypeFromCache { - Session influenceType = [self.dataRepository notificationCachedInfluenceType]; + OSSession influenceType = [self.dataRepository notificationCachedInfluenceType]; self.influenceType = influenceType; if (influenceType == INDIRECT) diff --git a/iOS_SDK/OneSignalSDK/Source/OSOutcomeEvent.h b/iOS_SDK/OneSignalSDK/Source/OSOutcomeEvent.h index 86ad5a745..89d724c00 100644 --- a/iOS_SDK/OneSignalSDK/Source/OSOutcomeEvent.h +++ b/iOS_SDK/OneSignalSDK/Source/OSOutcomeEvent.h @@ -32,7 +32,7 @@ @interface OSOutcomeEvent () -- (id _Nonnull)initWithSession:(Session)session +- (id _Nonnull)initWithSession:(OSSession)session notificationIds:(NSArray * _Nullable)notificationIds name:(NSString * _Nonnull)name timestamp:(NSNumber * _Nonnull)timestamp diff --git a/iOS_SDK/OneSignalSDK/Source/OSOutcomeEvent.m b/iOS_SDK/OneSignalSDK/Source/OSOutcomeEvent.m index cf639f238..8d20067d0 100644 --- a/iOS_SDK/OneSignalSDK/Source/OSOutcomeEvent.m +++ b/iOS_SDK/OneSignalSDK/Source/OSOutcomeEvent.m @@ -31,7 +31,7 @@ of this software and associated documentation files (the "Software"), to deal @implementation OSOutcomeEvent -- (id _Nonnull)initWithSession:(Session)influenceType +- (id _Nonnull)initWithSession:(OSSession)influenceType notificationIds:(NSArray * _Nullable)notificationIds name:(NSString * _Nonnull)name timestamp:(NSNumber * _Nonnull)timestamp @@ -50,9 +50,9 @@ - (id _Nonnull)initWithSession:(Session)influenceType - (id)initFromOutcomeEventParams:(OSOutcomeEventParams *)outcomeEventParams { if (self = [super init]) { OSOutcomeSource *source = outcomeEventParams.outcomeSource; - Session influenceType = UNATTRIBUTED; + OSSession influenceType = UNATTRIBUTED; NSArray *notificationId = nil; - + if (source) { if (source.directBody && source.directBody.notificationIds && source.directBody.notificationIds.count > 0) { influenceType = DIRECT; @@ -62,7 +62,7 @@ - (id)initFromOutcomeEventParams:(OSOutcomeEventParams *)outcomeEventParams { notificationId = source.indirectBody.notificationIds; } } - + _session = influenceType; _notificationIds = notificationId; _name = outcomeEventParams.outcomeId; diff --git a/iOS_SDK/OneSignalSDK/Source/OSSessionManager.m b/iOS_SDK/OneSignalSDK/Source/OSSessionManager.m index ed4e477d9..206ccf50f 100644 --- a/iOS_SDK/OneSignalSDK/Source/OSSessionManager.m +++ b/iOS_SDK/OneSignalSDK/Source/OSSessionManager.m @@ -196,7 +196,7 @@ - (void)attemptSessionUpgrade:(AppEntryAction)entryAction withDirectId:(NSString /* Called when the session for the app changes, caches the state, and broadcasts the session that just ended */ -- (BOOL)setSessionForChannel:(OSChannelTracker *)channelTracker withInfluenceType:(Session)influenceType directId:(NSString *)directId indirectIds:(NSArray *)indirectIds { +- (BOOL)setSessionForChannel:(OSChannelTracker *)channelTracker withInfluenceType:(OSSession)influenceType directId:(NSString *)directId indirectIds:(NSArray *)indirectIds { if (![self willChangeSessionForChannel:channelTracker withInfluenceType:influenceType directId:directId indirectIds:indirectIds]) return NO; @@ -226,7 +226,7 @@ - (BOOL)setSessionForChannel:(OSChannelTracker *)channelTracker withInfluenceTyp 2. Is DIRECT session data different from incoming DIRECT session data? 3. Is INDIRECT session data different from incoming INDIRECT session data? */ -- (BOOL)willChangeSessionForChannel:(OSChannelTracker *)channelTracker withInfluenceType:(Session)influenceType directId:(NSString *)directId indirectIds:(NSArray *)indirectIds { +- (BOOL)willChangeSessionForChannel:(OSChannelTracker *)channelTracker withInfluenceType:(OSSession)influenceType directId:(NSString *)directId indirectIds:(NSArray *)indirectIds { if (channelTracker.influenceType != influenceType) return true; diff --git a/iOS_SDK/OneSignalSDK/Source/OneSignal.h b/iOS_SDK/OneSignalSDK/Source/OneSignal.h index 4d4129e5d..72a0d145b 100755 --- a/iOS_SDK/OneSignalSDK/Source/OneSignal.h +++ b/iOS_SDK/OneSignalSDK/Source/OneSignal.h @@ -210,7 +210,7 @@ typedef NS_ENUM(NSUInteger, OSNotificationActionType) { // Pass in nil means a notification will not display typedef void (^OSNotificationDisplayResponse)(OSNotification* _Nullable notification); /* OneSignal Influence Types */ -typedef NS_ENUM(NSUInteger, Session) { +typedef NS_ENUM(NSUInteger, OSSession) { DIRECT, INDIRECT, UNATTRIBUTED, @@ -225,7 +225,7 @@ typedef NS_ENUM(NSUInteger, OSInfluenceChannel) { @interface OSOutcomeEvent : NSObject // Session enum (DIRECT, INDIRECT, UNATTRIBUTED, or DISABLED) to determine code route and request params -@property (nonatomic) Session session; +@property (nonatomic) OSSession session; // Notification ids for the current session @property (strong, nonatomic, nullable) NSArray *notificationIds; diff --git a/iOS_SDK/OneSignalSDK/Source/OneSignalSelectorHelpers.h b/iOS_SDK/OneSignalSDK/Source/OneSignalSelectorHelpers.h index 6f0869f75..8d5c1604a 100644 --- a/iOS_SDK/OneSignalSDK/Source/OneSignalSelectorHelpers.h +++ b/iOS_SDK/OneSignalSDK/Source/OneSignalSelectorHelpers.h @@ -35,5 +35,6 @@ Class getClassWithProtocolInHierarchy(Class searchClass, Protocol* protocolToFin NSArray* ClassGetSubclasses(Class parentClass); void injectToProperClass(SEL newSel, SEL makeLikeSel, NSArray* delegateSubclasses, Class myClass, Class delegateClass); BOOL injectSelector(Class newClass, SEL newSel, Class addToClass, SEL makeLikeSel); +BOOL injectClassSelector(Class newClass, SEL newSel, Class addToClass, SEL makeLikeSel); #endif /* OneSignalSelectorHelpers_h */ diff --git a/iOS_SDK/OneSignalSDK/Source/OneSignalSelectorHelpers.m b/iOS_SDK/OneSignalSDK/Source/OneSignalSelectorHelpers.m index fcd8451e6..5c6e8ce9f 100644 --- a/iOS_SDK/OneSignalSDK/Source/OneSignalSelectorHelpers.m +++ b/iOS_SDK/OneSignalSDK/Source/OneSignalSelectorHelpers.m @@ -48,6 +48,27 @@ Class getClassWithProtocolInHierarchy(Class searchClass, Protocol* protocolToFin return searchClass; } +BOOL injectClassSelector(Class newClass, SEL newSel, Class addToClass, SEL makeLikeSel) { + Method newMeth = class_getClassMethod(newClass, newSel); + IMP imp = method_getImplementation(newMeth); + + const char* methodTypeEncoding = method_getTypeEncoding(newMeth); + + BOOL existing = class_getClassMethod(addToClass, makeLikeSel) != NULL; + + if (existing) { + class_addMethod(addToClass, newSel, imp, methodTypeEncoding); + newMeth = class_getClassMethod(addToClass, newSel); + // Method orgMeth = class_getClassMethod(addToClass, makeLikeSel); + class_replaceMethod(addToClass, makeLikeSel, imp, methodTypeEncoding); + //method_exchangeImplementations(orgMeth, newMeth); + } + else + class_addMethod(addToClass, makeLikeSel, imp, methodTypeEncoding); + + return existing; +} + BOOL injectSelector(Class newClass, SEL newSel, Class addToClass, SEL makeLikeSel) { Method newMeth = class_getInstanceMethod(newClass, newSel); IMP imp = method_getImplementation(newMeth); diff --git a/iOS_SDK/OneSignalSDK/UnitTestApp/AppDelegate.h b/iOS_SDK/OneSignalSDK/UnitTestApp/AppDelegate.h new file mode 100644 index 000000000..a9a9a2cb2 --- /dev/null +++ b/iOS_SDK/OneSignalSDK/UnitTestApp/AppDelegate.h @@ -0,0 +1,34 @@ +/** + * Modified MIT License + * + * Copyright 2020 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 + +@interface AppDelegate : UIResponder +@property UIWindow *window; + +@end + diff --git a/iOS_SDK/OneSignalSDK/UnitTestApp/AppDelegate.m b/iOS_SDK/OneSignalSDK/UnitTestApp/AppDelegate.m new file mode 100644 index 000000000..a62dffa45 --- /dev/null +++ b/iOS_SDK/OneSignalSDK/UnitTestApp/AppDelegate.m @@ -0,0 +1,41 @@ +/** + * Modified MIT License + * + * Copyright 2020 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 "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + return YES; +} + +@end diff --git a/iOS_SDK/OneSignalSDK/UnitTestApp/Assets.xcassets/AccentColor.colorset/Contents.json b/iOS_SDK/OneSignalSDK/UnitTestApp/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 000000000..eb8789700 --- /dev/null +++ b/iOS_SDK/OneSignalSDK/UnitTestApp/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/iOS_SDK/OneSignalSDK/UnitTestApp/Assets.xcassets/AppIcon.appiconset/Contents.json b/iOS_SDK/OneSignalSDK/UnitTestApp/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000..9221b9bb1 --- /dev/null +++ b/iOS_SDK/OneSignalSDK/UnitTestApp/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/iOS_SDK/OneSignalSDK/UnitTestApp/Assets.xcassets/Contents.json b/iOS_SDK/OneSignalSDK/UnitTestApp/Assets.xcassets/Contents.json new file mode 100644 index 000000000..73c00596a --- /dev/null +++ b/iOS_SDK/OneSignalSDK/UnitTestApp/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/iOS_SDK/OneSignalSDK/UnitTestApp/Base.lproj/LaunchScreen.storyboard b/iOS_SDK/OneSignalSDK/UnitTestApp/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 000000000..865e9329f --- /dev/null +++ b/iOS_SDK/OneSignalSDK/UnitTestApp/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iOS_SDK/OneSignalSDK/UnitTestApp/Base.lproj/Main.storyboard b/iOS_SDK/OneSignalSDK/UnitTestApp/Base.lproj/Main.storyboard new file mode 100644 index 000000000..98e08db6e --- /dev/null +++ b/iOS_SDK/OneSignalSDK/UnitTestApp/Base.lproj/Main.storyboard @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iOS_SDK/OneSignalSDK/UnitTestApp/Info.plist b/iOS_SDK/OneSignalSDK/UnitTestApp/Info.plist new file mode 100644 index 000000000..06eea89d3 --- /dev/null +++ b/iOS_SDK/OneSignalSDK/UnitTestApp/Info.plist @@ -0,0 +1,49 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIApplicationSupportsIndirectInputEvents + + UIBackgroundModes + + remote-notification + + UILaunchStoryboardName + LaunchScreen + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/iOS_SDK/OneSignalSDK/UnitTestApp/UnitTestApp.entitlements b/iOS_SDK/OneSignalSDK/UnitTestApp/UnitTestApp.entitlements new file mode 100644 index 000000000..903def2af --- /dev/null +++ b/iOS_SDK/OneSignalSDK/UnitTestApp/UnitTestApp.entitlements @@ -0,0 +1,8 @@ + + + + + aps-environment + development + + diff --git a/iOS_SDK/OneSignalSDK/UnitTestApp/ViewController.h b/iOS_SDK/OneSignalSDK/UnitTestApp/ViewController.h new file mode 100644 index 000000000..72cfa0852 --- /dev/null +++ b/iOS_SDK/OneSignalSDK/UnitTestApp/ViewController.h @@ -0,0 +1,34 @@ +/** + * Modified MIT License + * + * Copyright 2020 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 + +@interface ViewController : UIViewController + + +@end + diff --git a/iOS_SDK/OneSignalSDK/UnitTestApp/ViewController.m b/iOS_SDK/OneSignalSDK/UnitTestApp/ViewController.m new file mode 100644 index 000000000..8634226f6 --- /dev/null +++ b/iOS_SDK/OneSignalSDK/UnitTestApp/ViewController.m @@ -0,0 +1,42 @@ +/** + * Modified MIT License + * + * Copyright 2020 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 "ViewController.h" + +@interface ViewController () + +@end + +@implementation ViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. +} + + +@end diff --git a/iOS_SDK/OneSignalSDK/UnitTestApp/main.m b/iOS_SDK/OneSignalSDK/UnitTestApp/main.m new file mode 100644 index 000000000..c09a26d7a --- /dev/null +++ b/iOS_SDK/OneSignalSDK/UnitTestApp/main.m @@ -0,0 +1,38 @@ +/** + * Modified MIT License + * + * Copyright 2020 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 "AppDelegate.h" + +int main(int argc, char * argv[]) { + NSString * appDelegateClassName; + @autoreleasepool { + // Setup code that might create autoreleased objects goes here. + appDelegateClassName = NSStringFromClass([AppDelegate class]); + } + return UIApplicationMain(argc, argv, nil, appDelegateClassName); +} diff --git a/iOS_SDK/OneSignalSDK/UnitTests/Shadows/UIApplicationOverrider.m b/iOS_SDK/OneSignalSDK/UnitTests/Shadows/UIApplicationOverrider.m index fcb24cef1..e80a065d6 100644 --- a/iOS_SDK/OneSignalSDK/UnitTests/Shadows/UIApplicationOverrider.m +++ b/iOS_SDK/OneSignalSDK/UnitTests/Shadows/UIApplicationOverrider.m @@ -54,9 +54,10 @@ @implementation UIApplicationOverrider static int apnsTokenLength = 32; +static UIApplication *sharedApplication; + + (void)load { injectToProperClass(@selector(overrideRegisterForRemoteNotifications), @selector(registerForRemoteNotifications), @[], [UIApplicationOverrider class], [UIApplication class]); - injectToProperClass(@selector(override_run), @selector(_run), @[], [UIApplicationOverrider class], [UIApplication class]); injectToProperClass(@selector(overrideCurrentUserNotificationSettings), @selector(currentUserNotificationSettings), @[], [UIApplicationOverrider class], [UIApplication class]); injectToProperClass(@selector(overrideRegisterForRemoteNotificationTypes:), @selector(registerForRemoteNotificationTypes:), @[], [UIApplicationOverrider class], [UIApplication class]); injectToProperClass(@selector(overrideRegisterUserNotificationSettings:), @selector(registerUserNotificationSettings:), @[], [UIApplicationOverrider class], [UIApplication class]); @@ -137,6 +138,13 @@ + (void)helperCallDidRegisterForRemoteNotificationsWithDeviceToken { }); } ++ (UIApplication *)override_shared { + if (!sharedApplication) { + sharedApplication = [UIApplication new]; + } + return sharedApplication; +} + // callPendingApplicationDidRegisterForRemoteNotificaitonsWithDeviceToken + (void)runBackgroundThreads { if (!pendingRegisterBlock || currentUIApplicationState != UIApplicationStateActive || blockApnsResponse) diff --git a/iOS_SDK/OneSignalSDK/UnitTests/UnitTestCommonMethods.m b/iOS_SDK/OneSignalSDK/UnitTests/UnitTestCommonMethods.m index 812e79087..b5173e8fc 100644 --- a/iOS_SDK/OneSignalSDK/UnitTests/UnitTestCommonMethods.m +++ b/iOS_SDK/OneSignalSDK/UnitTests/UnitTestCommonMethods.m @@ -226,9 +226,6 @@ + (void)beforeAllTest { // Force swizzle in all methods for tests. OneSignalHelperOverrider.mockIOSVersion = 9; - // Normally this just loops internally, overwrote _run to work around this. - UIApplicationMain(0, nil, nil, NSStringFromClass([UnitTestAppDelegate class])); - setupUIApplicationDelegate = true; // InstallUncaughtExceptionHandler();