minor clean up

This commit is contained in:
Ryan Zhao 2022-02-14 11:21:32 +11:00
parent 83c7283a76
commit 7d00897907
4 changed files with 12 additions and 15 deletions

View File

@ -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)

View File

@ -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<UInt> = UnsafeMutablePointer<UInt>.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)

View File

@ -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

View File

@ -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.")
}
}
}