Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] Combine user property updates for network call improvements, fix purchase bug #1444

Merged
merged 15 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
3CC9A6362AFA26E7008F68FD /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 3CC9A6352AFA26E7008F68FD /* PrivacyInfo.xcprivacy */; };
3CCF44BE299B17290021964D /* OneSignalWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 3CCF44BC299B17290021964D /* OneSignalWrapper.h */; settings = {ATTRIBUTES = (Public, ); }; };
3CCF44BF299B17290021964D /* OneSignalWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CCF44BD299B17290021964D /* OneSignalWrapper.m */; };
3CDE664C2BFC2A56006DA114 /* OneSignalUserObjcTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CDE664B2BFC2A56006DA114 /* OneSignalUserObjcTests.m */; };
3CE5F9E3289D88DC004A156E /* OSModelStoreChangedHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CE5F9E2289D88DC004A156E /* OSModelStoreChangedHandler.swift */; };
3CE795F928DB99B500736BD4 /* OSSubscriptionModelStoreListener.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CE795F828DB99B500736BD4 /* OSSubscriptionModelStoreListener.swift */; };
3CE795FB28DBDCE700736BD4 /* OSSubscriptionOperationExecutor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CE795FA28DBDCE700736BD4 /* OSSubscriptionOperationExecutor.swift */; };
Expand All @@ -153,6 +154,8 @@
3CE8CC582911B2B2000DB0D3 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3CE8CC572911B2B2000DB0D3 /* SystemConfiguration.framework */; };
3CE8CC5B29143F4B000DB0D3 /* NSDateFormatter+OneSignal.m in Sources */ = {isa = PBXBuildFile; fileRef = DE98772A2591655800DE07D5 /* NSDateFormatter+OneSignal.m */; };
3CE9227A289FA88B001B1062 /* OSIdentityModelStoreListener.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CE92279289FA88B001B1062 /* OSIdentityModelStoreListener.swift */; };
3CEE90A72BFE6ABD00B0FB5B /* OSPropertiesSupportedProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CEE90A62BFE6ABD00B0FB5B /* OSPropertiesSupportedProperty.swift */; };
3CEE90A92C000BD500B0FB5B /* OneSignalRequest+UnitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CEE90A82C000BD500B0FB5B /* OneSignalRequest+UnitTests.swift */; };
3CEE93422B7C4174008440BD /* OneSignalUserMocks.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3CC063DD2B6D7F2A002BB07F /* OneSignalUserMocks.framework */; };
3CEE93432B7C4174008440BD /* OneSignalUserMocks.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3CC063DD2B6D7F2A002BB07F /* OneSignalUserMocks.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
3CEE93462B7C73AB008440BD /* OneSignalCoreMocks.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3CC0639A2B6D7A8C002BB07F /* OneSignalCoreMocks.framework */; };
Expand Down Expand Up @@ -461,6 +464,8 @@
DEA4B4652888C59100E9FE12 /* OneSignalExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DE7D17F927026BA3002D3A5D /* OneSignalExtension.framework */; };
DEA4B4662888C59E00E9FE12 /* OneSignalExtension.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = DE7D17F927026BA3002D3A5D /* OneSignalExtension.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
DEA4B4672888C5F200E9FE12 /* OneSignalExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DE7D17F927026BA3002D3A5D /* OneSignalExtension.framework */; };
DEA69F452C190045009BB128 /* OneSignalCoreMocks.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3CC0639A2B6D7A8C002BB07F /* OneSignalCoreMocks.framework */; };
DEA69F462C190045009BB128 /* OneSignalCoreMocks.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3CC0639A2B6D7A8C002BB07F /* OneSignalCoreMocks.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
DEA98C1928C90EE5000C6856 /* OneSignalCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DE7D17E627026B95002D3A5D /* OneSignalCore.framework */; };
DEA98C1C28C90EE6000C6856 /* OneSignalOSCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C115161289A259500565C41 /* OneSignalOSCore.framework */; };
DEA98C1E28C90EE9000C6856 /* OneSignalCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DE7D17E627026B95002D3A5D /* OneSignalCore.framework */; };
Expand Down Expand Up @@ -868,6 +873,13 @@
remoteGlobalIDString = DE7D187F27037F43002D3A5D;
remoteInfo = OneSignalOutcomes;
};
DEA69F472C190045009BB128 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 37747F8B19147D6400558FAD /* Project object */;
proxyType = 1;
remoteGlobalIDString = 3CC063992B6D7A8C002BB07F;
remoteInfo = OneSignalCoreMocks;
};
DEBAAE062A420C9800BF2C1C /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 37747F8B19147D6400558FAD /* Project object */;
Expand Down Expand Up @@ -1032,6 +1044,7 @@
files = (
3CEE93542B7C78EC008440BD /* OneSignalUser.framework in Embed Frameworks */,
3CA8B8832BEC2FCB0010ADA1 /* XCTest.framework in Embed Frameworks */,
DEA69F462C190045009BB128 /* OneSignalCoreMocks.framework in Embed Frameworks */,
3CEE934F2B7C787B008440BD /* OneSignalOSCore.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
Expand Down Expand Up @@ -1174,6 +1187,8 @@
3CC9A6352AFA26E7008F68FD /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
3CCF44BC299B17290021964D /* OneSignalWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OneSignalWrapper.h; sourceTree = "<group>"; };
3CCF44BD299B17290021964D /* OneSignalWrapper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OneSignalWrapper.m; sourceTree = "<group>"; };
3CDE664A2BFC2A55006DA114 /* OneSignalUserTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "OneSignalUserTests-Bridging-Header.h"; sourceTree = "<group>"; };
3CDE664B2BFC2A56006DA114 /* OneSignalUserObjcTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OneSignalUserObjcTests.m; sourceTree = "<group>"; };
3CE5F9E2289D88DC004A156E /* OSModelStoreChangedHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSModelStoreChangedHandler.swift; sourceTree = "<group>"; };
3CE795F828DB99B500736BD4 /* OSSubscriptionModelStoreListener.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSSubscriptionModelStoreListener.swift; sourceTree = "<group>"; };
3CE795FA28DBDCE700736BD4 /* OSSubscriptionOperationExecutor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSSubscriptionOperationExecutor.swift; sourceTree = "<group>"; };
Expand All @@ -1184,6 +1199,8 @@
3CE8CC552911B1E0000DB0D3 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/iOSSupport/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
3CE8CC572911B2B2000DB0D3 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/SystemConfiguration.framework; sourceTree = DEVELOPER_DIR; };
3CE92279289FA88B001B1062 /* OSIdentityModelStoreListener.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSIdentityModelStoreListener.swift; sourceTree = "<group>"; };
3CEE90A62BFE6ABD00B0FB5B /* OSPropertiesSupportedProperty.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPropertiesSupportedProperty.swift; sourceTree = "<group>"; };
3CEE90A82C000BD500B0FB5B /* OneSignalRequest+UnitTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "OneSignalRequest+UnitTests.swift"; sourceTree = "<group>"; };
3CF8629D28A183F900776CA4 /* OSIdentityModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSIdentityModel.swift; sourceTree = "<group>"; };
3CF8629F28A1964F00776CA4 /* OSPropertiesModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPropertiesModel.swift; sourceTree = "<group>"; };
3CF862A128A197D200776CA4 /* OSPropertiesModelStoreListener.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPropertiesModelStoreListener.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1587,6 +1604,7 @@
files = (
3CEE93532B7C78EC008440BD /* OneSignalUser.framework in Frameworks */,
3CA8B8822BEC2FCB0010ADA1 /* XCTest.framework in Frameworks */,
DEA69F452C190045009BB128 /* OneSignalCoreMocks.framework in Frameworks */,
3CEE934E2B7C787B008440BD /* OneSignalOSCore.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -1907,6 +1925,7 @@
isa = PBXGroup;
children = (
3C8706752BDEED75000D8CD2 /* NSDictionary+UnitTests.swift */,
3CEE90A82C000BD500B0FB5B /* OneSignalRequest+UnitTests.swift */,
);
path = Extensions;
sourceTree = "<group>";
Expand Down Expand Up @@ -1977,12 +1996,22 @@
3CC063EC2B6D7FE8002BB07F /* OneSignalUserTests */ = {
isa = PBXGroup;
children = (
3CDE664A2BFC2A55006DA114 /* OneSignalUserTests-Bridging-Header.h */,
3CC063ED2B6D7FE8002BB07F /* OneSignalUserTests.swift */,
3C67F7792BEB2B710085A0F0 /* SwitchUserIntegrationTests.swift */,
3CDE664B2BFC2A56006DA114 /* OneSignalUserObjcTests.m */,
);
path = OneSignalUserTests;
sourceTree = "<group>";
};
3CEE90A52BFE6A7700B0FB5B /* Support */ = {
isa = PBXGroup;
children = (
3CEE90A62BFE6ABD00B0FB5B /* OSPropertiesSupportedProperty.swift */,
);
path = Support;
sourceTree = "<group>";
};
3E2400391D4FFC31008BDE70 /* OneSignalFramework */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -2258,6 +2287,7 @@
DE69E1A8282ED8360090BB3D /* Source */ = {
isa = PBXGroup;
children = (
3CEE90A52BFE6A7700B0FB5B /* Support */,
3C9AD6BA2B2284AB00BC1540 /* Executors */,
3C9AD6BD2B22877600BC1540 /* Requests */,
DE69E1A9282ED8790090BB3D /* UnitTestApp-Bridging-Header.h */,
Expand Down Expand Up @@ -3055,6 +3085,7 @@
dependencies = (
3CEE93512B7C787C008440BD /* PBXTargetDependency */,
3CEE93562B7C78EC008440BD /* PBXTargetDependency */,
DEA69F482C190045009BB128 /* PBXTargetDependency */,
);
name = OneSignalUserMocks;
productName = OneSignalUserMocks;
Expand Down Expand Up @@ -3384,6 +3415,7 @@
3CC063EA2B6D7FE8002BB07F = {
CreatedOnToolsVersion = 15.2;
DevelopmentTeam = 99SW8E36CT;
LastSwiftMigration = 1520;
ProvisioningStyle = Automatic;
TestTargetID = DEF5CCF02539321A0003E9CC;
};
Expand Down Expand Up @@ -3743,6 +3775,7 @@
4710EA552B8FD04400435356 /* MockOSDispatchQueue.swift in Sources */,
3CC063B22B6D7AD8002BB07F /* MockOneSignalClient.swift in Sources */,
3C8706762BDEED75000D8CD2 /* NSDictionary+UnitTests.swift in Sources */,
3CEE90A92C000BD500B0FB5B /* OneSignalRequest+UnitTests.swift in Sources */,
3CC063B42B6D7BA2002BB07F /* OneSignalCoreMocks.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -3772,6 +3805,7 @@
files = (
3C67F77A2BEB2B710085A0F0 /* SwitchUserIntegrationTests.swift in Sources */,
3CC063EE2B6D7FE8002BB07F /* OneSignalUserTests.swift in Sources */,
3CDE664C2BFC2A56006DA114 /* OneSignalUserObjcTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -3926,6 +3960,7 @@
3C8E6E0128AC0BA10031E48A /* OSIdentityOperationExecutor.swift in Sources */,
3CF862A228A197D200776CA4 /* OSPropertiesModelStoreListener.swift in Sources */,
3C277D7E2BD76E0000857606 /* OSIdentityModelRepo.swift in Sources */,
3CEE90A72BFE6ABD00B0FB5B /* OSPropertiesSupportedProperty.swift in Sources */,
3C9AD6C12B22886600BC1540 /* OSRequestUpdateSubscription.swift in Sources */,
3C0EF49E28A1DBCB00E5434B /* OSUserInternalImpl.swift in Sources */,
3C8E6DFF28AB09AE0031E48A /* OSPropertyOperationExecutor.swift in Sources */,
Expand Down Expand Up @@ -4301,6 +4336,11 @@
target = DE7D187F27037F43002D3A5D /* OneSignalOutcomes */;
targetProxy = DE7D18D42703ADE0002D3A5D /* PBXContainerItemProxy */;
};
DEA69F482C190045009BB128 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 3CC063992B6D7A8C002BB07F /* OneSignalCoreMocks */;
targetProxy = DEA69F472C190045009BB128 /* PBXContainerItemProxy */;
};
DEBAAE072A420C9800BF2C1C /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = DE7D17E527026B95002D3A5D /* OneSignalCore */;
Expand Down Expand Up @@ -5102,6 +5142,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_OBJC_BRIDGING_HEADER = "OneSignalUserTests/OneSignalUserTests-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/UnitTestApp.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/UnitTestApp";
Expand Down Expand Up @@ -5155,6 +5196,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_OBJC_BRIDGING_HEADER = "OneSignalUserTests/OneSignalUserTests-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down Expand Up @@ -5203,6 +5245,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_OBJC_BRIDGING_HEADER = "OneSignalUserTests/OneSignalUserTests-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/UnitTestApp.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/UnitTestApp";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,6 @@ typedef enum {ATTRIBUTED, NOT_ATTRIBUTED} FocusAttributionState;

