diff --git a/Frameworks/NynjaUIKit/NynjaUIKit.xcodeproj/project.pbxproj b/Frameworks/NynjaUIKit/NynjaUIKit.xcodeproj/project.pbxproj index 7b09f72343802f8e252f3b72b4142130de4341f3..aed5185af8844001422adc6b89cac60c681059b2 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; @@ -488,6 +490,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 = ""; @@ -516,7 +519,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 = Spotify; @@ -558,7 +561,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; @@ -571,8 +574,9 @@ 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"; VERSION_INFO_PREFIX = ""; @@ -601,7 +605,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; @@ -658,6 +662,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 = ""; @@ -686,7 +691,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; @@ -743,6 +748,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 = ""; @@ -771,7 +777,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; @@ -826,8 +832,9 @@ 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"; VERSION_INFO_PREFIX = ""; @@ -856,99 +863,14 @@ 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; }; - 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 */ = { + 85AC1343219F27CC002ADE57 /* PrereleaseDebug */ = { 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 */; + baseConfigurationReference = B90E6396110C47D18FB00838 /* Pods-NynjaUIKit.dev.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -998,15 +920,16 @@ 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 = Translate; + name = PrereleaseDebug; }; - 85631BFD20EFC95E0002BE51 /* Translate */ = { + 85AC1344219F27CC002ADE57 /* PrereleaseDebug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 1820AD65D6897E3E306C16A2 /* Pods-NynjaUIKit.translate.xcconfig */; + baseConfigurationReference = 18558C18EB6A4113B623AEDE /* Pods-NynjaUIKit.prereleasedebug.xcconfig */; buildSettings = { CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Manual; @@ -1026,10 +949,10 @@ 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 = Translate; + name = PrereleaseDebug; }; /* End XCBuildConfiguration section */ @@ -1039,28 +962,26 @@ buildConfigurations = ( 8514D4C820EE27080002378A /* Dev */, 5B4DFF722191A0C100E89D17 /* Spotify */, - 85631BFC20EFC95E0002BE51 /* Translate */, - 85631BF620EFC7EA0002BE51 /* Channels */, 85631BF220EFC50F0002BE51 /* DevAutoTests */, 85631BF020EFC4FC0002BE51 /* Release */, 85631BEE20EFC4F30002BE51 /* Prerelease */, + 85AC1343219F27CC002ADE57 /* PrereleaseDebug */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Dev; + defaultConfigurationName = Release; }; 8514D4C920EE27080002378A /* Build configuration list for PBXNativeTarget "NynjaUIKit" */ = { isa = XCConfigurationList; buildConfigurations = ( 8514D4CB20EE27080002378A /* Dev */, 5B4DFF732191A0C100E89D17 /* Spotify */, - 85631BFD20EFC95E0002BE51 /* Translate */, - 85631BF720EFC7EA0002BE51 /* Channels */, 85631BF320EFC50F0002BE51 /* DevAutoTests */, 85631BF120EFC4FC0002BE51 /* Release */, 85631BEF20EFC4F30002BE51 /* Prerelease */, + 85AC1344219F27CC002ADE57 /* PrereleaseDebug */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Dev; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; diff --git a/Frameworks/NynjaUIKit/NynjaUIKit/Core/Collection/ViewModels/SupplementaryView/SupplementaryViewModel.swift b/Frameworks/NynjaUIKit/NynjaUIKit/Core/Collection/ViewModels/SupplementaryView/SupplementaryViewModel.swift index 193a6c513b81d4a5201a606527c428267e3e1641..a2c99eeaa59bb55f5a53282fb0821ff111aed64b 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 ecea64cfb62c2404b92bac2a963a6ba790876020..ab503c85567eb9e0eb949bcae783f3b4b3edf0c1 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 } diff --git a/Nynja-Share/Resources/Info.plist b/Nynja-Share/Resources/Info.plist index 7c5b3060fa8c4ee81507b16e568168c3874b0154..b87f21e7d66323539f7c3f99d94936fe5538daff 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-Share/Services/AttachmentProvider/AttachmentProvider.swift b/Nynja-Share/Services/AttachmentProvider/AttachmentProvider.swift index 4280fc970daca9b0e605b233735039c102251676..c8cfc71a77aeccb0daaa7f66de411d44bf5b04c1 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 } @@ -59,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-Share/Services/AttachmentProvider/AttachmentTransformer/AttachmentTransformerImpl.swift b/Nynja-Share/Services/AttachmentProvider/AttachmentTransformer/AttachmentTransformerImpl.swift index 011ca3f47f00c272cee3505954134e814aa98c0e..7db1c635c495508b0f5dfe2da008f2e67e4b0b08 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 19a61f0c3baf93177b8fc5fa5a88e5983fdd1b13..09ff5b2eb591e5cfd0dc89076284c0d673bd3dda 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 6db4b540859e6cf7969385d28cccac069bc9c80d..34860cf50bb678e1cfcee3e16e3a0ca51f3cf3a9 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 */; }; @@ -809,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 */; }; @@ -849,6 +846,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 */; }; @@ -2703,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 = ""; }; @@ -3064,7 +3063,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 = ""; }; @@ -3102,6 +3100,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 = ""; }; @@ -3296,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 = ""; }; @@ -3948,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 = ""; }; @@ -4196,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 = ""; }; @@ -4230,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 = ""; }; @@ -6183,6 +6186,7 @@ F1313AFE20888CAB00E04092 /* DevConfig.xcconfig */, F10AFE9A20EF8B9A00C7CE83 /* DevAutoTests.xcconfig */, F1313AFF20888CB800E04092 /* PrereleaseConfig.xcconfig */, + 85AC1342219F16CF002ADE57 /* PrereleaseDebugConfig.xcconfig */, F1313B0020888CC400E04092 /* ReleaseConfig.xcconfig */, 5B4DFF6C21919FA000E89D17 /* SpotifyConfig.xcconfig */, F1313B0120888FE600E04092 /* ThirdPartyServices.swift */, @@ -7541,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 = ""; @@ -9207,7 +9214,6 @@ FB16E79520EFAF7C009FA203 /* Money */, A43B25BC20AB1E9600FF8107 /* Validator */, 85F3DD43203F410D00F210C0 /* TimerHandler.swift */, - 85057965206D17AB00565C60 /* ImagePickerHandler.swift */, F1AC0DE2207252E1001C68F7 /* Testable.swift */, ); path = Utils; @@ -9836,9 +9842,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 = ""; @@ -12366,7 +12373,6 @@ 8551CF1021708F7500829CF1 /* Array+Desc.swift */, 4B1D7E102029FF5000703228 /* Array+WheelItemModel.swift */, 4B4266C2204D923400194BC1 /* Array+UIView.swift */, - 26DCB25320692237001EF0AB /* Array+Feature.swift */, ); path = Array; sourceTree = ""; @@ -14317,7 +14323,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"; @@ -14342,7 +14347,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; @@ -14364,14 +14368,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"; @@ -14383,14 +14385,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; @@ -14454,7 +14454,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; @@ -14507,7 +14507,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 */, @@ -14551,6 +14550,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 */, @@ -15443,6 +15443,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 */, @@ -15640,7 +15641,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 */, @@ -15661,7 +15661,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 */, @@ -16653,6 +16652,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 */, @@ -16817,8 +16817,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; @@ -16827,13 +16827,15 @@ 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 = "f6fa31cc-ee3a-42a3-ae54-af6e54db9f3e"; - PROVISIONING_PROFILE_SPECIFIER = DevBundle_DevExt; + PROVISIONING_PROFILE_SPECIFIER = DevBundle_AdHocExt; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_COMPILATION_MODE = singlefile; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Dev; @@ -16862,9 +16864,9 @@ PROVISIONING_PROFILE = "2a318f9e-d0ab-41dc-968a-e1cb13de4de5"; PROVISIONING_PROFILE_SPECIFIER = ProductionBundle_AppstoreExt; SKIP_INSTALL = YES; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = RELEASE; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; @@ -16923,8 +16925,10 @@ 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; SWIFT_WHOLE_MODULE_OPTIMIZATION = YES; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -16977,8 +16981,9 @@ 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; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; @@ -16993,8 +16998,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; @@ -17003,16 +17008,17 @@ 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 = "6001ef39-7fcd-4abe-8f6d-2de8430809d4"; - PROVISIONING_PROFILE_SPECIFIER = DevBundle_Dev; + 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; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; SWIFT_WHOLE_MODULE_OPTIMIZATION = YES; }; name = Dev; @@ -17040,11 +17046,10 @@ 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.0; + SWIFT_VERSION = 4.2; SWIFT_WHOLE_MODULE_OPTIMIZATION = YES; }; name = Release; @@ -17103,8 +17108,10 @@ 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; SWIFT_WHOLE_MODULE_OPTIMIZATION = YES; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -17134,10 +17141,11 @@ 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; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; SWIFT_WHOLE_MODULE_OPTIMIZATION = YES; }; name = Spotify; @@ -17166,7 +17174,9 @@ PROVISIONING_PROFILE = "48a5e679-d09c-4e7f-ae6a-1c92707ffbba"; PROVISIONING_PROFILE_SPECIFIER = LocBundle_DevExt; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_COMPILATION_MODE = singlefile; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Spotify; @@ -17235,7 +17245,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 = Spotify; @@ -17304,12 +17314,192 @@ 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"; }; 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_COMPILATION_MODE = singlefile; + 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_COMPILATION_MODE = singlefile; + 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_COMPILATION_MODE = singlefile; + 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 */; @@ -17364,8 +17554,10 @@ 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; SWIFT_WHOLE_MODULE_OPTIMIZATION = YES; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -17393,10 +17585,11 @@ 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; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; SWIFT_WHOLE_MODULE_OPTIMIZATION = YES; }; name = DevAutoTests; @@ -17425,7 +17618,9 @@ PROVISIONING_PROFILE = "0ac45157-141b-4e67-9a87-602efcd8cb35"; PROVISIONING_PROFILE_SPECIFIER = DevBundle_DevExt; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_COMPILATION_MODE = singlefile; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = DevAutoTests; @@ -17494,7 +17689,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; @@ -17553,8 +17748,9 @@ 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; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -17585,9 +17781,9 @@ 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.0; + SWIFT_VERSION = 4.2; SWIFT_WHOLE_MODULE_OPTIMIZATION = YES; }; name = Prerelease; @@ -17617,8 +17813,8 @@ PROVISIONING_PROFILE_SPECIFIER = NynjaRC_adhocExt; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = RELEASE; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Prerelease; @@ -17687,7 +17883,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; @@ -17710,8 +17906,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; @@ -17734,8 +17931,10 @@ 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_ACTIVE_COMPILATION_CONDITIONS = RELEASE; + SWIFT_COMPILATION_MODE = singlefile; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; @@ -17804,7 +18003,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"; }; @@ -17829,9 +18028,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"; }; @@ -17856,9 +18055,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"; }; @@ -17883,9 +18082,10 @@ 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_ACTIVE_COMPILATION_CONDITIONS = RELEASE; + 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"; }; @@ -17901,6 +18101,7 @@ 5B4DFF6F2191A08E00E89D17 /* Spotify */, F10AFE9E20EF8BBE00C7CE83 /* DevAutoTests */, F1313AFD20888BD300E04092 /* Prerelease */, + 85AC133F219F1690002ADE57 /* PrereleaseDebug */, 357809AF1F9765CF00C9680C /* Release */, ); defaultConfigurationIsVisible = 0; @@ -17913,6 +18114,7 @@ 5B4DFF6D2191A08E00E89D17 /* Spotify */, F10AFE9C20EF8BBE00C7CE83 /* DevAutoTests */, F1313AFB20888BD300E04092 /* Prerelease */, + 85AC133D219F1690002ADE57 /* PrereleaseDebug */, 3ABCE8FE1EC9330D00A80B15 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -17925,6 +18127,7 @@ 5B4DFF6E2191A08E00E89D17 /* Spotify */, F10AFE9D20EF8BBE00C7CE83 /* DevAutoTests */, F1313AFC20888BD300E04092 /* Prerelease */, + 85AC133E219F1690002ADE57 /* PrereleaseDebug */, 3ABCE9011EC9330D00A80B15 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -17937,6 +18140,7 @@ 5B4DFF702191A08E00E89D17 /* Spotify */, F10AFE9F20EF8BBE00C7CE83 /* DevAutoTests */, F1C37AB1209A1BF4005EA197 /* Prerelease */, + 85AC1340219F1690002ADE57 /* PrereleaseDebug */, F1C37AB2209A1BF4005EA197 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -17949,6 +18153,7 @@ 5B4DFF712191A08E00E89D17 /* Spotify */, FE21ACB02113AA7F006010A0 /* DevAutoTests */, FE21ACB32113AA7F006010A0 /* Prerelease */, + 85AC1341219F1690002ADE57 /* PrereleaseDebug */, FE21ACB42113AA7F006010A0 /* Release */, ); defaultConfigurationIsVisible = 0; diff --git a/Nynja.xcodeproj/xcshareddata/xcschemes/PrereleaseDebug.xcscheme b/Nynja.xcodeproj/xcshareddata/xcschemes/PrereleaseDebug.xcscheme new file mode 100644 index 0000000000000000000000000000000000000000..5d95e7450bedcbb19aee0fdd1dbe3af3803a8ec9 --- /dev/null +++ b/Nynja.xcodeproj/xcshareddata/xcschemes/PrereleaseDebug.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Nynja/AppDelegate.swift b/Nynja/AppDelegate.swift index 332ecf388e8093ea60d5c0bc18587aecc72f37e8..2f4810bff36ccfedc4930b7e451596855f057daa 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 b05616b3e6ea96a512a27f9e2150af08193ecc67..80bc5b53192fd6f64e5d324104c7b3f3d9ff3d91 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/ChatBaseFactory.swift b/Nynja/ChatBaseFactory.swift index c3ed697013e33194415c01155e73d0159f87ddeb..4049283f349bf27f93b170ed4f454ff939ad0436 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/CircleMenuControl/Extension/UIView+Mask.swift b/Nynja/CircleMenuControl/Extension/UIView+Mask.swift index deb0a6efc3a6bcd51098dc296205e61f6c9480da..0a618ae9b866bdf00e6799a64a074f06bff992cf 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/DB/Models/DBJobMessage.swift b/Nynja/DB/Models/DBJobMessage.swift index 705505d3130f0225fd88605808f4516fb366435f..440b88796f1250c0eea3e0110e370b3b94e3c243 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/Extensions/FriendExtansion+BERT.swift b/Nynja/Extensions/FriendExtansion+BERT.swift index baee2d550a7cd0dcc95bfeea1a499ae6e9e32348..88b82c1922130f3fc014b644a4f0bdd432575641 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 7f46dd6e9bd10815b324ede27e04b3687cbe55c7..a8dc8035f0d5d5c58b6b3d1b33c90c9035a7379a 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 bf672b0f35c6e77d3f21d7e064af40901f204bca..e357cf1a567a56dc5a2b47a946fcec96b053d02b 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 10c4d72a1fac586b9930832ff14d88ce593014d3..909525893c6c44de16b301a9d71e8d038fb1f180 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/Range+Extension.swift b/Nynja/Extensions/Range+Extension.swift index 3d9e865f85f83cdcc567f356afe99a1e3d838849..552eee73505b41531a1363a01ef3cee69765d253 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 { @@ -71,27 +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: CountableRange) -> Bool { - return range.upperBound == lowerBound + func isAlongside(after range: ClosedRange) -> Bool { + return range.upperBound == lowerBound - 1 } - func isAlongside(before range: CountableRange) -> Bool { + func isAlongside(before range: Range) -> Bool { return upperBound == range.lowerBound } - func isAlongside(after range: CountableClosedRange) -> Bool { - return range.upperBound == lowerBound - 1 - } - - func isAlongside(before range: CountableClosedRange) -> Bool { + func isAlongside(before range: ClosedRange) -> Bool { return upperBound == range.lowerBound } } +// MARK: - Intersection + extension Range where Bound == Int { func intersects(_ range: Range) -> Bool { @@ -101,14 +89,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/SwiftLibrary/Array/Array+Feature.swift b/Nynja/Extensions/SwiftLibrary/Array/Array+Feature.swift deleted file mode 100644 index c54a3bb8424bd9c3dccd5d076b0e52e04b3301a5..0000000000000000000000000000000000000000 --- 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/SwiftLibrary/Array/Array+UIView.swift b/Nynja/Extensions/SwiftLibrary/Array/Array+UIView.swift index 678c0501c693edd6c69f14461546c51b2c554953..4610e1cb29a71bb37b4d1f8a687c6b57f8e2fba9 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 ae063c708a8b60fe0276084784ca5fcc8bda805a..396b31f6c42f8f17c060dbd70eb11304e407813e 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/Extensions/UIEdgeInsets+Adjust.swift b/Nynja/Extensions/UIEdgeInsets+Adjust.swift index b507e9d7da9958f6d6d419971a52cce5dbf4885c..cde0e723b7b40bf14669d0480b6449b8280e983e 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 fee3980a3ad5d8e68e57f9e07dd7b67097489617..575cb8b7cabc995ae6ba24a088c992091acfb1be 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 126d3a8af864880fa377d6750c6f7c78fa57f4d3..7f00924771a45ef53b2370ccd5bb839962a81093 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 + return style != NSUnderlineStyle.single.rawValue } set { - let value: NSUnderlineStyle = newValue ? .styleSingle : .styleNone - linkTextAttributes.updateValue(value.rawValue, forKey: NSAttributedStringKey.underlineStyle.rawValue) + let value: Int? = newValue ? NSUnderlineStyle.single.rawValue : nil + linkTextAttributes[.underlineStyle] = value } } @@ -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/Extensions/actExtension+BERT.swift b/Nynja/Extensions/actExtension+BERT.swift index eb9582cffcd64195819cbf97de92a1d500da7329..64d8c0a550fd65456a53215b54f762fc50aac442 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/FileManager.swift b/Nynja/FileManager.swift index cdec76d9ad58e260b26ed2925e09233a29744dc4..9b7e7378d27f6904d7bd1f0760139984449bdcab 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/Files/AppGroupFlagObserver.swift b/Nynja/Files/AppGroupFlagObserver.swift index d934c1f35e20b1d013d609bb0ad608852d9e2457..15655ddc6a4179ad96c5ceb32d9107e196afab06 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/ImageSelector.swift b/Nynja/ImageSelector.swift index 765f557be01d11a40485f10d44f618578ee8cc2b..bfa583c1b12b83d5054bca2f95e97c36052c5adf 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: UIAlertActionStyle.default) { _ in - self.presentGalleryIfCan() + style: .default) { _ in + 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: [String : Any]) { - guard let pickedImage: UIImage = info[UIImagePickerControllerOriginalImage] as? UIImage else { - dismiss(animated: true) - return - } -// selectHandler?(pickedImage) - dismiss(animated: false) - } - - func imagePickerControllerDidCancel(_ picker: UIImagePickerController) { - cancelHandler?() - dismiss(animated: false) - } - } - diff --git a/Nynja/KeychainService/KeychainService.swift b/Nynja/KeychainService/KeychainService.swift index 2928f1e7b5259ad030402a6969e5bd8f66363a70..abe7580783625517225e856e824117c748fed487 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 1442658fbc3e58a4cc989f67923e2bdce7ee8b65..b6d8358251df744f5090bc5dd01448638efc86b9 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/AlertManager.swift b/Nynja/Library/UI/AlertManager.swift index f0519ed17d6365548da9f8d33f65fa2804db9291..a24aec24b189c142cf9ad99bece3c804f8e6b961 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 d1483d9143f41f328eddbc4b20f8b10fa2eabe87..df8e71e21466bdcbd62871f0c0ba3afeec8e2446 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 63488412e4d5e3a6067d8194d2bd6c16e48a9cc4..77f9889868982794c95936a36ee11172b0845b2c 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/Buttons/TopSwipable/ScheduleButton.swift b/Nynja/Library/UI/Buttons/TopSwipable/ScheduleButton.swift index 8665569003dc3a9818b843418e0ee7866f093d11..1874cd5d8516d2113058167098d58280c5435d19 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/CollectionView/Layout/CarouselFlowLayout.swift b/Nynja/Library/UI/CollectionView/Layout/CarouselFlowLayout.swift index 678bca2080c0958af57d4b78c8c55a2bba5eb79d..73e1f0cf2e80a1a6ab8e239a670b6e99201fb65f 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 25d8fc336e62082d9654881c210e0f5f90c2cb99..b75d9d21f2958b7226ad0f8088df04093ea719ff 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 0802df582b5c6aa166ce7d27ea5c3f3180fe7600..a63f9bfc6901c29491b6fe408dff5476198661fb 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 } @@ -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/ContextMenuOLD/ContextMenu.swift b/Nynja/Library/UI/ContextMenuOLD/ContextMenu.swift index a4d7a06a5935521aac576abfbbdece59001b9c1e..b065abc159bd91970ea44eb05d8f18bfa813f19e 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 f936adddbebab041085673c4053ceaf240cc8da9..177440e170a8879d0b9c3c30f9652b1943a3f65f 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 { @@ -59,75 +62,6 @@ 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.. [String] { - return Array(byWords.suffix(max)) - } - - var byWordsSeparatedWithComma: [String] { - var result:[String] = [] - var word = "" - for (index,item) in self.characters.enumerated() { - if item == "," { - result.append(word) - word = "" - } else { - if index == self.characters.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() @@ -144,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) } diff --git a/Nynja/Library/UI/Extensions/TableView/UITableViewExtensions.swift b/Nynja/Library/UI/Extensions/TableView/UITableViewExtensions.swift index cf007793ccca7e5a3bef255f9c639602b7800367..e6ced1d8396579fefd15547eb0109b4bd5bc48c7 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 c8be625099afa7ae4530ebb7c55fac283d067abe..497ab22deedd269e53eb8665738a61deefa0b139 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 ba7a022edf1c3a3af78c3d0706d31fc4c84e5e75..a936f1323b2bfd20942ad1a987f35560c5a83a53 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 e869721666071857e90f962148232989db082551..387b2dedcf95dcf776c25aad4436366a09db9d5f 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 6fa8a24bfb10e1b7fd91de19532d348987e018d0..09937697bcb9004ad68aacacd8ca4c21f172639d 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 678cd42e8e4cee30893470a0a930232aa484615a..ff3b3cb3513b245778742bcf8ef5a7297772abd3 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 } @@ -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) @@ -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 } @@ -300,7 +300,7 @@ UIViewControllerAnimatedTransitioning, UIViewControllerInteractiveTransitioning self?.fadeView.removeFromSuperview() } - var scaleAnimationOptions: UIViewAnimationOptions + var scaleAnimationOptions: UIView.AnimationOptions var scaleInitialSpringVelocity: CGFloat if self.canPerformContextualDismissal() { @@ -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 } @@ -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() { @@ -536,7 +531,7 @@ UIViewControllerAnimatedTransitioning, UIViewControllerInteractiveTransitioning case .changed: let animation = { [weak self] in - guard let `self` = self else { + guard let self = self else { return } @@ -578,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/ItemSelector/ItemSelectorCell.swift b/Nynja/Library/UI/ItemSelector/ItemSelectorCell.swift index f2839dd90e9e23e5b651e74b592256706045debe..3dce9be3cafcfde4d06fd983257f8636b0486146 100644 --- a/Nynja/Library/UI/ItemSelector/ItemSelectorCell.swift +++ b/Nynja/Library/UI/ItemSelector/ItemSelectorCell.swift @@ -10,7 +10,7 @@ import Foundation class ItemSelectorCell : UICollectionViewCell { - static let font = UIFont(name: FontFamily.NotoSans.medium.name, size: 14) + static let font = UIFont(name: FontFamily.NotoSans.medium.name, size: 14)! override var isSelected: Bool { didSet { diff --git a/Nynja/Library/UI/ItemSelector/ItemsSelector.swift b/Nynja/Library/UI/ItemSelector/ItemsSelector.swift index 0023aeb0b512b6778f67fa75ffc1c544c55872d4..97044836574b3d2ac7c62b66595f0f70104cf71b 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 85f75ef46c9c64ac536bd7236148c06c8f103413..31bef1005da10a59d5863dac7537586451203e82 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 b80c49b9ed9e71ae88659387cd872a00aaf0fdee..9f844b6dccd807b47422a53f7240a0d6e7f125c2 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) } @@ -133,7 +133,7 @@ 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 c0c44cc226b785112da28533472b7ef70c3a50e5..8813713608074f271d566dcad503ac9953097cc9 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 729935d18057249f38f0073f40b88109c029dccd..469608a26a3b3e9ae62badcac6c090c786cd6e74 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 65c4aaad79961c1555090d45a6255e485d8c255d..4624503c3035a65e3b87c7882f899a5d9ec14f5f 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 2ea5733d7adb85af2e91ab48edb727160be7121d..4f0173f87dc3ff433af672486cc531b5a5148ab7 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 399300621a921a6b2cd65d9868f9f9693fcd3045..757691495e1dc3cac857ad53ef3c7f639c4e4a99 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 f64fee4af139a5517c53cfab065ed26ff4027806..4376bfbfc2d61748c650027daef81acf96e675a6 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 49ade53171646c02df3565589e4d6f8f8acde2ea..e65f209342253429cbb893bfb1af94c0d2efb4fe 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/InputBar.swift b/Nynja/Library/UI/TextInput/InputBar/InputBar.swift index b1ea9ec47893722c09c713ba3a55f95591405057..b9e4084451ef274379e61977eff088d1b4204de5 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/TextInput/InputBar/InputContent/TextInputContent.swift b/Nynja/Library/UI/TextInput/InputBar/InputContent/TextInputContent.swift index dd858f34952ad3c681494572bef43c1d5fb12c64..70a153481a1790fd3873c4009770a00852ec4d4e 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 2c00010b124af29247c177d65158a8f06e56ab84..2cb02ab5faa9502b967c031c30901b37ed5ce736 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/PhoneField.swift b/Nynja/Library/UI/TextInput/InputField/PhoneField.swift index 0fd156bc7ffa58db687530e4eb436b61858cc77a..72eea07c5365f84a75a7f2d5964b97b31d7db3aa 100644 --- a/Nynja/Library/UI/TextInput/InputField/PhoneField.swift +++ b/Nynja/Library/UI/TextInput/InputField/PhoneField.swift @@ -142,7 +142,7 @@ class PhoneField: BaseInputView, UITextFieldDelegate { func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> 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/Library/UI/TextInput/InputField/TextField/TextField.swift b/Nynja/Library/UI/TextInput/InputField/TextField/TextField.swift index 56b144fad54164656dc7d3be3a270586abe876bc..5a613b91e2af90b29a098cce47bfa199d4943297 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 7abb743cb7ff7eafb3d28286c6f617264f4b9dc0..8f114461168e0c32c944becd0a2119352b206cdd 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 5928411bd2b4cb0003c307c94ccf983c17e0f103..b4c08004bb7ffc602123b0c19247361cfdc8ce96 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 0c053a4f9ff8bd65d0c78de77446d27883ba00cb..38d709e8e1b4de2a840a69dce516ca27c3431774 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 b11f96c41360045fba6ebd99b706cbaf9772fc42..b33c3db775a22857a2e616010f206a4c4ca058d4 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 2eb82a3b000a4b87cbaaa87eb29594774cd60759..90e98f37979d3a239e0d1b915e50115f5addd300 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 a68742ac76fa8fa6cbf99964fb8a582003bcc8bc..1d43b66d46ef5fff061ffc8b4548056c19ce28b5 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 80bb0941bb8b43e6a8165ea245409e4bc39d6844..d7e29515113f6fc39facaf7159d1082d4d2fa96e 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 0cf9878b39c15bba024ef02d10c05288da651814..901165da9d83e669674bed79b72e7c7a60a97abe 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 29b0fc8455919bc69da09e3364674fe05c058217..3aa0ea24da3becb35782dfad34d2bd59474278b3 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 7f6573ad5b063795ed8955aa3989566bafb7bc99..619acc4e2bce72ae687e7f3c44ac8c26ea241352 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 } @@ -540,9 +540,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 78aecf9c386f15b75c29910d52a3045525ba4e5c..2fe8dbdcf821e0dbf609f3192e48fe54e265ba71 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 e91e2edc91e14aaeb8ffd97a1001456cea15229e..7fbc08b38453498fa99fa5131c1c8040617efc04 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 6b6acf72ecdb93538478ef337e4d1725cf983742..1f3fff91e4740fbf2165f1932000a66a9df4b5d7 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 4d80c51eaa356049e03967891348f575a87fc495..cf9eef5fc3a0ac9b6b75f81502d59fc5b106f384 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 bb649eccd4bf2e193325c64b78e1ca5dd192635a..0e8f49ddc17241f8146d6991034de260a627f43f 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/MQTTModels/DescExtension+BERT.swift b/Nynja/MQTTModels/DescExtension+BERT.swift index b54e87761c8aeb89847272403d7075a26d6af6ed..79226ca3dabaec5f5cb3235847051c577a7c7f45 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 2de47fd579a9a2080416e9ffdd29cb03265abe31..3520574e7f5d60af389435adddd19a13d58cc8a5 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 b8fe8b296fdc2962252e30631ea2722c97e5e1c2..d93009058d7d9891b4456a9a7e5821116d2baceb 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 a69ec793a5b28f6b14d5c254f9cf50f08bac124f..cb713168136ab20b6c03000da72edba79df44d73 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 54369b5a131a82b3719489e521530f9daed66d14..3a793308f138b9e46528f0829348598db179c936 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 ffde6954895473c535945f3279409aeaa206d986..5dee75746f29b848f185cb7d07ab4ab61b8b0128 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/Modules/AddContactByUsername/Interactor/AddContactByUsernameInteractor.swift b/Nynja/Modules/AddContactByUsername/Interactor/AddContactByUsernameInteractor.swift index 21d47a38e4c9670ccbf18447c72b5fbb0104b731..f5a46ed137432df4e889cf19358afe909b1dc1b7 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 b3e89801c91bff6e6a5b8818808218e91989a17f..93654da2192ee2eef8b31da8601f666d937f27da 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/AddParticipants/View/AddParticipantsViewController.swift b/Nynja/Modules/AddParticipants/View/AddParticipantsViewController.swift index be8274d3bbca3903c3430f775fefd90675e4a88d..f16476cb8d2297dda3568d5041521020ed7e5483 100644 --- a/Nynja/Modules/AddParticipants/View/AddParticipantsViewController.swift +++ b/Nynja/Modules/AddParticipants/View/AddParticipantsViewController.swift @@ -339,14 +339,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) } } @@ -538,11 +535,11 @@ 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) - case .updateGroupCall: + case .updateGroupCall?: fCanSelect = participantsDataSource.selectedParticipants.count < (presenter.maxParticipantsToAdd) default: fCanSelect = true @@ -576,7 +573,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 28939c6d3c02821d1e84b639702895cbcbad681e..8fbe1fb1fa5acdaf05396b9ad010b11f717487a8 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/Interactor/LoginInteractor.swift b/Nynja/Modules/Auth/Login/Interactor/LoginInteractor.swift index c0e1a555ba35260a1edaf507eec5b3cb84494e65..9e673cac10c137eaa50911a40f51a652cbbf88de 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/Auth/Login/View/LoginViewController.swift b/Nynja/Modules/Auth/Login/View/LoginViewController.swift index 44903d7d4d30d203310b4d949a4d66a5bbf16365..72d403c33130341f378a4089aab67335bc3234cc 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/Auth/Login/View/LoginWheelContainerDataSource.swift b/Nynja/Modules/Auth/Login/View/LoginWheelContainerDataSource.swift index ce1f7fdfb0c982b8ebab76b57070e5276cc1b512..725fcd2322753135ac5163e28da4470eb7af0796 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/Call/CallScreens/CallInProgress/Interactor/CallInProgressInteractor.swift b/Nynja/Modules/Call/CallScreens/CallInProgress/Interactor/CallInProgressInteractor.swift index 454383e50c12c8b0a44bbe7ac78d183377af3e71..aeca6525f63a90acb28ae1b26c29e0503451ea0d 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 531e3ace49211e1b126fd4377a6736c3b70f6cd5..f39088ebdd29a62ff269b80e54786e046c871ac2 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() } @@ -561,7 +561,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 49a8c6b3c6c62b97add40edc5fbebd5444ec9730..d8cbcceda3bbed36664f9e6db051acb1e484e3ef 100644 --- a/Nynja/Modules/Call/CallScreens/CallInProgress/WireFrame/CallInProgressWireframe.swift +++ b/Nynja/Modules/Call/CallScreens/CallInProgress/WireFrame/CallInProgressWireframe.swift @@ -129,7 +129,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 0374f03f48704ad6fe67cc07680de243b337bf18..c8cbab08e5f08cc0ed4b3abdcaf666a009bd2254 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 0cfa32bb635625c5193c58f66f41046ab46b4309..9fb80ebf14589a4c45331b14261873d66387376b 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 7f512269ceacaf2deee96ea1c522660f2c16808d..6d2e8c0bc1322347c9d2845a90d0773aa1fc8e8a 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 a393b308ccd32ef35f5665edd3a77e982e08dee2..4a861a10d6ade5734c370494dd2f3af123f94b53 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 949f194a429ee88e65b62b78c2ffb5a7e77ecd1e..a689b7138cbccec3a75f9f4a2489bd5caaf66831 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/Interactor/CreateGroupInteractor.swift b/Nynja/Modules/CreateGroup/Interactor/CreateGroupInteractor.swift index b532a3ad0c1c0490dbe0a1961cb9b919002625f9..269e3a90806bb05f0ef981b0bb0c6744ac2849d4 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/CreateGroup/View/TableView/Arrow/CellWithArrowTableViewCell.swift b/Nynja/Modules/CreateGroup/View/TableView/Arrow/CellWithArrowTableViewCell.swift index 48fe66110d564014323b90c77e9b050e704dcee8..8ff677650f740bf79f0ec2a161d04296de4e3514 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 959770715474b69e91e9996c97a2e0caf1b939de..12e45d4c7d4f16b8a0042b4381363a5e9acc2ce8 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 da2f25ef75497936c7150957ff95124f1df40000..26b9bb20e8427bed840b42aba1fec3fc348541b9 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 6c0ed90e71141b451dcbab4e59fd12b362e03d9a..eed9388de6c61eb6c29ab8e9efcee1c47ce4d343 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 ad1819d5a13510e5f6be398fd7b0ced355a0c1f8..46e737b3d78309637fd8cd4ad277eae08610dcfe 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 5a4214b5763e10f7842e56f2c6f8f603e355592c..92cfca816ddb9e610c0e7a2e621c8733f2b66481 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 3a2699f940641a58c0395e36df8aa9af1faf74de..ede35722d2d5ff98d22ef156ac82ef5e9cd24988 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: .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 4f94eec60b0e3c14c76e1794ba2f40f8ab66177f..c9afb9ed23905b763d0247788460e776ae001022 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 5a299a2e8bf74f2138427819483ec5e4b5d70241..8871e7bddffd6cc2bac3865822e89e7613ab0f4a 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 0a5f197edd81fb17119b671e6e638e969a8bb223..edf8dc83ddc3d65fdaa73615d892a4f2ca86c63f 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 a16aca9ec8f3ff397492acb200391792492313e3..2972ec357c3b545d92c362831cde2d0ff0ff2040 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 } @@ -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 b9169ebba3ce24b04c8637764c97b1f094c34aae..8325918a18cbd24f195694d6b095740be2fef7ce 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/Presenter/GalleryPresenter.swift b/Nynja/Modules/Flows/GalleryFlow/Gallery/Presenter/GalleryPresenter.swift index 64c600cb56ebc10544a31d1b3192e579efe4e39d..f875666d45055e3cd7e24ad1393b21cc43f0d4df 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 f6f3f135b1010937223344f1d769cee957722619..d1a8c4c157bca669b89ddaa548d5d34635fe91aa 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 } @@ -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 70a31cb1a428fe82b448e0812e4f050ca4ac1c2f..3ce533e6da8caf8d90495754b5e2280fa8732b38 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/Presenter/MultiplePreviewPresenter.swift b/Nynja/Modules/Flows/GalleryFlow/MultiplePreview/Presenter/MultiplePreviewPresenter.swift index 6f0ce8c4da0fc9832b9b39140a5eea3d08392939..da0cf91dfcc2a17e43b0df34d0adbf9a14ae36a5 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/MultiplePreviewViewController.swift b/Nynja/Modules/Flows/GalleryFlow/MultiplePreview/View/MultiplePreviewViewController.swift index 139f0ff15f0409cb589626558f7c77b39af8f0de..85b7a18695e290a975be43bf13495d71aabfb59e 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/ImagePreviewCVCell.swift b/Nynja/Modules/Flows/GalleryFlow/MultiplePreview/View/Subviews/ImagePreviewCVCell.swift index cde7069496fc99d8a284947f346a00fbd70b3cd4..5daafd08eeb23c95e2beda0cffbe50f38a8900fc 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/Flows/GalleryFlow/MultiplePreview/View/Subviews/VideoPreviewCVCell.swift b/Nynja/Modules/Flows/GalleryFlow/MultiplePreview/View/Subviews/VideoPreviewCVCell.swift index 9d7b375a0a458afea2349599e017c8491a3beba6..3dc2a5b70c01fd013ded20dab05fe55a34acd80f 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 0d6294000ffd7caff78d12467e43acccdadb142c..662a272c789f951ac645c76f2dfb705988c609bb 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/GroupRulesViewController.swift b/Nynja/Modules/GroupRules/View/GroupRulesViewController.swift index aaf240d6878f199c73cba592cace18867541c547..9a748d7020fb3c7df7f2c089084eccb763923654 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/GroupRules/View/UserGroupRulesVC.swift b/Nynja/Modules/GroupRules/View/UserGroupRulesVC.swift index bf8b14d3e37784a3473d6a77c50413133f57af6d..118c3f7bb86392eda63bf4e8a396775c1fc46745 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 765599504b0064862a8e769dfa03c7d9305862b5..f746cddb1fda68c72a8c5551e0675f32fb796778 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 309b2ad6f9cea17517397ea7eee100358c22e350..85d281c95117fd6b9384fc9834362f2a338ba03e 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 77718c382f6fbf8471e773c54ad2937f0456975c..cd1ff9ad68366d32d1031e9e5270a96622e6343a 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 0675e2bcf342cbaf83df3c8901064746e67210ae..452b55f3ee4070c8a71d4092b1372141735fec19 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 54fc601054c8297be9249eb643882f5f040c5915..038086a16dab4becb522a71fbc45c321346eeb19 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 dabba83f36b968e84a7a924d58d59fcd48637ca1..11f44b6481d6b159b432df1af6142f6d50d03ac9 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 d5a4add1e09e1a5f642cbea693398ae6b713e862..b59640e4885e54c402065db3539a269daa7db289 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/GroupStorage/WireFrame/GroupStorageWireframe.swift b/Nynja/Modules/GroupStorage/WireFrame/GroupStorageWireframe.swift index f6b69ef6716e9d84288ebd198f402413ff96f5ec..9a18f9b9f16b674774908db364b6a7537c3b5975 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/View/GroupsListViewController.swift b/Nynja/Modules/GroupsList/View/GroupsListViewController.swift index 780533112f8007ae20b227a218f2230e6caf7f26..20b33a03d85a5d0b2675948859237a462b775fbd 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/GroupsList/WireFrame/GroupsListWireframe.swift b/Nynja/Modules/GroupsList/WireFrame/GroupsListWireframe.swift index 3db6d4df5599742459d5f5299f85c2822cd85f30..8851cc245d94f6620648d5c3f892eb16edd0d5c7 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/History/View/HistoryCell.swift b/Nynja/Modules/History/View/HistoryCell.swift index 50e19b2cc0324c4b6ee5e732ee770a3c5ba36b12..b0ce0acd454ff69f22eebd28665ddf232421399e 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 5e24ce37b289a9a020c06af5b21ab054301ecd29..bb502999190c8e4507ba6473080e9f7df1a253ab 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 } @@ -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 } @@ -274,7 +274,7 @@ extension ImagePreviewViewController: ImagePreviewTransitionHostVCProtocol { prepareScrollView() - view.bringSubview(toFront: closeButton) + view.bringSubviewToFront(closeButton) } } @@ -300,12 +300,12 @@ 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 } 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 165fcd62e6e47e1b8500b90afd02f7471021f447..ceb03287ab6ba5ca45da2e9636a1eac370b2e840 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 efa3c109ef7180ba2d337ead6a92c1900cbd3cdf..2771da582298cc53eacf7281aa81c72b0b6918d1 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/Presenter/ChatLanguageSettingsPresenter.swift b/Nynja/Modules/LanguageSettings/LanguageSettings/Presenter/ChatLanguageSettingsPresenter.swift index dc21d34cc9439acd16be90e3482ebc9dba1d3625..caecbeb985c2867f436c010d3958ffcc02a06512 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/LanguageSettings/LanguageSettings/View/ChatLanguageSettingsViewController.swift b/Nynja/Modules/LanguageSettings/LanguageSettings/View/ChatLanguageSettingsViewController.swift index d2e7736e43741422ccaeef89a6ddc34e69bdbd43..0bdbc76ad06b1542348cc7112af60a659dab6d09 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) diff --git a/Nynja/Modules/LanguageSettings/LanguageSettings/View/TableView/Cell/ActionCell.swift b/Nynja/Modules/LanguageSettings/LanguageSettings/View/TableView/Cell/ActionCell.swift index 08a07e720e94dbd3bbdcb278cf194fa8b2cfbcde..0d81046068bdff66fd831b3249c581914086594e 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 0841f450917590f635a52d86b5881f7d62a90464..e2e16327cfa81a694003aee415d6c4fa659e3cd8 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+Gallery.swift b/Nynja/Modules/Main/View/MainViewController+Gallery.swift index 353b7bbcd6b3da08eea260e7b957972cc5a068d1..e50eaa1ab803ad179b08a8a3c7d521b495981a29 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/View/MainViewController.swift b/Nynja/Modules/Main/View/MainViewController.swift index 36d8fc95ffb81febca43d1bfca7ba9b69bb74448..6fff424627a5ee359f0b715dfe875faa09ed4552 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: UIBlurEffectStyle.dark) + let blur = UIBlurEffect(style: .dark) var blurView = UIVisualEffectView(effect: blur) v.addSubview(blurView) @@ -233,9 +214,9 @@ class MainViewController: BaseVC, MainViewProtocol, HitTestDelegate, UINavigatio maker.top.left.right.bottom.equalTo(v) }) - let activity = UIActivityIndicatorView(activityIndicatorStyle: UIActivityIndicatorViewStyle.whiteLarge) + let activity = 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,12 +236,13 @@ class MainViewController: BaseVC, MainViewProtocol, HitTestDelegate, UINavigatio self.presenter.viewShowed() viewShowed = true - view.bringSubview(toFront: gradientView) - view.bringSubview(toFront: container) - view.bringSubview(toFront: nextButton) - + + self.view.bringSubviewToFront(gradientView) + self.view.bringSubviewToFront(container) + self.view.bringSubviewToFront(nextButton) + if view.subviews.contains(uiLocker) { - self.view.bringSubview(toFront: uiLocker) + self.view.bringSubviewToFront(uiLocker) } updateWheelGestures(enabled:isDoubleTapEnabled) @@ -508,7 +490,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 @@ -565,22 +547,16 @@ 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, - let sendingType = info[ImagePickerHandler.SendingType.key] as? ImagePickerHandler.SendingType { - switch sendingType { - case .default: send(image: pickedImage) - case .asFile: send(image: pickedImage) - } } } @@ -603,7 +579,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 { @@ -666,7 +642,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/Main/WireFrame/MainWireframe.swift b/Nynja/Modules/Main/WireFrame/MainWireframe.swift index be8b325b8c8e32faec0470ebff160a241e91b914..392bd7b226696efff94438fdc09238daca8931b1 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 d7775cb5177986a04f3f8c6ed2b2fb151631b1ae..2fc02c760e93f9101bdbf73afbb1b273b981a184 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 ace2b8b33940e549dd45728aeadf24ac85f00b62..a4a0bab667307ee3ca99f828dd503753f438a39c 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 91d5550c4c1074126dc1797a2c6275438e9c0fcb..142570c5f9a60c3b62e56b9ed48994b16193ec87 100644 --- a/Nynja/Modules/Message/Interactor/MessageInteractor+Transcription.swift +++ b/Nynja/Modules/Message/Interactor/MessageInteractor+Transcription.swift @@ -87,7 +87,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 d455ff61bb155d1ae3b1223047236d17fb0d0cf5..9ee9d165fd43455dd53cf25c7d3141cd1c771a55 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() } } @@ -930,7 +930,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() @@ -1071,7 +1071,7 @@ extension MessageInteractor { try? storageService.perform(action: .save, with: message) translate(message: message, language: sendingLang) { [weak self] result in - guard let `self` = self else { return } + guard let self = self else { return } switch result { case .output(let output): diff --git a/Nynja/Modules/Message/Models/Mention/Payload/AttributedText/MessagePayloadRenderer.swift b/Nynja/Modules/Message/Models/Mention/Payload/AttributedText/MessagePayloadRenderer.swift index e80b138710fd27998c823581359834cb69139131..0c410ecb43c7d3f868e428f8d7278d7b32d539c8 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 6c80a3714957df9d363fc2353d3d16a8c421b360..70659a437157cec2e17c9097d5879f9a0489832c 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 48b28d44312a53abce0f0373dd98922601e53957..ab06e074e499e744319557df21316cb83290fb92 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, @@ -343,7 +343,6 @@ class MessagePresenter: BasePresenter, MessagePresenterProtocol, MessageInteract }) } - func translate(input: TranslationInput, translationHandler: @escaping TranslationHandler) -> CancelAction? { return interactor.translate(input: input, handler: translationHandler) } @@ -356,8 +355,8 @@ class MessagePresenter: BasePresenter, MessagePresenterProtocol, MessageInteract selectorLang: selector, 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.sendingLanguage = selectedLang }) @@ -372,7 +371,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 +385,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 } @@ -788,12 +787,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 } @@ -802,7 +801,7 @@ class MessagePresenter: BasePresenter, MessagePresenterProtocol, MessageInteract model.imageSize = imageSize } model.video = attach.payload - case .image: + case .image?: guard let thumb = message.thumb else { break } @@ -810,15 +809,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 } @@ -1115,7 +1114,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) } @@ -1139,5 +1138,4 @@ private extension MessagePresenter { deleteForOthers: deleteMessageForAll) } } - } diff --git a/Nynja/Modules/Message/View/MessageVC+StickerInputModuleDelegate.swift b/Nynja/Modules/Message/View/MessageVC+StickerInputModuleDelegate.swift index efd8d73aafd1da9869a25d6152045222516ff024..0193d83da1290d056f22de0d505238662e21853f 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 45c7cf606f9b4544e9b65e116aeca07a690ce169..f9c89e06c5260bff27702d973a2209d85a0620b2 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) } @@ -439,12 +439,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 @@ -482,11 +481,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() @@ -501,11 +498,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() @@ -566,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() } @@ -581,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) } @@ -603,10 +599,10 @@ 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.bringSubview(toFront: self.stickerPreviewContainerView) + self.view.bringSubviewToFront(self.stickerPreviewContainerView) } self.stickerPreviewAnimator.handlePreview(with: previewState, in: self.stickerPreviewContainerView) } @@ -625,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 { @@ -658,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 @@ -671,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 @@ -792,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 } @@ -804,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 { @@ -1144,7 +1140,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 } @@ -1795,7 +1791,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/ChatCells/BaseChatCell/BaseChatCell.swift b/Nynja/Modules/Message/View/Views/CollectionView/Cells/ChatCells/BaseChatCell/BaseChatCell.swift index 4f4f85ea51f9132b70788f902b51ee06a5f41b51..9b7f9ca1fa0be76ba249b07fd856a2e837b6c59a 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 @@ -11,8 +11,8 @@ import SnapKit class BaseChatCell: UICollectionViewCell, MessageBaseImageViewDataSource, MessageContentAppearance, MessageVoiceViewDelegate, ReplyCounterDelegate, MessageRepliedViewDelegate, MessageTextViewDelegate, MessageForwardViewDelegate, MessageStickerRepliedViewDelegate, MessageConvertionViewDelegate { - private static let senderFont = UIFont.makeFont(with: FontFamily.NotoSans.medium.name, height: CGFloat(22.0.adjustedByWidth)) - private static let translatingFont = UIFont(name: FontFamily.NotoSans.regular.name, size: 12) + private static let senderFont = UIFont.makeFont(with: FontFamily.NotoSans.medium.name, height: CGFloat(22.0.adjustedByWidth))! + private static let translatingFont = UIFont(name: FontFamily.NotoSans.regular.name, size: 12)! weak var delegate: BaseChatCellDelegate? @@ -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/ChatCells/BaseChatCell/OponentChatCell.swift b/Nynja/Modules/Message/View/Views/CollectionView/Cells/ChatCells/BaseChatCell/OponentChatCell.swift index 49e4ec85ff9a8fb19b46efa6635db9e94e379e5c..255242771010ab4b73ef77bf0dc2060edec8bfb5 100644 --- a/Nynja/Modules/Message/View/Views/CollectionView/Cells/ChatCells/BaseChatCell/OponentChatCell.swift +++ b/Nynja/Modules/Message/View/Views/CollectionView/Cells/ChatCells/BaseChatCell/OponentChatCell.swift @@ -163,7 +163,7 @@ class OponentChatCell: BaseChatCell { // MARK: Layout override func layoutSubviews() { super.layoutSubviews() - var corners: UIRectCorner = [.topRight, .bottomRight, .bottomLeft] + let corners: UIRectCorner = [.topRight, .bottomRight, .bottomLeft] bubble.roundCorners(corners, radius: radius) messageView.roundCorners(corners, radius: radius) } 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 fed72bf9f8a4f3230e598b0f1d097cdf5edb41d1..f58aff1b88a720b686011845283d4648d214e41c 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 25aee671f31724e12f5c7e66c84df2adf131f71b..af7a256d2eb7ace7d6c257bd55bbb96c3bccf44a 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/MessageForwardView.swift b/Nynja/Modules/Message/View/Views/CollectionView/Cells/Views/Message/MessageForwardView.swift index 04917621445c17f769ae8dee5e76871a622f7774..fbd566fde4c376d8c21a4415d65fd2f51f7757d9 100644 --- a/Nynja/Modules/Message/View/Views/CollectionView/Cells/Views/Message/MessageForwardView.swift +++ b/Nynja/Modules/Message/View/Views/CollectionView/Cells/Views/Message/MessageForwardView.swift @@ -17,7 +17,7 @@ final class MessageForwardView: MessageContainerView { weak var delegate: MessageForwardViewDelegate? private static let forwardFont = UIFont.makeFont(with: FontFamily.NotoSans.regular.name, - height: Constraints.forwardLabel.height) + height: Constraints.forwardLabel.height)! override var coloredViews: [UIView] { return [self, forwardLabel, contentView] 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 eae0ddee820e6590b18e21a8ced0930c43880a73..760585b3ac4ab7e0d236d713eadb7200eaea6a55 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.rawValue + ] self.addSubview(v) v.snp.makeConstraints { make in @@ -170,12 +170,9 @@ 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 } - if let result = self.textView.delegate?.textView?(self.textView, shouldInteractWith: url, in: range), !result { - return - } self.delegate?.showMenuForURL(url) } } 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 8524b8cf950469dedaedf061f204b6a513f55e51..1a7761df8a81d0ed84c5a9ce909ace0752681a60 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 c0e6dd148c6414a3c05d2a0ed41161e9d1b6f5f1..10c025d0b6b80c3f98a7562f181f752705d9351c 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 17e5461d091e6858e2110b5bc8bef09b70290b58..6d7224948229de4faf4c8fa885a53f84015e0427 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/OtherUser/View/OtherUserViewController.swift b/Nynja/Modules/OtherUser/View/OtherUserViewController.swift index 7f05451425c2bc6ab1dbcc1c637d4931b99c26f9..a424609f3a6edf54d8a3eac4399054fdf2f116ce 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/Profile/View/TableView/Cells/ActionCell/ProfileActionCell.swift b/Nynja/Modules/Profile/View/TableView/Cells/ActionCell/ProfileActionCell.swift index c0ee95d2b4264f49dce8df88327a441b35b904ff..879f4c7ab95cdc87e343a471289aa2e914bca0c2 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 e7efc03173e2e9cdd99a1cfa23a947b02c57b7ae..bc8ef3ff25e1974164ee077c023f34cbcb513d47 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 feff2cda2012d84d513abde010bf84ce8ee8544b..2f04a3dbb007442abb3fde4b985b67fe8489d885 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 897e9a736b9b2ec03e9b39cde66edc96c819317e..30b6226e5d7becf1573fc9147c70057d81c329f0 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 c038a9756e8d3a4d94e5a742690e1d30e0c53282..eeae4ad9580b7849dc8d027910c32ff517fa8785 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 9cd4aa015a75618e5068ebafa3fd973ad3702f01..d4d401b17fb869a4d628240b6c0de7c44b899816 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/RepliesProtocols.swift b/Nynja/Modules/Replies/RepliesProtocols.swift index a40350125bcb95527108d4adf23a1e51e6d17a96..8c4f3cfa1dc4acbb68144498e556c904bc0b61d0 100644 --- a/Nynja/Modules/Replies/RepliesProtocols.swift +++ b/Nynja/Modules/Replies/RepliesProtocols.swift @@ -11,7 +11,7 @@ import CoreLocation //MARK: - Wireframe protocol RepliesWireframeProtocol: class { - weak var main: MainWireFrame? {get set} + var main: MainWireFrame? { get set } func present(navigation: UINavigationController, main: MainWireFrame?, redirectAction: ((String)->Void)?) func hide(completion: (()->())?) diff --git a/Nynja/Modules/Replies/View/RepliesVC.swift b/Nynja/Modules/Replies/View/RepliesVC.swift index 967933a6f8d31653e9217db44a8611cd3cb14f69..2301446a088ed7cf307b46f8b2f40e836b8d8949 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/ScheduleMessage/View/ScheduleMessageViewController.swift b/Nynja/Modules/ScheduleMessage/View/ScheduleMessageViewController.swift index c74ed542c3823a88f051b629c176f12f50b132be..6b92e75675a238b090509bb5ad9e96c6f95dbc9c 100644 --- a/Nynja/Modules/ScheduleMessage/View/ScheduleMessageViewController.swift +++ b/Nynja/Modules/ScheduleMessage/View/ScheduleMessageViewController.swift @@ -262,11 +262,11 @@ final class ScheduleMessageViewController: BaseVC, ScheduleMessageViewProtocol, audioModel = model let audioItemView = AudioItemView( dependencies: .init( - canInteractionHandler: { [weak self] in + canInteractionHandler: { 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/Settings/ChangeNumber/ChangeNumberStep2/View/ChangeNumberStep2ViewController.swift b/Nynja/Modules/Settings/ChangeNumber/ChangeNumberStep2/View/ChangeNumberStep2ViewController.swift index 9b1d8153c673c6353d6bfd3a8ec395d750aa4af7..e02b2032157a01c6d6504b3952ad567bc7f92bc8 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 b18c5294e4448ebae18625f06796ffa4ac109114..648650cdcfc1490bb7c72d450d2786c0c713fa8f 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 031b67fb5136140f62c0d4a0e4d818ab157ff86a..d47377cbed9d97c25e81dba12a4b2f9b7dbc8545 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 dae24bb84ff94b2a4db48d32e0795531d2d37a8e..c48af4c0bcfc60cfe0dbeea2968e59cdd9210e6b 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 b803a32e053803ddfedd89cc02bd2b898026c6d0..d74c0b8880e50fb9dd2be8fc156ec74e0cf75efd 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 4cffbfcf03d8503d58bca5215ffe642fee012ab6..c504dffc005ea80dc82a08ef7a6bdc96de984a41 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/Splash/WireFrame/SplashWireframe.swift b/Nynja/Modules/Splash/WireFrame/SplashWireframe.swift index decce33128789c0c43ff81e1b325ae7079533f0d..bb0813ff54602f32ea699cfa22c5f4aa783e8e26 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/Modules/Stickers/View/CollectionView/Cells/ScaleAnimation/ScaleAnimatableGrid.swift b/Nynja/Modules/Stickers/View/CollectionView/Cells/ScaleAnimation/ScaleAnimatableGrid.swift index 100f422ddadfe8f4c56595cf8cd50af114d56424..459c1084e56d88b4bdda35906db6de05dcebb384 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/SearchResultView/StickerSearchResultView.swift b/Nynja/Modules/Stickers/View/SearchResultView/StickerSearchResultView.swift index 061abe1f3bd8b54eadfc7a7f40c1810f12fcfe1a..160c05dbdbcace437f2796747421cc7998536de9 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/Stickers/View/ViewController/StickersInputViewController.swift b/Nynja/Modules/Stickers/View/ViewController/StickersInputViewController.swift index 7a2e0e166b70d312e92b743d7763a1f5daa5b63a..5f7f381dac012c5626b5b84ac7a4eac8b556eaee 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 0b5875b02cc2b2415f1e5f9d792f8c9f2da3cb50..aa1db6c0ae6fcace57f643dc99549cba79b3642e 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 3f4e6dbcabc97de03e14d309bb3f412ce72948d5..c49857e4c1158c6fc60312b5eca6c101836435c9 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/Interactor/PaymentInteractor.swift b/Nynja/Modules/Wallet Flows/Payment/Interactor/PaymentInteractor.swift index 313286a746e464a826b277983ba82bc4476ccfba..30fa11f83dba94ca78a1093ca46b78add6c0f291 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 151ad0c6fd0bb0cc3ebd6a2ab303cd04012ae840..044d0d90e863c072b063cda4efbd9b658b995f1e 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 2b0589301d2e419f294ed2adac90f8115fcc7233..262f8c377918f19b5158a9c0fb9cb53f9c0c1419 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() } @@ -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) @@ -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/Interactor/SeedBackupWalletInteractor.swift b/Nynja/Modules/Wallet Flows/SeedBackup/Interactor/SeedBackupWalletInteractor.swift index 7a0e8dcbaaae740d1daa356c2e4dee8b5c53630f..08944e57790ecbd4cd0ef1f377106f933f9a01c7 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/SeedBackup/View/SeedBackupWalletCollectionViewCell.swift b/Nynja/Modules/Wallet Flows/SeedBackup/View/SeedBackupWalletCollectionViewCell.swift index d2ddf75c97a75e2567a0754d443f04901edfe378..1903b45837830d6234918f24fd3a68cfc102a297 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 3ca5b0957fe35bae7b824d137329b82cff884b9c..c1d78b34d9daf3da26956a457d9511b80992a4b8 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 aa0144eee28c312be67e71b944aa45fde2544449..303a9e496dcbbaaf5c6a7272384ccea17e5252a1 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 4a16c11472cd888342c13b9906c038d0eb0e6a03..50407d3bc10a51dbcfbd8b564fcc86cea76d7793 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 955a34b5c9af6974dbadcf7b9b5e750e22d7726a..2517acd5051c0928aa8697879a40076f0dec22a2 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 42f39ecb7b477945d518799a981e6e1f5f365e1b..c07f27cdc84d278516502924f0a8a42879240992 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/Presenter/WalletBalancesPresenter.swift b/Nynja/Modules/Wallet Flows/WalletBalances/Presenter/WalletBalancesPresenter.swift index 73190c73f1333711e34bb4032c5495fe31fbb040..d6dbc8bb04fda09c772899d7b20f228eb05cafbf 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/Modules/Wallet Flows/WalletBalances/View/WalletBalancesViewController.swift b/Nynja/Modules/Wallet Flows/WalletBalances/View/WalletBalancesViewController.swift index 2f22e5c652a72775cfd047a12d1512e94d26f9b8..c1e789f12a4f5e2d20286c01e1d4cd38747efb43 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 75a1022fefcd6af2be04a9355adb19c70ff76dbd..5913a8aafcce22e58b5fac36838ffd2be126307c 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 7b86fdf0a68ffae8a0eedb199e04f95d7ce7b39d..c5ea6bb8ba7d2fe76c72d8a9e0f34ff580383c64 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 } } @@ -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/Notifications/AppNotificationsProviding/AppNotificationsProvider.swift b/Nynja/Notifications/AppNotificationsProviding/AppNotificationsProvider.swift index c1c12c6332a6b7eb716b7c789fe39823a872bdaa..02f17cc707931b7a8fe198d542d693912b679cd7 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 07202fd1ed9d6daf4888505fae96a996ffad916b..ed70fc7095222bc710c938d13bf4aee009c773b2 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/ProgressModel.swift b/Nynja/ProgressModel.swift index dbee7ce84e179fb2c56f30d803450217e728572a..79e1c14e0d1c4cc1846eb61a4a4718dc11191a3b 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/Resources/Info.plist b/Nynja/Resources/Info.plist index dda23f3845685fd71c2ec1b987e5b0f5db50a1cf..619eb70e63515b48f2112c920b4e7a10d386be9a 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 diff --git a/Nynja/Resources/PrereleaseConfig.xcconfig b/Nynja/Resources/PrereleaseConfig.xcconfig index 1ffefb6cfa70a17c7e30a455a8a34989145b79f8..06b28b69b47547abf463fdd5526e1e5351ab7f3c 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 0000000000000000000000000000000000000000..af5e0d2c49dfe09f620d02c0ea9e9542093f35ce --- /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 f8b763d10d53ab772501aae33538bbfb15346308..f65b25f2e8785121a37b607380cc213fcad8e8e6 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 7bb8ffee29b93bfca549906912c96665dfa87d7f..edf527adceceaf8366bd60ff1219e304dc36acaf 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") } diff --git a/Nynja/ServerModel/Source/BERTEncodable.swift b/Nynja/ServerModel/Source/BERTEncodable.swift new file mode 100644 index 0000000000000000000000000000000000000000..140ed98ad2b32613040b5e1f2c757a19abca7b08 --- /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/Bert.swift b/Nynja/ServerModel/Source/Bert.swift index 7feae1b0e33c254893ad1536ee807c830655c541..b92543011a0055c03191024184665f9a51ad00ef 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/ServerModel/Source/BertBinConvertible.swift b/Nynja/ServerModel/Source/BertBinConvertible.swift index 7a7a728b2697070907c2aa9c6aa16dcb8cdee4bb..cda3ed2f4f91a8038ae80d7ef3915d8c4c0dfc6d 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/Audio/AudioManager/AudioManager.swift b/Nynja/Services/Audio/AudioManager/AudioManager.swift index a7d339febceb7e5bf30137811ab783983758a3a3..ba7896c22ac85615bbdf9bbc54ee016519b081f6 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 4d3afff43ce20b0ab502ed6958792cd17e53757f..ee381a087a9d1702186978c06dd82f143af7a51f 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 3ec40b6522dcc33b60ac95d33e97aa4ee7d639d8..bf2b2b415f7c2677eaaaebc0211301a0d0ac4988 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 } @@ -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 4442752e40732f769e68039d12086487a5e02d1e..2b8ab4b4b9046d04c2e2b540e0e7c8cdfc70fecf 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] @@ -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/LogService/LogWriter.swift b/Nynja/Services/Debug/LogService/LogWriter.swift index 1a1453996317c2eddf70009f308f09ba730dcfd6..56483a322973da823952600f7b13a3d361f79ff9 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/Debug/MotionManager/MotionManager.swift b/Nynja/Services/Debug/MotionManager/MotionManager.swift index b0829e81e9c07449abef90b9175c720a8f1333c7..845aa3010d9ec43298794c13e56f43aeecd2f7af 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 } @@ -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 01f980df7dc30bf18a1f4f563b596b59a051f48f..f25a12fb69cd25321f679d8b6b25169a216ce980 100644 --- a/Nynja/Services/Debug/SMSCodeProvider/SMSCodeProvider.swift +++ b/Nynja/Services/Debug/SMSCodeProvider/SMSCodeProvider.swift @@ -24,16 +24,14 @@ 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 { 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 b3639a0f79a4ecd7bc13b08fd60e49cf29d70cc6..72f559862f0e76edfd30f203519035ee42e06d40 100644 --- a/Nynja/Services/MQTT/MQTTService.swift +++ b/Nynja/Services/MQTT/MQTTService.swift @@ -249,7 +249,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/MQTT/StarExtension+BERT.swift b/Nynja/Services/MQTT/StarExtension+BERT.swift index 4be3b39961bc01a89507a1e04f81e8069d1fc400..5ef3df73b24e68dec155db9a8793c3c645a47136 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 d66ec20bb35ce0d2e5376566619739a8f37051d5..61f97e2cd71e4bac76cc75b0974b70f0263ccc4c 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/Services/PushService.swift b/Nynja/Services/PushService.swift index 91c423ae4f43f68dfed1c24e1f8b8554d48e70b9..5c2cbbf6e0066150cb882fb132013398a95a455a 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) @@ -287,7 +287,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/REST/NetworkHTTPClient/Request/HTTPHeader+Authorization.swift b/Nynja/Services/REST/NetworkHTTPClient/Request/HTTPHeader+Authorization.swift index 048f489b743dcd9718be9bcd68171c9b762c385c..e5de0146da423ebd2b4ee52fbeda60de8f081b01 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)"] - } -} diff --git a/Nynja/Services/ResourceManager/ResourceManager.swift b/Nynja/Services/ResourceManager/ResourceManager.swift index 86d657da97609c9f891e7c3be5929cda7e8dbae1..5ec51823603d013d97092358bc1d37b875877fab 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) @@ -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/StorageService.swift b/Nynja/Services/StorageService.swift index 9ef71ae31dc8f7c563b4e79dca10c6b262092e9a..5ae84cbaa1999515798a89f53806eeeac6587651 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) { diff --git a/Nynja/Services/TranscribeService/Operations /AudioConvertOperation.swift b/Nynja/Services/TranscribeService/Operations /AudioConvertOperation.swift index da15a23bc8a00ce1745c61c180834b9de5901c8b..59809221830db56a6afb3925b526580273045157 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/Nynja/Services/TranscribeService/Operations /AudioLongTranscribeProccessingOperation.swift b/Nynja/Services/TranscribeService/Operations /AudioLongTranscribeProccessingOperation.swift index cd8b262245836e9afdd2673c4b25227650fe377a..55e647aec421ccf12ee80ff3166f46690bf515c7 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 2fea2adf5fd942ddd354c4e0e2bf98983ff83e71..82d805337926e1e24cd011d1804b0c6f71d87c14 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) diff --git a/Nynja/ThumbnailGenerator.swift b/Nynja/ThumbnailGenerator.swift index 7676c53109128bd4a783d65231765b7b79685456..e4a1b536e518ec49d4b38884d8d84570c3763f8d 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 deleted file mode 100644 index 31689628d0afb0ad9248978f4b51e9fe636c1ebf..0000000000000000000000000000000000000000 --- a/Nynja/Utils/ImagePickerHandler.swift +++ /dev/null @@ -1,51 +0,0 @@ -// -// ImagePickerHandler.swift -// Nynja -// -// Created by Anton Poltoratskyi on 29.03.2018. -// Copyright © 2018 TecSynt Solutions. All rights reserved. -// - -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, [String : Any]) -> Void)? - public var onCancel: ((UIImagePickerController) -> Void)? - - public var onStartRecordingVideo: (() -> Void)? - public var onStopRecordingVideo: (() -> Void)? - - - // MARK: - UIImagePickerControllerDelegate - - public func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { - onFinishPickingMedia?(picker, info) - } - - public func imagePickerControllerDidCancel(_ picker: UIImagePickerController) { - onCancel?(picker) - } - - - // MARK: - CustomImagePickerDelegate - - func startRecordingVideo() { - onStartRecordingVideo?() - } - - func stopRecordingVideo() { - onStopRecordingVideo?() - } - -} diff --git a/Nynja/mucExtension+BERT.swift b/Nynja/mucExtension+BERT.swift index 175fa41fdd53deafb925167865f6b000540dd718..45f7e36346acf86c7b001521d3227534a852027c 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]) } } diff --git a/Podfile b/Podfile index 5ac0d4ab22b9bd72b5913da5bb234ac36b0bf83a..f09ca2eb26066182f2e11a58c90fb7a5d4ddc4af 100644 --- a/Podfile +++ b/Podfile @@ -18,10 +18,10 @@ 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' + 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,15 +33,15 @@ 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' - pod 'JTAppleCalendar', '= 7.1.5' + pod 'JTAppleCalendar', '= 7.1.6' pod 'NynjaSDK', '= 1.8' - pod 'CryptoSwift', '= 0.10.0' + pod 'CryptoSwift', '= 0.13.0' pod 'MulticastDelegateSwift', '= 2.1.1' @@ -49,10 +49,10 @@ 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' + 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' @@ -65,21 +65,20 @@ def commonPodsForNynjaTests pod 'AutoScrollLabel', '= 0.4.3' pod 'MaterialComponents/FlexibleHeader', '= 55.3.0' - pod 'JTAppleCalendar', '= 7.1.5' end def commonPodsForNynjaShare pod 'libPhoneNumber-iOS', '= 0.9.13' pod 'AWSS3', '= 2.6.20' - pod 'CocoaMQTT', '= 1.1.2' - pod 'SnapKit', '= 4.0.0' + 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 - pod 'SnapKit', '= 4.0.0' + pod 'SnapKit', '= 4.2.0' end target 'Nynja' do @@ -109,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.0' + 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 ac9927bf08a1d2c5bdfc4f5eeaa46a770cf76fcb..abc94d5a28269b39b3d00d684bfe6c0942a6fe7f 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 @@ -51,7 +50,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 @@ -67,23 +66,22 @@ 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) - 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 @@ -91,15 +89,15 @@ 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) - NynjaSDK (= 1.8) - QRCode (= 2.0) - SDWebImage (= 4.4.2) - - SnapKit (= 4.0.0) - - SwiftyJSON (= 4.0.0) + - SnapKit (= 4.2.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 @@ -169,7 +166,7 @@ SPEC CHECKSUMS: GRDBCipher: eef21d242c727a21e0f87ad44f8ea2df03edd252 GTMSessionFetcher: 5fa5b80fd20e439ef5f545fb2cb3ca6c6714caa2 Intercom: 083a05bf222811b0b5e0a0b24c863544123397f0 - JTAppleCalendar: 2d4f974f9f3c8b4964d51ca1f6e004883c031fbe + JTAppleCalendar: abb30678f42a4ef8a340a932b1dcb8c85a33dac2 libPhoneNumber-iOS: e444379ac18bbfbdefad571da735b2cd7e096caa MaterialComponents: 915f4e844400a35db3ea4c710a9af40aa8bcb093 MDFTextAccessibility: 94098925e0853551c5a311ce7c1ecefbe297cdb6 @@ -177,12 +174,11 @@ SPEC CHECKSUMS: NynjaSDK: 3c245c3a1b1e5e650012d2f367260ecf4860e748 QRCode: f98a1886c8f37523704a7512a4c0cd45b34c18a4 SDWebImage: 624d6e296c69b244bcede364c72ae0430ac14681 - SnapKit: a42d492c16e80209130a3379f73596c3454b7694 + SnapKit: fe8a619752f3f27075cc9a90244d75c6c3f27e2a SQLCipher: f9fcf29b2e59ced7defc2a2bdd0ebe79b40d4990 - SwiftyJSON: 070dabdcb1beb81b247c65ffa3a79dbbfb3b48aa - SwiftyTimer: 2efd74b060d69ad4f1496baf5bbedbe132125fcf + SwiftyJSON: c4bcba26dd9ec7a027fc8eade48e2c911f229e96 TestFairy: 842f8ddc45477b208eb85326b0418047b40f7137 -PODFILE CHECKSUM: f451188b6594449179a03b08671fe1f3f318dcad +PODFILE CHECKSUM: 97c6cb16e76c468f7b29f9e60d5f2cb3aab5b220 COCOAPODS: 1.5.3