diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index b9f7f6a93..930370bcc 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -581,7 +581,6 @@ B85357C323A1BD1200AAF6CD /* SeedVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B85357C223A1BD1200AAF6CD /* SeedVC.swift */; }; B85357C523A1F13800AAF6CD /* LinkDeviceVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B85357C423A1F13800AAF6CD /* LinkDeviceVC.swift */; }; B85357C723A1FB5100AAF6CD /* LinkDeviceVCDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B85357C623A1FB5100AAF6CD /* LinkDeviceVCDelegate.swift */; }; - B8544E3123D16CA500299F14 /* DeviceUtilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8544E3023D16CA500299F14 /* DeviceUtilities.swift */; }; B8544E3323D50E4900299F14 /* AppearanceUtilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8544E3223D50E4900299F14 /* AppearanceUtilities.swift */; }; B8544E3423D51EEF00299F14 /* ProfilePictureView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8BB82AC238F734800BA5194 /* ProfilePictureView.swift */; }; B8544E3523D5201400299F14 /* UIView+Constraints.swift in Sources */ = {isa = PBXBuildFile; fileRef = B885D5F52334A32100EE0D8E /* UIView+Constraints.swift */; }; @@ -599,15 +598,17 @@ B8B26C8F234D629C004ED98C /* MentionCandidateSelectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8B26C8E234D629C004ED98C /* MentionCandidateSelectionView.swift */; }; B8B26C91234D8CBD004ED98C /* MentionCandidateSelectionViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8B26C90234D8CBD004ED98C /* MentionCandidateSelectionViewDelegate.swift */; }; B8B5BCEC2394D869003823C9 /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8B5BCEB2394D869003823C9 /* Button.swift */; }; - B8BB82A0238F322400BA5194 /* Colors.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8BB829F238F322400BA5194 /* Colors.swift */; }; - B8BB82A2238F356100BA5194 /* Values.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8BB82A1238F356100BA5194 /* Values.swift */; }; B8BB82A5238F627000BA5194 /* HomeVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8BB82A4238F627000BA5194 /* HomeVC.swift */; }; - B8BB82A9238F62FB00BA5194 /* Gradients.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8BB82A8238F62FB00BA5194 /* Gradients.swift */; }; B8BB82AB238F669C00BA5194 /* ConversationCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8BB82AA238F669C00BA5194 /* ConversationCell.swift */; }; B8BB82B12390C37000BA5194 /* SearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8BB82B02390C37000BA5194 /* SearchBar.swift */; }; B8BB82B523947F2D00BA5194 /* TextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8BB82B423947F2D00BA5194 /* TextField.swift */; }; B8BB82B92394911B00BA5194 /* Separator.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8BB82B82394911B00BA5194 /* Separator.swift */; }; - B8BB82BE2394D4CE00BA5194 /* Fonts.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8BB82BD2394D4CE00BA5194 /* Fonts.swift */; }; + B8C9689523FA1B72005F64E0 /* AppMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8C9689023FA1401005F64E0 /* AppMode.swift */; }; + B8C9689623FA1B72005F64E0 /* Colors.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8BB829F238F322400BA5194 /* Colors.swift */; }; + B8C9689723FA1B72005F64E0 /* Fonts.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8BB82BD2394D4CE00BA5194 /* Fonts.swift */; }; + B8C9689823FA1B72005F64E0 /* Gradients.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8BB82A8238F62FB00BA5194 /* Gradients.swift */; }; + B8C9689923FA1B72005F64E0 /* Values.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8BB82A1238F356100BA5194 /* Values.swift */; }; + B8C9689A23FA1B95005F64E0 /* DeviceUtilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8544E3023D16CA500299F14 /* DeviceUtilities.swift */; }; B8CCF6352396005F0091D419 /* SpaceMono-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = B8CCF6342396005F0091D419 /* SpaceMono-Regular.ttf */; }; B8CCF63723961D6D0091D419 /* NewPrivateChatVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8CCF63623961D6D0091D419 /* NewPrivateChatVC.swift */; }; B8CCF639239721E20091D419 /* TabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8CCF638239721E20091D419 /* TabBar.swift */; }; @@ -1453,6 +1454,7 @@ B8BB82B423947F2D00BA5194 /* TextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextField.swift; sourceTree = ""; }; B8BB82B82394911B00BA5194 /* Separator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Separator.swift; sourceTree = ""; }; B8BB82BD2394D4CE00BA5194 /* Fonts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Fonts.swift; sourceTree = ""; }; + B8C9689023FA1401005F64E0 /* AppMode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppMode.swift; sourceTree = ""; }; B8CCF6342396005F0091D419 /* SpaceMono-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SpaceMono-Regular.ttf"; sourceTree = ""; }; B8CCF63623961D6D0091D419 /* NewPrivateChatVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewPrivateChatVC.swift; sourceTree = ""; }; B8CCF638239721E20091D419 /* TabBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBar.swift; sourceTree = ""; }; @@ -2719,7 +2721,6 @@ children = ( B8CCF63B239757C10091D419 /* Components */, B8BFFF392355426100102A27 /* Messaging */, - B8BB82A3238F356800BA5194 /* Style Guide */, B8CCF63C239757DB0091D419 /* Utilities */, B8CCF63D2397580E0091D419 /* View Controllers */, ); @@ -2729,9 +2730,8 @@ B846365922B7417900AF1514 /* Loki */ = { isa = PBXGroup; children = ( + B8C9689223FA1B05005F64E0 /* Redesign */, B8544E3623D520F600299F14 /* Jazz Icon */, - B8BB82AC238F734800BA5194 /* ProfilePictureView.swift */, - B885D5F52334A32100EE0D8E /* UIView+Constraints.swift */, ); path = Loki; sourceTree = ""; @@ -2750,6 +2750,7 @@ B8BB82A3238F356800BA5194 /* Style Guide */ = { isa = PBXGroup; children = ( + B8C9689023FA1401005F64E0 /* AppMode.swift */, B8BB829F238F322400BA5194 /* Colors.swift */, B8BB82BD2394D4CE00BA5194 /* Fonts.swift */, B8BB82A8238F62FB00BA5194 /* Gradients.swift */, @@ -2775,6 +2776,33 @@ path = Messaging; sourceTree = ""; }; + B8C9689223FA1B05005F64E0 /* Redesign */ = { + isa = PBXGroup; + children = ( + B8C9689323FA1B32005F64E0 /* Components */, + B8BB82A3238F356800BA5194 /* Style Guide */, + B8C9689423FA1B3D005F64E0 /* Utilities */, + ); + path = Redesign; + sourceTree = ""; + }; + B8C9689323FA1B32005F64E0 /* Components */ = { + isa = PBXGroup; + children = ( + B8BB82AC238F734800BA5194 /* ProfilePictureView.swift */, + ); + path = Components; + sourceTree = ""; + }; + B8C9689423FA1B3D005F64E0 /* Utilities */ = { + isa = PBXGroup; + children = ( + B8544E3023D16CA500299F14 /* DeviceUtilities.swift */, + B885D5F52334A32100EE0D8E /* UIView+Constraints.swift */, + ); + path = Utilities; + sourceTree = ""; + }; B8CCF63B239757C10091D419 /* Components */ = { isa = PBXGroup; children = ( @@ -2801,7 +2829,6 @@ isa = PBXGroup; children = ( B8544E3223D50E4900299F14 /* AppearanceUtilities.swift */, - B8544E3023D16CA500299F14 /* DeviceUtilities.swift */, B8783E9B23EB8DDE00404FB8 /* GeneralUtilities.swift */, B847570223D5698100759540 /* LokiPushNotificationManager.swift */, B84664F4235022F30083A1CD /* MentionUtilities.swift */, @@ -3673,6 +3700,7 @@ 34AC09E1211B39B100997B47 /* SelectThreadViewController.m in Sources */, 34AC09EF211B39B100997B47 /* ViewControllerUtils.m in Sources */, 346941A2215D2EE400B5BFAD /* OWSConversationColor.m in Sources */, + B8C9689723FA1B72005F64E0 /* Fonts.swift in Sources */, 34AC0A17211B39EA00997B47 /* VideoPlayerView.swift in Sources */, 34BEDB1321C43F6A007B0EAE /* ImageEditorView.swift in Sources */, 34AC09EE211B39B100997B47 /* EditContactShareNameViewController.swift in Sources */, @@ -3692,12 +3720,14 @@ 4CBBCA6321714B4500EEB37D /* OWS110SortIdMigration.swift in Sources */, 342950832124C9750000B063 /* OWSTextView.m in Sources */, 452EC6E1205FF5DC000E787C /* Bench.swift in Sources */, + B8C9689923FA1B72005F64E0 /* Values.swift in Sources */, 34BBC85D220D19D600857249 /* ImageEditorPanGestureRecognizer.swift in Sources */, 342950882124CB0A0000B063 /* OWSSearchBar.m in Sources */, 342950822124C9750000B063 /* OWSTextField.m in Sources */, 34AC0A13211B39EA00997B47 /* DisappearingTimerConfigurationView.swift in Sources */, 4CA46F4D219CFDAA0038ABDE /* GalleryRailView.swift in Sources */, 34480B621FD0A98800BC14EF /* UIColor+OWS.m in Sources */, + B8C9689823FA1B72005F64E0 /* Gradients.swift in Sources */, 4C20B2B720CA0034001BAC90 /* ThreadViewModel.swift in Sources */, 34BBC857220C7ADA00857249 /* ImageEditorItem.swift in Sources */, 346E35BE224283B100E55D5F /* UIAlertController+OWS.swift in Sources */, @@ -3725,6 +3755,7 @@ 346129FB1FD5F31400532771 /* OWS101ExistingUsersBlockOnIdentityChange.m in Sources */, B8544E3523D5201400299F14 /* UIView+Constraints.swift in Sources */, 34AC09EA211B39B100997B47 /* ModalActivityIndicatorViewController.swift in Sources */, + B8C9689523FA1B72005F64E0 /* AppMode.swift in Sources */, 344F248D2007CCD600CFB4F4 /* DisplayableText.swift in Sources */, 450998651FD8A34D00D89EB3 /* DeviceSleepManager.swift in Sources */, 34AC09EB211B39B100997B47 /* ContactShareApprovalViewController.swift in Sources */, @@ -3742,6 +3773,7 @@ 346129FE1FD5F31400532771 /* OWS106EnsureProfileComplete.swift in Sources */, 34AC0A10211B39EA00997B47 /* TappableView.swift in Sources */, 346129F91FD5F31400532771 /* OWS104CreateRecipientIdentities.m in Sources */, + B8C9689A23FA1B95005F64E0 /* DeviceUtilities.swift in Sources */, 346129B61FD1F7E800532771 /* ProfileFetcherJob.swift in Sources */, 34AC09E9211B39B100997B47 /* OWSTableViewController.m in Sources */, 340872CE2239596100CB25B0 /* AttachmentApprovalInputAccessoryView.swift in Sources */, @@ -3810,6 +3842,7 @@ 4C948FF72146EB4800349F0D /* BlockListCache.swift in Sources */, B846365B22B7418B00AF1514 /* Identicon+ObjC.swift in Sources */, 4551DB5A205C562300C8AE75 /* Collection+OWS.swift in Sources */, + B8C9689623FA1B72005F64E0 /* Colors.swift in Sources */, 34BBC84F220B8A0100857249 /* ImageEditorCropViewController.swift in Sources */, 34AC09ED211B39B100997B47 /* ContactFieldView.swift in Sources */, B8544E3423D51EEF00299F14 /* ProfilePictureView.swift in Sources */, @@ -3869,7 +3902,6 @@ 4505C2BF1E648EA300CEBF41 /* ExperienceUpgrade.swift in Sources */, EF764C351DB67CC5000D9A87 /* UIViewController+Permissions.m in Sources */, 45CD81EF1DC030E7004C9430 /* SyncPushTokensJob.swift in Sources */, - B8BB82A0238F322400BA5194 /* Colors.swift in Sources */, 34D2CCE0206939B400CB1A14 /* DebugUIMessagesAssetLoader.m in Sources */, 4CEB78C92178EBAB00F315D2 /* OWSSessionResetJobRecord.m in Sources */, 45794E861E00620000066731 /* CallUIAdapter.swift in Sources */, @@ -3904,7 +3936,6 @@ B80C6B572384A56D00FDBC8B /* DeviceLinksVC.swift in Sources */, 34A8B3512190A40E00218A25 /* MediaAlbumCellView.swift in Sources */, 34D1F0AE1F867BFC0066283D /* OWSMessageCell.m in Sources */, - B8BB82A2238F356100BA5194 /* Values.swift in Sources */, B8BB82AB238F669C00BA5194 /* ConversationCell.swift in Sources */, 4C4AEC4520EC343B0020E72B /* DismissableTextField.swift in Sources */, 4CB5F26720F6E1E2004D1B42 /* MenuActionsViewController.swift in Sources */, @@ -3919,7 +3950,6 @@ D221A09A169C9E5E00537ABF /* main.m in Sources */, 3496957221A301A100DCFE74 /* OWSBackup.m in Sources */, B86BD08623399CEF000F5AE3 /* SeedModal.swift in Sources */, - B8BB82A9238F62FB00BA5194 /* Gradients.swift in Sources */, 34B3F87B1E8DF1700035BE1A /* ExperienceUpgradesPageViewController.swift in Sources */, 3448E1622213585C004B052E /* OnboardingBaseViewController.swift in Sources */, 34E5DC8220D8050D00C08145 /* RegistrationUtils.m in Sources */, @@ -3960,7 +3990,6 @@ 34B3F8801E8DF1700035BE1A /* InviteFlow.swift in Sources */, B85357C523A1F13800AAF6CD /* LinkDeviceVC.swift in Sources */, 457C87B82032645C008D52D6 /* DebugUINotifications.swift in Sources */, - B8544E3123D16CA500299F14 /* DeviceUtilities.swift in Sources */, 4C21D5D8223AC60F00EF8A77 /* PhotoCapture.swift in Sources */, 4C13C9F620E57BA30089A98B /* ColorPickerViewController.swift in Sources */, B8162F0522892C5F00D46544 /* FriendRequestViewDelegate.swift in Sources */, @@ -4058,7 +4087,6 @@ 340FC8AE204DAC8D007AEB0F /* OWSSoundSettingsViewController.m in Sources */, 4579431E1E7C8CE9008ED0C0 /* Pastelog.m in Sources */, 340FC8B0204DAC8D007AEB0F /* AddToBlockListViewController.m in Sources */, - B8BB82BE2394D4CE00BA5194 /* Fonts.swift in Sources */, 3496957321A301A100DCFE74 /* OWSBackupJob.m in Sources */, 340FC8B3204DAC8D007AEB0F /* AppSettingsViewController.m in Sources */, C3DFFAC823E970080058DAF8 /* OpenGroupSuggestionSheet.swift in Sources */, diff --git a/Signal/src/Loki/Components/FakeChatView.swift b/Signal/src/Loki/Components/FakeChatView.swift index 14997b9d1..583ce2a98 100644 --- a/Signal/src/Loki/Components/FakeChatView.swift +++ b/Signal/src/Loki/Components/FakeChatView.swift @@ -54,8 +54,9 @@ final class FakeChatView : UIView { bubbleView.set(.width, to: Values.fakeChatBubbleWidth) bubbleView.layer.cornerRadius = Values.fakeChatBubbleCornerRadius bubbleView.layer.shadowColor = UIColor.black.cgColor - bubbleView.layer.shadowRadius = 2 - bubbleView.layer.shadowOpacity = 0.24 + bubbleView.layer.shadowRadius = isLightMode ? 1 : 2 + bubbleView.layer.shadowOpacity = isLightMode ? 0.08 : 0.24 + bubbleView.layer.shadowOffset = CGSize.zero let backgroundColor = wasSentByCurrentUser ? Colors.fakeChatBubbleBackground : Colors.accent bubbleView.backgroundColor = backgroundColor let label = UILabel() diff --git a/Signal/src/Loki/Components/TextField.swift b/Signal/src/Loki/Components/TextField.swift index 91ba42e13..49cdb6aab 100644 --- a/Signal/src/Loki/Components/TextField.swift +++ b/Signal/src/Loki/Components/TextField.swift @@ -28,11 +28,11 @@ final class TextField : UITextField { placeholder.addAttribute(.foregroundColor, value: placeholderColor, range: NSRange(location: 0, length: placeholder.length)) attributedPlaceholder = placeholder tintColor = Colors.accent - keyboardAppearance = .dark + keyboardAppearance = isLightMode ? .light : .dark if usesDefaultHeight { set(.height, to: Values.textFieldHeight) } - layer.borderColor = Colors.border.withAlphaComponent(Values.textFieldBorderOpacity).cgColor + layer.borderColor = isLightMode ? Colors.text.cgColor : Colors.border.withAlphaComponent(Values.textFieldBorderOpacity).cgColor layer.borderWidth = Values.borderThickness layer.cornerRadius = Values.textFieldCornerRadius } diff --git a/Signal/src/Loki/Style Guide/Colors.swift b/Signal/src/Loki/Style Guide/Colors.swift deleted file mode 100644 index ee7d5c8e8..000000000 --- a/Signal/src/Loki/Style Guide/Colors.swift +++ /dev/null @@ -1,38 +0,0 @@ - -@objc extension UIColor { - - @objc convenience init(hex value: UInt) { - let red = CGFloat((value >> 16) & 0xff) / 255 - let green = CGFloat((value >> 8) & 0xff) / 255 - let blue = CGFloat((value >> 0) & 0xff) / 255 - self.init(red: red, green: green, blue: blue, alpha: 1) - } -} - -@objc(LKColors) -final class Colors : NSObject { - - @objc static let accent = UIColor(hex: 0x00F782) - @objc static let text = UIColor(hex: 0xFFFFFF) - @objc static let destructive = UIColor(hex: 0xFF453A) - @objc static let unimportant = UIColor(hex: 0xD8D8D8) - @objc static let border = UIColor(hex: 0x979797) - @objc static let cellBackground = UIColor(hex: 0x1B1B1B) - @objc static let cellSelected = UIColor(hex: 0x0C0C0C) - @objc static let navigationBarBackground = UIColor(hex: 0x161616) - @objc static let searchBarPlaceholder = UIColor(hex: 0x8E8E93) // Also used for the icons - @objc static let searchBarBackground = UIColor(red: 142 / 255, green: 142 / 255, blue: 147 / 255, alpha: 0.12) - @objc static let newConversationButtonShadow = UIColor(hex: 0x077C44) - @objc static let separator = UIColor(hex: 0x36383C) - @objc static let unimportantButtonBackground = UIColor(hex: 0x323232) - @objc static let buttonBackground = UIColor(hex: 0x1B1B1B) - @objc static let settingButtonSelected = UIColor(hex: 0x0C0C0C) - @objc static let modalBackground = UIColor(hex: 0x101011) - @objc static let modalBorder = UIColor(hex: 0x212121) - @objc static let fakeChatBubbleBackground = UIColor(hex: 0x3F4146) - @objc static let fakeChatBubbleText = UIColor(hex: 0x000000) - @objc static let composeViewBackground = UIColor(hex: 0x1B1B1B) - @objc static let composeViewTextFieldBackground = UIColor(hex: 0x141414) - @objc static let receivedMessageBackground = UIColor(hex: 0x222325) - @objc static let sentMessageBackground = UIColor(hex: 0x3F4146) -} diff --git a/Signal/src/Loki/Style Guide/Fonts.swift b/Signal/src/Loki/Style Guide/Fonts.swift deleted file mode 100644 index 7611aa3f6..000000000 --- a/Signal/src/Loki/Style Guide/Fonts.swift +++ /dev/null @@ -1,12 +0,0 @@ - -@objc(LKFonts) -final class Fonts : NSObject { - - @objc static func spaceMono(ofSize size: CGFloat) -> UIFont { - return UIFont(name: "SpaceMono-Regular", size: size)! - } - - @objc static func boldSpaceMono(ofSize size: CGFloat) -> UIFont { - return UIFont(name: "SpaceMono-Bold", size: size)! - } -} diff --git a/Signal/src/Loki/Style Guide/Gradients.swift b/Signal/src/Loki/Style Guide/Gradients.swift deleted file mode 100644 index c65be7b36..000000000 --- a/Signal/src/Loki/Style Guide/Gradients.swift +++ /dev/null @@ -1,30 +0,0 @@ - -@objc(LKGradient) -final class Gradient : NSObject { - let start: UIColor - let end: UIColor - - private override init() { preconditionFailure("Use init(start:end:) instead.") } - - @objc init(start: UIColor, end: UIColor) { - self.start = start - self.end = end - super.init() - } -} - -@objc extension UIView { - - @objc func setGradient(_ gradient: Gradient) { - let layer = CAGradientLayer() - layer.frame = UIScreen.main.bounds - layer.colors = [ gradient.start.cgColor, gradient.end.cgColor ] - self.layer.insertSublayer(layer, at: 0) - } -} - -@objc(LKGradients) -final class Gradients : NSObject { - - @objc static let defaultLokiBackground = Gradient(start: UIColor(hex: 0x171717), end: UIColor(hex:0x121212)) -} diff --git a/Signal/src/Loki/Style Guide/Values.swift b/Signal/src/Loki/Style Guide/Values.swift deleted file mode 100644 index 587f55a10..000000000 --- a/Signal/src/Loki/Style Guide/Values.swift +++ /dev/null @@ -1,64 +0,0 @@ - -@objc(LKValues) -final class Values : NSObject { - - // MARK: - Alpha Values - @objc static let unimportantElementOpacity = CGFloat(0.6) - @objc static let conversationCellTimestampOpacity = CGFloat(0.4) - @objc static let textFieldBorderOpacity = CGFloat(0.4) - @objc static let modalBackgroundOpacity = CGFloat(0.75) - @objc static let composeViewTextFieldBorderOpacity = CGFloat(0.12) - @objc static let composeViewTextFieldPlaceholderOpacity = CGFloat(0.4) - - // MARK: - Font Sizes - @objc static let verySmallFontSize = CGFloat(10) - @objc static let smallFontSize = CGFloat(13) - @objc static let mediumFontSize = CGFloat(15) - @objc static let largeFontSize = CGFloat(20) - @objc static let veryLargeFontSize = CGFloat(25) - @objc static let massiveFontSize = CGFloat(50) - - // MARK: - Element Sizes - @objc static let smallButtonHeight = isSmallScreen ? CGFloat(24) : CGFloat(27) - @objc static let mediumButtonHeight = isSmallScreen ? CGFloat(30) : CGFloat(34) - @objc static let largeButtonHeight = isSmallScreen ? CGFloat(40) : CGFloat(45) - @objc static let accentLineThickness = CGFloat(4) - @objc static let verySmallProfilePictureSize = CGFloat(26) - @objc static let smallProfilePictureSize = CGFloat(35) - @objc static let mediumProfilePictureSize = CGFloat(45) - @objc static let largeProfilePictureSize = CGFloat(75) - @objc static let borderThickness = CGFloat(1) - @objc static let conversationCellStatusIndicatorSize = CGFloat(14) - @objc static let searchBarHeight = CGFloat(36) - @objc static let newConversationButtonSize = CGFloat(45) - @objc static let textFieldHeight = isSmallScreen ? CGFloat(48) : CGFloat(80) - @objc static let textFieldCornerRadius = CGFloat(8) - @objc static let separatorLabelHeight = CGFloat(24) - @objc static var separatorThickness: CGFloat { return 1 / UIScreen.main.scale } - @objc static let tabBarHeight = isSmallScreen ? CGFloat(32) : CGFloat(48) - @objc static let settingButtonHeight = isSmallScreen ? CGFloat(52) : CGFloat(75) - @objc static let modalCornerRadius = CGFloat(10) - @objc static let modalButtonCornerRadius = CGFloat(5) - @objc static let fakeChatBubbleWidth = CGFloat(224) - @objc static let fakeChatBubbleCornerRadius = CGFloat(10) - @objc static let fakeChatViewHeight = CGFloat(234) - @objc static let composeViewTextFieldBorderThickness = 1 / UIScreen.main.scale - @objc static let messageBubbleCornerRadius: CGFloat = 10 - @objc static let progressBarThickness: CGFloat = 2 - - // MARK: - Distances - @objc static let verySmallSpacing = CGFloat(4) - @objc static let smallSpacing = CGFloat(8) - @objc static let mediumSpacing = CGFloat(16) - @objc static let largeSpacing = CGFloat(24) - @objc static let veryLargeSpacing = CGFloat(35) - @objc static let massiveSpacing = CGFloat(64) - @objc static let newConversationButtonBottomOffset = CGFloat(52) - @objc static let onboardingButtonBottomOffset = isSmallScreen ? CGFloat(52) : CGFloat(72) - - // MARK: - Animation Values - @objc static let fakeChatStartDelay: TimeInterval = 1.5 - @objc static let fakeChatAnimationDuration: TimeInterval = 0.4 - @objc static let fakeChatDelay: TimeInterval = 2 - @objc static let fakeChatMessagePopAnimationStartScale: CGFloat = 0.6 -} diff --git a/Signal/src/Loki/View Controllers/DisplayNameVC.swift b/Signal/src/Loki/View Controllers/DisplayNameVC.swift index 264a5fd3d..c6410823f 100644 --- a/Signal/src/Loki/View Controllers/DisplayNameVC.swift +++ b/Signal/src/Loki/View Controllers/DisplayNameVC.swift @@ -13,7 +13,7 @@ final class DisplayNameVC : UIViewController { }() // MARK: Settings - override var preferredStatusBarStyle: UIStatusBarStyle { return .lightContent } + override var preferredStatusBarStyle: UIStatusBarStyle { return isLightMode ? .default : .lightContent } // MARK: Lifecycle override func viewDidLoad() { diff --git a/Signal/src/Loki/View Controllers/HomeVC.swift b/Signal/src/Loki/View Controllers/HomeVC.swift index c4498d2a9..54605a3cd 100644 --- a/Signal/src/Loki/View Controllers/HomeVC.swift +++ b/Signal/src/Loki/View Controllers/HomeVC.swift @@ -20,7 +20,7 @@ final class HomeVC : UIViewController, UITableViewDataSource, UITableViewDelegat private let editingDatabaseConnection = OWSPrimaryStorage.shared().newDatabaseConnection() // MARK: Settings - override var preferredStatusBarStyle: UIStatusBarStyle { return .lightContent } + override var preferredStatusBarStyle: UIStatusBarStyle { return isLightMode ? .default : .lightContent } // MARK: Components private lazy var seedReminderView: SeedReminderView = { diff --git a/Signal/src/Loki/View Controllers/JoinPublicChatVC.swift b/Signal/src/Loki/View Controllers/JoinPublicChatVC.swift index 6c8801304..a9562c48b 100644 --- a/Signal/src/Loki/View Controllers/JoinPublicChatVC.swift +++ b/Signal/src/Loki/View Controllers/JoinPublicChatVC.swift @@ -6,7 +6,7 @@ final class JoinPublicChatVC : UIViewController, UIPageViewControllerDataSource, private var targetVCIndex: Int? // MARK: Settings - override var preferredStatusBarStyle: UIStatusBarStyle { return .lightContent } + override var preferredStatusBarStyle: UIStatusBarStyle { return isLightMode ? .default : .lightContent } // MARK: Components private lazy var tabBar: TabBar = { diff --git a/Signal/src/Loki/View Controllers/LandingVC.swift b/Signal/src/Loki/View Controllers/LandingVC.swift index 3369edc3c..e3b4667af 100644 --- a/Signal/src/Loki/View Controllers/LandingVC.swift +++ b/Signal/src/Loki/View Controllers/LandingVC.swift @@ -34,7 +34,7 @@ final class LandingVC : UIViewController, LinkDeviceVCDelegate, DeviceLinkingMod }() // MARK: Settings - override var preferredStatusBarStyle: UIStatusBarStyle { return .lightContent } + override var preferredStatusBarStyle: UIStatusBarStyle { return isLightMode ? .default : .lightContent } // MARK: Lifecycle override func viewDidLoad() { diff --git a/Signal/src/Loki/View Controllers/LinkDeviceVC.swift b/Signal/src/Loki/View Controllers/LinkDeviceVC.swift index 888866bb8..9c4397247 100644 --- a/Signal/src/Loki/View Controllers/LinkDeviceVC.swift +++ b/Signal/src/Loki/View Controllers/LinkDeviceVC.swift @@ -6,7 +6,7 @@ final class LinkDeviceVC : UIViewController, UIPageViewControllerDataSource, UIP var delegate: LinkDeviceVCDelegate? // MARK: Settings - override var preferredStatusBarStyle: UIStatusBarStyle { return .lightContent } + override var preferredStatusBarStyle: UIStatusBarStyle { return isLightMode ? .default : .lightContent } // MARK: Components private lazy var tabBar: TabBar = { diff --git a/Signal/src/Loki/View Controllers/Modal.swift b/Signal/src/Loki/View Controllers/Modal.swift index e69a28049..3aeba387d 100644 --- a/Signal/src/Loki/View Controllers/Modal.swift +++ b/Signal/src/Loki/View Controllers/Modal.swift @@ -4,7 +4,7 @@ class Modal : UIViewController { private(set) var verticalCenteringConstraint: NSLayoutConstraint! // MARK: Settings - override var preferredStatusBarStyle: UIStatusBarStyle { return .lightContent } + override var preferredStatusBarStyle: UIStatusBarStyle { return isLightMode ? .default : .lightContent } // MARK: Components lazy var contentView: UIView = { diff --git a/Signal/src/Loki/View Controllers/NewPrivateChatVC.swift b/Signal/src/Loki/View Controllers/NewPrivateChatVC.swift index 9fccf24f8..872cc58a1 100644 --- a/Signal/src/Loki/View Controllers/NewPrivateChatVC.swift +++ b/Signal/src/Loki/View Controllers/NewPrivateChatVC.swift @@ -5,7 +5,7 @@ final class NewPrivateChatVC : UIViewController, UIPageViewControllerDataSource, private var targetVCIndex: Int? // MARK: Settings - override var preferredStatusBarStyle: UIStatusBarStyle { return .lightContent } + override var preferredStatusBarStyle: UIStatusBarStyle { return isLightMode ? .default : .lightContent } // MARK: Components private lazy var tabBar: TabBar = { diff --git a/Signal/src/Loki/View Controllers/QRCodeVC.swift b/Signal/src/Loki/View Controllers/QRCodeVC.swift index cf11b829c..fe93f6b6e 100644 --- a/Signal/src/Loki/View Controllers/QRCodeVC.swift +++ b/Signal/src/Loki/View Controllers/QRCodeVC.swift @@ -6,7 +6,7 @@ final class QRCodeVC : UIViewController, UIPageViewControllerDataSource, UIPageV private var tabBarTopConstraint: NSLayoutConstraint! // MARK: Settings - override var preferredStatusBarStyle: UIStatusBarStyle { return .lightContent } + override var preferredStatusBarStyle: UIStatusBarStyle { return isLightMode ? .default : .lightContent } // MARK: Components private lazy var tabBar: TabBar = { diff --git a/Signal/src/Loki/View Controllers/RegisterVC.swift b/Signal/src/Loki/View Controllers/RegisterVC.swift index 217c05a65..a402c9ad1 100644 --- a/Signal/src/Loki/View Controllers/RegisterVC.swift +++ b/Signal/src/Loki/View Controllers/RegisterVC.swift @@ -38,7 +38,7 @@ final class RegisterVC : UIViewController { }() // MARK: Settings - override var preferredStatusBarStyle: UIStatusBarStyle { return .lightContent } + override var preferredStatusBarStyle: UIStatusBarStyle { return isLightMode ? .default : .lightContent } // MARK: Lifecycle override func viewDidLoad() { diff --git a/Signal/src/Loki/View Controllers/RestoreVC.swift b/Signal/src/Loki/View Controllers/RestoreVC.swift index 79b00667a..9de95efb7 100644 --- a/Signal/src/Loki/View Controllers/RestoreVC.swift +++ b/Signal/src/Loki/View Controllers/RestoreVC.swift @@ -30,7 +30,7 @@ final class RestoreVC : UIViewController { }() // MARK: Settings - override var preferredStatusBarStyle: UIStatusBarStyle { return .lightContent } + override var preferredStatusBarStyle: UIStatusBarStyle { return isLightMode ? .default : .lightContent } // MARK: Lifecycle override func viewDidLoad() { diff --git a/Signal/src/Loki/View Controllers/SeedVC.swift b/Signal/src/Loki/View Controllers/SeedVC.swift index a07518575..40d09c675 100644 --- a/Signal/src/Loki/View Controllers/SeedVC.swift +++ b/Signal/src/Loki/View Controllers/SeedVC.swift @@ -53,7 +53,7 @@ final class SeedVC : UIViewController { }() // MARK: Settings - override var preferredStatusBarStyle: UIStatusBarStyle { return .lightContent } + override var preferredStatusBarStyle: UIStatusBarStyle { return isLightMode ? .default : .lightContent } // MARK: Lifecycle override func viewDidLoad() { diff --git a/Signal/src/Loki/View Controllers/SettingsVC.swift b/Signal/src/Loki/View Controllers/SettingsVC.swift index 4e92331db..78fa75ae4 100644 --- a/Signal/src/Loki/View Controllers/SettingsVC.swift +++ b/Signal/src/Loki/View Controllers/SettingsVC.swift @@ -13,7 +13,7 @@ final class SettingsVC : UIViewController, AvatarViewHelperDelegate { }() // MARK: Settings - override var preferredStatusBarStyle: UIStatusBarStyle { return .lightContent } + override var preferredStatusBarStyle: UIStatusBarStyle { return isLightMode ? .default : .lightContent } // MARK: Components private lazy var profilePictureView: ProfilePictureView = { diff --git a/Signal/src/Loki/View Controllers/Sheet.swift b/Signal/src/Loki/View Controllers/Sheet.swift index b7c96713d..33d3ba304 100644 --- a/Signal/src/Loki/View Controllers/Sheet.swift +++ b/Signal/src/Loki/View Controllers/Sheet.swift @@ -4,7 +4,7 @@ class Sheet : UIViewController { // MARK: Settings let overshoot: CGFloat = 40 - override var preferredStatusBarStyle: UIStatusBarStyle { return .lightContent } + override var preferredStatusBarStyle: UIStatusBarStyle { return isLightMode ? .default : .lightContent } // MARK: Components lazy var contentView: UIView = { diff --git a/SignalMessaging/Loki/ProfilePictureView.swift b/SignalMessaging/Loki/Redesign/Components/ProfilePictureView.swift similarity index 100% rename from SignalMessaging/Loki/ProfilePictureView.swift rename to SignalMessaging/Loki/Redesign/Components/ProfilePictureView.swift diff --git a/SignalMessaging/Loki/Redesign/Style Guide/AppMode.swift b/SignalMessaging/Loki/Redesign/Style Guide/AppMode.swift new file mode 100644 index 000000000..bfa332a6f --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/AppMode.swift @@ -0,0 +1,10 @@ + +public enum AppMode { + case light, dark + + public static var current: AppMode = .light +} + +public var isLightMode: Bool { + return AppMode.current == .light +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.swift b/SignalMessaging/Loki/Redesign/Style Guide/Colors.swift new file mode 100644 index 000000000..65e6bc6b5 --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.swift @@ -0,0 +1,38 @@ + +@objc public extension UIColor { + + @objc public convenience init(hex value: UInt) { + let red = CGFloat((value >> 16) & 0xff) / 255 + let green = CGFloat((value >> 8) & 0xff) / 255 + let blue = CGFloat((value >> 0) & 0xff) / 255 + self.init(red: red, green: green, blue: blue, alpha: 1) + } +} + +@objc(LKColors) +public final class Colors : NSObject { + + @objc public static var accent = isLightMode ? UIColor(hex: 0x00E97B) : UIColor(hex: 0x00F782) + @objc public static var text = isLightMode ? UIColor(hex: 0x000000) : UIColor(hex: 0xFFFFFF) + @objc public static var destructive = UIColor(hex: 0xFF453A) + @objc public static var unimportant = UIColor(hex: 0xD8D8D8) + @objc public static var border = UIColor(hex: 0x979797) + @objc public static var cellBackground = isLightMode ? UIColor(hex: 0xFCFCFC) : UIColor(hex: 0x1B1B1B) + @objc public static var cellSelected = isLightMode ? UIColor(hex: 0xDFDFDF) : UIColor(hex: 0x0C0C0C) + @objc public static var navigationBarBackground = isLightMode ? UIColor(hex: 0xFCFCFC) : UIColor(hex: 0x161616) + @objc public static var searchBarPlaceholder = UIColor(hex: 0x8E8E93) // Also used for the icons + @objc public static var searchBarBackground = UIColor(red: 142 / 255, green: 142 / 255, blue: 147 / 255, alpha: 0.12) + @objc public static var newConversationButtonShadow = UIColor(hex: 0x077C44) + @objc public static var separator = UIColor(hex: 0x36383C) + @objc public static var unimportantButtonBackground = UIColor(hex: 0x323232) + @objc public static var buttonBackground = UIColor(hex: 0x1B1B1B) + @objc public static var settingButtonSelected = UIColor(hex: 0x0C0C0C) + @objc public static var modalBackground = UIColor(hex: 0x101011) + @objc public static var modalBorder = UIColor(hex: 0x212121) + @objc public static var fakeChatBubbleBackground = isLightMode ? UIColor(hex: 0xFAFAFA) : UIColor(hex: 0x3F4146) + @objc public static var fakeChatBubbleText = UIColor(hex: 0x000000) + @objc public static var composeViewBackground = UIColor(hex: 0x1B1B1B) + @objc public static var composeViewTextFieldBackground = UIColor(hex: 0x141414) + @objc public static var receivedMessageBackground = UIColor(hex: 0x222325) + @objc public static var sentMessageBackground = UIColor(hex: 0x3F4146) +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Fonts.swift b/SignalMessaging/Loki/Redesign/Style Guide/Fonts.swift new file mode 100644 index 000000000..34e66a477 --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Fonts.swift @@ -0,0 +1,12 @@ + +@objc(LKFonts) +public final class Fonts : NSObject { + + @objc public static func spaceMono(ofSize size: CGFloat) -> UIFont { + return UIFont(name: "SpaceMono-Regular", size: size)! + } + + @objc public static func boldSpaceMono(ofSize size: CGFloat) -> UIFont { + return UIFont(name: "SpaceMono-Bold", size: size)! + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Gradients.swift b/SignalMessaging/Loki/Redesign/Style Guide/Gradients.swift new file mode 100644 index 000000000..63d4f7384 --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Gradients.swift @@ -0,0 +1,35 @@ + +@objc(LKGradient) +public final class Gradient : NSObject { + public let start: UIColor + public let end: UIColor + + private override init() { preconditionFailure("Use init(start:end:) instead.") } + + @objc public init(start: UIColor, end: UIColor) { + self.start = start + self.end = end + super.init() + } +} + +@objc public extension UIView { + + @objc public func setGradient(_ gradient: Gradient) { + let layer = CAGradientLayer() + layer.frame = UIScreen.main.bounds + layer.colors = [ gradient.start.cgColor, gradient.end.cgColor ] + self.layer.insertSublayer(layer, at: 0) + } +} + +@objc(LKGradients) +final public class Gradients : NSObject { + + @objc public static var defaultLokiBackground: Gradient { + switch AppMode.current { + case .light: return Gradient(start: UIColor(hex: 0xFCFCFC), end: UIColor(hex: 0xFFFFFF)) + case .dark: return Gradient(start: UIColor(hex: 0x171717), end: UIColor(hex: 0x121212)) + } + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Values.swift b/SignalMessaging/Loki/Redesign/Style Guide/Values.swift new file mode 100644 index 000000000..8bea9223c --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Values.swift @@ -0,0 +1,64 @@ + +@objc(LKValues) +public final class Values : NSObject { + + // MARK: - Alpha Values + @objc public static let unimportantElementOpacity = CGFloat(0.6) + @objc public static let conversationCellTimestampOpacity = CGFloat(0.4) + @objc public static let textFieldBorderOpacity = CGFloat(0.4) + @objc public static let modalBackgroundOpacity = CGFloat(0.75) + @objc public static let composeViewTextFieldBorderOpacity = CGFloat(0.12) + @objc public static let composeViewTextFieldPlaceholderOpacity = CGFloat(0.4) + + // MARK: - Font Sizes + @objc public static let verySmallFontSize = CGFloat(10) + @objc public static let smallFontSize = CGFloat(13) + @objc public static let mediumFontSize = CGFloat(15) + @objc public static let largeFontSize = CGFloat(20) + @objc public static let veryLargeFontSize = CGFloat(25) + @objc public static let massiveFontSize = CGFloat(50) + + // MARK: - Element Sizes + @objc public static let smallButtonHeight = isSmallScreen ? CGFloat(24) : CGFloat(27) + @objc public static let mediumButtonHeight = isSmallScreen ? CGFloat(30) : CGFloat(34) + @objc public static let largeButtonHeight = isSmallScreen ? CGFloat(40) : CGFloat(45) + @objc public static let accentLineThickness = CGFloat(4) + @objc public static let verySmallProfilePictureSize = CGFloat(26) + @objc public static let smallProfilePictureSize = CGFloat(35) + @objc public static let mediumProfilePictureSize = CGFloat(45) + @objc public static let largeProfilePictureSize = CGFloat(75) + @objc public static let borderThickness = CGFloat(1) + @objc public static let conversationCellStatusIndicatorSize = CGFloat(14) + @objc public static let searchBarHeight = CGFloat(36) + @objc public static let newConversationButtonSize = CGFloat(45) + @objc public static let textFieldHeight = isSmallScreen ? CGFloat(48) : CGFloat(80) + @objc public static let textFieldCornerRadius = CGFloat(8) + @objc public static let separatorLabelHeight = CGFloat(24) + @objc public static var separatorThickness: CGFloat { return 1 / UIScreen.main.scale } + @objc public static let tabBarHeight = isSmallScreen ? CGFloat(32) : CGFloat(48) + @objc public static let settingButtonHeight = isSmallScreen ? CGFloat(52) : CGFloat(75) + @objc public static let modalCornerRadius = CGFloat(10) + @objc public static let modalButtonCornerRadius = CGFloat(5) + @objc public static let fakeChatBubbleWidth = CGFloat(224) + @objc public static let fakeChatBubbleCornerRadius = CGFloat(10) + @objc public static let fakeChatViewHeight = CGFloat(234) + @objc public static let composeViewTextFieldBorderThickness = 1 / UIScreen.main.scale + @objc public static let messageBubbleCornerRadius: CGFloat = 10 + @objc public static let progressBarThickness: CGFloat = 2 + + // MARK: - Distances + @objc public static let verySmallSpacing = CGFloat(4) + @objc public static let smallSpacing = CGFloat(8) + @objc public static let mediumSpacing = CGFloat(16) + @objc public static let largeSpacing = CGFloat(24) + @objc public static let veryLargeSpacing = CGFloat(35) + @objc public static let massiveSpacing = CGFloat(64) + @objc public static let newConversationButtonBottomOffset = CGFloat(52) + @objc public static let onboardingButtonBottomOffset = isSmallScreen ? CGFloat(52) : CGFloat(72) + + // MARK: - Animation Values + @objc public static let fakeChatStartDelay: TimeInterval = 1.5 + @objc public static let fakeChatAnimationDuration: TimeInterval = 0.4 + @objc public static let fakeChatDelay: TimeInterval = 2 + @objc public static let fakeChatMessagePopAnimationStartScale: CGFloat = 0.6 +} diff --git a/Signal/src/Loki/Utilities/DeviceUtilities.swift b/SignalMessaging/Loki/Redesign/Utilities/DeviceUtilities.swift similarity index 62% rename from Signal/src/Loki/Utilities/DeviceUtilities.swift rename to SignalMessaging/Loki/Redesign/Utilities/DeviceUtilities.swift index d011c2541..077efaf29 100644 --- a/Signal/src/Loki/Utilities/DeviceUtilities.swift +++ b/SignalMessaging/Loki/Redesign/Utilities/DeviceUtilities.swift @@ -1,4 +1,4 @@ -var isSmallScreen: Bool { +public var isSmallScreen: Bool { return (UIScreen.main.bounds.height - 568) < 1 } diff --git a/SignalMessaging/Loki/UIView+Constraints.swift b/SignalMessaging/Loki/Redesign/Utilities/UIView+Constraints.swift similarity index 100% rename from SignalMessaging/Loki/UIView+Constraints.swift rename to SignalMessaging/Loki/Redesign/Utilities/UIView+Constraints.swift diff --git a/SignalMessaging/Views/OWSNavigationBar.swift b/SignalMessaging/Views/OWSNavigationBar.swift index 3043d220e..77a704112 100644 --- a/SignalMessaging/Views/OWSNavigationBar.swift +++ b/SignalMessaging/Views/OWSNavigationBar.swift @@ -75,9 +75,9 @@ public class OWSNavigationBar: UINavigationBar { return } - backgroundColor = UIColor(rgbHex: 0x161616) // Colors.navigationBarBackground + backgroundColor = Colors.navigationBarBackground - tintColor = UIColor(rgbHex: 0xFFFFFF) // Colors.text + tintColor = Colors.text if UIAccessibility.isReduceTransparencyEnabled { blurEffectView?.isHidden = true