// OneSignal Background Task Identifiers
#define ATTRIBUTED_FOCUS_TASK @"ATTRIBUTED_FOCUS_TASK"
#define UNATTRIBUTED_FOCUS_TASK @"UNATTRIBUTED_FOCUS_TASK"
#define SEND_SESSION_TIME_TO_USER_TASK @"SEND_SESSION_TIME_TO_USER_TASK"
#define OPERATION_REPO_BACKGROUND_TASK @"OPERATION_REPO_BACKGROUND_TASK"
#define IDENTITY_EXECUTOR_BACKGROUND_TASK @"IDENTITY_EXECUTOR_BACKGROUND_TASK_"
#define PROPERTIES_EXECUTOR_BACKGROUND_TASK @"PROPERTIES_EXECUTOR_BACKGROUND_TASK_"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,38 @@ extension NSDictionary {
}

private func equals(_ x: Any, _ y: Any) -> Bool {
guard x is AnyHashable else { return false }
guard y is AnyHashable else { return false }
return (x as! AnyHashable) == (y as! AnyHashable)
switch (x, y) {
case let (x as NSNumber, y as NSNumber):
// Handle float equality imprecision
return abs(x.floatValue - y.floatValue) <= .ulpOfOne
default:
guard x is AnyHashable else { return false }
guard y is AnyHashable else { return false }
return (x as! AnyHashable) == (y as! AnyHashable)
}
}

