From 7d0089790780f8ff8fbb7e8ea955b99481098cec Mon Sep 17 00:00:00 2001 From: Ryan Zhao Date: Mon, 14 Feb 2022 11:21:32 +1100 Subject: [PATCH] minor clean up --- .../Calls/Call Management/SessionCallManager.swift | 1 - .../Conversations/ConversationMessageMapping.swift | 10 +++++----- Session/Meta/AppDelegate.m | 12 +++++------- .../NotificationServiceExtension.swift | 4 ++-- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/Session/Calls/Call Management/SessionCallManager.swift b/Session/Calls/Call Management/SessionCallManager.swift index 91cb26a01..548f9bf52 100644 --- a/Session/Calls/Call Management/SessionCallManager.swift +++ b/Session/Calls/Call Management/SessionCallManager.swift @@ -94,7 +94,6 @@ public final class SessionCallManager: NSObject { guard error == nil else { self.reportCurrentCallEnded(reason: .failed) completion(error) - Logger.error("failed to report new incoming call, error: \(error!)") return } completion(nil) diff --git a/Session/Conversations/ConversationMessageMapping.swift b/Session/Conversations/ConversationMessageMapping.swift index f48503948..e418561f5 100644 --- a/Session/Conversations/ConversationMessageMapping.swift +++ b/Session/Conversations/ConversationMessageMapping.swift @@ -218,24 +218,24 @@ public class ConversationMessageMapping: NSObject { return IndexPath(row: oldIndex, section: 0) } guard let view = transaction.ext(viewName) as? YapDatabaseAutoViewTransaction else { - owsFailDebug("Could not load view.") + SNLog("Could not load view.") return nil } guard let group = group else { - owsFailDebug("No group.") + SNLog("No group.") return nil } let indexPtr: UnsafeMutablePointer = UnsafeMutablePointer.allocate(capacity: 1) let wasFound = view.getGroup(nil, index: indexPtr, forKey: uniqueId, inCollection: TSInteraction.collection()) guard wasFound else { - owsFailDebug("Could not find interaction.") + SNLog("Could not find interaction.") return nil } let index = indexPtr.pointee let threadInteractionCount = view.numberOfItems(inGroup: group) guard index < threadInteractionCount else { - owsFailDebug("Invalid index.") + SNLog("Invalid index.") return nil } // This math doesn't take into account the number of items loaded _after_ the pivot. @@ -244,7 +244,7 @@ public class ConversationMessageMapping: NSObject { self.update(withDesiredLength: desiredWindowSize, transaction: transaction) guard let newIndex = loadedUniqueIds().firstIndex(of: uniqueId) else { - owsFailDebug("Couldn't find interaction.") + SNLog("Couldn't find interaction.") return nil } return IndexPath(row: newIndex, section: 0) diff --git a/Session/Meta/AppDelegate.m b/Session/Meta/AppDelegate.m index 919841572..7e2c0e090 100644 --- a/Session/Meta/AppDelegate.m +++ b/Session/Meta/AppDelegate.m @@ -197,13 +197,11 @@ static NSTimeInterval launchStartedAt; LKAppMode appMode = [self getCurrentAppMode]; [self adaptAppMode:appMode]; - if (@available(iOS 11, *)) { - // This must happen in appDidFinishLaunching or earlier to ensure we don't - // miss notifications. - // Setting the delegate also seems to prevent us from getting the legacy notification - // notification callbacks upon launch e.g. 'didReceiveLocalNotification' - UNUserNotificationCenter.currentNotificationCenter.delegate = self; - } + // This must happen in appDidFinishLaunching or earlier to ensure we don't + // miss notifications. + // Setting the delegate also seems to prevent us from getting the legacy notification + // notification callbacks upon launch e.g. 'didReceiveLocalNotification' + UNUserNotificationCenter.currentNotificationCenter.delegate = self; [OWSScreenLockUI.sharedManager setupWithRootWindow:self.window]; [[OWSWindowManager sharedManager] setupWithRootWindow:self.window diff --git a/SessionNotificationServiceExtension/NotificationServiceExtension.swift b/SessionNotificationServiceExtension/NotificationServiceExtension.swift index e67e6481b..a4cec194e 100644 --- a/SessionNotificationServiceExtension/NotificationServiceExtension.swift +++ b/SessionNotificationServiceExtension/NotificationServiceExtension.swift @@ -233,10 +233,10 @@ public final class NotificationServiceExtension : UNNotificationServiceExtension CXProvider.reportNewIncomingVoIPPushPayload(payload) { error in if let error = error { self.handleSuccess(for: content) - owsFailDebug("Failed to notify main app of call message: \(error)") + SNLog("Failed to notify main app of call message: \(error)") } else { self.completeSilenty() - Logger.info("Successfully notified main app of call message.") + SNLog("Successfully notified main app of call message.") } } }