From c5fc671c31954c49424e79bbba4264bf2b31c333 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Thu, 8 Mar 2018 16:21:34 -0500 Subject: [PATCH 1/3] Fix lost call transactions after rebuilding callUIAdapter // FREEBIE --- .../Speakerbox/CallKitCallUIAdaptee.swift | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Signal/src/call/Speakerbox/CallKitCallUIAdaptee.swift b/Signal/src/call/Speakerbox/CallKitCallUIAdaptee.swift index bd9d9f87c..f1b8f62d9 100644 --- a/Signal/src/call/Speakerbox/CallKitCallUIAdaptee.swift +++ b/Signal/src/call/Speakerbox/CallKitCallUIAdaptee.swift @@ -31,6 +31,23 @@ final class CallKitCallUIAdaptee: NSObject, CallUIAdaptee, CXProviderDelegate { // CallKit handles incoming ringer stop/start for us. Yay! let hasManualRinger = false + // Instantiating more than one CXProvider can cause us to miss call transactions, so + // we maintain the provider across Adaptees using a singleton pattern + private static var _sharedProvider: CXProvider? + class func sharedProvider(useSystemCallLog: Bool) -> CXProvider { + let configuration = buildProviderConfiguration(useSystemCallLog: useSystemCallLog) + + if let sharedProvider = self._sharedProvider { + sharedProvider.configuration = configuration + return sharedProvider + } else { + SwiftSingletons.register(self) + let provider = CXProvider(configuration: configuration) + _sharedProvider = provider + return provider + } + } + // The app's provider configuration, representing its CallKit capabilities class func buildProviderConfiguration(useSystemCallLog: Bool) -> CXProviderConfiguration { let localizedName = NSLocalizedString("APPLICATION_NAME", comment: "Name of application") @@ -71,8 +88,7 @@ final class CallKitCallUIAdaptee: NSObject, CallUIAdaptee, CXProviderDelegate { self.contactsManager = contactsManager self.notificationsAdapter = notificationsAdapter - let providerConfiguration = type(of: self).buildProviderConfiguration(useSystemCallLog: useSystemCallLog) - self.provider = CXProvider(configuration: providerConfiguration) + self.provider = type(of: self).sharedProvider(useSystemCallLog: useSystemCallLog) self.audioActivity = AudioActivity(audioDescription: "[CallKitCallUIAdaptee]") self.showNamesOnCallScreen = showNamesOnCallScreen From 58f2c65a1c5da181b16d8e1c95b6d8db9a409244 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Wed, 7 Mar 2018 15:29:13 -0500 Subject: [PATCH 2/3] Fix redundant profile downloads // FREEBIE --- SignalMessaging/profiles/OWSUserProfile.m | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/SignalMessaging/profiles/OWSUserProfile.m b/SignalMessaging/profiles/OWSUserProfile.m index c0a55b95b..ff7ca5808 100644 --- a/SignalMessaging/profiles/OWSUserProfile.m +++ b/SignalMessaging/profiles/OWSUserProfile.m @@ -106,18 +106,17 @@ NSString *const kLocalProfileUniqueId = @"kLocalProfileUniqueId"; { @synchronized(self) { - BOOL didChange; - if (_avatarUrlPath == nil && avatarUrlPath == nil) { - didChange = NO; - } else if (_avatarUrlPath != nil || avatarUrlPath != nil) { - didChange = YES; + BOOL isEqual; + if (avatarUrlPath != nil) { + isEqual = [avatarUrlPath isEqual:_avatarUrlPath]; } else { - didChange = [_avatarUrlPath isEqualToString:avatarUrlPath]; + // are they both nil? + isEqual = _avatarUrlPath == nil; } _avatarUrlPath = avatarUrlPath; - if (didChange) { + if (!isEqual) { // If the avatarURL changed, the avatarFileName can't be valid. // Clear it. self.avatarFileName = nil; From 9595f1c87f22c512ff08b44212979fb83e2c80fe Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Thu, 8 Mar 2018 17:28:08 -0500 Subject: [PATCH 3/3] "Bump build to 2.21.0.15." --- Signal/Signal-Info.plist | 2 +- SignalShareExtension/Info.plist | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Signal/Signal-Info.plist b/Signal/Signal-Info.plist index 571b0afb0..e66289035 100644 --- a/Signal/Signal-Info.plist +++ b/Signal/Signal-Info.plist @@ -38,7 +38,7 @@ CFBundleVersion - 2.21.0.14 + 2.21.0.15 ITSAppUsesNonExemptEncryption LOGS_EMAIL diff --git a/SignalShareExtension/Info.plist b/SignalShareExtension/Info.plist index d28617143..d793bb292 100644 --- a/SignalShareExtension/Info.plist +++ b/SignalShareExtension/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 2.21.0 CFBundleVersion - 2.21.0.14 + 2.21.0.15 ITSAppUsesNonExemptEncryption NSAppTransportSecurity