From 2553dd0040fbf0274c267145936aff85419e4530 Mon Sep 17 00:00:00 2001 From: Anton Poltoratskyi Date: Thu, 1 Nov 2018 00:45:42 +0200 Subject: [PATCH 01/27] [NY-4362] Compiled project using Xcode 10.1 and Swift 4.2. --- .../AttachmentTransformerImpl.swift | 2 +- .../View/ForwardSelectorViewController.swift | 4 +- Nynja.xcodeproj/project.pbxproj | 18 +++---- Nynja/AppDelegate.swift | 10 ++-- Nynja/AudioFileConvertOperation.swift | 11 +++-- .../Extension/UIView+Mask.swift | 4 +- Nynja/Extensions/Range+Extension.swift | 27 ++--------- Nynja/Extensions/UIEdgeInsets+Adjust.swift | 8 ++-- ...ontrollerCameraCaptureModeExtensions.swift | 2 +- Nynja/Extensions/UITextView+Extensions.swift | 16 +++---- Nynja/ImageSelector.swift | 8 ++-- Nynja/Library/UI/AlertManager.swift | 2 +- Nynja/Library/UI/BannerView.swift | 5 +- Nynja/Library/UI/BaseVC/BaseVC.swift | 6 +-- .../Layout/CarouselFlowLayout.swift | 48 ++++++++++--------- .../Cells/ContextMenuControlCell.swift | 2 +- .../Cells/ContextMenuItemCell.swift | 4 +- .../UI/ContextMenuOLD/ContextMenu.swift | 2 +- .../Extensions/String/StringExtensions.swift | 5 +- .../TableView/UITableViewExtensions.swift | 3 +- .../UI/UIImageView/UIImageExtensions.swift | 2 +- .../LinkLongPressGestureRecognizer.swift | 4 +- .../UI/Gestures/LinkRecognizable.swift | 4 +- .../Gestures/LinkTapGestureRecognizer.swift | 4 +- .../ImagePreviewTransitionController.swift | 15 ++---- .../UI/ItemSelector/ItemsSelector.swift | 7 ++- .../KeyboardInteractive.swift | 8 ++-- .../KeyboardLayoutGuide.swift | 4 +- .../Cell/ChatListMessageContentView.swift | 4 +- .../Cell/ChatListMessageTableViewCell.swift | 2 +- .../Cells/Selector/SelectorCell.swift | 2 +- .../DataSource/TableViewDataSourceProxy.swift | 5 +- .../TableView/FastScroll/ScrollBar.swift | 2 +- .../NotificationView/NotificationView.swift | 2 +- .../UI/SwipeBackHelper/SwipeBackHelper.swift | 2 +- .../InputContent/TextInputContent.swift | 8 ++-- .../TextInput/InputField/CountryField.swift | 2 +- .../InputField/TextField/TextField.swift | 9 +++- .../ALKeyboardObservingView.swift | 6 +-- .../TextInputBar/ALTextInputBar.swift | 12 +++-- .../InputField/TextInputBar/ALTextView.swift | 16 +++++-- .../Material/MaterialTextField.swift | 2 +- .../ChatSettingCell/ArrowCell.swift | 2 +- .../ChatSettingCell/AvatarCell.swift | 2 +- .../ChatSettingCell/ImageCell.swift | 2 +- .../ChatSettingCell/SwitchCell.swift | 2 +- Nynja/Library/UI/UIViewController+Child.swift | 8 ++-- .../UI/View/CollapsedView/CollapsedView.swift | 4 +- .../UI/View/ImagesView/ImagesView.swift | 2 +- Nynja/Library/UI/View/UIViewExtensions.swift | 2 +- .../FastScroll/BorderView.swift | 2 +- .../Wheel/ItemViews/WheelItemView.swift | 6 +-- .../WheelImageFullItemPreview.swift | 2 +- .../View/AddParticipantsViewController.swift | 17 +++---- .../CircleLoadingView/CircleLoadingView.swift | 5 +- .../Auth/Login/View/LoginViewController.swift | 2 +- .../Interactor/CallInProgressInteractor.swift | 8 ++-- .../View/CallInProgressViewController.swift | 6 +-- .../WireFrame/CallInProgressWireframe.swift | 2 +- Nynja/Modules/Call/View/BottomCallView.swift | 12 ++--- .../Call/View/CallInProgressView.swift | 22 ++++----- .../View/ChatsListViewController.swift | 2 +- .../View/TableView/Cell/ContactCell.swift | 2 +- .../View/TransferCoinstoContactsView.swift | 4 +- .../Arrow/CellWithArrowTableViewCell.swift | 2 +- .../Image/CellWithImageTableViewCell.swift | 2 +- .../View/EditPhotoViewController.swift | 4 +- .../CameraFlow/Camera/CameraProtocols.swift | 34 ++++++------- .../Camera/Interactor/CameraInteractor.swift | 32 ++++++------- .../Camera/Presenter/CameraPresenter.swift | 16 +++---- .../Camera/View/CameraViewController.swift | 12 ++--- .../View/Subviews/QRNotificationVIew.swift | 2 +- .../Camera/Wireframe/CameraWireframe.swift | 2 +- .../View/PhotoPreviewViewController.swift | 4 +- .../CameraVideoPreviewInteractor.swift | 2 +- .../CameraVideoPreviewViewController.swift | 10 ++-- .../Gallery/View/GalleryViewController.swift | 16 +++---- .../Subviews/CounterIndicatorButton.swift | 4 +- .../View/MultiplePreviewViewController.swift | 6 +-- .../View/Subviews/VideoPreviewCVCell.swift | 4 +- .../GroupRules/View/AdminGroupRulesVC.swift | 4 +- .../GroupRules/View/UserGroupRulesVC.swift | 8 ++-- .../View/Collection/GroupCollectionCell.swift | 2 +- .../View/Collection/GroupVideosCell.swift | 2 +- .../View/Files/GroupFilesCell.swift | 2 +- .../View/Files/GroupFilesListVC.swift | 2 +- .../GroupStorage/View/GroupLinksListVC.swift | 2 +- .../GroupStorage/View/GroupStorageCell.swift | 2 +- .../View/GroupStorageViewController.swift | 8 ++-- .../View/GroupsListViewController.swift | 2 +- Nynja/Modules/History/View/HistoryCell.swift | 2 +- .../View/ImagePreviewViewController.swift | 6 +-- .../Cell/InterpretationTypeCell.swift | 2 +- .../View/TableView/Cell/LangCell.swift | 2 +- .../View/TableView/Cell/ActionCell.swift | 2 +- .../LeaveVoiceMessageViewController.swift | 16 +++---- .../Main/View/MainViewController.swift | 34 ++++++------- .../MessagePayloadRenderer.swift | 8 ++-- .../MessagePayloadRendererInput.swift | 14 +++--- .../Text/NSAttributedStringKey+Mention.swift | 6 +-- .../Message/Presenter/MessagePresenter.swift | 12 ++--- ...MessageVC+StickerInputModuleDelegate.swift | 4 +- Nynja/Modules/Message/View/MessageVC.swift | 29 +++++------ .../ChatCells/BaseChatCell/BaseChatCell.swift | 10 +++- .../Cells/Views/Base/MessageViewFactory.swift | 10 ++-- .../Cells/Views/FileTransferInfoView.swift | 8 ++-- .../Cells/Views/Message/MessageTextView.swift | 8 ++-- .../Reply/MessageStickerRepliedView.swift | 5 +- .../Scroll/ScrollPosition.swift | 2 +- .../Cell/UserMentionTableViewCell.swift | 2 +- .../Cells/ActionCell/ProfileActionCell.swift | 3 +- .../ContactCell/ProfileContactCell.swift | 2 +- .../ProfilePlaceholderCell.swift | 2 +- .../Cells/StarCell/StarMessageCell.swift | 6 +-- .../View/QRCodeReaderViewController.swift | 19 +++++--- .../Replies/Presenter/RepliesPresenter.swift | 12 ++--- Nynja/Modules/Replies/View/RepliesVC.swift | 2 +- .../ChangeNumberStep2ViewController.swift | 2 +- .../Cell/TextCheckmarkTableViewCell.swift | 2 +- .../TableView/TextSwitchTableViewCell.swift | 2 +- .../View/TableView/PrivacyTableViewCell.swift | 2 +- .../CheckmarkCell/CheckmarkCell.swift | 2 +- .../View/TableView/TextTableViewCell.swift | 2 +- .../ScaleAnimation/ScaleAnimatableGrid.swift | 2 +- .../StickersInputViewController.swift | 2 +- .../View/TableView/TimeZoneCell.swift | 2 +- .../View/VideoPreviewViewController.swift | 4 +- .../Payment/View/PaymentViewController.swift | 16 ++++--- .../SeedBackupWalletCollectionViewCell.swift | 16 +++---- ...VerificationWalletCollectionViewCell.swift | 2 +- ...SeedVerificationWalletViewController.swift | 2 +- .../View/TransferDetailsViewController.swift | 25 ++++------ .../View/TransferHistoryCell.swift | 2 +- .../View/TransferHistoryViewController.swift | 8 ++-- .../View/WalletBalancesViewController.swift | 8 ++-- .../View/WalletDetailsViewController.swift | 2 +- Nynja/NotificationManager.swift | 2 +- .../AppNotificationsProvider.swift | 4 +- Nynja/PermissionManager.swift | 10 ++-- .../Audio/AudioManager/AudioManager.swift | 2 +- .../Audio/AudioRecorder/AudioRecorder.swift | 2 +- .../AudioSessionManager.swift | 43 ++++++++--------- .../CameraSettingsService.swift | 8 ++-- .../Debug/MotionManager/MotionManager.swift | 2 +- Nynja/Services/PushService.swift | 3 +- .../ResourceManager/ResourceManager.swift | 2 +- Nynja/ThumbnailGenerator.swift | 5 +- Nynja/Utils/ImagePickerHandler.swift | 7 +-- Podfile.lock | 2 +- 149 files changed, 524 insertions(+), 510 deletions(-) diff --git a/Nynja-Share/Services/AttachmentProvider/AttachmentTransformer/AttachmentTransformerImpl.swift b/Nynja-Share/Services/AttachmentProvider/AttachmentTransformer/AttachmentTransformerImpl.swift index 011ca3f47..7db1c635c 100644 --- a/Nynja-Share/Services/AttachmentProvider/AttachmentTransformer/AttachmentTransformerImpl.swift +++ b/Nynja-Share/Services/AttachmentProvider/AttachmentTransformer/AttachmentTransformerImpl.swift @@ -45,7 +45,7 @@ final class AttachmentTransformerImpl: AttachmentTransformer { let documentDirectory = pathes[0] as String let filePath = "\(documentDirectory)/\(IdBuilder(format: .resourceId).build()).jpg" let url = URL(fileURLWithPath: filePath) - try? UIImageJPEGRepresentation(image, 1)?.write(to: url) + try? image.jpegData(compressionQuality: 1.0)?.write(to: url) return transformToImage(fromUrl: url) } diff --git a/Nynja-Share/UI/ForwardSelector/View/ForwardSelectorViewController.swift b/Nynja-Share/UI/ForwardSelector/View/ForwardSelectorViewController.swift index 19a61f0c3..09ff5b2eb 100644 --- a/Nynja-Share/UI/ForwardSelector/View/ForwardSelectorViewController.swift +++ b/Nynja-Share/UI/ForwardSelector/View/ForwardSelectorViewController.swift @@ -325,8 +325,8 @@ final class ForwardSelectorViewController: UIViewController, ForwardSelectorView override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) - self.view.bringSubview(toFront: navigationView) - self.view.bringSubview(toFront: hud) + self.view.bringSubviewToFront(navigationView) + self.view.bringSubviewToFront(hud) state = .contacts registerForKeyboardNotifications() } diff --git a/Nynja.xcodeproj/project.pbxproj b/Nynja.xcodeproj/project.pbxproj index 925d6b834..fafc9fc40 100644 --- a/Nynja.xcodeproj/project.pbxproj +++ b/Nynja.xcodeproj/project.pbxproj @@ -14397,7 +14397,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "exit 0\nKEYWORDS=\"TODO:|FIXME:|\\?\\?\\?:|\\!\\!\\!:\"\nfind \"${SRCROOT}/Nynja\" \\( -name \"*.h\" -or -name \"*.m\" -or -name \"*.swift\" \\) -print0 | xargs -0 egrep --with-filename --line-number --only-matching \"($KEYWORDS).*\\$\" | perl -p -e \"s/($KEYWORDS)/ warning: \\$1/\""; + shellScript = "exit 0\nKEYWORDS=\"TODO:|FIXME:|\\?\\?\\?:|\\!\\!\\!:\"\nfind \"${SRCROOT}/Nynja\" \\( -name \"*.h\" -or -name \"*.m\" -or -name \"*.swift\" \\) -print0 | xargs -0 egrep --with-filename --line-number --only-matching \"($KEYWORDS).*\\$\" | perl -p -e \"s/($KEYWORDS)/ warning: \\$1/\"\n"; }; F1313B0620889A8700E04092 /* KeyWordsHighlighting */ = { isa = PBXShellScriptBuildPhase; @@ -16779,7 +16779,7 @@ PROVISIONING_PROFILE = "ee586ed5-2bed-44bc-ab45-42f41bfa7316"; PROVISIONING_PROFILE_SPECIFIER = DevBundle_DevExt; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Dev; @@ -16810,7 +16810,7 @@ SKIP_INSTALL = YES; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; @@ -16958,7 +16958,7 @@ SWIFT_OBJC_BRIDGING_HEADER = "Nynja-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; SWIFT_WHOLE_MODULE_OPTIMIZATION = YES; }; name = Dev; @@ -16990,7 +16990,7 @@ SWIFT_OBJC_BRIDGING_HEADER = "Nynja-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; SWIFT_WHOLE_MODULE_OPTIMIZATION = YES; }; name = Release; @@ -17081,7 +17081,7 @@ SWIFT_OBJC_BRIDGING_HEADER = "Nynja-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; SWIFT_WHOLE_MODULE_OPTIMIZATION = YES; }; name = DevAutoTests; @@ -17110,7 +17110,7 @@ PROVISIONING_PROFILE = "0ac45157-141b-4e67-9a87-602efcd8cb35"; PROVISIONING_PROFILE_SPECIFIER = DevBundle_DevExt; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = DevAutoTests; @@ -17272,7 +17272,7 @@ SWIFT_OBJC_BRIDGING_HEADER = "Nynja-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; SWIFT_WHOLE_MODULE_OPTIMIZATION = YES; }; name = Prerelease; @@ -17303,7 +17303,7 @@ SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = RELEASE; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Prerelease; diff --git a/Nynja/AppDelegate.swift b/Nynja/AppDelegate.swift index 7ce25040d..6e9bfadb2 100644 --- a/Nynja/AppDelegate.swift +++ b/Nynja/AppDelegate.swift @@ -35,7 +35,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD // FIXME: need to be removed from here when share extension won't require new mqtt connection. private var appGroupObserver: AppGroupFlagObserver? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { UNUserNotificationCenter.current().delegate = self antiDebuggingService.startTracking() @@ -53,13 +53,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD return true } - internal func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool { + func application(_ application: UIApplication, + continue userActivity: NSUserActivity, + restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool { - guard userActivity.activityType == NSUserActivityTypeBrowsingWeb, - let url = userActivity.webpageURL else { + guard userActivity.activityType == NSUserActivityTypeBrowsingWeb, let url = userActivity.webpageURL else { return false } - return NynjaJoinByLinkService.shared().handleJoin(by: url) } diff --git a/Nynja/AudioFileConvertOperation.swift b/Nynja/AudioFileConvertOperation.swift index b05616b3e..80bc5b531 100755 --- a/Nynja/AudioFileConvertOperation.swift +++ b/Nynja/AudioFileConvertOperation.swift @@ -56,11 +56,16 @@ class AudioFileConvertOperation: Operation { super.init() - NotificationCenter.default.addObserver(self, selector: #selector(handleAudioSessionInterruptionNotification), name: .AVAudioSessionInterruption, object: AVAudioSession.sharedInstance()) + NotificationCenter.default.addObserver(self, + selector: #selector(handleAudioSessionInterruptionNotification), + name: AVAudioSession.interruptionNotification, + object: AVAudioSession.sharedInstance()) } deinit { - NotificationCenter.default.removeObserver(self, name: .AVAudioSessionInterruption, object: AVAudioSession.sharedInstance()) + NotificationCenter.default.removeObserver(self, + name: AVAudioSession.interruptionNotification, + object: AVAudioSession.sharedInstance()) } //MARK:- Converter @@ -597,7 +602,7 @@ class AudioFileConvertOperation: Operation { //MARK: Notification Handlers. @objc func handleAudioSessionInterruptionNotification(_ notification: NSNotification) { - let interruptionType = AVAudioSessionInterruptionType(rawValue: notification.userInfo![AVAudioSessionInterruptionTypeKey] as! UInt)! + let interruptionType = AVAudioSession.InterruptionType(rawValue: notification.userInfo![AVAudioSessionInterruptionTypeKey] as! UInt)! print("Session interrupted > --- \(interruptionType == .began ? "Begin Interruption" : "End Interruption") ---") diff --git a/Nynja/CircleMenuControl/Extension/UIView+Mask.swift b/Nynja/CircleMenuControl/Extension/UIView+Mask.swift index deb0a6efc..0a618ae9b 100644 --- a/Nynja/CircleMenuControl/Extension/UIView+Mask.swift +++ b/Nynja/CircleMenuControl/Extension/UIView+Mask.swift @@ -15,7 +15,7 @@ extension UIView { if inverse { path.append(UIBezierPath(rect: self.bounds)) - maskLayer.fillRule = kCAFillRuleEvenOdd + maskLayer.fillRule = .evenOdd } maskLayer.path = path.cgPath @@ -29,7 +29,7 @@ extension UIView { if inverse { path.append(UIBezierPath(rect: self.bounds)) - maskLayer.fillRule = kCAFillRuleEvenOdd + maskLayer.fillRule = .evenOdd } maskLayer.path = path.cgPath diff --git a/Nynja/Extensions/Range+Extension.swift b/Nynja/Extensions/Range+Extension.swift index 3d9e865f8..ae85d5c92 100644 --- a/Nynja/Extensions/Range+Extension.swift +++ b/Nynja/Extensions/Range+Extension.swift @@ -35,12 +35,6 @@ extension Range where Bound == Int { } } -extension CountableRange where Bound == Int { - var nsRange: NSRange { - return NSRange(location: lowerBound, length: count) - } -} - extension NSRange { var nativeRange: Range { @@ -75,19 +69,11 @@ extension Range where Bound == Int { return upperBound == range.lowerBound } - func isAlongside(after range: CountableRange) -> Bool { - return range.upperBound == lowerBound - } - - func isAlongside(before range: CountableRange) -> Bool { - return upperBound == range.lowerBound - } - - func isAlongside(after range: CountableClosedRange) -> Bool { + func isAlongside(after range: ClosedRange) -> Bool { return range.upperBound == lowerBound - 1 } - func isAlongside(before range: CountableClosedRange) -> Bool { + func isAlongside(before range: ClosedRange) -> Bool { return upperBound == range.lowerBound } } @@ -101,14 +87,7 @@ extension Range where Bound == Int { || range.contains(upperBound - 1) } - func intersects(_ range: CountableRange) -> Bool { - return contains(range.lowerBound) - || contains(range.upperBound - 1) - || range.contains(lowerBound) - || range.contains(upperBound - 1) - } - - func intersects(_ range: CountableClosedRange) -> Bool { + func intersects(_ range: ClosedRange) -> Bool { return contains(range.lowerBound) || contains(range.upperBound) || range.contains(lowerBound) diff --git a/Nynja/Extensions/UIEdgeInsets+Adjust.swift b/Nynja/Extensions/UIEdgeInsets+Adjust.swift index b507e9d7d..cde0e723b 100644 --- a/Nynja/Extensions/UIEdgeInsets+Adjust.swift +++ b/Nynja/Extensions/UIEdgeInsets+Adjust.swift @@ -29,10 +29,10 @@ extension UIEdgeInsets { case .bottom: bottom = value case .right: right = value } - let newInset: UIEdgeInsets = UIEdgeInsetsMake(self.top + top, - self.left + left, - self.bottom + bottom, - self.right + right) + let newInset: UIEdgeInsets = UIEdgeInsets(top: self.top + top, + left: self.left + left, + bottom: self.bottom + bottom, + right: self.right + right) return newInset } diff --git a/Nynja/Extensions/UIImagePickerControllerCameraCaptureMode/UIImagePickerControllerCameraCaptureModeExtensions.swift b/Nynja/Extensions/UIImagePickerControllerCameraCaptureMode/UIImagePickerControllerCameraCaptureModeExtensions.swift index fee3980a3..575cb8b7c 100644 --- a/Nynja/Extensions/UIImagePickerControllerCameraCaptureMode/UIImagePickerControllerCameraCaptureModeExtensions.swift +++ b/Nynja/Extensions/UIImagePickerControllerCameraCaptureMode/UIImagePickerControllerCameraCaptureModeExtensions.swift @@ -8,7 +8,7 @@ import Foundation -extension UIImagePickerControllerCameraCaptureMode { +extension UIImagePickerController.CameraCaptureMode { var title: String { switch self { case .photo: return "Photo" diff --git a/Nynja/Extensions/UITextView+Extensions.swift b/Nynja/Extensions/UITextView+Extensions.swift index 126d3a8af..56d3939e5 100644 --- a/Nynja/Extensions/UITextView+Extensions.swift +++ b/Nynja/Extensions/UITextView+Extensions.swift @@ -16,18 +16,18 @@ extension UITextView { } set { guard let newValue = newValue else { return } - linkTextAttributes.updateValue(newValue, forKey: NSAttributedStringKey.foregroundColor.rawValue) + linkTextAttributes[.foregroundColor] = newValue } } var isUnderlined: Bool { get { - let style: Int? = linkAttribute(forKey: .underlineStyle) - return style != NSUnderlineStyle.styleSingle.rawValue + let style: NSUnderlineStyle? = linkAttribute(forKey: .underlineStyle) + return style != NSUnderlineStyle.single } set { - let value: NSUnderlineStyle = newValue ? .styleSingle : .styleNone - linkTextAttributes.updateValue(value.rawValue, forKey: NSAttributedStringKey.underlineStyle.rawValue) + let value: NSUnderlineStyle = newValue ? .single : [] + linkTextAttributes[.underlineStyle] = newValue } } @@ -37,11 +37,11 @@ extension UITextView { } set { guard let newValue = newValue else { return } - linkTextAttributes.updateValue(newValue, forKey: NSAttributedStringKey.underlineColor.rawValue) + linkTextAttributes[.underlineColor] = newValue } } - private func linkAttribute(forKey key: NSAttributedStringKey) -> T? { - return linkTextAttributes[key.rawValue] as? T + private func linkAttribute(forKey key: NSAttributedString.Key) -> T? { + return linkTextAttributes[key] as? T } } diff --git a/Nynja/ImageSelector.swift b/Nynja/ImageSelector.swift index 765f557be..cfcb9503a 100644 --- a/Nynja/ImageSelector.swift +++ b/Nynja/ImageSelector.swift @@ -36,7 +36,7 @@ class ImageSelector: NSObject, UIImagePickerControllerDelegate, UINavigationCont self.presentCameraIfCan() }, UIAlertAction(title: String.localizable.dowloadImageFromGallery, - style: UIAlertActionStyle.default) { _ in + style: .default) { _ in self.presentGalleryIfCan() }, UIAlertAction(title: "Cancel", @@ -91,8 +91,9 @@ class ImageSelector: NSObject, UIImagePickerControllerDelegate, UINavigationCont } // MARK: - UIImagePickerControllerDelegate - func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { - guard let pickedImage: UIImage = info[UIImagePickerControllerOriginalImage] as? UIImage else { + + func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { + guard let pickedImage = info[.originalImage] as? UIImage else { dismiss(animated: true) return } @@ -104,6 +105,5 @@ class ImageSelector: NSObject, UIImagePickerControllerDelegate, UINavigationCont cancelHandler?() dismiss(animated: false) } - } diff --git a/Nynja/Library/UI/AlertManager.swift b/Nynja/Library/UI/AlertManager.swift index f0519ed17..a24aec24b 100644 --- a/Nynja/Library/UI/AlertManager.swift +++ b/Nynja/Library/UI/AlertManager.swift @@ -124,7 +124,7 @@ class AlertManager { denyCompletion?() }, secondAction: { - guard let settingsUrl = URL(string: UIApplicationOpenSettingsURLString) else { + guard let settingsUrl = URL(string: UIApplication.openSettingsURLString) else { settingsCompletion?() return } diff --git a/Nynja/Library/UI/BannerView.swift b/Nynja/Library/UI/BannerView.swift index d1483d914..df8e71e21 100644 --- a/Nynja/Library/UI/BannerView.swift +++ b/Nynja/Library/UI/BannerView.swift @@ -64,7 +64,7 @@ class BannerView: NSObject{ } } - window.windowLevel = UIWindowLevelStatusBar+1 + window.windowLevel = UIWindow.Level.statusBar + 1 DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) { self.removeBannerView() } @@ -73,7 +73,6 @@ class BannerView: NSObject{ private func removeBannerView(){ let window = UIApplication.shared.keyWindow! window.viewWithTag(self.bannerTag)?.removeFromSuperview() - window.windowLevel = UIWindowLevelStatusBar - 1 + window.windowLevel = UIWindow.Level.statusBar - 1 } } - diff --git a/Nynja/Library/UI/BaseVC/BaseVC.swift b/Nynja/Library/UI/BaseVC/BaseVC.swift index 63488412e..77f988986 100644 --- a/Nynja/Library/UI/BaseVC/BaseVC.swift +++ b/Nynja/Library/UI/BaseVC/BaseVC.swift @@ -137,7 +137,7 @@ class BaseVC: UIViewController, UIGestureRecognizerDelegate, BaseViewProtocol, U override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) - self.view.bringSubview(toFront: navigationView) + self.view.bringSubviewToFront(navigationView) _presenter?.screenBecomeActive() registerForKeyboardNotifications() } @@ -203,7 +203,7 @@ class BaseVC: UIViewController, UIGestureRecognizerDelegate, BaseViewProtocol, U spinner.hidesWhenStopped = true spinner.translatesAutoresizingMaskIntoConstraints = false view.addSubview(spinner) - spinner.activityIndicatorViewStyle = .whiteLarge + spinner.style = .whiteLarge spinner.snp.makeConstraints({ (make) in make.center.equalTo(self.view) @@ -223,7 +223,7 @@ class BaseVC: UIViewController, UIGestureRecognizerDelegate, BaseViewProtocol, U return } - view.bringSubview(toFront: spinner) + view.bringSubviewToFront(spinner) spinner.color = color spinner.startAnimating() view.isUserInteractionEnabled = false diff --git a/Nynja/Library/UI/CollectionView/Layout/CarouselFlowLayout.swift b/Nynja/Library/UI/CollectionView/Layout/CarouselFlowLayout.swift index 678bca208..73e1f0cf2 100644 --- a/Nynja/Library/UI/CollectionView/Layout/CarouselFlowLayout.swift +++ b/Nynja/Library/UI/CollectionView/Layout/CarouselFlowLayout.swift @@ -17,9 +17,10 @@ open class CarouselFlowLayout: UICollectionViewFlowLayout { fileprivate struct LayoutState { var size: CGSize - var direction: UICollectionViewScrollDirection + var direction: UICollectionView.ScrollDirection + func isEqual(_ otherState: LayoutState) -> Bool { - return self.size.equalTo(otherState.size) && self.direction == otherState.direction + return size.equalTo(otherState.size) && direction == otherState.direction } } @@ -35,7 +36,7 @@ open class CarouselFlowLayout: UICollectionViewFlowLayout { override open func prepare() { super.prepare() - let currentState = LayoutState(size: self.collectionView!.bounds.size, direction: self.scrollDirection) + let currentState = LayoutState(size: collectionView!.bounds.size, direction: scrollDirection) if !self.state.isEqual(currentState) { self.setupCollectionView() @@ -45,31 +46,34 @@ open class CarouselFlowLayout: UICollectionViewFlowLayout { } fileprivate func setupCollectionView() { - guard let collectionView = self.collectionView else { return } - if collectionView.decelerationRate != UIScrollViewDecelerationRateFast { - collectionView.decelerationRate = UIScrollViewDecelerationRateFast + guard let collectionView = collectionView else { return } + + if collectionView.decelerationRate != .fast { + collectionView.decelerationRate = .fast } } fileprivate func updateLayout() { - guard let collectionView = self.collectionView else { return } + guard let collectionView = collectionView else { return } let collectionSize = collectionView.bounds.size - let isHorizontal = (self.scrollDirection == .horizontal) + let isHorizontal = scrollDirection == .horizontal - let yInset = (collectionSize.height - self.itemSize.height) / 2 - let xInset = (collectionSize.width - self.itemSize.width) / 2 - self.sectionInset = UIEdgeInsetsMake(yInset, xInset, yInset, xInset) + let yInset = (collectionSize.height - itemSize.height) / 2 + let xInset = (collectionSize.width - itemSize.width) / 2 + self.sectionInset = UIEdgeInsets(top: yInset, left: xInset, bottom: yInset, right: xInset) - let side = isHorizontal ? self.itemSize.width : self.itemSize.height - let scaledItemOffset = (side - side*self.sideItemScale) / 2 - switch self.spacingMode { + let side = isHorizontal ? itemSize.width : itemSize.height + let scaledItemOffset = (side - side * sideItemScale) / 2 + + switch spacingMode { case .fixed(let spacing): - self.minimumLineSpacing = spacing - scaledItemOffset + minimumLineSpacing = spacing - scaledItemOffset + case .overlap(let visibleOffset): let fullSizeSideItemOverlap = visibleOffset + scaledItemOffset let inset = isHorizontal ? xInset : yInset - self.minimumLineSpacing = inset - fullSizeSideItemOverlap + minimumLineSpacing = inset - fullSizeSideItemOverlap } } @@ -82,20 +86,20 @@ open class CarouselFlowLayout: UICollectionViewFlowLayout { } fileprivate func transformLayoutAttributes(_ attributes: UICollectionViewLayoutAttributes) -> UICollectionViewLayoutAttributes { - guard let collectionView = self.collectionView else { return attributes } - let isHorizontal = (self.scrollDirection == .horizontal) + guard let collectionView = collectionView else { return attributes } + let isHorizontal = scrollDirection == .horizontal let collectionCenter = isHorizontal ? collectionView.frame.size.width / 2 : collectionView.frame.size.height / 2 let offset = isHorizontal ? collectionView.contentOffset.x : collectionView.contentOffset.y let normalizedCenter = (isHorizontal ? attributes.center.x : attributes.center.y) - offset - let maxDistance = (isHorizontal ? self.itemSize.width : self.itemSize.height) + self.minimumLineSpacing + let maxDistance = (isHorizontal ? itemSize.width : itemSize.height) + minimumLineSpacing let distance = min(abs(collectionCenter - normalizedCenter), maxDistance) let ratio = (maxDistance - distance)/maxDistance - let alpha = ratio * (1 - self.sideItemAlpha) + self.sideItemAlpha - let scale = ratio * (1 - self.sideItemScale) + self.sideItemScale - let shift = (1 - ratio) * self.sideItemShift + let alpha = ratio * (1 - sideItemAlpha) + sideItemAlpha + let scale = ratio * (1 - sideItemScale) + sideItemScale + let shift = (1 - ratio) * sideItemShift attributes.alpha = alpha attributes.transform3D = CATransform3DScale(CATransform3DIdentity, scale, scale, 1) attributes.zIndex = Int(alpha * 10) diff --git a/Nynja/Library/UI/ContextMenuOLD/Cells/ContextMenuControlCell.swift b/Nynja/Library/UI/ContextMenuOLD/Cells/ContextMenuControlCell.swift index 25d8fc336..b75d9d21f 100644 --- a/Nynja/Library/UI/ContextMenuOLD/Cells/ContextMenuControlCell.swift +++ b/Nynja/Library/UI/ContextMenuOLD/Cells/ContextMenuControlCell.swift @@ -33,7 +33,7 @@ class ContextMenuControlCell : UICollectionViewCell { let backgroundPanel = UIView() self.addSubview(backgroundPanel) - self.sendSubview(toBack: backgroundPanel) + self.sendSubviewToBack(backgroundPanel) backgroundPanel.snp.makeConstraints(backgroundConstraints()) diff --git a/Nynja/Library/UI/ContextMenuOLD/Cells/ContextMenuItemCell.swift b/Nynja/Library/UI/ContextMenuOLD/Cells/ContextMenuItemCell.swift index 0802df582..f06370519 100644 --- a/Nynja/Library/UI/ContextMenuOLD/Cells/ContextMenuItemCell.swift +++ b/Nynja/Library/UI/ContextMenuOLD/Cells/ContextMenuItemCell.swift @@ -17,7 +17,7 @@ class ContextMenuItemCell : UICollectionViewCell { let backgroundPanel = UIView() self.addSubview(backgroundPanel) - self.sendSubview(toBack: backgroundPanel) + self.sendSubviewToBack(backgroundPanel) backgroundPanel.snp.makeConstraints({ (make) in make.right.equalTo(self).offset(-1) make.left.top.bottom.equalToSuperview() @@ -87,7 +87,7 @@ class ContextMenuItemCell : UICollectionViewCell { let text = item.text! as NSString let size = CGSize(width: 0, height: height) width += text.boundingRect(with: size, - attributes: [NSAttributedStringKey.font: CellConstants.font], + attributes: [.font: CellConstants.font], context: nil).width } diff --git a/Nynja/Library/UI/ContextMenuOLD/ContextMenu.swift b/Nynja/Library/UI/ContextMenuOLD/ContextMenu.swift index a4d7a06a5..b065abc15 100644 --- a/Nynja/Library/UI/ContextMenuOLD/ContextMenu.swift +++ b/Nynja/Library/UI/ContextMenuOLD/ContextMenu.swift @@ -95,7 +95,7 @@ class ContextMenu : UIView, ContextMenuItemsViewDelegate, HitTestDelegate { setArrowPosition(calculations: calculations, direction: direction, inView: inView) inView.addSubview(self) - inView.bringSubview(toFront: self) + inView.bringSubviewToFront(self) clipsToBounds = true diff --git a/Nynja/Library/UI/Extensions/String/StringExtensions.swift b/Nynja/Library/UI/Extensions/String/StringExtensions.swift index 41e29294f..12b76b10d 100644 --- a/Nynja/Library/UI/Extensions/String/StringExtensions.swift +++ b/Nynja/Library/UI/Extensions/String/StringExtensions.swift @@ -23,7 +23,10 @@ extension String { repeat { let font = UIFont(name: fontName, size: fontSize)! - let textRect = (self as NSString).boundingRect(with: constraintSize, options: .usesLineFragmentOrigin, attributes: [NSAttributedStringKey.font:font], context: nil) + let textRect = (self as NSString).boundingRect(with: constraintSize, + options: .usesLineFragmentOrigin, + attributes: [.font: font], + context: nil) let labelSize = textRect.size if labelSize.height <= constraintSize.height { diff --git a/Nynja/Library/UI/Extensions/TableView/UITableViewExtensions.swift b/Nynja/Library/UI/Extensions/TableView/UITableViewExtensions.swift index cf007793c..e6ced1d83 100644 --- a/Nynja/Library/UI/Extensions/TableView/UITableViewExtensions.swift +++ b/Nynja/Library/UI/Extensions/TableView/UITableViewExtensions.swift @@ -45,7 +45,7 @@ extension UITableView { { _ in completion() } } - func reloadVisibleCells(_ animation: UITableViewRowAnimation = .none) { + func reloadVisibleCells(_ animation: UITableView.RowAnimation = .none) { if let visibleCellsIndex = self.indexPathsForVisibleRows { self.reloadRows(at: visibleCellsIndex, with: animation) } @@ -65,5 +65,4 @@ extension UITableView { return cell } - } diff --git a/Nynja/Library/UI/Extensions/UI/UIImageView/UIImageExtensions.swift b/Nynja/Library/UI/Extensions/UI/UIImageView/UIImageExtensions.swift index c8be62509..497ab22de 100644 --- a/Nynja/Library/UI/Extensions/UI/UIImageView/UIImageExtensions.swift +++ b/Nynja/Library/UI/Extensions/UI/UIImageView/UIImageExtensions.swift @@ -188,7 +188,7 @@ extension UIImage { var compressingValue:CGFloat = 1.0 while (needCompress && compressingValue > 0.0) { - if let data:Data = UIImageJPEGRepresentation(self, compressingValue) { + if let data = jpegData(compressionQuality: compressingValue) { if data.count < sizeInBytes { needCompress = false imgData = data diff --git a/Nynja/Library/UI/Gestures/LinkLongPressGestureRecognizer.swift b/Nynja/Library/UI/Gestures/LinkLongPressGestureRecognizer.swift index ba7a022ed..a936f1323 100644 --- a/Nynja/Library/UI/Gestures/LinkLongPressGestureRecognizer.swift +++ b/Nynja/Library/UI/Gestures/LinkLongPressGestureRecognizer.swift @@ -11,7 +11,7 @@ import UIKit public final class LinkLongPressGestureRecognizer: UILongPressGestureRecognizer, UIGestureRecognizerDelegate, LinkRecognizable { public unowned let textView: UITextView - public let targetAttribute: NSAttributedStringKey + public let targetAttribute: NSAttributedString.Key public var selection: (Link, NSRange)? public var handler: ((Link, NSRange) -> Void)? @@ -19,7 +19,7 @@ public final class LinkLongPressGestureRecognizer: UILongPressGestureRecog // MARK: - Init - public init(textView: UITextView, targetAttribute: NSAttributedStringKey) { + public init(textView: UITextView, targetAttribute: NSAttributedString.Key) { self.textView = textView self.targetAttribute = targetAttribute super.init(target: nil, action: nil) diff --git a/Nynja/Library/UI/Gestures/LinkRecognizable.swift b/Nynja/Library/UI/Gestures/LinkRecognizable.swift index e86972166..387b2dedc 100644 --- a/Nynja/Library/UI/Gestures/LinkRecognizable.swift +++ b/Nynja/Library/UI/Gestures/LinkRecognizable.swift @@ -12,12 +12,12 @@ public protocol LinkRecognizable: class { associatedtype Link var textView: UITextView { get } - var targetAttribute: NSAttributedStringKey { get } + var targetAttribute: NSAttributedString.Key { get } var selection: (Link, NSRange)? { get set } var handler: ((Link, NSRange) -> Void)? { get set } - init(textView: UITextView, targetAttribute: NSAttributedStringKey) + init(textView: UITextView, targetAttribute: NSAttributedString.Key) func handleTouch(on location: CGPoint) -> (Link, NSRange)? func resetSelection() diff --git a/Nynja/Library/UI/Gestures/LinkTapGestureRecognizer.swift b/Nynja/Library/UI/Gestures/LinkTapGestureRecognizer.swift index 6fa8a24bf..09937697b 100644 --- a/Nynja/Library/UI/Gestures/LinkTapGestureRecognizer.swift +++ b/Nynja/Library/UI/Gestures/LinkTapGestureRecognizer.swift @@ -11,7 +11,7 @@ import UIKit public final class LinkTapGestureRecognizer: UITapGestureRecognizer, UIGestureRecognizerDelegate, LinkRecognizable { public unowned let textView: UITextView - public let targetAttribute: NSAttributedStringKey + public let targetAttribute: NSAttributedString.Key public var selection: (Link, NSRange)? public var handler: ((Link, NSRange) -> Void)? @@ -19,7 +19,7 @@ public final class LinkTapGestureRecognizer: UITapGestureRecognizer, UIGes // MARK: - Init - public init(textView: UITextView, targetAttribute: NSAttributedStringKey) { + public init(textView: UITextView, targetAttribute: NSAttributedString.Key) { self.textView = textView self.targetAttribute = targetAttribute super.init(target: nil, action: nil) diff --git a/Nynja/Library/UI/ImagePreviewTransitionController/ImagePreviewTransitionController.swift b/Nynja/Library/UI/ImagePreviewTransitionController/ImagePreviewTransitionController.swift index 678cd42e8..320070193 100644 --- a/Nynja/Library/UI/ImagePreviewTransitionController/ImagePreviewTransitionController.swift +++ b/Nynja/Library/UI/ImagePreviewTransitionController/ImagePreviewTransitionController.swift @@ -152,7 +152,7 @@ UIViewControllerAnimatedTransitioning, UIViewControllerInteractiveTransitioning if #available(iOS 11.0, *) { } else { let animation = CABasicAnimation(keyPath: "cornerRadius") - animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) + animation.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut) animation.fromValue = NSNumber(value: Float(referenceViewCopy.layer.cornerRadius)) animation.toValue = NSNumber(value: Float(self.endingCornerRadius)) animation.duration = self.transitionDuration(using: transitionContext) @@ -300,7 +300,7 @@ UIViewControllerAnimatedTransitioning, UIViewControllerInteractiveTransitioning self?.fadeView.removeFromSuperview() } - var scaleAnimationOptions: UIViewAnimationOptions + var scaleAnimationOptions: UIView.AnimationOptions var scaleInitialSpringVelocity: CGFloat if self.canPerformContextualDismissal() { @@ -493,14 +493,9 @@ UIViewControllerAnimatedTransitioning, UIViewControllerInteractiveTransitioning if let from = from as? ImagePreviewTransitionHostVCProtocol { return from } - - guard let childViewController = - from.childViewControllers.filter({ $0 is ImagePreviewTransitionHostVCProtocol }).first - as? ImagePreviewTransitionHostVCProtocol else { - return nil - } - - return childViewController + return from.children + .first { $0 is ImagePreviewTransitionHostVCProtocol } + .flatMap { $0 as? ImagePreviewTransitionHostVCProtocol } } private func processPendingAnimations() { diff --git a/Nynja/Library/UI/ItemSelector/ItemsSelector.swift b/Nynja/Library/UI/ItemSelector/ItemsSelector.swift index 0023aeb0b..970448365 100644 --- a/Nynja/Library/UI/ItemSelector/ItemsSelector.swift +++ b/Nynja/Library/UI/ItemSelector/ItemsSelector.swift @@ -35,7 +35,7 @@ class ItemsSelector : UIView, UICollectionViewDataSource, UICollectionViewDelega private lazy var collectionView:UICollectionView = { let layout = UICollectionViewFlowLayout() - layout.scrollDirection = UICollectionViewScrollDirection.horizontal + layout.scrollDirection = .horizontal let collection = UICollectionView.init(frame: CGRect.zero, collectionViewLayout: layout) @@ -91,11 +91,10 @@ class ItemsSelector : UIView, UICollectionViewDataSource, UICollectionViewDelega return CGSize.zero } - let attributes = [NSAttributedStringKey.font: ItemSelectorCell.font] let boundingSize = CGSize(width: .greatestFiniteMagnitude, height: collectionView.frame.height) let textWidth = title.boundingRect(with: boundingSize, - options: NSStringDrawingOptions.usesLineFragmentOrigin, - attributes: attributes, + options: .usesLineFragmentOrigin, + attributes: [.font: ItemSelectorCell.font], context: nil).width let width = textWidth + Constants.borderWidth * 2 + Constants.titleInsets * 2 return CGSize(width: width, height: collectionView.frame.height) diff --git a/Nynja/Library/UI/KeyboardLayoutGuide/KeyboardInteractive.swift b/Nynja/Library/UI/KeyboardLayoutGuide/KeyboardInteractive.swift index 85f75ef46..31bef1005 100644 --- a/Nynja/Library/UI/KeyboardLayoutGuide/KeyboardInteractive.swift +++ b/Nynja/Library/UI/KeyboardLayoutGuide/KeyboardInteractive.swift @@ -24,8 +24,8 @@ extension KeyboardInteractive where Self: UIViewController { let endFrame = frameEndValue.cgRectValue let duration = (userInfo["UIKeyboardAnimationDurationUserInfoKey"] as? NSNumber)?.doubleValue ?? 0 let animationCurveRawNSN = userInfo["UIKeyboardAnimationCurveUserInfoKey"] as? NSNumber - let animationCurveRaw = animationCurveRawNSN?.uintValue ?? UIViewAnimationOptions.curveEaseOut.rawValue - let animationCurve = UIViewAnimationOptions(rawValue: animationCurveRaw) + let animationCurveRaw = animationCurveRawNSN?.uintValue ?? UIView.AnimationOptions.curveEaseOut.rawValue + let animationCurve = UIView.AnimationOptions(rawValue: animationCurveRaw) UIView.performWithoutAnimation { self.updateLayout() @@ -55,7 +55,7 @@ extension UIViewController { let center = NotificationCenter.default center.addObserver(self, selector: #selector(keyboardWillChangeFrame(notification:)), - name: .UIKeyboardWillChangeFrame, + name: UIResponder.keyboardWillChangeFrameNotification, object: nil) } @@ -64,7 +64,7 @@ extension UIViewController { return } let center = NotificationCenter.default - center.removeObserver(self, name: .UIKeyboardWillChangeFrame, object: nil) + center.removeObserver(self, name: UIResponder.keyboardWillChangeFrameNotification, object: nil) } @objc private func keyboardWillChangeFrame(notification: Notification) { diff --git a/Nynja/Library/UI/KeyboardLayoutGuide/KeyboardLayoutGuide.swift b/Nynja/Library/UI/KeyboardLayoutGuide/KeyboardLayoutGuide.swift index 87da1c305..e14c06e03 100644 --- a/Nynja/Library/UI/KeyboardLayoutGuide/KeyboardLayoutGuide.swift +++ b/Nynja/Library/UI/KeyboardLayoutGuide/KeyboardLayoutGuide.swift @@ -49,7 +49,7 @@ final class KeyboardLayoutGuide: UILayoutGuide { let nc = NotificationCenter.default nc.addObserver(self, selector: #selector(keyboardWillChangeFrame(_:)), - name: .UIKeyboardWillChangeFrame, + name: UIResponder.keyboardWillChangeFrameNotification, object: nil) } @@ -131,7 +131,7 @@ private extension UILayoutGuide { private extension Notification { var keyboardHeight: CGFloat? { - guard let v = userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue else { return nil } + guard let v = userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue else { return nil } // Weirdly enough UIKeyboardFrameEndUserInfoKey doesn't have the same behaviour // in ios 10 or iOS 11 so we can't rely on v.cgRectValue.width diff --git a/Nynja/Library/UI/Lists/TableView/Cells/ChatListMessageCell/Cell/ChatListMessageContentView.swift b/Nynja/Library/UI/Lists/TableView/Cells/ChatListMessageCell/Cell/ChatListMessageContentView.swift index c0c44cc22..881371360 100644 --- a/Nynja/Library/UI/Lists/TableView/Cells/ChatListMessageCell/Cell/ChatListMessageContentView.swift +++ b/Nynja/Library/UI/Lists/TableView/Cells/ChatListMessageCell/Cell/ChatListMessageContentView.swift @@ -109,11 +109,11 @@ final class ChatListMessageContentView: BaseView { } func setupContent(sender: String, text: String) { - let defaultAttributes: [NSAttributedStringKey: Any] = [ + let defaultAttributes: [NSAttributedString.Key: Any] = [ .foregroundColor: UIColor.nynja.manatee, .font: type(of: self).contentFont ] - let boldAttributes: [NSAttributedStringKey: Any] = [ + let boldAttributes: [NSAttributedString.Key: Any] = [ .foregroundColor: UIColor.nynja.manatee, .font: type(of: self).contentBoldFont ] diff --git a/Nynja/Library/UI/Lists/TableView/Cells/ChatListMessageCell/Cell/ChatListMessageTableViewCell.swift b/Nynja/Library/UI/Lists/TableView/Cells/ChatListMessageCell/Cell/ChatListMessageTableViewCell.swift index 729935d18..469608a26 100644 --- a/Nynja/Library/UI/Lists/TableView/Cells/ChatListMessageCell/Cell/ChatListMessageTableViewCell.swift +++ b/Nynja/Library/UI/Lists/TableView/Cells/ChatListMessageCell/Cell/ChatListMessageTableViewCell.swift @@ -85,7 +85,7 @@ final class ChatListMessageTableViewCell: UITableViewCell { // MARK: - Init - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) setup() } diff --git a/Nynja/Library/UI/Lists/TableView/Cells/Selector/SelectorCell.swift b/Nynja/Library/UI/Lists/TableView/Cells/Selector/SelectorCell.swift index 65c4aaad7..4624503c3 100644 --- a/Nynja/Library/UI/Lists/TableView/Cells/Selector/SelectorCell.swift +++ b/Nynja/Library/UI/Lists/TableView/Cells/Selector/SelectorCell.swift @@ -93,7 +93,7 @@ class SelectorCell: UITableViewCell { // MARK: - Init - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) baseSetup() } diff --git a/Nynja/Library/UI/Lists/TableView/DataSource/TableViewDataSourceProxy.swift b/Nynja/Library/UI/Lists/TableView/DataSource/TableViewDataSourceProxy.swift index 2ea5733d7..4f0173f87 100644 --- a/Nynja/Library/UI/Lists/TableView/DataSource/TableViewDataSourceProxy.swift +++ b/Nynja/Library/UI/Lists/TableView/DataSource/TableViewDataSourceProxy.swift @@ -52,13 +52,12 @@ class TableViewDataSourceProxy: NSObject, UITableViewDataSource { func tableView(_ tableView: UITableView, sectionForSectionIndexTitle title: String, at index: Int) -> Int { return dataSource.tableView?(tableView, sectionForSectionIndexTitle: title, at: index) ?? 0 } - - func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) { + + func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) { dataSource.tableView?(tableView, commit: editingStyle, forRowAt: indexPath) } func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) { dataSource.tableView?(tableView, moveRowAt: sourceIndexPath, to: destinationIndexPath) } - } diff --git a/Nynja/Library/UI/Lists/TableView/FastScroll/ScrollBar.swift b/Nynja/Library/UI/Lists/TableView/FastScroll/ScrollBar.swift index 399300621..757691495 100644 --- a/Nynja/Library/UI/Lists/TableView/FastScroll/ScrollBar.swift +++ b/Nynja/Library/UI/Lists/TableView/FastScroll/ScrollBar.swift @@ -132,7 +132,7 @@ class ScrollBar: BaseView { let superview = scrollView.superview superview?.addSubview(self) - superview?.bringSubview(toFront: self) + superview?.bringSubviewToFront(self) let topInset = scrollView.contentInset.top + verticalInset.top let bottomInset = scrollView.contentInset.bottom + verticalInset.bottom diff --git a/Nynja/Library/UI/NotificationView/NotificationView.swift b/Nynja/Library/UI/NotificationView/NotificationView.swift index f64fee4af..4376bfbfc 100644 --- a/Nynja/Library/UI/NotificationView/NotificationView.swift +++ b/Nynja/Library/UI/NotificationView/NotificationView.swift @@ -187,7 +187,7 @@ class NotificationView: UIView { class func topWindow() -> UIWindow? { for window in UIApplication.shared.windows.reversed() { - if window.windowLevel == UIWindowLevelNormal && !window.isHidden && window.frame != CGRect.zero { + if window.windowLevel == .normal && !window.isHidden && window.frame != CGRect.zero { return window } } diff --git a/Nynja/Library/UI/SwipeBackHelper/SwipeBackHelper.swift b/Nynja/Library/UI/SwipeBackHelper/SwipeBackHelper.swift index 49ade5317..e65f20934 100644 --- a/Nynja/Library/UI/SwipeBackHelper/SwipeBackHelper.swift +++ b/Nynja/Library/UI/SwipeBackHelper/SwipeBackHelper.swift @@ -98,7 +98,7 @@ final class SwipeBackHelper: NSObject { extension SwipeBackHelper: UINavigationControllerDelegate { - func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationControllerOperation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? { + func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationController.Operation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? { return SlideAnimatedTransitioning() } diff --git a/Nynja/Library/UI/TextInput/InputBar/InputContent/TextInputContent.swift b/Nynja/Library/UI/TextInput/InputBar/InputContent/TextInputContent.swift index dd858f349..70a153481 100644 --- a/Nynja/Library/UI/TextInput/InputBar/InputContent/TextInputContent.swift +++ b/Nynja/Library/UI/TextInput/InputBar/InputContent/TextInputContent.swift @@ -122,15 +122,15 @@ extension TextInputContent { static var defaultTextAttributes: TextAttributes { return [ - NSAttributedStringKey.foregroundColor: defaultTextColor, - NSAttributedStringKey.font: defaultFont + .foregroundColor: defaultTextColor, + .font: defaultFont ] } static var mentionAttributes: TextAttributes { return [ - NSAttributedStringKey.foregroundColor: UIColor.nynja.blue, - NSAttributedStringKey.font: defaultFont + .foregroundColor: UIColor.nynja.blue, + .font: defaultFont ] } } diff --git a/Nynja/Library/UI/TextInput/InputField/CountryField.swift b/Nynja/Library/UI/TextInput/InputField/CountryField.swift index 2c00010b1..2cb02ab5f 100644 --- a/Nynja/Library/UI/TextInput/InputField/CountryField.swift +++ b/Nynja/Library/UI/TextInput/InputField/CountryField.swift @@ -25,7 +25,7 @@ class CountryField: BaseInputView, TextFieldWithPickerDelegate { tf.textFieldDelegate = self tf.attributedPlaceholder = NSAttributedString(string: String.localizable.selectCountryTitle.uppercased(), - attributes: [NSAttributedStringKey.foregroundColor: UIColor.nynja.white]) + attributes: [.foregroundColor: UIColor.nynja.white]) tf.text = "" self.content.addSubview(tf) diff --git a/Nynja/Library/UI/TextInput/InputField/TextField/TextField.swift b/Nynja/Library/UI/TextInput/InputField/TextField/TextField.swift index 56b144fad..5a613b91e 100644 --- a/Nynja/Library/UI/TextInput/InputField/TextField/TextField.swift +++ b/Nynja/Library/UI/TextInput/InputField/TextField/TextField.swift @@ -99,14 +99,19 @@ open class TextField: UITextField { private func toggleSubscription(_ shouldSubscribe: Bool) { if shouldSubscribe { - NotificationCenter.default.addObserver(self, selector: #selector(handleBackgroundNotification), name: .UIApplicationDidEnterBackground, object: nil) + NotificationCenter.default.addObserver(self, + selector: #selector(handleBackgroundNotification), + name: UIApplication.didEnterBackgroundNotification, + object: nil) } else { unscribeFromBackgroundNotification() } } private func unscribeFromBackgroundNotification() { - NotificationCenter.default.removeObserver(self, name: .UIApplicationDidEnterBackground, object: nil) + NotificationCenter.default.removeObserver(self, + name: UIApplication.didEnterBackgroundNotification, + object: nil) } @objc private func handleBackgroundNotification() { diff --git a/Nynja/Library/UI/TextInput/InputField/TextInputBar/ALKeyboardObservingView.swift b/Nynja/Library/UI/TextInput/InputField/TextInputBar/ALKeyboardObservingView.swift index 7abb743cb..8f1144611 100755 --- a/Nynja/Library/UI/TextInput/InputField/TextInputBar/ALKeyboardObservingView.swift +++ b/Nynja/Library/UI/TextInput/InputField/TextInputBar/ALKeyboardObservingView.swift @@ -16,7 +16,7 @@ public class ALKeyboardObservingView: UIView { private var defaultHeight: CGFloat = 44 override public var intrinsicContentSize: CGSize { - return CGSize(width: UIViewNoIntrinsicMetric, height: defaultHeight) + return CGSize(width: UIView.noIntrinsicMetric, height: defaultHeight) } @@ -52,7 +52,7 @@ public class ALKeyboardObservingView: UIView { public func updateHeight(height: CGFloat) { for constraint in constraints { - if constraint.firstAttribute == NSLayoutAttribute.height && constraint.firstItem as! NSObject == self { + if constraint.firstAttribute == .height && constraint.firstItem === self { constraint.constant = height < defaultHeight ? defaultHeight : height } } @@ -75,7 +75,7 @@ public class ALKeyboardObservingView: UIView { } private func keyboardDidChangeFrame(frame: CGRect) { - let userInfo: [AnyHashable : Any] = [UIKeyboardFrameEndUserInfoKey: NSValue(cgRect:frame)] + let userInfo: [AnyHashable : Any] = [UIResponder.keyboardFrameEndUserInfoKey: NSValue(cgRect:frame)] NotificationCenter.default.post(name: NSNotification.Name(rawValue: ALKeyboardFrameDidChangeNotification), object: nil, userInfo: userInfo) } diff --git a/Nynja/Library/UI/TextInput/InputField/TextInputBar/ALTextInputBar.swift b/Nynja/Library/UI/TextInput/InputField/TextInputBar/ALTextInputBar.swift index 5928411bd..b4c08004b 100755 --- a/Nynja/Library/UI/TextInput/InputField/TextInputBar/ALTextInputBar.swift +++ b/Nynja/Library/UI/TextInput/InputField/TextInputBar/ALTextInputBar.swift @@ -211,7 +211,7 @@ open class ALTextInputBar: UIView, ALTextViewDelegate { // MARK: - View positioning and layout - override open var intrinsicContentSize: CGSize { - return CGSize(width: UIViewNoIntrinsicMetric, height: defaultHeight) + return CGSize(width: UIView.noIntrinsicMetric, height: defaultHeight) } override open func layoutSubviews() { @@ -275,8 +275,12 @@ open class ALTextInputBar: UIView, ALTextViewDelegate { textView.frame = CGRect(x: textViewX, y: textViewY, width: textViewWidth, height: textViewHeight) - let offset = UIEdgeInsetsMake(-textViewBorderPadding.top, -textViewBorderPadding.left, -textViewBorderPadding.bottom, -textViewBorderPadding.right) - textViewBorderView.frame = UIEdgeInsetsInsetRect(textView.frame, offset) + let offset = UIEdgeInsets(top: -textViewBorderPadding.top, + left: -textViewBorderPadding.left, + bottom: -textViewBorderPadding.bottom, + right: -textViewBorderPadding.right) + + textViewBorderView.frame = textView.frame.inset(by: offset) } public func updateViews(animated: Bool) { @@ -301,7 +305,7 @@ open class ALTextInputBar: UIView, ALTextViewDelegate { let height = padding + newHeight for constraint in constraints { - if constraint.firstAttribute == NSLayoutAttribute.height && constraint.firstItem as! NSObject == self { + if constraint.firstAttribute == .height && constraint.firstItem === self { constraint.constant = height < defaultHeight ? defaultHeight : height } } diff --git a/Nynja/Library/UI/TextInput/InputField/TextInputBar/ALTextView.swift b/Nynja/Library/UI/TextInput/InputField/TextInputBar/ALTextView.swift index 0c053a4f9..38d709e8e 100755 --- a/Nynja/Library/UI/TextInput/InputField/TextInputBar/ALTextView.swift +++ b/Nynja/Library/UI/TextInput/InputField/TextInputBar/ALTextView.swift @@ -115,7 +115,7 @@ public class ALTextView: UITextView { placeholderLabel.isHidden = shouldHidePlaceholder() if !placeholderLabel.isHidden { placeholderLabel.frame = placeholderRectThatFits(rect: bounds) - sendSubview(toBack: placeholderLabel) + sendSubviewToBack(placeholderLabel) } } @@ -153,9 +153,14 @@ public class ALTextView: UITextView { var newHeight: CGFloat = 0 if let font = font { - let attributes = [NSAttributedStringKey.font: font] - let boundingSize = CGSize(width: frame.size.width - textContainerInset.left - textContainerInset.right, height: .greatestFiniteMagnitude) - let size = text.boundingRect(with: boundingSize, options: NSStringDrawingOptions.usesLineFragmentOrigin, attributes: attributes, context: nil) + let boundingSize = CGSize( + width: frame.size.width - textContainerInset.left - textContainerInset.right, + height: .greatestFiniteMagnitude + ) + let size = text.boundingRect(with: boundingSize, + options: .usesLineFragmentOrigin, + attributes: [.font: font], + context: nil) newHeight = ceil(size.height) } @@ -201,7 +206,8 @@ public class ALTextView: UITextView { */ private func placeholderRectThatFits(rect: CGRect) -> CGRect { let padding = textContainer.lineFragmentPadding - var placeHolderRect = UIEdgeInsetsInsetRect(rect, textContainerInset) + + var placeHolderRect = rect.inset(by: textContainerInset) placeHolderRect.origin.x += padding placeHolderRect.size.width -= padding * 2 diff --git a/Nynja/Library/UI/TextInput/Material/MaterialTextField.swift b/Nynja/Library/UI/TextInput/Material/MaterialTextField.swift index b11f96c41..b33c3db77 100644 --- a/Nynja/Library/UI/TextInput/Material/MaterialTextField.swift +++ b/Nynja/Library/UI/TextInput/Material/MaterialTextField.swift @@ -41,7 +41,7 @@ class MaterialTextField: MaterialTextContainer { didSet { textField.rightView = rightView } } - var rightViewMode: UITextFieldViewMode = UITextFieldViewMode.never { + var rightViewMode: UITextField.ViewMode = .never { didSet { textField.rightViewMode = rightViewMode } } diff --git a/Nynja/Library/UI/UITableViewCells/ChatSettingCell/ArrowCell.swift b/Nynja/Library/UI/UITableViewCells/ChatSettingCell/ArrowCell.swift index 2eb82a3b0..90e98f379 100644 --- a/Nynja/Library/UI/UITableViewCells/ChatSettingCell/ArrowCell.swift +++ b/Nynja/Library/UI/UITableViewCells/ChatSettingCell/ArrowCell.swift @@ -87,7 +87,7 @@ class ArrowCell: BaseSettingCell, ConfigurableCell { //MARK: - Init - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) baseSetup() } diff --git a/Nynja/Library/UI/UITableViewCells/ChatSettingCell/AvatarCell.swift b/Nynja/Library/UI/UITableViewCells/ChatSettingCell/AvatarCell.swift index a68742ac7..1d43b66d4 100644 --- a/Nynja/Library/UI/UITableViewCells/ChatSettingCell/AvatarCell.swift +++ b/Nynja/Library/UI/UITableViewCells/ChatSettingCell/AvatarCell.swift @@ -71,7 +71,7 @@ class AvatarCell: BaseSettingCell, ConfigurableCell { // MARK: - Init - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) baseSetup() } diff --git a/Nynja/Library/UI/UITableViewCells/ChatSettingCell/ImageCell.swift b/Nynja/Library/UI/UITableViewCells/ChatSettingCell/ImageCell.swift index 80bb0941b..d7e295151 100644 --- a/Nynja/Library/UI/UITableViewCells/ChatSettingCell/ImageCell.swift +++ b/Nynja/Library/UI/UITableViewCells/ChatSettingCell/ImageCell.swift @@ -82,7 +82,7 @@ class ImageCell: BaseSettingCell, ConfigurableCell { }() // MARK: Init - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) baseSetup() } diff --git a/Nynja/Library/UI/UITableViewCells/ChatSettingCell/SwitchCell.swift b/Nynja/Library/UI/UITableViewCells/ChatSettingCell/SwitchCell.swift index 0cf9878b3..901165da9 100644 --- a/Nynja/Library/UI/UITableViewCells/ChatSettingCell/SwitchCell.swift +++ b/Nynja/Library/UI/UITableViewCells/ChatSettingCell/SwitchCell.swift @@ -86,7 +86,7 @@ class SwitchCell: BaseSettingCell, ConfigurableCell { // MARK: - Init - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) baseSetup() } diff --git a/Nynja/Library/UI/UIViewController+Child.swift b/Nynja/Library/UI/UIViewController+Child.swift index 29b0fc845..3aa0ea24d 100644 --- a/Nynja/Library/UI/UIViewController+Child.swift +++ b/Nynja/Library/UI/UIViewController+Child.swift @@ -12,15 +12,15 @@ import SnapKit extension UIViewController { func removeChildViewController(childViewController: UIViewController) { - childViewController.willMove(toParentViewController: nil) + childViewController.willMove(toParent: nil) childViewController.view.removeFromSuperview() - childViewController.removeFromParentViewController() + childViewController.removeFromParent() } func addViewControllerAsChild(childViewController: UIViewController, to view: UIView? = nil) { let containerView = view ?? self.view - addChildViewController(childViewController) + addChild(childViewController) containerView?.addSubview(childViewController.view) childViewController.view.snp.makeConstraints { make in @@ -28,7 +28,7 @@ extension UIViewController { make.right.left.bottom.equalToSuperview() } - childViewController.didMove(toParentViewController: self) + childViewController.didMove(toParent: self) } } diff --git a/Nynja/Library/UI/View/CollapsedView/CollapsedView.swift b/Nynja/Library/UI/View/CollapsedView/CollapsedView.swift index 48167d76e..ecc3ba768 100644 --- a/Nynja/Library/UI/View/CollapsedView/CollapsedView.swift +++ b/Nynja/Library/UI/View/CollapsedView/CollapsedView.swift @@ -491,9 +491,9 @@ private extension CollapsedView { arrowLayer.path = arrowToTopPath arrowLayer.strokeColor = UIColor.nynja.white.cgColor arrowLayer.lineWidth = 2.5 - arrowLayer.lineCap = kCALineCapRound + arrowLayer.lineCap = .round - arrowLayer.fillRule = kCAFillRuleEvenOdd + arrowLayer.fillRule = .evenOdd arrowLayer.fillColor = UIColor.nynja.clear.cgColor arrowLayer.bounds = CollapsedView.arrowRect diff --git a/Nynja/Library/UI/View/ImagesView/ImagesView.swift b/Nynja/Library/UI/View/ImagesView/ImagesView.swift index 78aecf9c3..2fe8dbdcf 100644 --- a/Nynja/Library/UI/View/ImagesView/ImagesView.swift +++ b/Nynja/Library/UI/View/ImagesView/ImagesView.swift @@ -102,7 +102,7 @@ class ImagesView: BaseView { imageView.setImage(with: items[index]) self.addSubview(imageView) - self.sendSubview(toBack: imageView) + self.sendSubviewToBack(imageView) imageView.snp.makeConstraints { make in if index == 0 { diff --git a/Nynja/Library/UI/View/UIViewExtensions.swift b/Nynja/Library/UI/View/UIViewExtensions.swift index e91e2edc9..7fbc08b38 100644 --- a/Nynja/Library/UI/View/UIViewExtensions.swift +++ b/Nynja/Library/UI/View/UIViewExtensions.swift @@ -54,7 +54,7 @@ extension UIView { backgroundImageView.image = image backgroundImageView.contentMode = .scaleAspectFill addSubview(backgroundImageView) - sendSubview(toBack: backgroundImageView) + sendSubviewToBack(backgroundImageView) backgroundImageView.snp.makeConstraints { (make) in make.edges.equalToSuperview() diff --git a/Nynja/Library/UI/WheelContainer/FastScroll/BorderView.swift b/Nynja/Library/UI/WheelContainer/FastScroll/BorderView.swift index 6b6acf72e..1f3fff91e 100644 --- a/Nynja/Library/UI/WheelContainer/FastScroll/BorderView.swift +++ b/Nynja/Library/UI/WheelContainer/FastScroll/BorderView.swift @@ -9,7 +9,7 @@ import Foundation typealias BorderSelectHandler = ((String, Int) -> Void) -typealias BorderScrollHandler = ((UIGestureRecognizerState) -> Void) +typealias BorderScrollHandler = ((UIGestureRecognizer.State) -> Void) fileprivate let initialText = "A" fileprivate let pointsCount = 26 diff --git a/Nynja/Library/UI/WheelContainer/Wheel/ItemViews/WheelItemView.swift b/Nynja/Library/UI/WheelContainer/Wheel/ItemViews/WheelItemView.swift index 4d80c51ea..cf9eef5fc 100644 --- a/Nynja/Library/UI/WheelContainer/Wheel/ItemViews/WheelItemView.swift +++ b/Nynja/Library/UI/WheelContainer/Wheel/ItemViews/WheelItemView.swift @@ -100,7 +100,7 @@ class WheelItemView: UIView { // Set mask let outerLayerMask = CAShapeLayer() outerLayerMask.path = path.cgPath - outerLayerMask.lineCap = kCALineCapRound + outerLayerMask.lineCap = .round layer.mask = outerLayerMask maskPath = path @@ -158,7 +158,7 @@ class WheelItemView: UIView { let outerLayerMask = CAShapeLayer() outerLayerMask.path = path.cgPath - outerLayerMask.lineCap = kCALineCapRound + outerLayerMask.lineCap = .round contentView.layer.mask = outerLayerMask contentView.layer.masksToBounds = true } @@ -270,7 +270,7 @@ fileprivate extension WheelItemView { let mask = CAShapeLayer() mask.path = path.cgPath - mask.lineCap = kCALineCapButt + mask.lineCap = .butt separatorLayer?.mask = mask separatorLayer?.masksToBounds = true diff --git a/Nynja/Library/UI/WheelContainer/Wheel/WheelPreviews/WheelImageFullItemPreview.swift b/Nynja/Library/UI/WheelContainer/Wheel/WheelPreviews/WheelImageFullItemPreview.swift index bb649eccd..0e8f49ddc 100644 --- a/Nynja/Library/UI/WheelContainer/Wheel/WheelPreviews/WheelImageFullItemPreview.swift +++ b/Nynja/Library/UI/WheelContainer/Wheel/WheelPreviews/WheelImageFullItemPreview.swift @@ -108,7 +108,7 @@ private extension WheelImageFullItemPreview { var data: Data? if type == .image { - data = UIImageJPEGRepresentation(image, 1.0) + data = image.jpegData(compressionQuality: 1.0) } else if type == .video { let group = DispatchGroup() let options = PHVideoRequestOptions() diff --git a/Nynja/Modules/AddParticipants/View/AddParticipantsViewController.swift b/Nynja/Modules/AddParticipants/View/AddParticipantsViewController.swift index f4e940541..2b9de6dd4 100644 --- a/Nynja/Modules/AddParticipants/View/AddParticipantsViewController.swift +++ b/Nynja/Modules/AddParticipants/View/AddParticipantsViewController.swift @@ -335,14 +335,11 @@ class AddParticipantsViewController: BaseVC, AddParticipantsViewProtocol, Keyboa label.isHidden = hasContacts if hasContacts { - - self.view.sendSubview(toBack: imgView) - self.view.sendSubview(toBack: label) - + self.view.sendSubviewToBack(imgView) + self.view.sendSubviewToBack(label) } else { - - self.view.bringSubview(toFront: imgView) - self.view.bringSubview(toFront: label) + self.view.bringSubviewToFront(imgView) + self.view.bringSubviewToFront(label) } } @@ -510,9 +507,9 @@ extension AddParticipantsViewController: ParticipantsActionsDelegate { var fCanSelect: Bool = true switch presenter.participantsMode { - case .createGroupCall: + case .createGroupCall?: fCanSelect = participantsDataSource.selectedParticipants.count < (presenter.maxParticipantsToAdd - 1) - case .createConferenceCall: + case .createConferenceCall?: fCanSelect = participantsDataSource.selectedParticipants.count < (presenter.maxParticipantsToAdd - 1) default: fCanSelect = true @@ -545,7 +542,7 @@ extension AddParticipantsViewController: TestableViewControllerProtocol { searchField.accessibilityIdentifier = Keys.searchField.rawValue switch presenter.participantsMode { - case .delete: + case .delete?: doneButton.accessibilityIdentifier = Keys.deleteButton.rawValue default: doneButton.accessibilityIdentifier = Keys.doneButton.rawValue diff --git a/Nynja/Modules/AssigningInterpreter/View/CircleLoadingView/CircleLoadingView.swift b/Nynja/Modules/AssigningInterpreter/View/CircleLoadingView/CircleLoadingView.swift index 28939c6d3..8fbe1fb1f 100644 --- a/Nynja/Modules/AssigningInterpreter/View/CircleLoadingView/CircleLoadingView.swift +++ b/Nynja/Modules/AssigningInterpreter/View/CircleLoadingView/CircleLoadingView.swift @@ -93,7 +93,10 @@ class CircleLoadingView: UIView { } private func addNotifications() { - NotificationCenter.default.addObserver(self, selector: #selector(self.applicationDidBecomeActive), name: Notification.Name.UIApplicationDidBecomeActive, object: nil) + NotificationCenter.default.addObserver(self, + selector: #selector(self.applicationDidBecomeActive), + name: UIApplication.didBecomeActiveNotification, + object: nil) } @objc diff --git a/Nynja/Modules/Auth/Login/View/LoginViewController.swift b/Nynja/Modules/Auth/Login/View/LoginViewController.swift index 44903d7d4..72d403c33 100644 --- a/Nynja/Modules/Auth/Login/View/LoginViewController.swift +++ b/Nynja/Modules/Auth/Login/View/LoginViewController.swift @@ -54,7 +54,7 @@ class LoginViewController: BaseVC, LoginViewProtocol, LoginWheelContainerViewPro let width = UIScreen.main.bounds.width * 0.81 * 2 - self.loginView.bringSubview(toFront: self.loginView.checkButton) + self.loginView.bringSubviewToFront(self.loginView.checkButton) self.loginView.insertSubview(c, belowSubview: self.loginView.checkButton) c.snp.makeConstraints({ (make) in diff --git a/Nynja/Modules/Call/CallScreens/CallInProgress/Interactor/CallInProgressInteractor.swift b/Nynja/Modules/Call/CallScreens/CallInProgress/Interactor/CallInProgressInteractor.swift index a7091de2d..f6aef2652 100644 --- a/Nynja/Modules/Call/CallScreens/CallInProgress/Interactor/CallInProgressInteractor.swift +++ b/Nynja/Modules/Call/CallScreens/CallInProgress/Interactor/CallInProgressInteractor.swift @@ -20,23 +20,23 @@ class CallInProgressInteractor: CallInProgressInteractorInputProtocol, NynjaCall NotificationCenter.default.addObserver(self, selector: #selector(applicationDidBecomeActive), - name: NSNotification.Name.UIApplicationDidBecomeActive, + name: UIApplication.didBecomeActiveNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(applicationWillResignActive), - name: NSNotification.Name.UIApplicationWillResignActive, + name: UIApplication.willResignActiveNotification, object: nil) } deinit { NotificationCenter.default.removeObserver(self, - name: NSNotification.Name.UIApplicationWillResignActive, + name: UIApplication.willResignActiveNotification, object: nil) NotificationCenter.default.removeObserver(self, - name: NSNotification.Name.UIApplicationDidBecomeActive, + name: UIApplication.didBecomeActiveNotification, object: nil) } diff --git a/Nynja/Modules/Call/CallScreens/CallInProgress/View/CallInProgressViewController.swift b/Nynja/Modules/Call/CallScreens/CallInProgress/View/CallInProgressViewController.swift index 2ed92f550..2405adc40 100644 --- a/Nynja/Modules/Call/CallScreens/CallInProgress/View/CallInProgressViewController.swift +++ b/Nynja/Modules/Call/CallScreens/CallInProgress/View/CallInProgressViewController.swift @@ -142,8 +142,8 @@ class CallInProgressViewController: BaseVC, CallInProgressViewProtocol, AudioSes callInProgressView.setup(self.isIncomingCallRinging, self.callInProgressMode, self.contact) holdToSpeakView.setup() - self.view.bringSubview(toFront: scrollView) - self.view.bringSubview(toFront: pageControl) + self.view.bringSubviewToFront(scrollView) + self.view.bringSubviewToFront(pageControl) goToSecondPage() } @@ -550,7 +550,7 @@ class CallInProgressViewController: BaseVC, CallInProgressViewProtocol, AudioSes private func handleDidStopLocalCapturer() { callInProgressView.myVideoView.isHidden = true - callInProgressView.sendSubview(toBack: callInProgressView.myVideoView) + callInProgressView.sendSubviewToBack(callInProgressView.myVideoView) callInProgressView.switchCameraButton.isHidden = true callInProgressView.cameraButton.setImage( UIImage.nynja.CallItems.icVideoOffVoiceCall.image, for: .normal) diff --git a/Nynja/Modules/Call/CallScreens/CallInProgress/WireFrame/CallInProgressWireframe.swift b/Nynja/Modules/Call/CallScreens/CallInProgress/WireFrame/CallInProgressWireframe.swift index d962c43c0..8b87b8ded 100644 --- a/Nynja/Modules/Call/CallScreens/CallInProgress/WireFrame/CallInProgressWireframe.swift +++ b/Nynja/Modules/Call/CallScreens/CallInProgress/WireFrame/CallInProgressWireframe.swift @@ -124,7 +124,7 @@ class CallInProgressWireframe: CallInProgressWireFrameProtocol { let actionSheet = UIAlertController(title: nil, message: nil, - preferredStyle: UIAlertControllerStyle.actionSheet) + preferredStyle: .actionSheet) if (false == (participant?.isMe)!) { actionSheet.addAction(UIAlertAction(title: String.localizable.removeParticipantFromCall, diff --git a/Nynja/Modules/Call/View/BottomCallView.swift b/Nynja/Modules/Call/View/BottomCallView.swift index 0374f03f4..c8cbab08e 100644 --- a/Nynja/Modules/Call/View/BottomCallView.swift +++ b/Nynja/Modules/Call/View/BottomCallView.swift @@ -454,10 +454,10 @@ class BottomCallView: UIView, AudioSessionManagerDelegate { portOutButton.isHidden = true portOutLabel.isHidden = true - bringSubview(toFront: moreButton) - bringSubview(toFront: cameraButton) - bringSubview(toFront: microphoneButton) - bringSubview(toFront: declineButton) + bringSubviewToFront(moreButton) + bringSubviewToFront(cameraButton) + bringSubviewToFront(microphoneButton) + bringSubviewToFront(declineButton) } func inCallVideo() { @@ -600,8 +600,8 @@ class BottomCallView: UIView, AudioSessionManagerDelegate { portOutButton.isHidden = true portOutLabel.isHidden = true - bringSubview(toFront: cameraButton) - bringSubview(toFront: microphoneButton) + bringSubviewToFront(cameraButton) + bringSubviewToFront(microphoneButton) } //MARK: actions diff --git a/Nynja/Modules/Call/View/CallInProgressView.swift b/Nynja/Modules/Call/View/CallInProgressView.swift index 0cfa32bb6..9fb80ebf1 100644 --- a/Nynja/Modules/Call/View/CallInProgressView.swift +++ b/Nynja/Modules/Call/View/CallInProgressView.swift @@ -635,7 +635,7 @@ class CallInProgressView: UIView, MultiPageCollectionViewDelegate { self.backgroundImage.isHidden = false self.backgroundGradientView.isHidden = false self.backgroundImage.setImage(url: contact?.avatarUrl, placeHolder: UIImage(named: "ava_placeholder")) - self.bringSubview(toFront: self.backgroundImage) + self.bringSubviewToFront(self.backgroundImage) self.insertSubview(self.backgroundGradientView, aboveSubview: self.backgroundImage) self.backgroundColor = UIColor.nynja.callBackground self.statusLabel.text = "call_incoming".localized @@ -648,11 +648,11 @@ class CallInProgressView: UIView, MultiPageCollectionViewDelegate { self.backgroundImage.isHidden = false self.backgroundGradientView.isHidden = false self.backgroundImage.setImage(url: contact?.avatarUrl, placeHolder: UIImage(named: "ava_placeholder")) - self.bringSubview(toFront: self.backgroundImage) + self.bringSubviewToFront(self.backgroundImage) self.insertSubview(self.backgroundGradientView, aboveSubview: self.backgroundImage) - self.bringSubview(toFront: self.otherVideoView) - self.bringSubview(toFront: self.myVideoView) - self.bringSubview(toFront: self.switchCameraButton) + self.bringSubviewToFront(self.otherVideoView) + self.bringSubviewToFront(self.myVideoView) + self.bringSubviewToFront(self.switchCameraButton) self.backgroundColor = UIColor.nynja.callBackground self.statusLabel.text = "call_incoming_video".localized self.activeSpeakerView.isHidden = true @@ -665,10 +665,10 @@ class CallInProgressView: UIView, MultiPageCollectionViewDelegate { self.multiPageView.isHidden = false self.backgroundImage.isHidden = true self.backgroundGradientView.isHidden = true - self.bringSubview(toFront: self.multiPageView) + self.bringSubviewToFront(self.multiPageView) self.backgroundColor = UIColor.nynja.callBackground self.statusLabel.text = "call_incoming_audio_conference".localized - self.bringSubview(toFront: self.activeSpeakerView) + self.bringSubviewToFront(self.activeSpeakerView) self.activeSpeakerView.isHidden = false self.activeSpeakerView.snp.updateConstraints { (maker) in maker.height.equalTo(self.activeSpeakerViewHeight) @@ -677,10 +677,10 @@ class CallInProgressView: UIView, MultiPageCollectionViewDelegate { updateActiveSpeakers(withText: "") } - self.bringSubview(toFront: self.bottomView) - self.bringSubview(toFront: self.bottomViewAcceptReject) - self.bringSubview(toFront: self.nameLabel) - self.bringSubview(toFront: self.statusLabel) + self.bringSubviewToFront(self.bottomView) + self.bringSubviewToFront(self.bottomViewAcceptReject) + self.bringSubviewToFront(self.nameLabel) + self.bringSubviewToFront(self.statusLabel) } func updateActiveSpeakers(withText:String) { diff --git a/Nynja/Modules/ChatsList/View/ChatsListViewController.swift b/Nynja/Modules/ChatsList/View/ChatsListViewController.swift index 7f512269c..6d2e8c0bc 100644 --- a/Nynja/Modules/ChatsList/View/ChatsListViewController.swift +++ b/Nynja/Modules/ChatsList/View/ChatsListViewController.swift @@ -112,7 +112,7 @@ final class ChatsListViewController: BaseVC, ChatsListViewProtocol, BackSwipable swipeBackHelper.addGesture() setupTableView() - view.bringSubview(toFront: controlContainerView) + view.bringSubviewToFront(controlContainerView) } private func setupTableView() { diff --git a/Nynja/Modules/Contacts/View/TableView/Cell/ContactCell.swift b/Nynja/Modules/Contacts/View/TableView/Cell/ContactCell.swift index a393b308c..4a861a10d 100644 --- a/Nynja/Modules/Contacts/View/TableView/Cell/ContactCell.swift +++ b/Nynja/Modules/Contacts/View/TableView/Cell/ContactCell.swift @@ -98,7 +98,7 @@ class ContactCell: UITableViewCell { }() // MARK: - Init - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) baseSetup() } diff --git a/Nynja/Modules/Contacts/View/TransferCoinstoContactsView.swift b/Nynja/Modules/Contacts/View/TransferCoinstoContactsView.swift index 949f194a4..a689b7138 100644 --- a/Nynja/Modules/Contacts/View/TransferCoinstoContactsView.swift +++ b/Nynja/Modules/Contacts/View/TransferCoinstoContactsView.swift @@ -26,7 +26,7 @@ final class TransferCoinstoContactsView: UIControl { textField.backgroundColor = UIColor.nynja.clear textField.isUserInteractionEnabled = false textField.rightView = UIImageView(image: UIImage.nynja.Wallet.icQrCodeWallet.image) - textField.rightViewMode = UITextFieldViewMode.always + textField.rightViewMode = .always textField.cursorColor = UIColor.nynja.white addSubview(textField) @@ -43,7 +43,7 @@ private extension TransferCoinstoContactsView { func baseSetup() { adressTextField.placeholder = String.localizable.walletExternalAddress - addTarget(self, action: #selector(touchedUpInside), for: UIControlEvents.touchUpInside) + addTarget(self, action: #selector(touchedUpInside), for: .touchUpInside) } @objc func touchedUpInside() { diff --git a/Nynja/Modules/CreateGroup/View/TableView/Arrow/CellWithArrowTableViewCell.swift b/Nynja/Modules/CreateGroup/View/TableView/Arrow/CellWithArrowTableViewCell.swift index 48fe66110..8ff677650 100644 --- a/Nynja/Modules/CreateGroup/View/TableView/Arrow/CellWithArrowTableViewCell.swift +++ b/Nynja/Modules/CreateGroup/View/TableView/Arrow/CellWithArrowTableViewCell.swift @@ -135,7 +135,7 @@ final class CellWithArrowTableViewCell: UITableViewCell { // MARK: - Init - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) setup() } diff --git a/Nynja/Modules/CreateGroup/View/TableView/Image/CellWithImageTableViewCell.swift b/Nynja/Modules/CreateGroup/View/TableView/Image/CellWithImageTableViewCell.swift index 959770715..12e45d4c7 100644 --- a/Nynja/Modules/CreateGroup/View/TableView/Image/CellWithImageTableViewCell.swift +++ b/Nynja/Modules/CreateGroup/View/TableView/Image/CellWithImageTableViewCell.swift @@ -30,7 +30,7 @@ final class CellWithImageTableViewCell: UITableViewCell { // MARK: - Init - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) setup() } diff --git a/Nynja/Modules/EditPhoto/View/EditPhotoViewController.swift b/Nynja/Modules/EditPhoto/View/EditPhotoViewController.swift index da2f25ef7..26b9bb20e 100644 --- a/Nynja/Modules/EditPhoto/View/EditPhotoViewController.swift +++ b/Nynja/Modules/EditPhoto/View/EditPhotoViewController.swift @@ -139,7 +139,7 @@ class EditPhotoViewController: BaseVC, EditPhotoViewProtocol, UIScrollViewDelega img = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() } else if image.imageOrientation.rawValue == 1 { - img = UIImage(cgImage: imageRef, scale: 1, orientation: UIImageOrientation(rawValue: 1)!) + img = UIImage(cgImage: imageRef, scale: 1, orientation: UIImage.Orientation(rawValue: 1)!) } return img } @@ -161,7 +161,7 @@ class EditPhotoViewController: BaseVC, EditPhotoViewProtocol, UIScrollViewDelega let fillLayer = CAShapeLayer() fillLayer.path = path.cgPath - fillLayer.fillRule = kCAFillRuleEvenOdd + fillLayer.fillRule = .evenOdd fillLayer.fillColor = UIColor.nynja.black.withAlphaComponent(0.5).cgColor self.overlayView.layer.addSublayer(fillLayer) } diff --git a/Nynja/Modules/Flows/CameraFlow/Camera/CameraProtocols.swift b/Nynja/Modules/Flows/CameraFlow/Camera/CameraProtocols.swift index 6c0ed90e7..eed9388de 100644 --- a/Nynja/Modules/Flows/CameraFlow/Camera/CameraProtocols.swift +++ b/Nynja/Modules/Flows/CameraFlow/Camera/CameraProtocols.swift @@ -18,21 +18,21 @@ protocol CameraWireFrameProtocol: WireframeProtocol { protocol CameraViewProtocol { func updateTime(seconds: Int) - func switchFlashlight(mode: UIImagePickerControllerCameraFlashMode) - func switchFlash(mode: UIImagePickerControllerCameraFlashMode) + func switchFlashlight(mode: UIImagePickerController.CameraFlashMode) + func switchFlash(mode: UIImagePickerController.CameraFlashMode) } protocol CameraPresenterProtocol: NavigationProtocol { func getTitle() -> String - func getCurrentSourceType() -> UIImagePickerControllerSourceType - func getCurrentCaptureMode() -> UIImagePickerControllerCameraCaptureMode - func getVideoQuality() -> UIImagePickerControllerQualityType + func getCurrentSourceType() -> UIImagePickerController.SourceType + func getCurrentCaptureMode() -> UIImagePickerController.CameraCaptureMode + func getVideoQuality() -> UIImagePickerController.QualityType func getMediaTypes() -> [String] - func getAvailableCameraModes() -> [UIImagePickerControllerCameraCaptureMode] - func getFlashMode() -> UIImagePickerControllerCameraFlashMode + func getAvailableCameraModes() -> [UIImagePickerController.CameraCaptureMode] + func getFlashMode() -> UIImagePickerController.CameraFlashMode - func setCameraMode(mode: UIImagePickerControllerCameraCaptureMode) -> Bool - func switchCameraDevice() -> UIImagePickerControllerCameraDevice + func setCameraMode(mode: UIImagePickerController.CameraCaptureMode) -> Bool + func switchCameraDevice() -> UIImagePickerController.CameraDevice func switchFlashMode() func startRecording() @@ -57,15 +57,15 @@ protocol CameraPresenterProtocol: NavigationProtocol { } protocol CameraInteractorInputProtocol { - func getAvailableCameraModes() -> [UIImagePickerControllerCameraCaptureMode] - func getCurrentSourceType() -> UIImagePickerControllerSourceType - func getCurrentCaptureMode() -> UIImagePickerControllerCameraCaptureMode - func getVideoQuality() -> UIImagePickerControllerQualityType + func getAvailableCameraModes() -> [UIImagePickerController.CameraCaptureMode] + func getCurrentSourceType() -> UIImagePickerController.SourceType + func getCurrentCaptureMode() -> UIImagePickerController.CameraCaptureMode + func getVideoQuality() -> UIImagePickerController.QualityType func getMediaTypes() -> [String] - func getFlashMode() -> UIImagePickerControllerCameraFlashMode + func getFlashMode() -> UIImagePickerController.CameraFlashMode - func switchCameraDevice() -> UIImagePickerControllerCameraDevice - func setCameraMode(mode: UIImagePickerControllerCameraCaptureMode) -> Bool + func switchCameraDevice() -> UIImagePickerController.CameraDevice + func setCameraMode(mode: UIImagePickerController.CameraCaptureMode) -> Bool func switchFleshMode() func startRecording() @@ -84,6 +84,6 @@ protocol CameraInteractorInputProtocol { } protocol CameraInteractorOutputProtocol: class { - func flashModeDidUpdate(mode: UIImagePickerControllerCameraFlashMode) + func flashModeDidUpdate(mode: UIImagePickerController.CameraFlashMode) func updateTime(seconds: Int) } diff --git a/Nynja/Modules/Flows/CameraFlow/Camera/Interactor/CameraInteractor.swift b/Nynja/Modules/Flows/CameraFlow/Camera/Interactor/CameraInteractor.swift index ad1819d5a..46e737b3d 100644 --- a/Nynja/Modules/Flows/CameraFlow/Camera/Interactor/CameraInteractor.swift +++ b/Nynja/Modules/Flows/CameraFlow/Camera/Interactor/CameraInteractor.swift @@ -27,7 +27,7 @@ final class CameraInteractor: CameraInteractorInputProtocol, SetInjectable { return nil } - private var availableCameraModes: [UIImagePickerControllerCameraCaptureMode]! + private var availableCameraModes: [UIImagePickerController.CameraCaptureMode]! private var timer: Timer? private var seconds: Int = -1 { @@ -36,9 +36,9 @@ final class CameraInteractor: CameraInteractorInputProtocol, SetInjectable { } } - private var cameraMode: UIImagePickerControllerCameraCaptureMode = .photo - private var cameraDevice: UIImagePickerControllerCameraDevice = .rear - private var flashMode: UIImagePickerControllerCameraFlashMode = .off { + private var cameraMode: UIImagePickerController.CameraCaptureMode = .photo + private var cameraDevice: UIImagePickerController.CameraDevice = .rear + private var flashMode: UIImagePickerController.CameraFlashMode = .off { didSet { presenter?.flashModeDidUpdate(mode: flashMode) } @@ -50,7 +50,7 @@ final class CameraInteractor: CameraInteractorInputProtocol, SetInjectable { //MARK: - CameraInteractorInputProtocol extension CameraInteractor { - func switchCameraDevice() -> UIImagePickerControllerCameraDevice { + func switchCameraDevice() -> UIImagePickerController.CameraDevice { switch cameraDevice { case .rear: cameraDevice = .front case .front: cameraDevice = .rear @@ -59,7 +59,7 @@ extension CameraInteractor { return cameraDevice } - func setCameraMode(mode: UIImagePickerControllerCameraCaptureMode) -> Bool { + func setCameraMode(mode: UIImagePickerController.CameraCaptureMode) -> Bool { if cameraMode == mode { return false } @@ -77,19 +77,19 @@ extension CameraInteractor { } } - func getAvailableCameraModes() -> [UIImagePickerControllerCameraCaptureMode] { + func getAvailableCameraModes() -> [UIImagePickerController.CameraCaptureMode] { return availableCameraModes } - func getCurrentSourceType() -> UIImagePickerControllerSourceType { + func getCurrentSourceType() -> UIImagePickerController.SourceType { return .camera } - func getCurrentCaptureMode() -> UIImagePickerControllerCameraCaptureMode { + func getCurrentCaptureMode() -> UIImagePickerController.CameraCaptureMode { return cameraMode } - func getVideoQuality() -> UIImagePickerControllerQualityType { + func getVideoQuality() -> UIImagePickerController.QualityType { return .typeHigh } @@ -135,7 +135,7 @@ extension CameraInteractor { } } - func getFlashMode() -> UIImagePickerControllerCameraFlashMode { + func getFlashMode() -> UIImagePickerController.CameraFlashMode { return flashMode } @@ -184,7 +184,7 @@ extension CameraInteractor { let contact: Contact? let room: Room? - let availableCameraModes: [UIImagePickerControllerCameraCaptureMode] + let availableCameraModes: [UIImagePickerController.CameraCaptureMode] } func inject(dependencies: CameraInteractor.Dependencies) { @@ -203,7 +203,7 @@ extension CameraInteractor { //MARK: - Private private extension CameraInteractor { - func switchFleshForPhoto() -> UIImagePickerControllerCameraFlashMode { + func switchFleshForPhoto() -> UIImagePickerController.CameraFlashMode { switch flashMode { case .auto: return .on case .on: return .off @@ -211,7 +211,7 @@ private extension CameraInteractor { } } - func switchFleshlightForVideo() -> UIImagePickerControllerCameraFlashMode { + func switchFleshlightForVideo() -> UIImagePickerController.CameraFlashMode { switch flashMode { case .auto: return .on case .on: return .off @@ -226,7 +226,7 @@ private extension CameraInteractor { } } - func swapFleshForPhoto() -> UIImagePickerControllerCameraFlashMode { + func swapFleshForPhoto() -> UIImagePickerController.CameraFlashMode { switch flashMode { case .auto: return .auto case .on: return .on @@ -234,7 +234,7 @@ private extension CameraInteractor { } } - func swapFleshlightForVideo() -> UIImagePickerControllerCameraFlashMode { + func swapFleshlightForVideo() -> UIImagePickerController.CameraFlashMode { switch flashMode { case .auto: return .on case .on: return .on diff --git a/Nynja/Modules/Flows/CameraFlow/Camera/Presenter/CameraPresenter.swift b/Nynja/Modules/Flows/CameraFlow/Camera/Presenter/CameraPresenter.swift index 5a4214b57..92cfca816 100644 --- a/Nynja/Modules/Flows/CameraFlow/Camera/Presenter/CameraPresenter.swift +++ b/Nynja/Modules/Flows/CameraFlow/Camera/Presenter/CameraPresenter.swift @@ -22,19 +22,19 @@ extension CameraPresenter { return "CAMERA" } - func getAvailableCameraModes() -> [UIImagePickerControllerCameraCaptureMode] { + func getAvailableCameraModes() -> [UIImagePickerController.CameraCaptureMode] { return interactor.getAvailableCameraModes() } - func getCurrentSourceType() -> UIImagePickerControllerSourceType { + func getCurrentSourceType() -> UIImagePickerController.SourceType { return interactor.getCurrentSourceType() } - func getCurrentCaptureMode() -> UIImagePickerControllerCameraCaptureMode { + func getCurrentCaptureMode() -> UIImagePickerController.CameraCaptureMode { return interactor.getCurrentCaptureMode() } - func getVideoQuality() -> UIImagePickerControllerQualityType { + func getVideoQuality() -> UIImagePickerController.QualityType { return interactor.getVideoQuality() } @@ -42,11 +42,11 @@ extension CameraPresenter { return interactor.getMediaTypes() } - func switchCameraDevice() -> UIImagePickerControllerCameraDevice { + func switchCameraDevice() -> UIImagePickerController.CameraDevice { return interactor.switchCameraDevice() } - func setCameraMode(mode: UIImagePickerControllerCameraCaptureMode) -> Bool { + func setCameraMode(mode: UIImagePickerController.CameraCaptureMode) -> Bool { return interactor.setCameraMode(mode: mode) } @@ -98,7 +98,7 @@ extension CameraPresenter { interactor.switchSound() } - func getFlashMode() -> UIImagePickerControllerCameraFlashMode { + func getFlashMode() -> UIImagePickerController.CameraFlashMode { return interactor.getFlashMode() } @@ -124,7 +124,7 @@ extension CameraPresenter { //MARK: - CameraInteractorOutputProtocol extension CameraPresenter { - func flashModeDidUpdate(mode: UIImagePickerControllerCameraFlashMode) { + func flashModeDidUpdate(mode: UIImagePickerController.CameraFlashMode) { switch interactor.getCurrentCaptureMode() { case .photo: view.switchFlash(mode: mode) case .video: view.switchFlashlight(mode: mode) diff --git a/Nynja/Modules/Flows/CameraFlow/Camera/View/CameraViewController.swift b/Nynja/Modules/Flows/CameraFlow/Camera/View/CameraViewController.swift index 3a2699f94..afd94e75a 100644 --- a/Nynja/Modules/Flows/CameraFlow/Camera/View/CameraViewController.swift +++ b/Nynja/Modules/Flows/CameraFlow/Camera/View/CameraViewController.swift @@ -53,7 +53,7 @@ final class CameraViewController: UIViewController, CameraViewProtocol, SetInjec //MARK: - camera modes properties private weak var cameraModesContainerView: UIView! - private var cameraModeButtons: [(button: UIButton, captureMode: UIImagePickerControllerCameraCaptureMode)]? + private var cameraModeButtons: [(button: UIButton, captureMode: UIImagePickerController.CameraCaptureMode)]? //MARK: - captureButton @@ -281,7 +281,7 @@ extension CameraViewController { //MARK: - CameraViewProtocol extension CameraViewController { - func switchFlashlight(mode: UIImagePickerControllerCameraFlashMode) { + func switchFlashlight(mode: UIImagePickerController.CameraFlashMode) { DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.25) { [weak self] in let device = AVCaptureDevice.default(for: .video) @@ -301,7 +301,7 @@ extension CameraViewController { } } - func switchFlash(mode: UIImagePickerControllerCameraFlashMode) { + func switchFlash(mode: UIImagePickerController.CameraFlashMode) { let device = AVCaptureDevice.default(for: .video) try? device?.lockForConfiguration() @@ -463,7 +463,7 @@ private extension CameraViewController { } func addBlurViewToOverlay() { - let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.dark) + let blurEffect = UIBlurEffect(style: UIBlurEffect.Style.dark) let blurEffectView = UIVisualEffectView(effect: blurEffect) blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight] overlayView.addSubview(blurEffectView) @@ -472,7 +472,7 @@ private extension CameraViewController { make.edges.equalToSuperview() } - overlayView.sendSubview(toBack: blurEffectView) + overlayView.sendSubviewToBack(blurEffectView) blurEffectView.alpha = 0 view.layoutIfNeeded() @@ -942,7 +942,7 @@ private extension CameraViewController { return container } - func setViews(`for` modes: [UIImagePickerControllerCameraCaptureMode], in container: UIView) { + func setViews(`for` modes: [UIImagePickerController.CameraCaptureMode], in container: UIView) { cameraModeButtons = [] modes.enumerated().forEach { (offset, element) in diff --git a/Nynja/Modules/Flows/CameraFlow/Camera/View/Subviews/QRNotificationVIew.swift b/Nynja/Modules/Flows/CameraFlow/Camera/View/Subviews/QRNotificationVIew.swift index 4f94eec60..c9afb9ed2 100644 --- a/Nynja/Modules/Flows/CameraFlow/Camera/View/Subviews/QRNotificationVIew.swift +++ b/Nynja/Modules/Flows/CameraFlow/Camera/View/Subviews/QRNotificationVIew.swift @@ -42,7 +42,7 @@ final class QRNotificationView: UIView, SetInjectable { lastLine = line } - let lastLineSize = (lastLine as NSString).size(withAttributes: [NSAttributedStringKey.font : textView.font as Any]) + let lastLineSize = (lastLine as NSString).size(withAttributes: [.font : textView.font]) if (textView.contentSize.width > 0 && textView.contentSize.width * 2 < textView.textStorage.size().width) || diff --git a/Nynja/Modules/Flows/CameraFlow/Camera/Wireframe/CameraWireframe.swift b/Nynja/Modules/Flows/CameraFlow/Camera/Wireframe/CameraWireframe.swift index 5a299a2e8..8871e7bdd 100644 --- a/Nynja/Modules/Flows/CameraFlow/Camera/Wireframe/CameraWireframe.swift +++ b/Nynja/Modules/Flows/CameraFlow/Camera/Wireframe/CameraWireframe.swift @@ -32,7 +32,7 @@ extension CameraWireframe { struct Parameters { let room: Room? let contact: Contact? - let availableCameraModes: [UIImagePickerControllerCameraCaptureMode] + let availableCameraModes: [UIImagePickerController.CameraCaptureMode] } enum State { diff --git a/Nynja/Modules/Flows/CameraFlow/PhotoPreview/View/PhotoPreviewViewController.swift b/Nynja/Modules/Flows/CameraFlow/PhotoPreview/View/PhotoPreviewViewController.swift index 0a5f197ed..edf8dc83d 100644 --- a/Nynja/Modules/Flows/CameraFlow/PhotoPreview/View/PhotoPreviewViewController.swift +++ b/Nynja/Modules/Flows/CameraFlow/PhotoPreview/View/PhotoPreviewViewController.swift @@ -187,7 +187,7 @@ extension PhotoPreviewViewController { collapsedContentView = makeCollapsedContentView(on: footerContentView, isHaveAdditionalFunctionality: isHaveAdditionalFunctionality) expandedContentView = makeExpandedContentView(on: footerContentView, top: collapsedContentView) - footerContentView.sendSubview(toBack: expandedContentView) + footerContentView.sendSubviewToBack(expandedContentView) sendAsFileButton = makeSendAsFileButton(on: expandedContentView) } else { collapsedContentView = makeCollapsedContentView(on: view, isHaveAdditionalFunctionality: isHaveAdditionalFunctionality) @@ -455,7 +455,7 @@ extension PhotoPreviewViewController { let fillLayer = CAShapeLayer() fillLayer.path = path.cgPath - fillLayer.fillRule = kCAFillRuleEvenOdd + fillLayer.fillRule = .evenOdd fillLayer.fillColor = UIColor.nynja.black.withAlphaComponent(0.5).cgColor overlay.layer.addSublayer(fillLayer) diff --git a/Nynja/Modules/Flows/CameraFlow/VideoPreview/Interactor/CameraVideoPreviewInteractor.swift b/Nynja/Modules/Flows/CameraFlow/VideoPreview/Interactor/CameraVideoPreviewInteractor.swift index a16aca9ec..a8423047f 100644 --- a/Nynja/Modules/Flows/CameraFlow/VideoPreview/Interactor/CameraVideoPreviewInteractor.swift +++ b/Nynja/Modules/Flows/CameraFlow/VideoPreview/Interactor/CameraVideoPreviewInteractor.swift @@ -187,7 +187,7 @@ private extension CameraVideoPreviewInteractor { let start = CMTime(seconds: 0, preferredTimescale: avAsset.duration.timescale) let duration = avAsset.duration - let range = CMTimeRangeMake(start, duration) + let range = CMTimeRange(start: start, duration: duration) exportSession?.timeRange = range exportSession?.exportAsynchronously { diff --git a/Nynja/Modules/Flows/CameraFlow/VideoPreview/View/CameraVideoPreviewViewController.swift b/Nynja/Modules/Flows/CameraFlow/VideoPreview/View/CameraVideoPreviewViewController.swift index b9169ebba..8325918a1 100644 --- a/Nynja/Modules/Flows/CameraFlow/VideoPreview/View/CameraVideoPreviewViewController.swift +++ b/Nynja/Modules/Flows/CameraFlow/VideoPreview/View/CameraVideoPreviewViewController.swift @@ -82,7 +82,7 @@ final class CameraVideoPreviewViewController: UIViewController, CameraVideoPrevi } expandedContentView = makeExpandedContentView(on: footerContentView, top: collapsedContentView) - footerContentView.sendSubview(toBack: expandedContentView) + footerContentView.sendSubviewToBack(expandedContentView) sendAsFileButton = makeSendAsFileButton(on: expandedContentView) player = makePlayer(url: presenter.getVideoUrl()) @@ -96,7 +96,7 @@ final class CameraVideoPreviewViewController: UIViewController, CameraVideoPrevi timerView.setTimeValue(seconds: presenter.getVideoLenghtInSeconds()) } - open override func viewWillAppear(_ animated: Bool) { + override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) if let screenshot = presentingViewController?.view.snapshotView(afterScreenUpdates: false) { @@ -109,7 +109,7 @@ final class CameraVideoPreviewViewController: UIViewController, CameraVideoPrevi } } - override open func viewDidAppear(_ animated: Bool) { + override func viewDidAppear(_ animated: Bool) { super.viewWillDisappear(animated) UIView.animate( @@ -195,7 +195,7 @@ extension CameraVideoPreviewViewController { UIView.animate( withDuration: 0.25, delay: 0, - options: UIViewAnimationOptions.curveLinear, + options: .curveLinear, animations: { [weak self] in self?.view.layoutIfNeeded() }, @@ -239,7 +239,7 @@ private extension CameraVideoPreviewViewController { state = .canPlayVideo presenter.endRepoducing() player.pause() - player.seek(to: kCMTimeZero) + player.seek(to: .zero) } func setupNotifications() { diff --git a/Nynja/Modules/Flows/GalleryFlow/Gallery/View/GalleryViewController.swift b/Nynja/Modules/Flows/GalleryFlow/Gallery/View/GalleryViewController.swift index f6f3f135b..39b79296d 100644 --- a/Nynja/Modules/Flows/GalleryFlow/Gallery/View/GalleryViewController.swift +++ b/Nynja/Modules/Flows/GalleryFlow/Gallery/View/GalleryViewController.swift @@ -274,7 +274,7 @@ extension GalleryViewController { spinner.hidesWhenStopped = true spinner.translatesAutoresizingMaskIntoConstraints = false view.addSubview(spinner) - spinner.activityIndicatorViewStyle = .whiteLarge + spinner.style = .whiteLarge spinner.color = UIColor.nynja.mainRed @@ -345,7 +345,7 @@ extension GalleryViewController { collectionView.register(GalleryPhotoItemCollectionViewCell.self, forCellWithReuseIdentifier: GalleryPhotoItemCollectionViewCell.identifier) collectionView.register(GallerySectionHeader.self, - forSupplementaryViewOfKind: UICollectionElementKindSectionHeader, + forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: GallerySectionHeader.identifier) collectionView.dataSource = self @@ -496,7 +496,7 @@ extension GalleryViewController { let contentView = UIView() view.addSubview(contentView) - view.sendSubview(toBack: contentView) + view.sendSubviewToBack(contentView) contentView.backgroundColor = UIColor.nynja.darkLight contentView.snp.makeConstraints { (maker) in @@ -512,7 +512,7 @@ extension GalleryViewController { let contentView = UIView() view.addSubview(contentView) - view.sendSubview(toBack: contentView) + view.sendSubviewToBack(contentView) contentView.backgroundColor = UIColor.nynja.darkLight contentView.snp.makeConstraints { (maker) in @@ -532,8 +532,8 @@ extension GalleryViewController { segment.insertSegment(withTitle: String.localizable.byDate, at: 0, animated: false) segment.insertSegment(withTitle: String.localizable.byFolder, at: 1, animated: false) - segment.setTitleTextAttributes([NSAttributedStringKey.foregroundColor: UIColor.nynja.white], for: UIControlState.selected) - segment.setTitleTextAttributes([NSAttributedStringKey.foregroundColor: UIColor.nynja.mainRed], for: UIControlState.normal) + segment.setTitleTextAttributes([.foregroundColor: UIColor.nynja.white], for: .selected) + segment.setTitleTextAttributes([.foregroundColor: UIColor.nynja.mainRed], for: .normal) segment.layer.cornerRadius = CGFloat(SegmentedControlLayout.height / 2) segment.layer.masksToBounds = true @@ -560,8 +560,8 @@ extension GalleryViewController { segment.insertSegment(withTitle: String.localizable.byDate, at: 0, animated: false) segment.insertSegment(withTitle: String.localizable.byFolder, at: 1, animated: false) - segment.setTitleTextAttributes([NSAttributedStringKey.foregroundColor: UIColor.nynja.white], for: UIControlState.selected) - segment.setTitleTextAttributes([NSAttributedStringKey.foregroundColor: UIColor.nynja.mainRed], for: UIControlState.normal) + segment.setTitleTextAttributes([.foregroundColor: UIColor.nynja.white], for: .selected) + segment.setTitleTextAttributes([.foregroundColor: UIColor.nynja.mainRed], for: .normal) segment.layer.cornerRadius = CGFloat(SegmentedControlLayout.height / 2) segment.layer.masksToBounds = true diff --git a/Nynja/Modules/Flows/GalleryFlow/Gallery/View/Subviews/CounterIndicatorButton.swift b/Nynja/Modules/Flows/GalleryFlow/Gallery/View/Subviews/CounterIndicatorButton.swift index 70a31cb1a..3ce533e6d 100644 --- a/Nynja/Modules/Flows/GalleryFlow/Gallery/View/Subviews/CounterIndicatorButton.swift +++ b/Nynja/Modules/Flows/GalleryFlow/Gallery/View/Subviews/CounterIndicatorButton.swift @@ -9,7 +9,7 @@ import UIKit final class CounterIndicatorButton: UIButton { - enum State { + enum CounterState { case selected(numberValue: Int) case nonselected @@ -25,7 +25,7 @@ final class CounterIndicatorButton: UIButton { } } - var indicatorState: State = .nonselected { + var indicatorState: CounterState = .nonselected { didSet { indicatorState.apply(to: self) } diff --git a/Nynja/Modules/Flows/GalleryFlow/MultiplePreview/View/MultiplePreviewViewController.swift b/Nynja/Modules/Flows/GalleryFlow/MultiplePreview/View/MultiplePreviewViewController.swift index 139f0ff15..85b7a1869 100644 --- a/Nynja/Modules/Flows/GalleryFlow/MultiplePreview/View/MultiplePreviewViewController.swift +++ b/Nynja/Modules/Flows/GalleryFlow/MultiplePreview/View/MultiplePreviewViewController.swift @@ -158,7 +158,7 @@ extension MultiplePreviewViewController { UIView.animate( withDuration: 0.25, delay: 0, - options: UIViewAnimationOptions.curveLinear, + options: .curveLinear, animations: { [weak self] in self?.view.layoutIfNeeded() }, @@ -255,7 +255,7 @@ extension MultiplePreviewViewController { expandedContentView = makeExpandedContentView(on: footerContentView!) sendAsFile = makeSendAsFileButton(on: expandedContentView!) - footerContentView?.bringSubview(toFront: collapsedContentView!) + footerContentView?.bringSubviewToFront(collapsedContentView!) switchMuteButton = makeSwitchMuteButton(on: view, bottom: footerView!) progressBar = makeProgressBar(on: view, bottom: footerView!) @@ -348,7 +348,7 @@ private extension MultiplePreviewViewController { spinner.hidesWhenStopped = true spinner.translatesAutoresizingMaskIntoConstraints = false view.addSubview(spinner) - spinner.activityIndicatorViewStyle = .whiteLarge + spinner.style = .whiteLarge spinner.color = UIColor.nynja.mainRed diff --git a/Nynja/Modules/Flows/GalleryFlow/MultiplePreview/View/Subviews/VideoPreviewCVCell.swift b/Nynja/Modules/Flows/GalleryFlow/MultiplePreview/View/Subviews/VideoPreviewCVCell.swift index 9d7b375a0..3dc2a5b70 100644 --- a/Nynja/Modules/Flows/GalleryFlow/MultiplePreview/View/Subviews/VideoPreviewCVCell.swift +++ b/Nynja/Modules/Flows/GalleryFlow/MultiplePreview/View/Subviews/VideoPreviewCVCell.swift @@ -34,7 +34,7 @@ final class VideoPreviewCVCell: UICollectionViewCell, Configurable, IdentityProt func end() { player?.pause() - player?.seek(to: kCMTimeZero) + player?.seek(to: .zero) } func onSwitchMuteTap(_ isMute: Bool) { @@ -131,7 +131,7 @@ final class VideoPreviewCVCell: UICollectionViewCell, Configurable, IdentityProt spinner.hidesWhenStopped = true spinner.translatesAutoresizingMaskIntoConstraints = false self.contentView.addSubview(spinner) - spinner.activityIndicatorViewStyle = .whiteLarge + spinner.style = .whiteLarge spinner.color = UIColor.nynja.mainRed diff --git a/Nynja/Modules/GroupRules/View/AdminGroupRulesVC.swift b/Nynja/Modules/GroupRules/View/AdminGroupRulesVC.swift index 0d6294000..662a272c7 100644 --- a/Nynja/Modules/GroupRules/View/AdminGroupRulesVC.swift +++ b/Nynja/Modules/GroupRules/View/AdminGroupRulesVC.swift @@ -100,8 +100,8 @@ class AdminGroupRulesVC : GroupRulesViewController { textViewContainer.setGradientMask(firstInset: AdminConstraints.textView.verticalInsets, secondInset: AdminConstraints.textView.verticalInsets, vertical:true) - textView.contentInset = UIEdgeInsetsMake(AdminConstraints.textView.verticalInsets, 0, - AdminConstraints.textView.verticalInsets, 0) + textView.contentInset = UIEdgeInsets(top: AdminConstraints.textView.verticalInsets, left: 0, + bottom: AdminConstraints.textView.verticalInsets, right: 0) } // MARK: Actions diff --git a/Nynja/Modules/GroupRules/View/UserGroupRulesVC.swift b/Nynja/Modules/GroupRules/View/UserGroupRulesVC.swift index bf8b14d3e..118c3f7bb 100644 --- a/Nynja/Modules/GroupRules/View/UserGroupRulesVC.swift +++ b/Nynja/Modules/GroupRules/View/UserGroupRulesVC.swift @@ -60,10 +60,10 @@ class UserGroupRulesVC : GroupRulesViewController { textViewContainer.setGradientMask(firstInset: UserConstraints.textView.topInset, secondInset: UserConstraints.controlsContainer.height, vertical:true) - textView.contentInset = UIEdgeInsetsMake(UserConstraints.textView.topInset, - 0, - UserConstraints.controlsContainer.height, - 0) + textView.contentInset = UIEdgeInsets(top: UserConstraints.textView.topInset, + left: 0, + bottom: UserConstraints.controlsContainer.height, + right: 0) } // MARK: Actions diff --git a/Nynja/Modules/GroupStorage/View/Collection/GroupCollectionCell.swift b/Nynja/Modules/GroupStorage/View/Collection/GroupCollectionCell.swift index 765599504..f746cddb1 100644 --- a/Nynja/Modules/GroupStorage/View/Collection/GroupCollectionCell.swift +++ b/Nynja/Modules/GroupStorage/View/Collection/GroupCollectionCell.swift @@ -27,7 +27,7 @@ class GroupCollectionCell : UICollectionViewCell, GroupStorageCell { imageView.clipsToBounds = true self.contentView.addSubview(imageView) - self.contentView.sendSubview(toBack: imageView) + self.contentView.sendSubviewToBack(imageView) imageView.snp.makeConstraints({ (maker) in maker.left.right.top.bottom.equalToSuperview() diff --git a/Nynja/Modules/GroupStorage/View/Collection/GroupVideosCell.swift b/Nynja/Modules/GroupStorage/View/Collection/GroupVideosCell.swift index 309b2ad6f..85d281c95 100644 --- a/Nynja/Modules/GroupStorage/View/Collection/GroupVideosCell.swift +++ b/Nynja/Modules/GroupStorage/View/Collection/GroupVideosCell.swift @@ -17,7 +17,7 @@ class GroupVideosCell : GroupCollectionCell { panel.backgroundColor = UIColor.nynja.almostBlack.withAlphaComponent(0.5) self.contentView.addSubview(panel) - self.contentView.bringSubview(toFront: panel) + self.contentView.bringSubviewToFront(panel) panel.snp.makeConstraints({ (maker) in maker.width.equalTo(Constraints.infoPanel.width) diff --git a/Nynja/Modules/GroupStorage/View/Files/GroupFilesCell.swift b/Nynja/Modules/GroupStorage/View/Files/GroupFilesCell.swift index bd8395239..c17ec02e6 100644 --- a/Nynja/Modules/GroupStorage/View/Files/GroupFilesCell.swift +++ b/Nynja/Modules/GroupStorage/View/Files/GroupFilesCell.swift @@ -108,7 +108,7 @@ class GroupFilesCell : UITableViewCell, GroupStorageCell { // MARK: - Init - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) baseSetup() } diff --git a/Nynja/Modules/GroupStorage/View/Files/GroupFilesListVC.swift b/Nynja/Modules/GroupStorage/View/Files/GroupFilesListVC.swift index 0675e2bcf..452b55f3e 100644 --- a/Nynja/Modules/GroupStorage/View/Files/GroupFilesListVC.swift +++ b/Nynja/Modules/GroupStorage/View/Files/GroupFilesListVC.swift @@ -25,7 +25,7 @@ class GroupFilesListVC : GroupStorageListVC, UITableViewDelegate, UITableViewDat table.register(cellsClass, forCellReuseIdentifier: CellsId.regular) table.clipsToBounds = false table.backgroundColor = UIColor.nynja.clear - table.separatorStyle = UITableViewCellSeparatorStyle.none + table.separatorStyle = .none table.showsVerticalScrollIndicator = false view.addSubview(table) diff --git a/Nynja/Modules/GroupStorage/View/GroupLinksListVC.swift b/Nynja/Modules/GroupStorage/View/GroupLinksListVC.swift index 54fc60105..038086a16 100644 --- a/Nynja/Modules/GroupStorage/View/GroupLinksListVC.swift +++ b/Nynja/Modules/GroupStorage/View/GroupLinksListVC.swift @@ -36,7 +36,7 @@ class GroupLinksListVC : GroupStorageListVC, UITableViewDataSource, UITableViewD table.register(LinksCell.self, forCellReuseIdentifier: "cell") table.clipsToBounds = false table.backgroundColor = UIColor.nynja.clear - table.separatorStyle = UITableViewCellSeparatorStyle.none + table.separatorStyle = .none table.showsVerticalScrollIndicator = false view.addSubview(table) diff --git a/Nynja/Modules/GroupStorage/View/GroupStorageCell.swift b/Nynja/Modules/GroupStorage/View/GroupStorageCell.swift index dabba83f3..11f44b648 100644 --- a/Nynja/Modules/GroupStorage/View/GroupStorageCell.swift +++ b/Nynja/Modules/GroupStorage/View/GroupStorageCell.swift @@ -41,7 +41,7 @@ extension GroupStorageCell { view.addSubview(container) container.snp.makeConstraints(loadingContainerContraints()) - view.bringSubview(toFront: container) + view.bringSubviewToFront(container) loadingContainer = container // Progress indicator diff --git a/Nynja/Modules/GroupStorage/View/GroupStorageViewController.swift b/Nynja/Modules/GroupStorage/View/GroupStorageViewController.swift index d5a4add1e..b59640e48 100644 --- a/Nynja/Modules/GroupStorage/View/GroupStorageViewController.swift +++ b/Nynja/Modules/GroupStorage/View/GroupStorageViewController.swift @@ -138,7 +138,7 @@ class GroupStorageViewController: BaseVC, GroupStorageViewProtocol, ItemSelector } func showController (_ controller:GroupStorageListVC) { - for child in childViewControllers { + for child in children { let isFilterController = controllersClasses.values.contains(where: { (type) -> Bool in return child.isKind(of: type) }) @@ -153,8 +153,8 @@ class GroupStorageViewController: BaseVC, GroupStorageViewProtocol, ItemSelector controller.delegate = self controller.view.clipsToBounds = false - controller.willMove(toParentViewController: self) - self.addChildViewController(controller) + controller.willMove(toParent: self) + self.addChild(controller) container.addSubview(controller.view) controller.view.snp.makeConstraints { (maker) in @@ -162,7 +162,7 @@ class GroupStorageViewController: BaseVC, GroupStorageViewProtocol, ItemSelector maker.bottom.equalToSuperview().inset(Constants.Container.bottomInner) } - controller.didMove(toParentViewController: self) + controller.didMove(toParent: self) } // MARK: Interaction with list diff --git a/Nynja/Modules/GroupsList/View/GroupsListViewController.swift b/Nynja/Modules/GroupsList/View/GroupsListViewController.swift index 780533112..20b33a03d 100644 --- a/Nynja/Modules/GroupsList/View/GroupsListViewController.swift +++ b/Nynja/Modules/GroupsList/View/GroupsListViewController.swift @@ -100,7 +100,7 @@ final class GroupsListViewController: BaseVC, GroupsListViewProtocol, BackSwipab swipeBackHelper.addGesture() setupTableView() - view.bringSubview(toFront: controlContainerView) + view.bringSubviewToFront(controlContainerView) } private func setupTableView() { diff --git a/Nynja/Modules/History/View/HistoryCell.swift b/Nynja/Modules/History/View/HistoryCell.swift index 50e19b2cc..b0ce0acd4 100644 --- a/Nynja/Modules/History/View/HistoryCell.swift +++ b/Nynja/Modules/History/View/HistoryCell.swift @@ -127,7 +127,7 @@ class HistoryCell: UITableViewCell { // MARK: - Init - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) baseSetup() } diff --git a/Nynja/Modules/ImagePreview/View/ImagePreviewViewController.swift b/Nynja/Modules/ImagePreview/View/ImagePreviewViewController.swift index 5e24ce37b..7c879b67b 100644 --- a/Nynja/Modules/ImagePreview/View/ImagePreviewViewController.swift +++ b/Nynja/Modules/ImagePreview/View/ImagePreviewViewController.swift @@ -95,7 +95,7 @@ UIViewControllerTransitioningDelegate, SetInjectable { private func setupUI() { setupImage() - view.bringSubview(toFront: closeButton) + view.bringSubviewToFront(closeButton) view.backgroundColor = UIColor.nynja.black } @@ -274,7 +274,7 @@ extension ImagePreviewViewController: ImagePreviewTransitionHostVCProtocol { prepareScrollView() - view.bringSubview(toFront: closeButton) + view.bringSubviewToFront(closeButton) } } @@ -305,7 +305,7 @@ private extension ImagePreviewViewController { } self.prepareScrollView() - self.view.bringSubview(toFront: self.closeButton) + self.view.bringSubviewToFront(self.closeButton) } } diff --git a/Nynja/Modules/InterpretationType/View/TableView/Cell/InterpretationTypeCell.swift b/Nynja/Modules/InterpretationType/View/TableView/Cell/InterpretationTypeCell.swift index 165fcd62e..ceb03287a 100644 --- a/Nynja/Modules/InterpretationType/View/TableView/Cell/InterpretationTypeCell.swift +++ b/Nynja/Modules/InterpretationType/View/TableView/Cell/InterpretationTypeCell.swift @@ -97,7 +97,7 @@ class InterpretationTypeCell: UITableViewCell { }() // MARK: Init - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) baseSetup() } diff --git a/Nynja/Modules/LanguageSettings/LanguageSelector/View/TableView/Cell/LangCell.swift b/Nynja/Modules/LanguageSettings/LanguageSelector/View/TableView/Cell/LangCell.swift index efa3c109e..2771da582 100644 --- a/Nynja/Modules/LanguageSettings/LanguageSelector/View/TableView/Cell/LangCell.swift +++ b/Nynja/Modules/LanguageSettings/LanguageSelector/View/TableView/Cell/LangCell.swift @@ -63,7 +63,7 @@ class LangCell: UITableViewCell, ConfigurableCell { //MARK: - Init - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) baseSetup() } diff --git a/Nynja/Modules/LanguageSettings/LanguageSettings/View/TableView/Cell/ActionCell.swift b/Nynja/Modules/LanguageSettings/LanguageSettings/View/TableView/Cell/ActionCell.swift index 2ba3705f1..d3550a1b8 100644 --- a/Nynja/Modules/LanguageSettings/LanguageSettings/View/TableView/Cell/ActionCell.swift +++ b/Nynja/Modules/LanguageSettings/LanguageSettings/View/TableView/Cell/ActionCell.swift @@ -19,7 +19,7 @@ class ActionCell: BaseCell { //MARK: - Init - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) baseSetup() } diff --git a/Nynja/Modules/LeaveVoiceMessage/View/LeaveVoiceMessageViewController.swift b/Nynja/Modules/LeaveVoiceMessage/View/LeaveVoiceMessageViewController.swift index 0841f4509..e2e16327c 100644 --- a/Nynja/Modules/LeaveVoiceMessage/View/LeaveVoiceMessageViewController.swift +++ b/Nynja/Modules/LeaveVoiceMessage/View/LeaveVoiceMessageViewController.swift @@ -260,17 +260,17 @@ class LeaveVoiceMessageViewController: BaseVC, LeaveVoiceMessageViewProtocol { nameLabel.text = self.contact.fullName self.view.insertSubview(self.backgroundGradientView, aboveSubview: self.backgroundImage) - self.view.bringSubview(toFront: self.nameLabel) - self.view.bringSubview(toFront: self.statusLabel) + self.view.bringSubviewToFront(self.nameLabel) + self.view.bringSubviewToFront(self.statusLabel) - self.view.bringSubview(toFront: self.callBackButton) - self.view.bringSubview(toFront: self.cancelButton) + self.view.bringSubviewToFront(self.callBackButton) + self.view.bringSubviewToFront(self.cancelButton) - self.view.bringSubview(toFront: self.labelCancel) - self.view.bringSubview(toFront: self.labelCallBack) + self.view.bringSubviewToFront(self.labelCancel) + self.view.bringSubviewToFront(self.labelCallBack) - self.view.bringSubview(toFront: self.labelVoiceMessage) - self.view.bringSubview(toFront: self.voiceMessageButton) + self.view.bringSubviewToFront(self.labelVoiceMessage) + self.view.bringSubviewToFront(self.voiceMessageButton) } @objc private func callBackButtonPressed() { diff --git a/Nynja/Modules/Main/View/MainViewController.swift b/Nynja/Modules/Main/View/MainViewController.swift index 3a1cc6589..f746146a0 100644 --- a/Nynja/Modules/Main/View/MainViewController.swift +++ b/Nynja/Modules/Main/View/MainViewController.swift @@ -225,7 +225,7 @@ class MainViewController: BaseVC, MainViewProtocol, HitTestDelegate, UINavigatio lazy var uiLocker: UIView = { let v = UIView() - let blur = UIBlurEffect(style: UIBlurEffectStyle.dark) + let blur = UIBlurEffect(style: UIBlurEffect.Style.dark) var blurView = UIVisualEffectView(effect: blur) v.addSubview(blurView) @@ -233,9 +233,9 @@ class MainViewController: BaseVC, MainViewProtocol, HitTestDelegate, UINavigatio maker.top.left.right.bottom.equalTo(v) }) - let activity = UIActivityIndicatorView(activityIndicatorStyle: UIActivityIndicatorViewStyle.whiteLarge) + let activity = UIActivityIndicatorView(style: UIActivityIndicatorView.Style.whiteLarge) v.addSubview(activity) - v.bringSubview(toFront: activity) + v.bringSubviewToFront(activity) activity.snp.makeConstraints({ (maker) in maker.top.left.right.bottom.equalTo(v) @@ -255,14 +255,14 @@ class MainViewController: BaseVC, MainViewProtocol, HitTestDelegate, UINavigatio self.presenter.viewShowed() viewShowed = true - self.view.bringSubview(toFront: gradientView) - self.view.bringSubview(toFront: container) - self.view.bringSubview(toFront: nextButton) - self.view.bringSubview(toFront: safeAreaView) + self.view.bringSubviewToFront(gradientView) + self.view.bringSubviewToFront(container) + self.view.bringSubviewToFront(nextButton) + self.view.bringSubviewToFront(safeAreaView) if view.subviews.contains(uiLocker) { - self.view.bringSubview(toFront: uiLocker) + self.view.bringSubviewToFront(uiLocker) } updateWheelGestures(enabled:isDoubleTapEnabled) @@ -510,7 +510,7 @@ class MainViewController: BaseVC, MainViewProtocol, HitTestDelegate, UINavigatio // MARK: - Image Picker - func presentImagePicker(with sourceType: UIImagePickerControllerSourceType) { + func presentImagePicker(with sourceType: UIImagePickerController.SourceType) { let contact = Contact() let contactID = UserDefaults.standard.value(forKey: String(SharedParameters.contactPhoneId.rawValue)) as? String contact.phone_id = contactID @@ -567,23 +567,25 @@ class MainViewController: BaseVC, MainViewProtocol, HitTestDelegate, UINavigatio presenter?.wireFrame?.sendStatus(status: .recordingVideo) } - func processingSelect(info: [String : Any]) { - let mediaType = info[UIImagePickerControllerMediaType] as! String + private func processingSelect(info: [UIImagePickerController.InfoKey : Any]) { + let mediaType = info[.mediaType] as! String if mediaType == kUTTypeMovie as String { - if let mediaUrl = info[UIImagePickerControllerMediaURL] as? URL { + if let mediaUrl = info[.mediaURL] as? URL { self.convert(url: mediaUrl, complete: { (url) in self.presenter.sendVideo(with: url) }) } - } else if let pickedImage = info[UIImagePickerControllerOriginalImage] as? UIImage, + } + //FIXME: sending type + /* else if let pickedImage = info[.originalImage] as? UIImage, let sendingType = info[ImagePickerHandler.SendingType.key] as? ImagePickerHandler.SendingType { switch sendingType { case .default: send(image: pickedImage) case .asFile: send(image: pickedImage) } - } + } */ } func send(image: UIImage) { @@ -605,7 +607,7 @@ class MainViewController: BaseVC, MainViewProtocol, HitTestDelegate, UINavigatio exportSession?.outputFileType = AVFileType.mp4 let start = CMTime(seconds: 0, preferredTimescale: avAsset.duration.timescale) let duration = avAsset.duration - let range = CMTimeRangeMake(start, duration) + let range = CMTimeRange(start: start, duration: duration) exportSession?.timeRange = range exportSession?.exportAsynchronously(completionHandler: { switch exportSession!.status { @@ -668,7 +670,7 @@ class MainViewController: BaseVC, MainViewProtocol, HitTestDelegate, UINavigatio // MARK: UI locking func showUILocker() { self.view.addSubview(uiLocker) - self.view.bringSubview(toFront: uiLocker) + self.view.bringSubviewToFront(uiLocker) uiLocker.snp.makeConstraints { (maker) in maker.left.right.top.bottom.equalTo(self.view) diff --git a/Nynja/Modules/Message/Models/Mention/Payload/AttributedText/MessagePayloadRenderer.swift b/Nynja/Modules/Message/Models/Mention/Payload/AttributedText/MessagePayloadRenderer.swift index e80b13871..0c410ecb4 100644 --- a/Nynja/Modules/Message/Models/Mention/Payload/AttributedText/MessagePayloadRenderer.swift +++ b/Nynja/Modules/Message/Models/Mention/Payload/AttributedText/MessagePayloadRenderer.swift @@ -24,7 +24,7 @@ final class MessagePayloadRenderer: MessagePayloadRendererInput { func processPayload(with mentions: PayloadParseResult?, in attributedText: NSMutableAttributedString, - mentionAttributes: [NSAttributedStringKey: Any]) -> PayloadProcessingResult { + mentionAttributes: [NSAttributedString.Key: Any]) -> PayloadProcessingResult { guard let mentions = mentions, !mentions.isEmpty else { return (attributedText, nil) @@ -42,7 +42,7 @@ final class MessagePayloadRenderer: MessagePayloadRendererInput { let tagRange = mention.range.utf16Encoded.shifted(by: offset).nsRange attributedText.replaceCharacters(in: tagRange, with: alias) - let attrRange = Range(tagRange.location.. PayloadProcessingResult + mentionAttributes: [NSAttributedString.Key: Any]) -> PayloadProcessingResult static func processPlainTextPayload(with mentions: PayloadParseResult?, in text: String) -> PlainPayloadProcessingResult @@ -32,17 +32,17 @@ protocol MessagePayloadRendererInput: class { extension MessagePayloadRendererInput { - private var textAttributes: [NSAttributedStringKey: Any] { + private var textAttributes: [NSAttributedString.Key: Any] { return [ - NSAttributedStringKey.foregroundColor: textColor, - NSAttributedStringKey.font: textFont + .foregroundColor: textColor, + .font: textFont ] } - private var mentionAttributes: [NSAttributedStringKey: Any] { + private var mentionAttributes: [NSAttributedString.Key: Any] { return [ - NSAttributedStringKey.foregroundColor: mentionColor, - NSAttributedStringKey.font: textFont + .foregroundColor: mentionColor, + .font: textFont ] } diff --git a/Nynja/Modules/Message/Models/Mention/Text/NSAttributedStringKey+Mention.swift b/Nynja/Modules/Message/Models/Mention/Text/NSAttributedStringKey+Mention.swift index 6c80a3714..70659a437 100644 --- a/Nynja/Modules/Message/Models/Mention/Text/NSAttributedStringKey+Mention.swift +++ b/Nynja/Modules/Message/Models/Mention/Text/NSAttributedStringKey+Mention.swift @@ -8,8 +8,8 @@ import Foundation -public typealias TextAttributes = [NSAttributedStringKey: Any] +public typealias TextAttributes = [NSAttributedString.Key: Any] -extension NSAttributedStringKey { - static let mention = NSAttributedStringKey(rawValue: "mention") +extension NSAttributedString.Key { + static let mention = NSAttributedString.Key(rawValue: "mention") } diff --git a/Nynja/Modules/Message/Presenter/MessagePresenter.swift b/Nynja/Modules/Message/Presenter/MessagePresenter.swift index f31a0beb0..b90600bc3 100644 --- a/Nynja/Modules/Message/Presenter/MessagePresenter.swift +++ b/Nynja/Modules/Message/Presenter/MessagePresenter.swift @@ -769,12 +769,12 @@ class MessagePresenter: BasePresenter, MessagePresenterProtocol, MessageInteract model.sender = interactor.sender(for: message) switch model.type { - case .file: + case .file?: guard let file = message.files?.first, file.mime == SendMessageType.file.rawValue else { break } model.text = file.decodedFilename - case .video: + case .video?: guard let thumb = message.thumb else { break } @@ -783,7 +783,7 @@ class MessagePresenter: BasePresenter, MessagePresenterProtocol, MessageInteract model.imageSize = imageSize } model.video = attach.payload - case .image: + case .image?: guard let thumb = message.thumb else { break } @@ -791,15 +791,15 @@ class MessagePresenter: BasePresenter, MessagePresenterProtocol, MessageInteract if let imageSize = self.imageSize(from: attach) { model.imageSize = imageSize } - case .audio: + case .audio?: guard let desc = message.mainFile else { break } model.amplitudes = desc.amplitudes model.audioDuration = desc.audioDuration - case .sticker: + case .sticker?: model.emoji = message.mainFile?.firstEmoji - case .transfer: + case .transfer?: guard let files = message.files?.first, files.mime == SendMessageType.transfer.rawValue else { break } diff --git a/Nynja/Modules/Message/View/MessageVC+StickerInputModuleDelegate.swift b/Nynja/Modules/Message/View/MessageVC+StickerInputModuleDelegate.swift index efd8d73aa..0193d83da 100644 --- a/Nynja/Modules/Message/View/MessageVC+StickerInputModuleDelegate.swift +++ b/Nynja/Modules/Message/View/MessageVC+StickerInputModuleDelegate.swift @@ -11,7 +11,7 @@ import Foundation extension MessageVC: StickerInputModuleDelegate { func stickerPreviewContainer(for stickerInput: StickerInputModuleProtocol) -> UIView { - view.bringSubview(toFront: stickerPreviewContainerView) + view.bringSubviewToFront(stickerPreviewContainerView) return stickerPreviewContainerView } @@ -34,7 +34,7 @@ extension MessageVC: StickerInputModuleDelegate { func showStickerSearchResult() { stickerSearchResultView.isHidden = false - view.bringSubview(toFront: stickerSearchResultView) + view.bringSubviewToFront(stickerSearchResultView) } func hideStickerSearchResult() { diff --git a/Nynja/Modules/Message/View/MessageVC.swift b/Nynja/Modules/Message/View/MessageVC.swift index 35cbe1b5e..13188e74c 100644 --- a/Nynja/Modules/Message/View/MessageVC.swift +++ b/Nynja/Modules/Message/View/MessageVC.swift @@ -424,11 +424,11 @@ final class MessageVC: BaseVC, MessageViewProtocol, ReplyPreviewDelegate, BackSw setupStickerSearchResultViewOutput() setupStickerStateHandlers() - view.bringSubview(toFront: inputBar) - view.bringSubview(toFront: replyPreview) - view.bringSubview(toFront: gradientView) - view.bringSubview(toFront: bottomButton) - view.bringSubview(toFront: mentionCounterView) + view.bringSubviewToFront(inputBar) + view.bringSubviewToFront(replyPreview) + view.bringSubviewToFront(gradientView) + view.bringSubviewToFront(bottomButton) + view.bringSubviewToFront(mentionCounterView) mentionCounterView.isHidden = true stickerSearchResultView.isHidden = true @@ -451,11 +451,9 @@ final class MessageVC: BaseVC, MessageViewProtocol, ReplyPreviewDelegate, BackSw viewVisible = true let center = NotificationCenter.default - center.addObserver(self, selector: #selector(willEnterForeground), name: .UIApplicationWillEnterForeground, object: nil) - center.addObserver(self, selector: #selector(didEnterBackground), name: .UIApplicationDidEnterBackground, object: nil) - - center.addObserver(self, selector: #selector(willResignActive), name: .UIApplicationWillResignActive, object: nil) - + center.addObserver(self, selector: #selector(willEnterForeground), name: UIApplication.willEnterForegroundNotification, object: nil) + center.addObserver(self, selector: #selector(didEnterBackground), name: UIApplication.didEnterBackgroundNotification, object: nil) + center.addObserver(self, selector: #selector(willResignActive), name: UIApplication.willResignActiveNotification, object: nil) collectionView.layoutIfNeeded() presenter.viewDidAppear() @@ -470,11 +468,10 @@ final class MessageVC: BaseVC, MessageViewProtocol, ReplyPreviewDelegate, BackSw if viewVisible { viewVisible = false - NotificationCenter.default.removeObserver(self, name: .UIApplicationWillEnterForeground, object: nil) - NotificationCenter.default.removeObserver(self, name: .UIApplicationDidEnterBackground, object: nil) - - NotificationCenter.default.removeObserver(self, name: .UIApplicationWillResignActive, object: nil) - + let center = NotificationCenter.default + center.removeObserver(self, name: UIApplication.willEnterForegroundNotification, object: nil) + center.removeObserver(self, name: UIApplication.didEnterBackgroundNotification, object: nil) + center.removeObserver(self, name: UIApplication.willResignActiveNotification, object: nil) goAway() @@ -570,7 +567,7 @@ final class MessageVC: BaseVC, MessageViewProtocol, ReplyPreviewDelegate, BackSw guard let `self` = self else { return } if case .active = previewState { - self.view.bringSubview(toFront: self.stickerPreviewContainerView) + self.view.bringSubviewToFront(self.stickerPreviewContainerView) } self.stickerPreviewAnimator.handlePreview(with: previewState, in: self.stickerPreviewContainerView) } diff --git a/Nynja/Modules/Message/View/Views/CollectionView/Cells/ChatCells/BaseChatCell/BaseChatCell.swift b/Nynja/Modules/Message/View/Views/CollectionView/Cells/ChatCells/BaseChatCell/BaseChatCell.swift index a3f05eb93..fecf377e1 100644 --- a/Nynja/Modules/Message/View/Views/CollectionView/Cells/ChatCells/BaseChatCell/BaseChatCell.swift +++ b/Nynja/Modules/Message/View/Views/CollectionView/Cells/ChatCells/BaseChatCell/BaseChatCell.swift @@ -533,7 +533,10 @@ class BaseChatCell: UICollectionViewCell, MessageBaseImageViewDataSource, Messag let text = model.sender?.nick ?? model.sender?.fullname - var textSize = text?.boundingRect(with: CGSize(width: maxWidth, height: 0), options: .usesLineFragmentOrigin, attributes: [NSAttributedStringKey.font: BaseChatCell.senderFont as Any], context: nil).size ?? CGSize.zero + var textSize = text?.boundingRect(with: CGSize(width: maxWidth, height: 0), + options: .usesLineFragmentOrigin, + attributes: [.font: senderFont], + context: nil).size ?? .zero textSize.width = ceil(min(maxWidth, max(textSize.width, minWidth))) textSize.height = ceil(textSize.height) @@ -546,7 +549,10 @@ class BaseChatCell: UICollectionViewCell, MessageBaseImageViewDataSource, Messag let text = String.localizable.tpTranscribing - var textSize = text.boundingRect(with: CGSize(width: maxWidth, height: 0), options: .usesLineFragmentOrigin, attributes: [NSAttributedStringKey.font: BaseChatCell.translatingFont as Any], context: nil).size + var textSize = text.boundingRect(with: CGSize(width: maxWidth, height: 0), + options: .usesLineFragmentOrigin, + attributes: [.font: translatingFont], + context: nil).size textSize.width = ceil(min(maxWidth, textSize.width)) textSize.height = ceil(textSize.height) diff --git a/Nynja/Modules/Message/View/Views/CollectionView/Cells/Views/Base/MessageViewFactory.swift b/Nynja/Modules/Message/View/Views/CollectionView/Cells/Views/Base/MessageViewFactory.swift index fed72bf9f..f58aff1b8 100644 --- a/Nynja/Modules/Message/View/Views/CollectionView/Cells/Views/Base/MessageViewFactory.swift +++ b/Nynja/Modules/Message/View/Views/CollectionView/Cells/Views/Base/MessageViewFactory.swift @@ -38,7 +38,7 @@ final class MessageViewFactory { switch type { case let .reply(_ ,subtype): switch model.type { - case .sticker: + case .sticker?: return model.isOwner ? MessageStickerRepliedView(contentAppearance: dependency, delegate: dependency, @@ -90,7 +90,7 @@ final class MessageViewFactory { case let .reply(_, subtype): switch model.type { - case .sticker: + case .sticker?: return model.isOwner ? MessageStickerRepliedView.size(for: model, maxWidth: maxWidth, with: bubble) : OpponentMessageStickerRepliedView.size(for: model, maxWidth: maxWidth, with: bubble) @@ -154,7 +154,11 @@ final class MessageViewFactory { } private static func content(for model: BaseChatCellModel) -> BubbleInjectible.Type? { - switch model.type { + guard let type = model.type else { + return nil + } + + switch type { case .contact: return MessageContactView.self case .location: diff --git a/Nynja/Modules/Message/View/Views/CollectionView/Cells/Views/FileTransferInfoView.swift b/Nynja/Modules/Message/View/Views/CollectionView/Cells/Views/FileTransferInfoView.swift index 25aee671f..af7a256d2 100644 --- a/Nynja/Modules/Message/View/Views/CollectionView/Cells/Views/FileTransferInfoView.swift +++ b/Nynja/Modules/Message/View/Views/CollectionView/Cells/Views/FileTransferInfoView.swift @@ -87,11 +87,11 @@ class FileTransferInfoView: BaseView { private func configureResolutionInfo(with model: BaseChatCellModel) { switch model.type { - case .image: + case .image?: self.progressLabel.text = model.transferCompleteString self.speedLabel.text = model.imageResolutionString self.speedLabel.textColor = progressColor - case .video: + case .video?: self.progressLabel.text = model.transferCompleteString self.speedLabel.text = nil default: @@ -116,10 +116,10 @@ class FileTransferInfoView: BaseView { var imageResolutionWidth: CGFloat = 0 switch model.type { - case .image: + case .image?: imageResolutionWidth = model.imageResolutionString.width(for: speedFontName, height: Constraints.labels.speedHeight) - case .video: + case .video?: imageResolutionWidth = model.transferCompleteString.width(for: progressFontName, height: Constraints.labels.progressHeight) default: diff --git a/Nynja/Modules/Message/View/Views/CollectionView/Cells/Views/Message/MessageTextView.swift b/Nynja/Modules/Message/View/Views/CollectionView/Cells/Views/Message/MessageTextView.swift index eae0ddee8..cee5dfa2a 100644 --- a/Nynja/Modules/Message/View/Views/CollectionView/Cells/Views/Message/MessageTextView.swift +++ b/Nynja/Modules/Message/View/Views/CollectionView/Cells/Views/Message/MessageTextView.swift @@ -61,10 +61,10 @@ final class MessageTextView: MessageContentView { v.textContainer.lineFragmentPadding = 0 v.linkTextAttributes = [ - NSAttributedStringKey.foregroundColor.rawValue:UIColor.nynja.blue, - NSAttributedStringKey.underlineColor.rawValue: UIColor.nynja.blue, - NSAttributedStringKey.underlineStyle.rawValue: NSUnderlineStyle.styleSingle.rawValue - ] as [String : Any] + .foregroundColor: UIColor.nynja.blue, + .underlineColor: UIColor.nynja.blue, + .underlineStyle: NSUnderlineStyle.single + ] self.addSubview(v) v.snp.makeConstraints { make in diff --git a/Nynja/Modules/Message/View/Views/CollectionView/Cells/Views/Reply/MessageStickerRepliedView.swift b/Nynja/Modules/Message/View/Views/CollectionView/Cells/Views/Reply/MessageStickerRepliedView.swift index 8524b8cf9..1a7761df8 100644 --- a/Nynja/Modules/Message/View/Views/CollectionView/Cells/Views/Reply/MessageStickerRepliedView.swift +++ b/Nynja/Modules/Message/View/Views/CollectionView/Cells/Views/Reply/MessageStickerRepliedView.swift @@ -143,7 +143,10 @@ class MessageStickerRepliedView: MessageContainerView, ReplyInfoViewDelegate { let maxWidth = Constraints.replyInfoView.maxWidth - CGFloat(insets) - var textSize = text.boundingRect(with: CGSize(width: maxWidth, height: 0), options: .usesLineFragmentOrigin, attributes: [NSAttributedStringKey.font: font as Any], context: nil).size + var textSize = text.boundingRect(with: CGSize(width: maxWidth, height: 0), + options: .usesLineFragmentOrigin, + attributes: [.font: font], + context: nil).size textSize.width = ceil(min(maxWidth, textSize.width)) textSize.height = ceil(textSize.height) diff --git a/Nynja/Modules/Message/View/Views/CollectionView/Scroll/ScrollPosition.swift b/Nynja/Modules/Message/View/Views/CollectionView/Scroll/ScrollPosition.swift index c0e6dd148..10c025d0b 100644 --- a/Nynja/Modules/Message/View/Views/CollectionView/Scroll/ScrollPosition.swift +++ b/Nynja/Modules/Message/View/Views/CollectionView/Scroll/ScrollPosition.swift @@ -13,7 +13,7 @@ enum ScrollPosition { case center case bottom - var nativePosition: UICollectionViewScrollPosition { + var nativePosition: UICollectionView.ScrollPosition { switch self { case .top: return .top diff --git a/Nynja/Modules/Message/View/Views/MentionPanelView/Cell/UserMentionTableViewCell.swift b/Nynja/Modules/Message/View/Views/MentionPanelView/Cell/UserMentionTableViewCell.swift index 17e5461d0..6d7224948 100644 --- a/Nynja/Modules/Message/View/Views/MentionPanelView/Cell/UserMentionTableViewCell.swift +++ b/Nynja/Modules/Message/View/Views/MentionPanelView/Cell/UserMentionTableViewCell.swift @@ -60,7 +60,7 @@ final class UserMentionTableViewCell: UITableViewCell { // MARK: - Init - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) baseSetup() } diff --git a/Nynja/Modules/Profile/View/TableView/Cells/ActionCell/ProfileActionCell.swift b/Nynja/Modules/Profile/View/TableView/Cells/ActionCell/ProfileActionCell.swift index c0ee95d2b..879f4c7ab 100644 --- a/Nynja/Modules/Profile/View/TableView/Cells/ActionCell/ProfileActionCell.swift +++ b/Nynja/Modules/Profile/View/TableView/Cells/ActionCell/ProfileActionCell.swift @@ -60,7 +60,8 @@ class ProfileActionCell: UITableViewCell, ConfigurableCell { }() // MARK: Init - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) baseSetup() } diff --git a/Nynja/Modules/Profile/View/TableView/Cells/ContactCell/ProfileContactCell.swift b/Nynja/Modules/Profile/View/TableView/Cells/ContactCell/ProfileContactCell.swift index e7efc0317..bc8ef3ff2 100644 --- a/Nynja/Modules/Profile/View/TableView/Cells/ContactCell/ProfileContactCell.swift +++ b/Nynja/Modules/Profile/View/TableView/Cells/ContactCell/ProfileContactCell.swift @@ -192,7 +192,7 @@ class ProfileContactCell: UITableViewCell, ConfigurableCell { self.statusLabel.isHidden = true self.separatorView.isHidden = false - self.contentView.bringSubview(toFront: avatarButton) + self.contentView.bringSubviewToFront(avatarButton) self.avatarButton.addTarget(self, action: #selector(avatarTapped(_:)), for: .touchUpInside) self.acceptButton.addTarget(self, action: #selector(acceptTapped(_:)), for: .touchUpInside) self.ignoreButton.addTarget(self, action: #selector(ignoreTapped(_:)), for: .touchUpInside) diff --git a/Nynja/Modules/Profile/View/TableView/Cells/ProfilePlaceholderCell/ProfilePlaceholderCell.swift b/Nynja/Modules/Profile/View/TableView/Cells/ProfilePlaceholderCell/ProfilePlaceholderCell.swift index feff2cda2..2f04a3dbb 100644 --- a/Nynja/Modules/Profile/View/TableView/Cells/ProfilePlaceholderCell/ProfilePlaceholderCell.swift +++ b/Nynja/Modules/Profile/View/TableView/Cells/ProfilePlaceholderCell/ProfilePlaceholderCell.swift @@ -25,7 +25,7 @@ class ProfilePlaceholderCell: UITableViewCell, ConfigurableCell { }() // MARK: Init - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) baseSetup() } diff --git a/Nynja/Modules/Profile/View/TableView/Cells/StarCell/StarMessageCell.swift b/Nynja/Modules/Profile/View/TableView/Cells/StarCell/StarMessageCell.swift index 897e9a736..30b6226e5 100644 --- a/Nynja/Modules/Profile/View/TableView/Cells/StarCell/StarMessageCell.swift +++ b/Nynja/Modules/Profile/View/TableView/Cells/StarCell/StarMessageCell.swift @@ -109,7 +109,7 @@ class StarMessageCell: UITableViewCell, ConfigurableCell { make.right.equalToSuperview().inset(Constraints.timeLabel.rightInset.adjustedByWidth) make.bottom.equalToSuperview().inset(Constraints.timeLabel.bottomInset.adjustedByWidth) }) - contentView.bringSubview(toFront: label) + contentView.bringSubviewToFront(label) return label }() @@ -128,7 +128,7 @@ class StarMessageCell: UITableViewCell, ConfigurableCell { make.left.equalTo(self.nameLabel) make.bottom.equalToSuperview().inset(Constraints.additionalInfoLabel.bottomInset.adjustedByWidth) }) - contentView.bringSubview(toFront: label) + contentView.bringSubviewToFront(label) return label }() @@ -171,7 +171,7 @@ class StarMessageCell: UITableViewCell, ConfigurableCell { // MARK: - Init - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) baseSetup() } diff --git a/Nynja/Modules/QRCodeReader/View/QRCodeReaderViewController.swift b/Nynja/Modules/QRCodeReader/View/QRCodeReaderViewController.swift index c038a9756..eeae4ad95 100644 --- a/Nynja/Modules/QRCodeReader/View/QRCodeReaderViewController.swift +++ b/Nynja/Modules/QRCodeReader/View/QRCodeReaderViewController.swift @@ -56,7 +56,7 @@ class QRCodeReaderViewController: BaseVC, QRCodeReaderViewProtocol { let view = UIImageView() self.captureContainer.addSubview(view) - self.captureContainer.bringSubview(toFront: view) + self.captureContainer.bringSubviewToFront(view) view.isUserInteractionEnabled = false view.image = UIImage.nynja.CameraItems.icCameraFrame.image @@ -74,7 +74,7 @@ class QRCodeReaderViewController: BaseVC, QRCodeReaderViewProtocol { let view = UIView(frame: frame) self.captureContainer.addSubview(view) - self.captureContainer.sendSubview(toBack: view) + self.captureContainer.sendSubviewToBack(view) let subview = UIView(frame: frame) subview.backgroundColor = UIColor.green @@ -295,13 +295,20 @@ class QRCodeReaderViewController: BaseVC, QRCodeReaderViewProtocol { //MARK: 📩 Notification Handlers private func setupAppStateNotifications() { - NotificationCenter.default.addObserver(self, selector: #selector(self.startCursorAnimationOnEnterForeground), name: .UIApplicationWillEnterForeground, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(self.startCursorAnimationOnResignActive), name: .UIApplicationWillResignActive, object: nil) + NotificationCenter.default.addObserver(self, + selector: #selector(startCursorAnimationOnEnterForeground), + name: UIApplication.willEnterForegroundNotification, + object: nil) + + NotificationCenter.default.addObserver(self, + selector: #selector(startCursorAnimationOnResignActive), + name: UIApplication.willResignActiveNotification, + object: nil) } private func removeNotificationObservers() { - NotificationCenter.default.removeObserver(self, name: .UIApplicationWillEnterForeground, object: nil) - NotificationCenter.default.removeObserver(self, name: .UIApplicationWillResignActive, object: nil) + NotificationCenter.default.removeObserver(self, name: UIApplication.willEnterForegroundNotification, object: nil) + NotificationCenter.default.removeObserver(self, name: UIApplication.willResignActiveNotification, object: nil) } @objc private func startCursorAnimationOnEnterForeground() { diff --git a/Nynja/Modules/Replies/Presenter/RepliesPresenter.swift b/Nynja/Modules/Replies/Presenter/RepliesPresenter.swift index d57886a32..75f4b2a6c 100644 --- a/Nynja/Modules/Replies/Presenter/RepliesPresenter.swift +++ b/Nynja/Modules/Replies/Presenter/RepliesPresenter.swift @@ -104,23 +104,23 @@ class RepliesPresenter: BasePresenter, RepliesPresenterProtocol, RepliesInteract } switch model.type { - case .file: + case .file?: if let file = message.files?.first, file.mime == SendMessageType.file.rawValue { model.text = file.decodedFilename } - case .video: + case .video?: if let thumb = message.files?.first, thumb.mime == SendMessageType.thumbnails.rawValue { model.text = thumb.payload model.imageSize = makeImageSize(from: message) } - case .sticker: + case .sticker?: model.emoji = message.mainFile?.firstEmoji - case .contact: + case .contact?: model.contact = makeContact(from: attach) - case .image: + case .image?: model.imageSize = makeImageSize(from: message) - case .audio: + case .audio?: model.amplitudes = message.mainFile?.amplitudes model.audioDuration = message.mainFile?.audioDuration default: diff --git a/Nynja/Modules/Replies/View/RepliesVC.swift b/Nynja/Modules/Replies/View/RepliesVC.swift index fc0d20fc8..13326939c 100644 --- a/Nynja/Modules/Replies/View/RepliesVC.swift +++ b/Nynja/Modules/Replies/View/RepliesVC.swift @@ -51,7 +51,7 @@ final class RepliesVC: BaseVC, RepliesViewProtocol { collectionView.backgroundColor = UIColor.nynja.clear collectionView.alwaysBounceVertical = true - collectionView.contentInset = UIEdgeInsetsMake(Constraints.tableView.topInset, 0, 0, 0) + collectionView.contentInset = UIEdgeInsets(top: Constraints.tableView.topInset, left: 0, bottom: 0, right: 0) collectionView.contentOffset = CGPoint(x: 0, y: -Constraints.tableView.topInset) let bottomPadding = UIScreen.main.bounds.height * 0.11 diff --git a/Nynja/Modules/Settings/ChangeNumber/ChangeNumberStep2/View/ChangeNumberStep2ViewController.swift b/Nynja/Modules/Settings/ChangeNumber/ChangeNumberStep2/View/ChangeNumberStep2ViewController.swift index 9b1d8153c..e02b20321 100644 --- a/Nynja/Modules/Settings/ChangeNumber/ChangeNumberStep2/View/ChangeNumberStep2ViewController.swift +++ b/Nynja/Modules/Settings/ChangeNumber/ChangeNumberStep2/View/ChangeNumberStep2ViewController.swift @@ -43,7 +43,7 @@ class ChangeNumberStep2ViewController: BaseVC, LoginWheelContainerViewProtocol, c.shouldRestoreState = true c.clipsToBounds = false let width = UIScreen.main.bounds.width * 0.81 * 2 - self.changeNumberView.bringSubview(toFront: self.changeNumberView.checkButton) + self.changeNumberView.bringSubviewToFront(self.changeNumberView.checkButton) self.changeNumberView.insertSubview(c, belowSubview: self.changeNumberView.checkButton) c.snp.makeConstraints({ (make) in make.width.height.equalTo(width) diff --git a/Nynja/Modules/Settings/NotificationAlertSounds/View/TableView/Cell/TextCheckmarkTableViewCell.swift b/Nynja/Modules/Settings/NotificationAlertSounds/View/TableView/Cell/TextCheckmarkTableViewCell.swift index b18c5294e..648650cdc 100644 --- a/Nynja/Modules/Settings/NotificationAlertSounds/View/TableView/Cell/TextCheckmarkTableViewCell.swift +++ b/Nynja/Modules/Settings/NotificationAlertSounds/View/TableView/Cell/TextCheckmarkTableViewCell.swift @@ -52,7 +52,7 @@ final class TextCheckmarkTableViewCell: UITableViewCell { // MARK: - Init - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) baseSetup() } diff --git a/Nynja/Modules/Settings/Notifications/View/TableView/TextSwitchTableViewCell.swift b/Nynja/Modules/Settings/Notifications/View/TableView/TextSwitchTableViewCell.swift index 031b67fb5..d47377cbe 100644 --- a/Nynja/Modules/Settings/Notifications/View/TableView/TextSwitchTableViewCell.swift +++ b/Nynja/Modules/Settings/Notifications/View/TableView/TextSwitchTableViewCell.swift @@ -74,7 +74,7 @@ final class TextSwitchTableViewCell: UITableViewCell { // MARK: - Init - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) baseSetup() } diff --git a/Nynja/Modules/Settings/Privacy/View/TableView/PrivacyTableViewCell.swift b/Nynja/Modules/Settings/Privacy/View/TableView/PrivacyTableViewCell.swift index dae24bb84..c48af4c0b 100644 --- a/Nynja/Modules/Settings/Privacy/View/TableView/PrivacyTableViewCell.swift +++ b/Nynja/Modules/Settings/Privacy/View/TableView/PrivacyTableViewCell.swift @@ -86,7 +86,7 @@ final class PrivacyTableViewCell: UITableViewCell { // MARK: - Init - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) baseSetup() } diff --git a/Nynja/Modules/Settings/SettingsDataAndStorage/View/TableView/CheckmarkCell/CheckmarkCell.swift b/Nynja/Modules/Settings/SettingsDataAndStorage/View/TableView/CheckmarkCell/CheckmarkCell.swift index b803a32e0..d74c0b888 100644 --- a/Nynja/Modules/Settings/SettingsDataAndStorage/View/TableView/CheckmarkCell/CheckmarkCell.swift +++ b/Nynja/Modules/Settings/SettingsDataAndStorage/View/TableView/CheckmarkCell/CheckmarkCell.swift @@ -70,7 +70,7 @@ class CheckmarkCell: UITableViewCell { }() // MARK: Init - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) baseSetup() } diff --git a/Nynja/Modules/Settings/Support/View/TableView/TextTableViewCell.swift b/Nynja/Modules/Settings/Support/View/TableView/TextTableViewCell.swift index 4cffbfcf0..c504dffc0 100644 --- a/Nynja/Modules/Settings/Support/View/TableView/TextTableViewCell.swift +++ b/Nynja/Modules/Settings/Support/View/TableView/TextTableViewCell.swift @@ -70,7 +70,7 @@ final class TextTableViewCell: UITableViewCell { // MARK: - Init - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) baseSetup() } diff --git a/Nynja/Modules/Stickers/View/CollectionView/Cells/ScaleAnimation/ScaleAnimatableGrid.swift b/Nynja/Modules/Stickers/View/CollectionView/Cells/ScaleAnimation/ScaleAnimatableGrid.swift index 100f422dd..459c1084e 100644 --- a/Nynja/Modules/Stickers/View/CollectionView/Cells/ScaleAnimation/ScaleAnimatableGrid.swift +++ b/Nynja/Modules/Stickers/View/CollectionView/Cells/ScaleAnimation/ScaleAnimatableGrid.swift @@ -63,7 +63,7 @@ extension ScaleAnimatableGrid where Self: UIView { } } - private func animateLongPress(at indexPath: IndexPath?, state: UIGestureRecognizerState) { + private func animateLongPress(at indexPath: IndexPath?, state: UIGestureRecognizer.State) { let shouldScale = state == .began let shouldRestore = state == .ended || state == .cancelled diff --git a/Nynja/Modules/Stickers/View/ViewController/StickersInputViewController.swift b/Nynja/Modules/Stickers/View/ViewController/StickersInputViewController.swift index 7a2e0e166..5f7f381da 100644 --- a/Nynja/Modules/Stickers/View/ViewController/StickersInputViewController.swift +++ b/Nynja/Modules/Stickers/View/ViewController/StickersInputViewController.swift @@ -334,7 +334,7 @@ final class StickersInputViewController: UIInputViewController, StickersInputVie guard case let indices = menuCollectionView.indexPathsForVisibleItems, !indices.isEmpty else { return } - let position: UICollectionViewScrollPosition = .centeredHorizontally + let position: UICollectionView.ScrollPosition = .centeredHorizontally menuCollectionView.selectItem(at: indexPath, animated: animated, scrollPosition: position) } diff --git a/Nynja/Modules/TimeZoneSelector/View/TableView/TimeZoneCell.swift b/Nynja/Modules/TimeZoneSelector/View/TableView/TimeZoneCell.swift index 0b5875b02..aa1db6c0a 100644 --- a/Nynja/Modules/TimeZoneSelector/View/TableView/TimeZoneCell.swift +++ b/Nynja/Modules/TimeZoneSelector/View/TableView/TimeZoneCell.swift @@ -57,7 +57,7 @@ class TimeZoneCell: UITableViewCell { // MARK: - Init - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) baseSetup() } diff --git a/Nynja/Modules/VideoPreview/View/VideoPreviewViewController.swift b/Nynja/Modules/VideoPreview/View/VideoPreviewViewController.swift index 3f4e6dbca..c49857e4c 100644 --- a/Nynja/Modules/VideoPreview/View/VideoPreviewViewController.swift +++ b/Nynja/Modules/VideoPreview/View/VideoPreviewViewController.swift @@ -92,8 +92,8 @@ class VideoPreviewViewController: UIViewController, VideoPreviewViewProtocol { override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) - self.view.bringSubview(toFront: playButton) - self.view.bringSubview(toFront: nextButton) + self.view.bringSubviewToFront(playButton) + self.view.bringSubviewToFront(nextButton) } @objc func didFinishPlaying(notification: Notification) { diff --git a/Nynja/Modules/Wallet Flows/Payment/View/PaymentViewController.swift b/Nynja/Modules/Wallet Flows/Payment/View/PaymentViewController.swift index 2b0589301..6bf1fc6fd 100644 --- a/Nynja/Modules/Wallet Flows/Payment/View/PaymentViewController.swift +++ b/Nynja/Modules/Wallet Flows/Payment/View/PaymentViewController.swift @@ -34,7 +34,7 @@ UITableViewDataSource, TestableViewControllerProtocol { self.model = model tableView.reloadData() - view.bringSubview(toFront: sendButton) + view.bringSubviewToFront(sendButton) showAllViews() } @@ -255,7 +255,7 @@ extension PaymentViewController { } cell.backgroundColor = UIColor.nynja.clear - cell.selectionStyle = UITableViewCellSelectionStyle.none + cell.selectionStyle = UITableViewCell.SelectionStyle.none return cell } @@ -277,11 +277,13 @@ extension PaymentViewController { var edgeInsets: UIEdgeInsets { switch cellModel.type { - case .userData: return UIEdgeInsetsMake(0, - Constraints.tableView.separatorInset, - 0, - Constraints.tableView.separatorInset) - case .amount, .notes: return UIEdgeInsetsMake(0, cell.bounds.size.width, 0, 0) + case .userData: + return UIEdgeInsets(top: 0, + left: Constraints.tableView.separatorInset, + bottom: 0, + right: Constraints.tableView.separatorInset) + case .amount, .notes: + return UIEdgeInsets(top: 0, left: cell.bounds.size.width, bottom: 0, right: 0) } } diff --git a/Nynja/Modules/Wallet Flows/SeedBackup/View/SeedBackupWalletCollectionViewCell.swift b/Nynja/Modules/Wallet Flows/SeedBackup/View/SeedBackupWalletCollectionViewCell.swift index d2ddf75c9..1903b4583 100644 --- a/Nynja/Modules/Wallet Flows/SeedBackup/View/SeedBackupWalletCollectionViewCell.swift +++ b/Nynja/Modules/Wallet Flows/SeedBackup/View/SeedBackupWalletCollectionViewCell.swift @@ -87,9 +87,9 @@ final class SeedBackupWalletCollectionViewCell: UICollectionViewCell { return NSMutableAttributedString( string: text, - attributes: [NSAttributedStringKey.font: font, - NSAttributedStringKey.foregroundColor: UIColor.nynja.manatee, - NSAttributedStringKey.paragraphStyle: paragraphStyle]) + attributes: [.font: font, + .foregroundColor: UIColor.nynja.manatee, + .paragraphStyle: paragraphStyle]) } } @@ -119,16 +119,16 @@ private extension SeedBackupWalletCollectionViewCell { guard let font = Consts.font else { return nil } return NSMutableAttributedString( string: text, - attributes: [NSAttributedStringKey.font: font, - NSAttributedStringKey.foregroundColor: UIColor.nynja.manatee]) + attributes: [NSAttributedString.Key.font: font, + .foregroundColor: UIColor.nynja.manatee]) } func makeAttributedSeed(with text: String) -> NSAttributedString? { guard let font = Consts.font else { return nil } return NSMutableAttributedString( string: text, - attributes: [NSAttributedStringKey.font: font, - NSAttributedStringKey.foregroundColor: UIColor.white]) + attributes: [NSAttributedString.Key.font: font, + .foregroundColor: UIColor.white]) } } @@ -146,7 +146,7 @@ private extension SeedBackupWalletCollectionViewCell { static let lineFragmentPadding = CGFloat(0) static let height = CGFloat(32.adjustedByWidth) static let topInset = CGFloat(10.adjustedByWidth) - static let textContainerInset: UIEdgeInsets = UIEdgeInsetsMake(4, 16, 0, 0) + static let textContainerInset: UIEdgeInsets = UIEdgeInsets(top: 4, left: 16, bottom: 0, right: 0) } } } diff --git a/Nynja/Modules/Wallet Flows/SeedVerification/View/SeedVerificationWalletCollectionViewCell.swift b/Nynja/Modules/Wallet Flows/SeedVerification/View/SeedVerificationWalletCollectionViewCell.swift index 3ca5b0957..c1d78b34d 100644 --- a/Nynja/Modules/Wallet Flows/SeedVerification/View/SeedVerificationWalletCollectionViewCell.swift +++ b/Nynja/Modules/Wallet Flows/SeedVerification/View/SeedVerificationWalletCollectionViewCell.swift @@ -104,7 +104,7 @@ private extension SeedVerificationWalletCollectionViewCell { static let lineFragmentPadding = CGFloat(0) static let height = CGFloat(32.adjustedByWidth) static let topInset = CGFloat(7.adjustedByWidth) - static let textContainerInset: UIEdgeInsets = UIEdgeInsetsMake(4, 16, 0, 0) + static let textContainerInset: UIEdgeInsets = UIEdgeInsets(top: 4, left: 16, bottom: 0, right: 0) } enum wordTextField { diff --git a/Nynja/Modules/Wallet Flows/SeedVerification/View/SeedVerificationWalletViewController.swift b/Nynja/Modules/Wallet Flows/SeedVerification/View/SeedVerificationWalletViewController.swift index aa0144eee..303a9e496 100644 --- a/Nynja/Modules/Wallet Flows/SeedVerification/View/SeedVerificationWalletViewController.swift +++ b/Nynja/Modules/Wallet Flows/SeedVerification/View/SeedVerificationWalletViewController.swift @@ -167,7 +167,7 @@ TestableViewControllerProtocol, UICollectionViewDelegateFlowLayout { backButtonImage: UIImage.nynja.icBackNavigation.image)) collectionView.isHidden = false - view.bringSubview(toFront: nextButton) + view.bringSubviewToFront(nextButton) nextButton.isEnabled = false } } diff --git a/Nynja/Modules/Wallet Flows/TransferDetails/View/TransferDetailsViewController.swift b/Nynja/Modules/Wallet Flows/TransferDetails/View/TransferDetailsViewController.swift index 4a16c1147..50407d3bc 100644 --- a/Nynja/Modules/Wallet Flows/TransferDetails/View/TransferDetailsViewController.swift +++ b/Nynja/Modules/Wallet Flows/TransferDetails/View/TransferDetailsViewController.swift @@ -182,7 +182,7 @@ final class TransferDetailsViewController: BaseVC, TransferDetailsViewProtocol, textField.placeholder = String.localizable.walletNynjaAdress textField.isUserInteractionEnabled = false textField.rightView = UIImageView(image: UIImage.nynja.Messages.ContextMenu.icCopyContextMenu.image) - textField.rightViewMode = UITextFieldViewMode.always + textField.rightViewMode = .always textField.cursorColor = UIColor.nynja.white contentView.addSubview(textField) @@ -274,16 +274,9 @@ final class TransferDetailsViewController: BaseVC, TransferDetailsViewProtocol, navigationHandler: presenter, backButtonImage: UIImage.nynja.icBackNavigation.image)) - - nynBalanceLabel.setContentCompressionResistancePriority( - UILayoutPriority.defaultHigh, - for: UILayoutConstraintAxis.horizontal) - senderLabel.setContentCompressionResistancePriority( - UILayoutPriority.defaultLow, - for: UILayoutConstraintAxis.horizontal) - nameLabel.setContentCompressionResistancePriority( - UILayoutPriority.defaultLow, - for: UILayoutConstraintAxis.horizontal) + nynBalanceLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal) + senderLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) + nameLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) let nyn = NYNMoney(1000) @@ -426,8 +419,8 @@ private extension TransferDetailsViewController { return NSMutableAttributedString( string: text, attributes: [ - NSAttributedStringKey.font: font, - NSAttributedStringKey.foregroundColor: UIColor.nynja.manatee]) + .font: font, + .foregroundColor: UIColor.nynja.manatee]) } static func makeAttributedBody(text: String) -> NSAttributedString { @@ -435,12 +428,12 @@ private extension TransferDetailsViewController { return NSMutableAttributedString( string: text, attributes: [ - NSAttributedStringKey.font: font, - NSAttributedStringKey.foregroundColor: UIColor.nynja.manatee]) + .font: font, + .foregroundColor: UIColor.nynja.manatee]) } static let attributedNewLine: NSAttributedString = { let font = Consts.font - return NSMutableAttributedString(string: "\n", attributes: [NSAttributedStringKey.font: font]) + return NSMutableAttributedString(string: "\n", attributes: [.font: font]) }() } diff --git a/Nynja/Modules/Wallet Flows/TransferHistory/View/TransferHistoryCell.swift b/Nynja/Modules/Wallet Flows/TransferHistory/View/TransferHistoryCell.swift index 955a34b5c..2517acd50 100644 --- a/Nynja/Modules/Wallet Flows/TransferHistory/View/TransferHistoryCell.swift +++ b/Nynja/Modules/Wallet Flows/TransferHistory/View/TransferHistoryCell.swift @@ -16,7 +16,7 @@ final class TransferHistoryCell: UITableViewCell { // MARK: - Init - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) baseSetup() } diff --git a/Nynja/Modules/Wallet Flows/TransferHistory/View/TransferHistoryViewController.swift b/Nynja/Modules/Wallet Flows/TransferHistory/View/TransferHistoryViewController.swift index 42f39ecb7..c07f27cdc 100644 --- a/Nynja/Modules/Wallet Flows/TransferHistory/View/TransferHistoryViewController.swift +++ b/Nynja/Modules/Wallet Flows/TransferHistory/View/TransferHistoryViewController.swift @@ -88,10 +88,10 @@ TransferHistoryTableDataSourceOutputProtocol, TestableViewControllerProtocol { tableView.backgroundColor = .clear tableView.clipsToBounds = true tableView.separatorColor = UIColor.nynja.backgroundGray - tableView.separatorInset = UIEdgeInsetsMake(0, - Consts.tableView.separatorInset, - 0, - Consts.tableView.separatorInset) + tableView.separatorInset = UIEdgeInsets(top: 0, + left: Consts.tableView.separatorInset, + bottom: 0, + right: Consts.tableView.separatorInset) tableView.keyboardDismissMode = .onDrag tableView.separatorStyle = .singleLine diff --git a/Nynja/Modules/Wallet Flows/WalletBalances/View/WalletBalancesViewController.swift b/Nynja/Modules/Wallet Flows/WalletBalances/View/WalletBalancesViewController.swift index 2f22e5c65..c1e789f12 100644 --- a/Nynja/Modules/Wallet Flows/WalletBalances/View/WalletBalancesViewController.swift +++ b/Nynja/Modules/Wallet Flows/WalletBalances/View/WalletBalancesViewController.swift @@ -320,10 +320,10 @@ extension WalletBalancesViewController: UITableViewDelegate, UITableViewDataSour private extension WalletBalancesViewController { enum Consts { enum tableView { - static let separatorInset = UIEdgeInsetsMake(0, - CGFloat(16.adjustedByWidth), - 0, - CGFloat(16.adjustedByWidth)) + static let separatorInset = UIEdgeInsets(top: 0, + left: CGFloat(16.adjustedByWidth), + bottom: 0, + right: CGFloat(16.adjustedByWidth)) static let heightForHeaderInSection = CGFloat(64.adjustedByWidth) enum headerView { diff --git a/Nynja/Modules/Wallet Flows/WalletDetails/View/WalletDetailsViewController.swift b/Nynja/Modules/Wallet Flows/WalletDetails/View/WalletDetailsViewController.swift index 75a1022fe..5913a8aaf 100644 --- a/Nynja/Modules/Wallet Flows/WalletDetails/View/WalletDetailsViewController.swift +++ b/Nynja/Modules/Wallet Flows/WalletDetails/View/WalletDetailsViewController.swift @@ -121,7 +121,7 @@ final class WalletDetailsViewController: BaseVC, WalletDetailsViewProtocol, Test textField.placeholder = String.localizable.walletNynjaAdress textField.isUserInteractionEnabled = false textField.rightView = UIImageView(image: UIImage.nynja.Messages.ContextMenu.icCopyContextMenu.image) - textField.rightViewMode = UITextFieldViewMode.always + textField.rightViewMode = .always textField.cursorColor = UIColor.nynja.white view.addSubview(textField) diff --git a/Nynja/NotificationManager.swift b/Nynja/NotificationManager.swift index 36e12a720..f46d9fa37 100644 --- a/Nynja/NotificationManager.swift +++ b/Nynja/NotificationManager.swift @@ -89,7 +89,7 @@ final class NotificationManager { private var getMessageVC: MessageVC? { get { return ((UIApplication.shared.keyWindow?.rootViewController as? UINavigationController)? - .viewControllers.first?.childViewControllers.first as? UINavigationController)? + .viewControllers.first?.children.first as? UINavigationController)? .viewControllers.last as? MessageVC } } diff --git a/Nynja/Notifications/AppNotificationsProviding/AppNotificationsProvider.swift b/Nynja/Notifications/AppNotificationsProviding/AppNotificationsProvider.swift index c1c12c633..02f17cc70 100644 --- a/Nynja/Notifications/AppNotificationsProviding/AppNotificationsProvider.swift +++ b/Nynja/Notifications/AppNotificationsProviding/AppNotificationsProvider.swift @@ -20,12 +20,12 @@ class AppNotificationsProvider: AppNotificationsProviding { notificationCenter.addObserver( self, selector: #selector(didEnterBackground), - name: .UIApplicationDidEnterBackground, + name: UIApplication.didEnterBackgroundNotification, object: nil) notificationCenter.addObserver( self, selector: #selector(willEnterForeground), - name: .UIApplicationWillEnterForeground, + name: UIApplication.willEnterForegroundNotification, object: nil) } diff --git a/Nynja/PermissionManager.swift b/Nynja/PermissionManager.swift index 07202fd1e..ed70fc709 100644 --- a/Nynja/PermissionManager.swift +++ b/Nynja/PermissionManager.swift @@ -38,7 +38,7 @@ class PermissionManager: NSObject { fileprivate var permissionManager: PermissionManager? var isMicrophoneGranted: Bool { - return AVAudioSession.sharedInstance().recordPermission() == AVAudioSessionRecordPermission.granted + return AVAudioSession.sharedInstance().recordPermission == .granted } func requestCameraPermission(with completion:PermissionCompletion?) { @@ -109,19 +109,19 @@ class PermissionManager: NSObject { func requestMicrophonePermission(with completion: PermissionCompletion?) { let session = AVAudioSession.sharedInstance() - let status = session.recordPermission() + let status = session.recordPermission switch status { - case AVAudioSessionRecordPermission.granted: + case .granted: dispatchAsyncMain { completion?(.authorized) } - case AVAudioSessionRecordPermission.denied: + case .denied: dispatchAsyncMain { AlertManager.sharedInstance.showAlertAllowPermission(resourceName: "microphone") completion?(.notAuthorized) } - case AVAudioSessionRecordPermission.undetermined: + case .undetermined: session.requestRecordPermission { (result) in dispatchAsyncMain { let authorizationStatis: AuthorizationStatus = result ? .authorized : .notAuthorized diff --git a/Nynja/Services/Audio/AudioManager/AudioManager.swift b/Nynja/Services/Audio/AudioManager/AudioManager.swift index a7d339feb..ba7896c22 100644 --- a/Nynja/Services/Audio/AudioManager/AudioManager.swift +++ b/Nynja/Services/Audio/AudioManager/AudioManager.swift @@ -149,7 +149,7 @@ final class AudioManager: NSObject, AVAudioPlayerDelegate { selector: #selector(updateProgress(_:)), userInfo: nil, repeats: true) - RunLoop.current.add(timer, forMode: .commonModes) + RunLoop.current.add(timer, forMode: .common) progressTimer = timer } diff --git a/Nynja/Services/Audio/AudioRecorder/AudioRecorder.swift b/Nynja/Services/Audio/AudioRecorder/AudioRecorder.swift index 4d3afff43..ee381a087 100644 --- a/Nynja/Services/Audio/AudioRecorder/AudioRecorder.swift +++ b/Nynja/Services/Audio/AudioRecorder/AudioRecorder.swift @@ -84,7 +84,7 @@ final class AudioRecorder: NSObject { return true } catch { - if let errorCode = AVAudioSessionErrorCode(rawValue: (error as NSError).code) { + if let errorCode = AVAudioSession.ErrorCode(rawValue: (error as NSError).code) { LogService.log(topic: .audioSystem) { return "AVSession error: \(errorCode)" } if errorCode == .insufficientPriority { diff --git a/Nynja/Services/Audio/AudioSessionManager/AudioSessionManager.swift b/Nynja/Services/Audio/AudioSessionManager/AudioSessionManager.swift index 3ec40b652..12a4aa5b7 100644 --- a/Nynja/Services/Audio/AudioSessionManager/AudioSessionManager.swift +++ b/Nynja/Services/Audio/AudioSessionManager/AudioSessionManager.swift @@ -56,7 +56,7 @@ final class AudioSessionManager { attributes: .concurrent) private var currentCategory: Category? { - return Category(string: session.category) + return Category(nativeCategory: session.category) } private let notificationCenter = NotificationCenter.default @@ -70,7 +70,7 @@ final class AudioSessionManager { notificationCenter.addObserver( self, selector: #selector(audioSessionRouteChange(notification:)), - name: .AVAudioSessionRouteChange, + name: AVAudioSession.routeChangeNotification, object: nil) } @@ -88,8 +88,7 @@ final class AudioSessionManager { } private func _configureDefaultSession() throws { - try session.setCategory(Category.default.nativeCategory) - try session.setMode(AVAudioSessionModeDefault) + try session.setCategory(Category.default.nativeCategory, mode: AVAudioSession.Mode.default) } @@ -98,32 +97,32 @@ final class AudioSessionManager { func resetAudioSession() throws { try dispatchQueue.sync { try _configureDefaultSession() - try session.setActive(false, with: .notifyOthersOnDeactivation) + try session.setActive(false, options: .notifyOthersOnDeactivation) } } // MARK: - Category Options - var categoryOptions: AVAudioSessionCategoryOptions { + var categoryOptions: AVAudioSession.CategoryOptions { return session.categoryOptions } - func addCategoryOptions(_ options: AVAudioSessionCategoryOptions, applyImmediately: Bool = false) throws { + func addCategoryOptions(_ options: AVAudioSession.CategoryOptions, applyImmediately: Bool = false) throws { try dispatchQueue.sync { let newOptions = session.categoryOptions.union(options) try setCategoryOptions(newOptions, applyImmidiately: applyImmediately) } } - func removeCategoryOptions(_ options: AVAudioSessionCategoryOptions, applyImmediately: Bool = false) throws { + func removeCategoryOptions(_ options: AVAudioSession.CategoryOptions, applyImmediately: Bool = false) throws { try dispatchQueue.sync { let newOptions = session.categoryOptions.subtracting(options) try setCategoryOptions(newOptions, applyImmidiately: applyImmediately) } } - private func setCategoryOptions(_ options: AVAudioSessionCategoryOptions, applyImmidiately: Bool) throws { + private func setCategoryOptions(_ options: AVAudioSession.CategoryOptions, applyImmidiately: Bool) throws { if applyImmidiately { try session.setActive(false) } @@ -141,15 +140,15 @@ final class AudioSessionManager { // MARK: - Record permission var isRecordPermissionGranted: Bool { - return session.recordPermission() == .granted + return session.recordPermission == .granted } // MARK: - Set Active/Inactive - func setActive(_ isActive: Bool, with options: AVAudioSessionSetActiveOptions = []) throws { + func setActive(_ isActive: Bool, with options: AVAudioSession.SetActiveOptions = []) throws { try dispatchQueue.sync { - try session.setActive(isActive, with: options) + try session.setActive(isActive, options: options) } } @@ -159,7 +158,7 @@ final class AudioSessionManager { @objc private func audioSessionRouteChange(notification: Notification) { guard let userInfo = notification.userInfo, let reasonValue = userInfo[AVAudioSessionRouteChangeReasonKey] as? UInt, - let reason = AVAudioSessionRouteChangeReason(rawValue:reasonValue) else { + let reason = AVAudioSession.RouteChangeReason(rawValue:reasonValue) else { return } @@ -195,20 +194,20 @@ extension AudioSessionManager { case playback case playAndRecord - var nativeCategory: String { + var nativeCategory: AVAudioSession.Category { switch self { case .playback: - return AVAudioSessionCategoryPlayback + return .playback case .playAndRecord: - return AVAudioSessionCategoryPlayAndRecord + return .playAndRecord } } - init?(string: String) { - switch string { - case AVAudioSessionCategoryPlayback: + init?(nativeCategory: AVAudioSession.Category) { + switch nativeCategory { + case .playback: self = .playback - case AVAudioSessionCategoryPlayAndRecord: + case .playAndRecord: self = .playAndRecord default: // Just ignore other categories at now. @@ -240,7 +239,7 @@ extension AudioSessionManager { private func tryAdjustSpeaker(with speaker: Speaker) -> Bool { switch speaker { case .soft, .loud: - let port: AVAudioSessionPortOverride = speaker == .soft ? .none : .speaker + let port: AVAudioSession.PortOverride = speaker == .soft ? .none : .speaker do { try session.overrideOutputAudioPort(port) @@ -257,7 +256,7 @@ extension AudioSessionManager { private var activeSpeaker: Speaker { let isSpeakerActivated = session.currentRoute.outputs - .first { $0.portType == AVAudioSessionPortBuiltInSpeaker } != nil + .first { $0.portType == AVAudioSession.Port.builtInSpeaker } != nil return isSpeakerActivated ? .loud : .soft } diff --git a/Nynja/Services/CameraSettingsService/CameraSettingsService.swift b/Nynja/Services/CameraSettingsService/CameraSettingsService.swift index 4442752e4..e5a359c84 100644 --- a/Nynja/Services/CameraSettingsService/CameraSettingsService.swift +++ b/Nynja/Services/CameraSettingsService/CameraSettingsService.swift @@ -10,8 +10,8 @@ import UIKit import AVFoundation protocol CameraSettingsServiceProtocol { - func availableDevices() -> [UIImagePickerControllerCameraDevice] - func availableCameraCaptureMode() -> [UIImagePickerControllerCameraCaptureMode] + func availableDevices() -> [UIImagePickerController.CameraDevice] + func availableCameraCaptureMode() -> [UIImagePickerController.CameraCaptureMode] func availableVideoQualities() -> [VideoQuality] func availablePhotoQualities() -> [PhotoQuality] func settings() throws -> CameraSettings @@ -34,11 +34,11 @@ final class CameraSettingsService: CameraSettingsServiceProtocol { } extension CameraSettingsService { - func availableDevices() -> [UIImagePickerControllerCameraDevice] { + func availableDevices() -> [UIImagePickerController.CameraDevice] { return [.front, .rear] } - func availableCameraCaptureMode() -> [UIImagePickerControllerCameraCaptureMode] { + func availableCameraCaptureMode() -> [UIImagePickerController.CameraCaptureMode] { switch sourceFlow { case .cameraFlow: return [.photo, .video] case .avatar: return [.photo] diff --git a/Nynja/Services/Debug/MotionManager/MotionManager.swift b/Nynja/Services/Debug/MotionManager/MotionManager.swift index b0829e81e..f9621475c 100644 --- a/Nynja/Services/Debug/MotionManager/MotionManager.swift +++ b/Nynja/Services/Debug/MotionManager/MotionManager.swift @@ -39,7 +39,7 @@ class MotionManager { self.updates(ax: self.motion.accelerometerData, g: self.motion.gyroData) } - RunLoop.current.add(self.timer!, forMode: .defaultRunLoopMode) + RunLoop.current.add(self.timer!, forMode: .default) #endif } diff --git a/Nynja/Services/PushService.swift b/Nynja/Services/PushService.swift index 90d4f9069..5c5e958b6 100644 --- a/Nynja/Services/PushService.swift +++ b/Nynja/Services/PushService.swift @@ -281,7 +281,8 @@ final class PushService: NSObject, PKPushRegistryDelegate, UserSettingsRespondab content.body = title content.userInfo = data if let _sound = sound { - content.sound = UNNotificationSound(named: _sound) + let soundName = UNNotificationSoundName(rawValue: _sound) + content.sound = UNNotificationSound(named: soundName) } let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 1, repeats: false) diff --git a/Nynja/Services/ResourceManager/ResourceManager.swift b/Nynja/Services/ResourceManager/ResourceManager.swift index 86d657da9..adfb496a1 100644 --- a/Nynja/Services/ResourceManager/ResourceManager.swift +++ b/Nynja/Services/ResourceManager/ResourceManager.swift @@ -100,7 +100,7 @@ extension ResourceManager { func savePhotoAsFile(image: UIImage, setting: PhotoQuality) -> URL? { let updatedImage = image.fixedOrientation().scale(CGFloat(setting.resolutionScale)) let url = prepareUrl() - let data = UIImageJPEGRepresentation(updatedImage, 1) + let data = updatedImage.jpegData(compressionQuality: 1.0) do { try saveData(data: data, to: url) diff --git a/Nynja/ThumbnailGenerator.swift b/Nynja/ThumbnailGenerator.swift index 7676c5310..e4a1b536e 100644 --- a/Nynja/ThumbnailGenerator.swift +++ b/Nynja/ThumbnailGenerator.swift @@ -90,8 +90,9 @@ class ThumbnailGenerator { let writeUrl = URL(fileURLWithPath: writePath) FileManagerService.sharedInstance.createDirectory(folder: folder) - try UIImageJPEGRepresentation(image, 1)!.write(to: writeUrl, options: .atomic) + + try image.jpegData(compressionQuality: 1.0)!.write(to: writeUrl, options: .atomic) + return writeUrl } - } diff --git a/Nynja/Utils/ImagePickerHandler.swift b/Nynja/Utils/ImagePickerHandler.swift index 31689628d..e8d237a99 100644 --- a/Nynja/Utils/ImagePickerHandler.swift +++ b/Nynja/Utils/ImagePickerHandler.swift @@ -17,10 +17,10 @@ public final class ImagePickerHandler: NSObject, UIImagePickerControllerDelegate case `default` case asFile - static let key = "SendingType" +// static let key = "SendingType" } - public var onFinishPickingMedia: ((UIImagePickerController, [String : Any]) -> Void)? + public var onFinishPickingMedia: ((UIImagePickerController, [UIImagePickerController.InfoKey : Any]) -> Void)? public var onCancel: ((UIImagePickerController) -> Void)? public var onStartRecordingVideo: (() -> Void)? @@ -29,7 +29,8 @@ public final class ImagePickerHandler: NSObject, UIImagePickerControllerDelegate // MARK: - UIImagePickerControllerDelegate - public func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { + public func imagePickerController(_ picker: UIImagePickerController, + didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { onFinishPickingMedia?(picker, info) } diff --git a/Podfile.lock b/Podfile.lock index 330199dfe..839be3a78 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -183,6 +183,6 @@ SPEC CHECKSUMS: SwiftyTimer: 2efd74b060d69ad4f1496baf5bbedbe132125fcf TestFairy: 842f8ddc45477b208eb85326b0418047b40f7137 -PODFILE CHECKSUM: 01080340b078e299ca510440c83ee5b20671cd13 +PODFILE CHECKSUM: f206ab413c7bb2af1ba8a5ce0e66489b21851a6f COCOAPODS: 1.5.3 -- GitLab From 52a1444e0588828df435fcfbbf75fd483e90059f Mon Sep 17 00:00:00 2001 From: Anton Poltoratskyi Date: Thu, 1 Nov 2018 00:54:41 +0200 Subject: [PATCH 02/27] [NY-4362] Setup Swift 4.2 version in NynjaUIKit. Remove unused build configurations from NynjaUIKit. --- .../NynjaUIKit.xcodeproj/project.pbxproj | 184 +----------------- 1 file changed, 7 insertions(+), 177 deletions(-) diff --git a/Frameworks/NynjaUIKit/NynjaUIKit.xcodeproj/project.pbxproj b/Frameworks/NynjaUIKit/NynjaUIKit.xcodeproj/project.pbxproj index f64833620..16bf3da26 100644 --- a/Frameworks/NynjaUIKit/NynjaUIKit.xcodeproj/project.pbxproj +++ b/Frameworks/NynjaUIKit/NynjaUIKit.xcodeproj/project.pbxproj @@ -485,7 +485,8 @@ MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.2; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -571,6 +572,7 @@ SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_VERSION = 4.2; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -656,6 +658,7 @@ SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_VERSION = 4.2; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -741,6 +744,7 @@ SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_VERSION = 4.2; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -774,176 +778,6 @@ }; name = DevAutoTests; }; - 85631BF620EFC7EA0002BE51 /* Channels */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = C90742AD8E6E2E817F7DB1E9 /* Pods-NynjaUIKit.channels.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Channels; - }; - 85631BF720EFC7EA0002BE51 /* Channels */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = C90742AD8E6E2E817F7DB1E9 /* Pods-NynjaUIKit.channels.xcconfig */; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - CODE_SIGN_STYLE = Manual; - DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = ""; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = NynjaUIKit/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.nynja.mobile.communicator.NynjaUIKit; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Channels; - }; - 85631BFC20EFC95E0002BE51 /* Translate */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 1820AD65D6897E3E306C16A2 /* Pods-NynjaUIKit.translate.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Translate; - }; - 85631BFD20EFC95E0002BE51 /* Translate */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 1820AD65D6897E3E306C16A2 /* Pods-NynjaUIKit.translate.xcconfig */; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - CODE_SIGN_STYLE = Manual; - DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = ""; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = NynjaUIKit/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.nynja.mobile.communicator.NynjaUIKit; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Translate; - }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -951,27 +785,23 @@ isa = XCConfigurationList; buildConfigurations = ( 8514D4C820EE27080002378A /* Dev */, - 85631BFC20EFC95E0002BE51 /* Translate */, - 85631BF620EFC7EA0002BE51 /* Channels */, 85631BF220EFC50F0002BE51 /* DevAutoTests */, 85631BF020EFC4FC0002BE51 /* Release */, 85631BEE20EFC4F30002BE51 /* Prerelease */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Dev; + defaultConfigurationName = Release; }; 8514D4C920EE27080002378A /* Build configuration list for PBXNativeTarget "NynjaUIKit" */ = { isa = XCConfigurationList; buildConfigurations = ( 8514D4CB20EE27080002378A /* Dev */, - 85631BFD20EFC95E0002BE51 /* Translate */, - 85631BF720EFC7EA0002BE51 /* Channels */, 85631BF320EFC50F0002BE51 /* DevAutoTests */, 85631BF120EFC4FC0002BE51 /* Release */, 85631BEF20EFC4F30002BE51 /* Prerelease */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Dev; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; -- GitLab From aa6a21f41a8539db314d266e907320bf48982e42 Mon Sep 17 00:00:00 2001 From: Anton Poltoratskyi Date: Thu, 1 Nov 2018 01:03:32 +0200 Subject: [PATCH 03/27] [NY-4362] Update Swift compiler optimization levels for Prerelease and Release --- Nynja.xcodeproj/project.pbxproj | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Nynja.xcodeproj/project.pbxproj b/Nynja.xcodeproj/project.pbxproj index fafc9fc40..cec9ec159 100644 --- a/Nynja.xcodeproj/project.pbxproj +++ b/Nynja.xcodeproj/project.pbxproj @@ -16808,8 +16808,7 @@ PROVISIONING_PROFILE = "2a318f9e-d0ab-41dc-968a-e1cb13de4de5"; PROVISIONING_PROFILE_SPECIFIER = ProductionBundle_AppstoreExt; SKIP_INSTALL = YES; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -16923,7 +16922,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 10.3; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_OPTIMIZATION_LEVEL = "-O"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_WHOLE_MODULE_OPTIMIZATION = YES; TARGETED_DEVICE_FAMILY = "1,2"; @@ -16986,9 +16985,8 @@ PROVISIONING_PROFILE = "1971b115-2b2c-48b6-a20f-3686249e0a88"; PROVISIONING_PROFILE_SPECIFIER = ProductionBundle_Appstore; SWIFT_ACTIVE_COMPILATION_CONDITIONS = RELEASE; - SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OBJC_BRIDGING_HEADER = "Nynja-Bridging-Header.h"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_VERSION = 4.2; SWIFT_WHOLE_MODULE_OPTIMIZATION = YES; @@ -17238,7 +17236,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_OPTIMIZATION_LEVEL = "-O"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_WHOLE_MODULE_OPTIMIZATION = YES; TARGETED_DEVICE_FAMILY = "1,2"; @@ -17270,7 +17268,7 @@ PROVISIONING_PROFILE_SPECIFIER = NynjaRC_adhoc; SWIFT_ACTIVE_COMPILATION_CONDITIONS = RELEASE; SWIFT_OBJC_BRIDGING_HEADER = "Nynja-Bridging-Header.h"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_OPTIMIZATION_LEVEL = "-O"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_VERSION = 4.2; SWIFT_WHOLE_MODULE_OPTIMIZATION = YES; @@ -17302,7 +17300,7 @@ PROVISIONING_PROFILE_SPECIFIER = NynjaRC_adhocExt; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = RELEASE; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_OPTIMIZATION_LEVEL = "-O"; SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; -- GitLab From 8fdc4fe49b1841cc27692273c4ef2ae4c3032a39 Mon Sep 17 00:00:00 2001 From: Anton Poltoratskyi Date: Thu, 1 Nov 2018 02:00:58 +0200 Subject: [PATCH 04/27] [NY-4362] Remove some of project warnings --- .../AttachmentProvider.swift | 3 +- Nynja/ChatBaseFactory.swift | 2 +- Nynja/DB/Models/DBJobMessage.swift | 6 ++-- Nynja/FileManager.swift | 2 +- Nynja/KeychainService/KeychainService.swift | 4 --- Nynja/Library/Reachability.swift | 2 +- .../Cells/ContextMenuItemCell.swift | 2 +- .../Extensions/String/StringExtensions.swift | 35 +++---------------- .../UI/ItemSelector/ItemSelectorCell.swift | 2 +- .../UI/TextInput/InputField/PhoneField.swift | 2 +- .../View/LoginWheelContainerDataSource.swift | 1 - .../WireFrame/GroupStorageWireframe.swift | 1 + .../WireFrame/GroupsListWireframe.swift | 4 --- .../Presenter/LanguageSelectorPresenter.swift | 2 +- .../MessageInteractor+Translation.swift | 2 +- .../ChatCells/BaseChatCell/BaseChatCell.swift | 4 +-- .../BaseChatCell/OponentChatCell.swift | 2 +- .../Views/Message/MessageForwardView.swift | 2 +- .../Cells/Views/Message/MessageTextView.swift | 3 -- Nynja/Modules/Replies/RepliesProtocols.swift | 2 +- .../View/ScheduleMessageViewController.swift | 2 +- .../Splash/WireFrame/SplashWireframe.swift | 2 +- Nynja/NotificationManager.swift | 1 - Nynja/ProgressModel.swift | 3 +- Nynja/ServerModel/Source/Bert.swift | 12 +++---- .../CameraSettingsService.swift | 3 +- .../Debug/MotionManager/MotionManager.swift | 2 +- .../SMSCodeProvider/SMSCodeProvider.swift | 2 +- Nynja/Services/MQTT/MQTTService.swift | 2 +- Nynja/Services/PushService.swift | 8 ++--- Nynja/Services/StorageService.swift | 2 +- 31 files changed, 41 insertions(+), 81 deletions(-) diff --git a/Nynja-Share/Services/AttachmentProvider/AttachmentProvider.swift b/Nynja-Share/Services/AttachmentProvider/AttachmentProvider.swift index 4280fc970..3890c67c1 100644 --- a/Nynja-Share/Services/AttachmentProvider/AttachmentProvider.swift +++ b/Nynja-Share/Services/AttachmentProvider/AttachmentProvider.swift @@ -30,8 +30,7 @@ final class AttachmentProvider: AttachmentProviding, InitializeInjectable { let supportedAttachments: [Attachment.Kind] = Attachment.Kind.allValues func attachment(from context: NSExtensionContext, completion: @escaping AttachmentProvidingCompletion) { - guard let item = context.inputItems.first as? NSExtensionItem, - let providers = item.attachments as? [NSItemProvider] else { + guard let item = context.inputItems.first as? NSExtensionItem, let providers = item.attachments else { completion(nil) return } diff --git a/Nynja/ChatBaseFactory.swift b/Nynja/ChatBaseFactory.swift index c3ed69701..4049283f3 100644 --- a/Nynja/ChatBaseFactory.swift +++ b/Nynja/ChatBaseFactory.swift @@ -15,7 +15,7 @@ class ChatBaseFactory: ChatItemsFactory { self.isActionsEnabled = isActionsEnabled } - override required init() { + required init() { super.init() } diff --git a/Nynja/DB/Models/DBJobMessage.swift b/Nynja/DB/Models/DBJobMessage.swift index 705505d31..440b88796 100644 --- a/Nynja/DB/Models/DBJobMessage.swift +++ b/Nynja/DB/Models/DBJobMessage.swift @@ -154,10 +154,8 @@ final class DBJobMessage: Record, DBModelProtocol { if let id = self.id { try self.files.forEach { desc in - if desc.serverId != nil { - desc.targetId = "\(id)" - try desc.saveAggregate(db) //save desc - } + desc.targetId = "\(id)" + try desc.saveAggregate(db) } } } diff --git a/Nynja/FileManager.swift b/Nynja/FileManager.swift index cdec76d9a..9b7e7378d 100644 --- a/Nynja/FileManager.swift +++ b/Nynja/FileManager.swift @@ -136,7 +136,7 @@ class FileManagerService { var total: UInt64 = 0 - for (index, object) in directoryEnumerator.enumerated() { + for (_, object) in directoryEnumerator.enumerated() { guard let fileURL = object as? NSURL else { throw FileErrors.BadResource } var fileSizeResource: AnyObject? try fileURL.getResourceValue(&fileSizeResource, forKey: URLResourceKey.fileSizeKey) diff --git a/Nynja/KeychainService/KeychainService.swift b/Nynja/KeychainService/KeychainService.swift index 2928f1e7b..abe758078 100644 --- a/Nynja/KeychainService/KeychainService.swift +++ b/Nynja/KeychainService/KeychainService.swift @@ -100,10 +100,6 @@ final class KeychainService { let isSuccess = deleteResult == errSecSuccess || deleteResult == errSecItemNotFound return partial && isSuccess } - - defer { - LogService.log(topic: .keychain) { return "Wipe keychain" } - } } } diff --git a/Nynja/Library/Reachability.swift b/Nynja/Library/Reachability.swift index 1442658fb..b6d835825 100644 --- a/Nynja/Library/Reachability.swift +++ b/Nynja/Library/Reachability.swift @@ -43,7 +43,7 @@ class Reachability { isRunningOnDevice ? .wwan : .unreachable } var isRunningOnDevice: Bool = { - #if (arch(i386) || arch(x86_64)) && os(iOS) + #if targetEnvironment(simulator) return false #else return true diff --git a/Nynja/Library/UI/ContextMenuOLD/Cells/ContextMenuItemCell.swift b/Nynja/Library/UI/ContextMenuOLD/Cells/ContextMenuItemCell.swift index f06370519..a63f9bfc6 100644 --- a/Nynja/Library/UI/ContextMenuOLD/Cells/ContextMenuItemCell.swift +++ b/Nynja/Library/UI/ContextMenuOLD/Cells/ContextMenuItemCell.swift @@ -96,7 +96,7 @@ class ContextMenuItemCell : UICollectionViewCell { // MARK: Constants struct CellConstants { - static let font = UIFont.init(name: FontFamily.NotoSans.regular.name, size: 16) + static let font = UIFont.init(name: FontFamily.NotoSans.regular.name, size: 16)! static let horizontalCellBorder:CGFloat = 6 static let verticalCellBorder:CGFloat = 4 } diff --git a/Nynja/Library/UI/Extensions/String/StringExtensions.swift b/Nynja/Library/UI/Extensions/String/StringExtensions.swift index 12b76b10d..7cea05250 100644 --- a/Nynja/Library/UI/Extensions/String/StringExtensions.swift +++ b/Nynja/Library/UI/Extensions/String/StringExtensions.swift @@ -62,41 +62,16 @@ extension String { return fontSize } - - var pairs: [String] { - var result: [String] = [] - let characters = Array(self.characters) - stride(from: 0, to: characters.count, by: 2).forEach { - result.append(String(characters[$0.. String { - var result: String = "" - let characters = Array(self.characters) - stride(from: 0, to: characters.count, by: n).forEach { - result += String(characters[$0.. Bool { if textField == code { - let modificatedText = (textField.text as? NSString)?.replacingCharacters(in: range, with: string) + let modificatedText = (textField.text as NSString?)?.replacingCharacters(in: range, with: string) let before = !string.isEmpty ? textField.text : modificatedText let value = self.updatedCode(textField,shouldChangeCharactersIn:range,replacementString:string) let after = !string.isEmpty ? modificatedText :textField.text diff --git a/Nynja/Modules/Auth/Login/View/LoginWheelContainerDataSource.swift b/Nynja/Modules/Auth/Login/View/LoginWheelContainerDataSource.swift index ce1f7fdfb..725fcd232 100644 --- a/Nynja/Modules/Auth/Login/View/LoginWheelContainerDataSource.swift +++ b/Nynja/Modules/Auth/Login/View/LoginWheelContainerDataSource.swift @@ -127,7 +127,6 @@ extension LoginWheelContainerDataSource: WheelContainerDataSource { } func wheelContainer(_ container: WheelContainer, itemViewAt indexPath: IndexPath, reusing view: UIView?) -> WheelItemView? { - let frame = CGRect(origin: CGPoint.zero, size: configuration.sectorSize) let itemModel = countryModels[indexPath.item] let itemView = reusableViews.getItem(index: indexPath.item) itemView.update(model: itemModel) diff --git a/Nynja/Modules/GroupStorage/WireFrame/GroupStorageWireframe.swift b/Nynja/Modules/GroupStorage/WireFrame/GroupStorageWireframe.swift index f6b69ef67..9a18f9b9f 100644 --- a/Nynja/Modules/GroupStorage/WireFrame/GroupStorageWireframe.swift +++ b/Nynja/Modules/GroupStorage/WireFrame/GroupStorageWireframe.swift @@ -54,6 +54,7 @@ class GroupStorageWireFrame: GroupStorageWireFrameProtocol { func openLink(link: URL) { UIApplication.shared.openURL(link) } + func openMessage(id: String) { for i in 0..<(self.navigation?.viewControllers.count ?? 0) { if let messageVC = self.navigation?.viewControllers[i] as? MessageVC { diff --git a/Nynja/Modules/GroupsList/WireFrame/GroupsListWireframe.swift b/Nynja/Modules/GroupsList/WireFrame/GroupsListWireframe.swift index 3db6d4df5..8851cc245 100644 --- a/Nynja/Modules/GroupsList/WireFrame/GroupsListWireframe.swift +++ b/Nynja/Modules/GroupsList/WireFrame/GroupsListWireframe.swift @@ -17,10 +17,6 @@ class GroupsListWireFrame: GroupsListWireFrameProtocol { self.navigation = navigation self.main = main - // Dependencies - let conversationsProvider = ConversationsProvider() - - // Compomentes let view = GroupsListViewController() let presenter = GroupsListPresenter() diff --git a/Nynja/Modules/LanguageSettings/LanguageSelector/Presenter/LanguageSelectorPresenter.swift b/Nynja/Modules/LanguageSettings/LanguageSelector/Presenter/LanguageSelectorPresenter.swift index 50e26a802..1869a5070 100644 --- a/Nynja/Modules/LanguageSettings/LanguageSelector/Presenter/LanguageSelectorPresenter.swift +++ b/Nynja/Modules/LanguageSettings/LanguageSelector/Presenter/LanguageSelectorPresenter.swift @@ -110,7 +110,7 @@ class LanguageSelectorPresenter: BasePresenter, LanguageSelectorPresenterProtoco private func prepareLanguagesToShow(_ languages: [LangExtended]) -> GroupOfLangCellViewModels { var groupedLanguages = languages.map { LangCellViewModel(lang: $0, isSelected: $0.language == currentLang) }.groupedByName() if isNoneAvailable { - var isSelectedNone = selectedLang == nil ? true : false + var isSelectedNone = false if case .lang(let language) = selectedLang { isSelectedNone = language.language == LanguageSettingConstants.languageNone ? true : isSelectedNone } diff --git a/Nynja/Modules/Message/Interactor/MessageInteractor+Translation.swift b/Nynja/Modules/Message/Interactor/MessageInteractor+Translation.swift index 70c4d3e25..5c571fe49 100644 --- a/Nynja/Modules/Message/Interactor/MessageInteractor+Translation.swift +++ b/Nynja/Modules/Message/Interactor/MessageInteractor+Translation.swift @@ -104,7 +104,7 @@ extension MessageInteractor { let text = "@\(mentionInfo.alias)" translatedText.insert(contentsOf: text, at: keyRange.lowerBound) - let attrRange = Range(keyRange.utf16Encoded.lowerBound..Void)?) func hide(completion: (()->())?) diff --git a/Nynja/Modules/ScheduleMessage/View/ScheduleMessageViewController.swift b/Nynja/Modules/ScheduleMessage/View/ScheduleMessageViewController.swift index c74ed542c..4f692ec75 100644 --- a/Nynja/Modules/ScheduleMessage/View/ScheduleMessageViewController.swift +++ b/Nynja/Modules/ScheduleMessage/View/ScheduleMessageViewController.swift @@ -262,7 +262,7 @@ final class ScheduleMessageViewController: BaseVC, ScheduleMessageViewProtocol, audioModel = model let audioItemView = AudioItemView( dependencies: .init( - canInteractionHandler: { [weak self] in + canInteractionHandler: { return true }, changeStateHandler: { [weak self] state in diff --git a/Nynja/Modules/Splash/WireFrame/SplashWireframe.swift b/Nynja/Modules/Splash/WireFrame/SplashWireframe.swift index decce3312..bb0813ff5 100644 --- a/Nynja/Modules/Splash/WireFrame/SplashWireframe.swift +++ b/Nynja/Modules/Splash/WireFrame/SplashWireframe.swift @@ -42,7 +42,7 @@ class SplashWireFrame: SplashWireFrameProtocol { } func showEditProfile(roster: Roster) { - guard let contact = roster.myContact else { + guard roster.myContact != nil else { assertionFailure("Contact should exist!") return } diff --git a/Nynja/NotificationManager.swift b/Nynja/NotificationManager.swift index f46d9fa37..c8a327032 100644 --- a/Nynja/NotificationManager.swift +++ b/Nynja/NotificationManager.swift @@ -154,7 +154,6 @@ final class NotificationManager { navigateToHistory(presenter: presenter) case .friend(let requestType): navigateToFriend(presenter: presenter, requestType: requestType) - default: break } } diff --git a/Nynja/ProgressModel.swift b/Nynja/ProgressModel.swift index dbee7ce84..79e1c14e0 100644 --- a/Nynja/ProgressModel.swift +++ b/Nynja/ProgressModel.swift @@ -40,9 +40,8 @@ class ProgressModel { } var description: String { - return " url: \(url)\n progress:\(progress)\n status:\(status)\n result:\(result)\n" + return " url: \(url)\n progress:\(progress)\n status:\(status)\n result:\(String(describing: result))\n" } - } extension ProgressModel: SpeedStringRepresentable { diff --git a/Nynja/ServerModel/Source/Bert.swift b/Nynja/ServerModel/Source/Bert.swift index 7feae1b0e..b92543011 100644 --- a/Nynja/ServerModel/Source/Bert.swift +++ b/Nynja/ServerModel/Source/Bert.swift @@ -245,7 +245,7 @@ class Bert { return 1 + 2 + 9 case "BertAtom": let atom = (object as! BertAtom) - return 1 + 2 + atom.value.characters.count + return 1 + 2 + atom.value.count case "BertBinary": let binary = (object as! BertBinary) return 1 + 4 + binary.value.length @@ -265,7 +265,7 @@ class Bert { case "BertString": // TODO: implement encoding for length > 0xFF let string = (object as! BertString) - return 1 + 2 + string.value.characters.count + return 1 + 2 + string.value.count case "BertTuple": let tuple = (object as! BertTuple) var n = 0 @@ -303,7 +303,7 @@ class Bert { } class func encodeAtom(atom: BertAtom, data: inout [UInt8], offset: inout Int) { - let length = UInt16(atom.value.characters.count) + let length = UInt16(atom.value.count) data[offset] = BertType.Atom.rawValue offset += 1 writeUInt16(i: length, data: &data, offset: &offset) @@ -392,10 +392,10 @@ class Bert { class func encodeString(string: BertString, data: inout [UInt8], offset: inout Int) { data[offset] = BertType.String.rawValue offset += 1 - writeUInt16(i: UInt16(string.value.characters.count), data: &data, offset: &offset) + writeUInt16(i: UInt16(string.value.count), data: &data, offset: &offset) - memcpy(&data[offset], (string.value as NSString).utf8String, string.value.characters.count) - offset += string.value.characters.count + memcpy(&data[offset], (string.value as NSString).utf8String, string.value.count) + offset += string.value.count } class func encodeTuple(tuple: BertTuple, data: inout [UInt8], offset: inout Int) throws { diff --git a/Nynja/Services/CameraSettingsService/CameraSettingsService.swift b/Nynja/Services/CameraSettingsService/CameraSettingsService.swift index e5a359c84..2b8ab4b4b 100644 --- a/Nynja/Services/CameraSettingsService/CameraSettingsService.swift +++ b/Nynja/Services/CameraSettingsService/CameraSettingsService.swift @@ -87,7 +87,8 @@ extension CameraSettingsService { } } - @discardableResult func makeDefaultSettings() -> CameraSettings { + @discardableResult + func makeDefaultSettings() -> CameraSettings { let settings = CameraSettings( isScanQRCodes: .qrCodes(value: false), isDrawGrid: .grid(value: false), diff --git a/Nynja/Services/Debug/MotionManager/MotionManager.swift b/Nynja/Services/Debug/MotionManager/MotionManager.swift index f9621475c..845aa3010 100644 --- a/Nynja/Services/Debug/MotionManager/MotionManager.swift +++ b/Nynja/Services/Debug/MotionManager/MotionManager.swift @@ -48,7 +48,7 @@ class MotionManager { var y = 1 func updates(ax: CMAccelerometerData?, g: CMGyroData?) { - if let _g = self.gCoords,let new = MotionCoords(data: g) { + if self.gCoords != nil,let new = MotionCoords(data: g) { res += Int(new.z) if res > 300, Int(new.z) > 0, i > 0 { i -= 1 diff --git a/Nynja/Services/Debug/SMSCodeProvider/SMSCodeProvider.swift b/Nynja/Services/Debug/SMSCodeProvider/SMSCodeProvider.swift index 01f980df7..9115ed696 100644 --- a/Nynja/Services/Debug/SMSCodeProvider/SMSCodeProvider.swift +++ b/Nynja/Services/Debug/SMSCodeProvider/SMSCodeProvider.swift @@ -33,7 +33,7 @@ class SMSCodeProvider: SMSCodeProviding { if let todoJSON = try JSONSerialization.jsonObject(with: data!, options: []) as? [[String: Any]] { for i in todoJSON { let model = Modelka(input: i) - if let smsCode = model.smsCode as? String, model.devKey == self.deviceId { + if let smsCode = model.smsCode, model.devKey == self.deviceId { completion(smsCode) } } diff --git a/Nynja/Services/MQTT/MQTTService.swift b/Nynja/Services/MQTT/MQTTService.swift index f750f8d5f..fb1c082af 100644 --- a/Nynja/Services/MQTT/MQTTService.swift +++ b/Nynja/Services/MQTT/MQTTService.swift @@ -247,7 +247,7 @@ final class MQTTService: NSObject, CocoaMQTTDelegate, ConnectionServiceDelegate } func mqttDidDisconnect(_ mqtt: CocoaMQTT, withError err: Error?) { - LogService.log(topic: .MQTT) { return "clientID: \(mqtt.clientID ) & password: \(mqtt.password ?? "") & clearSession: \(mqtt.cleanSession) state: \(mqtt.connState) & error: \(err?.localizedDescription)" } + LogService.log(topic: .MQTT) { return "clientID: \(mqtt.clientID ) & password: \(mqtt.password ?? "") & clearSession: \(mqtt.cleanSession) state: \(mqtt.connState) & error: \(String(describing: err?.localizedDescription))" } if let error = err as NSError?, error.code == 7 { LogService.log(topic: .MQTT) { return "Something went wrong" } diff --git a/Nynja/Services/PushService.swift b/Nynja/Services/PushService.swift index 5c5e958b6..a22a320b4 100644 --- a/Nynja/Services/PushService.swift +++ b/Nynja/Services/PushService.swift @@ -143,11 +143,11 @@ final class PushService: NSObject, PKPushRegistryDelegate, UserSettingsRespondab private func readPushes(feed: BaseChatModel, reader: Int64) { var predicate: String = "" - if let _p2p = feed as? p2p { - predicate = "Message_p2p;\(_p2p.opponentId);\(reader)" + if let p2p = feed as? p2p, let opponentId = p2p.opponentId { + predicate = "Message_p2p;\(opponentId);\(reader)" } - if let _muc = feed as? muc { - predicate = "Message_muc;\(_muc.name);\(reader)" + if let muc = feed as? muc, let mucName = muc.name { + predicate = "Message_muc;\(mucName);\(reader)" } getNotificationIds(predicate: predicate) { ids in UNUserNotificationCenter.current().removeDeliveredNotifications(withIdentifiers: ids) diff --git a/Nynja/Services/StorageService.swift b/Nynja/Services/StorageService.swift index 9ef71ae31..5ae84cbaa 100644 --- a/Nynja/Services/StorageService.swift +++ b/Nynja/Services/StorageService.swift @@ -80,7 +80,7 @@ class StorageService { application: application) keychain.set(newPassphrase, forKey: passphraseKey) - LogService.log(topic: .passphrase) { return "Store new passphrase: \(keychain.string(forKey: passphraseKey))" } + LogService.log(topic: .passphrase) { return "Store new passphrase: \(String(describing: keychain.string(forKey: passphraseKey)))" } } private func setupInsecureDatabase(with name: String, application: UIApplication) { -- GitLab From 52ec82551f651609b4b68c2bff2d763e2809b06a Mon Sep 17 00:00:00 2001 From: Anton Poltoratskyi Date: Thu, 1 Nov 2018 02:01:19 +0200 Subject: [PATCH 05/27] [NY-4362] Fixed UITextView extension --- Nynja/Extensions/UITextView+Extensions.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Nynja/Extensions/UITextView+Extensions.swift b/Nynja/Extensions/UITextView+Extensions.swift index 56d3939e5..e9f92bafb 100644 --- a/Nynja/Extensions/UITextView+Extensions.swift +++ b/Nynja/Extensions/UITextView+Extensions.swift @@ -27,7 +27,7 @@ extension UITextView { } set { let value: NSUnderlineStyle = newValue ? .single : [] - linkTextAttributes[.underlineStyle] = newValue + linkTextAttributes[.underlineStyle] = value } } -- GitLab From 66b5fa19916a456da94adb7f3a4bde81df8a1e79 Mon Sep 17 00:00:00 2001 From: Anton Poltoratskyi Date: Thu, 1 Nov 2018 02:02:22 +0200 Subject: [PATCH 06/27] [NY-4362] Disable warnings about type-inference time. --- Nynja.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Nynja.xcodeproj/project.pbxproj b/Nynja.xcodeproj/project.pbxproj index cec9ec159..e2cd6091f 100644 --- a/Nynja.xcodeproj/project.pbxproj +++ b/Nynja.xcodeproj/project.pbxproj @@ -16773,7 +16773,7 @@ INFOPLIST_FILE = "Nynja-Share/Resources/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" -DSHARE_EXTENSION -Xfrontend -warn-long-expression-type-checking=20 -Xfrontend -warn-long-function-bodies=20"; + OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" -DSHARE_EXTENSION"; PRODUCT_BUNDLE_IDENTIFIER = "$(ExtensionBundleIdentifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = "ee586ed5-2bed-44bc-ab45-42f41bfa7316"; @@ -16948,7 +16948,7 @@ INFOPLIST_FILE = "$(SRCROOT)/Nynja/Resources/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - OTHER_SWIFT_FLAGS = "$(inherited) -D SQLITE_HAS_CODEC -D GRDBCIPHER $(inherited) \"-D\" \"COCOAPODS\" -Xfrontend -debug-time-function-bodies -Xfrontend -warn-long-expression-type-checking=20 -Xfrontend -warn-long-function-bodies=20"; + OTHER_SWIFT_FLAGS = "$(inherited) -D SQLITE_HAS_CODEC -D GRDBCIPHER $(inherited) \"-D\" \"COCOAPODS\""; PRODUCT_BUNDLE_IDENTIFIER = "$(BundleIdentifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = "60b08613-9664-4cda-8e81-82eb36b7a786"; -- GitLab From 24caed34232a61744c38362bb5187a3b0198aec1 Mon Sep 17 00:00:00 2001 From: Anton Poltoratskyi Date: Thu, 1 Nov 2018 02:08:29 +0200 Subject: [PATCH 07/27] [NY-4362] Fixed optimization levels. Update Swift version to 4.2 in test targets. --- .../NynjaUIKit.xcodeproj/project.pbxproj | 2 +- Nynja.xcodeproj/project.pbxproj | 42 ++++++++++--------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/Frameworks/NynjaUIKit/NynjaUIKit.xcodeproj/project.pbxproj b/Frameworks/NynjaUIKit/NynjaUIKit.xcodeproj/project.pbxproj index 16bf3da26..cddd8a552 100644 --- a/Frameworks/NynjaUIKit/NynjaUIKit.xcodeproj/project.pbxproj +++ b/Frameworks/NynjaUIKit/NynjaUIKit.xcodeproj/project.pbxproj @@ -484,7 +484,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 10.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; - SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_COMPILATION_MODE = singlefile; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 4.2; VALIDATE_PRODUCT = YES; diff --git a/Nynja.xcodeproj/project.pbxproj b/Nynja.xcodeproj/project.pbxproj index e2cd6091f..4991ad549 100644 --- a/Nynja.xcodeproj/project.pbxproj +++ b/Nynja.xcodeproj/project.pbxproj @@ -16808,7 +16808,8 @@ PROVISIONING_PROFILE = "2a318f9e-d0ab-41dc-968a-e1cb13de4de5"; PROVISIONING_PROFILE_SPECIFIER = ProductionBundle_AppstoreExt; SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -16922,7 +16923,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 10.3; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_WHOLE_MODULE_OPTIMIZATION = YES; TARGETED_DEVICE_FAMILY = "1,2"; @@ -16985,8 +16986,9 @@ PROVISIONING_PROFILE = "1971b115-2b2c-48b6-a20f-3686249e0a88"; PROVISIONING_PROFILE_SPECIFIER = ProductionBundle_Appstore; SWIFT_ACTIVE_COMPILATION_CONDITIONS = RELEASE; + SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OBJC_BRIDGING_HEADER = "Nynja-Bridging-Header.h"; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_VERSION = 4.2; SWIFT_WHOLE_MODULE_OPTIMIZATION = YES; @@ -17177,7 +17179,7 @@ SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = DevAutoTests; @@ -17236,7 +17238,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_WHOLE_MODULE_OPTIMIZATION = YES; TARGETED_DEVICE_FAMILY = "1,2"; @@ -17268,7 +17270,7 @@ PROVISIONING_PROFILE_SPECIFIER = NynjaRC_adhoc; SWIFT_ACTIVE_COMPILATION_CONDITIONS = RELEASE; SWIFT_OBJC_BRIDGING_HEADER = "Nynja-Bridging-Header.h"; - SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_VERSION = 4.2; SWIFT_WHOLE_MODULE_OPTIMIZATION = YES; @@ -17300,7 +17302,7 @@ PROVISIONING_PROFILE_SPECIFIER = NynjaRC_adhocExt; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = RELEASE; - SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -17370,7 +17372,7 @@ SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Dev; @@ -17393,8 +17395,9 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.nynja.mobile.communicator.NynjaUnitTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.0; + SWIFT_COMPILATION_MODE = singlefile; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Prerelease; @@ -17417,8 +17420,9 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.nynja.mobile.communicator.NynjaUnitTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.0; + SWIFT_COMPILATION_MODE = singlefile; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; @@ -17487,7 +17491,7 @@ SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Nynja.app/Nynja"; }; @@ -17512,9 +17516,9 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.nynja.dev.mobile.communicator.NynjaIntegrationTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_COMPILATION_MODE = singlefile; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Nynja.app/Nynja"; }; @@ -17539,9 +17543,9 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.nynja.dev.mobile.communicator.NynjaIntegrationTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_COMPILATION_MODE = singlefile; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Nynja.app/Nynja"; }; @@ -17566,9 +17570,9 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.nynja.dev.mobile.communicator.NynjaIntegrationTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_COMPILATION_MODE = singlefile; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Nynja.app/Nynja"; }; -- GitLab From 6706bcee03b674e28dc085d2c7e360d3fdde1bd8 Mon Sep 17 00:00:00 2001 From: Anton Poltoratskyi Date: Thu, 1 Nov 2018 02:13:19 +0200 Subject: [PATCH 08/27] [NY-4362] Remove unused code from StringExtensions. --- .../Extensions/String/StringExtensions.swift | 46 +------------------ 1 file changed, 2 insertions(+), 44 deletions(-) diff --git a/Nynja/Library/UI/Extensions/String/StringExtensions.swift b/Nynja/Library/UI/Extensions/String/StringExtensions.swift index 7cea05250..680619ede 100644 --- a/Nynja/Library/UI/Extensions/String/StringExtensions.swift +++ b/Nynja/Library/UI/Extensions/String/StringExtensions.swift @@ -63,50 +63,6 @@ extension String { return fontSize } - var byWords: [String] { - var result: [String] = [] - var word = "" - for (index, item) in enumerated() { - if item == " " { - result.append(word) - word = "" - } else { - if index == self.count - 1 { - word = word + String(item) - result.append(word) - } - word = word + String(item) - } - } - return result - } - - var lastWord: String { - return byWords.last ?? "" - } - - func lastWords(_ max: Int) -> [String] { - return Array(byWords.suffix(max)) - } - - var byWordsSeparatedWithComma: [String] { - var result:[String] = [] - var word = "" - for (index, item) in enumerated() { - if item == "," { - result.append(word) - word = "" - } else { - if index == self.count - 1 { - word = word + String(item) - result.append(word) - } - word = word + String(item) - } - } - return result - } - func stringAsPhone(format: NBEPhoneNumberFormat = NBEPhoneNumberFormat.INTERNATIONAL) -> String { let util = NBPhoneNumberUtil.sharedInstance() let region = NSLocale.current.regionCode @@ -122,6 +78,8 @@ extension String { return "" } + + // FIXME: remove the methods below - getting string index by int index takes O(N) time. func index(from: Int) -> Index { return self.index(startIndex, offsetBy: from) } -- GitLab From 170e612451eb00a0132d904489c2bc9c0a21cbcf Mon Sep 17 00:00:00 2001 From: Anton Poltoratskyi Date: Thu, 1 Nov 2018 22:23:56 +0200 Subject: [PATCH 09/27] [NY-4362] Update and fix NynjaUIKit to Swift 4.2. --- .../NynjaUIKit/NynjaUIKit.xcodeproj/project.pbxproj | 8 ++++---- .../SupplementaryView/SupplementaryViewModel.swift | 2 +- .../Views/ContextMenu/View/NynjaContextMenu.swift | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Frameworks/NynjaUIKit/NynjaUIKit.xcodeproj/project.pbxproj b/Frameworks/NynjaUIKit/NynjaUIKit.xcodeproj/project.pbxproj index cddd8a552..cd6117c74 100644 --- a/Frameworks/NynjaUIKit/NynjaUIKit.xcodeproj/project.pbxproj +++ b/Frameworks/NynjaUIKit/NynjaUIKit.xcodeproj/project.pbxproj @@ -515,7 +515,7 @@ PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Dev; @@ -601,7 +601,7 @@ PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Prerelease; @@ -687,7 +687,7 @@ PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; @@ -773,7 +773,7 @@ PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = DevAutoTests; diff --git a/Frameworks/NynjaUIKit/NynjaUIKit/Core/Collection/ViewModels/SupplementaryView/SupplementaryViewModel.swift b/Frameworks/NynjaUIKit/NynjaUIKit/Core/Collection/ViewModels/SupplementaryView/SupplementaryViewModel.swift index 193a6c513..a2c99eeaa 100644 --- a/Frameworks/NynjaUIKit/NynjaUIKit/Core/Collection/ViewModels/SupplementaryView/SupplementaryViewModel.swift +++ b/Frameworks/NynjaUIKit/NynjaUIKit/Core/Collection/ViewModels/SupplementaryView/SupplementaryViewModel.swift @@ -17,7 +17,7 @@ public protocol AnySupplementaryViewModel: Reusable, AccessibilityConfigurable { extension AnySupplementaryViewModel { public static var supplementaryKind: String { - return UICollectionElementKindSectionHeader + return UICollectionView.elementKindSectionHeader } } diff --git a/Frameworks/NynjaUIKit/NynjaUIKit/Views/ContextMenu/View/NynjaContextMenu.swift b/Frameworks/NynjaUIKit/NynjaUIKit/Views/ContextMenu/View/NynjaContextMenu.swift index ecea64cfb..ab503c855 100644 --- a/Frameworks/NynjaUIKit/NynjaUIKit/Views/ContextMenu/View/NynjaContextMenu.swift +++ b/Frameworks/NynjaUIKit/NynjaUIKit/Views/ContextMenu/View/NynjaContextMenu.swift @@ -254,7 +254,7 @@ extension NynjaContextMenu { setupFrames(for: frame, in: containerView) - containerView.bringSubview(toFront: self) + containerView.bringSubviewToFront(self) UIApplication.shared.windows.forEach { $0.hitTestDelegate = self } -- GitLab From f2635a349d7f525b80cbb3c4d6d26e1d806335d8 Mon Sep 17 00:00:00 2001 From: Anton Poltoratskyi Date: Thu, 1 Nov 2018 22:24:27 +0200 Subject: [PATCH 10/27] [NY-4362] Fixed main target after merge --- .../View/ChatLanguageSettingsViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Nynja/Modules/LanguageSettings/LanguageSettings/View/ChatLanguageSettingsViewController.swift b/Nynja/Modules/LanguageSettings/LanguageSettings/View/ChatLanguageSettingsViewController.swift index d2e7736e4..0bdbc76ad 100644 --- a/Nynja/Modules/LanguageSettings/LanguageSettings/View/ChatLanguageSettingsViewController.swift +++ b/Nynja/Modules/LanguageSettings/LanguageSettings/View/ChatLanguageSettingsViewController.swift @@ -28,7 +28,7 @@ class ChatLanguageSettingsViewController: BaseVC, ChatLanguageSettingsViewProtoc table.backgroundColor = UIColor.nynja.clear table.separatorStyle = .none table.estimatedRowHeight = 100 - table.rowHeight = UITableViewAutomaticDimension + table.rowHeight = UITableView.automaticDimension self.view.addSubview(table) table.snp.makeConstraints({ (make) in make.top.equalTo(navigationView.snp.bottom) -- GitLab From c3c7c64de48a39d9f6a589666462216c326d7d5a Mon Sep 17 00:00:00 2001 From: Anton Poltoratskyi Date: Thu, 1 Nov 2018 22:25:19 +0200 Subject: [PATCH 11/27] [NY-4362] Update SnapKit to Swift 4.2 - use pod version `4.2.0`. --- Podfile | 8 ++++---- Podfile.lock | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Podfile b/Podfile index a50c4ef09..127990951 100644 --- a/Podfile +++ b/Podfile @@ -18,7 +18,7 @@ end def commonPodsForNynja pod 'TestFairy', '= 1.13.4' - pod 'SnapKit', '= 4.0.0' + pod 'SnapKit', '= 4.2.0' pod 'Fabric', '= 1.6.13' pod 'Crashlytics', '= 3.8.6' pod 'CocoaMQTT', '= 1.1.2' @@ -49,7 +49,7 @@ def commonPodsForNynja end def commonPodsForNynjaTests - pod 'SnapKit', '= 4.0.0' + pod 'SnapKit', '= 4.2.0' pod 'Fabric', '= 1.6.13' pod 'Crashlytics', '= 3.8.6' pod 'CocoaMQTT', '= 1.1.2' @@ -72,14 +72,14 @@ def commonPodsForNynjaShare pod 'libPhoneNumber-iOS', '= 0.9.13' pod 'AWSS3', '= 2.6.20' pod 'CocoaMQTT', '= 1.1.2' - pod 'SnapKit', '= 4.0.0' + pod 'SnapKit', '= 4.2.0' pod 'SDWebImage', '= 4.4.2' pod 'GRDBCipher', '= 2.10.0' pod 'CryptoSwift', '= 0.10.0' end def commonPodsForNynjaUIKit - pod 'SnapKit', '= 4.0.0' + pod 'SnapKit', '= 4.2.0' end target 'Nynja' do diff --git a/Podfile.lock b/Podfile.lock index 839be3a78..74f01b2dd 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -67,7 +67,7 @@ PODS: - SDWebImage (4.4.2): - SDWebImage/Core (= 4.4.2) - SDWebImage/Core (4.4.2) - - SnapKit (4.0.0) + - SnapKit (4.2.0) - SQLCipher (3.4.2): - SQLCipher/standard (= 3.4.2) - SQLCipher/common (3.4.2) @@ -98,7 +98,7 @@ DEPENDENCIES: - NynjaSDK (= 1.7.1) - QRCode (= 2.0) - SDWebImage (= 4.4.2) - - SnapKit (= 4.0.0) + - SnapKit (= 4.2.0) - SwiftyJSON (= 4.0.0) - TestFairy (= 1.13.4) @@ -177,12 +177,12 @@ SPEC CHECKSUMS: NynjaSDK: 77eed21eba9e95484230fc0edf1ae9cd00a30e6b QRCode: f98a1886c8f37523704a7512a4c0cd45b34c18a4 SDWebImage: 624d6e296c69b244bcede364c72ae0430ac14681 - SnapKit: a42d492c16e80209130a3379f73596c3454b7694 + SnapKit: fe8a619752f3f27075cc9a90244d75c6c3f27e2a SQLCipher: f9fcf29b2e59ced7defc2a2bdd0ebe79b40d4990 SwiftyJSON: 070dabdcb1beb81b247c65ffa3a79dbbfb3b48aa SwiftyTimer: 2efd74b060d69ad4f1496baf5bbedbe132125fcf TestFairy: 842f8ddc45477b208eb85326b0418047b40f7137 -PODFILE CHECKSUM: f206ab413c7bb2af1ba8a5ce0e66489b21851a6f +PODFILE CHECKSUM: 0c031aa1c9b2d9a334a0849542060335c5299f51 COCOAPODS: 1.5.3 -- GitLab From 6303802321fd8332d2319f9239fe2280f891d73a Mon Sep 17 00:00:00 2001 From: Anton Poltoratskyi Date: Thu, 1 Nov 2018 22:32:21 +0200 Subject: [PATCH 12/27] [NY-4362] Update JTAppleCalendar --- Podfile | 5 ++--- Podfile.lock | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Podfile b/Podfile index 127990951..ea85f1626 100644 --- a/Podfile +++ b/Podfile @@ -37,7 +37,7 @@ def commonPodsForNynja pod 'AutoScrollLabel', '= 0.4.3' pod 'MaterialComponents/FlexibleHeader', '= 55.3.0' - pod 'JTAppleCalendar', '= 7.1.5' + pod 'JTAppleCalendar', '= 7.1.6' pod 'NynjaSDK', '= 1.7.1' @@ -65,7 +65,6 @@ def commonPodsForNynjaTests pod 'AutoScrollLabel', '= 0.4.3' pod 'MaterialComponents/FlexibleHeader', '= 55.3.0' - pod 'JTAppleCalendar', '= 7.1.5' end def commonPodsForNynjaShare @@ -109,7 +108,7 @@ end post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| - config.build_settings['SWIFT_VERSION'] = '4.0' + config.build_settings['SWIFT_VERSION'] = '4.2' end end diff --git a/Podfile.lock b/Podfile.lock index 74f01b2dd..a371f060a 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -51,7 +51,7 @@ PODS: - SQLCipher (~> 3.4.1) - GTMSessionFetcher/Core (1.1.15) - Intercom (5.1.6) - - JTAppleCalendar (7.1.5) + - JTAppleCalendar (7.1.6) - libPhoneNumber-iOS (0.9.13) - MaterialComponents/FlexibleHeader (55.3.0): - MaterialComponents/private/Application @@ -91,7 +91,7 @@ DEPENDENCIES: - GooglePlaces (= 2.7.0) - GRDBCipher (= 2.10.0) - Intercom (= 5.1.6) - - JTAppleCalendar (= 7.1.5) + - JTAppleCalendar (= 7.1.6) - libPhoneNumber-iOS (= 0.9.13) - MaterialComponents/FlexibleHeader (= 55.3.0) - MulticastDelegateSwift (= 2.1.1) @@ -169,7 +169,7 @@ SPEC CHECKSUMS: GRDBCipher: eef21d242c727a21e0f87ad44f8ea2df03edd252 GTMSessionFetcher: 5fa5b80fd20e439ef5f545fb2cb3ca6c6714caa2 Intercom: 083a05bf222811b0b5e0a0b24c863544123397f0 - JTAppleCalendar: 2d4f974f9f3c8b4964d51ca1f6e004883c031fbe + JTAppleCalendar: abb30678f42a4ef8a340a932b1dcb8c85a33dac2 libPhoneNumber-iOS: e444379ac18bbfbdefad571da735b2cd7e096caa MaterialComponents: 915f4e844400a35db3ea4c710a9af40aa8bcb093 MDFTextAccessibility: 94098925e0853551c5a311ce7c1ecefbe297cdb6 @@ -183,6 +183,6 @@ SPEC CHECKSUMS: SwiftyTimer: 2efd74b060d69ad4f1496baf5bbedbe132125fcf TestFairy: 842f8ddc45477b208eb85326b0418047b40f7137 -PODFILE CHECKSUM: 0c031aa1c9b2d9a334a0849542060335c5299f51 +PODFILE CHECKSUM: 461ccca76d30a7dc12233e48ae4f09d23e4e9f92 COCOAPODS: 1.5.3 -- GitLab From e5d5c6038eb6073450d92c47532f434117dbdf32 Mon Sep 17 00:00:00 2001 From: Anton Poltoratskyi Date: Thu, 1 Nov 2018 23:26:44 +0200 Subject: [PATCH 13/27] [NY-4362] Update CocoaMQTT, CryptoSwift, SwiftyJSON. --- Nynja.xcodeproj/project.pbxproj | 6 ----- .../Services/Debug/LogService/LogWriter.swift | 2 +- .../Operations /AudioConvertOperation.swift | 2 +- Podfile | 18 ++++++++----- Podfile.lock | 26 ++++++++----------- 5 files changed, 24 insertions(+), 30 deletions(-) diff --git a/Nynja.xcodeproj/project.pbxproj b/Nynja.xcodeproj/project.pbxproj index 6a1fe8334..58c0a179e 100644 --- a/Nynja.xcodeproj/project.pbxproj +++ b/Nynja.xcodeproj/project.pbxproj @@ -14292,7 +14292,6 @@ "${BUILT_PRODUCTS_DIR}/SQLCipher/SQLCipher.framework", "${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework", "${BUILT_PRODUCTS_DIR}/SwiftyJSON/SwiftyJSON.framework", - "${BUILT_PRODUCTS_DIR}/SwiftyTimer/SwiftyTimer.framework", "${BUILT_PRODUCTS_DIR}/libPhoneNumber-iOS/libPhoneNumber_iOS.framework", ); name = "[CP] Embed Pods Frameworks"; @@ -14317,7 +14316,6 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SQLCipher.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SnapKit.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyJSON.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyTimer.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/libPhoneNumber_iOS.framework", ); runOnlyForDeploymentPostprocessing = 0; @@ -14339,14 +14337,12 @@ "${BUILT_PRODUCTS_DIR}/CocoaLumberjack/CocoaLumberjack.framework", "${BUILT_PRODUCTS_DIR}/CocoaMQTT/CocoaMQTT.framework", "${BUILT_PRODUCTS_DIR}/GRDBCipher/GRDBCipher.framework", - "${BUILT_PRODUCTS_DIR}/JTAppleCalendar/JTAppleCalendar.framework", "${BUILT_PRODUCTS_DIR}/MDFTextAccessibility/MDFTextAccessibility.framework", "${BUILT_PRODUCTS_DIR}/MaterialComponents/MaterialComponents.framework", "${BUILT_PRODUCTS_DIR}/QRCode/QRCode.framework", "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework", "${BUILT_PRODUCTS_DIR}/SQLCipher/SQLCipher.framework", "${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework", - "${BUILT_PRODUCTS_DIR}/SwiftyTimer/SwiftyTimer.framework", "${BUILT_PRODUCTS_DIR}/libPhoneNumber-iOS/libPhoneNumber_iOS.framework", ); name = "[CP] Embed Pods Frameworks"; @@ -14358,14 +14354,12 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CocoaLumberjack.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CocoaMQTT.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GRDBCipher.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/JTAppleCalendar.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MDFTextAccessibility.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MaterialComponents.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/QRCode.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SQLCipher.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SnapKit.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyTimer.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/libPhoneNumber_iOS.framework", ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Nynja/Services/Debug/LogService/LogWriter.swift b/Nynja/Services/Debug/LogService/LogWriter.swift index 1a1453996..56483a322 100644 --- a/Nynja/Services/Debug/LogService/LogWriter.swift +++ b/Nynja/Services/Debug/LogService/LogWriter.swift @@ -51,7 +51,7 @@ class LogWriter { let title = BertAtom(fromString: "Log") let _topic = topic.getBin() let _description = description.getBin() - let timestamp = Int64(Date().timeIntervalSince1970.seconds) + let timestamp = Int64(Date().timeIntervalSince1970) let _timeStamp = BertNumber(fromInt64: timestamp) let _thread = thread.getBin() let bert = BertTuple(fromElements: [title, _topic, _description, _timeStamp, _thread]) diff --git a/Nynja/Services/TranscribeService/Operations /AudioConvertOperation.swift b/Nynja/Services/TranscribeService/Operations /AudioConvertOperation.swift index da15a23bc..598092218 100644 --- a/Nynja/Services/TranscribeService/Operations /AudioConvertOperation.swift +++ b/Nynja/Services/TranscribeService/Operations /AudioConvertOperation.swift @@ -52,7 +52,7 @@ final class AudioConvertOperation: TranscribeOperation, InitializeInjectable { extension AudioConvertOperation { var outputURL: URL { - let timeStamp = Int64(Date().timeIntervalSince1970.seconds) + let timeStamp = Int64(Date().timeIntervalSince1970) let fileName = "voice_\(timeStamp)_\(UUID().uuidString).caf" let path = FileManagerService.sharedInstance.createFile(folder: Constants.Folders.downloads, name: fileName) ?? "" return URL(fileURLWithPath: path) diff --git a/Podfile b/Podfile index ea85f1626..2a73f8d3b 100644 --- a/Podfile +++ b/Podfile @@ -21,7 +21,7 @@ def commonPodsForNynja pod 'SnapKit', '= 4.2.0' pod 'Fabric', '= 1.6.13' pod 'Crashlytics', '= 3.8.6' - pod 'CocoaMQTT', '= 1.1.2' + pod 'CocoaMQTT', '= 1.1.3' pod 'libPhoneNumber-iOS', '= 0.9.13' pod 'QRCode', '= 2.0' pod 'CocoaLumberjack', :git => 'https://github.com/CocoaLumberjack/CocoaLumberjack', :commit => '12948ff' @@ -33,7 +33,7 @@ def commonPodsForNynja pod 'Firebase/Storage' pod 'Firebase/Auth' pod 'GRDBCipher', '= 2.10.0' - pod 'SwiftyJSON', '= 4.0.0' + pod 'SwiftyJSON', '= 4.2.0' pod 'AutoScrollLabel', '= 0.4.3' pod 'MaterialComponents/FlexibleHeader', '= 55.3.0' @@ -41,7 +41,7 @@ def commonPodsForNynja pod 'NynjaSDK', '= 1.7.1' - pod 'CryptoSwift', '= 0.10.0' + pod 'CryptoSwift', '= 0.13.0' pod 'MulticastDelegateSwift', '= 2.1.1' @@ -52,7 +52,7 @@ def commonPodsForNynjaTests pod 'SnapKit', '= 4.2.0' pod 'Fabric', '= 1.6.13' pod 'Crashlytics', '= 3.8.6' - pod 'CocoaMQTT', '= 1.1.2' + pod 'CocoaMQTT', '= 1.1.3' pod 'libPhoneNumber-iOS', '= 0.9.13' pod 'QRCode', '= 2.0' pod 'CocoaLumberjack', :git => 'https://github.com/CocoaLumberjack/CocoaLumberjack', :commit => '12948ff' @@ -70,11 +70,11 @@ end def commonPodsForNynjaShare pod 'libPhoneNumber-iOS', '= 0.9.13' pod 'AWSS3', '= 2.6.20' - pod 'CocoaMQTT', '= 1.1.2' + pod 'CocoaMQTT', '= 1.1.3' pod 'SnapKit', '= 4.2.0' pod 'SDWebImage', '= 4.4.2' pod 'GRDBCipher', '= 2.10.0' - pod 'CryptoSwift', '= 0.10.0' + pod 'CryptoSwift', '= 0.13.0' end def commonPodsForNynjaUIKit @@ -108,7 +108,11 @@ end post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| - config.build_settings['SWIFT_VERSION'] = '4.2' + if target.name == 'GRDBCipher' + config.build_settings['SWIFT_VERSION'] = '4.0' + else + config.build_settings['SWIFT_VERSION'] = '4.2' + end end end diff --git a/Podfile.lock b/Podfile.lock index a371f060a..44008c52b 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -10,12 +10,11 @@ PODS: - CocoaLumberjack/Default (3.2.1) - CocoaLumberjack/Extensions (3.2.1): - CocoaLumberjack/Default - - CocoaMQTT (1.1.2): - - CocoaAsyncSocket (~> 7.6.1) - - SwiftyTimer (~> 2.0.0) + - CocoaMQTT (1.1.3): + - CocoaAsyncSocket (~> 7.6.3) - Crashlytics (3.8.6): - Fabric (~> 1.6.3) - - CryptoSwift (0.10.0) + - CryptoSwift (0.13.0) - Fabric (1.6.13) - Firebase/Auth (5.8.1): - Firebase/CoreOnly @@ -73,17 +72,16 @@ PODS: - SQLCipher/common (3.4.2) - SQLCipher/standard (3.4.2): - SQLCipher/common - - SwiftyJSON (4.0.0) - - SwiftyTimer (2.0.0) + - SwiftyJSON (4.2.0) - TestFairy (1.13.4) DEPENDENCIES: - AutoScrollLabel (= 0.4.3) - AWSS3 (= 2.6.20) - CocoaLumberjack (from `https://github.com/CocoaLumberjack/CocoaLumberjack`, commit `12948ff`) - - CocoaMQTT (= 1.1.2) + - CocoaMQTT (= 1.1.3) - Crashlytics (= 3.8.6) - - CryptoSwift (= 0.10.0) + - CryptoSwift (= 0.13.0) - Fabric (= 1.6.13) - Firebase/Auth - Firebase/Storage @@ -99,7 +97,7 @@ DEPENDENCIES: - QRCode (= 2.0) - SDWebImage (= 4.4.2) - SnapKit (= 4.2.0) - - SwiftyJSON (= 4.0.0) + - SwiftyJSON (= 4.2.0) - TestFairy (= 1.13.4) SPEC REPOS: @@ -133,7 +131,6 @@ SPEC REPOS: - SnapKit - SQLCipher - SwiftyJSON - - SwiftyTimer - TestFairy https://nynjagroup.jfrog.io/nynjagroup/api/pods/cocoapods-local: - NynjaSDK @@ -154,9 +151,9 @@ SPEC CHECKSUMS: AWSS3: 69589dec1883cdca872b4ddd1ea2ef814b0846fe CocoaAsyncSocket: eafaa68a7e0ec99ead0a7b35015e0bf25d2c8987 CocoaLumberjack: 520616f8e72226ca2c729b43981b66bc483745ce - CocoaMQTT: d33ab3cd4e329f9f1cfbb62e25306a318a606616 + CocoaMQTT: b506d38ad3bbe1c55a4f8ee8c9fd02c35da1a7d8 Crashlytics: 95d05f4e4c19a771250c4bd9ce344d996de32bbf - CryptoSwift: 6c778d69282bed3b4e975ff97a79d074f20bb011 + CryptoSwift: 16e78bebf567bad1c87b2d58f6547f25b74c31aa Fabric: 2fb5676bc811af011a04513451f463dac6803206 Firebase: a870ed114d769b424021a0c8ddb0c86c3250a0c5 FirebaseAuth: 504b198ceb3472dca5c65bb95544ea44cfc9439e @@ -179,10 +176,9 @@ SPEC CHECKSUMS: SDWebImage: 624d6e296c69b244bcede364c72ae0430ac14681 SnapKit: fe8a619752f3f27075cc9a90244d75c6c3f27e2a SQLCipher: f9fcf29b2e59ced7defc2a2bdd0ebe79b40d4990 - SwiftyJSON: 070dabdcb1beb81b247c65ffa3a79dbbfb3b48aa - SwiftyTimer: 2efd74b060d69ad4f1496baf5bbedbe132125fcf + SwiftyJSON: c4bcba26dd9ec7a027fc8eade48e2c911f229e96 TestFairy: 842f8ddc45477b208eb85326b0418047b40f7137 -PODFILE CHECKSUM: 461ccca76d30a7dc12233e48ae4f09d23e4e9f92 +PODFILE CHECKSUM: d47bdc05a1b87029d46f81f65d92b20740112cb9 COCOAPODS: 1.5.3 -- GitLab From ccf74e68044df009343efe096a0fa8797129856f Mon Sep 17 00:00:00 2001 From: Anton Poltoratskyi Date: Thu, 1 Nov 2018 23:50:55 +0200 Subject: [PATCH 14/27] [NY-4362] Replace guard let `self` = self with guard let self = self according to new Swift 4.2 guideline. --- .../AttachmentProvider.swift | 2 +- Nynja/Files/AppGroupFlagObserver.swift | 2 +- .../Buttons/TopSwipable/ScheduleButton.swift | 2 +- .../ImagePreviewTransitionController.swift | 14 +++++----- .../UI/TextInput/InputBar/InputBar.swift | 2 +- .../UI/View/CollapsedView/CollapsedView.swift | 8 +++--- .../AddContactByUsernameInteractor.swift | 2 +- .../AddContactViaPhoneInteractor.swift | 2 +- .../Login/Interactor/LoginInteractor.swift | 2 +- .../Interactor/CreateGroupInteractor.swift | 2 +- .../CameraVideoPreviewInteractor.swift | 4 +-- .../Gallery/Presenter/GalleryPresenter.swift | 8 +++--- .../Gallery/View/GalleryViewController.swift | 2 +- .../Presenter/MultiplePreviewPresenter.swift | 4 +-- .../View/Subviews/ImagePreviewCVCell.swift | 2 +- .../View/GroupRulesViewController.swift | 2 +- .../View/ImagePreviewViewController.swift | 4 +-- .../ChatLanguageSettingsPresenter.swift | 10 +++---- .../View/MainViewController+Gallery.swift | 8 +++--- .../Main/WireFrame/MainWireframe.swift | 2 +- .../MessageInteractor+Forward.swift | 2 +- .../MessageInteractor+StorageSubscriber.swift | 2 +- .../MessageInteractor+Transcription.swift | 2 +- .../Interactor/MessageInteractor.swift | 10 +++---- .../Message/Presenter/MessagePresenter.swift | 12 ++++----- Nynja/Modules/Message/View/MessageVC.swift | 26 +++++++++---------- .../Cells/Views/Message/MessageTextView.swift | 2 +- .../View/OtherUserViewController.swift | 2 +- .../View/ScheduleMessageViewController.swift | 2 +- .../StickerSearchResultView.swift | 2 +- .../Interactor/PaymentInteractor.swift | 4 +-- .../Payment/Presenter/PaymentPresenter.swift | 4 +-- .../Payment/View/PaymentViewController.swift | 2 +- .../SeedBackupWalletInteractor.swift | 2 +- .../Presenter/WalletBalancesPresenter.swift | 2 +- .../AudioSessionManager.swift | 2 +- .../SMSCodeProvider/SMSCodeProvider.swift | 6 ++--- .../ResourceManager/ResourceManager.swift | 6 ++--- ...ioLongTranscribeProccessingOperation.swift | 2 +- .../TranscribeService/TranscribeService.swift | 4 +-- 40 files changed, 89 insertions(+), 91 deletions(-) diff --git a/Nynja-Share/Services/AttachmentProvider/AttachmentProvider.swift b/Nynja-Share/Services/AttachmentProvider/AttachmentProvider.swift index 3890c67c1..c8cfc71a7 100644 --- a/Nynja-Share/Services/AttachmentProvider/AttachmentProvider.swift +++ b/Nynja-Share/Services/AttachmentProvider/AttachmentProvider.swift @@ -58,7 +58,7 @@ final class AttachmentProvider: AttachmentProviding, InitializeInjectable { completionHandler: { [weak self] coding, error in defer { group.leave() } - guard let `self` = self, let coding = coding else { + guard let self = self, let coding = coding else { return } if let attachement = self.transformer.transform(toKind: kind, coding: coding) { diff --git a/Nynja/Files/AppGroupFlagObserver.swift b/Nynja/Files/AppGroupFlagObserver.swift index d934c1f35..15655ddc6 100644 --- a/Nynja/Files/AppGroupFlagObserver.swift +++ b/Nynja/Files/AppGroupFlagObserver.swift @@ -23,7 +23,7 @@ final class AppGroupFlagObserver: AppGroupFlagContainer { try prepare() directoryWatcher = DirectoryWatcher.makeDirectoryWatcher(withPath: flagsDirectoryURL.path) { [weak self] watcher in - guard let `self` = self else { + guard let self = self else { return } do { diff --git a/Nynja/Library/UI/Buttons/TopSwipable/ScheduleButton.swift b/Nynja/Library/UI/Buttons/TopSwipable/ScheduleButton.swift index 866556900..1874cd5d8 100644 --- a/Nynja/Library/UI/Buttons/TopSwipable/ScheduleButton.swift +++ b/Nynja/Library/UI/Buttons/TopSwipable/ScheduleButton.swift @@ -91,7 +91,7 @@ final class ScheduleButton: UIButton, TopSwipable { } swipeAction = { [weak self] in - guard let `self` = self else { return } + guard let self = self else { return } self.scheduleAction?() self.hideScheduleView() } diff --git a/Nynja/Library/UI/ImagePreviewTransitionController/ImagePreviewTransitionController.swift b/Nynja/Library/UI/ImagePreviewTransitionController/ImagePreviewTransitionController.swift index 320070193..ff3b3cb35 100644 --- a/Nynja/Library/UI/ImagePreviewTransitionController/ImagePreviewTransitionController.swift +++ b/Nynja/Library/UI/ImagePreviewTransitionController/ImagePreviewTransitionController.swift @@ -141,7 +141,7 @@ UIViewControllerAnimatedTransitioning, UIViewControllerInteractiveTransitioning height: aspectRatioAdjustedSize.height * scale) let scaleAnimations = { [weak self] () in - guard let `self` = self else { + guard let self = self else { return } @@ -163,7 +163,7 @@ UIViewControllerAnimatedTransitioning, UIViewControllerInteractiveTransitioning } let scaleCompletion = { [weak self] (_ finished: Bool) in - guard let `self` = self else { + guard let self = self else { return } @@ -249,7 +249,7 @@ UIViewControllerAnimatedTransitioning, UIViewControllerInteractiveTransitioning var offscreenImageViewCenter: CGPoint? let scaleAnimations = { [weak self] () in - guard let `self` = self else { + guard let self = self else { return } @@ -434,7 +434,7 @@ UIViewControllerAnimatedTransitioning, UIViewControllerInteractiveTransitioning let overlayView = imagePreviewViewController.hostOverlayView let animations = { [weak self] () in - guard let `self` = self else { + guard let self = self else { return } @@ -444,7 +444,7 @@ UIViewControllerAnimatedTransitioning, UIViewControllerInteractiveTransitioning } let completion = { [weak self] (_ finished: Bool) in - guard let `self` = self else { + guard let self = self else { return } @@ -531,7 +531,7 @@ UIViewControllerAnimatedTransitioning, UIViewControllerInteractiveTransitioning case .changed: let animation = { [weak self] in - guard let `self` = self else { + guard let self = self else { return } @@ -573,7 +573,7 @@ UIViewControllerAnimatedTransitioning, UIViewControllerInteractiveTransitioning fallthrough case .cancelled: let animation = { [weak self] in - guard let `self` = self, let transitionContext = self.dismissalTransitionContext else { + guard let self = self, let transitionContext = self.dismissalTransitionContext else { return } diff --git a/Nynja/Library/UI/TextInput/InputBar/InputBar.swift b/Nynja/Library/UI/TextInput/InputBar/InputBar.swift index b1ea9ec47..b9e408445 100644 --- a/Nynja/Library/UI/TextInput/InputBar/InputBar.swift +++ b/Nynja/Library/UI/TextInput/InputBar/InputBar.swift @@ -710,7 +710,7 @@ extension InputBar: ALTextInputBarDelegate { shouldSendTyping = true dispatchAsyncMainThrotlle(key: "message_typing", seconds: 1.0, firstImmediate: true) { [weak self] in - guard let `self` = self, self.shouldSendTyping else { + guard let self = self, self.shouldSendTyping else { return } self.sendTypingHandler?(.typing) diff --git a/Nynja/Library/UI/View/CollapsedView/CollapsedView.swift b/Nynja/Library/UI/View/CollapsedView/CollapsedView.swift index 924b15510..619acc4e2 100644 --- a/Nynja/Library/UI/View/CollapsedView/CollapsedView.swift +++ b/Nynja/Library/UI/View/CollapsedView/CollapsedView.swift @@ -416,7 +416,7 @@ private extension CollapsedView { UIView.animate( withDuration: TimeInterval(animationsDuration.expandedDuration), animations: { [weak self] in - guard let `self` = self else { + guard let self = self else { return } @@ -425,7 +425,7 @@ private extension CollapsedView { self.superview?.superview?.layoutIfNeeded() }, completion: { [weak self] isSuccess in - guard let `self` = self else { + guard let self = self else { return } @@ -439,7 +439,7 @@ private extension CollapsedView { UIView.animate( withDuration: TimeInterval(animationsDuration.collapsedDuration), animations: { [weak self] in - guard let `self` = self else { + guard let self = self else { return } @@ -448,7 +448,7 @@ private extension CollapsedView { self.superview?.superview?.layoutIfNeeded() }, completion: { [weak self] isSuccess in - guard let `self` = self else { + guard let self = self else { return } diff --git a/Nynja/Modules/AddContactByUsername/Interactor/AddContactByUsernameInteractor.swift b/Nynja/Modules/AddContactByUsername/Interactor/AddContactByUsernameInteractor.swift index 21d47a38e..f5a46ed13 100644 --- a/Nynja/Modules/AddContactByUsername/Interactor/AddContactByUsernameInteractor.swift +++ b/Nynja/Modules/AddContactByUsername/Interactor/AddContactByUsernameInteractor.swift @@ -41,7 +41,7 @@ final class AddContactByUsernameInteractor: AddContactByUsernameInteractorInputP } } else { searchAction = { [weak self] in - guard let `self` = self, self.mqttService.isConnectedSuccess else { + guard let self = self, self.mqttService.isConnectedSuccess else { return } self.mqttService.searchContactByUsername(nick: username) diff --git a/Nynja/Modules/AddContactViaPhone/Interactor/AddContactViaPhoneInteractor.swift b/Nynja/Modules/AddContactViaPhone/Interactor/AddContactViaPhoneInteractor.swift index b3e89801c..93654da21 100644 --- a/Nynja/Modules/AddContactViaPhone/Interactor/AddContactViaPhoneInteractor.swift +++ b/Nynja/Modules/AddContactViaPhone/Interactor/AddContactViaPhoneInteractor.swift @@ -40,7 +40,7 @@ final class AddContactViaPhoneInteractor: AddContactViaPhoneInteractorInputProto presenter.getContactByPhoneSuccess(contact: contact) } else { searchAction = { [weak self] in - guard let `self` = self, self.mqttService.isConnectedSuccess else { + guard let self = self, self.mqttService.isConnectedSuccess else { return } self.mqttService.tryFindContact(number: number) diff --git a/Nynja/Modules/Auth/Login/Interactor/LoginInteractor.swift b/Nynja/Modules/Auth/Login/Interactor/LoginInteractor.swift index c0e1a555b..9e673cac1 100644 --- a/Nynja/Modules/Auth/Login/Interactor/LoginInteractor.swift +++ b/Nynja/Modules/Auth/Login/Interactor/LoginInteractor.swift @@ -82,7 +82,7 @@ class LoginInteractor: BaseInteractor, LoginInteractorInputProtocol, IoHandlerDe private func launchConnectionTimer() { connectionTimerHandler = TimerHandler.init(interval: 60, repeats: false, action: { [weak self] _ in - guard let `self` = self else { + guard let self = self else { return } diff --git a/Nynja/Modules/CreateGroup/Interactor/CreateGroupInteractor.swift b/Nynja/Modules/CreateGroup/Interactor/CreateGroupInteractor.swift index b532a3ad0..269e3a908 100644 --- a/Nynja/Modules/CreateGroup/Interactor/CreateGroupInteractor.swift +++ b/Nynja/Modules/CreateGroup/Interactor/CreateGroupInteractor.swift @@ -58,7 +58,7 @@ final class CreateGroupInteractor: BaseInteractor, CreateGroupInteractorInputPro func sendRoom(with name: String, avatar: String?, members: [Member]) { let roomId = localId let createAction = { [weak self] in - guard let `self` = self, let phoneId = self.storageService.phoneId else { + guard let self = self, let phoneId = self.storageService.phoneId else { return } self.mqttService.createRoom(phoneId: phoneId, roomId: roomId, name: name, avatar: avatar, members: members) diff --git a/Nynja/Modules/Flows/CameraFlow/VideoPreview/Interactor/CameraVideoPreviewInteractor.swift b/Nynja/Modules/Flows/CameraFlow/VideoPreview/Interactor/CameraVideoPreviewInteractor.swift index a8423047f..2972ec357 100644 --- a/Nynja/Modules/Flows/CameraFlow/VideoPreview/Interactor/CameraVideoPreviewInteractor.swift +++ b/Nynja/Modules/Flows/CameraFlow/VideoPreview/Interactor/CameraVideoPreviewInteractor.swift @@ -112,7 +112,7 @@ extension CameraVideoPreviewInteractor { func send() { convert(url: sourceURL) { [weak self] (url) in - guard let `self` = self else { + guard let self = self else { return } @@ -123,7 +123,7 @@ extension CameraVideoPreviewInteractor { func sendAsFile() { convert(url: sourceURL) { [weak self] (url) in - guard let `self` = self else { + guard let self = self else { return } diff --git a/Nynja/Modules/Flows/GalleryFlow/Gallery/Presenter/GalleryPresenter.swift b/Nynja/Modules/Flows/GalleryFlow/Gallery/Presenter/GalleryPresenter.swift index 64c600cb5..f875666d4 100644 --- a/Nynja/Modules/Flows/GalleryFlow/Gallery/Presenter/GalleryPresenter.swift +++ b/Nynja/Modules/Flows/GalleryFlow/Gallery/Presenter/GalleryPresenter.swift @@ -80,7 +80,7 @@ extension GalleryPresenter { switch galleryItem.mediaType { case .image: interactor.getHighQualityImage(for: galleryItem) { [weak self] image in - guard let `self` = self else { + guard let self = self else { return } @@ -88,7 +88,7 @@ extension GalleryPresenter { } case .video: interactor.getURL(for: galleryItem) { [weak self] url in - guard let `self` = self else { + guard let self = self else { return } @@ -124,7 +124,7 @@ extension GalleryPresenter { func send() { prepareContentForEnding { [weak self] (arr) in - guard let `self` = self else { + guard let self = self else { return } @@ -134,7 +134,7 @@ extension GalleryPresenter { func sendAsFile() { prepareContentForEnding { [weak self] (arr) in - guard let `self` = self else { + guard let self = self else { return } diff --git a/Nynja/Modules/Flows/GalleryFlow/Gallery/View/GalleryViewController.swift b/Nynja/Modules/Flows/GalleryFlow/Gallery/View/GalleryViewController.swift index 39b79296d..d1a8c4c15 100644 --- a/Nynja/Modules/Flows/GalleryFlow/Gallery/View/GalleryViewController.swift +++ b/Nynja/Modules/Flows/GalleryFlow/Gallery/View/GalleryViewController.swift @@ -206,7 +206,7 @@ extension GalleryViewController { isHaveCounter: presenter.isMultiselectEnable(), counterNumber: presenter.galleryItemCounter(galleryItem), selectAction: { [weak self] in - guard let `self` = self else { + guard let self = self else { return } diff --git a/Nynja/Modules/Flows/GalleryFlow/MultiplePreview/Presenter/MultiplePreviewPresenter.swift b/Nynja/Modules/Flows/GalleryFlow/MultiplePreview/Presenter/MultiplePreviewPresenter.swift index 6f0ce8c4d..da0cf91df 100644 --- a/Nynja/Modules/Flows/GalleryFlow/MultiplePreview/Presenter/MultiplePreviewPresenter.swift +++ b/Nynja/Modules/Flows/GalleryFlow/MultiplePreview/Presenter/MultiplePreviewPresenter.swift @@ -74,7 +74,7 @@ extension MultiplePreviewPresenter { func send() { prepareContentForEnding { [weak self] (arr) in - guard let `self` = self else { + guard let self = self else { return } @@ -84,7 +84,7 @@ extension MultiplePreviewPresenter { func sendAsFile() { prepareContentForEnding { [weak self] (arr) in - guard let `self` = self else { + guard let self = self else { return } diff --git a/Nynja/Modules/Flows/GalleryFlow/MultiplePreview/View/Subviews/ImagePreviewCVCell.swift b/Nynja/Modules/Flows/GalleryFlow/MultiplePreview/View/Subviews/ImagePreviewCVCell.swift index cde706949..5daafd08e 100644 --- a/Nynja/Modules/Flows/GalleryFlow/MultiplePreview/View/Subviews/ImagePreviewCVCell.swift +++ b/Nynja/Modules/Flows/GalleryFlow/MultiplePreview/View/Subviews/ImagePreviewCVCell.swift @@ -29,7 +29,7 @@ final class ImagePreviewCVCell: UICollectionViewCell, Configurable, IdentityProt setupTestingKeys() config.item.getImage(with: config.fullSize) { [weak self] (image) in - guard let `self` = self, let image = self.prepareImageForViewing(image, on: self.contentView) else { + guard let self = self, let image = self.prepareImageForViewing(image, on: self.contentView) else { return } diff --git a/Nynja/Modules/GroupRules/View/GroupRulesViewController.swift b/Nynja/Modules/GroupRules/View/GroupRulesViewController.swift index aaf240d68..9a748d702 100644 --- a/Nynja/Modules/GroupRules/View/GroupRulesViewController.swift +++ b/Nynja/Modules/GroupRules/View/GroupRulesViewController.swift @@ -91,7 +91,7 @@ class GroupRulesViewController: BaseVC, GroupRulesViewProtocol, KeyboardInteract textView.addGestureRecognizer(linkLongPressRecognizer) linkLongPressRecognizer.handler = { [weak self] link, _ in - guard let `self` = self, let url = URL(string: link) else { + guard let self = self, let url = URL(string: link) else { return } let alertManager = AlertManager.sharedInstance diff --git a/Nynja/Modules/ImagePreview/View/ImagePreviewViewController.swift b/Nynja/Modules/ImagePreview/View/ImagePreviewViewController.swift index 7c879b67b..bb5029991 100644 --- a/Nynja/Modules/ImagePreview/View/ImagePreviewViewController.swift +++ b/Nynja/Modules/ImagePreview/View/ImagePreviewViewController.swift @@ -187,7 +187,7 @@ extension ImagePreviewViewController { func scrollViewDidEndZooming(_ scrollView: UIScrollView, with view: UIView?, atScale scale: CGFloat) { UIView.animate(withDuration: 0.5, delay: 0, options: .beginFromCurrentState, animations: { [weak self] in - guard let `self` = self else { + guard let self = self else { return } @@ -300,7 +300,7 @@ private extension ImagePreviewViewController { func setupImage() { imageView.sd_setImage(with: imageURL) { [weak self] (image, error, cahceType, url) in - guard let `self` = self else { + guard let self = self else { return } diff --git a/Nynja/Modules/LanguageSettings/LanguageSettings/Presenter/ChatLanguageSettingsPresenter.swift b/Nynja/Modules/LanguageSettings/LanguageSettings/Presenter/ChatLanguageSettingsPresenter.swift index dc21d34cc..caecbeb98 100644 --- a/Nynja/Modules/LanguageSettings/LanguageSettings/Presenter/ChatLanguageSettingsPresenter.swift +++ b/Nynja/Modules/LanguageSettings/LanguageSettings/Presenter/ChatLanguageSettingsPresenter.swift @@ -101,7 +101,7 @@ class ChatLanguageSettingsPresenter: BasePresenter, ChatLanguageSettingsPresente title: String.localizable.lsAutoTranslateInc) let action: () -> Void = { [weak self, weak model] in - guard let `self` = self else { return } + guard let self = self else { return } let newValue = !self.autoTranslate @@ -116,7 +116,7 @@ class ChatLanguageSettingsPresenter: BasePresenter, ChatLanguageSettingsPresente private func makeTranslationOutgoingLanguageModel() -> CellModel { let model = DirectableActionCellViewModel(title: outgoingTranslateLanguage.name.capitalized) let action: () -> Void = { [weak self, weak model] in - guard let `self` = self else { return } + guard let self = self else { return } let input = LanguageSelector.Input(selectorType: .translateOutgoing, selectedLang: self.outgoingTranslateLanguage, @@ -151,7 +151,7 @@ class ChatLanguageSettingsPresenter: BasePresenter, ChatLanguageSettingsPresente private func makeTranscribeLanguageModel() -> CellModel { let model = DirectableActionCellViewModel(title: transcribeLanguage.name.capitalized) let action: () -> Void = { [weak self, weak model] in - guard let `self` = self else { return } + guard let self = self else { return } let input = LanguageSelector.Input(selectorType: .transcribe, selectedLang: self.transcribeLanguage, @@ -177,7 +177,7 @@ class ChatLanguageSettingsPresenter: BasePresenter, ChatLanguageSettingsPresente let model = SwitchableActionCellViewModel(isOn: autoTranscribe, title: String.localizable.lsAutoTranscribeVoice) let action: () -> Void = { [weak self, weak model] in - guard let `self` = self else { return } + guard let self = self else { return } let newValue = !self.autoTranscribe @@ -193,7 +193,7 @@ class ChatLanguageSettingsPresenter: BasePresenter, ChatLanguageSettingsPresente let model = SwitchableActionCellViewModel(isOn: autoTranslateTranscribe, title: String.localizable.lsAutoTranslateVoice) let action: () -> Void = { [weak self, weak model] in - guard let `self` = self else { return } + guard let self = self else { return } let newValue = !self.autoTranslateTranscribe diff --git a/Nynja/Modules/Main/View/MainViewController+Gallery.swift b/Nynja/Modules/Main/View/MainViewController+Gallery.swift index 353b7bbcd..e50eaa1ab 100644 --- a/Nynja/Modules/Main/View/MainViewController+Gallery.swift +++ b/Nynja/Modules/Main/View/MainViewController+Gallery.swift @@ -12,7 +12,7 @@ extension MainViewController { func showGallery(indexPath: IndexPath?) { PermissionManager().requestGaleryPermission { [weak self] (status) in - guard let `self` = self else { + guard let self = self else { return } @@ -35,7 +35,7 @@ extension MainViewController { private func makeChangeHandler(with info: TopLevelInfo) -> GalleryFetchController.ChangeHandler { return { [weak self, weak selectedItem = info.selectedItem] changedResult in - guard let `self` = self else { + guard let self = self else { return } @@ -98,7 +98,7 @@ extension MainViewController { private func makeMediaTransformer(with indexPath: IndexPath?) -> DataTransformer { return { params in return ImageFullWheelItemModel(type: .fetch(params)) { [weak self] (model, _) in - guard let `self` = self, + guard let self = self, case let .fetch(data) = model.type else { return } @@ -125,7 +125,7 @@ extension MainViewController { PHImageManager .default() .requestAVAsset(forVideo: asset, options: options, resultHandler: { [weak self] (asset, audioMix, info) in - guard let `self` = self, + guard let self = self, let urlAsset = asset as? AVURLAsset else { return } diff --git a/Nynja/Modules/Main/WireFrame/MainWireframe.swift b/Nynja/Modules/Main/WireFrame/MainWireframe.swift index cbb1e674e..57ed45ce1 100644 --- a/Nynja/Modules/Main/WireFrame/MainWireframe.swift +++ b/Nynja/Modules/Main/WireFrame/MainWireframe.swift @@ -71,7 +71,7 @@ class MainWireFrame: MainWireFrameProtocol, NynjaCommunicatorServiceDelegate { func showContacts() { PermissionManager().requestContactsPermission { [weak self] status in - guard let `self` = self, status == .authorized else { + guard let self = self, status == .authorized else { return } ContactsWireFrame().presentAllContacts(navigation: self.contentNavigation, mainWireFrame: self) diff --git a/Nynja/Modules/Message/Interactor/MessageInteractor+Forward.swift b/Nynja/Modules/Message/Interactor/MessageInteractor+Forward.swift index d7775cb51..2fc02c760 100644 --- a/Nynja/Modules/Message/Interactor/MessageInteractor+Forward.swift +++ b/Nynja/Modules/Message/Interactor/MessageInteractor+Forward.swift @@ -39,7 +39,7 @@ extension MessageInteractor { let messages = info.targets.messages(from: info.message, phoneId: phoneId) mqttService.forwardMessage(phoneId: phoneId, messages: messages) { [weak self] createdJob in - guard let `self` = self, let dbJob = DBJob(job: createdJob) else { return } + guard let self = self, let dbJob = DBJob(job: createdJob) else { return } dbJob.type = .forward diff --git a/Nynja/Modules/Message/Interactor/MessageInteractor+StorageSubscriber.swift b/Nynja/Modules/Message/Interactor/MessageInteractor+StorageSubscriber.swift index ace2b8b33..a4a0bab66 100644 --- a/Nynja/Modules/Message/Interactor/MessageInteractor+StorageSubscriber.swift +++ b/Nynja/Modules/Message/Interactor/MessageInteractor+StorageSubscriber.swift @@ -179,7 +179,7 @@ extension MessageInteractor { return } processingQueue.async { [weak self] in - guard let `self` = self else { return } + guard let self = self else { return } self.fetchFromStorage() } } else if isMessageExisted(message) { diff --git a/Nynja/Modules/Message/Interactor/MessageInteractor+Transcription.swift b/Nynja/Modules/Message/Interactor/MessageInteractor+Transcription.swift index cd59ca488..6c6692053 100644 --- a/Nynja/Modules/Message/Interactor/MessageInteractor+Transcription.swift +++ b/Nynja/Modules/Message/Interactor/MessageInteractor+Transcription.swift @@ -85,7 +85,7 @@ extension MessageInteractor: Transcription { func subscribeToTranscribeProcessing() { transcriptionService.observeState(self) { [weak self] localId, state, isAuto in - guard let `self` = self else { + guard let self = self else { return } diff --git a/Nynja/Modules/Message/Interactor/MessageInteractor.swift b/Nynja/Modules/Message/Interactor/MessageInteractor.swift index 2b624dc6e..466961e1d 100644 --- a/Nynja/Modules/Message/Interactor/MessageInteractor.swift +++ b/Nynja/Modules/Message/Interactor/MessageInteractor.swift @@ -274,7 +274,7 @@ final class MessageInteractor: BaseInteractor, MessageInteractorInputProtocol, H private func requestHistory(_ messageID: MessageServerId?) { processingQueue.async { [weak self] in - guard let `self` = self, let request = self.makeHistoryRequest(messageID) else { + guard let self = self, let request = self.makeHistoryRequest(messageID) else { return } self.mqttService.sendHistoryRequest(with: request) @@ -283,7 +283,7 @@ final class MessageInteractor: BaseInteractor, MessageInteractorInputProtocol, H private func requestHistory(from: MessageServerId, to: MessageServerId) { processingQueue.async { [weak self] in - guard let `self` = self, let phoneId = self.storageService.phoneId else { + guard let self = self, let phoneId = self.storageService.phoneId else { return } do { @@ -380,7 +380,7 @@ final class MessageInteractor: BaseInteractor, MessageInteractorInputProtocol, H func fetchMessages(from messageID: MessageServerId? = nil, isNew: Bool = false) { if !isNew { processingQueue.async { [weak self] in - guard let `self` = self else { return } + guard let self = self else { return } self.fetchFromStorage() } } @@ -928,7 +928,7 @@ final class MessageInteractor: BaseInteractor, MessageInteractorInputProtocol, H return } processingQueue.async { [weak self] in - guard let `self` = self else { return } + guard let self = self else { return } if self.isNew { self.fetchNewFromStorage() @@ -1069,7 +1069,7 @@ extension MessageInteractor { try? storageService.perform(action: .save, with: message) translate(message, lang: sendingLang) { [weak self] output in - guard let `self` = self else { return } + guard let self = self else { return } let translationDesc = self.messageFactory.autotranslationDesc(text: output.inputText, translatedText: output.translatedText, lang: output.translatedLang) var files = message.files?.filter { $0.type != .autotranslate } ?? [] files.append(translationDesc) diff --git a/Nynja/Modules/Message/Presenter/MessagePresenter.swift b/Nynja/Modules/Message/Presenter/MessagePresenter.swift index 2120d2bfe..228c26b66 100644 --- a/Nynja/Modules/Message/Presenter/MessagePresenter.swift +++ b/Nynja/Modules/Message/Presenter/MessagePresenter.swift @@ -318,7 +318,7 @@ class MessagePresenter: BasePresenter, MessagePresenterProtocol, MessageInteract selectorType: selectorType, selectedLang: language, selectorLang: { [weak self] selectedLang in - guard let `self` = self, let selectedLang = selectedLang else { + guard let self = self, let selectedLang = selectedLang else { return } self.interactor.translateMessage(localId: localId, @@ -330,7 +330,7 @@ class MessagePresenter: BasePresenter, MessagePresenterProtocol, MessageInteract selectorType: .transcribe, selectedLang: language, selectorLang: { [weak self] selectedLang in - guard let `self` = self, let selectedLang = selectedLang else { + guard let self = self, let selectedLang = selectedLang else { return } self.interactor.transcribeMessage(localId: localId, @@ -357,7 +357,7 @@ class MessagePresenter: BasePresenter, MessagePresenterProtocol, MessageInteract saveLangHandler: { [weak self] isNeedToSave, selectedLang in saveLangHandler?(isNeedToSave, selectedLang) - guard isNeedToSave, let `self` = self else { return } + guard isNeedToSave, let self = self else { return } self.interactor.setupSendingLanguage(lang: selectedLang) }) @@ -372,7 +372,7 @@ class MessagePresenter: BasePresenter, MessagePresenterProtocol, MessageInteract firstActionTitle: String.localizable.transcribeErrorAction, secondActionTitle: String.localizable.ok, firstAction: { [weak self] in - guard let `self` = self else { + guard let self = self else { return } self.showLanguageSelector(for: localId, with: language) @@ -386,7 +386,7 @@ class MessagePresenter: BasePresenter, MessagePresenterProtocol, MessageInteract selectorType: .transcribe, selectedLang: language, selectorLang: { [weak self] selectedLang in - guard let `self` = self, let selectedLang = selectedLang else { + guard let self = self, let selectedLang = selectedLang else { return } @@ -1115,7 +1115,7 @@ private extension MessagePresenter { } let deleteTransferConfirm: AlertActionWrapper = { [weak self] in - guard let `self` = self else { return } + guard let self = self else { return } let deleteAlert = self.chatScreenAlertFactory.makeOwnerDeleteOnlyForSelfMenuAlert(delete: deleteMessageForMe) self.wireFrame.show(alert: deleteAlert) } diff --git a/Nynja/Modules/Message/View/MessageVC.swift b/Nynja/Modules/Message/View/MessageVC.swift index 1eb41953f..bb43d67fe 100644 --- a/Nynja/Modules/Message/View/MessageVC.swift +++ b/Nynja/Modules/Message/View/MessageVC.swift @@ -145,7 +145,7 @@ final class MessageVC: BaseVC, MessageViewProtocol, ReplyPreviewDelegate, BackSw inputBar.displayMode = .new inputBar.newSendHandler = { [weak self] content in - guard let `self` = self else { + guard let self = self else { return } self.stickerInputState.clearSearchResult() @@ -162,7 +162,7 @@ final class MessageVC: BaseVC, MessageViewProtocol, ReplyPreviewDelegate, BackSw } inputBar.editSendHandler = { [weak self] content in - guard let `self` = self else { + guard let self = self else { return } switch content { @@ -174,7 +174,7 @@ final class MessageVC: BaseVC, MessageViewProtocol, ReplyPreviewDelegate, BackSw } inputBar.scheduleSendHandler = { [weak self] content in - guard let `self` = self else { return } + guard let self = self else { return } self.presenter.openSchedule(content: content, mentions: self.mentions) } @@ -562,7 +562,7 @@ final class MessageVC: BaseVC, MessageViewProtocol, ReplyPreviewDelegate, BackSw private func setupInputBarTextOutput() { inputBar.willSendHandler = { [weak self] _ in - guard let `self` = self else { return } + guard let self = self else { return } self.mentions = self.mentionController.mentions self.mentionController.reset() } @@ -577,7 +577,7 @@ final class MessageVC: BaseVC, MessageViewProtocol, ReplyPreviewDelegate, BackSw } inputBar.textRangeReplaceHandler = { [weak self] textView, range, replacementText in - guard let `self` = self else { return false } + guard let self = self else { return false } return self.handleReplacement(in: textView, range: range, replacementText: replacementText) } @@ -599,7 +599,7 @@ final class MessageVC: BaseVC, MessageViewProtocol, ReplyPreviewDelegate, BackSw } stickerSearchResultView.stickerPreviewHandler = { [weak self] previewState in - guard let `self` = self else { return } + guard let self = self else { return } if case .active = previewState { self.view.bringSubviewToFront(self.stickerPreviewContainerView) @@ -621,7 +621,7 @@ final class MessageVC: BaseVC, MessageViewProtocol, ReplyPreviewDelegate, BackSw } mentionController.textUpdateHandler = { [weak self] inputText, mentions in - guard let `self` = self else { return } + guard let self = self else { return } let attributedString = NSMutableAttributedString(string: inputText, attributes: self.defaultInputTextAttributes) for mention in mentions { @@ -654,7 +654,7 @@ final class MessageVC: BaseVC, MessageViewProtocol, ReplyPreviewDelegate, BackSw private func searchStickerByEmoji(_ emoji: String) { searchSticker { [weak self] in - guard let `self` = self, self.lastStickerSearchQuery != emoji else { + guard let self = self, self.lastStickerSearchQuery != emoji else { return } self.lastStickerSearchQuery = emoji @@ -667,7 +667,7 @@ final class MessageVC: BaseVC, MessageViewProtocol, ReplyPreviewDelegate, BackSw private func searchSticker(by filter: String) { searchSticker { [weak self] in - guard let `self` = self, self.lastStickerSearchQuery != filter else { + guard let self = self, self.lastStickerSearchQuery != filter else { return } self.lastStickerSearchQuery = filter @@ -788,7 +788,7 @@ final class MessageVC: BaseVC, MessageViewProtocol, ReplyPreviewDelegate, BackSw } stickerInputState.subscribe(on: .closeSearch) { [weak self] state in - guard let `self` = self else { return } + guard let self = self else { return } if case .stickerSearch = self.inputBar.displayMode { self.inputBar.displayMode = .new } @@ -800,7 +800,7 @@ final class MessageVC: BaseVC, MessageViewProtocol, ReplyPreviewDelegate, BackSw } stickerInputState.subscribe(on: .openSearchResult) { [weak self] state in - guard let `self` = self, let searchResult = state.searchResult else { + guard let self = self, let searchResult = state.searchResult else { return } guard state.isStickerSearchResultPresented else { @@ -1139,7 +1139,7 @@ final class MessageVC: BaseVC, MessageViewProtocol, ReplyPreviewDelegate, BackSw func update(sender: MessageSender, inMessagesWithIds messageIds: [String]) { dispatchAsyncMain { [weak self] in - guard let `self` = self else { + guard let self = self else { return } @@ -1788,7 +1788,7 @@ private extension MessageVC { }, displayingHandler: { [weak self] pandingState in - guard let `self` = self else { return } + guard let self = self else { return } if case .translating(_) = pandingState { self.inputBar.isEnabled = false } else { diff --git a/Nynja/Modules/Message/View/Views/CollectionView/Cells/Views/Message/MessageTextView.swift b/Nynja/Modules/Message/View/Views/CollectionView/Cells/Views/Message/MessageTextView.swift index 0fbd2dbe3..7b6c74301 100644 --- a/Nynja/Modules/Message/View/Views/CollectionView/Cells/Views/Message/MessageTextView.swift +++ b/Nynja/Modules/Message/View/Views/CollectionView/Cells/Views/Message/MessageTextView.swift @@ -170,7 +170,7 @@ final class MessageTextView: MessageContentView { mentionTapRecognizer.require(toFail: linkLongPressRecognizer) linkLongPressRecognizer.handler = { [weak self] link, range in - guard let `self` = self, let url = URL(string: link) else { + guard let self = self, let url = URL(string: link) else { return } self.delegate?.showMenuForURL(url) diff --git a/Nynja/Modules/OtherUser/View/OtherUserViewController.swift b/Nynja/Modules/OtherUser/View/OtherUserViewController.swift index 87459c2d4..c9202dbbc 100644 --- a/Nynja/Modules/OtherUser/View/OtherUserViewController.swift +++ b/Nynja/Modules/OtherUser/View/OtherUserViewController.swift @@ -54,7 +54,7 @@ class OtherUserViewController: BaseVC, OtherUserViewProtocol, SettingCellDelegat func setup(_ contact: Contact?) { let settings = HeaderSetting(contact: contact) { [weak self] in - guard let `self` = self else { + guard let self = self else { return } self.presenter.showAvatar(target: self.headerContentView.avatarImageView) diff --git a/Nynja/Modules/ScheduleMessage/View/ScheduleMessageViewController.swift b/Nynja/Modules/ScheduleMessage/View/ScheduleMessageViewController.swift index 4f692ec75..6b92e7567 100644 --- a/Nynja/Modules/ScheduleMessage/View/ScheduleMessageViewController.swift +++ b/Nynja/Modules/ScheduleMessage/View/ScheduleMessageViewController.swift @@ -266,7 +266,7 @@ final class ScheduleMessageViewController: BaseVC, ScheduleMessageViewProtocol, return true }, changeStateHandler: { [weak self] state in - guard let `self` = self, let audioModel = self.audioModel else { + guard let self = self, let audioModel = self.audioModel else { return } switch state { diff --git a/Nynja/Modules/Stickers/View/SearchResultView/StickerSearchResultView.swift b/Nynja/Modules/Stickers/View/SearchResultView/StickerSearchResultView.swift index 061abe1f3..160c05dbd 100644 --- a/Nynja/Modules/Stickers/View/SearchResultView/StickerSearchResultView.swift +++ b/Nynja/Modules/Stickers/View/SearchResultView/StickerSearchResultView.swift @@ -40,7 +40,7 @@ final class StickerSearchResultView: UIView, ScaleAnimatableGrid { var stickerPreviewHandler: ((StickerPreviewState) -> Void)? { didSet { previewHandler = { [weak self] state in - guard let `self` = self else { return } + guard let self = self else { return } switch state { case let .active(indexPath, image): if let sticker = self.content.item(at: indexPath) { diff --git a/Nynja/Modules/Wallet Flows/Payment/Interactor/PaymentInteractor.swift b/Nynja/Modules/Wallet Flows/Payment/Interactor/PaymentInteractor.swift index 313286a74..30fa11f83 100644 --- a/Nynja/Modules/Wallet Flows/Payment/Interactor/PaymentInteractor.swift +++ b/Nynja/Modules/Wallet Flows/Payment/Interactor/PaymentInteractor.swift @@ -41,7 +41,7 @@ final class PaymentInteractor: PaymentInteractorInputProtocol, SetInjectable { func sendCoins(with passcode: String, completion: @escaping (Error?) -> ()) { makeTransfer(passcode: passcode) { [weak self] (error) in - guard let `self` = self else { + guard let self = self else { return } @@ -69,7 +69,7 @@ final class PaymentInteractor: PaymentInteractorInputProtocol, SetInjectable { func setupWallet(with name: String?, passcode: String, completion: @escaping (Error?) -> ()) { walletService.getWallet(name: name, passcode: passcode) { [weak self] (result) in - guard let `self` = self else { + guard let self = self else { return } diff --git a/Nynja/Modules/Wallet Flows/Payment/Presenter/PaymentPresenter.swift b/Nynja/Modules/Wallet Flows/Payment/Presenter/PaymentPresenter.swift index 151ad0c6f..044d0d90e 100644 --- a/Nynja/Modules/Wallet Flows/Payment/Presenter/PaymentPresenter.swift +++ b/Nynja/Modules/Wallet Flows/Payment/Presenter/PaymentPresenter.swift @@ -55,7 +55,7 @@ final class PaymentPresenter: BasePresenter, SetInjectable, PaymentPresenterProt viewModel = [recipient, balance, amount, notes] dispatchAsyncMain { [weak self] in - guard let `self` = self else { + guard let self = self else { return } self.view.setup(with: self.viewModel) @@ -106,7 +106,7 @@ final class PaymentPresenter: BasePresenter, SetInjectable, PaymentPresenterProt self?.view.showActivityIndicator() } interactor.sendCoins(with: passcode) { [weak self] (error) in - guard let `self` = self else { + guard let self = self else { return } dispatchAsyncMain { diff --git a/Nynja/Modules/Wallet Flows/Payment/View/PaymentViewController.swift b/Nynja/Modules/Wallet Flows/Payment/View/PaymentViewController.swift index 6bf1fc6fd..262f8c377 100644 --- a/Nynja/Modules/Wallet Flows/Payment/View/PaymentViewController.swift +++ b/Nynja/Modules/Wallet Flows/Payment/View/PaymentViewController.swift @@ -224,7 +224,7 @@ extension PaymentViewController { cell?.textField.placeholder = cellModel.title cell?.textField.keyboardType = .numberPad cell?.textField.textChanged = { [weak self] input in - guard let `self` = self else { return } + guard let self = self else { return } let info = self.presenter.amountChanged(input.text) cell?.textField.info = info self.sendButton.isEnabled = (info == nil) diff --git a/Nynja/Modules/Wallet Flows/SeedBackup/Interactor/SeedBackupWalletInteractor.swift b/Nynja/Modules/Wallet Flows/SeedBackup/Interactor/SeedBackupWalletInteractor.swift index 7a0e8dcba..08944e577 100644 --- a/Nynja/Modules/Wallet Flows/SeedBackup/Interactor/SeedBackupWalletInteractor.swift +++ b/Nynja/Modules/Wallet Flows/SeedBackup/Interactor/SeedBackupWalletInteractor.swift @@ -22,7 +22,7 @@ extension SeedBackupWalletInteractor { func getSeeds(completion: (([String]) -> ())) { walletService.makeMnemonics() { [weak self] result in - guard let `self` = self else { + guard let self = self else { return } diff --git a/Nynja/Modules/Wallet Flows/WalletBalances/Presenter/WalletBalancesPresenter.swift b/Nynja/Modules/Wallet Flows/WalletBalances/Presenter/WalletBalancesPresenter.swift index 73190c73f..d6dbc8bb0 100644 --- a/Nynja/Modules/Wallet Flows/WalletBalances/Presenter/WalletBalancesPresenter.swift +++ b/Nynja/Modules/Wallet Flows/WalletBalances/Presenter/WalletBalancesPresenter.swift @@ -46,7 +46,7 @@ WalletBalancesInteractorOutputProtocol, SetInjectable { view.showWalletFetchInProgress() let name = interactor.getWalletName() interactor.getWallet(name: name, passcode: passcode) { [weak self] (wallet, error) in - guard let `self` = self else { + guard let self = self else { return } diff --git a/Nynja/Services/Audio/AudioSessionManager/AudioSessionManager.swift b/Nynja/Services/Audio/AudioSessionManager/AudioSessionManager.swift index 12a4aa5b7..bf2b2b415 100644 --- a/Nynja/Services/Audio/AudioSessionManager/AudioSessionManager.swift +++ b/Nynja/Services/Audio/AudioSessionManager/AudioSessionManager.swift @@ -32,7 +32,7 @@ final class AudioSessionManager { } set { dispatchQueue.async(flags: .barrier) { [weak self] in - guard let `self` = self, self._speaker != newValue else { + guard let self = self, self._speaker != newValue else { return } diff --git a/Nynja/Services/Debug/SMSCodeProvider/SMSCodeProvider.swift b/Nynja/Services/Debug/SMSCodeProvider/SMSCodeProvider.swift index 9115ed696..f25a12fb6 100644 --- a/Nynja/Services/Debug/SMSCodeProvider/SMSCodeProvider.swift +++ b/Nynja/Services/Debug/SMSCodeProvider/SMSCodeProvider.swift @@ -24,11 +24,9 @@ class SMSCodeProvider: SMSCodeProviding { let session = URLSession.shared let task = session.dataTask(with: req, completionHandler: { [weak self] (data, resp, err) in - guard let `self` = self, - data != nil else { - return + guard let self = self, data != nil else { + return } - do { if let todoJSON = try JSONSerialization.jsonObject(with: data!, options: []) as? [[String: Any]] { for i in todoJSON { diff --git a/Nynja/Services/ResourceManager/ResourceManager.swift b/Nynja/Services/ResourceManager/ResourceManager.swift index adfb496a1..5ec518236 100644 --- a/Nynja/Services/ResourceManager/ResourceManager.swift +++ b/Nynja/Services/ResourceManager/ResourceManager.swift @@ -150,7 +150,7 @@ extension ResourceManager { func fetchMedia(completion: @escaping GalleryResourceFetchCompletion, failure: @escaping GalleryResourceFetchFailure) { requestPermission( completion: { [weak self] in - guard let `self` = self else { + guard let self = self else { return } @@ -189,7 +189,7 @@ extension ResourceManager { func fetchCollections(completion: @escaping GalleryResourceFetchCompletion, failure: @escaping GalleryResourceFetchFailure) { requestPermission(completion: { [weak self] in - guard let `self` = self else { + guard let self = self else { return } @@ -212,7 +212,7 @@ extension ResourceManager { for item in items { let operation = AsyncBlockOperation { [weak self] (operation) in - guard let `self` = self else { + guard let self = self else { operation.state = .finished return } diff --git a/Nynja/Services/TranscribeService/Operations /AudioLongTranscribeProccessingOperation.swift b/Nynja/Services/TranscribeService/Operations /AudioLongTranscribeProccessingOperation.swift index cd8b26224..55e647aec 100644 --- a/Nynja/Services/TranscribeService/Operations /AudioLongTranscribeProccessingOperation.swift +++ b/Nynja/Services/TranscribeService/Operations /AudioLongTranscribeProccessingOperation.swift @@ -57,7 +57,7 @@ final class AudioLongTranscribeProccessingOperation: TranscribeOperation, Initia private func transcribeLongOperation(with name: String) { let processingTask = networkService.loadTranscriptionProcessingResult(name: name) { [weak self] result in - guard let `self` = self else { + guard let self = self else { return } switch result { diff --git a/Nynja/Services/TranscribeService/TranscribeService.swift b/Nynja/Services/TranscribeService/TranscribeService.swift index 00cc35c04..c8b27e6eb 100644 --- a/Nynja/Services/TranscribeService/TranscribeService.swift +++ b/Nynja/Services/TranscribeService/TranscribeService.swift @@ -145,7 +145,7 @@ extension TranscribeService: TranscribeServiceProtocol { let dataWrapper = TranscribeServiceDataWrapper() let completion: TranscribeProcessingInnerHandler = { [weak self] state in - guard let `self` = self else { + guard let self = self else { return } process = self.updateProcessing(process, data: dataWrapper, state: state) @@ -200,7 +200,7 @@ extension TranscribeService: TranscribeServiceProtocol { dataWrapper.processingResult = convert.value let completion: TranscribeProcessingInnerHandler = { [weak self] state in - guard let `self` = self else { + guard let self = self else { return } convert = self.updateProcessing(convert, data: dataWrapper, state: state) -- GitLab From 4d6804c9b10ad358f527165842d1682d87e76815 Mon Sep 17 00:00:00 2001 From: Anton Poltoratskyi Date: Thu, 1 Nov 2018 23:56:59 +0200 Subject: [PATCH 15/27] [NY-4362] Enable assertion for dev scheme in NynjaUIKit --- Frameworks/NynjaUIKit/NynjaUIKit.xcodeproj/project.pbxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Frameworks/NynjaUIKit/NynjaUIKit.xcodeproj/project.pbxproj b/Frameworks/NynjaUIKit/NynjaUIKit.xcodeproj/project.pbxproj index cd6117c74..81dbc5156 100644 --- a/Frameworks/NynjaUIKit/NynjaUIKit.xcodeproj/project.pbxproj +++ b/Frameworks/NynjaUIKit/NynjaUIKit.xcodeproj/project.pbxproj @@ -471,7 +471,7 @@ COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; + ENABLE_NS_ASSERTIONS = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; -- GitLab From 9113c53ccf81d2aa574de8f70e5ec610db47a634 Mon Sep 17 00:00:00 2001 From: Anton Poltoratskyi Date: Fri, 2 Nov 2018 00:00:36 +0200 Subject: [PATCH 16/27] [NY-4362] Remove unused ImagePickerHandler.SendingType --- Nynja/Modules/Main/View/MainViewController.swift | 8 -------- Nynja/Utils/ImagePickerHandler.swift | 10 ---------- 2 files changed, 18 deletions(-) diff --git a/Nynja/Modules/Main/View/MainViewController.swift b/Nynja/Modules/Main/View/MainViewController.swift index 792f0576b..abfb2276f 100644 --- a/Nynja/Modules/Main/View/MainViewController.swift +++ b/Nynja/Modules/Main/View/MainViewController.swift @@ -577,14 +577,6 @@ class MainViewController: BaseVC, MainViewProtocol, HitTestDelegate, UINavigatio }) } } - //FIXME: sending type - /* else if let pickedImage = info[.originalImage] as? UIImage, - let sendingType = info[ImagePickerHandler.SendingType.key] as? ImagePickerHandler.SendingType { - switch sendingType { - case .default: send(image: pickedImage) - case .asFile: send(image: pickedImage) - } - } */ } func send(image: UIImage) { diff --git a/Nynja/Utils/ImagePickerHandler.swift b/Nynja/Utils/ImagePickerHandler.swift index e8d237a99..82fc248ec 100644 --- a/Nynja/Utils/ImagePickerHandler.swift +++ b/Nynja/Utils/ImagePickerHandler.swift @@ -8,18 +8,8 @@ import UIKit -/* - Used in order to avoid assign MainViewController as UINavigationControllerDelegate of UIImagePickerController's delegate property. - */ public final class ImagePickerHandler: NSObject, UIImagePickerControllerDelegate, UINavigationControllerDelegate { - enum SendingType: String { - case `default` - case asFile - -// static let key = "SendingType" - } - public var onFinishPickingMedia: ((UIImagePickerController, [UIImagePickerController.InfoKey : Any]) -> Void)? public var onCancel: ((UIImagePickerController) -> Void)? -- GitLab From be1bd08511c569c25b66b0df7d4308f20615ff79 Mon Sep 17 00:00:00 2001 From: Anton Poltoratskyi Date: Sat, 3 Nov 2018 00:10:58 +0200 Subject: [PATCH 17/27] [NY-4362] Remove unused extensions. --- .../SwiftLibrary/Array/Array+UIView.swift | 2 +- .../SwiftLibrary/Array/ArrayExtension.swift | 22 +++++-------------- .../Request/HTTPHeader+Authorization.swift | 6 ----- 3 files changed, 6 insertions(+), 24 deletions(-) diff --git a/Nynja/Extensions/SwiftLibrary/Array/Array+UIView.swift b/Nynja/Extensions/SwiftLibrary/Array/Array+UIView.swift index 678c0501c..4610e1cb2 100644 --- a/Nynja/Extensions/SwiftLibrary/Array/Array+UIView.swift +++ b/Nynja/Extensions/SwiftLibrary/Array/Array+UIView.swift @@ -7,6 +7,7 @@ // import UIKit + extension Array where Element: UIView { func activate() {} @@ -14,5 +15,4 @@ extension Array where Element: UIView { func removeFromSuperview() { self.forEach { $0.removeFromSuperview() } } - } diff --git a/Nynja/Extensions/SwiftLibrary/Array/ArrayExtension.swift b/Nynja/Extensions/SwiftLibrary/Array/ArrayExtension.swift index ae063c708..396b31f6c 100644 --- a/Nynja/Extensions/SwiftLibrary/Array/ArrayExtension.swift +++ b/Nynja/Extensions/SwiftLibrary/Array/ArrayExtension.swift @@ -9,30 +9,19 @@ extension Array where Element: Equatable { mutating func remove(_ element: Element) { - guard let index = self.index(of: element) else { + guard let index = index(of: element) else { return } - - self.remove(at: index) - } - - mutating func remove(contentsOf elements: C) where C.Iterator.Element == Element { - elements.forEach { self.remove($0) } + remove(at: index) } } extension Array { - - mutating func removeAll(where predicate: (Element) -> Bool) { - self = filter { !predicate($0) } - } - + func count(where predicate: (Element) -> Bool) -> Int { var count = 0 - for element in self { - if predicate(element) { - count += 1 - } + for element in self where predicate(element) { + count += 1 } return count } @@ -60,5 +49,4 @@ extension Array { temp.complete(to: length, with: element) return temp } - } diff --git a/Nynja/Services/REST/NetworkHTTPClient/Request/HTTPHeader+Authorization.swift b/Nynja/Services/REST/NetworkHTTPClient/Request/HTTPHeader+Authorization.swift index 048f489b7..e5de0146d 100644 --- a/Nynja/Services/REST/NetworkHTTPClient/Request/HTTPHeader+Authorization.swift +++ b/Nynja/Services/REST/NetworkHTTPClient/Request/HTTPHeader+Authorization.swift @@ -9,9 +9,3 @@ import Foundation typealias HTTPHeaders = [String: String] - -extension Dictionary where Key == Value, Key == String { - static func authorization(_ token: String) -> [String: String] { - return ["Authorization": "Bearer \(token)"] - } -} -- GitLab From e31028aa4643abe85d2a7605c3d963393ebb5515 Mon Sep 17 00:00:00 2001 From: Anton Poltoratskyi Date: Sat, 3 Nov 2018 01:40:40 +0200 Subject: [PATCH 18/27] [NY-4362] Added BERTEncodable. Remove some code duplication from bert encoding logic. --- Nynja.xcodeproj/project.pbxproj | 16 ++--- Nynja/Extensions/FriendExtansion+BERT.swift | 28 +++------ Nynja/Extensions/JobExtension+BERT.swift | 20 ++----- Nynja/Extensions/LinkExtension+Bert.swift | 6 +- Nynja/Extensions/MemberExtension+BERT.swift | 38 ++++++------ .../SwiftLibrary/Array/Array+Feature.swift | 22 ------- Nynja/Extensions/actExtension+BERT.swift | 2 +- Nynja/MQTTModels/DescExtension+BERT.swift | 14 ++--- Nynja/MQTTModels/FeatureExtension+BERT.swift | 7 +-- Nynja/MQTTModels/MessageExtension+BERT.swift | 20 +++---- Nynja/MQTTModels/RoomExtension+BERT.swift | 38 ++---------- Nynja/MQTTModels/TypingExtension+BERT.swift | 3 +- Nynja/MQTTModels/p2pExtension+BERT.swift | 3 +- Nynja/ServerModel/Source/BERTEncodable.swift | 60 +++++++++++++++++++ .../Source/BertBinConvertible.swift | 6 +- Nynja/Services/MQTT/StarExtension+BERT.swift | 18 +++--- Nynja/Services/Models/AuthModel.swift | 7 +-- Nynja/mucExtension+BERT.swift | 7 +-- 18 files changed, 151 insertions(+), 164 deletions(-) delete mode 100644 Nynja/Extensions/SwiftLibrary/Array/Array+Feature.swift create mode 100644 Nynja/ServerModel/Source/BERTEncodable.swift diff --git a/Nynja.xcodeproj/project.pbxproj b/Nynja.xcodeproj/project.pbxproj index 26a6c8460..1d0451820 100644 --- a/Nynja.xcodeproj/project.pbxproj +++ b/Nynja.xcodeproj/project.pbxproj @@ -146,7 +146,6 @@ 260552A61F9E1CD100D68DE6 /* SearchHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 260552A51F9E1CD100D68DE6 /* SearchHandler.swift */; }; 260629712056EF2800CB8F65 /* LinksCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 260629702056EF2800CB8F65 /* LinksCell.swift */; }; 2606F3BC20BFE20500CF7F15 /* MessageInteractor+Translation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2606F3BB20BFE20400CF7F15 /* MessageInteractor+Translation.swift */; }; - 2610D4642076516900E6E2B2 /* Array+Feature.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26DCB25320692237001EF0AB /* Array+Feature.swift */; }; 26131E02210399BA00BE94F9 /* TranscribeService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26131E01210399BA00BE94F9 /* TranscribeService.swift */; }; 26142B1120472ECD004E5FE4 /* MessageLinkTable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26142B1020472ECD004E5FE4 /* MessageLinkTable.swift */; }; 26142B1320473BFD004E5FE4 /* DBMessageLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26142B1220473BFD004E5FE4 /* DBMessageLink.swift */; }; @@ -415,7 +414,6 @@ 26DCB24E2064B9DC001EF0AB /* ContactsTableDS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26DCB24D2064B9DB001EF0AB /* ContactsTableDS.swift */; }; 26DCB2502064BA3D001EF0AB /* ContactsPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26DCB24F2064BA3D001EF0AB /* ContactsPresenter.swift */; }; 26DCB2522064BA46001EF0AB /* ContactsInteractor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26DCB2512064BA46001EF0AB /* ContactsInteractor.swift */; }; - 26DCB25420692237001EF0AB /* Array+Feature.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26DCB25320692237001EF0AB /* Array+Feature.swift */; }; 26DCB256206924B3001EF0AB /* FeatureFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26DCB255206924B3001EF0AB /* FeatureFactory.swift */; }; 26DE8D9120FE1AF500C41096 /* ChatCellFooterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26DE8D9020FE1AF500C41096 /* ChatCellFooterView.swift */; }; 26E0C44721469E9800A58ECD /* ConnectionService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26E0C44621469E9800A58ECD /* ConnectionService.swift */; }; @@ -849,6 +847,9 @@ 8511D3712034427F00B2A620 /* UIView+SafeArea.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8511D3702034427F00B2A620 /* UIView+SafeArea.swift */; }; 8511D3742034596E00B2A620 /* Collection+ViewLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8511D3732034596E00B2A620 /* Collection+ViewLayout.swift */; }; 8512349221221B9E000129A2 /* Collection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8512349121221B9E000129A2 /* Collection.swift */; }; + 8513F06C218D053F003B901B /* BERTEncodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8513F06B218D053F003B901B /* BERTEncodable.swift */; }; + 8513F071218D0753003B901B /* BERTEncodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8513F06B218D053F003B901B /* BERTEncodable.swift */; }; + 8513F072218D0753003B901B /* BERTEncodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8513F06B218D053F003B901B /* BERTEncodable.swift */; }; 8514D52220EE48930002378A /* NynjaContextMenuItemsFactory+Design.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8514D52120EE48930002378A /* NynjaContextMenuItemsFactory+Design.swift */; }; 8514D52420EE48A30002378A /* NynjaContextMenuItemsFactory+Messages.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8514D52320EE48A30002378A /* NynjaContextMenuItemsFactory+Messages.swift */; }; 8514DE892136A50100718DD8 /* DBStarAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8514DE882136A50100718DD8 /* DBStarAction.swift */; }; @@ -2702,7 +2703,6 @@ 26DCB24D2064B9DB001EF0AB /* ContactsTableDS.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContactsTableDS.swift; sourceTree = ""; }; 26DCB24F2064BA3D001EF0AB /* ContactsPresenter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContactsPresenter.swift; sourceTree = ""; }; 26DCB2512064BA46001EF0AB /* ContactsInteractor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContactsInteractor.swift; sourceTree = ""; }; - 26DCB25320692237001EF0AB /* Array+Feature.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Array+Feature.swift"; sourceTree = ""; }; 26DCB255206924B3001EF0AB /* FeatureFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = FeatureFactory.swift; path = Services/FeatureFactory.swift; sourceTree = ""; }; 26DE8D9020FE1AF500C41096 /* ChatCellFooterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatCellFooterView.swift; sourceTree = ""; }; 26E0C44621469E9800A58ECD /* ConnectionService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ConnectionService.swift; path = Services/ConnectionService.swift; sourceTree = ""; }; @@ -3098,6 +3098,7 @@ 8511D3702034427F00B2A620 /* UIView+SafeArea.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+SafeArea.swift"; sourceTree = ""; }; 8511D3732034596E00B2A620 /* Collection+ViewLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Collection+ViewLayout.swift"; sourceTree = ""; }; 8512349121221B9E000129A2 /* Collection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Collection.swift; sourceTree = ""; }; + 8513F06B218D053F003B901B /* BERTEncodable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BERTEncodable.swift; sourceTree = ""; }; 8514D52120EE48930002378A /* NynjaContextMenuItemsFactory+Design.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NynjaContextMenuItemsFactory+Design.swift"; sourceTree = ""; }; 8514D52320EE48A30002378A /* NynjaContextMenuItemsFactory+Messages.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NynjaContextMenuItemsFactory+Messages.swift"; sourceTree = ""; }; 8514DE882136A50100718DD8 /* DBStarAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DBStarAction.swift; sourceTree = ""; }; @@ -9825,9 +9826,10 @@ children = ( A42CE50820692EDA000889CC /* Decoder.swift */, A42CE50920692EDA000889CC /* Bert.swift */, - 852003F920D459E9007C0036 /* BertBinConvertible.swift */, A42CE50A20692EDA000889CC /* StringAtom.swift */, A42CE50B20692EDA000889CC /* TypeSpec.swift */, + 852003F920D459E9007C0036 /* BertBinConvertible.swift */, + 8513F06B218D053F003B901B /* BERTEncodable.swift */, ); path = Source; sourceTree = ""; @@ -12355,7 +12357,6 @@ 8551CF1021708F7500829CF1 /* Array+Desc.swift */, 4B1D7E102029FF5000703228 /* Array+WheelItemModel.swift */, 4B4266C2204D923400194BC1 /* Array+UIView.swift */, - 26DCB25320692237001EF0AB /* Array+Feature.swift */, ); path = Array; sourceTree = ""; @@ -14490,7 +14491,6 @@ A42CE55220692EDB000889CC /* act.swift in Sources */, A42CE5DA20692EDB000889CC /* p2p_Spec.swift in Sources */, A4A2424F2060390000B0A804 /* Handlers.swift in Sources */, - 2610D4642076516900E6E2B2 /* Array+Feature.swift in Sources */, 262D4389203352D4002F1E45 /* FriendExtansion+BERT.swift in Sources */, A42CE5A220692EDB000889CC /* operation.swift in Sources */, A42D519B206A34E200EEB952 /* IoHandler.swift in Sources */, @@ -14534,6 +14534,7 @@ A42CE5E420692EDB000889CC /* Feature_Spec.swift in Sources */, 26C0C1D82073CD2E00C530DA /* ForwardTargets.swift in Sources */, A4F3DAB82084967500FF71C7 /* CGContext+Gradient.swift in Sources */, + 8513F071218D0753003B901B /* BERTEncodable.swift in Sources */, 26C0C1EA2073DBDB00C530DA /* SelectionAvatarView.swift in Sources */, 26C0C1C22073C74D00C530DA /* LabelExtensions.swift in Sources */, 8524C4D321777157003BF374 /* Member+Status.swift in Sources */, @@ -15426,6 +15427,7 @@ 85380EE62109FF340048042D /* IdentifierComponentValue.swift in Sources */, F10AFEB920F7B1B000C7CE83 /* WheelMapItemPreview.swift in Sources */, 267BE2AE1FE13AB600C47E18 /* ParticipantsInteractor.swift in Sources */, + 8513F06C218D053F003B901B /* BERTEncodable.swift in Sources */, 850C301F204DA87A00DB26C2 /* PrivacyListWireFrame.swift in Sources */, 858BC123203320BB0022EB25 /* ForwardSelectorDataSource.swift in Sources */, 850571232050B0AD00EDF794 /* NotificationAlertSoundsProtocols.swift in Sources */, @@ -15623,7 +15625,6 @@ 85150C2620BE9EA3005D311A /* StickerDetailsPreviewView.swift in Sources */, 0062D9432062EC4100B915AC /* ShareNynjaHeaderViewLayout.swift in Sources */, A42D52B9206A53AA00EEB952 /* Profile_Spec.swift in Sources */, - 26DCB25420692237001EF0AB /* Array+Feature.swift in Sources */, F1607B2E20B2DE8A00BDF60A /* CameraQRPreviewInteractor.swift in Sources */, B77C11EA2109254800CCB42E /* InterpretationTypeWireFrame.swift in Sources */, B7F4C2AC211995D500E48A98 /* UseCaseValidationService.swift in Sources */, @@ -16635,6 +16636,7 @@ 4B752B5E2163A4F900E852B9 /* GApiResponse.swift in Sources */, FB816EF020B5B36D00093DCD /* HistoryRequestModelTests.swift in Sources */, 85458CEA212D742300BA8814 /* muc.swift in Sources */, + 8513F072218D0753003B901B /* BERTEncodable.swift in Sources */, A4CB153B21039C1100C3B68B /* JailbreakDetectorProtocol.swift in Sources */, 4BF090B621635B3000DCCA5C /* LogServiceStub.swift in Sources */, 4B8C05952164A9D60034D8F3 /* ChatCellModelMock.swift in Sources */, diff --git a/Nynja/Extensions/FriendExtansion+BERT.swift b/Nynja/Extensions/FriendExtansion+BERT.swift index baee2d550..88b82c192 100644 --- a/Nynja/Extensions/FriendExtansion+BERT.swift +++ b/Nynja/Extensions/FriendExtansion+BERT.swift @@ -6,33 +6,23 @@ // Copyright © 2018 TecSynt Solutions. All rights reserved. // -extension Friend { +extension Friend: BERTEncodable { func getBert() -> BertObject { let topic = BertAtom(fromString: "Friend") let _phoneId = Bert.getBin(self.phone_id) let _friendId = Bert.getBin(self.friend_id) - var _settings : BertObject = BertNil() - if let settings = self.settings { - var _settingsData = [BertObject]() - for i in settings { - let _d = i.getBert() - _settingsData.append(_d) - } - _settings = BertList(fromElements: _settingsData) - } - - var _status: BertObject = BertAtom(fromString: "") + let _settings = self.settings.getBert() + + let _status: BertObject if let st = self.status as? String { _status = BertAtom(fromString: st) - } else if let st = self.status as? StringAtom { - if let strSt = st.string { - _status = BertAtom(fromString: strSt) - } + } else if let st = self.status as? StringAtom, let strSt = st.string { + _status = BertAtom(fromString: strSt) + } else { + _status = BertAtom(fromString: "") } - let result = BertTuple(fromElements: [topic, _phoneId, _friendId, _settings, _status]) - - return result + return BertTuple(fromElements: [topic, _phoneId, _friendId, _settings, _status]) } } diff --git a/Nynja/Extensions/JobExtension+BERT.swift b/Nynja/Extensions/JobExtension+BERT.swift index 7f46dd6e9..a8dc8035f 100644 --- a/Nynja/Extensions/JobExtension+BERT.swift +++ b/Nynja/Extensions/JobExtension+BERT.swift @@ -8,7 +8,7 @@ import Foundation -extension Job { +extension Job: BERTEncodable { func getBert() -> BertObject { let _topic = BertAtom(fromString: "Job") @@ -22,7 +22,7 @@ extension Job { let _prev = Bert.getBin(self.prev) let _next = Bert.getBin(self.next) let _time = Bert.getBin(self.time) - var _data : BertObject = BertNil() + let _data : BertObject if let data = self.data { var _dataData = [BertObject]() for i in data { @@ -30,22 +30,14 @@ extension Job { _dataData.append(_d) } _data = BertList(fromElements: _dataData) + } else { + _data = BertNil() } - var _settings : BertObject = BertNil() - if let settings = self.settings { - var _settingsData = [BertObject]() - for i in settings { - let _d = i.getBert() - _settingsData.append(_d) - } - _settings = BertList(fromElements: _settingsData) - } + let _settings = self.settings.getBert() + let statusString = (self.status as? StringAtom)?.string ?? (self.status as? String) let _status = BertAtom(fromString: statusString ?? "") let model = BertTuple(fromElements: [_topic, _id, _container, _feed_id, _next, _prev, BertNil(), BertNil(), _time, _data, BertNil(), _settings, _status]) return model } - } - - diff --git a/Nynja/Extensions/LinkExtension+Bert.swift b/Nynja/Extensions/LinkExtension+Bert.swift index bf672b0f3..e357cf1a5 100644 --- a/Nynja/Extensions/LinkExtension+Bert.swift +++ b/Nynja/Extensions/LinkExtension+Bert.swift @@ -6,7 +6,7 @@ // Copyright © 2018 TecSynt Solutions. All rights reserved. // -extension Link { +extension Link: BERTEncodable { func getBert() -> BertObject { let _topic = BertAtom(fromString: "Link") @@ -15,9 +15,11 @@ extension Link { let _room_id = Bert.getBin(room_id) let _created = Bert.getBin(created) - var _status: BertObject = BertNil() + let _status: BertObject if let statusString = StringAtom.string(status) { _status = BertAtom(fromString: statusString) + } else { + _status = BertNil() } let model = BertTuple(fromElements: [_topic, diff --git a/Nynja/Extensions/MemberExtension+BERT.swift b/Nynja/Extensions/MemberExtension+BERT.swift index 10c4d72a1..909525893 100644 --- a/Nynja/Extensions/MemberExtension+BERT.swift +++ b/Nynja/Extensions/MemberExtension+BERT.swift @@ -8,7 +8,7 @@ import Foundation -extension Member { +extension Member: BERTEncodable { func getBert() -> BertObject { let topic = BertAtom(fromString: "Member") @@ -21,40 +21,40 @@ extension Member { let _feeds = BertNil() let _avatar = Bert.getBin(self.avatar) let _names = Bert.getBin(self.names) - var _surnames: BertObject = BertNil() + let _surnames: BertObject if let lname = self.surnames, lname != "" { _surnames = Bert.getBin(lname) + } else { + _surnames = BertNil() } let _alias = Bert.getBin(self.alias) - var _reader: BertObject = BertNumber(fromInt64: 0) + let _reader: BertObject if let r = self.reader { _reader = Bert.getBin(r) + } else { + _reader = BertNumber(fromInt64: 0) } - var _update: BertObject = BertNumber(fromInt64: 0) + let _update: BertObject if let u = self.update { _update = BertNumber(fromInt64: u) + } else { + _update = BertNumber(fromInt64: 0) } - var _settings : BertObject = BertNil() - if let settings = self.settings { - var _settingsData = [BertObject]() - for i in settings { - let _d = i.getBert() - _settingsData.append(_d) - } - _settings = BertList(fromElements: _settingsData) - } + let _settings = self.settings.getBert() - var _presence: BertObject = BertNil() + let _presence: BertObject if let pres = self.presence as? String { _presence = BertAtom(fromString: pres) + } else { + _presence = BertNil() } - var _status: BertObject = BertAtom(fromString: "member") + let _status: BertObject if let st = self.status as? String { _status = BertAtom(fromString: st) - } else if let st = self.status as? StringAtom { - if let strSt = st.string { - _status = BertAtom(fromString: strSt) - } + } else if let st = self.status as? StringAtom, let strSt = st.string { + _status = BertAtom(fromString: strSt) + } else { + _status = BertAtom(fromString: "member") } let services : BertObject = BertNil() diff --git a/Nynja/Extensions/SwiftLibrary/Array/Array+Feature.swift b/Nynja/Extensions/SwiftLibrary/Array/Array+Feature.swift deleted file mode 100644 index c54a3bb84..000000000 --- a/Nynja/Extensions/SwiftLibrary/Array/Array+Feature.swift +++ /dev/null @@ -1,22 +0,0 @@ -// -// Array+Feature.swift -// Nynja -// -// Created by Anton M on 26.03.2018. -// Copyright © 2018 TecSynt Solutions. All rights reserved. -// - -import Foundation - -extension Array where Element == Feature { - - func getBert() -> BertObject { - let list = self.map { (feature) -> BertObject in - return feature.getBert() - } - let result = BertList(fromElements: list) - return result - } - -} - diff --git a/Nynja/Extensions/actExtension+BERT.swift b/Nynja/Extensions/actExtension+BERT.swift index eb9582cff..64d8c0a55 100644 --- a/Nynja/Extensions/actExtension+BERT.swift +++ b/Nynja/Extensions/actExtension+BERT.swift @@ -8,7 +8,7 @@ import Foundation -extension act { +extension act: BERTEncodable { func getBert() -> BertObject { let _type = BertAtom(fromString: "act") diff --git a/Nynja/MQTTModels/DescExtension+BERT.swift b/Nynja/MQTTModels/DescExtension+BERT.swift index b54e87761..79226ca3d 100644 --- a/Nynja/MQTTModels/DescExtension+BERT.swift +++ b/Nynja/MQTTModels/DescExtension+BERT.swift @@ -8,21 +8,17 @@ import Foundation -extension Desc { +extension Desc: BERTEncodable { + func getBert() -> BertObject { let topic = BertAtom(fromString: "Desc") let _id = Bert.getBin(self.id) let _mime = Bert.getBin(self.mime) let _payload = Bert.getBin(self.payload) let _parentId = Bert.getBin(self.parentid) - var _data: BertObject = BertNil() - if let data = self.data { - var _descData = [BertObject]() - for i in data { - _descData.append(i.getBert()) - } - _data = BertList(fromElements: _descData) - } + + let _data = self.data.getBert() + return BertTuple(fromElements: [topic, _id, _mime,_payload,_parentId,_data]) } } diff --git a/Nynja/MQTTModels/FeatureExtension+BERT.swift b/Nynja/MQTTModels/FeatureExtension+BERT.swift index 2de47fd57..3520574e7 100644 --- a/Nynja/MQTTModels/FeatureExtension+BERT.swift +++ b/Nynja/MQTTModels/FeatureExtension+BERT.swift @@ -8,7 +8,7 @@ import Foundation -extension Feature { +extension Feature: BERTEncodable { func getBert() -> BertObject { let topic = BertAtom(fromString: "Feature") @@ -17,9 +17,6 @@ extension Feature { let _value = Bert.getBin(self.value) let _group = Bert.getBin(self.group) - let model = BertTuple(fromElements: [topic,_id,_key,_value,_group]) - - return model + return BertTuple(fromElements: [topic,_id,_key,_value,_group]) } } - diff --git a/Nynja/MQTTModels/MessageExtension+BERT.swift b/Nynja/MQTTModels/MessageExtension+BERT.swift index b8fe8b296..d93009058 100644 --- a/Nynja/MQTTModels/MessageExtension+BERT.swift +++ b/Nynja/MQTTModels/MessageExtension+BERT.swift @@ -8,9 +8,13 @@ import Foundation -extension Message { +extension Message: BERTEncodable { - func getBert(chain: String? = "chain") -> BertObject { + func getBert() -> BertObject { + return getBert(chain: "chain") + } + + func getBert(chain: String?) -> BertObject { let topic = BertAtom(fromString: "Message") let _from = Bert.getBin(self.from) let _to = Bert.getBin(self.to) @@ -57,17 +61,7 @@ extension Message { _created = BertNil() } - let attachments: BertObject - if let descs = self.files, descs.count > 0 { - var att = [BertObject]() - for i in descs { - let desc = i.getBert() - att.append(desc) - } - attachments = BertList(fromElements: att) - } else { - attachments = BertNil() - } + let attachments = self.files.getBertOrNil() let types: BertObject if !self.types.isEmpty { diff --git a/Nynja/MQTTModels/RoomExtension+BERT.swift b/Nynja/MQTTModels/RoomExtension+BERT.swift index a69ec793a..cb7131681 100644 --- a/Nynja/MQTTModels/RoomExtension+BERT.swift +++ b/Nynja/MQTTModels/RoomExtension+BERT.swift @@ -8,15 +8,15 @@ import Foundation -extension Room { +extension Room: BERTEncodable { func getBert() -> BertObject { let topic = BertAtom(fromString: "Room") var _name: BertObject = BertNil() let _id = Bert.getBin(self.id) - var _data: BertObject = BertNil() - var _members: BertObject = BertNil() - var _admins: BertObject = BertNil() + let _data: BertObject = self.data.getBert() + let _members: BertObject = self.members.getBert() + let _admins: BertObject = self.admins.getBert() let _status = BertAtom(fromString: (self.status as? String ?? "")) let _description = Bert.getBin(self.description) let _tos = Bert.getBin(self.tos) @@ -30,40 +30,12 @@ extension Room { if let name = self.name { _name = Bert.getBin(name) } - if let dat = self.data { - var _bData = [BertObject]() - for i in dat { - let _d = i.getBert() - _bData.append(_d) - } - _data = BertList(fromElements: _bData) - } - - if let memrs = self.members { - var _memData = [BertObject]() - for i in memrs { - let _d = i.getBert() - _memData.append(_d) - } - _members = BertList(fromElements: _memData) - } - - if let adms = self.admins { - var _admData = [BertObject]() - for i in adms { - let _d = i.getBert() - _admData.append(_d) - } - _admins = BertList(fromElements: _admData) - } - if let objects = (self.mentions as? [Int64])?.compactMap({ Bert.getBin($0) as? BertNumber }) { _mentions = BertList(fromElements: objects) } - let links = (self.links ?? []).compactMap { $0.getBert() } - let _links = BertList(fromElements: links) + let _links = self.links.getBert() var typeString = type as? String if let type = self.type as? StringAtom { diff --git a/Nynja/MQTTModels/TypingExtension+BERT.swift b/Nynja/MQTTModels/TypingExtension+BERT.swift index 54369b5a1..3a793308f 100644 --- a/Nynja/MQTTModels/TypingExtension+BERT.swift +++ b/Nynja/MQTTModels/TypingExtension+BERT.swift @@ -8,7 +8,8 @@ import Foundation -extension Typing { +extension Typing: BERTEncodable { + func getBert() -> BertObject { let topic = BertAtom(fromString: "Typing") let _phone_id = Bert.getBin(self.phone_id) diff --git a/Nynja/MQTTModels/p2pExtension+BERT.swift b/Nynja/MQTTModels/p2pExtension+BERT.swift index ffde69548..5dee75746 100644 --- a/Nynja/MQTTModels/p2pExtension+BERT.swift +++ b/Nynja/MQTTModels/p2pExtension+BERT.swift @@ -8,7 +8,8 @@ import Foundation -extension p2p { +extension p2p: BERTEncodable { + func getBert() -> BertObject { var result: BertObject = BertNil() let type = BertAtom(fromString: "p2p") diff --git a/Nynja/ServerModel/Source/BERTEncodable.swift b/Nynja/ServerModel/Source/BERTEncodable.swift new file mode 100644 index 000000000..140ed98ad --- /dev/null +++ b/Nynja/ServerModel/Source/BERTEncodable.swift @@ -0,0 +1,60 @@ +// +// BERTEncodable.swift +// Nynja +// +// Created by Anton Poltoratskyi on 03.11.2018. +// Copyright © 2018 TecSynt Solutions. All rights reserved. +// + +import Foundation + +protocol BERTEncodable { + func getBert() -> BertObject +} + +// Don't conform Optional to BERTEncodable using 'extension Optional: BERTEncodable where Wrapped: BERTEncodable' +// in order to not be able to pass it as parameter of BERTEncodable type. +extension Optional where Wrapped: BERTEncodable { + + func getBert() -> BertObject { + let result: BertObject + if let wrapped = self { + result = wrapped.getBert() + } else { + result = BertNil() + } + return result + } +} + +extension Optional where Wrapped: BERTArray, Wrapped.Iterator.Element: BERTEncodable { + + func getBertOrNil() -> BertObject { + let result: BertObject + if let wrapped = self { + result = wrapped.getBertOrNil() + } else { + result = BertNil() + } + return result + } +} + +protocol BERTArray: Collection { } + +extension BERTArray where Element: BERTEncodable { + + func getBert() -> BertObject { + return BertList(fromElements: map { $0.getBert() }) + } + + /// Returns nil if array is empty + func getBertOrNil() -> BertObject { + guard !isEmpty else { + return BertNil() + } + return getBert() + } +} + +extension Array: BERTArray, BERTEncodable where Element: BERTEncodable { } diff --git a/Nynja/ServerModel/Source/BertBinConvertible.swift b/Nynja/ServerModel/Source/BertBinConvertible.swift index 7a7a728b2..cda3ed2f4 100644 --- a/Nynja/ServerModel/Source/BertBinConvertible.swift +++ b/Nynja/ServerModel/Source/BertBinConvertible.swift @@ -26,12 +26,14 @@ extension Int64: BertBinConvertible { } } -extension Optional: BertBinConvertible where Wrapped: BertBinConvertible { +extension Optional where Wrapped: BertBinConvertible { func getBin() -> BertObject { - var result: BertObject = BertNil() + let result: BertObject if let wrapped = self { result = wrapped.getBin() + } else { + result = BertNil() } return result } diff --git a/Nynja/Services/MQTT/StarExtension+BERT.swift b/Nynja/Services/MQTT/StarExtension+BERT.swift index 4be3b3996..5ef3df73b 100644 --- a/Nynja/Services/MQTT/StarExtension+BERT.swift +++ b/Nynja/Services/MQTT/StarExtension+BERT.swift @@ -8,22 +8,26 @@ import Foundation -extension Star { +extension Star: BERTEncodable { + func getBert() -> BertObject { - var result: BertObject = BertNil() let type = BertAtom(fromString: "Star") - var id: BertObject = BertNil() + let id: BertObject if let idd = self.id { id = BertNumber(fromInt64: idd) + } else { + id = BertNil() } let client_id = Bert.getBin(self.client_id) - var rosterID: BertObject = BertNil() + let rosterID: BertObject if let idd = roster_id { rosterID = BertNumber(fromInt64: idd) + } else { + rosterID = BertNil() } - let message = self.message?.getBert() ?? BertNil() + let message = self.message.getBert() let status = BertAtom(fromString:(self.status as? StringAtom)?.string ?? "") - result = BertTuple(fromElements: [type, id, client_id,rosterID, message, BertNil(),status]) - return result + + return BertTuple(fromElements: [type, id, client_id,rosterID, message, BertNil(),status]) } } diff --git a/Nynja/Services/Models/AuthModel.swift b/Nynja/Services/Models/AuthModel.swift index d66ec20bb..61f97e2cd 100644 --- a/Nynja/Services/Models/AuthModel.swift +++ b/Nynja/Services/Models/AuthModel.swift @@ -104,11 +104,8 @@ class AuthModel: BaseMQTTModel { language = BertList(fromElements: [tmp]) } - var bertSettings: BertObject = BertNil() - if let set = settings { - bertSettings = set.getBert() - } - + let bertSettings = settings.getBert() + return BertTuple(fromElements: [topic, cliID, devToken, diff --git a/Nynja/mucExtension+BERT.swift b/Nynja/mucExtension+BERT.swift index 175fa41fd..45f7e3634 100644 --- a/Nynja/mucExtension+BERT.swift +++ b/Nynja/mucExtension+BERT.swift @@ -8,12 +8,11 @@ import Foundation -extension muc { +extension muc: BERTEncodable { + func getBert() -> BertObject { - var result: BertObject = BertNil() let topicMuc = BertAtom(fromString: "muc") let _to = Bert.getBin(self.name) - result = BertTuple(fromElements: [topicMuc,_to]) - return result + return BertTuple(fromElements: [topicMuc,_to]) } } -- GitLab From b3fd5ac82a55801619c853e8ad23beb33fc021ed Mon Sep 17 00:00:00 2001 From: Anton Poltoratskyi Date: Mon, 5 Nov 2018 22:20:28 +0200 Subject: [PATCH 19/27] [NY-4362] Fixed linkTextAttributes. --- Nynja/Extensions/Range+Extension.swift | 10 ++++++---- Nynja/Extensions/UITextView+Extensions.swift | 6 +++--- .../Cells/Views/Message/MessageTextView.swift | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Nynja/Extensions/Range+Extension.swift b/Nynja/Extensions/Range+Extension.swift index ae85d5c92..552eee735 100644 --- a/Nynja/Extensions/Range+Extension.swift +++ b/Nynja/Extensions/Range+Extension.swift @@ -65,19 +65,21 @@ extension Range where Bound == Int { return range.upperBound == lowerBound } - func isAlongside(before range: Range) -> Bool { - return upperBound == range.lowerBound - } - func isAlongside(after range: ClosedRange) -> Bool { return range.upperBound == lowerBound - 1 } + func isAlongside(before range: Range) -> Bool { + return upperBound == range.lowerBound + } + func isAlongside(before range: ClosedRange) -> Bool { return upperBound == range.lowerBound } } +// MARK: - Intersection + extension Range where Bound == Int { func intersects(_ range: Range) -> Bool { diff --git a/Nynja/Extensions/UITextView+Extensions.swift b/Nynja/Extensions/UITextView+Extensions.swift index e9f92bafb..f0d5c6de8 100644 --- a/Nynja/Extensions/UITextView+Extensions.swift +++ b/Nynja/Extensions/UITextView+Extensions.swift @@ -22,12 +22,12 @@ extension UITextView { var isUnderlined: Bool { get { - let style: NSUnderlineStyle? = linkAttribute(forKey: .underlineStyle) - return style != NSUnderlineStyle.single + let style: Int? = linkAttribute(forKey: .underlineStyle) + return style != NSUnderlineStyle.single.rawValue } set { let value: NSUnderlineStyle = newValue ? .single : [] - linkTextAttributes[.underlineStyle] = value + linkTextAttributes[.underlineStyle] = value.rawValue } } diff --git a/Nynja/Modules/Message/View/Views/CollectionView/Cells/Views/Message/MessageTextView.swift b/Nynja/Modules/Message/View/Views/CollectionView/Cells/Views/Message/MessageTextView.swift index 7b6c74301..760585b3a 100644 --- a/Nynja/Modules/Message/View/Views/CollectionView/Cells/Views/Message/MessageTextView.swift +++ b/Nynja/Modules/Message/View/Views/CollectionView/Cells/Views/Message/MessageTextView.swift @@ -63,7 +63,7 @@ final class MessageTextView: MessageContentView { v.linkTextAttributes = [ .foregroundColor: UIColor.nynja.blue, .underlineColor: UIColor.nynja.blue, - .underlineStyle: NSUnderlineStyle.single + .underlineStyle: NSUnderlineStyle.single.rawValue ] self.addSubview(v) -- GitLab From bf278f210e4f028c541b2b5c962ab660f656db78 Mon Sep 17 00:00:00 2001 From: Anton Poltoratskyi Date: Mon, 5 Nov 2018 22:41:56 +0200 Subject: [PATCH 20/27] [NY-4362] Remove unused code from ImageSelector. --- Nynja/Extensions/UITextView+Extensions.swift | 4 +- Nynja/ImageSelector.swift | 53 ++++++-------------- 2 files changed, 17 insertions(+), 40 deletions(-) diff --git a/Nynja/Extensions/UITextView+Extensions.swift b/Nynja/Extensions/UITextView+Extensions.swift index f0d5c6de8..7f0092477 100644 --- a/Nynja/Extensions/UITextView+Extensions.swift +++ b/Nynja/Extensions/UITextView+Extensions.swift @@ -26,8 +26,8 @@ extension UITextView { return style != NSUnderlineStyle.single.rawValue } set { - let value: NSUnderlineStyle = newValue ? .single : [] - linkTextAttributes[.underlineStyle] = value.rawValue + let value: Int? = newValue ? NSUnderlineStyle.single.rawValue : nil + linkTextAttributes[.underlineStyle] = value } } diff --git a/Nynja/ImageSelector.swift b/Nynja/ImageSelector.swift index cfcb9503a..bfa583c1b 100644 --- a/Nynja/ImageSelector.swift +++ b/Nynja/ImageSelector.swift @@ -9,11 +9,11 @@ import UIKit import MobileCoreServices -class ImageSelector: NSObject, UIImagePickerControllerDelegate, UINavigationControllerDelegate { +final class ImageSelector { + typealias SelectHandler = (_ imageURL: URL?) -> Void typealias CancelHandler = () -> Void - // MARK: - Properties private var selectHandler: SelectHandler? private var cancelHandler: CancelHandler? @@ -23,7 +23,6 @@ class ImageSelector: NSObject, UIImagePickerControllerDelegate, UINavigationCont private var strongSelf: ImageSelector? - // MARK: - Start selection func startSelection(selectHandler: SelectHandler?, cancelHandler: CancelHandler? = nil) { strongSelf = self @@ -33,11 +32,11 @@ class ImageSelector: NSObject, UIImagePickerControllerDelegate, UINavigationCont let actions = [ UIAlertAction(title: String.localizable.dowloadImageFromCamera, style: .default) { _ in - self.presentCameraIfCan() + self.presentCamera() }, UIAlertAction(title: String.localizable.dowloadImageFromGallery, style: .default) { _ in - self.presentGalleryIfCan() + self.presentGallery() }, UIAlertAction(title: "Cancel", style: .cancel) { _ in @@ -49,31 +48,26 @@ class ImageSelector: NSObject, UIImagePickerControllerDelegate, UINavigationCont AlertManager.sharedInstance.showActionSheet(title: nil, message: "Choose Action", actions: actions) } - // MARK: - Present & dismiss - private func presentGalleryIfCan() { - PermissionManager().requestGaleryPermission { [weak self] (status) in - guard status == .authorized, - let viewController = self?.presentingController else { - return + private func presentGallery() { + PermissionManager().requestGaleryPermission { [weak self] status in + guard let self = self, status == .authorized, let viewController = self.presentingController else { + return } - - self?.startSelectAvatarFlow(source: .gallery, on: viewController) + self.startSelectAvatarFlow(source: .gallery, on: viewController) } } - private func presentCameraIfCan() { - PermissionManager().requestCameraPermission { [weak self] (status) in - guard status == .authorized, - let viewController = self?.presentingController else { - return + private func presentCamera() { + PermissionManager().requestCameraPermission { [weak self] status in + guard let self = self, status == .authorized, let viewController = self.presentingController else { + return } - - self?.startSelectAvatarFlow(source: .camera, on: viewController) + self.startSelectAvatarFlow(source: .camera, on: viewController) } } private func startSelectAvatarFlow(source: SelectAvatarFlowCoordinatorSource, on viewController: UIViewController) { - let selectAvatarFlowCoordinator = SelectAvatarFlowCoordinator(dependencies: SelectAvatarFlowCoordinator.Dependencies( + let selectAvatarFlowCoordinator = SelectAvatarFlowCoordinator(dependencies: .init( source: source, rootViewController: viewController, serviceFactory: ServiceFactory(), @@ -89,21 +83,4 @@ class ImageSelector: NSObject, UIImagePickerControllerDelegate, UINavigationCont self.strongSelf = nil } } - - // MARK: - UIImagePickerControllerDelegate - - func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { - guard let pickedImage = info[.originalImage] as? UIImage else { - dismiss(animated: true) - return - } -// selectHandler?(pickedImage) - dismiss(animated: false) - } - - func imagePickerControllerDidCancel(_ picker: UIImagePickerController) { - cancelHandler?() - dismiss(animated: false) - } } - -- GitLab From 0fbd3c4ab661b0a93fdb61625f129348267d53d0 Mon Sep 17 00:00:00 2001 From: Anton Poltoratskyi Date: Mon, 5 Nov 2018 23:18:59 +0200 Subject: [PATCH 21/27] [NY-4362] Remove unused ImagePickerHandler. --- Nynja.xcodeproj/project.pbxproj | 4 -- .../Main/View/MainViewController.swift | 23 +--------- Nynja/Utils/ImagePickerHandler.swift | 42 ------------------- 3 files changed, 2 insertions(+), 67 deletions(-) delete mode 100644 Nynja/Utils/ImagePickerHandler.swift diff --git a/Nynja.xcodeproj/project.pbxproj b/Nynja.xcodeproj/project.pbxproj index 1d0451820..1819e8bcd 100644 --- a/Nynja.xcodeproj/project.pbxproj +++ b/Nynja.xcodeproj/project.pbxproj @@ -807,7 +807,6 @@ 850571252050B0AD00EDF794 /* NotificationAlertSoundsWireFrame.swift in Sources */ = {isa = PBXBuildFile; fileRef = 850571202050B0AD00EDF794 /* NotificationAlertSoundsWireFrame.swift */; }; 85057962206D0C8400565C60 /* MediaPlaceholderWheelItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85057961206D0C8400565C60 /* MediaPlaceholderWheelItemModel.swift */; }; 85057964206D0CE500565C60 /* LocationPlaceholderWheelItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85057963206D0CE500565C60 /* LocationPlaceholderWheelItemModel.swift */; }; - 85057966206D17AB00565C60 /* ImagePickerHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85057965206D17AB00565C60 /* ImagePickerHandler.swift */; }; 8506F001206BF5DA008B2D7F /* ChatPlaceholderWheelItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8506F000206BF5DA008B2D7F /* ChatPlaceholderWheelItemView.swift */; }; 85082DDD2045A873000AE4B2 /* UserSettingsService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85082DDC2045A873000AE4B2 /* UserSettingsService.swift */; }; 85082DDF2045A8C2000AE4B2 /* WheelPosition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85082DDE2045A8C2000AE4B2 /* WheelPosition.swift */; }; @@ -3060,7 +3059,6 @@ 850571202050B0AD00EDF794 /* NotificationAlertSoundsWireFrame.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationAlertSoundsWireFrame.swift; sourceTree = ""; }; 85057961206D0C8400565C60 /* MediaPlaceholderWheelItemModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = MediaPlaceholderWheelItemModel.swift; path = Nynja/Library/UI/WheelContainer/Wheel/Factory/MediaPlaceholderWheelItemModel.swift; sourceTree = SOURCE_ROOT; }; 85057963206D0CE500565C60 /* LocationPlaceholderWheelItemModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationPlaceholderWheelItemModel.swift; sourceTree = ""; }; - 85057965206D17AB00565C60 /* ImagePickerHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImagePickerHandler.swift; sourceTree = ""; }; 8506F000206BF5DA008B2D7F /* ChatPlaceholderWheelItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatPlaceholderWheelItemView.swift; sourceTree = ""; }; 85082DDC2045A873000AE4B2 /* UserSettingsService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserSettingsService.swift; sourceTree = ""; }; 85082DDE2045A8C2000AE4B2 /* WheelPosition.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WheelPosition.swift; sourceTree = ""; }; @@ -9197,7 +9195,6 @@ FB16E79520EFAF7C009FA203 /* Money */, A43B25BC20AB1E9600FF8107 /* Validator */, 85F3DD43203F410D00F210C0 /* TimerHandler.swift */, - 85057965206D17AB00565C60 /* ImagePickerHandler.swift */, F1AC0DE2207252E1001C68F7 /* Testable.swift */, ); path = Utils; @@ -15645,7 +15642,6 @@ A4679B8E20B2DA610021FE9C /* SelectorAvatarCell.swift in Sources */, 2648C41B2069B52100863614 /* ChangeNumberView.swift in Sources */, 2648C40E2069B52100863614 /* ChangeNumberStep1Interactor.swift in Sources */, - 85057966206D17AB00565C60 /* ImagePickerHandler.swift in Sources */, 6D5157D01F30B36A002A27DB /* ChatView.swift in Sources */, 8572C3BB2092366100E4840C /* StickerCollectionDataSource.swift in Sources */, E735853D1F6C2705003354B5 /* Geometry.swift in Sources */, diff --git a/Nynja/Modules/Main/View/MainViewController.swift b/Nynja/Modules/Main/View/MainViewController.swift index abfb2276f..6fff42462 100644 --- a/Nynja/Modules/Main/View/MainViewController.swift +++ b/Nynja/Modules/Main/View/MainViewController.swift @@ -53,25 +53,6 @@ class MainViewController: BaseVC, MainViewProtocol, HitTestDelegate, UINavigatio private var recordingVideoTimer: Timer? - private lazy var imagePickerHandler: ImagePickerHandler = { - let handler = ImagePickerHandler() - handler.onStopRecordingVideo = { [weak self] in - self?.stopRecordingVideo() - } - handler.onStartRecordingVideo = { [weak self] in - self?.startRecordingVideo() - } - handler.onFinishPickingMedia = { [weak self] picker, info in - picker.dismissAll(animated: true) { - self?.processingSelect(info: info) - } - } - handler.onCancel = { [weak self] picker in - picker.dismissAll(animated: true) - } - return handler - }() - // MARK: Views private lazy var safeAreaView: UIView = { @@ -225,7 +206,7 @@ class MainViewController: BaseVC, MainViewProtocol, HitTestDelegate, UINavigatio lazy var uiLocker: UIView = { let v = UIView() - let blur = UIBlurEffect(style: UIBlurEffect.Style.dark) + let blur = UIBlurEffect(style: .dark) var blurView = UIVisualEffectView(effect: blur) v.addSubview(blurView) @@ -233,7 +214,7 @@ class MainViewController: BaseVC, MainViewProtocol, HitTestDelegate, UINavigatio maker.top.left.right.bottom.equalTo(v) }) - let activity = UIActivityIndicatorView(style: UIActivityIndicatorView.Style.whiteLarge) + let activity = UIActivityIndicatorView(style: .whiteLarge) v.addSubview(activity) v.bringSubviewToFront(activity) diff --git a/Nynja/Utils/ImagePickerHandler.swift b/Nynja/Utils/ImagePickerHandler.swift deleted file mode 100644 index 82fc248ec..000000000 --- a/Nynja/Utils/ImagePickerHandler.swift +++ /dev/null @@ -1,42 +0,0 @@ -// -// ImagePickerHandler.swift -// Nynja -// -// Created by Anton Poltoratskyi on 29.03.2018. -// Copyright © 2018 TecSynt Solutions. All rights reserved. -// - -import UIKit - -public final class ImagePickerHandler: NSObject, UIImagePickerControllerDelegate, UINavigationControllerDelegate { - - public var onFinishPickingMedia: ((UIImagePickerController, [UIImagePickerController.InfoKey : Any]) -> Void)? - public var onCancel: ((UIImagePickerController) -> Void)? - - public var onStartRecordingVideo: (() -> Void)? - public var onStopRecordingVideo: (() -> Void)? - - - // MARK: - UIImagePickerControllerDelegate - - public func imagePickerController(_ picker: UIImagePickerController, - didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { - onFinishPickingMedia?(picker, info) - } - - public func imagePickerControllerDidCancel(_ picker: UIImagePickerController) { - onCancel?(picker) - } - - - // MARK: - CustomImagePickerDelegate - - func startRecordingVideo() { - onStartRecordingVideo?() - } - - func stopRecordingVideo() { - onStopRecordingVideo?() - } - -} -- GitLab From 16fbe82485918564e60faae2b09fc327e4fa0885 Mon Sep 17 00:00:00 2001 From: Anton Poltoratskyi Date: Thu, 15 Nov 2018 19:00:43 +0200 Subject: [PATCH 22/27] [NY-4362] Fixed compile errors. --- .../AddParticipants/View/AddParticipantsViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Nynja/Modules/AddParticipants/View/AddParticipantsViewController.swift b/Nynja/Modules/AddParticipants/View/AddParticipantsViewController.swift index cf65e0b53..f16476cb8 100644 --- a/Nynja/Modules/AddParticipants/View/AddParticipantsViewController.swift +++ b/Nynja/Modules/AddParticipants/View/AddParticipantsViewController.swift @@ -539,7 +539,7 @@ extension AddParticipantsViewController: ParticipantsActionsDelegate { fCanSelect = participantsDataSource.selectedParticipants.count < (presenter.maxParticipantsToAdd - 1) case .createConferenceCall?: fCanSelect = participantsDataSource.selectedParticipants.count < (presenter.maxParticipantsToAdd - 1) - case .updateGroupCall: + case .updateGroupCall?: fCanSelect = participantsDataSource.selectedParticipants.count < (presenter.maxParticipantsToAdd) default: fCanSelect = true -- GitLab From 1bee2d5b0908716cf81f7c1b854c3feb19929118 Mon Sep 17 00:00:00 2001 From: Anton Poltoratskyi Date: Thu, 15 Nov 2018 19:12:38 +0200 Subject: [PATCH 23/27] [NY-4362] Minor fix. --- .../Flows/CameraFlow/Camera/View/CameraViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Nynja/Modules/Flows/CameraFlow/Camera/View/CameraViewController.swift b/Nynja/Modules/Flows/CameraFlow/Camera/View/CameraViewController.swift index afd94e75a..ede35722d 100644 --- a/Nynja/Modules/Flows/CameraFlow/Camera/View/CameraViewController.swift +++ b/Nynja/Modules/Flows/CameraFlow/Camera/View/CameraViewController.swift @@ -463,7 +463,7 @@ private extension CameraViewController { } func addBlurViewToOverlay() { - let blurEffect = UIBlurEffect(style: UIBlurEffect.Style.dark) + let blurEffect = UIBlurEffect(style: .dark) let blurEffectView = UIVisualEffectView(effect: blurEffect) blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight] overlayView.addSubview(blurEffectView) -- GitLab From eb4a517cb9890a027046acf097ccd6bd91639429 Mon Sep 17 00:00:00 2001 From: Anton Poltoratskyi Date: Fri, 16 Nov 2018 16:56:49 +0200 Subject: [PATCH 24/27] Updated project file --- Nynja-Share/Resources/Info.plist | 2 +- Nynja.xcodeproj/project.pbxproj | 12 ++++++------ Nynja/Resources/Info.plist | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Nynja-Share/Resources/Info.plist b/Nynja-Share/Resources/Info.plist index 7c5b3060f..b87f21e7d 100644 --- a/Nynja-Share/Resources/Info.plist +++ b/Nynja-Share/Resources/Info.plist @@ -21,7 +21,7 @@ CFBundleShortVersionString 1.0 CFBundleVersion - 0.5.4.Dev + 0.5.4.Swift Config $(Config) ModelsVersion diff --git a/Nynja.xcodeproj/project.pbxproj b/Nynja.xcodeproj/project.pbxproj index 29174df53..3473cd3aa 100644 --- a/Nynja.xcodeproj/project.pbxproj +++ b/Nynja.xcodeproj/project.pbxproj @@ -16809,8 +16809,8 @@ CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_ENTITLEMENTS = "Nynja-Share/Resources/Nynja-Share.entitlements"; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CODE_SIGN_IDENTITY = "iPhone Distribution"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; CODE_SIGN_STYLE = Manual; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = 9GKQ5AMF2B; @@ -16823,7 +16823,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "$(ExtensionBundleIdentifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = "f6fa31cc-ee3a-42a3-ae54-af6e54db9f3e"; - PROVISIONING_PROFILE_SPECIFIER = DevBundle_DevExt; + PROVISIONING_PROFILE_SPECIFIER = DevBundle_AdHocExt; SKIP_INSTALL = YES; SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; @@ -16987,8 +16987,8 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIconDev; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Nynja/Resources/Nynja.entitlements; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CODE_SIGN_IDENTITY = "iPhone Distribution"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; CODE_SIGN_STYLE = Manual; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; @@ -17001,7 +17001,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "$(BundleIdentifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = "6001ef39-7fcd-4abe-8f6d-2de8430809d4"; - PROVISIONING_PROFILE_SPECIFIER = DevBundle_Dev; + PROVISIONING_PROFILE_SPECIFIER = DevBundle_adhoc; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OBJC_BRIDGING_HEADER = "Nynja-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; diff --git a/Nynja/Resources/Info.plist b/Nynja/Resources/Info.plist index dda23f384..619eb70e6 100644 --- a/Nynja/Resources/Info.plist +++ b/Nynja/Resources/Info.plist @@ -23,7 +23,7 @@ CFBundleShortVersionString 1.0 CFBundleVersion - 0.5.4.Dev + 0.5.4.Swift ConfServerAddress $(ConfServerAddress) ConfServerPort -- GitLab From 771e5ac9799f935b116704f1f8000180b69907a7 Mon Sep 17 00:00:00 2001 From: Anton Poltoratskyi Date: Fri, 16 Nov 2018 19:18:57 +0200 Subject: [PATCH 25/27] Added new scheme --- .../NynjaUIKit.xcodeproj/project.pbxproj | 118 ++++++++--- Nynja.xcodeproj/project.pbxproj | 190 ++++++++++++++++++ Nynja/Resources/PrereleaseConfig.xcconfig | 2 +- .../Resources/PrereleaseDebugConfig.xcconfig | 25 +++ Nynja/Resources/ReleaseConfig.xcconfig | 2 +- Nynja/Resources/ThirdPartyServices.swift | 11 +- 6 files changed, 315 insertions(+), 33 deletions(-) create mode 100644 Nynja/Resources/PrereleaseDebugConfig.xcconfig diff --git a/Frameworks/NynjaUIKit/NynjaUIKit.xcodeproj/project.pbxproj b/Frameworks/NynjaUIKit/NynjaUIKit.xcodeproj/project.pbxproj index 3863dc6d5..5cc68235e 100644 --- a/Frameworks/NynjaUIKit/NynjaUIKit.xcodeproj/project.pbxproj +++ b/Frameworks/NynjaUIKit/NynjaUIKit.xcodeproj/project.pbxproj @@ -36,6 +36,7 @@ /* Begin PBXFileReference section */ 1820AD65D6897E3E306C16A2 /* Pods-NynjaUIKit.translate.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NynjaUIKit.translate.xcconfig"; path = "../../Pods/Target Support Files/Pods-NynjaUIKit/Pods-NynjaUIKit.translate.xcconfig"; sourceTree = ""; }; + 18558C18EB6A4113B623AEDE /* Pods-NynjaUIKit.prereleasedebug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NynjaUIKit.prereleasedebug.xcconfig"; path = "../../Pods/Target Support Files/Pods-NynjaUIKit/Pods-NynjaUIKit.prereleasedebug.xcconfig"; sourceTree = ""; }; 7336042AC840197E622730FD /* Pods-NynjaUIKit.prerelease.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NynjaUIKit.prerelease.xcconfig"; path = "../../Pods/Target Support Files/Pods-NynjaUIKit/Pods-NynjaUIKit.prerelease.xcconfig"; sourceTree = ""; }; 8514D4C120EE27080002378A /* NynjaUIKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = NynjaUIKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 8514D4C420EE27080002378A /* NynjaUIKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NynjaUIKit.h; sourceTree = ""; }; @@ -93,6 +94,7 @@ E966C049045184395EBB9166 /* Pods-NynjaUIKit.release.xcconfig */, 7336042AC840197E622730FD /* Pods-NynjaUIKit.prerelease.xcconfig */, DA270E65F48C8FD1EF3BF945 /* Pods-NynjaUIKit.spotify.xcconfig */, + 18558C18EB6A4113B623AEDE /* Pods-NynjaUIKit.prereleasedebug.xcconfig */, ); name = Pods; sourceTree = ""; @@ -438,7 +440,7 @@ /* Begin XCBuildConfiguration section */ 5B4DFF722191A0C100E89D17 /* Spotify */ = { isa = XCBuildConfiguration; - baseConfigurationReference = B90E6396110C47D18FB00838 /* Pods-NynjaUIKit.dev.xcconfig */; + baseConfigurationReference = DA270E65F48C8FD1EF3BF945 /* Pods-NynjaUIKit.spotify.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -508,11 +510,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = NynjaUIKit/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.nynja.mobile.communicator.NynjaUIKit; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -594,11 +592,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = NynjaUIKit/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.nynja.mobile.communicator.NynjaUIKit; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -680,11 +674,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = NynjaUIKit/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.nynja.mobile.communicator.NynjaUIKit; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -766,11 +756,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = NynjaUIKit/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.nynja.mobile.communicator.NynjaUIKit; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -852,11 +838,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = NynjaUIKit/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.nynja.mobile.communicator.NynjaUIKit; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -866,6 +848,88 @@ }; name = DevAutoTests; }; + 85AC1343219F27CC002ADE57 /* PrereleaseDebug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = B90E6396110C47D18FB00838 /* Pods-NynjaUIKit.dev.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_VERSION = 4.2; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = PrereleaseDebug; + }; + 85AC1344219F27CC002ADE57 /* PrereleaseDebug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 18558C18EB6A4113B623AEDE /* Pods-NynjaUIKit.prereleasedebug.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = NynjaUIKit/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.nynja.mobile.communicator.NynjaUIKit; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = PrereleaseDebug; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -877,6 +941,7 @@ 85631BF220EFC50F0002BE51 /* DevAutoTests */, 85631BF020EFC4FC0002BE51 /* Release */, 85631BEE20EFC4F30002BE51 /* Prerelease */, + 85AC1343219F27CC002ADE57 /* PrereleaseDebug */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -889,6 +954,7 @@ 85631BF320EFC50F0002BE51 /* DevAutoTests */, 85631BF120EFC4FC0002BE51 /* Release */, 85631BEF20EFC4F30002BE51 /* Prerelease */, + 85AC1344219F27CC002ADE57 /* PrereleaseDebug */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; diff --git a/Nynja.xcodeproj/project.pbxproj b/Nynja.xcodeproj/project.pbxproj index 3473cd3aa..9adf22fa0 100644 --- a/Nynja.xcodeproj/project.pbxproj +++ b/Nynja.xcodeproj/project.pbxproj @@ -3295,6 +3295,7 @@ 859C42AC2056BF9F00AE3797 /* incoming_message.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = incoming_message.mp3; sourceTree = ""; }; 859F9B4B2035CB1E009D017A /* ForwardContent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ForwardContent.swift; sourceTree = ""; }; 85A3CA01214129F200E0EDD5 /* KeyboardInteractive.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyboardInteractive.swift; sourceTree = ""; }; + 85AC1342219F16CF002ADE57 /* PrereleaseDebugConfig.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = PrereleaseDebugConfig.xcconfig; sourceTree = ""; }; 85B0013121270DEC000C89FE /* TableOrder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableOrder.swift; sourceTree = ""; }; 85B0013321272694000C89FE /* MessageInteractor+History.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MessageInteractor+History.swift"; sourceTree = ""; }; 85B750A020334A2B00AD6013 /* ForwardTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ForwardTableViewCell.swift; sourceTree = ""; }; @@ -3947,6 +3948,7 @@ DFBBE8C9FC347038AB74CF43 /* LanguageSettingsProtocols.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = LanguageSettingsProtocols.swift; sourceTree = ""; }; E0D2600FD713CD1058B95019 /* MyGroupAliasViewController.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = MyGroupAliasViewController.swift; sourceTree = ""; }; E23783DEFB30677C304498F3 /* Pods-Nynja.prerelease.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Nynja.prerelease.xcconfig"; path = "Pods/Target Support Files/Pods-Nynja/Pods-Nynja.prerelease.xcconfig"; sourceTree = ""; }; + E42B638ABF2F5FA220065230 /* Pods-Nynja.prereleasedebug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Nynja.prereleasedebug.xcconfig"; path = "Pods/Target Support Files/Pods-Nynja/Pods-Nynja.prereleasedebug.xcconfig"; sourceTree = ""; }; E49C16524294773D8EE07534 /* Pods-NynjaUnitTests.stickers.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NynjaUnitTests.stickers.xcconfig"; path = "Pods/Target Support Files/Pods-NynjaUnitTests/Pods-NynjaUnitTests.stickers.xcconfig"; sourceTree = ""; }; E70189BA1F9107AD00CA7005 /* ProximitySensorManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ProximitySensorManager.swift; path = Services/ProximitySensorManager.swift; sourceTree = ""; }; E701A27C1FB33E1600D995C3 /* ParticipantsActionsDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ParticipantsActionsDelegate.swift; sourceTree = ""; }; @@ -4195,6 +4197,7 @@ F1D4A49F20762A1D00F31089 /* Configurable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Configurable.swift; sourceTree = ""; }; F1EED41420C57C30001060C4 /* PhotoPreviewSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoPreviewSource.swift; sourceTree = ""; }; F1F219FC7966064C555AC2A4 /* TopUpAccountViewController.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = TopUpAccountViewController.swift; sourceTree = ""; }; + F4618EFB966F8049C21C6AEB /* Pods-NynjaUnitTests.prereleasedebug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NynjaUnitTests.prereleasedebug.xcconfig"; path = "Pods/Target Support Files/Pods-NynjaUnitTests/Pods-NynjaUnitTests.prereleasedebug.xcconfig"; sourceTree = ""; }; F46A5D92A279FA0A509DA508 /* Pods-NynjaUnitTests.translate.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NynjaUnitTests.translate.xcconfig"; path = "Pods/Target Support Files/Pods-NynjaUnitTests/Pods-NynjaUnitTests.translate.xcconfig"; sourceTree = ""; }; F56141F2CF85255940EA304F /* EditPhotoWireframe.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = EditPhotoWireframe.swift; sourceTree = ""; }; F79C9355E1AA4B373567F765 /* LanguageSettingsInteractor.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = LanguageSettingsInteractor.swift; sourceTree = ""; }; @@ -4229,6 +4232,7 @@ FBD885772147F9640099B8C3 /* AssetsConstants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetsConstants.swift; sourceTree = ""; }; FBDA34E820921079009F4FB6 /* KeyboardLayoutGuide.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyboardLayoutGuide.swift; sourceTree = ""; }; FBE3885C2118849000149721 /* AlertActionWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertActionWrapper.swift; sourceTree = ""; }; + FC0DDDDCCBF893326A794665 /* Pods-Nynja-Share.prereleasedebug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Nynja-Share.prereleasedebug.xcconfig"; path = "Pods/Target Support Files/Pods-Nynja-Share/Pods-Nynja-Share.prereleasedebug.xcconfig"; sourceTree = ""; }; FD011693E63204766A30F18C /* TutorialPresenter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = TutorialPresenter.swift; sourceTree = ""; }; FD21B8AD8A89427D88B48BC6 /* AddContactProtocols.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = AddContactProtocols.swift; sourceTree = ""; }; FD33E34E2376166F3A132271 /* ImagePreviewProtocols.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = ImagePreviewProtocols.swift; sourceTree = ""; }; @@ -6182,6 +6186,7 @@ F1313AFE20888CAB00E04092 /* DevConfig.xcconfig */, F10AFE9A20EF8B9A00C7CE83 /* DevAutoTests.xcconfig */, F1313AFF20888CB800E04092 /* PrereleaseConfig.xcconfig */, + 85AC1342219F16CF002ADE57 /* PrereleaseDebugConfig.xcconfig */, F1313B0020888CC400E04092 /* ReleaseConfig.xcconfig */, 5B4DFF6C21919FA000E89D17 /* SpotifyConfig.xcconfig */, F1313B0120888FE600E04092 /* ThirdPartyServices.swift */, @@ -7540,6 +7545,9 @@ 7ADCB0C891B31AF691307B4F /* Pods-Nynja.spotify.xcconfig */, 7F7FC209C7703E3E7617D782 /* Pods-Nynja-Share.spotify.xcconfig */, A0A57BD401783039D49B7B75 /* Pods-NynjaUnitTests.spotify.xcconfig */, + E42B638ABF2F5FA220065230 /* Pods-Nynja.prereleasedebug.xcconfig */, + FC0DDDDCCBF893326A794665 /* Pods-Nynja-Share.prereleasedebug.xcconfig */, + F4618EFB966F8049C21C6AEB /* Pods-NynjaUnitTests.prereleasedebug.xcconfig */, ); name = Pods; sourceTree = ""; @@ -17305,6 +17313,183 @@ }; name = Spotify; }; + 85AC133D219F1690002ADE57 /* PrereleaseDebug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 85AC1342219F16CF002ADE57 /* PrereleaseDebugConfig.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 10.3; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_SWIFT3_OBJC_INFERENCE = Off; + SWIFT_VERSION = 4.2; + SWIFT_WHOLE_MODULE_OPTIMIZATION = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = PrereleaseDebug; + }; + 85AC133E219F1690002ADE57 /* PrereleaseDebug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E42B638ABF2F5FA220065230 /* Pods-Nynja.prereleasedebug.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIconSpotify; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Nynja/Resources/Nynja.entitlements; + CODE_SIGN_IDENTITY = "iPhone Distribution"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; + CODE_SIGN_STYLE = Manual; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = 9GKQ5AMF2B; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = "$(SRCROOT)/Nynja/Resources/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_BUNDLE_IDENTIFIER = "$(BundleIdentifier)"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = "e4b654e5-ea23-4135-bb19-3edc95e49642"; + PROVISIONING_PROFILE_SPECIFIER = DevBundle_adhoc; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OBJC_BRIDGING_HEADER = "Nynja-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_SWIFT3_OBJC_INFERENCE = Off; + SWIFT_VERSION = 4.2; + SWIFT_WHOLE_MODULE_OPTIMIZATION = YES; + }; + name = PrereleaseDebug; + }; + 85AC133F219F1690002ADE57 /* PrereleaseDebug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FC0DDDDCCBF893326A794665 /* Pods-Nynja-Share.prereleasedebug.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_ENTITLEMENTS = "Nynja-Share/Resources/Nynja-Share.entitlements"; + CODE_SIGN_IDENTITY = "iPhone Distribution"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; + CODE_SIGN_STYLE = Manual; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = 9GKQ5AMF2B; + ENABLE_BITCODE = NO; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = "Nynja-Share/Resources/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" -DSHARE_EXTENSION"; + PRODUCT_BUNDLE_IDENTIFIER = "$(ExtensionBundleIdentifier)"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = "5dca1418-4061-4c52-958f-3edf7251f19b"; + PROVISIONING_PROFILE_SPECIFIER = DevBundle_AdHocExt; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = PrereleaseDebug; + }; + 85AC1340219F1690002ADE57 /* PrereleaseDebug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = F4618EFB966F8049C21C6AEB /* Pods-NynjaUnitTests.prereleasedebug.xcconfig */; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 9GKQ5AMF2B; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = NynjaUnitTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.3; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.nynja.mobile.communicator.NynjaUnitTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_COMPILATION_MODE = singlefile; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = PrereleaseDebug; + }; + 85AC1341219F1690002ADE57 /* PrereleaseDebug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 9GKQ5AMF2B; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = NynjaIntegrationTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.3; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.nynja.dev.mobile.communicator.NynjaIntegrationTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_COMPILATION_MODE = singlefile; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Nynja.app/Nynja"; + }; + name = PrereleaseDebug; + }; F10AFE9C20EF8BBE00C7CE83 /* DevAutoTests */ = { isa = XCBuildConfiguration; baseConfigurationReference = F10AFE9A20EF8B9A00C7CE83 /* DevAutoTests.xcconfig */; @@ -17900,6 +18085,7 @@ 5B4DFF6F2191A08E00E89D17 /* Spotify */, F10AFE9E20EF8BBE00C7CE83 /* DevAutoTests */, F1313AFD20888BD300E04092 /* Prerelease */, + 85AC133F219F1690002ADE57 /* PrereleaseDebug */, 357809AF1F9765CF00C9680C /* Release */, ); defaultConfigurationIsVisible = 0; @@ -17912,6 +18098,7 @@ 5B4DFF6D2191A08E00E89D17 /* Spotify */, F10AFE9C20EF8BBE00C7CE83 /* DevAutoTests */, F1313AFB20888BD300E04092 /* Prerelease */, + 85AC133D219F1690002ADE57 /* PrereleaseDebug */, 3ABCE8FE1EC9330D00A80B15 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -17924,6 +18111,7 @@ 5B4DFF6E2191A08E00E89D17 /* Spotify */, F10AFE9D20EF8BBE00C7CE83 /* DevAutoTests */, F1313AFC20888BD300E04092 /* Prerelease */, + 85AC133E219F1690002ADE57 /* PrereleaseDebug */, 3ABCE9011EC9330D00A80B15 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -17936,6 +18124,7 @@ 5B4DFF702191A08E00E89D17 /* Spotify */, F10AFE9F20EF8BBE00C7CE83 /* DevAutoTests */, F1C37AB1209A1BF4005EA197 /* Prerelease */, + 85AC1340219F1690002ADE57 /* PrereleaseDebug */, F1C37AB2209A1BF4005EA197 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -17948,6 +18137,7 @@ 5B4DFF712191A08E00E89D17 /* Spotify */, FE21ACB02113AA7F006010A0 /* DevAutoTests */, FE21ACB32113AA7F006010A0 /* Prerelease */, + 85AC1341219F1690002ADE57 /* PrereleaseDebug */, FE21ACB42113AA7F006010A0 /* Release */, ); defaultConfigurationIsVisible = 0; diff --git a/Nynja/Resources/PrereleaseConfig.xcconfig b/Nynja/Resources/PrereleaseConfig.xcconfig index 1ffefb6cf..06b28b69b 100644 --- a/Nynja/Resources/PrereleaseConfig.xcconfig +++ b/Nynja/Resources/PrereleaseConfig.xcconfig @@ -14,7 +14,7 @@ AppName = NYNJARC ServerPort = 8443 Config = prerelease AppGroup = group.com.nynja.mobile.communicator.rc -ModelsVersion = 9 +ModelsVersion = 10 isServerConnectionSecure = true ConfServerAddress = call.staging.nynja.net ConfServerPort = 443 diff --git a/Nynja/Resources/PrereleaseDebugConfig.xcconfig b/Nynja/Resources/PrereleaseDebugConfig.xcconfig new file mode 100644 index 000000000..af5e0d2c4 --- /dev/null +++ b/Nynja/Resources/PrereleaseDebugConfig.xcconfig @@ -0,0 +1,25 @@ +// +// PrereleaseDebugConfig.xcconfig +// Nynja +// +// Created by Anton Poltoratskyi on 16.11.2018. +// Copyright © 2018 TecSynt Solutions. All rights reserved. +// + +// Configuration settings file format documentation can be found at: +// https://help.apple.com/xcode/#/dev745c5c974 + +BundleIdentifier = com.nynja.dev.mobile.communicator +ExtensionBundleIdentifier = com.nynja.dev.mobile.communicator.NynjaShare +ServerURL = preprod.ci.nynja.net +AppName = NYNJARC_DEBUG +ServerPort = 1883 +Config = prereleaseDebug +AppGroup = group.com.nynja.mobile.communicator.dev +ModelsVersion = 10 +isServerConnectionSecure = false +ConfServerAddress = call.staging.nynja.net +ConfServerPort = 443 +ConfServerSecure = true +AssociatedDomain = applinks:join.staging.nynja.net + diff --git a/Nynja/Resources/ReleaseConfig.xcconfig b/Nynja/Resources/ReleaseConfig.xcconfig index f8b763d10..f65b25f2e 100644 --- a/Nynja/Resources/ReleaseConfig.xcconfig +++ b/Nynja/Resources/ReleaseConfig.xcconfig @@ -14,7 +14,7 @@ AppName = NYNJA ServerPort = 8443 Config = release AppGroup = group.com.nynja.mobile.communicator -ModelsVersion = 9 +ModelsVersion = 10 isServerConnectionSecure = true ConfServerAddress = call.nynja.net ConfServerPort = 443 diff --git a/Nynja/Resources/ThirdPartyServices.swift b/Nynja/Resources/ThirdPartyServices.swift index 7bb8ffee2..edf527adc 100644 --- a/Nynja/Resources/ThirdPartyServices.swift +++ b/Nynja/Resources/ThirdPartyServices.swift @@ -23,6 +23,7 @@ enum AppConfig: String { case prerelease case release case spotify + case prereleaseDebug } protocol ThirdPartyService { @@ -46,7 +47,7 @@ struct AmazonService: ThirdPartyService { init(config: AppConfig) { switch config { - case .dev, .devAutoTests, .spotify: + case .dev, .devAutoTests, .spotify, .prereleaseDebug: serviceConfig = Config(accessKey: "AKIAIVFYOPZSACBLBBSA", secretKey: "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", defaultBucketName: "nynja-defaults", @@ -75,7 +76,7 @@ struct GoogleService: ThirdPartyService { init(config: AppConfig) { switch config { - case .dev, .devAutoTests, .spotify: serviceConfig = Config(apiKey: "AIzaSyCAi5Ea_zkYzbIARCqfMMrq4NOy935BltA") + case .dev, .devAutoTests, .spotify, .prereleaseDebug: serviceConfig = Config(apiKey: "AIzaSyCAi5Ea_zkYzbIARCqfMMrq4NOy935BltA") case .prerelease: serviceConfig = Config(apiKey: "AIzaSyCAi5Ea_zkYzbIARCqfMMrq4NOy935BltA") case .release: serviceConfig = Config(apiKey: "AIzaSyCAi5Ea_zkYzbIARCqfMMrq4NOy935BltA") } @@ -92,7 +93,7 @@ struct IntercomService: ThirdPartyService { init(config: AppConfig) { switch config { - case .dev, .devAutoTests, .spotify: serviceConfig = Config(apiKey: "ios_sdk-3f0f8a4f52e4ed08a2bf6f1a39a1e9eb8b0763d5", appId: "s3isdm0n") + case .dev, .devAutoTests, .spotify, .prereleaseDebug: serviceConfig = Config(apiKey: "ios_sdk-3f0f8a4f52e4ed08a2bf6f1a39a1e9eb8b0763d5", appId: "s3isdm0n") case .prerelease: serviceConfig = Config(apiKey: "ios_sdk-3f0f8a4f52e4ed08a2bf6f1a39a1e9eb8b0763d5", appId: "s3isdm0n") case .release: serviceConfig = Config(apiKey: "ios_sdk-3f0f8a4f52e4ed08a2bf6f1a39a1e9eb8b0763d5", appId: "s3isdm0n") } @@ -112,7 +113,7 @@ struct SupportService: ThirdPartyService { init(config: AppConfig) { switch config { - case .dev, .devAutoTests, .spotify: serviceConfig = Config(mailAddress: "support@nynja.biz", + case .dev, .devAutoTests, .spotify, .prereleaseDebug: serviceConfig = Config(mailAddress: "support@nynja.biz", faq: URL(string: "https://landing.nynja.io/-temporary-slug-81be145c-f4aa-4787-8d71-b3ab51a1aef2?hs_preview=XOrlQzBx-6108791186")!, privacyPolicy: URL(string: "https://landing.nynja.io/privacy-policy")!, terms: URL(string:"https://landing.nynja.io/terms-of-use")!) @@ -139,7 +140,7 @@ struct TestFairyService: ThirdPartyService { init(config: AppConfig) { switch config { - case .dev, .devAutoTests, .spotify: serviceConfig = Config(key: "4e58695a5ce5ee4ccddbb4b852d3927626f7da36") + case .dev, .devAutoTests, .spotify, .prereleaseDebug: serviceConfig = Config(key: "4e58695a5ce5ee4ccddbb4b852d3927626f7da36") case .prerelease: serviceConfig = Config(key: "4e58695a5ce5ee4ccddbb4b852d3927626f7da36") case .release: serviceConfig = Config(key: "4e58695a5ce5ee4ccddbb4b852d3927626f7da36") } -- GitLab From 0295b788f480815cec544174923ffe620b9779b9 Mon Sep 17 00:00:00 2001 From: Anton Poltoratskyi Date: Fri, 16 Nov 2018 19:19:10 +0200 Subject: [PATCH 26/27] Added new scheme 2 --- .../xcschemes/PrereleaseDebug.xcscheme | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 Nynja.xcodeproj/xcshareddata/xcschemes/PrereleaseDebug.xcscheme diff --git a/Nynja.xcodeproj/xcshareddata/xcschemes/PrereleaseDebug.xcscheme b/Nynja.xcodeproj/xcshareddata/xcschemes/PrereleaseDebug.xcscheme new file mode 100644 index 000000000..5d95e7450 --- /dev/null +++ b/Nynja.xcodeproj/xcshareddata/xcschemes/PrereleaseDebug.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- GitLab From 8d238aca02fa14b1592e06cfd185fd13f55cb6bf Mon Sep 17 00:00:00 2001 From: Anton Poltoratskyi Date: Sun, 18 Nov 2018 22:45:44 +0200 Subject: [PATCH 27/27] Fixed active compilation conditions, compilation mode and optimization level. --- .../NynjaUIKit.xcodeproj/project.pbxproj | 40 +++++++++++++++---- Nynja.xcodeproj/project.pbxproj | 32 +++++++++++---- 2 files changed, 56 insertions(+), 16 deletions(-) diff --git a/Frameworks/NynjaUIKit/NynjaUIKit.xcodeproj/project.pbxproj b/Frameworks/NynjaUIKit/NynjaUIKit.xcodeproj/project.pbxproj index 5cc68235e..aed5185af 100644 --- a/Frameworks/NynjaUIKit/NynjaUIKit.xcodeproj/project.pbxproj +++ b/Frameworks/NynjaUIKit/NynjaUIKit.xcodeproj/project.pbxproj @@ -510,7 +510,11 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = NynjaUIKit/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = com.nynja.mobile.communicator.NynjaUIKit; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -592,7 +596,11 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = NynjaUIKit/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = com.nynja.mobile.communicator.NynjaUIKit; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -674,7 +682,11 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = NynjaUIKit/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = com.nynja.mobile.communicator.NynjaUIKit; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -756,7 +768,11 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = NynjaUIKit/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = com.nynja.mobile.communicator.NynjaUIKit; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -816,8 +832,8 @@ IPHONEOS_DEPLOYMENT_TARGET = 10.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_COMPILATION_MODE = singlefile; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 4.2; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -838,7 +854,11 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = NynjaUIKit/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = com.nynja.mobile.communicator.NynjaUIKit; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -920,7 +940,11 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = NynjaUIKit/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = com.nynja.mobile.communicator.NynjaUIKit; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/Nynja.xcodeproj/project.pbxproj b/Nynja.xcodeproj/project.pbxproj index 9adf22fa0..34860cf50 100644 --- a/Nynja.xcodeproj/project.pbxproj +++ b/Nynja.xcodeproj/project.pbxproj @@ -16833,6 +16833,8 @@ PROVISIONING_PROFILE = "f6fa31cc-ee3a-42a3-ae54-af6e54db9f3e"; PROVISIONING_PROFILE_SPECIFIER = DevBundle_AdHocExt; SKIP_INSTALL = YES; + SWIFT_COMPILATION_MODE = singlefile; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -16862,8 +16864,8 @@ PROVISIONING_PROFILE = "2a318f9e-d0ab-41dc-968a-e1cb13de4de5"; PROVISIONING_PROFILE_SPECIFIER = ProductionBundle_AppstoreExt; SKIP_INSTALL = YES; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = RELEASE; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -16923,6 +16925,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_COMPILATION_MODE = singlefile; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_VERSION = 4.2; @@ -16978,7 +16981,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 10.3; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_VERSION = 4.2; SWIFT_WHOLE_MODULE_OPTIMIZATION = YES; @@ -17011,6 +17014,7 @@ PROVISIONING_PROFILE = "6001ef39-7fcd-4abe-8f6d-2de8430809d4"; PROVISIONING_PROFILE_SPECIFIER = DevBundle_adhoc; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_COMPILATION_MODE = singlefile; SWIFT_OBJC_BRIDGING_HEADER = "Nynja-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; @@ -17042,9 +17046,8 @@ PROVISIONING_PROFILE = "1971b115-2b2c-48b6-a20f-3686249e0a88"; PROVISIONING_PROFILE_SPECIFIER = ProductionBundle_Appstore; SWIFT_ACTIVE_COMPILATION_CONDITIONS = RELEASE; - SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OBJC_BRIDGING_HEADER = "Nynja-Bridging-Header.h"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_VERSION = 4.2; SWIFT_WHOLE_MODULE_OPTIMIZATION = YES; @@ -17105,6 +17108,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_COMPILATION_MODE = singlefile; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_VERSION = 4.2; @@ -17137,6 +17141,7 @@ PROVISIONING_PROFILE = "725573e3-fa72-4be9-8455-f1b62a74ef8d"; PROVISIONING_PROFILE_SPECIFIER = LocBundle_Dev; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_COMPILATION_MODE = singlefile; SWIFT_OBJC_BRIDGING_HEADER = "Nynja-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; @@ -17169,6 +17174,8 @@ PROVISIONING_PROFILE = "48a5e679-d09c-4e7f-ae6a-1c92707ffbba"; PROVISIONING_PROFILE_SPECIFIER = LocBundle_DevExt; SKIP_INSTALL = YES; + SWIFT_COMPILATION_MODE = singlefile; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -17367,6 +17374,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_COMPILATION_MODE = singlefile; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_VERSION = 4.2; @@ -17399,6 +17407,7 @@ PROVISIONING_PROFILE = "e4b654e5-ea23-4135-bb19-3edc95e49642"; PROVISIONING_PROFILE_SPECIFIER = DevBundle_adhoc; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_COMPILATION_MODE = singlefile; SWIFT_OBJC_BRIDGING_HEADER = "Nynja-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; @@ -17432,6 +17441,7 @@ PROVISIONING_PROFILE_SPECIFIER = DevBundle_AdHocExt; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_COMPILATION_MODE = singlefile; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; @@ -17544,6 +17554,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_COMPILATION_MODE = singlefile; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_VERSION = 4.2; @@ -17574,6 +17585,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = "e9cc21bd-73cb-4b39-92ab-097127d12162"; PROVISIONING_PROFILE_SPECIFIER = DevBundle_Dev; + SWIFT_COMPILATION_MODE = singlefile; SWIFT_OBJC_BRIDGING_HEADER = "Nynja-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; @@ -17606,6 +17618,8 @@ PROVISIONING_PROFILE = "0ac45157-141b-4e67-9a87-602efcd8cb35"; PROVISIONING_PROFILE_SPECIFIER = DevBundle_DevExt; SKIP_INSTALL = YES; + SWIFT_COMPILATION_MODE = singlefile; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -17734,7 +17748,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_VERSION = 4.2; SWIFT_WHOLE_MODULE_OPTIMIZATION = YES; @@ -17767,7 +17781,7 @@ PROVISIONING_PROFILE_SPECIFIER = NynjaRC_adhoc; SWIFT_ACTIVE_COMPILATION_CONDITIONS = RELEASE; SWIFT_OBJC_BRIDGING_HEADER = "Nynja-Bridging-Header.h"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_VERSION = 4.2; SWIFT_WHOLE_MODULE_OPTIMIZATION = YES; @@ -17799,7 +17813,7 @@ PROVISIONING_PROFILE_SPECIFIER = NynjaRC_adhocExt; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = RELEASE; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -17917,6 +17931,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.nynja.mobile.communicator.NynjaUnitTests; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = RELEASE; SWIFT_COMPILATION_MODE = singlefile; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 4.2; @@ -18067,6 +18082,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.nynja.dev.mobile.communicator.NynjaIntegrationTests; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = RELEASE; SWIFT_COMPILATION_MODE = singlefile; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 4.2; -- GitLab