Skip to content

Commit 239245e

Browse files
committed
[nits] logging, old temp code
* override `description` for OSModelChangedArgs, OSDelta to print more details for them * remove unnecessary logs * remove old code / temp code * Remove some overly verbose logs, prints
1 parent 07c0a9e commit 239245e

File tree

9 files changed

+11
-28
lines changed

9 files changed

+11
-28
lines changed

iOS_SDK/OneSignalSDK/OneSignalNotifications/OSNotificationsManager.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ + (BOOL)canRequestPermission {
226226
}
227227

228228
+ (void)requestPermission:(OSUserResponseBlock)block {
229-
NSLog(@"🔥 requestPermission:(OSUserResponseBlock)block called");
230229
// return if the user has not granted privacy permissions
231230
if ([OSPrivacyConsentController shouldLogMissingPrivacyConsentErrorWithMethodName:@"requestPermission:"])
232231
return;

iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/OSDelta.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ open class OSDelta: NSObject, NSCoding {
3838
public let property: String
3939
public let value: Any
4040

41+
override open var description: String {
42+
return "OSDelta \(name) with property: \(property) value: \(value)"
43+
}
44+
4145
public init(name: String, model: OSModel, property: String, value: Any) {
4246
self.name = name
4347
self.deltaId = UUID().uuidString

iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/OSModelChangedHandler.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ public class OSModelChangedArgs: NSObject {
4343
*/
4444
public let newValue: Any
4545

46+
override public var description: String {
47+
return "OSModelChangedArgs for model: \(model) with property: \(property) value: \(newValue)"
48+
}
49+
4650
init(model: OSModel, property: String, newValue: Any) {
4751
self.model = model
4852
self.property = property

iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/OSModelStore.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,7 @@ open class OSModelStore<TModel: OSModel>: NSObject {
117117
We may still need references to model(s) in this store!
118118
*/
119119
@objc func removeModelsFromUserDefaults() {
120-
print("🔥 OSModelStore \(self.storeKey): removeModelsFromUserDefaults() called.")
121-
// Clear the UserDefaults models cache when OS_ON_USER_WILL_CHANGE
122-
120+
// Clear the UserDefaults models cache when OS_ON_USER_WILL_CHANGEclearModelsFromStore() called
123121
OneSignalUserDefaults.initShared().removeValue(forKey: self.storeKey)
124122
}
125123

@@ -129,7 +127,6 @@ open class OSModelStore<TModel: OSModel>: NSObject {
129127
In contrast, it is not necessary for the Identity or Properties Model Stores to do so.
130128
*/
131129
public func clearModelsFromStore() {
132-
print("🔥 OSModelStore \(self.storeKey): clearModelsFromStore() called.")
133130
self.models = [:]
134131
}
135132
}

iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/OSOperationRepo.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ public class OSOperationRepo: NSObject {
9090
return
9191
}
9292
start()
93-
print("🔥 OSOperationRepo addExecutor: \(executor)")
9493
executors.append(executor)
9594
for delta in executor.supportedDeltas {
9695
deltasToExecutorMap[delta] = executor

iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSUserInternalImpl.swift

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ protocol OSUserInternal {
4646
func setLocation(lat:Float, long:Float)
4747
// Language
4848
func setLanguage(_ language: String?)
49-
50-
// TODO: UM This is a temporary function to create a push subscription for testing
51-
func testCreatePushSubscription(subscriptionId: String, token: String, enabled: Bool) -> OSSubscriptionModel
5249
}
5350

5451
/**
@@ -68,13 +65,6 @@ class OSUserInternalImpl: NSObject, OSUserInternal {
6865

6966
// Sessions will be outside this?
7067

71-
// TODO: UM This is a temporary function to create a push subscription for testing
72-
func testCreatePushSubscription(subscriptionId: String, token: String, enabled: Bool) -> OSSubscriptionModel {
73-
pushSubscriptionModel = OSSubscriptionModel(type: .push, address: token, subscriptionId: subscriptionId, accepted: true, isDisabled: false, changeNotifier: OSEventProducer())
74-
print("🔥 OSUserInternalImpl has set pushSubcription for testing")
75-
return pushSubscriptionModel
76-
}
77-
7868
init(identityModel: OSIdentityModel, propertiesModel: OSPropertiesModel, pushSubscriptionModel: OSSubscriptionModel) {
7969
self.identityModel = identityModel
8070
self.propertiesModel = propertiesModel

iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSUserRequests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ class OSRequestCreateUser: OneSignalRequest, OSUserRequest {
235235

236236
func prepareForExecution() -> Bool {
237237
guard let appId = OneSignalConfigManager.getAppId() else {
238+
OneSignalLog.onesignalLog(.LL_DEBUG, message: "Cannot generate the create user request due to null app ID.")
238239
return false
239240
}
240241
self.addJWTHeader(identityModel:identityModel)

iOS_SDK/OneSignalSDK/OneSignalUser/Source/OneSignalUserManagerImpl.swift

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ import OneSignalNotifications
7070
typealias OSJwtCompletionBlock = (_ newJwtToken: String) -> Void
7171
typealias OSJwtExpiredHandler = (_ externalId: String, _ completion: OSJwtCompletionBlock) -> Void
7272
func onJwtExpired(expiredHandler: @escaping OSJwtExpiredHandler)
73-
74-
// TODO: UM This is a temporary function to create a push subscription for testing
75-
func testCreatePushSubscription(subscriptionId: String, token: String, enabled: Bool)
7673
}
7774

7875
/**
@@ -313,6 +310,7 @@ public class OneSignalUserManagerImpl: NSObject, OneSignalUserManager {
313310
and the operation repo flushing the current (soon to be old) user's operations.
314311
*/
315312
private func prepareForNewUser() {
313+
OneSignalLog.onesignalLog(.LL_VERBOSE, message: "OneSignalUserManagerImpl prepareForNewUser called")
316314
NotificationCenter.default.post(name: Notification.Name(OS_ON_USER_WILL_CHANGE), object: nil)
317315

318316
// This store MUST be cleared, Identity and Properties do not.
@@ -607,13 +605,6 @@ extension OneSignalUserManagerImpl: OSUser {
607605
}
608606
user.setLanguage(language)
609607
}
610-
611-
public func testCreatePushSubscription(subscriptionId: String, token: String, enabled: Bool) {
612-
guard !OneSignalConfigManager.shouldAwaitAppIdAndLogMissingPrivacyConsent(forMethod: nil) else {
613-
return
614-
}
615-
user.testCreatePushSubscription(subscriptionId: subscriptionId, token: token, enabled: enabled)
616-
}
617608
}
618609

619610
extension OneSignalUserManagerImpl: OSPushSubscription {

iOS_SDK/OneSignalSDK/Source/OneSignal.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,6 @@ + (void)startNewSessionInternal {
406406

407407
sessionLaunchTime = [NSDate date];
408408

409-
[OneSignalLog onesignalLog:ONE_S_LL_VERBOSE message:@"Calling OneSignal `create/on_session`"];
410-
411409
// TODO: Figure out if Create User also sets session_count automatically on backend
412410
[OneSignalUserManagerImpl.sharedInstance startNewSession];
413411

0 commit comments

Comments
 (0)