/**
Returns a string representation of a dictionary in alphabetical order by key.
If there are dictionaries within this dictionary, those will also be stringified in alphabetical order by key.
This method is motivated by the need to compare two requests whose payloads may be unordered dictionaries.
*/
public func toSortedString() -> String {
guard let dict = self as? [String: Any] else {
return "[:]"
}
var result = "["
let sortedKeys = Array(dict.keys).sorted(by: <)
for key in sortedKeys {
if let value = dict[key] as? NSDictionary {
result += " \(key): \(value.toSortedString()),"
} else {
result += " \(key): \(String(describing: dict[key])),"
}
}
// drop the last comma within a dictionary's items
result = String(result.dropLast())
result += "]"
return result
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import OneSignalCore

extension OneSignalRequest {
/// Returns alphabetically ordered string representation of request's parameters
public func stringifyParams() -> String {
guard let dict = self.parameters as? NSDictionary else {
return "[:]"
}
return dict.toSortedString()
}
}
27 changes: 22 additions & 5 deletions iOS_SDK/OneSignalSDK/OneSignalCoreMocks/MockOneSignalClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,21 @@ public class MockOneSignalClient: NSObject, IOneSignalClient {
}
}

/// Helper method to stringify the name of a request for identification and comparison
private func stringify(_ request: OneSignalRequest) -> String {
var stringified = request.description

switch request.description {
case let str where str.contains("OSRequestUpdateProperties"):
// Return an ordered representation of the request parameters
stringified = "<OSRequestUpdateProperties with parameters: \(request.stringifyParams())>"
default:
break
}

return stringified
}

