Skip to content

Commit bfba7f4

Browse files
committed
Add ConsistencyManagerHelpers to test
* Has helper methods for repeating functionality
1 parent dbc7c39 commit bfba7f4

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@
186186
3CEE93542B7C78EC008440BD /* OneSignalUser.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = DE69E19B282ED8060090BB3D /* OneSignalUser.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
187187
3CEE93572B7C78FD008440BD /* OneSignalCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DE7D17E627026B95002D3A5D /* OneSignalCore.framework */; };
188188
3CEE93582B7C78FE008440BD /* OneSignalCore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = DE7D17E627026B95002D3A5D /* OneSignalCore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
189+
3CEEBBD32D48000E008EE1C5 /* ConsistencyManagerHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CEEBBD22D48000E008EE1C5 /* ConsistencyManagerHelpers.swift */; };
189190
3CF11E3D2C6D6155002856F5 /* UserExecutorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CF11E3C2C6D6155002856F5 /* UserExecutorTests.swift */; };
190191
3CF11E402C6E6DE2002856F5 /* MockNewRecordsState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CF11E3F2C6E6DE2002856F5 /* MockNewRecordsState.swift */; };
191192
3CF1A5632C669EA40056B3AA /* OSNewRecordsState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CF1A5622C669EA40056B3AA /* OSNewRecordsState.swift */; };
@@ -1363,6 +1364,7 @@
13631364
3CE92279289FA88B001B1062 /* OSIdentityModelStoreListener.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSIdentityModelStoreListener.swift; sourceTree = "<group>"; };
13641365
3CEE90A62BFE6ABD00B0FB5B /* OSPropertiesSupportedProperty.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPropertiesSupportedProperty.swift; sourceTree = "<group>"; };
13651366
3CEE90A82C000BD500B0FB5B /* OneSignalRequest+UnitTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "OneSignalRequest+UnitTests.swift"; sourceTree = "<group>"; };
1367+
3CEEBBD22D48000E008EE1C5 /* ConsistencyManagerHelpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConsistencyManagerHelpers.swift; sourceTree = "<group>"; };
13661368
3CF11E3C2C6D6155002856F5 /* UserExecutorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserExecutorTests.swift; sourceTree = "<group>"; };
13671369
3CF11E3F2C6E6DE2002856F5 /* MockNewRecordsState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockNewRecordsState.swift; sourceTree = "<group>"; };
13681370
3CF1A5622C669EA40056B3AA /* OSNewRecordsState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSNewRecordsState.swift; sourceTree = "<group>"; };
@@ -2191,6 +2193,7 @@
21912193
3C8544B82C5AEFF700F542A9 /* OneSignalOSCoreMocks.h */,
21922194
3C8544C22C5AF18B00F542A9 /* OSCoreMocks.swift */,
21932195
3CF11E3F2C6E6DE2002856F5 /* MockNewRecordsState.swift */,
2196+
3CEEBBD22D48000E008EE1C5 /* ConsistencyManagerHelpers.swift */,
21942197
);
21952198
path = OneSignalOSCoreMocks;
21962199
sourceTree = "<group>";
@@ -4309,6 +4312,7 @@
43094312
files = (
43104313
3C8544C32C5AF18B00F542A9 /* OSCoreMocks.swift in Sources */,
43114314
3CF11E402C6E6DE2002856F5 /* MockNewRecordsState.swift in Sources */,
4315+
3CEEBBD32D48000E008EE1C5 /* ConsistencyManagerHelpers.swift in Sources */,
43124316
);
43134317
runOnlyForDeploymentPostprocessing = 0;
43144318
};
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
Modified MIT License
3+
4+
Copyright 2025 OneSignal
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
1. The above copyright notice and this permission notice shall be included in
14+
all copies or substantial portions of the Software.
15+
16+
2. All copies of substantial portions of the Software may only be used in connection
17+
with services provided by OneSignal.
18+
19+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25+
THE SOFTWARE.
26+
*/
27+
28+
import OneSignalOSCore
29+
30+
public class ConsistencyManagerHelpers {
31+
/// Unblocks the Consistency Manager, which allows fetching of IAMs for example.
32+
public static func setDefaultRywToken(id: String) {
33+
let key = OSIamFetchOffsetKey.userUpdate
34+
let rywToken = "123"
35+
let rywDelay: NSNumber = 0
36+
let rywData = OSReadYourWriteData(rywToken: rywToken, rywDelay: rywDelay)
37+
OSConsistencyManager.shared.setRywTokenAndDelay(id: id, key: key, value: rywData)
38+
}
39+
}

0 commit comments

Comments
 (0)