Auto-migration to Swift 4.

This commit is contained in:
Matthew Chen 2018-05-25 12:54:25 -04:00
parent 6b39f73e65
commit 28f7142a59
32 changed files with 110 additions and 101 deletions

View File

@ -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";
};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -95,7 +95,7 @@ public class LongTextViewController: OWSViewController {
// MARK: - Actions
func shareButtonPressed() {
@objc func shareButtonPressed() {
AttachmentSharing.showShareUI(forText: messageBody)
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -125,7 +125,7 @@ class ReminderView: UIView {
iconView.autoSetDimension(.width, toSize: 13)
}
func handleTap(gestureRecognizer: UIGestureRecognizer) {
@objc func handleTap(gestureRecognizer: UIGestureRecognizer) {
tapAction()
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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