Skip to content

Commit 663edc1

Browse files
author
Rodrigo Gomez Palacio
committed
Run swiftlint --fix
Motivation: fix all lint issues
1 parent 4f7a9dd commit 663edc1

File tree

12 files changed

+36
-43
lines changed

12 files changed

+36
-43
lines changed

iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/Consistency/IamFetch/OSIamFetchReadyCondition.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
THE SOFTWARE.
2626
*/
2727

28-
@objc public class OSIamFetchReadyCondition: NSObject, OSCondition {
28+
@objc public class OSIamFetchReadyCondition: NSObject, OSCondition {
2929
// the id used to index the token map (e.g. onesignalId)
3030
private let id: String
3131
private var hasSubscriptionUpdatePending: Bool = false
@@ -48,11 +48,11 @@
4848

4949
// Expose the constant to Objective-C
5050
@objc public static let CONDITIONID: String = "OSIamFetchReadyCondition"
51-
51+
5252
public var conditionId: String {
5353
return OSIamFetchReadyCondition.CONDITIONID
5454
}
55-
55+
5656
public func setSubscriptionUpdatePending(value: Bool) {
5757
hasSubscriptionUpdatePending = value
5858
}
@@ -63,12 +63,12 @@
6363
let userCreateTokenSet = tokenMap[NSNumber(value: OSIamFetchOffsetKey.userCreate.rawValue)] != nil
6464
let userUpdateTokenSet = tokenMap[NSNumber(value: OSIamFetchOffsetKey.userUpdate.rawValue)] != nil
6565
let subscriptionTokenSet = tokenMap[NSNumber(value: OSIamFetchOffsetKey.subscriptionUpdate.rawValue)] != nil
66-
67-
if (userCreateTokenSet) {
68-
return true;
66+
67+
if userCreateTokenSet {
68+
return true
6969
}
7070

71-
if (hasSubscriptionUpdatePending) {
71+
if hasSubscriptionUpdatePending {
7272
return userUpdateTokenSet && subscriptionTokenSet
7373
}
7474
return userUpdateTokenSet

iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/Consistency/OSConsistencyManager.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import OneSignalCore
3838

3939
// Private initializer to prevent multiple instances
4040
private override init() {}
41-
41+
4242
// Used for testing
4343
public func reset() {
4444
indexedTokens = [:]
@@ -72,13 +72,13 @@ import OneSignalCore
7272
return condition.getNewestToken(indexedTokens: self.indexedTokens)
7373
}
7474
}
75-
75+
7676
// Method to resolve conditions by condition ID (e.g. OSIamFetchReadyCondition.ID)
7777
@objc public func resolveConditionsWithID(id: String) {
7878
guard let conditionList = indexedConditions[id] else { return }
7979
var completedConditions: [(OSCondition, DispatchSemaphore)] = []
8080
for (condition, semaphore) in conditionList {
81-
if (condition.conditionId == id) {
81+
if condition.conditionId == id {
8282
semaphore.signal()
8383
completedConditions.append((condition, semaphore))
8484
}

iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/Consistency/OSReadYourWriteData.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,3 @@ public class OSReadYourWriteData: NSObject {
5757
return hasher.finalize()
5858
}
5959
}
60-

iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/OSOperationRepo.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public class OSOperationRepo: NSObject {
118118

119119
// Persist the deltas (including new delta) to storage
120120
OneSignalUserDefaults.initShared().saveCodeableData(forKey: OS_OPERATION_REPO_DELTA_QUEUE_KEY, withValue: self.deltaQueue)
121-
121+
122122
if flush {
123123
self.flushDeltaQueue()
124124
}

iOS_SDK/OneSignalSDK/OneSignalOSCoreMocks/MockNewRecordsState.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@ public class MockNewRecordsState: OSNewRecordsState {
4242
super.add(key, overwrite)
4343
}
4444

45-
override public func canAccess(_ key: String) -> Bool {
46-
return super.canAccess(key)
47-
}
48-
4945
public func get(_ key: String?) -> [MockNewRecord] {
5046
return records.filter { $0.key == key }
5147
}

iOS_SDK/OneSignalSDK/OneSignalOSCoreTests/OSConsistencyManagerTests.swift

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class OSConsistencyManagerTests: XCTestCase {
121121
XCTAssertTrue(true) // Simulate some async action completing without hanging
122122
}
123123
}
124-
124+
125125
func testSetRywTokenWithoutAnyCondition() {
126126
// Given
127127
let id = "test_id"
@@ -138,7 +138,7 @@ class OSConsistencyManagerTests: XCTestCase {
138138
// There is no condition registered, so we just check that no errors occur
139139
XCTAssertTrue(true) // If no errors occur, this test will pass
140140
}
141-
141+
142142
func testMultipleConditionsWithDifferentKeys() {
143143
let expectation1 = self.expectation(description: "UserUpdate condition met")
144144
let expectation2 = self.expectation(description: "SubscriptionUpdate condition met")
@@ -215,7 +215,7 @@ class OSConsistencyManagerTests: XCTestCase {
215215

216216
return result
217217
}
218-
218+
219219
func testConditionMetImmediatelyAfterTokenAlreadySet() {
220220
let expectation = self.expectation(description: "Condition met immediately")
221221

@@ -247,7 +247,7 @@ class OSConsistencyManagerTests: XCTestCase {
247247

248248
waitForExpectations(timeout: 2.0, handler: nil)
249249
}
250-
250+
251251
func testConcurrentUpdatesToTokens() {
252252
let expectation = self.expectation(description: "Concurrent updates handled correctly")
253253

@@ -294,16 +294,15 @@ class OSConsistencyManagerTests: XCTestCase {
294294
}
295295
}
296296

297-
298297
// Mock implementation of OSCondition that simulates a condition that isn't met
299298
class TestUnmetCondition: NSObject, OSCondition {
300299
// class-level constant for the ID
301300
public static let CONDITIONID = "TestUnmetCondition"
302-
301+
303302
public var conditionId: String {
304303
return TestUnmetCondition.CONDITIONID
305304
}
306-
305+
307306
func isMet(indexedTokens: [String: [NSNumber: OSReadYourWriteData]]) -> Bool {
308307
return false // Always returns false to simulate an unmet condition
309308
}
@@ -316,49 +315,49 @@ class TestUnmetCondition: NSObject, OSCondition {
316315
// Mock implementation of OSCondition for cases where the condition is met
317316
class TestMetCondition: NSObject, OSCondition {
318317
private let expectedTokens: [String: [NSNumber: OSReadYourWriteData]]
319-
318+
320319
// class-level constant for the ID
321320
public static let CONDITIONID = "TestMetCondition"
322-
321+
323322
public var conditionId: String {
324323
return TestMetCondition.CONDITIONID
325324
}
326-
325+
327326
init(expectedTokens: [String: [NSNumber: OSReadYourWriteData]]) {
328327
self.expectedTokens = expectedTokens
329328
}
330-
329+
331330
func isMet(indexedTokens: [String: [NSNumber: OSReadYourWriteData]]) -> Bool {
332331
print("Expected tokens: \(expectedTokens)")
333332
print("Actual tokens: \(indexedTokens)")
334-
333+
335334
// Check if all the expected tokens are present in the actual tokens
336335
for (id, expectedTokenMap) in expectedTokens {
337336
guard let actualTokenMap = indexedTokens[id] else {
338337
print("No tokens found for id: \(id)")
339338
return false
340339
}
341-
340+
342341
// Check if all expected keys (e.g., userUpdate, subscriptionUpdate) are present with the correct value
343342
for (expectedKey, expectedValue) in expectedTokenMap {
344343
guard let actualValue = actualTokenMap[expectedKey] else {
345344
print("Key \(expectedKey) not found in actual tokens")
346345
return false
347346
}
348-
347+
349348
if actualValue != expectedValue {
350349
print("Mismatch for key \(expectedKey): expected \(expectedValue.rywToken), found \(actualValue.rywToken)")
351350
return false
352351
}
353352
}
354353
}
355-
354+
356355
print("Condition met for id")
357356
return true
358357
}
359-
358+
360359
func getNewestToken(indexedTokens: [String: [NSNumber: OSReadYourWriteData]]) -> OSReadYourWriteData? {
361-
var dataBasedOnNewestRywToken: OSReadYourWriteData? = nil
360+
var dataBasedOnNewestRywToken: OSReadYourWriteData?
362361

363362
// Loop through the token maps and compare the values
364363
for tokenMap in indexedTokens.values {

iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSPropertyOperationExecutor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ class OSPropertyOperationExecutor: OSOperationExecutor {
259259
if let rywToken = response?["ryw_token"] as? String
260260
{
261261
let rywDelay = response?["ryw_delay"] as? NSNumber
262-
262+
263263
OSConsistencyManager.shared.setRywTokenAndDelay(
264264
id: onesignalId,
265265
key: OSIamFetchOffsetKey.userUpdate,

iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSSubscriptionOperationExecutor.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ class OSSubscriptionOperationExecutor: OSOperationExecutor {
297297
}
298298
return
299299
}
300-
300+
301301
if let onesignalId = request.identityModel.onesignalId {
302302
if let rywToken = response["ryw_token"] as? String
303303
{
@@ -312,7 +312,7 @@ class OSSubscriptionOperationExecutor: OSOperationExecutor {
312312
OSConsistencyManager.shared.resolveConditionsWithID(id: OSIamFetchReadyCondition.CONDITIONID)
313313
}
314314
}
315-
315+
316316
request.subscriptionModel.hydrate(response)
317317
if inBackground {
318318
OSBackgroundTaskManager.endBackgroundTask(backgroundTaskIdentifier)
@@ -419,7 +419,7 @@ class OSSubscriptionOperationExecutor: OSOperationExecutor {
419419
OSBackgroundTaskManager.endBackgroundTask(backgroundTaskIdentifier)
420420
}
421421
}
422-
422+
423423
if let onesignalId = OneSignalUserManagerImpl.sharedInstance.onesignalId {
424424
if let rywToken = response?["ryw_token"] as? String
425425
{

iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSUserExecutor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ extension OSUserExecutor {
258258
} else {
259259
self.executePendingRequests()
260260
}
261-
261+
262262
if let onesignalId = request.identityModel.onesignalId {
263263
if let rywToken = response["ryw_token"] as? String
264264
{

iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSSubscriptionModelStoreListener.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class OSSubscriptionModelStoreListener: OSModelStoreListener {
7070
let condition = OSIamFetchReadyCondition.sharedInstance(withId: onesignalId)
7171
condition.setSubscriptionUpdatePending(value: true)
7272
}
73-
73+
7474
return OSDelta(
7575
name: OS_UPDATE_SUBSCRIPTION_DELTA,
7676
identityModelId: OneSignalUserManagerImpl.sharedInstance.user.identityModel.modelId,

0 commit comments

Comments
 (0)