From d0be7f786c10844e5b5d7a4998791549b14fd655 Mon Sep 17 00:00:00 2001 From: Morgan Pretty Date: Thu, 29 Jun 2023 16:58:23 +1000 Subject: [PATCH] Fixed a hang, removed redundant libs, files and code Fixed an issue where returning the app from the background would result in the app staying permanently on the splash screen Included a CRC32 implementation so we can drop the CryptoSwift dependenciy (using CryptoKit everywhere else) Removed 'SocketRocket' (unused) Removed the `xcode_14_3_workaround` post-install hook (fixed with CocoaPods 1.12.1) Removed the `enable_fts5_support` post-install hook (enabled by default since GRDB 6.7.0 so redundant) Removed the `enable_whole_module_optimization_for_crypto_swift` post-install hook (dropped CryptoSwift support) Cleared out a bunch of headers from the Signal-Bridging-header file (direct imports instead to reduce incremental build sizes) Deleted some unused code --- Podfile | 39 +-- Podfile.lock | 12 +- Session.xcodeproj/project.pbxproj | 52 +--- .../Call Management/SessionCallManager.swift | 1 + .../Calls/Views & Modals/CallVideoView.swift | 1 + .../Conversations/ConversationSearch.swift | 1 + .../Emoji Picker/EmojiSkinTonePicker.swift | 1 + .../Content Views/MediaView.swift | 1 + .../Message Cells/DateHeaderCell.swift | 1 + .../Message Cells/UnreadMarkerCell.swift | 1 + ...isappearingMessagesSettingsViewModel.swift | 1 + .../ConversationTitleView.swift | 2 +- .../New Conversation/NewConversationVC.swift | 1 + .../GIFs/GifPickerCell.swift | 1 + .../GIFs/GifPickerViewController.swift | 2 +- .../GIFs/GiphyAPI.swift | 1 + .../OWSImagePickerController.swift | 1 + .../PhotoCapture.swift | 1 + .../PhotoCaptureViewController.swift | 2 +- .../SendMediaNavigationController.swift | 6 +- .../Transitions/MediaInteractiveDismiss.swift | 1 + Session/Meta/AppDelegate.swift | 25 +- Session/Meta/SessionApp.swift | 1 + Session/Meta/Signal-Bridging-Header.h | 23 -- .../PushRegistrationManager.swift | 1 + Session/Onboarding/Onboarding.swift | 1 + Session/Shared/CaptionView.swift | 2 +- Session/Shared/FullConversationCell.swift | 6 +- Session/Shared/OWSBezierPathView.h | 2 + .../Utilities/Sodium+Utilities.swift | 7 +- .../SignalShareExtension-Bridging-Header.h | 1 - SessionUtilitiesKit/Crypto/Hex.swift | 10 +- SessionUtilitiesKit/Crypto/Mnemonic.swift | 20 +- .../General/NSNotificationCenter+OWS.h | 24 -- .../General/NSNotificationCenter+OWS.m | 29 --- SessionUtilitiesKit/General/NSString+SSK.h | 15 -- SessionUtilitiesKit/General/NSString+SSK.m | 23 -- SessionUtilitiesKit/General/String+SSK.swift | 4 - .../Meta/SessionUtilitiesKit.h | 2 - .../AttachmentCaptionToolbar.swift | 2 +- .../MediaMessageView.swift | 16 +- SignalUtilitiesKit/Meta/SignalUtilitiesKit.h | 3 - .../Utilities/NSAttributedString+OWS.h | 16 -- .../Utilities/NSAttributedString+OWS.m | 39 --- SignalUtilitiesKit/Utilities/OWSDispatch.h | 23 -- SignalUtilitiesKit/Utilities/OWSDispatch.m | 34 --- SignalUtilitiesKit/Utilities/UIFont+OWS.h | 63 ----- SignalUtilitiesKit/Utilities/UIFont+OWS.m | 234 ------------------ 48 files changed, 97 insertions(+), 658 deletions(-) delete mode 100644 SessionUtilitiesKit/General/NSNotificationCenter+OWS.h delete mode 100644 SessionUtilitiesKit/General/NSNotificationCenter+OWS.m delete mode 100644 SessionUtilitiesKit/General/NSString+SSK.h delete mode 100644 SessionUtilitiesKit/General/NSString+SSK.m delete mode 100644 SignalUtilitiesKit/Utilities/NSAttributedString+OWS.h delete mode 100644 SignalUtilitiesKit/Utilities/NSAttributedString+OWS.m delete mode 100644 SignalUtilitiesKit/Utilities/OWSDispatch.h delete mode 100644 SignalUtilitiesKit/Utilities/OWSDispatch.m delete mode 100644 SignalUtilitiesKit/Utilities/UIFont+OWS.h delete mode 100644 SignalUtilitiesKit/Utilities/UIFont+OWS.m diff --git a/Podfile b/Podfile index d9f7d9613..5747d4620 100644 --- a/Podfile +++ b/Podfile @@ -6,16 +6,16 @@ inhibit_all_warnings! # Dependencies to be included in the app and all extensions/frameworks abstract_target 'GlobalDependencies' do - pod 'CryptoSwift' # FIXME: If https://github.com/jedisct1/swift-sodium/pull/249 gets resolved then revert this back to the standard pod pod 'Sodium', :git => 'https://github.com/oxen-io/session-ios-swift-sodium.git', branch: 'session-build' pod 'GRDB.swift/SQLCipher' + + # FIXME: Would be nice to migrate from CocoaPods to SwiftPackageManager (should allow us to speed up build time), haven't gone through all of the dependencies but currently unfortunately SQLCipher doesn't support SPM (for more info see: https://github.com/sqlcipher/sqlcipher/issues/371) pod 'SQLCipher', '~> 4.5.3' # FIXME: We want to remove this once it's been long enough since the migration to GRDB pod 'YapDatabase/SQLCipher', :git => 'https://github.com/oxen-io/session-ios-yap-database.git', branch: 'signal-release' pod 'WebRTC-lib' - pod 'SocketRocket', '~> 0.5.1' target 'Session' do pod 'Reachability' @@ -100,23 +100,7 @@ end # Actions to perform post-install post_install do |installer| - enable_whole_module_optimization_for_crypto_swift(installer) set_minimum_deployment_target(installer) - enable_fts5_support(installer) - - #FIXME: Remove this workaround once an official fix is released (hopefully Cocoapods 1.12.1) - xcode_14_3_workaround(installer) -end - -def enable_whole_module_optimization_for_crypto_swift(installer) - installer.pods_project.targets.each do |target| - if target.name.end_with? "CryptoSwift" - target.build_configurations.each do |config| - config.build_settings['GCC_OPTIMIZATION_LEVEL'] = 'fast' - config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = '-O' - end - end - end end def set_minimum_deployment_target(installer) @@ -126,22 +110,3 @@ def set_minimum_deployment_target(installer) end end end - -# This is to ensure we enable support for FastTextSearch5 (might not be enabled by default) -# For more info see https://github.com/groue/GRDB.swift/blob/master/Documentation/FullTextSearch.md#enabling-fts5-support -def enable_fts5_support(installer) - installer.pods_project.targets.select { |target| target.name == "GRDB.swift" }.each do |target| - target.build_configurations.each do |config| - config.build_settings['OTHER_SWIFT_FLAGS'] = "$(inherited) -D SQLITE_ENABLE_FTS5" - end - end -end - -# Workaround for Xcode 14.3: -# Sourced from https://github.com/flutter/flutter/issues/123852#issuecomment-1493232105 -def xcode_14_3_workaround(installer) - system('sed -i \'\' \'44s/readlink/readlink -f/\' \'Pods/Target Support Files/Pods-GlobalDependencies-FrameworkAndExtensionDependencies-ExtendedDependencies-SessionMessagingKit-SessionMessagingKitTests/Pods-GlobalDependencies-FrameworkAndExtensionDependencies-ExtendedDependencies-SessionMessagingKit-SessionMessagingKitTests-frameworks.sh\'') - system('sed -i \'\' \'44s/readlink/readlink -f/\' \'Pods/Target Support Files/Pods-GlobalDependencies-FrameworkAndExtensionDependencies-ExtendedDependencies-SessionUtilitiesKit-SessionUtilitiesKitTests/Pods-GlobalDependencies-FrameworkAndExtensionDependencies-ExtendedDependencies-SessionUtilitiesKit-SessionUtilitiesKitTests-frameworks.sh\'') - system('sed -i \'\' \'44s/readlink/readlink -f/\' \'Pods/Target Support Files/Pods-GlobalDependencies-Session/Pods-GlobalDependencies-Session-frameworks.sh\'') - system('sed -i \'\' \'44s/readlink/readlink -f/\' \'Pods/Target Support Files/Pods-GlobalDependencies-Session-SessionTests/Pods-GlobalDependencies-Session-SessionTests-frameworks.sh\'') -end diff --git a/Podfile.lock b/Podfile.lock index 051db4dda..970a62e71 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -2,7 +2,6 @@ PODS: - CocoaLumberjack (3.8.0): - CocoaLumberjack/Core (= 3.8.0) - CocoaLumberjack/Core (3.8.0) - - CryptoSwift (1.4.2) - Curve25519Kit (2.1.0): - CocoaLumberjack - SignalCoreKit @@ -35,7 +34,6 @@ PODS: - SignalCoreKit (1.0.0): - CocoaLumberjack - OpenSSL-Universal - - SocketRocket (0.5.1) - Sodium (0.9.1) - SQLCipher (4.5.3): - SQLCipher/standard (= 4.5.3) @@ -115,7 +113,6 @@ PODS: - ZXingObjC/All (3.6.5) DEPENDENCIES: - - CryptoSwift - Curve25519Kit (from `https://github.com/oxen-io/session-ios-curve-25519-kit.git`, branch `session-version`) - DifferenceKit - GRDB.swift/SQLCipher @@ -126,7 +123,6 @@ DEPENDENCIES: - Reachability - SAMKeychain - SignalCoreKit (from `https://github.com/oxen-io/session-ios-core-kit`, branch `session-version`) - - SocketRocket (~> 0.5.1) - Sodium (from `https://github.com/oxen-io/session-ios-swift-sodium.git`, branch `session-build`) - SQLCipher (~> 4.5.3) - SwiftProtobuf (~> 1.5.0) @@ -138,7 +134,6 @@ DEPENDENCIES: SPEC REPOS: https://github.com/CocoaPods/Specs.git: - CocoaLumberjack - - CryptoSwift - DifferenceKit - GRDB.swift - libwebp @@ -149,7 +144,6 @@ SPEC REPOS: - Quick - Reachability - SAMKeychain - - SocketRocket - SQLCipher - SwiftProtobuf - WebRTC-lib @@ -190,7 +184,6 @@ CHECKOUT OPTIONS: SPEC CHECKSUMS: CocoaLumberjack: 78abfb691154e2a9df8ded4350d504ee19d90732 - CryptoSwift: a532e74ed010f8c95f611d00b8bbae42e9fe7c17 Curve25519Kit: e63f9859ede02438ae3defc5e1a87e09d1ec7ee6 DifferenceKit: ab185c4d7f9cef8af3fcf593e5b387fb81e999ca GRDB.swift: fe420b1af49ec519c7e96e07887ee44f5dfa2b78 @@ -203,7 +196,6 @@ SPEC CHECKSUMS: Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 SAMKeychain: 483e1c9f32984d50ca961e26818a534283b4cd5c SignalCoreKit: 1fbd8732163ef76de16cd1107d1fa3684b607e5d - SocketRocket: d57c7159b83c3c6655745cd15302aa24b6bae531 Sodium: a7d42cb46e789d2630fa552d35870b416ed055ae SQLCipher: 57fa9f863fa4a3ed9dd3c90ace52315db8c0fdca SwiftProtobuf: 241400280f912735c1e1b9fe675fdd2c6c4d42e2 @@ -212,6 +204,6 @@ SPEC CHECKSUMS: YYImage: f1ddd15ac032a58b78bbed1e012b50302d318331 ZXingObjC: fdbb269f25dd2032da343e06f10224d62f537bdb -PODFILE CHECKSUM: 5a4993725a7d48be883663a52df2a5de45d2d099 +PODFILE CHECKSUM: 68799237a4dc046f5ac25c573af03b559f5b10c4 -COCOAPODS: 1.11.3 +COCOAPODS: 1.12.1 diff --git a/Session.xcodeproj/project.pbxproj b/Session.xcodeproj/project.pbxproj index 16cef78c5..458f0c863 100644 --- a/Session.xcodeproj/project.pbxproj +++ b/Session.xcodeproj/project.pbxproj @@ -219,8 +219,6 @@ B8856D7B256F14F4001CE70E /* UIView+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = C38EF23E255B6D66007E1867 /* UIView+OWS.m */; }; B8856D8D256F1502001CE70E /* UIView+OWS.h in Headers */ = {isa = PBXBuildFile; fileRef = C38EF23D255B6D66007E1867 /* UIView+OWS.h */; settings = {ATTRIBUTES = (Public, ); }; }; B8856DE6256F15F2001CE70E /* String+SSK.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB3F255A580C00E217F9 /* String+SSK.swift */; }; - B8856DEF256F161F001CE70E /* NSString+SSK.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB45255A580C00E217F9 /* NSString+SSK.m */; }; - B8856DF8256F1633001CE70E /* NSString+SSK.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDB12255A580800E217F9 /* NSString+SSK.h */; settings = {ATTRIBUTES = (Public, ); }; }; B8856E09256F1676001CE70E /* UIDevice+featureSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = C38EF237255B6D65007E1867 /* UIDevice+featureSupport.swift */; }; B8856E1A256F1700001CE70E /* OWSMath.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDB14255A580800E217F9 /* OWSMath.h */; settings = {ATTRIBUTES = (Public, ); }; }; B886B4A72398B23E00211ABE /* QRCodeVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B886B4A62398B23E00211ABE /* QRCodeVC.swift */; }; @@ -284,8 +282,6 @@ C32C5A24256DB7DB003C73A2 /* SNUserDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB6B255A580F00E217F9 /* SNUserDefaults.swift */; }; C32C5A48256DB8F0003C73A2 /* BuildConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33FDAA8255A57FF00E217F9 /* BuildConfiguration.swift */; }; C32C5A88256DBCF9003C73A2 /* MessageReceiver+ClosedGroups.swift in Sources */ = {isa = PBXBuildFile; fileRef = C32C5A87256DBCF9003C73A2 /* MessageReceiver+ClosedGroups.swift */; }; - C32C5B48256DC211003C73A2 /* NSNotificationCenter+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB6C255A580F00E217F9 /* NSNotificationCenter+OWS.m */; }; - C32C5B51256DC219003C73A2 /* NSNotificationCenter+OWS.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDB3B255A580B00E217F9 /* NSNotificationCenter+OWS.h */; settings = {ATTRIBUTES = (Public, ); }; }; C32C5C3D256DCBAF003C73A2 /* AppReadiness.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB75255A581000E217F9 /* AppReadiness.m */; }; C32C5C46256DCBB2003C73A2 /* AppReadiness.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDB01255A580700E217F9 /* AppReadiness.h */; settings = {ATTRIBUTES = (Public, ); }; }; C32C5D83256DD5B6003C73A2 /* SSKKeychainStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33FDBBC255A581600E217F9 /* SSKKeychainStorage.swift */; }; @@ -320,10 +316,8 @@ C33FD9C5255A54EF00E217F9 /* SessionUtilitiesKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3C2A679255388CC00C340D1 /* SessionUtilitiesKit.framework */; }; C33FDC29255A581F00E217F9 /* ReachabilityManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33FDA6F255A57FA00E217F9 /* ReachabilityManager.swift */; }; C33FDC45255A581F00E217F9 /* AppVersion.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDA8B255A57FD00E217F9 /* AppVersion.m */; }; - C33FDC50255A582000E217F9 /* OWSDispatch.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDA96255A57FE00E217F9 /* OWSDispatch.h */; settings = {ATTRIBUTES = (Public, ); }; }; C33FDC58255A582000E217F9 /* ReverseDispatchQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33FDA9E255A57FF00E217F9 /* ReverseDispatchQueue.swift */; }; C33FDC78255A582000E217F9 /* TSConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDABE255A580100E217F9 /* TSConstants.m */; }; - C33FDC7D255A582000E217F9 /* OWSDispatch.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDAC3255A580200E217F9 /* OWSDispatch.m */; }; C33FDC98255A582000E217F9 /* SwiftSingletons.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33FDADE255A580400E217F9 /* SwiftSingletons.swift */; }; C33FDC9A255A582000E217F9 /* ByteParser.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDAE0255A580400E217F9 /* ByteParser.m */; }; C33FDCD1255A582000E217F9 /* FunctionalUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB17255A580800E217F9 /* FunctionalUtil.m */; }; @@ -367,10 +361,6 @@ C38EF00C255B61CC007E1867 /* SignalUtilitiesKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C33FD9AB255A548A00E217F9 /* SignalUtilitiesKit.framework */; }; C38EF22B255B6D5D007E1867 /* ShareViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C38EF226255B6D5D007E1867 /* ShareViewDelegate.swift */; }; C38EF22C255B6D5D007E1867 /* OWSVideoPlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = C38EF227255B6D5D007E1867 /* OWSVideoPlayer.swift */; }; - C38EF245255B6D67007E1867 /* UIFont+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = C38EF238255B6D66007E1867 /* UIFont+OWS.m */; }; - C38EF246255B6D67007E1867 /* UIFont+OWS.h in Headers */ = {isa = PBXBuildFile; fileRef = C38EF239255B6D66007E1867 /* UIFont+OWS.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C38EF247255B6D67007E1867 /* NSAttributedString+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = C38EF23A255B6D66007E1867 /* NSAttributedString+OWS.m */; }; - C38EF24C255B6D67007E1867 /* NSAttributedString+OWS.h in Headers */ = {isa = PBXBuildFile; fileRef = C38EF23F255B6D67007E1867 /* NSAttributedString+OWS.h */; settings = {ATTRIBUTES = (Public, ); }; }; C38EF24D255B6D67007E1867 /* UIView+OWS.swift in Sources */ = {isa = PBXBuildFile; fileRef = C38EF240255B6D67007E1867 /* UIView+OWS.swift */; }; C38EF24E255B6D67007E1867 /* Collection+OWS.swift in Sources */ = {isa = PBXBuildFile; fileRef = C38EF241255B6D67007E1867 /* Collection+OWS.swift */; }; C38EF2B3255B6D9C007E1867 /* UIViewController+Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = C38EF2B1255B6D9C007E1867 /* UIViewController+Utilities.swift */; }; @@ -1435,11 +1425,9 @@ C33FDA87255A57FC00E217F9 /* TypingIndicators.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TypingIndicators.swift; sourceTree = ""; }; C33FDA8B255A57FD00E217F9 /* AppVersion.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppVersion.m; sourceTree = ""; }; C33FDA8E255A57FD00E217F9 /* OWSFileSystem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSFileSystem.m; sourceTree = ""; }; - C33FDA96255A57FE00E217F9 /* OWSDispatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSDispatch.h; sourceTree = ""; }; C33FDA9E255A57FF00E217F9 /* ReverseDispatchQueue.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReverseDispatchQueue.swift; sourceTree = ""; }; C33FDAA8255A57FF00E217F9 /* BuildConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BuildConfiguration.swift; sourceTree = ""; }; C33FDABE255A580100E217F9 /* TSConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSConstants.m; sourceTree = ""; }; - C33FDAC3255A580200E217F9 /* OWSDispatch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSDispatch.m; sourceTree = ""; }; C33FDADE255A580400E217F9 /* SwiftSingletons.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftSingletons.swift; sourceTree = ""; }; C33FDAE0255A580400E217F9 /* ByteParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ByteParser.m; sourceTree = ""; }; C33FDAEF255A580500E217F9 /* NSData+Image.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+Image.m"; sourceTree = ""; }; @@ -1448,7 +1436,6 @@ C33FDAFC255A580600E217F9 /* MIMETypeUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MIMETypeUtil.h; sourceTree = ""; }; C33FDAFD255A580600E217F9 /* LRUCache.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LRUCache.swift; sourceTree = ""; }; C33FDB01255A580700E217F9 /* AppReadiness.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppReadiness.h; sourceTree = ""; }; - C33FDB12255A580800E217F9 /* NSString+SSK.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+SSK.h"; sourceTree = ""; }; C33FDB14255A580800E217F9 /* OWSMath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSMath.h; sourceTree = ""; }; C33FDB17255A580800E217F9 /* FunctionalUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FunctionalUtil.m; sourceTree = ""; }; C33FDB1C255A580900E217F9 /* UIImage+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+OWS.h"; sourceTree = ""; }; @@ -1457,11 +1444,9 @@ C33FDB34255A580B00E217F9 /* ClosedGroupPoller.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClosedGroupPoller.swift; sourceTree = ""; }; C33FDB38255A580B00E217F9 /* OWSBackgroundTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSBackgroundTask.h; sourceTree = ""; }; C33FDB3A255A580B00E217F9 /* Poller.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Poller.swift; sourceTree = ""; }; - C33FDB3B255A580B00E217F9 /* NSNotificationCenter+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSNotificationCenter+OWS.h"; sourceTree = ""; }; C33FDB3F255A580C00E217F9 /* String+SSK.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+SSK.swift"; sourceTree = ""; }; C33FDB40255A580C00E217F9 /* SignalIOSProto.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SignalIOSProto.swift; sourceTree = ""; }; C33FDB41255A580C00E217F9 /* MIMETypeUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MIMETypeUtil.m; sourceTree = ""; }; - C33FDB45255A580C00E217F9 /* NSString+SSK.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+SSK.m"; sourceTree = ""; }; C33FDB49255A580C00E217F9 /* WeakTimer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WeakTimer.swift; sourceTree = ""; }; C33FDB4C255A580D00E217F9 /* AppVersion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppVersion.h; sourceTree = ""; }; C33FDB51255A580D00E217F9 /* NSUserDefaults+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSUserDefaults+OWS.h"; sourceTree = ""; }; @@ -1469,7 +1454,6 @@ C33FDB68255A580F00E217F9 /* ContentProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentProxy.swift; sourceTree = ""; }; C33FDB69255A580F00E217F9 /* FeatureFlags.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FeatureFlags.swift; sourceTree = ""; }; C33FDB6B255A580F00E217F9 /* SNUserDefaults.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SNUserDefaults.swift; sourceTree = ""; }; - C33FDB6C255A580F00E217F9 /* NSNotificationCenter+OWS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSNotificationCenter+OWS.m"; sourceTree = ""; }; C33FDB75255A581000E217F9 /* AppReadiness.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppReadiness.m; sourceTree = ""; }; C33FDB77255A581000E217F9 /* NSUserDefaults+OWS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSUserDefaults+OWS.m"; sourceTree = ""; }; C33FDB78255A581000E217F9 /* OWSOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSOperation.m; sourceTree = ""; }; @@ -1523,12 +1507,8 @@ C38EF226255B6D5D007E1867 /* ShareViewDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ShareViewDelegate.swift; path = SignalUtilitiesKit/Utilities/ShareViewDelegate.swift; sourceTree = SOURCE_ROOT; }; C38EF227255B6D5D007E1867 /* OWSVideoPlayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = OWSVideoPlayer.swift; path = "SignalUtilitiesKit/Media Viewing & Editing/OWSVideoPlayer.swift"; sourceTree = SOURCE_ROOT; }; C38EF237255B6D65007E1867 /* UIDevice+featureSupport.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "UIDevice+featureSupport.swift"; path = "SessionUtilitiesKit/General/UIDevice+featureSupport.swift"; sourceTree = SOURCE_ROOT; }; - C38EF238255B6D66007E1867 /* UIFont+OWS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIFont+OWS.m"; path = "SignalUtilitiesKit/Utilities/UIFont+OWS.m"; sourceTree = SOURCE_ROOT; }; - C38EF239255B6D66007E1867 /* UIFont+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIFont+OWS.h"; path = "SignalUtilitiesKit/Utilities/UIFont+OWS.h"; sourceTree = SOURCE_ROOT; }; - C38EF23A255B6D66007E1867 /* NSAttributedString+OWS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSAttributedString+OWS.m"; path = "SignalUtilitiesKit/Utilities/NSAttributedString+OWS.m"; sourceTree = SOURCE_ROOT; }; C38EF23D255B6D66007E1867 /* UIView+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIView+OWS.h"; path = "SessionUtilitiesKit/General/UIView+OWS.h"; sourceTree = SOURCE_ROOT; }; C38EF23E255B6D66007E1867 /* UIView+OWS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIView+OWS.m"; path = "SessionUtilitiesKit/General/UIView+OWS.m"; sourceTree = SOURCE_ROOT; }; - C38EF23F255B6D67007E1867 /* NSAttributedString+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSAttributedString+OWS.h"; path = "SignalUtilitiesKit/Utilities/NSAttributedString+OWS.h"; sourceTree = SOURCE_ROOT; }; C38EF240255B6D67007E1867 /* UIView+OWS.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "UIView+OWS.swift"; path = "SignalUtilitiesKit/Utilities/UIView+OWS.swift"; sourceTree = SOURCE_ROOT; }; C38EF241255B6D67007E1867 /* Collection+OWS.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "Collection+OWS.swift"; path = "SignalUtilitiesKit/Utilities/Collection+OWS.swift"; sourceTree = SOURCE_ROOT; }; C38EF281255B6D84007E1867 /* OWSAudioSession.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = OWSAudioSession.swift; path = SessionMessagingKit/Utilities/OWSAudioSession.swift; sourceTree = SOURCE_ROOT; }; @@ -2635,11 +2615,7 @@ B8BC00BF257D90E30032E807 /* General.swift */, C3C2A5CE2553860700C340D1 /* Logging.swift */, C33FDAFD255A580600E217F9 /* LRUCache.swift */, - C33FDB3B255A580B00E217F9 /* NSNotificationCenter+OWS.h */, - C33FDB6C255A580F00E217F9 /* NSNotificationCenter+OWS.m */, C33FDA7A255A57FB00E217F9 /* NSRegularExpression+SSK.swift */, - C33FDB12255A580800E217F9 /* NSString+SSK.h */, - C33FDB45255A580C00E217F9 /* NSString+SSK.m */, C352A3762557859C00338F3E /* NSTimer+Proxying.h */, C352A36C2557858D00338F3E /* NSTimer+Proxying.m */, 7B1D74AF27C365960030B423 /* Timer+MainThread.swift */, @@ -3404,10 +3380,6 @@ FD71161D28D9772700B47552 /* UIViewController+OWS.swift */, C38EF2B1255B6D9C007E1867 /* UIViewController+Utilities.swift */, C38EF307255B6DBE007E1867 /* UIGestureRecognizer+OWS.swift */, - C38EF239255B6D66007E1867 /* UIFont+OWS.h */, - C38EF238255B6D66007E1867 /* UIFont+OWS.m */, - C33FDA96255A57FE00E217F9 /* OWSDispatch.h */, - C33FDAC3255A580200E217F9 /* OWSDispatch.m */, C33FDBF9255A581C00E217F9 /* OWSError.h */, C33FDC0B255A581D00E217F9 /* OWSError.m */, C33FDBA1255A581400E217F9 /* OWSOperation.h */, @@ -3442,8 +3414,6 @@ C38EF3AE255B6DE5007E1867 /* OrderedDictionary.swift */, C38EF226255B6D5D007E1867 /* ShareViewDelegate.swift */, C38EF2FA255B6DBD007E1867 /* Bench.swift */, - C38EF23F255B6D67007E1867 /* NSAttributedString+OWS.h */, - C38EF23A255B6D66007E1867 /* NSAttributedString+OWS.m */, ); path = Utilities; sourceTree = ""; @@ -4447,14 +4417,11 @@ C33FDDD0255A582000E217F9 /* FunctionalUtil.h in Headers */, C33FDD5B255A582000E217F9 /* OWSOperation.h in Headers */, C33FDD7C255A582000E217F9 /* SSKAsserts.h in Headers */, - C38EF24C255B6D67007E1867 /* NSAttributedString+OWS.h in Headers */, C33FDDCC255A582000E217F9 /* TSConstants.h in Headers */, C33FDDBD255A582000E217F9 /* ByteParser.h in Headers */, C33FDDB3255A582000E217F9 /* OWSError.h in Headers */, C38EF35E255B6DCC007E1867 /* OWSViewController.h in Headers */, - C38EF246255B6D67007E1867 /* UIFont+OWS.h in Headers */, C33FD9AF255A548A00E217F9 /* SignalUtilitiesKit.h in Headers */, - C33FDC50255A582000E217F9 /* OWSDispatch.h in Headers */, C33FDD06255A582000E217F9 /* AppVersion.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; @@ -4475,12 +4442,10 @@ C3D9E38A256760390040E4F3 /* OWSFileSystem.h in Headers */, C3D9E379256760340040E4F3 /* MIMETypeUtil.h in Headers */, C3D9E50E25677A510040E4F3 /* DataSource.h in Headers */, - B8856DF8256F1633001CE70E /* NSString+SSK.h in Headers */, C3D9E4FD256778E30040E4F3 /* NSData+Image.h in Headers */, C3D9E4E3256778720040E4F3 /* UIImage+OWS.h in Headers */, B8856E1A256F1700001CE70E /* OWSMath.h in Headers */, C352A3772557864000338F3E /* NSTimer+Proxying.h in Headers */, - C32C5B51256DC219003C73A2 /* NSNotificationCenter+OWS.h in Headers */, FD30036A2A3ADEC100B5A5FB /* CExceptionHelper.h in Headers */, C3C2A67D255388CC00C340D1 /* SessionUtilitiesKit.h in Headers */, C32C6018256E07F9003C73A2 /* NSUserDefaults+OWS.h in Headers */, @@ -5486,8 +5451,6 @@ files = ( C38EF3C6255B6DE7007E1867 /* ImageEditorModel.swift in Sources */, C38EF3C3255B6DE7007E1867 /* ImageEditorTextItem.swift in Sources */, - C33FDC7D255A582000E217F9 /* OWSDispatch.m in Sources */, - C38EF247255B6D67007E1867 /* NSAttributedString+OWS.m in Sources */, C33FDD49255A582000E217F9 /* ParamParser.swift in Sources */, C38EF3C5255B6DE7007E1867 /* OWSViewController+ImageEditor.swift in Sources */, C38EF385255B6DD2007E1867 /* AttachmentTextToolbar.swift in Sources */, @@ -5496,7 +5459,6 @@ C38EF389255B6DD2007E1867 /* AttachmentTextView.swift in Sources */, C38EF3FF255B6DF7007E1867 /* TappableView.swift in Sources */, C38EF3C2255B6DE7007E1867 /* ImageEditorPaletteView.swift in Sources */, - C38EF245255B6D67007E1867 /* UIFont+OWS.m in Sources */, C38EF36F255B6DCC007E1867 /* OWSViewController.m in Sources */, C38EF3FB255B6DF7007E1867 /* UIAlertController+OWS.swift in Sources */, C38EF30C255B6DBF007E1867 /* ScreenLock.swift in Sources */, @@ -5648,7 +5610,6 @@ 7B7CB192271508AD0079FF93 /* CallRingTonePlayer.swift in Sources */, FD848B8B283DC509000E298B /* PagedDatabaseObserver.swift in Sources */, B8856E09256F1676001CE70E /* UIDevice+featureSupport.swift in Sources */, - B8856DEF256F161F001CE70E /* NSString+SSK.m in Sources */, FD09C5E2282212B3000CE219 /* JobDependencies.swift in Sources */, FDED2E3C282E1B5D00B2CD2A /* UICollectionView+ReusableView.swift in Sources */, FDF8487B29405906007DCAE5 /* HTTPHeader.swift in Sources */, @@ -5676,7 +5637,6 @@ FD09797D27FBDB2000936362 /* Notification+Utilities.swift in Sources */, FDC6D7602862B3F600B04575 /* Dependencies.swift in Sources */, C3C2AC2E2553CBEB00C340D1 /* String+Trimming.swift in Sources */, - C32C5B48256DC211003C73A2 /* NSNotificationCenter+OWS.m in Sources */, FD17D7C727F5207C00122BE0 /* DatabaseMigrator+Utilities.swift in Sources */, FD848B9328420164000E298B /* UnicodeScalar+Utilities.swift in Sources */, FD09796B27F6C67500936362 /* Failable.swift in Sources */, @@ -6417,7 +6377,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 411; + CURRENT_PROJECT_VERSION = 412; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -6489,7 +6449,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 411; + CURRENT_PROJECT_VERSION = 412; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = SUQ8J2PCT7; ENABLE_NS_ASSERTIONS = NO; @@ -6554,7 +6514,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 411; + CURRENT_PROJECT_VERSION = 412; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -6628,7 +6588,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 411; + CURRENT_PROJECT_VERSION = 412; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = SUQ8J2PCT7; ENABLE_NS_ASSERTIONS = NO; @@ -7536,7 +7496,7 @@ CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 411; + CURRENT_PROJECT_VERSION = 412; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -7607,7 +7567,7 @@ CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 411; + CURRENT_PROJECT_VERSION = 412; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", diff --git a/Session/Calls/Call Management/SessionCallManager.swift b/Session/Calls/Call Management/SessionCallManager.swift index a453a1218..18fa498da 100644 --- a/Session/Calls/Call Management/SessionCallManager.swift +++ b/Session/Calls/Call Management/SessionCallManager.swift @@ -5,6 +5,7 @@ import CallKit import GRDB import SessionMessagingKit import SignalCoreKit +import SignalUtilitiesKit public final class SessionCallManager: NSObject, CallManagerProtocol { let provider: CXProvider? diff --git a/Session/Calls/Views & Modals/CallVideoView.swift b/Session/Calls/Views & Modals/CallVideoView.swift index 65f76812c..e0b73e5e7 100644 --- a/Session/Calls/Views & Modals/CallVideoView.swift +++ b/Session/Calls/Views & Modals/CallVideoView.swift @@ -3,6 +3,7 @@ import WebRTC import Foundation import SessionUtilitiesKit +import SignalCoreKit #if targetEnvironment(simulator) // Note: 'RTCMTLVideoView' doesn't seem to work on the simulator so use 'RTCEAGLVideoView' instead diff --git a/Session/Conversations/ConversationSearch.swift b/Session/Conversations/ConversationSearch.swift index e62f2d2f2..785578104 100644 --- a/Session/Conversations/ConversationSearch.swift +++ b/Session/Conversations/ConversationSearch.swift @@ -4,6 +4,7 @@ import UIKit import GRDB import SignalUtilitiesKit import SignalCoreKit +import SessionUIKit public class StyledSearchController: UISearchController { public override var preferredStatusBarStyle: UIStatusBarStyle { diff --git a/Session/Conversations/Emoji Picker/EmojiSkinTonePicker.swift b/Session/Conversations/Emoji Picker/EmojiSkinTonePicker.swift index b771ec7d6..5c6da4152 100644 --- a/Session/Conversations/Emoji Picker/EmojiSkinTonePicker.swift +++ b/Session/Conversations/Emoji Picker/EmojiSkinTonePicker.swift @@ -3,6 +3,7 @@ import UIKit import SessionUIKit import SignalCoreKit +import SignalUtilitiesKit class EmojiSkinTonePicker: UIView { let emoji: Emoji diff --git a/Session/Conversations/Message Cells/Content Views/MediaView.swift b/Session/Conversations/Message Cells/Content Views/MediaView.swift index 8d7e498de..0af198314 100644 --- a/Session/Conversations/Message Cells/Content Views/MediaView.swift +++ b/Session/Conversations/Message Cells/Content Views/MediaView.swift @@ -5,6 +5,7 @@ import YYImage import SessionUIKit import SessionMessagingKit import SignalCoreKit +import SignalUtilitiesKit public class MediaView: UIView { static let contentMode: UIView.ContentMode = .scaleAspectFill diff --git a/Session/Conversations/Message Cells/DateHeaderCell.swift b/Session/Conversations/Message Cells/DateHeaderCell.swift index f6a99ca3f..0f37ed4e4 100644 --- a/Session/Conversations/Message Cells/DateHeaderCell.swift +++ b/Session/Conversations/Message Cells/DateHeaderCell.swift @@ -4,6 +4,7 @@ import UIKit import SignalUtilitiesKit import SessionUtilitiesKit import SessionMessagingKit +import SessionUIKit final class DateHeaderCell: MessageCell { // MARK: - UI diff --git a/Session/Conversations/Message Cells/UnreadMarkerCell.swift b/Session/Conversations/Message Cells/UnreadMarkerCell.swift index 76410c050..2ab5f89cf 100644 --- a/Session/Conversations/Message Cells/UnreadMarkerCell.swift +++ b/Session/Conversations/Message Cells/UnreadMarkerCell.swift @@ -4,6 +4,7 @@ import UIKit import SignalUtilitiesKit import SessionUtilitiesKit import SessionMessagingKit +import SessionUIKit final class UnreadMarkerCell: MessageCell { public static let height: CGFloat = 32 diff --git a/Session/Conversations/Settings/ThreadDisappearingMessagesSettingsViewModel.swift b/Session/Conversations/Settings/ThreadDisappearingMessagesSettingsViewModel.swift index 981c05624..86a5ac164 100644 --- a/Session/Conversations/Settings/ThreadDisappearingMessagesSettingsViewModel.swift +++ b/Session/Conversations/Settings/ThreadDisappearingMessagesSettingsViewModel.swift @@ -7,6 +7,7 @@ import DifferenceKit import SessionUIKit import SessionMessagingKit import SessionUtilitiesKit +import SessionSnodeKit class ThreadDisappearingMessagesSettingsViewModel: SessionTableViewModel { // MARK: - Config diff --git a/Session/Conversations/Views & Modals/ConversationTitleView.swift b/Session/Conversations/Views & Modals/ConversationTitleView.swift index d4a0c78f0..03c9d5534 100644 --- a/Session/Conversations/Views & Modals/ConversationTitleView.swift +++ b/Session/Conversations/Views & Modals/ConversationTitleView.swift @@ -144,7 +144,7 @@ final class ConversationTitleView: UIView { subtitleLabel?.attributedText = NSAttributedString( string: FullConversationCell.mutePrefix, attributes: [ - .font: UIFont.ows_elegantIconsFont(10), + .font: UIFont(name: "ElegantIcons", size: 10) as Any, .foregroundColor: textPrimary ] ) diff --git a/Session/Home/New Conversation/NewConversationVC.swift b/Session/Home/New Conversation/NewConversationVC.swift index 5e8c96eae..0b40a49c1 100644 --- a/Session/Home/New Conversation/NewConversationVC.swift +++ b/Session/Home/New Conversation/NewConversationVC.swift @@ -4,6 +4,7 @@ import UIKit import GRDB import SessionUIKit import SessionMessagingKit +import SignalUtilitiesKit final class NewConversationVC: BaseVC, ThemedNavigation, UITableViewDelegate, UITableViewDataSource { private let newConversationViewModel = NewConversationViewModel() diff --git a/Session/Media Viewing & Editing/GIFs/GifPickerCell.swift b/Session/Media Viewing & Editing/GIFs/GifPickerCell.swift index b748a9521..0967e8020 100644 --- a/Session/Media Viewing & Editing/GIFs/GifPickerCell.swift +++ b/Session/Media Viewing & Editing/GIFs/GifPickerCell.swift @@ -4,6 +4,7 @@ import Foundation import Combine import YYImage import SignalUtilitiesKit +import SignalCoreKit class GifPickerCell: UICollectionViewCell { diff --git a/Session/Media Viewing & Editing/GIFs/GifPickerViewController.swift b/Session/Media Viewing & Editing/GIFs/GifPickerViewController.swift index c5e92d27d..4b2436258 100644 --- a/Session/Media Viewing & Editing/GIFs/GifPickerViewController.swift +++ b/Session/Media Viewing & Editing/GIFs/GifPickerViewController.swift @@ -217,7 +217,7 @@ class GifPickerViewController: OWSViewController, UISearchBarDelegate, UICollect private func createErrorLabel(text: String) -> UILabel { let label: UILabel = UILabel() - label.font = .ows_mediumFont(withSize: 20) + label.font = UIFont.systemFont(ofSize: 20, weight: .medium) label.text = text label.themeTextColor = .textPrimary label.textAlignment = .center diff --git a/Session/Media Viewing & Editing/GIFs/GiphyAPI.swift b/Session/Media Viewing & Editing/GIFs/GiphyAPI.swift index ec2ccddbb..1a3f6eef5 100644 --- a/Session/Media Viewing & Editing/GIFs/GiphyAPI.swift +++ b/Session/Media Viewing & Editing/GIFs/GiphyAPI.swift @@ -5,6 +5,7 @@ import Combine import CoreServices import SignalUtilitiesKit import SessionUtilitiesKit +import SignalCoreKit // There's no UTI type for webp! enum GiphyFormat { diff --git a/Session/Media Viewing & Editing/OWSImagePickerController.swift b/Session/Media Viewing & Editing/OWSImagePickerController.swift index 904a239df..d88e3a60a 100644 --- a/Session/Media Viewing & Editing/OWSImagePickerController.swift +++ b/Session/Media Viewing & Editing/OWSImagePickerController.swift @@ -3,6 +3,7 @@ // import Foundation +import SignalUtilitiesKit @objc class OWSImagePickerController: UIImagePickerController { diff --git a/Session/Media Viewing & Editing/PhotoCapture.swift b/Session/Media Viewing & Editing/PhotoCapture.swift index 37fa99901..6f4687e85 100644 --- a/Session/Media Viewing & Editing/PhotoCapture.swift +++ b/Session/Media Viewing & Editing/PhotoCapture.swift @@ -6,6 +6,7 @@ import AVFoundation import CoreServices import SessionMessagingKit import SessionUtilitiesKit +import SignalCoreKit protocol PhotoCaptureDelegate: AnyObject { func photoCapture(_ photoCapture: PhotoCapture, didFinishProcessingAttachment attachment: SignalAttachment) diff --git a/Session/Media Viewing & Editing/PhotoCaptureViewController.swift b/Session/Media Viewing & Editing/PhotoCaptureViewController.swift index 32b08929e..91e43eb61 100644 --- a/Session/Media Viewing & Editing/PhotoCaptureViewController.swift +++ b/Session/Media Viewing & Editing/PhotoCaptureViewController.swift @@ -601,7 +601,7 @@ class RecordingTimerView: UIView { private lazy var label: UILabel = { let label: UILabel = UILabel() - label.font = .ows_monospacedDigitFont(withSize: 20) + label.font = UIFont.monospacedDigitSystemFont(ofSize: 20, weight: .regular) label.themeTextColor = .textPrimary label.textAlignment = .center label.layer.shadowOffset = CGSize.zero diff --git a/Session/Media Viewing & Editing/SendMediaNavigationController.swift b/Session/Media Viewing & Editing/SendMediaNavigationController.swift index a452a3cbf..63bf1fde4 100644 --- a/Session/Media Viewing & Editing/SendMediaNavigationController.swift +++ b/Session/Media Viewing & Editing/SendMediaNavigationController.swift @@ -5,6 +5,7 @@ import Combine import Photos import SignalUtilitiesKit import SignalCoreKit +import SessionUIKit class SendMediaNavigationController: UINavigationController { public override var preferredStatusBarStyle: UIStatusBarStyle { @@ -596,7 +597,10 @@ private class DoneButton: UIView { private lazy var badgeLabel: UILabel = { let result: UILabel = UILabel() - result.font = .ows_dynamicTypeSubheadline.ows_monospaced() + result.font = UIFont.monospacedDigitSystemFont( + ofSize: UIFont.preferredFont(forTextStyle: .subheadline).pointSize, + weight: .regular + ) result.themeTextColor = .black // Will render on the primary color so should always be black result.textAlignment = .center diff --git a/Session/Media Viewing & Editing/Transitions/MediaInteractiveDismiss.swift b/Session/Media Viewing & Editing/Transitions/MediaInteractiveDismiss.swift index bd213e0b9..ad1cb6fcd 100644 --- a/Session/Media Viewing & Editing/Transitions/MediaInteractiveDismiss.swift +++ b/Session/Media Viewing & Editing/Transitions/MediaInteractiveDismiss.swift @@ -1,6 +1,7 @@ // Copyright © 2022 Rangeproof Pty Ltd. All rights reserved. import UIKit +import SignalUtilitiesKit // MARK: - InteractivelyDismissableViewController diff --git a/Session/Meta/AppDelegate.swift b/Session/Meta/AppDelegate.swift index 82f373b48..254679d33 100644 --- a/Session/Meta/AppDelegate.swift +++ b/Session/Meta/AppDelegate.swift @@ -27,8 +27,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD // MARK: - Lifecycle func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - // Log something immediately to make it easier to track app launches (and crashes during launch) - SNLog("Launching \(SessionApp.versionInfo)") startTime = CACurrentMediaTime() // These should be the first things we do (the startup process can fail without them) @@ -288,8 +286,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD Configuration.performMainSetup() JobRunner.add(executor: SyncPushTokensJob.self, for: .syncPushTokens) - // Setup the UI and trigger any post-UI setup actions - self.ensureRootViewController(calledFrom: lifecycleMethod) { [weak self] in + // Setup the UI if needed, then trigger any post-UI setup actions + self.ensureRootViewController(calledFrom: lifecycleMethod) { [weak self] success in + // If we didn't successfully ensure the rootViewController then don't continue as + // the user is in an invalid state (and should have already been shown a modal) + guard success else { return } + /// Trigger any launch-specific jobs and start the JobRunner with `JobRunner.appDidFinishLaunching()` some /// of these jobs (eg. DisappearingMessages job) can impact the interactions which get fetched to display on the home /// screen, if the PagedDatabaseObserver hasn't been setup yet then the home screen can show stale (ie. deleted) @@ -483,11 +485,16 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD private func ensureRootViewController( calledFrom lifecycleMethod: LifecycleMethod, - onComplete: (() -> ())? = nil + onComplete: @escaping ((Bool) -> ()) = { _ in } ) { - guard (AppReadiness.isAppReady() || lifecycleMethod == .finishLaunching) && Storage.shared.isValid && !hasInitialRootViewController else { - return - } + let hasInitialRootViewController: Bool = self.hasInitialRootViewController + + // Always call the completion block and indicate whether we successfully created the UI + guard + Storage.shared.isValid && + (AppReadiness.isAppReady() || lifecycleMethod == .finishLaunching) && + !hasInitialRootViewController + else { return DispatchQueue.main.async { onComplete(hasInitialRootViewController) } } /// Start a timeout for the creation of the rootViewController setup process (if it takes too long then we want to give the user /// the option to export their logs) @@ -541,7 +548,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD } // Setup is completed so run any post-setup tasks - onComplete?() + onComplete(true) } // Navigate to the approriate screen depending on the onboarding state diff --git a/Session/Meta/SessionApp.swift b/Session/Meta/SessionApp.swift index 5dfc97351..319c82f7e 100644 --- a/Session/Meta/SessionApp.swift +++ b/Session/Meta/SessionApp.swift @@ -4,6 +4,7 @@ import Foundation import SessionUtilitiesKit import SessionMessagingKit import SignalCoreKit +import SessionUIKit public struct SessionApp { // FIXME: Refactor this to be protocol based for unit testing (or even dynamic based on view hierarchy - do want to avoid needing to use the main thread to access them though) diff --git a/Session/Meta/Signal-Bridging-Header.h b/Session/Meta/Signal-Bridging-Header.h index e30005afb..a745cd256 100644 --- a/Session/Meta/Signal-Bridging-Header.h +++ b/Session/Meta/Signal-Bridging-Header.h @@ -2,32 +2,9 @@ // Copyright (c) 2019 Open Whisper Systems. All rights reserved. // -#import -#import -#import - -// Separate iOS Frameworks from other imports. #import "AVAudioSession+OWS.h" #import "OWSAudioPlayer.h" #import "OWSBezierPathView.h" #import "OWSMessageTimerView.h" #import "OWSWindowManager.h" #import "MainAppContext.h" -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import diff --git a/Session/Notifications/PushRegistrationManager.swift b/Session/Notifications/PushRegistrationManager.swift index 50fe02510..392b7c542 100644 --- a/Session/Notifications/PushRegistrationManager.swift +++ b/Session/Notifications/PushRegistrationManager.swift @@ -5,6 +5,7 @@ import Combine import PushKit import GRDB import SignalUtilitiesKit +import SignalCoreKit public enum PushRegistrationError: Error { case assertionError(description: String) diff --git a/Session/Onboarding/Onboarding.swift b/Session/Onboarding/Onboarding.swift index b09fae7ef..97607724d 100644 --- a/Session/Onboarding/Onboarding.swift +++ b/Session/Onboarding/Onboarding.swift @@ -6,6 +6,7 @@ import Sodium import GRDB import SessionUtilitiesKit import SessionMessagingKit +import SessionSnodeKit enum Onboarding { private static let profileNameRetrievalIdentifier: Atomic = Atomic(nil) diff --git a/Session/Shared/CaptionView.swift b/Session/Shared/CaptionView.swift index a861a5a7e..1b66232ca 100644 --- a/Session/Shared/CaptionView.swift +++ b/Session/Shared/CaptionView.swift @@ -100,7 +100,7 @@ private class CaptionView: UIView { let textView: CaptionTextView = { let textView = CaptionTextView() - textView.font = UIFont.ows_dynamicTypeBody + textView.font = UIFont.preferredFont(forTextStyle: .body) textView.themeTextColor = .textPrimary textView.themeBackgroundColor = .clear textView.isEditable = false diff --git a/Session/Shared/FullConversationCell.swift b/Session/Shared/FullConversationCell.swift index 9a8d7fa83..feba6c06d 100644 --- a/Session/Shared/FullConversationCell.swift +++ b/Session/Shared/FullConversationCell.swift @@ -492,7 +492,7 @@ public final class FullConversationCell: UITableViewCell, SwipeActionOptimisticC case (true, false): self.snippetLabel.attributedText = NSAttributedString( string: FullConversationCell.mutePrefix, - attributes: [ .font: UIFont.ows_elegantIconsFont(10) ] + attributes: [ .font: UIFont(name: "ElegantIcons", size: 10) as Any ] ) .appending(attrString) @@ -547,7 +547,7 @@ public final class FullConversationCell: UITableViewCell, SwipeActionOptimisticC result.append(NSAttributedString( string: FullConversationCell.mutePrefix, attributes: [ - .font: UIFont.ows_elegantIconsFont(10), + .font: UIFont(name: "ElegantIcons", size: 10) as Any, .foregroundColor: textColor ] )) @@ -562,7 +562,7 @@ public final class FullConversationCell: UITableViewCell, SwipeActionOptimisticC result.append(NSAttributedString( string: " ", attributes: [ - .font: UIFont.ows_elegantIconsFont(10), + .font: UIFont(name: "ElegantIcons", size: 10) as Any, .foregroundColor: textColor ] )) diff --git a/Session/Shared/OWSBezierPathView.h b/Session/Shared/OWSBezierPathView.h index 6cb0201a8..c3aea7400 100644 --- a/Session/Shared/OWSBezierPathView.h +++ b/Session/Shared/OWSBezierPathView.h @@ -2,6 +2,8 @@ // Copyright (c) 2017 Open Whisper Systems. All rights reserved. // +#import + typedef void (^ConfigureShapeLayerBlock)(CAShapeLayer *_Nonnull layer, CGRect bounds); NS_ASSUME_NONNULL_BEGIN diff --git a/SessionMessagingKit/Utilities/Sodium+Utilities.swift b/SessionMessagingKit/Utilities/Sodium+Utilities.swift index 9166c392d..8e5210a73 100644 --- a/SessionMessagingKit/Utilities/Sodium+Utilities.swift +++ b/SessionMessagingKit/Utilities/Sodium+Utilities.swift @@ -1,6 +1,7 @@ // Copyright © 2022 Rangeproof Pty Ltd. All rights reserved. import Foundation +import CryptoKit import Clibsodium import Sodium import Curve25519Kit @@ -108,10 +109,10 @@ extension Sodium { /// pubkeys (this doesn't affect verification at all) public func sogsSignature(message: Bytes, secretKey: Bytes, blindedSecretKey ka: Bytes, blindedPublicKey kA: Bytes) -> Bytes? { /// H_rh = sha512(s.encode()).digest()[32:] - let H_rh: Bytes = Bytes(secretKey.sha512().suffix(32)) + let H_rh: Bytes = Bytes(SHA512.hash(data: secretKey).suffix(32)) /// r = salt.crypto_core_ed25519_scalar_reduce(sha512_multipart(H_rh, kA, message_parts)) - let combinedHashBytes: Bytes = (H_rh + kA + message).sha512() + let combinedHashBytes: Bytes = SHA512.hash(data: H_rh + kA + message).bytes let rPtr: UnsafeMutablePointer = UnsafeMutablePointer.allocate(capacity: Sodium.scalarLength) _ = combinedHashBytes.withUnsafeBytes { (combinedHashPtr: UnsafeRawBufferPointer) -> Int32 in @@ -129,7 +130,7 @@ extension Sodium { /// HRAM = salt.crypto_core_ed25519_scalar_reduce(sha512_multipart(sig_R, kA, message_parts)) let sig_RBytes: Bytes = Data(bytes: sig_RPtr, count: Sodium.noClampLength).bytes - let HRAMHashBytes: Bytes = (sig_RBytes + kA + message).sha512() + let HRAMHashBytes: Bytes = SHA512.hash(data: sig_RBytes + kA + message).bytes let HRAMPtr: UnsafeMutablePointer = UnsafeMutablePointer.allocate(capacity: Sodium.scalarLength) _ = HRAMHashBytes.withUnsafeBytes { (HRAMHashPtr: UnsafeRawBufferPointer) -> Int32 in diff --git a/SessionShareExtension/Meta/SignalShareExtension-Bridging-Header.h b/SessionShareExtension/Meta/SignalShareExtension-Bridging-Header.h index 9334672ce..216371943 100644 --- a/SessionShareExtension/Meta/SignalShareExtension-Bridging-Header.h +++ b/SessionShareExtension/Meta/SignalShareExtension-Bridging-Header.h @@ -6,7 +6,6 @@ #import // Separate iOS Frameworks from other imports. -#import #import #import #import diff --git a/SessionUtilitiesKit/Crypto/Hex.swift b/SessionUtilitiesKit/Crypto/Hex.swift index f9b01f406..ade2e838b 100644 --- a/SessionUtilitiesKit/Crypto/Hex.swift +++ b/SessionUtilitiesKit/Crypto/Hex.swift @@ -16,7 +16,7 @@ public extension Data { var bytes: [UInt8] { return Array(self) } func toHexString() -> String { - return bytes.map { String(format: "%02x", $0) }.joined() + return bytes.toHexString() } init(hex: String) { @@ -71,4 +71,12 @@ public extension Array where Element == UInt8 { append(b) } } + + func toHexString() -> String { + return map { String(format: "%02x", $0) }.joined() + } + + func toBase64(options: Data.Base64EncodingOptions = []) -> String { + Data(self).base64EncodedString(options: options) + } } diff --git a/SessionUtilitiesKit/Crypto/Mnemonic.swift b/SessionUtilitiesKit/Crypto/Mnemonic.swift index ac8f46af5..a02c31940 100644 --- a/SessionUtilitiesKit/Crypto/Mnemonic.swift +++ b/SessionUtilitiesKit/Crypto/Mnemonic.swift @@ -1,10 +1,26 @@ // Copyright © 2022 Rangeproof Pty Ltd. All rights reserved. import Foundation -import CryptoSwift /// Based on [mnemonic.js](https://github.com/loki-project/loki-messenger/blob/development/libloki/modules/mnemonic.js) . public enum Mnemonic { + /// This implementation was sourced from https://gist.github.com/antfarm/695fa78e0730b67eb094c77d53942216 + enum CRC32 { + static let table: [UInt32] = { + (0...255).map { i -> UInt32 in + (0..<8).reduce(UInt32(i), { c, _ in + ((0xEDB88320 * (c % 2)) ^ (c >> 1)) + }) + } + }() + + static func checksum(bytes: [UInt8]) -> UInt32 { + return ~(bytes.reduce(~UInt32(0), { crc, byte in + (crc >> 8) ^ table[(Int(crc) ^ Int(byte)) & 0xFF] + })) + } + } + public struct Language: Hashable { fileprivate let filename: String fileprivate let prefixLength: UInt @@ -147,7 +163,7 @@ public enum Mnemonic { } private static func determineChecksumIndex(for x: [String], prefixLength: UInt) -> Int { - let checksum = Array(x.map { $0.prefix(length: prefixLength) }.joined().utf8).crc32() + let checksum = CRC32.checksum(bytes: Array(x.map { $0.prefix(length: prefixLength) }.joined().utf8)) return Int(checksum) % x.count } diff --git a/SessionUtilitiesKit/General/NSNotificationCenter+OWS.h b/SessionUtilitiesKit/General/NSNotificationCenter+OWS.h deleted file mode 100644 index 2a97bda43..000000000 --- a/SessionUtilitiesKit/General/NSNotificationCenter+OWS.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// Copyright (c) 2017 Open Whisper Systems. All rights reserved. -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -// We often use notifications as way to publish events. -// -// We never need these events to be received synchronously, -// so we should always send them asynchronously to avoid any -// possible risk of deadlock. These methods also ensure that -// the notifications are always fired on the main thread. -@interface NSNotificationCenter (OWS) - -- (void)postNotificationNameAsync:(NSNotificationName)name object:(nullable id)object; -- (void)postNotificationNameAsync:(NSNotificationName)name - object:(nullable id)object - userInfo:(nullable NSDictionary *)userInfo; - -@end - -NS_ASSUME_NONNULL_END diff --git a/SessionUtilitiesKit/General/NSNotificationCenter+OWS.m b/SessionUtilitiesKit/General/NSNotificationCenter+OWS.m deleted file mode 100644 index c406ff6b7..000000000 --- a/SessionUtilitiesKit/General/NSNotificationCenter+OWS.m +++ /dev/null @@ -1,29 +0,0 @@ -// -// Copyright (c) 2017 Open Whisper Systems. All rights reserved. -// - -#import "NSNotificationCenter+OWS.h" - -NS_ASSUME_NONNULL_BEGIN - -@implementation NSNotificationCenter (OWS) - -- (void)postNotificationNameAsync:(NSNotificationName)name object:(nullable id)object -{ - dispatch_async(dispatch_get_main_queue(), ^{ - [self postNotificationName:name object:object]; - }); -} - -- (void)postNotificationNameAsync:(NSNotificationName)name - object:(nullable id)object - userInfo:(nullable NSDictionary *)userInfo -{ - dispatch_async(dispatch_get_main_queue(), ^{ - [self postNotificationName:name object:object userInfo:userInfo]; - }); -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/SessionUtilitiesKit/General/NSString+SSK.h b/SessionUtilitiesKit/General/NSString+SSK.h deleted file mode 100644 index 48c43f466..000000000 --- a/SessionUtilitiesKit/General/NSString+SSK.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// Copyright (c) 2018 Open Whisper Systems. All rights reserved. -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface NSString (SSK) - -- (NSString *)rtlSafeAppend:(NSString *)string; - -@end - -NS_ASSUME_NONNULL_END diff --git a/SessionUtilitiesKit/General/NSString+SSK.m b/SessionUtilitiesKit/General/NSString+SSK.m deleted file mode 100644 index c69067838..000000000 --- a/SessionUtilitiesKit/General/NSString+SSK.m +++ /dev/null @@ -1,23 +0,0 @@ -// -// Copyright (c) 2018 Open Whisper Systems. All rights reserved. -// - -#import "NSString+SSK.h" -#import "AppContext.h" - -NS_ASSUME_NONNULL_BEGIN - -@implementation NSString (SSK) - -- (NSString *)rtlSafeAppend:(NSString *)string -{ - if (CurrentAppContext().isRTL) { - return [string stringByAppendingString:self]; - } else { - return [self stringByAppendingString:string]; - } -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/SessionUtilitiesKit/General/String+SSK.swift b/SessionUtilitiesKit/General/String+SSK.swift index ae50abb28..f888c654a 100644 --- a/SessionUtilitiesKit/General/String+SSK.swift +++ b/SessionUtilitiesKit/General/String+SSK.swift @@ -10,10 +10,6 @@ public extension String { return (self as NSString).digitsOnly() } - func rtlSafeAppend(_ string: String) -> String { - return (self as NSString).rtlSafeAppend(string) - } - func substring(from index: Int) -> String { return String(self[self.index(self.startIndex, offsetBy: index)...]) } diff --git a/SessionUtilitiesKit/Meta/SessionUtilitiesKit.h b/SessionUtilitiesKit/Meta/SessionUtilitiesKit.h index e4124f453..7bd86403d 100644 --- a/SessionUtilitiesKit/Meta/SessionUtilitiesKit.h +++ b/SessionUtilitiesKit/Meta/SessionUtilitiesKit.h @@ -7,8 +7,6 @@ FOUNDATION_EXPORT const unsigned char SessionUtilitiesKitVersionString[]; #import #import #import -#import -#import #import #import #import diff --git a/SignalUtilitiesKit/Media Viewing & Editing/Attachment Approval/AttachmentCaptionToolbar.swift b/SignalUtilitiesKit/Media Viewing & Editing/Attachment Approval/AttachmentCaptionToolbar.swift index 534c7321c..4c3ad9f57 100644 --- a/SignalUtilitiesKit/Media Viewing & Editing/Attachment Approval/AttachmentCaptionToolbar.swift +++ b/SignalUtilitiesKit/Media Viewing & Editing/Attachment Approval/AttachmentCaptionToolbar.swift @@ -128,7 +128,7 @@ class AttachmentCaptionToolbar: UIView, UITextViewDelegate { textView.themeBackgroundColor = .clear textView.themeTintColor = .textPrimary - textView.font = UIFont.ows_dynamicTypeBody + textView.font = UIFont.preferredFont(forTextStyle: .body) textView.themeTextColor = .textPrimary textView.textContainerInset = UIEdgeInsets(top: 7, left: 7, bottom: 7, right: 7) diff --git a/SignalUtilitiesKit/Media Viewing & Editing/MediaMessageView.swift b/SignalUtilitiesKit/Media Viewing & Editing/MediaMessageView.swift index 5884bb82d..6089077cc 100644 --- a/SignalUtilitiesKit/Media Viewing & Editing/MediaMessageView.swift +++ b/SignalUtilitiesKit/Media Viewing & Editing/MediaMessageView.swift @@ -260,15 +260,15 @@ public class MediaMessageView: UIView, OWSAudioPlayerDelegate { // Styling switch mode { case .attachmentApproval: - label.font = UIFont.ows_boldFont(withSize: ScaleFromIPhone5To7Plus(16, 22)) + label.font = UIFont.boldSystemFont(ofSize: ScaleFromIPhone5To7Plus(16, 22)) label.themeTextColor = .textPrimary case .large: - label.font = UIFont.ows_regularFont(withSize: ScaleFromIPhone5To7Plus(18, 24)) + label.font = UIFont.systemFont(ofSize: ScaleFromIPhone5To7Plus(18, 24)) label.themeTextColor = .primary case .small: - label.font = UIFont.ows_regularFont(withSize: ScaleFromIPhone5To7Plus(14, 14)) + label.font = UIFont.systemFont(ofSize: ScaleFromIPhone5To7Plus(14, 14)) label.themeTextColor = .primary } @@ -315,15 +315,15 @@ public class MediaMessageView: UIView, OWSAudioPlayerDelegate { // Styling switch mode { case .attachmentApproval: - label.font = UIFont.ows_regularFont(withSize: ScaleFromIPhone5To7Plus(12, 18)) + label.font = UIFont.systemFont(ofSize: ScaleFromIPhone5To7Plus(12, 18)) label.themeTextColor = .textSecondary case .large: - label.font = UIFont.ows_regularFont(withSize: ScaleFromIPhone5To7Plus(18, 24)) + label.font = UIFont.systemFont(ofSize: ScaleFromIPhone5To7Plus(18, 24)) label.themeTextColor = .primary case .small: - label.font = UIFont.ows_regularFont(withSize: ScaleFromIPhone5To7Plus(14, 14)) + label.font = UIFont.systemFont(ofSize: ScaleFromIPhone5To7Plus(14, 14)) label.themeTextColor = .primary } @@ -332,7 +332,7 @@ public class MediaMessageView: UIView, OWSAudioPlayerDelegate { // We only load Link Previews for HTTPS urls so append an explanation for not if let linkPreviewURL: String = linkPreviewInfo?.url { if let targetUrl: URL = URL(string: linkPreviewURL), targetUrl.scheme?.lowercased() != "https" { - label.font = UIFont.ows_regularFont(withSize: Values.verySmallFontSize) + label.font = UIFont.systemFont(ofSize: Values.verySmallFontSize) label.text = "vc_share_link_previews_unsecure".localized() label.themeTextColor = (mode == .attachmentApproval ? .textSecondary : @@ -585,7 +585,7 @@ public class MediaMessageView: UIView, OWSAudioPlayerDelegate { // This error case is handled already in the 'subtitleLabel' creation } else { - self?.subtitleLabel.font = UIFont.ows_regularFont(withSize: Values.verySmallFontSize) + self?.subtitleLabel.font = UIFont.systemFont(ofSize: Values.verySmallFontSize) self?.subtitleLabel.text = "vc_share_link_previews_error".localized() self?.subtitleLabel.themeTextColor = (self?.mode == .attachmentApproval ? .textSecondary : diff --git a/SignalUtilitiesKit/Meta/SignalUtilitiesKit.h b/SignalUtilitiesKit/Meta/SignalUtilitiesKit.h index aceb514c8..f90e1721d 100644 --- a/SignalUtilitiesKit/Meta/SignalUtilitiesKit.h +++ b/SignalUtilitiesKit/Meta/SignalUtilitiesKit.h @@ -10,12 +10,9 @@ FOUNDATION_EXPORT const unsigned char SignalUtilitiesKitVersionString[]; #import #import #import -#import #import -#import #import #import #import #import #import -#import diff --git a/SignalUtilitiesKit/Utilities/NSAttributedString+OWS.h b/SignalUtilitiesKit/Utilities/NSAttributedString+OWS.h deleted file mode 100644 index d78b1744f..000000000 --- a/SignalUtilitiesKit/Utilities/NSAttributedString+OWS.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// Copyright (c) 2018 Open Whisper Systems. All rights reserved. -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface NSAttributedString (OWS) - -- (NSAttributedString *)rtlSafeAppend:(NSString *)text attributes:(NSDictionary *)attributes; -- (NSAttributedString *)rtlSafeAppend:(NSAttributedString *)string; - -@end - -NS_ASSUME_NONNULL_END diff --git a/SignalUtilitiesKit/Utilities/NSAttributedString+OWS.m b/SignalUtilitiesKit/Utilities/NSAttributedString+OWS.m deleted file mode 100644 index 3762543d2..000000000 --- a/SignalUtilitiesKit/Utilities/NSAttributedString+OWS.m +++ /dev/null @@ -1,39 +0,0 @@ -// -// Copyright (c) 2018 Open Whisper Systems. All rights reserved. -// - -#import "NSAttributedString+OWS.h" -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@implementation NSAttributedString (OWS) - -- (NSAttributedString *)rtlSafeAppend:(NSString *)text attributes:(NSDictionary *)attributes -{ - OWSAssertDebug(text); - OWSAssertDebug(attributes); - - NSAttributedString *substring = [[NSAttributedString alloc] initWithString:text attributes:attributes]; - return [self rtlSafeAppend:substring]; -} - -- (NSAttributedString *)rtlSafeAppend:(NSAttributedString *)string -{ - OWSAssertDebug(string); - - NSMutableAttributedString *result = [NSMutableAttributedString new]; - if (CurrentAppContext().isRTL) { - [result appendAttributedString:string]; - [result appendAttributedString:self]; - } else { - [result appendAttributedString:self]; - [result appendAttributedString:string]; - } - return [result copy]; -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/SignalUtilitiesKit/Utilities/OWSDispatch.h b/SignalUtilitiesKit/Utilities/OWSDispatch.h deleted file mode 100644 index ef0dccd93..000000000 --- a/SignalUtilitiesKit/Utilities/OWSDispatch.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// Copyright (c) 2018 Open Whisper Systems. All rights reserved. -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface OWSDispatch : NSObject - -/** - * Attachment downloading - */ -+ (dispatch_queue_t)attachmentsQueue; - -/** - * Serial message sending queue - */ -+ (dispatch_queue_t)sendingQueue; - -@end - -NS_ASSUME_NONNULL_END diff --git a/SignalUtilitiesKit/Utilities/OWSDispatch.m b/SignalUtilitiesKit/Utilities/OWSDispatch.m deleted file mode 100644 index 5f300a2f9..000000000 --- a/SignalUtilitiesKit/Utilities/OWSDispatch.m +++ /dev/null @@ -1,34 +0,0 @@ -// -// Copyright (c) 2018 Open Whisper Systems. All rights reserved. -// - -#import "OWSDispatch.h" - -NS_ASSUME_NONNULL_BEGIN - -@implementation OWSDispatch - -+ (dispatch_queue_t)attachmentsQueue -{ - static dispatch_once_t onceToken; - static dispatch_queue_t queue; - dispatch_once(&onceToken, ^{ - queue = dispatch_queue_create("org.whispersystems.signal.attachments", NULL); - }); - return queue; -} - -+ (dispatch_queue_t)sendingQueue -{ - static dispatch_once_t onceToken; - static dispatch_queue_t queue; - dispatch_once(&onceToken, ^{ - dispatch_queue_attr_t attributes = dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_USER_INITIATED, 0); - queue = dispatch_queue_create("org.whispersystems.signal.sendQueue", attributes); - }); - return queue; -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/SignalUtilitiesKit/Utilities/UIFont+OWS.h b/SignalUtilitiesKit/Utilities/UIFont+OWS.h deleted file mode 100644 index 741ed989b..000000000 --- a/SignalUtilitiesKit/Utilities/UIFont+OWS.h +++ /dev/null @@ -1,63 +0,0 @@ -// -// Copyright (c) 2019 Open Whisper Systems. All rights reserved. -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface UIFont (OWS) - -+ (UIFont *)ows_thinFontWithSize:(CGFloat)size; - -+ (UIFont *)ows_lightFontWithSize:(CGFloat)size; - -+ (UIFont *)ows_regularFontWithSize:(CGFloat)size; - -+ (UIFont *)ows_mediumFontWithSize:(CGFloat)size; - -+ (UIFont *)ows_boldFontWithSize:(CGFloat)size; - -+ (UIFont *)ows_monospacedDigitFontWithSize:(CGFloat)size; - -#pragma mark - Icon Fonts - -+ (UIFont *)ows_fontAwesomeFont:(CGFloat)size; -+ (UIFont *)ows_dripIconsFont:(CGFloat)size; -+ (UIFont *)ows_elegantIconsFont:(CGFloat)size; - -#pragma mark - Dynamic Type - -@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeTitle1Font; -@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeTitle2Font; -@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeTitle3Font; -@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeHeadlineFont; -@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeBodyFont; -@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeSubheadlineFont; -@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeFootnoteFont; -@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeCaption1Font; -@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeCaption2Font; - -#pragma mark - Dynamic Type Clamped - -@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeLargeTitle1ClampedFont; -@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeTitle1ClampedFont; -@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeTitle2ClampedFont; -@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeTitle3ClampedFont; -@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeHeadlineClampedFont; -@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeBodyClampedFont; -@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeSubheadlineClampedFont; -@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeFootnoteClampedFont; -@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeCaption1ClampedFont; -@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeCaption2ClampedFont; - -#pragma mark - Styles - -- (UIFont *)ows_italic; -- (UIFont *)ows_bold; -- (UIFont *)ows_mediumWeight; -- (UIFont *)ows_monospaced; - -@end - -NS_ASSUME_NONNULL_END diff --git a/SignalUtilitiesKit/Utilities/UIFont+OWS.m b/SignalUtilitiesKit/Utilities/UIFont+OWS.m deleted file mode 100644 index 78497bd44..000000000 --- a/SignalUtilitiesKit/Utilities/UIFont+OWS.m +++ /dev/null @@ -1,234 +0,0 @@ -// -// Copyright (c) 2019 Open Whisper Systems. All rights reserved. -// - -#import "UIFont+OWS.h" -#import - -NS_ASSUME_NONNULL_BEGIN - -@implementation UIFont (OWS) - -+ (UIFont *)ows_thinFontWithSize:(CGFloat)size -{ - return [UIFont systemFontOfSize:size weight:UIFontWeightThin]; -} - -+ (UIFont *)ows_lightFontWithSize:(CGFloat)size -{ - return [UIFont systemFontOfSize:size weight:UIFontWeightLight]; -} - -+ (UIFont *)ows_regularFontWithSize:(CGFloat)size -{ - return [UIFont systemFontOfSize:size weight:UIFontWeightRegular]; -} - -+ (UIFont *)ows_mediumFontWithSize:(CGFloat)size -{ - return [UIFont systemFontOfSize:size weight:UIFontWeightMedium]; -} - -+ (UIFont *)ows_boldFontWithSize:(CGFloat)size -{ - return [UIFont boldSystemFontOfSize:size]; -} - -+ (UIFont *)ows_monospacedDigitFontWithSize:(CGFloat)size; -{ - return [self monospacedDigitSystemFontOfSize:size weight:UIFontWeightRegular]; -} - -#pragma mark - Icon Fonts - -+ (UIFont *)ows_fontAwesomeFont:(CGFloat)size -{ - return [UIFont fontWithName:@"FontAwesome" size:size]; -} - -+ (UIFont *)ows_dripIconsFont:(CGFloat)size -{ - return [UIFont fontWithName:@"dripicons-v2" size:size]; -} - -+ (UIFont *)ows_elegantIconsFont:(CGFloat)size -{ - return [UIFont fontWithName:@"ElegantIcons" size:size]; -} - -#pragma mark - Dynamic Type - -+ (UIFont *)ows_dynamicTypeTitle1Font -{ - return [UIFont preferredFontForTextStyle:UIFontTextStyleTitle1]; -} - -+ (UIFont *)ows_dynamicTypeTitle2Font -{ - return [UIFont preferredFontForTextStyle:UIFontTextStyleTitle2]; -} - -+ (UIFont *)ows_dynamicTypeTitle3Font -{ - return [UIFont preferredFontForTextStyle:UIFontTextStyleTitle3]; -} - -+ (UIFont *)ows_dynamicTypeHeadlineFont -{ - return [UIFont preferredFontForTextStyle:UIFontTextStyleHeadline]; -} - -+ (UIFont *)ows_dynamicTypeBodyFont -{ - return [UIFont preferredFontForTextStyle:UIFontTextStyleBody]; -} - -+ (UIFont *)ows_dynamicTypeSubheadlineFont -{ - return [UIFont preferredFontForTextStyle:UIFontTextStyleSubheadline]; -} - -+ (UIFont *)ows_dynamicTypeFootnoteFont -{ - return [UIFont preferredFontForTextStyle:UIFontTextStyleFootnote]; -} - -+ (UIFont *)ows_dynamicTypeCaption1Font -{ - return [UIFont preferredFontForTextStyle:UIFontTextStyleCaption1]; -} - -+ (UIFont *)ows_dynamicTypeCaption2Font -{ - return [UIFont preferredFontForTextStyle:UIFontTextStyleCaption2]; -} - -#pragma mark - Dynamic Type Clamped - -+ (UIFont *)preferredFontForTextStyleClamped:(UIFontTextStyle)fontTextStyle -{ - // We clamp the dynamic type sizes at the max size available - // without "larger accessibility sizes" enabled. - static NSDictionary *maxPointSizeMap = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - NSMutableDictionary *map = [@{ - UIFontTextStyleTitle1 : @(34.0), - UIFontTextStyleTitle2 : @(28.0), - UIFontTextStyleTitle3 : @(26.0), - UIFontTextStyleHeadline : @(23.0), - UIFontTextStyleBody : @(23.0), - UIFontTextStyleSubheadline : @(21.0), - UIFontTextStyleFootnote : @(19.0), - UIFontTextStyleCaption1 : @(18.0), - UIFontTextStyleCaption2 : @(17.0), - } mutableCopy]; - map[UIFontTextStyleLargeTitle] = @(40.0); - maxPointSizeMap = map; - }); - - UIFont *font = [UIFont preferredFontForTextStyle:fontTextStyle]; - NSNumber *_Nullable maxPointSize = maxPointSizeMap[fontTextStyle]; - if (maxPointSize) { - if (maxPointSize.floatValue < font.pointSize) { - return [font fontWithSize:maxPointSize.floatValue]; - } - } else { - OWSFailDebug(@"Missing max point size for style: %@", fontTextStyle); - } - - return font; -} - -+ (UIFont *)ows_dynamicTypeLargeTitle1ClampedFont -{ - return [UIFont preferredFontForTextStyleClamped:UIFontTextStyleLargeTitle]; -} - -+ (UIFont *)ows_dynamicTypeTitle1ClampedFont -{ - return [UIFont preferredFontForTextStyleClamped:UIFontTextStyleTitle1]; -} - -+ (UIFont *)ows_dynamicTypeTitle2ClampedFont -{ - return [UIFont preferredFontForTextStyleClamped:UIFontTextStyleTitle2]; -} - -+ (UIFont *)ows_dynamicTypeTitle3ClampedFont -{ - return [UIFont preferredFontForTextStyleClamped:UIFontTextStyleTitle3]; -} - -+ (UIFont *)ows_dynamicTypeHeadlineClampedFont -{ - return [UIFont preferredFontForTextStyleClamped:UIFontTextStyleHeadline]; -} - -+ (UIFont *)ows_dynamicTypeBodyClampedFont -{ - return [UIFont preferredFontForTextStyleClamped:UIFontTextStyleBody]; -} - -+ (UIFont *)ows_dynamicTypeSubheadlineClampedFont -{ - return [UIFont preferredFontForTextStyleClamped:UIFontTextStyleSubheadline]; -} - -+ (UIFont *)ows_dynamicTypeFootnoteClampedFont -{ - return [UIFont preferredFontForTextStyleClamped:UIFontTextStyleFootnote]; -} - -+ (UIFont *)ows_dynamicTypeCaption1ClampedFont -{ - return [UIFont preferredFontForTextStyleClamped:UIFontTextStyleCaption1]; -} - -+ (UIFont *)ows_dynamicTypeCaption2ClampedFont -{ - return [UIFont preferredFontForTextStyleClamped:UIFontTextStyleCaption2]; -} - -#pragma mark - Styles - -- (UIFont *)ows_italic -{ - return [self styleWithSymbolicTraits:UIFontDescriptorTraitItalic]; -} - -- (UIFont *)ows_bold -{ - return [self styleWithSymbolicTraits:UIFontDescriptorTraitBold]; -} - -- (UIFont *)styleWithSymbolicTraits:(UIFontDescriptorSymbolicTraits)symbolicTraits -{ - UIFontDescriptor *fontDescriptor = [self.fontDescriptor fontDescriptorWithSymbolicTraits:symbolicTraits]; - UIFont *font = [UIFont fontWithDescriptor:fontDescriptor size:0]; - OWSAssertDebug(font); - return font ?: self; -} - -- (UIFont *)ows_mediumWeight -{ - // The recommended approach of deriving "medium" weight fonts for dynamic - // type fonts is: - // - // [UIFontDescriptor fontDescriptorByAddingAttributes:...] - // - // But this doesn't seem to work in practice on iOS 11 using UIFontWeightMedium. - - UIFont *derivedFont = [UIFont systemFontOfSize:self.pointSize weight:UIFontWeightMedium]; - return derivedFont; -} - -- (UIFont *)ows_monospaced -{ - return [self.class ows_monospacedDigitFontWithSize:self.pointSize]; -} - - -@end - -NS_ASSUME_NONNULL_END