From a7a05e9bbfea8e44532d2e7619275a6769a880d1 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Wed, 19 Sep 2018 16:27:26 -0400 Subject: [PATCH] Respond to CR. Rework how CallNotificationsAdapter adaptee is populated. --- .../CallNotificationsAdapter.swift | 18 ++++++++---------- Signal/src/environment/SignalApp.m | 9 ++++----- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/Signal/src/UserInterface/Notifications/CallNotificationsAdapter.swift b/Signal/src/UserInterface/Notifications/CallNotificationsAdapter.swift index 06decc2ea..fe05e43f1 100644 --- a/Signal/src/UserInterface/Notifications/CallNotificationsAdapter.swift +++ b/Signal/src/UserInterface/Notifications/CallNotificationsAdapter.swift @@ -10,20 +10,18 @@ import Foundation @objc(OWSCallNotificationsAdapter) public class CallNotificationsAdapter: NSObject { - let adaptee: OWSCallNotificationsAdaptee - - @objc public init(adaptee: OWSCallNotificationsAdaptee) { - // TODO We can't mix UILocalNotification (NotificationManager) with the UNNotifications + var adaptee: OWSCallNotificationsAdaptee { + // TODO: We may eventually want to use UserNotificationsAdaptee instead. + // + // We can't mix UILocalNotification (NotificationManager) with the UNNotifications // Because registering message categories in one, clobbers the registered categories from the other // We have to first port *all* the existing UINotification categories to UNNotifications - // which is a good thing to do, but in trying to limit the scope of changes that's been + // which is a good thing to do, but in trying to limit the scope of changes that's been // left out for now. -// if #available(iOS 10.0, *) { -// adaptee = UserNotificationsAdaptee() -// } else { - self.adaptee = adaptee -// } + return SignalApp.shared().notificationsManager + } + @objc public override init() { super.init() SwiftSingletons.register(self) diff --git a/Signal/src/environment/SignalApp.m b/Signal/src/environment/SignalApp.m index c881216f8..7cb04af99 100644 --- a/Signal/src/environment/SignalApp.m +++ b/Signal/src/environment/SignalApp.m @@ -73,11 +73,10 @@ NS_ASSUME_NONNULL_BEGIN selector:@selector(didChangeCallLoggingPreference:) name:OWSPreferencesCallLoggingDidChangeNotification object:nil]; - _callService = [[CallService alloc] - initWithAccountManager:self.accountManager - contactsManager:Environment.shared.contactsManager - messageSender:SSKEnvironment.shared.messageSender - notificationsAdapter:[[OWSCallNotificationsAdapter alloc] initWithAdaptee:self.notificationsManager]]; + _callService = [[CallService alloc] initWithAccountManager:self.accountManager + contactsManager:Environment.shared.contactsManager + messageSender:SSKEnvironment.shared.messageSender + notificationsAdapter:[OWSCallNotificationsAdapter new]]; _callMessageHandler = [[OWSWebRTCCallMessageHandler alloc] initWithAccountManager:self.accountManager