minor clean up

pull/562/head
Ryan Zhao 2 years ago
parent 83c7283a76
commit 7d00897907

@ -94,7 +94,6 @@ public final class SessionCallManager: NSObject {
guard error == nil else { guard error == nil else {
self.reportCurrentCallEnded(reason: .failed) self.reportCurrentCallEnded(reason: .failed)
completion(error) completion(error)
Logger.error("failed to report new incoming call, error: \(error!)")
return return
} }
completion(nil) completion(nil)

@ -218,24 +218,24 @@ public class ConversationMessageMapping: NSObject {
return IndexPath(row: oldIndex, section: 0) return IndexPath(row: oldIndex, section: 0)
} }
guard let view = transaction.ext(viewName) as? YapDatabaseAutoViewTransaction else { guard let view = transaction.ext(viewName) as? YapDatabaseAutoViewTransaction else {
owsFailDebug("Could not load view.") SNLog("Could not load view.")
return nil return nil
} }
guard let group = group else { guard let group = group else {
owsFailDebug("No group.") SNLog("No group.")
return nil return nil
} }
let indexPtr: UnsafeMutablePointer<UInt> = UnsafeMutablePointer<UInt>.allocate(capacity: 1) let indexPtr: UnsafeMutablePointer<UInt> = UnsafeMutablePointer<UInt>.allocate(capacity: 1)
let wasFound = view.getGroup(nil, index: indexPtr, forKey: uniqueId, inCollection: TSInteraction.collection()) let wasFound = view.getGroup(nil, index: indexPtr, forKey: uniqueId, inCollection: TSInteraction.collection())
guard wasFound else { guard wasFound else {
owsFailDebug("Could not find interaction.") SNLog("Could not find interaction.")
return nil return nil
} }
let index = indexPtr.pointee let index = indexPtr.pointee
let threadInteractionCount = view.numberOfItems(inGroup: group) let threadInteractionCount = view.numberOfItems(inGroup: group)
guard index < threadInteractionCount else { guard index < threadInteractionCount else {
owsFailDebug("Invalid index.") SNLog("Invalid index.")
return nil return nil
} }
// This math doesn't take into account the number of items loaded _after_ the pivot. // 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) self.update(withDesiredLength: desiredWindowSize, transaction: transaction)
guard let newIndex = loadedUniqueIds().firstIndex(of: uniqueId) else { guard let newIndex = loadedUniqueIds().firstIndex(of: uniqueId) else {
owsFailDebug("Couldn't find interaction.") SNLog("Couldn't find interaction.")
return nil return nil
} }
return IndexPath(row: newIndex, section: 0) return IndexPath(row: newIndex, section: 0)

@ -197,13 +197,11 @@ static NSTimeInterval launchStartedAt;
LKAppMode appMode = [self getCurrentAppMode]; LKAppMode appMode = [self getCurrentAppMode];
[self adaptAppMode:appMode]; [self adaptAppMode:appMode];
if (@available(iOS 11, *)) { // This must happen in appDidFinishLaunching or earlier to ensure we don't
// This must happen in appDidFinishLaunching or earlier to ensure we don't // miss notifications.
// miss notifications. // Setting the delegate also seems to prevent us from getting the legacy notification
// Setting the delegate also seems to prevent us from getting the legacy notification // notification callbacks upon launch e.g. 'didReceiveLocalNotification'
// notification callbacks upon launch e.g. 'didReceiveLocalNotification' UNUserNotificationCenter.currentNotificationCenter.delegate = self;
UNUserNotificationCenter.currentNotificationCenter.delegate = self;
}
[OWSScreenLockUI.sharedManager setupWithRootWindow:self.window]; [OWSScreenLockUI.sharedManager setupWithRootWindow:self.window];
[[OWSWindowManager sharedManager] setupWithRootWindow:self.window [[OWSWindowManager sharedManager] setupWithRootWindow:self.window

@ -233,10 +233,10 @@ public final class NotificationServiceExtension : UNNotificationServiceExtension
CXProvider.reportNewIncomingVoIPPushPayload(payload) { error in CXProvider.reportNewIncomingVoIPPushPayload(payload) { error in
if let error = error { if let error = error {
self.handleSuccess(for: content) 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 { } else {
self.completeSilenty() self.completeSilenty()
Logger.info("Successfully notified main app of call message.") SNLog("Successfully notified main app of call message.")
} }
} }
} }

Loading…
Cancel
Save