func finishExecutingRequest(_ request: OneSignalRequest, onSuccess successBlock: OSResultSuccessBlock, onFailure failureBlock: OSFailureBlock) {

// TODO: This entire method needs to contained within the equivalent of @synchronized ❗️
Expand All @@ -110,18 +125,19 @@ public class MockOneSignalClient: NSObject, IOneSignalClient {

self.didCompleteRequest(request)

let stringifiedRequest = stringify(request)
// Switch between types of requests with mock responses
if request.isKind(of: OSRequestGetIosParams.self) {
// send a mock remote params response
successBlock(["mockTodo": "responseTodo"])
}
if (mockResponses[String(describing: request)]) != nil {
successBlock(mockResponses[String(describing: request)])
} else if (mockFailureResponses[String(describing: request)]) != nil {
failureBlock(mockFailureResponses[String(describing: request)])
if (mockResponses[stringifiedRequest]) != nil {
successBlock(mockResponses[stringifiedRequest])
} else if (mockFailureResponses[stringifiedRequest]) != nil {
failureBlock(mockFailureResponses[stringifiedRequest])
} else {
allRequestsHandled = false
print("🧪 cannot find a mock response for request: \(request)")
print("🧪 cannot find a mock response for request: \(stringifiedRequest)")
}
}

Expand Down Expand Up @@ -154,6 +170,7 @@ extension MockOneSignalClient {
/**
Checks if there is only one executed request that contains the payload provided, and the url matches the path provided.
*/
@objc
public func onlyOneRequest(contains path: String, contains payload: [String: Any]) -> Bool {
var found = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import XCTest

@objc
public class OneSignalCoreMocks: NSObject {

@objc
public static func clearUserDefaults() {
guard let userDefaults = OneSignalUserDefaults.initStandard().userDefaults else {
return
Expand All @@ -46,6 +46,7 @@ public class OneSignalCoreMocks: NSObject {
}

/** Wait specified number of seconds for any async methods to run */
@objc
public static func waitForBackgroundThreads(seconds: Double) {
let expectation = XCTestExpectation(description: "Wait for \(seconds) seconds")
_ = XCTWaiter.wait(for: [expectation], timeout: seconds)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,14 @@ public class OSOperationRepo: NSObject {
}
}

func enqueueDelta(_ delta: OSDelta) {
/**
Enqueueing is driven by model changes and called manually by the User Manager to
add session time, session count and purchase data.

// TODO: We can make this method internal once there is no manual adding of a Delta except through stores.
This can happen when session data and purchase data use the model / store / listener infrastructure.
*/
public func enqueueDelta(_ delta: OSDelta) {
guard !OneSignalConfigManager.shouldAwaitAppIdAndLogMissingPrivacyConsent(forMethod: nil) else {
return
}
Expand Down
Loading
Loading