diff --git a/iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj b/iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj index 3c9a377ce..bc4f95135 100644 --- a/iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj +++ b/iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj @@ -64,6 +64,7 @@ 3C0C67262D4946BD00F80448 /* OneSignalCore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = DE7D17E627026B95002D3A5D /* OneSignalCore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 3C0C67372D49503E00F80448 /* UIApplication+OneSignal.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C0C672F2D49501D00F80448 /* UIApplication+OneSignal.m */; }; 3C0C67382D49505700F80448 /* UIApplication+OneSignal.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C0C672E2D49501D00F80448 /* UIApplication+OneSignal.h */; }; + 3C0C673A2D49540700F80448 /* ConsistencyManagerTestHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C0C67392D49540700F80448 /* ConsistencyManagerTestHelpers.swift */; }; 3C0EF49E28A1DBCB00E5434B /* OSUserInternalImpl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C0EF49D28A1DBCB00E5434B /* OSUserInternalImpl.swift */; }; 3C115165289A259500565C41 /* OneSignalOSCore.docc in Sources */ = {isa = PBXBuildFile; fileRef = 3C115164289A259500565C41 /* OneSignalOSCore.docc */; }; 3C115171289A259500565C41 /* OneSignalOSCore.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C115163289A259500565C41 /* OneSignalOSCore.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -1282,6 +1283,7 @@ 3C0C67222D49469200F80448 /* MockMessagingController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MockMessagingController.m; sourceTree = ""; }; 3C0C672E2D49501D00F80448 /* UIApplication+OneSignal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIApplication+OneSignal.h"; sourceTree = ""; }; 3C0C672F2D49501D00F80448 /* UIApplication+OneSignal.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIApplication+OneSignal.m"; sourceTree = ""; }; + 3C0C67392D49540700F80448 /* ConsistencyManagerTestHelpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConsistencyManagerTestHelpers.swift; sourceTree = ""; }; 3C0EF49D28A1DBCB00E5434B /* OSUserInternalImpl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OSUserInternalImpl.swift; sourceTree = ""; }; 3C115161289A259500565C41 /* OneSignalOSCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OneSignalOSCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 3C115163289A259500565C41 /* OneSignalOSCore.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OneSignalOSCore.h; sourceTree = ""; }; @@ -2203,6 +2205,7 @@ isa = PBXGroup; children = ( 3C8544B82C5AEFF700F542A9 /* OneSignalOSCoreMocks.h */, + 3C0C67392D49540700F80448 /* ConsistencyManagerTestHelpers.swift */, 3C8544C22C5AF18B00F542A9 /* OSCoreMocks.swift */, 3CF11E3F2C6E6DE2002856F5 /* MockNewRecordsState.swift */, ); @@ -4320,6 +4323,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 3C0C673A2D49540700F80448 /* ConsistencyManagerTestHelpers.swift in Sources */, 3C8544C32C5AF18B00F542A9 /* OSCoreMocks.swift in Sources */, 3CF11E402C6E6DE2002856F5 /* MockNewRecordsState.swift in Sources */, ); diff --git a/iOS_SDK/OneSignalSDK/OneSignalOSCoreMocks/ConsistencyManagerTestHelpers.swift b/iOS_SDK/OneSignalSDK/OneSignalOSCoreMocks/ConsistencyManagerTestHelpers.swift new file mode 100644 index 000000000..53d105943 --- /dev/null +++ b/iOS_SDK/OneSignalSDK/OneSignalOSCoreMocks/ConsistencyManagerTestHelpers.swift @@ -0,0 +1,39 @@ +/* + Modified MIT License + + Copyright 2025 OneSignal + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + 1. The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + 2. All copies of substantial portions of the Software may only be used in connection + with services provided by OneSignal. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + */ + +import OneSignalOSCore + +public class ConsistencyManagerTestHelpers { + /// Unblocks the Consistency Manager, which allows fetching of IAMs for example. + public static func setDefaultRywToken(id: String) { + let key = OSIamFetchOffsetKey.userUpdate + let rywToken = "123" + let rywDelay: NSNumber = 0 + let rywData = OSReadYourWriteData(rywToken: rywToken, rywDelay: rywDelay) + OSConsistencyManager.shared.setRywTokenAndDelay(id: id, key: key, value: rywData) + } +}