diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index bca9ed4e9..19286170e 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -2593,12 +2593,12 @@ 453518911FC63DBF00210559 = { CreatedOnToolsVersion = 9.2; DevelopmentTeam = U68MSDN6DR; - LastSwiftMigration = 0910; + LastSwiftMigration = 0930; ProvisioningStyle = Automatic; }; D221A088169C9E5E00537ABF = { DevelopmentTeam = U68MSDN6DR; - LastSwiftMigration = 0800; + LastSwiftMigration = 0930; ProvisioningStyle = Automatic; SystemCapabilities = { com.apple.ApplicationGroups.iOS = { @@ -2629,7 +2629,7 @@ }; D221A0A9169C9E5F00537ABF = { DevelopmentTeam = U68MSDN6DR; - LastSwiftMigration = 0800; + LastSwiftMigration = 0930; ProvisioningStyle = Automatic; TestTargetID = D221A088169C9E5E00537ABF; }; @@ -3597,7 +3597,8 @@ SDKROOT = iphoneos; SWIFT_OBJC_BRIDGING_HEADER = "Signal/src/Signal-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.0; TEST_AFTER_BUILD = YES; VALID_ARCHS = "arm64 armv7 armv7s"; WRAPPER_EXTENSION = app; @@ -3657,7 +3658,8 @@ PROVISIONING_PROFILE = ""; SWIFT_OBJC_BRIDGING_HEADER = "Signal/test/SignalTests-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Signal.app/Signal"; VALID_ARCHS = "arm64 armv7s armv7 i386 x86_64"; }; @@ -3901,7 +3903,8 @@ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OBJC_BRIDGING_HEADER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -3978,7 +3981,8 @@ SKIP_INSTALL = YES; SWIFT_OBJC_BRIDGING_HEADER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -4055,7 +4059,8 @@ SKIP_INSTALL = YES; SWIFT_OBJC_BRIDGING_HEADER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -4254,7 +4259,8 @@ SDKROOT = iphoneos; SWIFT_OBJC_BRIDGING_HEADER = "Signal/src/Signal-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.0; TEST_AFTER_BUILD = YES; VALID_ARCHS = "arm64 armv7 armv7s"; WRAPPER_EXTENSION = app; @@ -4313,7 +4319,8 @@ PROVISIONING_PROFILE = ""; SDKROOT = iphoneos; SWIFT_OBJC_BRIDGING_HEADER = "Signal/src/Signal-Bridging-Header.h"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.0; TEST_AFTER_BUILD = YES; VALID_ARCHS = "arm64 armv7 armv7s"; WRAPPER_EXTENSION = app; @@ -4373,7 +4380,8 @@ PROVISIONING_PROFILE = ""; SWIFT_OBJC_BRIDGING_HEADER = "Signal/test/SignalTests-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.0; TEST_HOST = "$(BUNDLE_LOADER)"; VALID_ARCHS = "arm64 armv7s armv7 i386 x86_64"; }; @@ -4431,7 +4439,8 @@ PROVISIONING_PROFILE = ""; SWIFT_OBJC_BRIDGING_HEADER = "Signal/test/SignalTests-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.0; TEST_HOST = "$(BUNDLE_LOADER)"; VALID_ARCHS = "arm64 armv7s armv7 i386 x86_64"; }; diff --git a/Signal/src/ViewControllers/CallViewController.swift b/Signal/src/ViewControllers/CallViewController.swift index 8c4f449f7..a6e171671 100644 --- a/Signal/src/ViewControllers/CallViewController.swift +++ b/Signal/src/ViewControllers/CallViewController.swift @@ -150,7 +150,7 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver, NotificationCenter.default.removeObserver(self) } - func didBecomeActive() { + @objc func didBecomeActive() { if (self.isViewLoaded) { shouldRemoteVideoControlsBeHidden = false } @@ -235,7 +235,7 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver, createSettingsNagViews() } - func didTouchRootView(sender: UIGestureRecognizer) { + @objc func didTouchRootView(sender: UIGestureRecognizer) { if !remoteVideoView.isHidden { shouldRemoteVideoControlsBeHidden = !shouldRemoteVideoControlsBeHidden } @@ -541,7 +541,7 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver, contactAvatarView.autoPinEdge(toSuperviewEdge: .right, withInset: 0, relation: .greaterThanOrEqual) contactAvatarView.autoPinEdge(toSuperviewEdge: .bottom, withInset: 0, relation: .greaterThanOrEqual) contactAvatarView.autoPinEdge(toSuperviewEdge: .left, withInset: 0, relation: .greaterThanOrEqual) - NSLayoutConstraint.autoSetPriority(UILayoutPriorityDefaultLow) { + NSLayoutConstraint.autoSetPriority(UILayoutPriority.defaultLow) { contactAvatarView.autoPinEdgesToSuperviewMargins() } @@ -825,7 +825,7 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver, /** * Ends a connected call. Do not confuse with `didPressDeclineCall`. */ - func didPressHangup(sender: UIButton) { + @objc func didPressHangup(sender: UIButton) { Logger.info("\(TAG) called \(#function)") callUIAdapter.localHangupCall(call) @@ -833,14 +833,14 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver, dismissIfPossible(shouldDelay: false) } - func didPressMute(sender muteButton: UIButton) { + @objc func didPressMute(sender muteButton: UIButton) { Logger.info("\(TAG) called \(#function)") muteButton.isSelected = !muteButton.isSelected callUIAdapter.setIsMuted(call: call, isMuted: muteButton.isSelected) } - func didPressAudioSource(sender button: UIButton) { + @objc func didPressAudioSource(sender button: UIButton) { Logger.info("\(TAG) called \(#function)") if self.hasAlternateAudioSources { @@ -863,20 +863,20 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver, dismissIfPossible(shouldDelay: false) } - func didPressAnswerCall(sender: UIButton) { + @objc func didPressAnswerCall(sender: UIButton) { Logger.info("\(TAG) called \(#function)") callUIAdapter.answerCall(call) } - func didPressVideo(sender: UIButton) { + @objc func didPressVideo(sender: UIButton) { Logger.info("\(TAG) called \(#function)") let hasLocalVideo = !sender.isSelected callUIAdapter.setHasLocalVideo(call: call, hasLocalVideo: hasLocalVideo) } - func didPressFlipCamera(sender: UIButton) { + @objc func didPressFlipCamera(sender: UIButton) { // toggle value sender.isSelected = !sender.isSelected @@ -889,7 +889,7 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver, /** * Denies an incoming not-yet-connected call, Do not confuse with `didPressHangup`. */ - func didPressDeclineCall(sender: UIButton) { + @objc func didPressDeclineCall(sender: UIButton) { Logger.info("\(TAG) called \(#function)") callUIAdapter.declineCall(call) @@ -897,7 +897,7 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver, dismissIfPossible(shouldDelay: false) } - func didPressShowCallSettings(sender: UIButton) { + @objc func didPressShowCallSettings(sender: UIButton) { Logger.info("\(TAG) called \(#function)") markSettingsNagAsComplete() @@ -916,7 +916,7 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver, }) } - func didPressDismissNag(sender: UIButton) { + @objc func didPressDismissNag(sender: UIButton) { Logger.info("\(TAG) called \(#function)") markSettingsNagAsComplete() @@ -939,7 +939,7 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver, preferences.setIsCallKitPrivacyEnabled(preferences.isCallKitPrivacyEnabled()) } - func didTapLeaveCall(sender: UIButton) { + @objc func didTapLeaveCall(sender: UIButton) { OWSWindowManager.shared().leaveCallView() } diff --git a/Signal/src/ViewControllers/ContactViewController.swift b/Signal/src/ViewControllers/ContactViewController.swift index 697fe432a..82c110e2d 100644 --- a/Signal/src/ViewControllers/ContactViewController.swift +++ b/Signal/src/ViewControllers/ContactViewController.swift @@ -214,7 +214,7 @@ class ContactViewController: OWSViewController, ContactShareViewHelperDelegate { // Back Button let backButtonSize = CGFloat(50) - let backButton = TappableView(actionBlock: { [weak self] _ in + let backButton = TappableView(actionBlock: { [weak self] guard let strongSelf = self else { return } strongSelf.didPressDismiss() }) @@ -280,21 +280,21 @@ class ContactViewController: OWSViewController, ContactShareViewHelperDelegate { stackView.addArrangedSubview(createCircleActionButton(text: NSLocalizedString("ACTION_SEND_MESSAGE", comment: "Label for 'sent message' button in contact view."), imageName: "contact_view_message", - actionBlock: { [weak self] _ in + actionBlock: { [weak self] guard let strongSelf = self else { return } strongSelf.didPressSendMessage() })) stackView.addArrangedSubview(createCircleActionButton(text: NSLocalizedString("ACTION_AUDIO_CALL", comment: "Label for 'audio call' button in contact view."), imageName: "contact_view_audio_call", - actionBlock: { [weak self] _ in + actionBlock: { [weak self] guard let strongSelf = self else { return } strongSelf.didPressAudioCall() })) stackView.addArrangedSubview(createCircleActionButton(text: NSLocalizedString("ACTION_VIDEO_CALL", comment: "Label for 'video call' button in contact view."), imageName: "contact_view_video_call", - actionBlock: { [weak self] _ in + actionBlock: { [weak self] guard let strongSelf = self else { return } strongSelf.didPressVideoCall() })) @@ -307,7 +307,7 @@ class ContactViewController: OWSViewController, ContactShareViewHelperDelegate { // Show invite button for system contacts without a Signal account. let inviteButton = createLargePillButton(text: NSLocalizedString("ACTION_INVITE", comment: "Label for 'invite' button in contact view."), - actionBlock: { [weak self] _ in + actionBlock: { [weak self] guard let strongSelf = self else { return } strongSelf.didPressInvite() }) @@ -334,7 +334,7 @@ class ContactViewController: OWSViewController, ContactShareViewHelperDelegate { // Always show "add to contacts" button. let addToContactsButton = createLargePillButton(text: NSLocalizedString("CONVERSATION_VIEW_ADD_TO_CONTACTS_OFFER", comment: "Message shown in conversation view that offers to add an unknown user to your phone's contacts."), - actionBlock: { [weak self] _ in + actionBlock: { [weak self] guard let strongSelf = self else { return } strongSelf.didPressAddToContacts() }) diff --git a/Signal/src/ViewControllers/ContactsPicker.swift b/Signal/src/ViewControllers/ContactsPicker.swift index 4729fcf01..e10b07bdc 100644 --- a/Signal/src/ViewControllers/ContactsPicker.swift +++ b/Signal/src/ViewControllers/ContactsPicker.swift @@ -305,11 +305,11 @@ public class ContactsPicker: OWSViewController, UITableViewDelegate, UITableView // MARK: - Button Actions - func onTouchCancelButton() { + @objc func onTouchCancelButton() { contactsPickerDelegate?.contactsPickerDidCancel(self) } - func onTouchDoneButton() { + @objc func onTouchDoneButton() { contactsPickerDelegate?.contactsPicker(self, didSelectMultipleContacts: selectedContacts) } diff --git a/Signal/src/ViewControllers/ConversationView/ConversationHeaderView.swift b/Signal/src/ViewControllers/ConversationView/ConversationHeaderView.swift index f90cda99c..7d3e03fca 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationHeaderView.swift +++ b/Signal/src/ViewControllers/ConversationView/ConversationHeaderView.swift @@ -110,7 +110,7 @@ public class ConversationHeaderView: UIStackView { // MARK: Delegate Methods - func didTapView(tapGesture: UITapGestureRecognizer) { + @objc func didTapView(tapGesture: UITapGestureRecognizer) { guard tapGesture.state == .recognized else { return } diff --git a/Signal/src/ViewControllers/CropScaleImageViewController.swift b/Signal/src/ViewControllers/CropScaleImageViewController.swift index 29692fbe8..7f4db3fb5 100644 --- a/Signal/src/ViewControllers/CropScaleImageViewController.swift +++ b/Signal/src/ViewControllers/CropScaleImageViewController.swift @@ -182,7 +182,7 @@ class CropScaleImageViewController: OWSViewController { self.view.addSubview(contentView) contentView.autoPinEdgesToSuperviewEdges() - let imageView = OWSLayerView(frame:CGRect.zero, layoutCallback: {[weak self] _ in + let imageView = OWSLayerView(frame:CGRect.zero, layoutCallback: {[weak self] guard let strongSelf = self else { return } strongSelf.updateImageLayout() }) @@ -369,7 +369,7 @@ class CropScaleImageViewController: OWSViewController { var lastPinchLocation: CGPoint = CGPoint.zero var lastPinchScale: CGFloat = 1.0 - func handlePinch(sender: UIPinchGestureRecognizer) { + @objc func handlePinch(sender: UIPinchGestureRecognizer) { switch (sender.state) { case .possible: break @@ -426,7 +426,7 @@ class CropScaleImageViewController: OWSViewController { var srcTranslationAtPanStart: CGPoint = CGPoint.zero - func handlePan(sender: UIPanGestureRecognizer) { + @objc func handlePan(sender: UIPanGestureRecognizer) { switch (sender.state) { case .possible: break @@ -499,11 +499,11 @@ class CropScaleImageViewController: OWSViewController { // MARK: - Event Handlers - func cancelPressed(sender: UIButton) { + @objc func cancelPressed(sender: UIButton) { dismiss(animated: true, completion:nil) } - func donePressed(sender: UIButton) { + @objc func donePressed(sender: UIButton) { let successCompletion = self.successCompletion dismiss(animated: true, completion: { guard let dstImage = self.generateDstImage() else { diff --git a/Signal/src/ViewControllers/ExperienceUpgradesPageViewController.swift b/Signal/src/ViewControllers/ExperienceUpgradesPageViewController.swift index 534ece287..bb1a26458 100644 --- a/Signal/src/ViewControllers/ExperienceUpgradesPageViewController.swift +++ b/Signal/src/ViewControllers/ExperienceUpgradesPageViewController.swift @@ -103,7 +103,7 @@ private class IntroducingCustomNotificationAudioExperienceUpgradeViewController: return button } - func didTapButton(sender: UIButton) { + @objc func didTapButton(sender: UIButton) { Logger.debug("\(TAG) in \(#function)") guard let buttonAction = self.buttonAction else { @@ -213,7 +213,7 @@ private class IntroductingReadReceiptsExperienceUpgradeViewController: Experienc return button } - func didTapButton(sender: UIButton) { + @objc func didTapButton(sender: UIButton) { Logger.debug("\(TAG) in \(#function)") guard let buttonAction = self.buttonAction else { @@ -343,7 +343,7 @@ private class IntroductingProfilesExperienceUpgradeViewController: ExperienceUpg // MARK: - Actions - func didTapButton(sender: UIButton) { + @objc func didTapButton(sender: UIButton) { Logger.debug("\(TAG) in \(#function)") // dismiss the modally presented view controller, then proceed. @@ -382,7 +382,7 @@ private class CallKitExperienceUpgradeViewController: ExperienceUpgradeViewContr // MARK: - Actions - func didTapPrivacySettingsButton(sender: UIButton) { + @objc func didTapPrivacySettingsButton(sender: UIButton) { Logger.debug("\(TAG) in \(#function)") // dismiss the modally presented view controller, then proceed. @@ -687,12 +687,12 @@ class ExperienceUpgradesPageViewController: OWSViewController, UIPageViewControl super.dismiss(animated: flag, completion: completion) } - func didTapDismissButton(sender: UIButton) { + @objc func didTapDismissButton(sender: UIButton) { Logger.debug("\(TAG) in \(#function)") self.dismiss(animated: true) } - func handleDismissGesture(sender: AnyObject) { + @objc func handleDismissGesture(sender: AnyObject) { Logger.debug("\(TAG) in \(#function)") self.dismiss(animated: true) } diff --git a/Signal/src/ViewControllers/GifPicker/GifPickerViewController.swift b/Signal/src/ViewControllers/GifPicker/GifPickerViewController.swift index 11f727edc..937f51aff 100644 --- a/Signal/src/ViewControllers/GifPicker/GifPickerViewController.swift +++ b/Signal/src/ViewControllers/GifPicker/GifPickerViewController.swift @@ -79,7 +79,7 @@ class GifPickerViewController: OWSViewController, UISearchBarDelegate, UICollect progressiveSearchTimer?.invalidate() } - func didBecomeActive() { + @objc func didBecomeActive() { SwiftAssertIsOnMainThread(#function) Logger.info("\(self.TAG) \(#function)") @@ -88,7 +88,7 @@ class GifPickerViewController: OWSViewController, UISearchBarDelegate, UICollect ensureCellState() } - func reachabilityChanged() { + @objc func reachabilityChanged() { SwiftAssertIsOnMainThread(#function) Logger.info("\(self.TAG) \(#function)") @@ -418,7 +418,7 @@ class GifPickerViewController: OWSViewController, UISearchBarDelegate, UICollect // MARK: - Event Handlers - func donePressed(sender: UIButton) { + @objc func donePressed(sender: UIButton) { dismiss(animated: true, completion: nil) } @@ -505,7 +505,7 @@ class GifPickerViewController: OWSViewController, UISearchBarDelegate, UICollect // MARK: - Event Handlers - func retryTapped(sender: UIGestureRecognizer) { + @objc func retryTapped(sender: UIGestureRecognizer) { guard sender.state == .recognized else { return } diff --git a/Signal/src/ViewControllers/LongTextViewController.swift b/Signal/src/ViewControllers/LongTextViewController.swift index e23d9fab5..ff25a958a 100644 --- a/Signal/src/ViewControllers/LongTextViewController.swift +++ b/Signal/src/ViewControllers/LongTextViewController.swift @@ -95,7 +95,7 @@ public class LongTextViewController: OWSViewController { // MARK: - Actions - func shareButtonPressed() { + @objc func shareButtonPressed() { AttachmentSharing.showShareUI(forText: messageBody) } } diff --git a/Signal/src/ViewControllers/MessageDetailViewController.swift b/Signal/src/ViewControllers/MessageDetailViewController.swift index e8d50a961..7558093d7 100644 --- a/Signal/src/ViewControllers/MessageDetailViewController.swift +++ b/Signal/src/ViewControllers/MessageDetailViewController.swift @@ -496,7 +496,7 @@ class MessageDetailViewController: OWSViewController, MediaGalleryDataSourceDele // MARK: - Actions - func shareButtonPressed() { + @objc func shareButtonPressed() { guard let attachmentStream = attachmentStream else { Logger.error("\(logTag) Share button should only be shown with attachment, but no attachment found.") return @@ -525,7 +525,7 @@ class MessageDetailViewController: OWSViewController, MediaGalleryDataSourceDele } } - internal func yapDatabaseModified(notification: NSNotification) { + @objc internal func yapDatabaseModified(notification: NSNotification) { SwiftAssertIsOnMainThread(#function) guard !wasDeleted else { diff --git a/Signal/src/ViewControllers/OWS2FAReminderViewController.swift b/Signal/src/ViewControllers/OWS2FAReminderViewController.swift index 588721f34..593b37773 100644 --- a/Signal/src/ViewControllers/OWS2FAReminderViewController.swift +++ b/Signal/src/ViewControllers/OWS2FAReminderViewController.swift @@ -44,7 +44,7 @@ public class OWS2FAReminderViewController: UIViewController, PinEntryViewDelegat let instructionsTextHeader = NSLocalizedString("REMINDER_2FA_BODY_HEADER", comment: "Body header for when user is periodically prompted to enter their registration lock PIN") let instructionsTextBody = NSLocalizedString("REMINDER_2FA_BODY", comment: "Body text for when user is periodically prompted to enter their registration lock PIN") - let attributes = [NSFontAttributeName: pinEntryView.boldLabelFont] + let attributes = [NSAttributedStringKey.font: pinEntryView.boldLabelFont] let attributedInstructionsText = NSAttributedString(string: instructionsTextHeader, attributes: attributes).rtlSafeAppend(" ", referenceView: pinEntryView).rtlSafeAppend(instructionsTextBody, referenceView: pinEntryView) diff --git a/Signal/src/call/CallService.swift b/Signal/src/call/CallService.swift index 3f2c56236..8e8d282e5 100644 --- a/Signal/src/call/CallService.swift +++ b/Signal/src/call/CallService.swift @@ -319,12 +319,12 @@ private class SignalCallData: NSObject { NotificationCenter.default.removeObserver(self) } - func didEnterBackground() { + @objc func didEnterBackground() { SwiftAssertIsOnMainThread(#function) self.updateIsVideoEnabled() } - func didBecomeActive() { + @objc func didBecomeActive() { SwiftAssertIsOnMainThread(#function) self.updateIsVideoEnabled() } diff --git a/Signal/src/call/PeerConnectionClient.swift b/Signal/src/call/PeerConnectionClient.swift index b7b28f798..ed39d674a 100644 --- a/Signal/src/call/PeerConnectionClient.swift +++ b/Signal/src/call/PeerConnectionClient.swift @@ -545,7 +545,7 @@ class PeerConnectionClient: NSObject, RTCPeerConnectionDelegate, RTCDataChannelD if let error = error { reject(error) } else { - fulfill() + fulfill(()) } }) } @@ -575,7 +575,7 @@ class PeerConnectionClient: NSObject, RTCPeerConnectionDelegate, RTCDataChannelD reject(error) return } - fulfill() + fulfill(()) }) } @@ -616,7 +616,7 @@ class PeerConnectionClient: NSObject, RTCPeerConnectionDelegate, RTCDataChannelD reject(error) return } - fulfill() + fulfill(()) }) } return promise diff --git a/Signal/src/environment/PushRegistrationManager.swift b/Signal/src/environment/PushRegistrationManager.swift index 28bbd5339..0465fa043 100644 --- a/Signal/src/environment/PushRegistrationManager.swift +++ b/Signal/src/environment/PushRegistrationManager.swift @@ -105,13 +105,13 @@ public enum PushRegistrationError: Error { // MARK: PKPushRegistryDelegate - voIP Push Token - public func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, forType type: PKPushType) { + public func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType) { Logger.info("\(self.logTag) in \(#function)") assert(type == .voIP) self.pushManager.application(UIApplication.shared, didReceiveRemoteNotification: payload.dictionaryPayload) } - public func pushRegistry(_ registry: PKPushRegistry, didUpdate credentials: PKPushCredentials, forType type: PKPushType) { + public func pushRegistry(_ registry: PKPushRegistry, didUpdate credentials: PKPushCredentials, for type: PKPushType) { Logger.info("\(self.logTag) in \(#function)") assert(type == .voIP) assert(credentials.type == .voIP) @@ -123,7 +123,7 @@ public enum PushRegistrationError: Error { fulfillVoipTokenPromise(credentials.token) } - public func pushRegistry(_ registry: PKPushRegistry, didInvalidatePushTokenForType type: PKPushType) { + public func pushRegistry(_ registry: PKPushRegistry, didInvalidatePushTokenFor type: PKPushType) { // It's not clear when this would happen. We've never previously handled it, but we should at // least start learning if it happens. owsFail("\(self.logTag) in \(#function)") @@ -266,7 +266,7 @@ public enum PushRegistrationError: Error { // If we've already completed registering for a voip token, resolve it immediately, // rather than waiting for the delegate method to be called. - if let voipTokenData = voipRegistry.pushToken(forType: .voIP) { + if let voipTokenData = voipRegistry.pushToken(for: .voIP) { Logger.info("\(self.logTag) using pre-registered voIP token") fulfill(voipTokenData) } diff --git a/Signal/src/util/OWSBackupAPI.swift b/Signal/src/util/OWSBackupAPI.swift index 4dce41255..dfdc214ef 100644 --- a/Signal/src/util/OWSBackupAPI.swift +++ b/Signal/src/util/OWSBackupAPI.swift @@ -220,7 +220,7 @@ import CloudKit success(recordName) } else { // No record found, saving new record. - guard let fileUrl = fileUrlBlock() else { + guard let fileUrl = fileUrlBlock(()) else { Logger.error("\(self.logTag) error preparing file for upload.") failure(OWSErrorWithCodeDescription(.exportBackupError, NSLocalizedString("BACKUP_EXPORT_ERROR_SAVE_FILE_TO_CLOUD_FAILED", @@ -264,7 +264,7 @@ import CloudKit label: "Delete Records") switch outcome { case .success: - success() + success(()) case .failureDoNotRetry(let outcomeError): failure(outcomeError) case .failureRetryAfterDelay(let retryDelay): @@ -475,7 +475,7 @@ import CloudKit DispatchQueue.global().async { do { try FileManager.default.copyItem(at: asset.fileURL, to: toFileUrl) - success() + success(()) } catch { Logger.error("\(self.logTag) couldn't copy asset file: \(error).") failure(invalidServiceResponseError()) diff --git a/Signal/src/views/AttachmentPointerView.swift b/Signal/src/views/AttachmentPointerView.swift index d755b06ed..749db5980 100644 --- a/Signal/src/views/AttachmentPointerView.swift +++ b/Signal/src/views/AttachmentPointerView.swift @@ -52,7 +52,7 @@ class AttachmentPointerView: UIView { NotificationCenter.default.removeObserver(self) } - internal func attachmentDownloadProgress(_ notification: Notification) { + @objc internal func attachmentDownloadProgress(_ notification: Notification) { guard let attachmentId = attachmentPointer.uniqueId else { owsFail("Missing attachment id.") return diff --git a/Signal/src/views/ContactCell.swift b/Signal/src/views/ContactCell.swift index 4a7dbacf3..6e1bf5861 100644 --- a/Signal/src/views/ContactCell.swift +++ b/Signal/src/views/ContactCell.swift @@ -65,7 +65,7 @@ class ContactCell: UITableViewCell { } } - func didChangePreferredContentSize() { + @objc func didChangePreferredContentSize() { self.titleLabel.font = UIFont.ows_dynamicTypeBody self.subtitleLabel.font = UIFont.ows_dynamicTypeSubheadline } @@ -130,7 +130,7 @@ fileprivate extension CNContact { let boldDescriptor = font.fontDescriptor.withSymbolicTraits(.traitBold) let boldAttributes = [ - NSFontAttributeName: UIFont(descriptor: boldDescriptor!, size: 0) + NSAttributedStringKey.font: UIFont(descriptor: boldDescriptor!, size: 0) ] if let attributedName = CNContactFormatter.attributedString(from: self, style: .fullName, defaultAttributes: nil) { diff --git a/Signal/src/views/QuotedReplyPreview.swift b/Signal/src/views/QuotedReplyPreview.swift index 21f1b7b8e..e7eab2b9d 100644 --- a/Signal/src/views/QuotedReplyPreview.swift +++ b/Signal/src/views/QuotedReplyPreview.swift @@ -83,7 +83,7 @@ class QuotedReplyPreview: UIView { self.heightConstraint.constant = size.height } - func contentSizeCategoryDidChange(_ notification: Notification) { + @objc func contentSizeCategoryDidChange(_ notification: Notification) { Logger.debug("\(self.logTag) in \(#function)") updateContents() diff --git a/Signal/src/views/ReminderView.swift b/Signal/src/views/ReminderView.swift index 7102d3ce9..a0c138a76 100644 --- a/Signal/src/views/ReminderView.swift +++ b/Signal/src/views/ReminderView.swift @@ -125,7 +125,7 @@ class ReminderView: UIView { iconView.autoSetDimension(.width, toSize: 13) } - func handleTap(gestureRecognizer: UIGestureRecognizer) { + @objc func handleTap(gestureRecognizer: UIGestureRecognizer) { tapAction() } } diff --git a/SignalMessaging/Views/AvatarImageView.swift b/SignalMessaging/Views/AvatarImageView.swift index 99fe980ad..8008cffbc 100644 --- a/SignalMessaging/Views/AvatarImageView.swift +++ b/SignalMessaging/Views/AvatarImageView.swift @@ -95,7 +95,7 @@ public class ConversationAvatarImageView: AvatarImageView { fatalError("init(coder:) has not been implemented") } - func handleSignalAccountsChanged(notification: Notification) { + @objc func handleSignalAccountsChanged(notification: Notification) { Logger.debug("\(self.logTag) in \(#function)") // PERF: It would be nice if we could do this only if *this* user's SignalAccount changed, @@ -104,7 +104,7 @@ public class ConversationAvatarImageView: AvatarImageView { self.updateImage() } - func handleOtherUsersProfileChanged(notification: Notification) { + @objc func handleOtherUsersProfileChanged(notification: Notification) { Logger.debug("\(self.logTag) in \(#function)") guard let changedRecipientId = notification.userInfo?[kNSNotificationKey_ProfileRecipientId] as? String else { @@ -126,7 +126,7 @@ public class ConversationAvatarImageView: AvatarImageView { self.updateImage() } - func handleGroupAvatarChanged(notification: Notification) { + @objc func handleGroupAvatarChanged(notification: Notification) { Logger.debug("\(self.logTag) in \(#function)") guard let changedGroupThreadId = notification.userInfo?[TSGroupThread_NotificationKey_UniqueId] as? String else { diff --git a/SignalMessaging/Views/TappableStackView.swift b/SignalMessaging/Views/TappableStackView.swift index 237bd0ee5..8498c84c7 100644 --- a/SignalMessaging/Views/TappableStackView.swift +++ b/SignalMessaging/Views/TappableStackView.swift @@ -23,7 +23,7 @@ public class TappableStackView: UIStackView { self.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(wasTapped))) } - func wasTapped(sender: UIGestureRecognizer) { + @objc func wasTapped(sender: UIGestureRecognizer) { Logger.info("\(logTag) \(#function)") guard sender.state == .recognized else { diff --git a/SignalMessaging/Views/TappableView.swift b/SignalMessaging/Views/TappableView.swift index e440e6554..11ad3757e 100644 --- a/SignalMessaging/Views/TappableView.swift +++ b/SignalMessaging/Views/TappableView.swift @@ -22,7 +22,7 @@ public class TappableView: UIView { self.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(wasTapped))) } - func wasTapped(sender: UIGestureRecognizer) { + @objc func wasTapped(sender: UIGestureRecognizer) { Logger.info("\(logTag) \(#function)") guard sender.state == .recognized else { diff --git a/SignalMessaging/attachments/AttachmentApprovalViewController.swift b/SignalMessaging/attachments/AttachmentApprovalViewController.swift index 22a444f65..cbe181b98 100644 --- a/SignalMessaging/attachments/AttachmentApprovalViewController.swift +++ b/SignalMessaging/attachments/AttachmentApprovalViewController.swift @@ -216,7 +216,7 @@ public class AttachmentApprovalViewController: OWSViewController, CaptioningTool } } - public func didTapPlayerView(_ gestureRecognizer: UIGestureRecognizer) { + @objc public func didTapPlayerView(_ gestureRecognizer: UIGestureRecognizer) { assert(self.videoPlayer != nil) self.pauseVideo() } @@ -251,7 +251,7 @@ public class AttachmentApprovalViewController: OWSViewController, CaptioningTool self.playVideo() } - func cancelPressed(sender: UIButton) { + @objc func cancelPressed(sender: UIButton) { self.delegate?.attachmentApproval(self, didCancelAttachment: attachment) } @@ -619,7 +619,7 @@ class CaptioningToolbar: UIView, UITextViewDelegate { bottomGradient.autoPinEdgesToSuperviewEdges(with: .zero, excludingEdge: .top) } - func didTapSend() { + @objc func didTapSend() { self.captioningToolbarDelegate?.captioningToolbarDidTapSend(self, captionText: self.textView.text) } diff --git a/SignalMessaging/attachments/ContactShareApprovalViewController.swift b/SignalMessaging/attachments/ContactShareApprovalViewController.swift index a27c8f37a..0a0b9a0e3 100644 --- a/SignalMessaging/attachments/ContactShareApprovalViewController.swift +++ b/SignalMessaging/attachments/ContactShareApprovalViewController.swift @@ -203,7 +203,7 @@ class ContactShareFieldView: UIStackView { self.addArrangedSubview(previewView) } - func wasTapped(sender: UIGestureRecognizer) { + @objc func wasTapped(sender: UIGestureRecognizer) { Logger.info("\(self.logTag) \(#function)") guard sender.state == .recognized else { @@ -401,7 +401,7 @@ public class ContactShareApprovalViewController: OWSViewController, EditContactS func createNameRow() -> UIView { let nameVMargin = CGFloat(16) - let stackView = TappableStackView(actionBlock: { [weak self] _ in + let stackView = TappableStackView(actionBlock: { [weak self] guard let strongSelf = self else { return } strongSelf.didPressEditName() }) @@ -447,7 +447,7 @@ public class ContactShareApprovalViewController: OWSViewController, EditContactS // MARK: - - func didPressSendButton() { + @objc func didPressSendButton() { SwiftAssertIsOnMainThread(#function) guard isAtLeastOneFieldSelected() else { @@ -475,7 +475,7 @@ public class ContactShareApprovalViewController: OWSViewController, EditContactS delegate.approveContactShare(self, didApproveContactShare: filteredContactShare) } - func didPressCancel() { + @objc func didPressCancel() { Logger.info("\(logTag) \(#function)") guard let delegate = self.delegate else { diff --git a/SignalMessaging/attachments/EditContactShareNameViewController.swift b/SignalMessaging/attachments/EditContactShareNameViewController.swift index 7c43ca22e..e70befa18 100644 --- a/SignalMessaging/attachments/EditContactShareNameViewController.swift +++ b/SignalMessaging/attachments/EditContactShareNameViewController.swift @@ -76,7 +76,7 @@ class ContactNameFieldView: UIView { valueView.addTarget(self, action: #selector(textFieldDidChange), for: .editingChanged) } - func wasTapped(sender: UIGestureRecognizer) { + @objc func wasTapped(sender: UIGestureRecognizer) { Logger.info("\(self.logTag) \(#function)") guard sender.state == .recognized else { @@ -86,7 +86,7 @@ class ContactNameFieldView: UIView { valueView.becomeFirstResponder() } - func textFieldDidChange(sender: UITextField) { + @objc func textFieldDidChange(sender: UITextField) { Logger.info("\(self.logTag) \(#function)") hasUnsavedChanges = true @@ -285,7 +285,7 @@ public class EditContactShareNameViewController: OWSViewController, ContactNameF // MARK: - - func didPressSave() { + @objc func didPressSave() { Logger.info("\(logTag) \(#function)") guard let newName = OWSContactName() else { @@ -315,7 +315,7 @@ public class EditContactShareNameViewController: OWSViewController, ContactNameF navigationController.popViewController(animated: true) } - func didPressCancel() { + @objc func didPressCancel() { Logger.info("\(logTag) \(#function)") guard let navigationController = self.navigationController else { diff --git a/SignalMessaging/attachments/MediaMessageView.swift b/SignalMessaging/attachments/MediaMessageView.swift index ed7aad1af..4bc1d1870 100644 --- a/SignalMessaging/attachments/MediaMessageView.swift +++ b/SignalMessaging/attachments/MediaMessageView.swift @@ -164,7 +164,7 @@ public class MediaMessageView: UIView, OWSAudioPlayerDelegate { // it's superview is big enough to contain it. stackView.autoPinWidthToSuperview() stackView.autoVCenterInSuperview() - NSLayoutConstraint.autoSetPriority(UILayoutPriorityDefaultLow) { + NSLayoutConstraint.autoSetPriority(UILayoutPriority.defaultLow) { stackView.autoPinHeightToSuperview() } stackView.autoPinEdge(toSuperviewEdge: .top, withInset: 0, relation: .greaterThanOrEqual) @@ -277,7 +277,7 @@ public class MediaMessageView: UIView, OWSAudioPlayerDelegate { // it's superview is big enough to contain it. stackView.autoPinWidthToSuperview() stackView.autoVCenterInSuperview() - NSLayoutConstraint.autoSetPriority(UILayoutPriorityDefaultLow) { + NSLayoutConstraint.autoSetPriority(UILayoutPriority.defaultLow) { stackView.autoPinHeightToSuperview() } stackView.autoPinEdge(toSuperviewEdge: .top, withInset: 0, relation: .greaterThanOrEqual) diff --git a/SignalMessaging/attachments/MessageApprovalViewController.swift b/SignalMessaging/attachments/MessageApprovalViewController.swift index 859522b0a..df826831e 100644 --- a/SignalMessaging/attachments/MessageApprovalViewController.swift +++ b/SignalMessaging/attachments/MessageApprovalViewController.swift @@ -200,11 +200,11 @@ public class MessageApprovalViewController: OWSViewController, UITextViewDelegat // MARK: - Event Handlers - func cancelPressed(sender: UIButton) { + @objc func cancelPressed(sender: UIButton) { delegate?.messageApprovalDidCancel(self) } - func sendPressed(sender: UIButton) { + @objc func sendPressed(sender: UIButton) { delegate?.messageApproval(self, didApproveMessage: self.textView.text) } diff --git a/SignalMessaging/attachments/SignalAttachment.swift b/SignalMessaging/attachments/SignalAttachment.swift index 8e007ac23..8149421ff 100644 --- a/SignalMessaging/attachments/SignalAttachment.swift +++ b/SignalMessaging/attachments/SignalAttachment.swift @@ -958,7 +958,7 @@ public class SignalAttachment: NSObject { } exportSession.shouldOptimizeForNetworkUse = true - exportSession.outputFileType = AVFileTypeMPEG4 + exportSession.outputFileType = AVFileType.mp4 exportSession.metadataItemFilter = AVMetadataItemFilter.forSharing() let exportURL = videoTempPath.appendingPathComponent(UUID().uuidString).appendingPathExtension("mp4") diff --git a/SignalMessaging/attachments/VideoPlayerView.swift b/SignalMessaging/attachments/VideoPlayerView.swift index ea9f0468c..594eb5504 100644 --- a/SignalMessaging/attachments/VideoPlayerView.swift +++ b/SignalMessaging/attachments/VideoPlayerView.swift @@ -112,7 +112,7 @@ public class PlayerProgressBar: UIView { // Configure controls - let kLabelFont = UIFont.monospacedDigitSystemFont(ofSize: 12, weight: UIFontWeightRegular) + let kLabelFont = UIFont.monospacedDigitSystemFont(ofSize: 12, weight: UIFont.Weight.regular) positionLabel.font = kLabelFont remainingLabel.font = kLabelFont diff --git a/SignalMessaging/contacts/ModalActivityIndicatorViewController.swift b/SignalMessaging/contacts/ModalActivityIndicatorViewController.swift index c8f553a4d..52a674929 100644 --- a/SignalMessaging/contacts/ModalActivityIndicatorViewController.swift +++ b/SignalMessaging/contacts/ModalActivityIndicatorViewController.swift @@ -132,7 +132,7 @@ public class ModalActivityIndicatorViewController: OWSViewController { self.presentTimer = nil } - func presentTimerFired() { + @objc func presentTimerFired() { SwiftAssertIsOnMainThread(#function) clearTimer() @@ -143,7 +143,7 @@ public class ModalActivityIndicatorViewController: OWSViewController { } } - func cancelPressed() { + @objc func cancelPressed() { SwiftAssertIsOnMainThread(#function) wasCancelled = true diff --git a/SignalMessaging/environment/migrations/OWS106EnsureProfileComplete.swift b/SignalMessaging/environment/migrations/OWS106EnsureProfileComplete.swift index bf0d0a860..e864a52e5 100644 --- a/SignalMessaging/environment/migrations/OWS106EnsureProfileComplete.swift +++ b/SignalMessaging/environment/migrations/OWS106EnsureProfileComplete.swift @@ -30,7 +30,7 @@ public class OWS106EnsureProfileComplete: OWSDatabaseMigration { Logger.error("\(self.TAG) Failed.") } - completion() + completion(()) }) type(of: self).sharedCompleteRegistrationFixerJob = job @@ -98,7 +98,7 @@ public class OWS106EnsureProfileComplete: OWSDatabaseMigration { ProfileFetcherJob(networkManager: networkManager).getProfile(recipientId: localRecipientId).then { _ -> Void in Logger.info("\(self.TAG) verified recipient profile is in good shape: \(localRecipientId)") - fulfill() + fulfill(()) }.catch { error in switch error { case SignalServiceProfile.ValidationError.invalidIdentityKey(let description): @@ -107,7 +107,7 @@ public class OWS106EnsureProfileComplete: OWSDatabaseMigration { TSPreKeyManager.registerPreKeys(with: .signedAndOneTime, success: { Logger.info("\(self.TAG) successfully uploaded pre-keys. Profile should be fixed.") - fulfill() + fulfill(()) }, failure: { _ in reject(OWSErrorWithCodeDescription(.signalServiceFailure, "\(self.TAG) Unknown error in \(#function)")) diff --git a/SignalMessaging/utils/OWSMessagesBubbleImageFactory.swift b/SignalMessaging/utils/OWSMessagesBubbleImageFactory.swift index 5c2e50ead..27f8daea0 100644 --- a/SignalMessaging/utils/OWSMessagesBubbleImageFactory.swift +++ b/SignalMessaging/utils/OWSMessagesBubbleImageFactory.swift @@ -21,22 +21,22 @@ public class OWSMessagesBubbleImageFactory: NSObject { }() public lazy var incoming: JSQMessagesBubbleImage = { - let color = bubbleColorIncoming + let color = OWSMessagesBubbleImageFactory.bubbleColorIncoming return self.incoming(color: color) }() public lazy var outgoing: JSQMessagesBubbleImage = { - let color = bubbleColorOutgoingSent + let color = OWSMessagesBubbleImageFactory.bubbleColorOutgoingSent return self.outgoing(color: color) }() public lazy var currentlyOutgoing: JSQMessagesBubbleImage = { - let color = bubbleColorOutgoingSending + let color = OWSMessagesBubbleImageFactory.bubbleColorOutgoingSending return self.outgoing(color: color) }() public lazy var outgoingFailed: JSQMessagesBubbleImage = { - let color = bubbleColorOutgoingUnsent + let color = OWSMessagesBubbleImageFactory.bubbleColorOutgoingUnsent return self.outgoing(color: color) }()