diff --git a/iOS_SDK/OneSignalSDK/OneSignalCore/Source/API/OneSignalClient.m b/iOS_SDK/OneSignalSDK/OneSignalCore/Source/API/OneSignalClient.m index 5cfee3305d..5e99619dfa 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalCore/Source/API/OneSignalClient.m +++ b/iOS_SDK/OneSignalSDK/OneSignalCore/Source/API/OneSignalClient.m @@ -76,9 +76,10 @@ - (OneSignalClientError *)privacyConsentErrorWithRequestType:(NSString *)type { - (void)executeRequest:(OneSignalRequest *)request onSuccess:(OSResultSuccessBlock)successBlock onFailure:(OSClientFailureBlock)failureBlock { // If privacy consent is required but not yet given, any non-GET request should be blocked. if (request.method != GET && [OSPrivacyConsentController shouldLogMissingPrivacyConsentErrorWithMethodName:nil]) { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"Attempted to perform an HTTP request (%@) before the user provided privacy consent."]; + OneSignalClientError *consentError = [self privacyConsentErrorWithRequestType:NSStringFromClass(request.class)]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:consentError.message]; if (failureBlock) { - failureBlock([self privacyConsentErrorWithRequestType:NSStringFromClass(request.class)]); + failureBlock(consentError); } return; diff --git a/iOS_SDK/OneSignalSDK/OneSignalCore/Source/OSPrivacyConsentController.m b/iOS_SDK/OneSignalSDK/OneSignalCore/Source/OSPrivacyConsentController.m index a91b7af51f..4896da3309 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalCore/Source/OSPrivacyConsentController.m +++ b/iOS_SDK/OneSignalSDK/OneSignalCore/Source/OSPrivacyConsentController.m @@ -66,7 +66,7 @@ + (void)setRequiresPrivacyConsent:(BOOL)required { return; if ([self requiresUserPrivacyConsent] && !required) { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"Cannot change setConsentRequired() from TRUE to FALSE"]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"Cannot change setConsentRequired() from TRUE to FALSE"]; return; } [OneSignalUserDefaults.initShared saveBoolForKey:OSUD_REQUIRES_USER_PRIVACY_CONSENT withValue:required]; diff --git a/iOS_SDK/OneSignalSDK/OneSignalCore/Source/OSStubInAppMessages.m b/iOS_SDK/OneSignalSDK/OneSignalCore/Source/OSStubInAppMessages.m index b15fc8ab2e..8fe21ec336 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalCore/Source/OSStubInAppMessages.m +++ b/iOS_SDK/OneSignalSDK/OneSignalCore/Source/OSStubInAppMessages.m @@ -36,48 +36,48 @@ @implementation OSStubInAppMessages } + (void)addClickListener:(NSObject * _Nullable)listener { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"OneSignalInAppMessages not found. In order to use OneSignal's In App Messaging features the OneSignalInAppMessages module must be added."]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"OneSignalInAppMessages not found. In order to use OneSignal's In App Messaging features the OneSignalInAppMessages module must be added."]; } + (void)addLifecycleListener:(NSObject * _Nullable)listener { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"OneSignalInAppMessages not found. In order to use OneSignal's In App Messaging features the OneSignalInAppMessages module must be added."]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"OneSignalInAppMessages not found. In order to use OneSignal's In App Messaging features the OneSignalInAppMessages module must be added."]; } + (void)addTrigger:(NSString * _Nonnull)key withValue:(NSString * _Nonnull)value { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"OneSignalInAppMessages not found. In order to use OneSignal's In App Messaging features the OneSignalInAppMessages module must be added."]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"OneSignalInAppMessages not found. In order to use OneSignal's In App Messaging features the OneSignalInAppMessages module must be added."]; } + (void)addTriggers:(NSDictionary * _Nonnull)triggers { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"OneSignalInAppMessages not found. In order to use OneSignal's In App Messaging features the OneSignalInAppMessages module must be added."]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"OneSignalInAppMessages not found. In order to use OneSignal's In App Messaging features the OneSignalInAppMessages module must be added."]; } + (void)clearTriggers { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"OneSignalInAppMessages not found. In order to use OneSignal's In App Messaging features the OneSignalInAppMessages module must be added."]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"OneSignalInAppMessages not found. In order to use OneSignal's In App Messaging features the OneSignalInAppMessages module must be added."]; } + (BOOL)paused { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"OneSignalInAppMessages not found. In order to use OneSignal's In App Messaging features the OneSignalInAppMessages module must be added."]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"OneSignalInAppMessages not found. In order to use OneSignal's In App Messaging features the OneSignalInAppMessages module must be added."]; return true; } + (void)paused:(BOOL)pause { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"OneSignalInAppMessages not found. In order to use OneSignal's In App Messaging features the OneSignalInAppMessages module must be added."]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"OneSignalInAppMessages not found. In order to use OneSignal's In App Messaging features the OneSignalInAppMessages module must be added."]; } + (void)removeClickListener:(NSObject * _Nullable)listener { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"OneSignalInAppMessages not found. In order to use OneSignal's In App Messaging features the OneSignalInAppMessages module must be added."]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"OneSignalInAppMessages not found. In order to use OneSignal's In App Messaging features the OneSignalInAppMessages module must be added."]; } + (void)removeLifecycleListener:(NSObject * _Nullable)listener { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"OneSignalInAppMessages not found. In order to use OneSignal's In App Messaging features the OneSignalInAppMessages module must be added."]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"OneSignalInAppMessages not found. In order to use OneSignal's In App Messaging features the OneSignalInAppMessages module must be added."]; } + (void)removeTrigger:(NSString * _Nonnull)key { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"OneSignalInAppMessages not found. In order to use OneSignal's In App Messaging features the OneSignalInAppMessages module must be added."]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"OneSignalInAppMessages not found. In order to use OneSignal's In App Messaging features the OneSignalInAppMessages module must be added."]; } + (void)removeTriggers:(NSArray * _Nonnull)keys { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"OneSignalInAppMessages not found. In order to use OneSignal's In App Messaging features the OneSignalInAppMessages module must be added."]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"OneSignalInAppMessages not found. In order to use OneSignal's In App Messaging features the OneSignalInAppMessages module must be added."]; } @end diff --git a/iOS_SDK/OneSignalSDK/OneSignalCore/Source/OSStubLocation.m b/iOS_SDK/OneSignalSDK/OneSignalCore/Source/OSStubLocation.m index e04faf84ec..35b74286a4 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalCore/Source/OSStubLocation.m +++ b/iOS_SDK/OneSignalSDK/OneSignalCore/Source/OSStubLocation.m @@ -36,16 +36,16 @@ @implementation OSStubLocation } + (BOOL)isShared { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"OneSignalLocation not found. In order to use OneSignal's location features the OneSignalLocation module must be added."]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"OneSignalLocation not found. In order to use OneSignal's location features the OneSignalLocation module must be added."]; return false; } + (void)requestPermission { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"OneSignalLocation not found. In order to use OneSignal's location features the OneSignalLocation module must be added."]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"OneSignalLocation not found. In order to use OneSignal's location features the OneSignalLocation module must be added."]; } + (void)setShared:(BOOL)enable { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"OneSignalLocation not found. In order to use OneSignal's location features the OneSignalLocation module must be added."]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"OneSignalLocation not found. In order to use OneSignal's location features the OneSignalLocation module must be added."]; } @end diff --git a/iOS_SDK/OneSignalSDK/OneSignalExtension/OneSignalAttachmentHandler.m b/iOS_SDK/OneSignalSDK/OneSignalExtension/OneSignalAttachmentHandler.m index c3209c6bb4..15ac446a97 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalExtension/OneSignalAttachmentHandler.m +++ b/iOS_SDK/OneSignalSDK/OneSignalExtension/OneSignalAttachmentHandler.m @@ -49,7 +49,7 @@ @implementation DirectDownloadDelegate -(void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data { NSError *fileHandleError; if (![outputHandle writeData:data error:&fileHandleError]) { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:[NSString stringWithFormat:@"OneSignal Error encountered while downloading attachment: %@", fileHandleError]]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:[NSString stringWithFormat:@"OneSignal Error encountered while downloading attachment: %@", fileHandleError]]; } } @@ -271,7 +271,7 @@ + (NSString *)downloadMediaAndSaveInBundle:(NSString *)urlString { let mimeType = [NSURLSession downloadItemAtURL:url toFile:filePath error:&error]; if (error) { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:[NSString stringWithFormat:@"Encountered an error while attempting to download file with URL: %@", error]]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:[NSString stringWithFormat:@"Encountered an error while attempting to download file with URL: %@", error]]; return nil; } @@ -286,7 +286,7 @@ + (NSString *)downloadMediaAndSaveInBundle:(NSString *)urlString { [[NSFileManager defaultManager] moveItemAtPath:filePath toPath:newPath error:&error]; if (error) { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:[NSString stringWithFormat:@"Encountered an error while attempting to download file with URL: %@", error]]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:[NSString stringWithFormat:@"Encountered an error while attempting to download file with URL: %@", error]]; return nil; } @@ -304,7 +304,7 @@ + (NSString *)downloadMediaAndSaveInBundle:(NSString *)urlString { [standardUserDefaults saveObjectForKey:OSUD_TEMP_CACHED_NOTIFICATION_MEDIA withValue:appendedCache]; return name; } @catch (NSException *exception) { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:[NSString stringWithFormat:@"OneSignal encountered an exception while downloading file (%@), exception: %@", url, exception.description]]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:[NSString stringWithFormat:@"OneSignal encountered an exception while downloading file (%@), exception: %@", url, exception.description]]; return nil; } diff --git a/iOS_SDK/OneSignalSDK/OneSignalExtension/OneSignalNotificationServiceExtensionHandler.m b/iOS_SDK/OneSignalSDK/OneSignalExtension/OneSignalNotificationServiceExtensionHandler.m index 3815453408..8ed4adaa98 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalExtension/OneSignalNotificationServiceExtensionHandler.m +++ b/iOS_SDK/OneSignalSDK/OneSignalExtension/OneSignalNotificationServiceExtensionHandler.m @@ -153,7 +153,7 @@ + (void)onNotificationReceived:(NSString *)receivedNotificationId withBlockingTa dispatch_semaphore_signal(semaphore); } } failureBlock:^(NSError *error) { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:[NSString stringWithFormat:@"OneSignal onNotificationReceived sendReceiveReceipt Failed for playerId: %@ error: %@", playerId, error]]; + [OneSignalLog onesignalLog:ONE_S_LL_INFO message:[NSString stringWithFormat:@"OneSignal onNotificationReceived sendReceiveReceipt Failed for playerId: %@ error: %@", playerId, error]]; if (semaphore) { dispatch_semaphore_signal(semaphore); } diff --git a/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSMessagingController.m b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSMessagingController.m index 704316abb9..78c5f7f5cc 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSMessagingController.m +++ b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSMessagingController.m @@ -657,7 +657,7 @@ - (void)resetRedisplayMessagesBySession { - (void)deleteInactiveMessage:(OSInAppMessageInternal *)message { let deleteMessage = [NSString stringWithFormat:@"Deleting inactive in-app message from cache: %@", message.messageId]; - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:deleteMessage]; + [OneSignalLog onesignalLog:ONE_S_LL_DEBUG message:deleteMessage]; NSMutableArray *newMessagesArray = [NSMutableArray arrayWithArray:self.messages]; [newMessagesArray removeObject: message]; self.messages = newMessagesArray; @@ -872,7 +872,7 @@ - (void)messageViewPageImpressionRequest:(OSInAppMessageInternal *)message withP } onFailure:^(OneSignalClientError *error) { NSString *errorMessage = [NSString stringWithFormat:@"In App Message with message id: %@ and page id: %@, failed POST page impression update with error: %@", message.messageId, pageId, error.message]; - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:errorMessage]; + [OneSignalLog onesignalLog:ONE_S_LL_INFO message:errorMessage]; if (message) { [self.viewedPageIDs removeObject:messagePrefixedPageId]; } @@ -912,7 +912,7 @@ - (void)messageViewImpressionRequest:(OSInAppMessageInternal *)message { } onFailure:^(OneSignalClientError *error) { NSString *errorMessage = [NSString stringWithFormat:@"In App Message with id: %@, failed POST impression update with error: %@", message.messageId, error.message]; - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:errorMessage]; + [OneSignalLog onesignalLog:ONE_S_LL_INFO message:errorMessage]; // If the post failed, remove the messageId from the impressionedInAppMessages set [self.impressionedInAppMessages removeObject:message.messageId]; @@ -1333,7 +1333,7 @@ - (void)sendClickRESTCall:(OSInAppMessageInternal *)message withAction:(OSInAppM } onFailure:^(OneSignalClientError *error) { NSString *errorMessage = [NSString stringWithFormat:@"In App Message with id: %@, failed POST click update for click id: %@, with error: %@", message.messageId, action.clickId, error.message]; - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:errorMessage]; + [OneSignalLog onesignalLog:ONE_S_LL_INFO message:errorMessage]; // Remove clickId from local clickedClickIds since click was not tracked [self.clickedClickIds removeObject:action.clickId]; @@ -1359,7 +1359,7 @@ - (void)sendOutcomes:(NSArray*)outcomes forMessageId:(N - (void)sendClickActionOutcomes:(NSArray *)outcomes { if (![OSOutcomes sharedController]) { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"Make sure OneSignal init is called first"]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"Make sure OneSignal init is called first"]; return; } diff --git a/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Model/OSInAppMessageLocationPrompt.m b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Model/OSInAppMessageLocationPrompt.m index b5d0e8d60c..e6af50dc86 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Model/OSInAppMessageLocationPrompt.m +++ b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Model/OSInAppMessageLocationPrompt.m @@ -63,7 +63,7 @@ - (void)handlePrompt:(void (^)(PromptActionResult result))completionHandler { [invocation setArgument: &completionHandler atIndex: 3]; [invocation invoke]; } else { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"OneSignalLocation not found. In order to use OneSignal's location features the OneSignalLocation module must be added."]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"OneSignalLocation not found. In order to use OneSignal's location features the OneSignalLocation module must be added."]; } } diff --git a/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/UI/OSInAppMessageView.m b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/UI/OSInAppMessageView.m index aef2b358bf..e11f88f4b4 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/UI/OSInAppMessageView.m +++ b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/UI/OSInAppMessageView.m @@ -156,7 +156,7 @@ - (void)resetWebViewToMaxBoundsAndResizeHeight:(void (^) (NSNumber *newHeight)) [self.webView evaluateJavaScript:OS_JS_GET_PAGE_META_DATA_METHOD completionHandler:^(NSDictionary *result, NSError *error) { if (error) { NSString *errorMessage = [NSString stringWithFormat:@"Javascript Method: %@ Evaluated with Error: %@", OS_JS_GET_PAGE_META_DATA_METHOD, error]; - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:errorMessage]; + [OneSignalLog onesignalLog:ONE_S_LL_INFO message:errorMessage]; return; } NSString *successMessage = [NSString stringWithFormat:@"Javascript Method: %@ Evaluated with Success: %@", OS_JS_GET_PAGE_META_DATA_METHOD, result]; @@ -182,7 +182,7 @@ - (void)updateSafeAreaInsets { [self.webView evaluateJavaScript:setInsetsString completionHandler:^(NSDictionary *result, NSError * _Nullable error) { if (error) { NSString *errorMessage = [NSString stringWithFormat:@"Javascript Method: %@ Evaluated with Error: %@", OS_SET_SAFE_AREA_INSETS_METHOD, error]; - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:errorMessage]; + [OneSignalLog onesignalLog:ONE_S_LL_INFO message:errorMessage]; return; } NSString *successMessage = [NSString stringWithFormat:@"Javascript Method: %@ Evaluated with Success: %@", OS_SET_SAFE_AREA_INSETS_METHOD, result]; diff --git a/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/UI/OSInAppMessageViewController.m b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/UI/OSInAppMessageViewController.m index 873e7447d6..fd560e034b 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/UI/OSInAppMessageViewController.m +++ b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/UI/OSInAppMessageViewController.m @@ -339,7 +339,7 @@ - (void)encounteredErrorLoadingMessageContent:(NSError * _Nullable)error { if (error.code == 410 || error.code == 404) { [self.delegate messageIsNotActive:self.message]; } - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:message]; + [OneSignalLog onesignalLog:ONE_S_LL_INFO message:message]; } /* diff --git a/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/UI/OneSignalWebView.m b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/UI/OneSignalWebView.m index 06910b334a..22ba8b6b7e 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/UI/OneSignalWebView.m +++ b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/UI/OneSignalWebView.m @@ -91,7 +91,7 @@ -(void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigati } -(void)webView:(WKWebView *)webView didFailNavigation:(WKNavigation *)navigation withError:(NSError *)error { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:[NSString stringWithFormat:@"webView: An error occurred during navigation: %@", error]]; + [OneSignalLog onesignalLog:ONE_S_LL_INFO message:[NSString stringWithFormat:@"webView: An error occurred during navigation: %@", error]]; } - (void)pinSubviewToMarginsWithSubview:(UIView *)subview withSuperview:(UIView *)superview { diff --git a/iOS_SDK/OneSignalSDK/OneSignalLocation/OneSignalLocationManager.m b/iOS_SDK/OneSignalSDK/OneSignalLocation/OneSignalLocationManager.m index 9fc2403aa5..b20566d8fe 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalLocation/OneSignalLocationManager.m +++ b/iOS_SDK/OneSignalSDK/OneSignalLocation/OneSignalLocationManager.m @@ -309,7 +309,7 @@ + (void)internalGetLocation:(bool)prompt fallbackToSettings:(BOOL)fallback { } else { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"Include a privacy NSLocationAlwaysUsageDescription or NSLocationWhenInUseUsageDescription in your info.plist to request location permissions."]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"Include a privacy NSLocationAlwaysUsageDescription or NSLocationWhenInUseUsageDescription in your info.plist to request location permissions."]; [self sendAndClearLocationListener:LOCATION_PERMISSIONS_MISSING_INFO_PLIST]; } @@ -406,7 +406,7 @@ - (void)locationManager:(id)manager didUpdateLocations:(NSArray *)locations { } - (void)locationManager:(id)manager didFailWithError:(NSError *)error { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:[NSString stringWithFormat:@"CLLocationManager did fail with error: %@", error]]; + [OneSignalLog onesignalLog:ONE_S_LL_INFO message:[NSString stringWithFormat:@"CLLocationManager did fail with error: %@", error]]; [OneSignalLocationManager sendAndClearLocationListener:ERROR]; if ([OneSignalLocationManager backgroundTaskIsActive]) { [OneSignalLocationManager endTask]; diff --git a/iOS_SDK/OneSignalSDK/OneSignalNotifications/OSNotification+OneSignal.m b/iOS_SDK/OneSignalSDK/OneSignalNotifications/OSNotification+OneSignal.m index b2f9cefb11..41f5aefddd 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalNotifications/OSNotification+OneSignal.m +++ b/iOS_SDK/OneSignalSDK/OneSignalNotifications/OSNotification+OneSignal.m @@ -64,7 +64,7 @@ - (void)setCompletionBlock:(OSNotificationDisplayResponse)completion { - (void)display { if (!_completion) { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"OSNotificationWillDisplayEvent.notification.display cannot be called due to timing out or notification was already displayed."]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"OSNotificationWillDisplayEvent.notification.display cannot be called due to timing out or notification was already displayed."]; } [self complete:self]; } diff --git a/iOS_SDK/OneSignalSDK/OneSignalNotifications/OSNotificationsManager.m b/iOS_SDK/OneSignalSDK/OneSignalNotifications/OSNotificationsManager.m index d855d0c7ae..15b5379008 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalNotifications/OSNotificationsManager.m +++ b/iOS_SDK/OneSignalSDK/OneSignalNotifications/OSNotificationsManager.m @@ -393,7 +393,7 @@ + (void)presentAppSettings { if ([[UIApplication sharedApplication] canOpenURL:url]) { [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil]; } else { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"Unable to open settings for this application"]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"Unable to open settings for this application"]; } } @@ -471,15 +471,15 @@ + (void)processFailedRemoteNotificationsRegistration:(NSError*)err { if (err.code == 3000) { [self setSubscriptionErrorStatus:ERROR_PUSH_CAPABLILITY_DISABLED]; - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"ERROR! 'Push Notifications' capability missing! Add the capability in Xcode under 'Target' -> '' -> 'Signing & Capabilities' then click the '+ Capability' button."]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"ERROR! 'Push Notifications' capability missing! Add the capability in Xcode under 'Target' -> '' -> 'Signing & Capabilities' then click the '+ Capability' button."]; } else if (err.code == 3010) { [self setSubscriptionErrorStatus:ERROR_PUSH_SIMULATOR_NOT_SUPPORTED]; - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:[NSString stringWithFormat:@"Error! iOS Simulator does not support push! Please test on a real iOS device. Error: %@", err]]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:[NSString stringWithFormat:@"Error! iOS Simulator does not support push! Please test on a real iOS device. Error: %@", err]]; } else { [self setSubscriptionErrorStatus:ERROR_PUSH_UNKNOWN_APNS_ERROR]; - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:[NSString stringWithFormat:@"Error registering for Apple push notifications! Error: %@", err]]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:[NSString stringWithFormat:@"Error registering for Apple push notifications! Error: %@", err]]; } } @@ -1032,7 +1032,7 @@ + (void)setBadgeCount:(NSInteger)badgeCount { if (@available(iOS 16.0, *)) { [[UNUserNotificationCenter currentNotificationCenter] setBadgeCount:badgeCount withCompletionHandler:^(NSError * _Nullable error) { if (error) { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:[NSString stringWithFormat:@"setBadgeCount encountered error setting badge count: %@", error]]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:[NSString stringWithFormat:@"setBadgeCount encountered error setting badge count: %@", error]]; } }]; } else { diff --git a/iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/OSBackgroundTaskManager.swift b/iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/OSBackgroundTaskManager.swift index 65d99f3643..3ecd2af474 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/OSBackgroundTaskManager.swift +++ b/iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/OSBackgroundTaskManager.swift @@ -63,7 +63,7 @@ public class OSBackgroundTaskManager: NSObject { @objc public static func setTaskInvalid(_ taskIdentifier: String) { guard let delegate = taskHandler else { - OneSignalLog.onesignalLog(.LL_ERROR, message: "OSBackgroundTaskManager:setTaskInvalid \(taskIdentifier) cannot be executed due to no task handler.") + OneSignalLog.onesignalLog(.LL_DEBUG, message: "OSBackgroundTaskManager:setTaskInvalid \(taskIdentifier) cannot be executed due to no task handler.") // But not necessarily an error because this task won't exist // Can be called in initialization of services before delegate is set return diff --git a/iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/OSInputGuard.swift b/iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/OSInputGuard.swift index 20a2efa34c..0c1e97f494 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/OSInputGuard.swift +++ b/iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/OSInputGuard.swift @@ -34,13 +34,13 @@ public final class OSInputGuard: NSObject { public static func isMissing(_ value: String?, _ api: String) -> Bool { // A NUL cannot be stored in a text column, so it is never a usable value. if let value, value.contains("\u{0000}") { - OneSignalLog.onesignalLog(.LL_ERROR, message: "\(api) contains a null byte") + OneSignalLog.onesignalLog(.LL_WARN, message: "\(api) contains a null byte") return true } if let value, !value.isEmpty { return false } - OneSignalLog.onesignalLog(.LL_ERROR, message: "\(api) is required") + OneSignalLog.onesignalLog(.LL_WARN, message: "\(api) is required") return true } diff --git a/iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/OSModelStore.swift b/iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/OSModelStore.swift index b35978a846..8e8e1aaaed 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/OSModelStore.swift +++ b/iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/OSModelStore.swift @@ -151,7 +151,7 @@ open class OSModelStore: NSObject { // persist the models (with removed model) to storage OneSignalUserDefaults.initShared().saveCodeableData(forKey: self.storeKey, withValue: self.models) } else { - OneSignalLog.onesignalLog(.LL_ERROR, message: "OSModelStore cannot remove \(id) because it doesn't exist in the store.") + OneSignalLog.onesignalLog(.LL_WARN, message: "OSModelStore cannot remove \(id) because it doesn't exist in the store.") return } } diff --git a/iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/OSStubLiveActivities.swift b/iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/OSStubLiveActivities.swift index 6360b564fc..4e5426a3cb 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/OSStubLiveActivities.swift +++ b/iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/OSStubLiveActivities.swift @@ -39,6 +39,6 @@ public class OSStubLiveActivities: NSObject, OSLiveActivities { private static func logUnavailable() { let message = "OneSignalLiveActivities not found. In order to use OneSignal's " + "LiveActivities features the OneSignalLiveActivities module must be added." - OneSignalLog.onesignalLog(.LL_ERROR, message: message) + OneSignalLog.onesignalLog(.LL_WARN, message: message) } } diff --git a/iOS_SDK/OneSignalSDK/OneSignalOutcomes/OSOutcomes.m b/iOS_SDK/OneSignalSDK/OneSignalOutcomes/OSOutcomes.m index 88df80b148..264b3dfe7b 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalOutcomes/OSOutcomes.m +++ b/iOS_SDK/OneSignalSDK/OneSignalOutcomes/OSOutcomes.m @@ -96,7 +96,7 @@ + (void)addOutcome:(NSString * _Nonnull)name { return; } if (!_sharedController) { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"Attempted to call OneSignal.Session before init. Make sure OneSignal init is called first."]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"Attempted to call OneSignal.Session before init. Make sure OneSignal init is called first."]; return; } @@ -108,7 +108,7 @@ + (void)addOutcomeWithValue:(NSString * _Nonnull)name value:(NSNumber * _Nonnull return; } if (!_sharedController) { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"Attempted to call OneSignal.Session before init. Make sure OneSignal init is called first."]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"Attempted to call OneSignal.Session before init. Make sure OneSignal init is called first."]; return; } @@ -120,7 +120,7 @@ + (void)addUniqueOutcome:(NSString * _Nonnull)name { return; } if (!_sharedController) { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"Attempted to call OneSignal.Session before init. Make sure OneSignal init is called first."]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"Attempted to call OneSignal.Session before init. Make sure OneSignal init is called first."]; return; } diff --git a/iOS_SDK/OneSignalSDK/OneSignalOutcomes/Source/OutcomeEvents/OneSignalOutcomeEventsController.m b/iOS_SDK/OneSignalSDK/OneSignalOutcomes/Source/OutcomeEvents/OneSignalOutcomeEventsController.m index d792ae8cc3..6ad9489238 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalOutcomes/Source/OutcomeEvents/OneSignalOutcomeEventsController.m +++ b/iOS_SDK/OneSignalSDK/OneSignalOutcomes/Source/OutcomeEvents/OneSignalOutcomeEventsController.m @@ -123,7 +123,7 @@ - (void)sendSessionEndOutcomes:(NSNumber * _Nonnull)timeElapsed successBlock(result); } } onFailure:^(OneSignalClientError *error) { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"OneSignalOutcomeEventsController:sendSessionEndOutcomes failed"]; + [OneSignalLog onesignalLog:ONE_S_LL_DEBUG message:@"OneSignalOutcomeEventsController:sendSessionEndOutcomes failed"]; if (failureBlock) { failureBlock(error.underlyingError); } @@ -361,7 +361,7 @@ - (void)addUniqueOutcome:(NSString * _Nonnull)name { - (BOOL)isValidOutcomeEntry:(NSString * _Nonnull)name { if (!name || [name length] == 0) { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"Outcome name must not be null or empty"]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"Outcome name must not be null or empty"]; return false; } @@ -370,7 +370,7 @@ - (BOOL)isValidOutcomeEntry:(NSString * _Nonnull)name { - (BOOL)isValidOutcomeValue:(NSNumber *)value { if (!value || value.intValue <= 0) { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"Outcome value must not be null or 0"]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"Outcome value must not be null or 0"]; return false; } diff --git a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSCustomEventsExecutor.swift b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSCustomEventsExecutor.swift index 185ded8a3e..bb421d7006 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSCustomEventsExecutor.swift +++ b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSCustomEventsExecutor.swift @@ -352,7 +352,7 @@ class OSCustomEventsExecutor: OSOperationExecutor { } } } onFailure: { error in - OneSignalLog.onesignalLog(.LL_ERROR, message: "OSCustomEventsExecutor request failed with error: \(error.debugDescription)") + OneSignalLog.logRequestFailure("OSCustomEventsExecutor request failed with error: \(error.debugDescription)", statusCode: error.code) self.dispatchQueue.async { let responseType = OSNetworkingUtils.getResponseStatusType(error.code) if responseType == .unauthorized, self.auth.handleUnauthorized(request) { diff --git a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSIdentityOperationExecutor.swift b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSIdentityOperationExecutor.swift index 4c85052b79..4f0663059f 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSIdentityOperationExecutor.swift +++ b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSIdentityOperationExecutor.swift @@ -67,7 +67,7 @@ class OSIdentityOperationExecutor: OSOperationExecutor { delta.model = modelInStore } else { // The model does not exist, drop this Delta - OneSignalLog.onesignalLog(.LL_ERROR, message: "OSIdentityOperationExecutor.init dropped \(delta)") + OneSignalLog.onesignalLog(.LL_WARN, message: "OSIdentityOperationExecutor.init dropped \(delta)") deltaQueue.remove(at: index) } } @@ -92,7 +92,7 @@ class OSIdentityOperationExecutor: OSOperationExecutor { OneSignalUserManagerImpl.sharedInstance.addIdentityModelToRepo(request.identityModel) } else { // 3. The model do not exist AND this request cannot be sent, drop this Request - OneSignalLog.onesignalLog(.LL_ERROR, message: "OSIdentityOperationExecutor.init dropped \(request)") + OneSignalLog.onesignalLog(.LL_WARN, message: "OSIdentityOperationExecutor.init dropped \(request)") addRequestQueue.remove(at: index) } } @@ -117,7 +117,7 @@ class OSIdentityOperationExecutor: OSOperationExecutor { OneSignalUserManagerImpl.sharedInstance.addIdentityModelToRepo(request.identityModel) } else { // 3. The model does not exist AND this request cannot be sent, drop this Request - OneSignalLog.onesignalLog(.LL_ERROR, message: "OSIdentityOperationExecutor.init dropped \(request)") + OneSignalLog.onesignalLog(.LL_WARN, message: "OSIdentityOperationExecutor.init dropped \(request)") removeRequestQueue.remove(at: index) } } @@ -273,7 +273,7 @@ class OSIdentityOperationExecutor: OSOperationExecutor { } } } onFailure: { error in - OneSignalLog.onesignalLog(.LL_ERROR, message: "OSIdentityOperationExecutor add aliases request failed with error: \(error.debugDescription)") + OneSignalLog.logRequestFailure("OSIdentityOperationExecutor add aliases request failed with error: \(error.debugDescription)", statusCode: error.code) self.dispatchQueue.async { let responseType = OSNetworkingUtils.getResponseStatusType(error.code) if responseType == .missing { @@ -335,7 +335,7 @@ class OSIdentityOperationExecutor: OSOperationExecutor { } } } onFailure: { error in - OneSignalLog.onesignalLog(.LL_ERROR, message: "OSIdentityOperationExecutor remove alias request failed with error: \(error.debugDescription)") + OneSignalLog.logRequestFailure("OSIdentityOperationExecutor remove alias request failed with error: \(error.debugDescription)", statusCode: error.code) self.dispatchQueue.async { let responseType = OSNetworkingUtils.getResponseStatusType(error.code) if responseType == .unauthorized, self.auth.handleUnauthorized(request) { diff --git a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSPropertyOperationExecutor.swift b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSPropertyOperationExecutor.swift index aef7f8676b..a3be4331b6 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSPropertyOperationExecutor.swift +++ b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSPropertyOperationExecutor.swift @@ -183,7 +183,7 @@ class OSPropertyOperationExecutor: OSOperationExecutor { for delta in self.deltaQueue { guard let identityModel = OneSignalUserManagerImpl.sharedInstance.getIdentityModel(delta.identityModelId) else { - OneSignalLog.onesignalLog(.LL_ERROR, message: "OSPropertyOperationExecutor.processDeltaQueue dropped: \(delta)") + OneSignalLog.onesignalLog(.LL_WARN, message: "OSPropertyOperationExecutor.processDeltaQueue dropped: \(delta)") continue } let combinedSoFar: OSCombinedProperties? = combinedProperties[identityModel.modelId] @@ -326,7 +326,7 @@ class OSPropertyOperationExecutor: OSOperationExecutor { OSConsistencyManager.shared.setRywTokenAndDelay(id: onesignalId, key: OSIamFetchOffsetKey.userUpdate, value: rywData) } } onFailure: { error in - OneSignalLog.onesignalLog(.LL_ERROR, message: "OSPropertyOperationExecutor update properties request failed with error: \(error.debugDescription)") + OneSignalLog.logRequestFailure("OSPropertyOperationExecutor update properties request failed with error: \(error.debugDescription)", statusCode: error.code) self.dispatchQueue.async { let responseType = OSNetworkingUtils.getResponseStatusType(error.code) if responseType == .missing { diff --git a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSSubscriptionOperationExecutor.swift b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSSubscriptionOperationExecutor.swift index 538859c837..2c89929ec5 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSSubscriptionOperationExecutor.swift +++ b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSSubscriptionOperationExecutor.swift @@ -67,7 +67,7 @@ class OSSubscriptionOperationExecutor: OSOperationExecutor { delta.model = modelInStore } else { // The model does not exist, drop this Delta - OneSignalLog.onesignalLog(.LL_ERROR, message: "OSSubscriptionOperationExecutor.init dropped \(delta)") + OneSignalLog.onesignalLog(.LL_WARN, message: "OSSubscriptionOperationExecutor.init dropped \(delta)") deltaQueue.remove(at: index) } } @@ -129,7 +129,7 @@ class OSSubscriptionOperationExecutor: OSOperationExecutor { } else if !auth.keepUncachedOwned(request), !request.prepareForExecution(newRecordsState: newRecordsState, auth: auth) { // 3. The model does not exist AND no token can arrive to make this sendable, drop it - OneSignalLog.onesignalLog(.LL_ERROR, message: "OSSubscriptionOperationExecutor.init dropped \(request)") + OneSignalLog.onesignalLog(.LL_WARN, message: "OSSubscriptionOperationExecutor.init dropped \(request)") removeRequestQueue.remove(at: index) continue } @@ -153,7 +153,7 @@ class OSSubscriptionOperationExecutor: OSOperationExecutor { request.subscriptionModel = subscriptionModel } else if !request.prepareForExecution(newRecordsState: newRecordsState, auth: auth) { // 3. The models do not exist AND this request cannot be sent, drop this Request - OneSignalLog.onesignalLog(.LL_ERROR, message: "OSSubscriptionOperationExecutor.init dropped \(request)") + OneSignalLog.onesignalLog(.LL_WARN, message: "OSSubscriptionOperationExecutor.init dropped \(request)") updateRequestQueue.remove(at: index) continue } @@ -265,7 +265,7 @@ class OSSubscriptionOperationExecutor: OSOperationExecutor { ) self.addRequestQueue.append(request) } else { - OneSignalLog.onesignalLog(.LL_ERROR, message: "OSSubscriptionOperationExecutor.processDeltaQueue dropped \(delta)") + OneSignalLog.onesignalLog(.LL_WARN, message: "OSSubscriptionOperationExecutor.processDeltaQueue dropped \(delta)") } case OS_REMOVE_SUBSCRIPTION_DELTA: let request = OSRequestDeleteSubscription( @@ -389,7 +389,7 @@ extension OSSubscriptionOperationExecutor { } } } onFailure: { error in - OneSignalLog.onesignalLog(.LL_ERROR, message: "OSSubscriptionOperationExecutor create subscription request failed with error: \(error.debugDescription)") + OneSignalLog.logRequestFailure("OSSubscriptionOperationExecutor create subscription request failed with error: \(error.debugDescription)", statusCode: error.code) self.dispatchQueue.async { let responseType = OSNetworkingUtils.getResponseStatusType(error.code) if responseType == .missing { @@ -450,7 +450,7 @@ extension OSSubscriptionOperationExecutor { } } } onFailure: { error in - OneSignalLog.onesignalLog(.LL_ERROR, message: "OSSubscriptionOperationExecutor delete subscription request failed with error: \(error.debugDescription)") + OneSignalLog.logRequestFailure("OSSubscriptionOperationExecutor delete subscription request failed with error: \(error.debugDescription)", statusCode: error.code) self.dispatchQueue.async { let responseType = OSNetworkingUtils.getResponseStatusType(error.code) // No token handling: the delete is never signed, so a 401 here is not about the user's JWT. @@ -513,7 +513,7 @@ extension OSSubscriptionOperationExecutor { } } } onFailure: { error in - OneSignalLog.onesignalLog(.LL_ERROR, message: "OSSubscriptionOperationExecutor update subscription request failed with error: \(error.debugDescription)") + OneSignalLog.logRequestFailure("OSSubscriptionOperationExecutor update subscription request failed with error: \(error.debugDescription)", statusCode: error.code) self.dispatchQueue.async { let responseType = OSNetworkingUtils.getResponseStatusType(error.code) if responseType != .retryable { diff --git a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSUserExecutor.swift b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSUserExecutor.swift index d10d7c53c6..cb8e5a0065 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSUserExecutor.swift +++ b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSUserExecutor.swift @@ -232,7 +232,7 @@ class OSUserExecutor { } userRequestQueue.append(req) } else { - OneSignalLog.onesignalLog(.LL_ERROR, message: "OSUserExecutor.start() dropped: \(request)") + OneSignalLog.onesignalLog(.LL_WARN, message: "OSUserExecutor.start() dropped: \(request)") } } } @@ -536,9 +536,10 @@ extension OSUserExecutor { } OneSignalUserManagerImpl.sharedInstance.operationRepo.paused = false } onFailure: { error in - OneSignalLog.onesignalLog(.LL_ERROR, message: "OSUserExecutor create user request failed with error: \(error.debugDescription)") + let message = "OSUserExecutor create user request failed with error: \(error.debugDescription)" let responseType = OSNetworkingUtils.getResponseStatusType(error.code) if responseType == .unauthorized, self.auth.handleUnauthorized(request) { + OneSignalLog.onesignalLog(.LL_INFO, message: message) // Held rather than paused: `updateUserJwt` resumes work by flushing, which a paused Repo drops. // Ordering does not need the pause — every Request for this user waits on an `onesignal_id`. OneSignalLog.onesignalLog(.LL_DEBUG, message: "OSUserExecutor holding \(request) for a new token") @@ -546,6 +547,7 @@ extension OSUserExecutor { // re-enter so that token is used now rather than waiting on another wake. self.executePendingRequests() } else if responseType != .retryable { + OneSignalLog.onesignalLog(.LL_ERROR, message: message) // A failed create user request would leave the SDK in a bad state // Don't remove the request from cache and pause the operation repo // We will retry this request on a new session. Stays marked as sent until then, so other @@ -563,6 +565,7 @@ extension OSUserExecutor { } } } else { + OneSignalLog.onesignalLog(.LL_INFO, message: message) self.retryLater(request, error: error) } } @@ -611,7 +614,7 @@ extension OSUserExecutor { self.removeFromQueue(request) } } onFailure: { error in - OneSignalLog.onesignalLog(.LL_ERROR, message: "OSUserExecutor executeFetchIdentityBySubscriptionRequest failed with error: \(error.debugDescription)") + OneSignalLog.logRequestFailure("OSUserExecutor executeFetchIdentityBySubscriptionRequest failed with error: \(error.debugDescription)", statusCode: error.code) let responseType = OSNetworkingUtils.getResponseStatusType(error.code) if responseType != .retryable { // Fail, no retry, remove the subscription_id but keep the same push subscription model @@ -752,7 +755,7 @@ extension OSUserExecutor { if !subscriptionExists { // This subscription probably has been deleted - OneSignalLog.onesignalLog(.LL_ERROR, message: "OSUserExecutor.executeFetchUserRequest found this device's push subscription gone, now send the push subscription to server.") + OneSignalLog.onesignalLog(.LL_WARN, message: "OSUserExecutor.executeFetchUserRequest found this device's push subscription gone, now send the push subscription to server.") OneSignalUserManagerImpl.sharedInstance.pushSubscriptionModel?.subscriptionId = nil OneSignalUserManagerImpl.sharedInstance.createPushSubscriptionRequest() } @@ -760,7 +763,7 @@ extension OSUserExecutor { } self.executePendingRequests() } onFailure: { error in - OneSignalLog.onesignalLog(.LL_ERROR, message: "OSUserExecutor executeFetchUserRequest failed with error: \(error.debugDescription)") + OneSignalLog.logRequestFailure("OSUserExecutor executeFetchUserRequest failed with error: \(error.debugDescription)", statusCode: error.code) let responseType = OSNetworkingUtils.getResponseStatusType(error.code) if responseType == .missing { self.removeFromQueue(request) diff --git a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSIdentityModelRepo.swift b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSIdentityModelRepo.swift index c1468632e7..c310322b8b 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSIdentityModelRepo.swift +++ b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSIdentityModelRepo.swift @@ -71,7 +71,7 @@ class OSIdentityModelRepo { func updateJwtToken(externalId: String, token: String) -> Bool { let matchingModels = modelsMatching(externalId: externalId) guard !matchingModels.isEmpty else { - OneSignalLog.onesignalLog(.LL_ERROR, message: "OSIdentityModelRepo.updateJwtToken called for unknown external ID \(externalId)") + OneSignalLog.onesignalLog(.LL_WARN, message: "OSIdentityModelRepo.updateJwtToken called for unknown external ID \(externalId)") return false } for model in matchingModels { @@ -97,7 +97,7 @@ class OSIdentityModelRepo { func invalidateJwtToken(externalId: String, rejectedToken: String) -> Bool { let matchingModels = modelsMatching(externalId: externalId) guard !matchingModels.isEmpty else { - OneSignalLog.onesignalLog(.LL_ERROR, message: "OSIdentityModelRepo.invalidateJwtToken called for unknown external ID \(externalId)") + OneSignalLog.onesignalLog(.LL_WARN, message: "OSIdentityModelRepo.invalidateJwtToken called for unknown external ID \(externalId)") return false } for model in matchingModels { diff --git a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSPropertiesModelStoreListener.swift b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSPropertiesModelStoreListener.swift index ec4d5da5b3..7807346f90 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSPropertiesModelStoreListener.swift +++ b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSPropertiesModelStoreListener.swift @@ -52,7 +52,7 @@ class OSPropertiesModelStoreListener: OSModelStoreListener { let userInstance = OneSignalUserManagerImpl.sharedInstance._user, userInstance.propertiesModel.modelId == args.model.modelId else { - OneSignalLog.onesignalLog(.LL_ERROR, message: "OSPropertiesModelStoreListener.getUpdateModelDelta encountered unsupported property: \(args.property), no user instance, or a properties model that is not the current user's") + OneSignalLog.onesignalLog(.LL_WARN, message: "OSPropertiesModelStoreListener.getUpdateModelDelta encountered unsupported property: \(args.property), no user instance, or a properties model that is not the current user's") return nil } let identityModel = userInstance.identityModel diff --git a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSSubscriptionModelStoreListener.swift b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSSubscriptionModelStoreListener.swift index 4d82244422..962bac0f7a 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSSubscriptionModelStoreListener.swift +++ b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSSubscriptionModelStoreListener.swift @@ -43,7 +43,7 @@ class OSSubscriptionModelStoreListener: OSModelStoreListener { guard let userInstance = OneSignalUserManagerImpl.sharedInstance._user, store.getModel(modelId: model.modelId) != nil else { - OneSignalLog.onesignalLog(.LL_ERROR, message: "OSSubscriptionModelStoreListener.getAddModelDelta has no user instance or the model is not in the current store") + OneSignalLog.onesignalLog(.LL_WARN, message: "OSSubscriptionModelStoreListener.getAddModelDelta has no user instance or the model is not in the current store") return nil } let identityModel = userInstance.identityModel @@ -63,7 +63,7 @@ class OSSubscriptionModelStoreListener: OSModelStoreListener { */ func getRemoveModelDelta(_ model: OSSubscriptionModel) -> OSDelta? { guard let userInstance = OneSignalUserManagerImpl.sharedInstance._user else { - OneSignalLog.onesignalLog(.LL_ERROR, message: "OSSubscriptionModelStoreListener.getRemoveModelDelta has no user instance") + OneSignalLog.onesignalLog(.LL_WARN, message: "OSSubscriptionModelStoreListener.getRemoveModelDelta has no user instance") return nil } let identityModel = userInstance.identityModel @@ -85,7 +85,7 @@ class OSSubscriptionModelStoreListener: OSModelStoreListener { // something like the app_version. If the app_version hasn't changed since the last session, there // wouldn't be an update needed (among other system-level properties). guard let userInstance = OneSignalUserManagerImpl.sharedInstance._user else { - OneSignalLog.onesignalLog(.LL_ERROR, message: "OSSubscriptionModelStoreListener.getUpdateModelDelta has no user instance") + OneSignalLog.onesignalLog(.LL_WARN, message: "OSSubscriptionModelStoreListener.getUpdateModelDelta has no user instance") return nil } let identityModel = userInstance.identityModel diff --git a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSUserInternalImpl.swift b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSUserInternalImpl.swift index ff705640ba..f98d4b2446 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSUserInternalImpl.swift +++ b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSUserInternalImpl.swift @@ -92,7 +92,7 @@ class OSUserInternalImpl: NSObject, OSUserInternal { !aliases.values.contains("") else { // log error - OneSignalLog.onesignalLog(.LL_ERROR, message: "OneSignal.User addAliases error: Cannot use \(OS_ONESIGNAL_ID) or \(OS_EXTERNAL_ID) as a alias label. Or, cannot use empty string as an alias ID.") + OneSignalLog.onesignalLog(.LL_WARN, message: "OneSignal.User addAliases error: Cannot use \(OS_ONESIGNAL_ID) or \(OS_EXTERNAL_ID) as a alias label. Or, cannot use empty string as an alias ID.") return } identityModel.addAliases(aliases) @@ -107,7 +107,7 @@ class OSUserInternalImpl: NSObject, OSUserInternal { !labels.contains(OS_EXTERNAL_ID) else { // log error - OneSignalLog.onesignalLog(.LL_ERROR, message: "OneSignal.User removeAliases error: Cannot use \(OS_ONESIGNAL_ID) or \(OS_EXTERNAL_ID) as a alias label.") + OneSignalLog.onesignalLog(.LL_WARN, message: "OneSignal.User removeAliases error: Cannot use \(OS_ONESIGNAL_ID) or \(OS_EXTERNAL_ID) as a alias label.") return } identityModel.removeAliases(labels) diff --git a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSUserJwtRepo.swift b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSUserJwtRepo.swift index db22f24ac4..48a587a123 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSUserJwtRepo.swift +++ b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSUserJwtRepo.swift @@ -86,7 +86,7 @@ final class OSUserJwtRepo: OSUserJwtProviding { @discardableResult func updateJwt(externalId: String, token: String) -> Bool { guard !token.isEmpty, token != OS_JWT_TOKEN_INVALID else { - OneSignalLog.onesignalLog(.LL_ERROR, message: "OSUserJwtRepo.updateJwt ignored an unusable token for \(externalId)") + OneSignalLog.onesignalLog(.LL_WARN, message: "OSUserJwtRepo.updateJwt ignored an unusable token for \(externalId)") return false } guard identityModelRepo.updateJwtToken(externalId: externalId, token: token) else { diff --git a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OneSignalUserManagerImpl+Jwt.swift b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OneSignalUserManagerImpl+Jwt.swift index 078e2835f7..5579d3b4ab 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OneSignalUserManagerImpl+Jwt.swift +++ b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OneSignalUserManagerImpl+Jwt.swift @@ -150,7 +150,7 @@ extension OneSignalUserManagerImpl { return } guard !externalId.isEmpty, !token.isEmpty, token != OS_JWT_TOKEN_INVALID else { - OneSignalLog.onesignalLog(.LL_ERROR, message: "OneSignal.updateUserJwt called with empty externalId or an unusable token. This is not allowed.") + OneSignalLog.onesignalLog(.LL_WARN, message: "OneSignal.updateUserJwt called with empty externalId or an unusable token. This is not allowed.") return } OneSignalLog.onesignalLog( diff --git a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OneSignalUserManagerImpl.swift b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OneSignalUserManagerImpl.swift index 1d914e1b0a..c3d90fb0fd 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OneSignalUserManagerImpl.swift +++ b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OneSignalUserManagerImpl.swift @@ -961,7 +961,7 @@ extension OneSignalUserManagerImpl: OSUser { // Make sure the properties are serializable as JSON object guard JSONSerialization.isValidJSONObject(processedProperties) else { - OneSignalLog.onesignalLog(.LL_ERROR, message: "trackEvent called with invalid properties \(processedProperties), dropping this event.") + OneSignalLog.onesignalLog(.LL_WARN, message: "trackEvent called with invalid properties \(processedProperties), dropping this event.") return } diff --git a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Requests/OSUserRequest.swift b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Requests/OSUserRequest.swift index ac02149fe5..e370fb03c0 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Requests/OSUserRequest.swift +++ b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Requests/OSUserRequest.swift @@ -87,3 +87,11 @@ internal extension OneSignalRequest { } } } + +extension OneSignalLog { + /// Callers that pause the Operation Repo on a failure log ERROR instead. + static func logRequestFailure(_ message: String, statusCode: Int) { + let responseType = OSNetworkingUtils.getResponseStatusType(statusCode) + onesignalLog(responseType == .retryable ? .LL_INFO : .LL_WARN, message: message) + } +} diff --git a/iOS_SDK/OneSignalSDK/Source/OSAttributedFocusTimeProcessor.m b/iOS_SDK/OneSignalSDK/Source/OSAttributedFocusTimeProcessor.m index 649d2468bd..93168d9b99 100644 --- a/iOS_SDK/OneSignalSDK/Source/OSAttributedFocusTimeProcessor.m +++ b/iOS_SDK/OneSignalSDK/Source/OSAttributedFocusTimeProcessor.m @@ -111,7 +111,7 @@ - (void)sendBackgroundAttributedSessionTimeWithParams:(OSFocusCallParams *)param [super saveUnsentActiveTime:0]; [OSBackgroundTaskManager endBackgroundTask:SESSION_OUTCOMES_TASK]; } onFailure:^(NSError *error) { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"sendBackgroundAttributed failed, will retry on next open"]; + [OneSignalLog onesignalLog:ONE_S_LL_INFO message:@"sendBackgroundAttributed failed, will retry on next open"]; [OSBackgroundTaskManager endBackgroundTask:SESSION_OUTCOMES_TASK]; }]; }); diff --git a/iOS_SDK/OneSignalSDK/Source/OSUnattributedFocusTimeProcessor.m b/iOS_SDK/OneSignalSDK/Source/OSUnattributedFocusTimeProcessor.m index 714631131c..46579315c8 100644 --- a/iOS_SDK/OneSignalSDK/Source/OSUnattributedFocusTimeProcessor.m +++ b/iOS_SDK/OneSignalSDK/Source/OSUnattributedFocusTimeProcessor.m @@ -110,7 +110,7 @@ - (void)sendBackgroundUnattributedSessionTimeWithParams:(OSFocusCallParams *)par [super saveUnsentActiveTime:0]; [OSBackgroundTaskManager endBackgroundTask:SESSION_OUTCOMES_TASK]; } onFailure:^(NSError *error) { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"sendUnattributed session end outcomes failed, will retry on next open"]; + [OneSignalLog onesignalLog:ONE_S_LL_INFO message:@"sendUnattributed session end outcomes failed, will retry on next open"]; [OSBackgroundTaskManager endBackgroundTask:SESSION_OUTCOMES_TASK]; }]; }); diff --git a/iOS_SDK/OneSignalSDK/Source/OneSignal.m b/iOS_SDK/OneSignalSDK/Source/OneSignal.m index 1957233482..7abad9fcdf 100755 --- a/iOS_SDK/OneSignalSDK/Source/OneSignal.m +++ b/iOS_SDK/OneSignalSDK/Source/OneSignal.m @@ -227,7 +227,7 @@ + (void)logout { if (oneSignalInAppMessages != nil && [oneSignalInAppMessages respondsToSelector:@selector(InAppMessages)]) { return [oneSignalInAppMessages performSelector:@selector(InAppMessages)]; } else { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"OneSignalInAppMessages not found. In order to use OneSignal's In App Messaging features the OneSignalInAppMessages module must be added."]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"OneSignalInAppMessages not found. In order to use OneSignal's In App Messaging features the OneSignalInAppMessages module must be added."]; return [OSStubInAppMessages InAppMessages]; } } @@ -240,7 +240,7 @@ + (void)logout { if (oneSignalLiveActivities != nil && [oneSignalLiveActivities respondsToSelector:@selector(liveActivities)]) { return [oneSignalLiveActivities performSelector:@selector(liveActivities)]; } else { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"oneSignalLiveActivities not found. In order to use OneSignal's LiveActivities features the OneSignalLiveActivities module must be added."]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"oneSignalLiveActivities not found. In order to use OneSignal's LiveActivities features the OneSignalLiveActivities module must be added."]; return [OSStubLiveActivities liveActivities]; } #endif @@ -493,7 +493,7 @@ + (void)startLiveActivitiesManager { if (oneSignalLiveActivities != nil && [oneSignalLiveActivities respondsToSelector:@selector(start)]) { [oneSignalLiveActivities performSelector:@selector(start)]; } else { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"oneSignalLiveActivities not found. In order to use OneSignal's LiveActivities features the OneSignalLiveActivities module must be added."]; + [OneSignalLog onesignalLog:ONE_S_LL_INFO message:@"OneSignalLiveActivities module not found, Live Activities will not start. Add the module to use OneSignal's LiveActivities features."]; } #endif } @@ -943,7 +943,7 @@ + (UNMutableNotificationContent*)serviceExtensionTimeWillExpireRequest:(UNNotifi + (void)sendSessionEndOutcomes:(NSNumber*)totalTimeActive params:(OSFocusCallParams *)params onSuccess:(OSResultSuccessBlock _Nonnull)successBlock onFailure:(OSFailureBlock _Nonnull)failureBlock { if (![OSOutcomes sharedController]) { - [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:@"Make sure OneSignal init is called first"]; + [OneSignalLog onesignalLog:ONE_S_LL_WARN message:@"Make sure OneSignal init is called first"]; if (failureBlock) { failureBlock([NSError errorWithDomain:@"onesignal" code:0 userInfo:@{@"error" : @"Missing outcomes controller."}]); }