From 0eff43e1d1f540b66afd410737e582a7c082b751 Mon Sep 17 00:00:00 2001 From: CMK Date: Wed, 14 Apr 2021 15:24:54 +0800 Subject: [PATCH] feat: update compose scene UI appearance --- Localization/app.json | 6 ++- .../xcschemes/xcschememanagement.plist | 2 +- .../Section/ComposeStatusSection.swift | 16 ++++-- .../Diffiable/Section/StatusSection.swift | 2 +- Mastodon/Generated/Assets.swift | 42 ++++++++------- Mastodon/Generated/Strings.swift | 8 +++ .../Banner => Scene/Compose}/Contents.json | 0 .../Compose/background.colorset/Contents.json | 38 +++++++++++++ .../toolbar.background.colorset/Contents.json | 38 +++++++++++++ .../{Profile => Scene}/Contents.json | 0 .../Profile/Banner}/Contents.json | 0 .../Contents.json | 0 .../Contents.json | 0 .../username.gray.colorset/Contents.json | 0 .../Profile}/Contents.json | 0 .../Scene/Welcome/Contents.json | 9 ++++ .../Scene/Welcome/illustration/Contents.json | 9 ++++ .../background.cyan.colorset/Contents.json | 0 .../cloud.base.imageset/Contents.json | 0 .../untitled10007Group61.png | Bin .../untitled10007Group61@2x.png | Bin .../untitled10007Group61@3x.png | Bin .../Contents.json | 0 .../untitled10006Group21.png | Bin .../untitled10006Group21@2x.png | Bin .../untitled10006Group21@3x.png | Bin .../Contents.json | 0 .../untitled10003Group11.png | Bin .../untitled10003Group11@2x.png | Bin .../untitled10003Group11@3x.png | Bin .../Contents.json | 0 .../untitled10005Group101.png | Bin .../untitled10005Group101@2x.png | Bin .../untitled10005Group101@3x.png | Bin .../Contents.json | 0 .../untitled10004Group111.png | Bin .../untitled10004Group111@2x.png | Bin .../untitled10004Group111@3x.png | Bin .../Contents.json | 0 .../mastodon.logo.black.pdf | 0 .../Contents.json | 0 .../mastodon.logo.black.large.pdf | 0 .../mastodon.logo.imageset/Contents.json | 0 .../mastodon.logo.imageset/logotypeFull1.pdf | 0 .../Contents.json | 0 .../logotypeFull1.large.pdf | Bin .../Resources/en.lproj/Localizable.strings | 2 + ...iedToStatusContentCollectionViewCell.swift | 25 +++++++++ .../Scene/Compose/ComposeViewController.swift | 46 +++++++++------- Mastodon/Scene/Compose/ComposeViewModel.swift | 1 + .../Compose/View/ComposeToolbarView.swift | 50 +++++++++++++++--- .../View/WelcomeIllustrationView.swift | 12 ++--- .../Welcome/WelcomeViewController.swift | 2 +- .../Header/View/ProfileHeaderView.swift | 8 +-- .../Scene/Share/View/Content/StatusView.swift | 4 +- 55 files changed, 257 insertions(+), 63 deletions(-) rename Mastodon/Resources/Assets.xcassets/{Profile/Banner => Scene/Compose}/Contents.json (100%) create mode 100644 Mastodon/Resources/Assets.xcassets/Scene/Compose/background.colorset/Contents.json create mode 100644 Mastodon/Resources/Assets.xcassets/Scene/Compose/toolbar.background.colorset/Contents.json rename Mastodon/Resources/Assets.xcassets/{Profile => Scene}/Contents.json (100%) rename Mastodon/Resources/Assets.xcassets/{Welcome => Scene/Profile/Banner}/Contents.json (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Profile/Banner/bio.edit.background.gray.colorset/Contents.json (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Profile/Banner/name.edit.background.gray.colorset/Contents.json (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Profile/Banner/username.gray.colorset/Contents.json (100%) rename Mastodon/Resources/Assets.xcassets/{Welcome/illustration => Scene/Profile}/Contents.json (100%) create mode 100644 Mastodon/Resources/Assets.xcassets/Scene/Welcome/Contents.json create mode 100644 Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/Contents.json rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Welcome/illustration/background.cyan.colorset/Contents.json (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Welcome/illustration/cloud.base.imageset/Contents.json (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Welcome/illustration/cloud.base.imageset/untitled10007Group61.png (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Welcome/illustration/cloud.base.imageset/untitled10007Group61@2x.png (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Welcome/illustration/cloud.base.imageset/untitled10007Group61@3x.png (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Welcome/illustration/elephant.on.airplane.with.contrail.imageset/Contents.json (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Welcome/illustration/elephant.on.airplane.with.contrail.imageset/untitled10006Group21.png (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Welcome/illustration/elephant.on.airplane.with.contrail.imageset/untitled10006Group21@2x.png (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Welcome/illustration/elephant.on.airplane.with.contrail.imageset/untitled10006Group21@3x.png (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Welcome/illustration/elephant.three.on.grass.imageset/Contents.json (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Welcome/illustration/elephant.three.on.grass.imageset/untitled10003Group11.png (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Welcome/illustration/elephant.three.on.grass.imageset/untitled10003Group11@2x.png (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Welcome/illustration/elephant.three.on.grass.imageset/untitled10003Group11@3x.png (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Welcome/illustration/elephant.three.on.grass.with.tree.three.imageset/Contents.json (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Welcome/illustration/elephant.three.on.grass.with.tree.three.imageset/untitled10005Group101.png (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Welcome/illustration/elephant.three.on.grass.with.tree.three.imageset/untitled10005Group101@2x.png (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Welcome/illustration/elephant.three.on.grass.with.tree.three.imageset/untitled10005Group101@3x.png (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Welcome/illustration/elephant.three.on.grass.with.tree.two.imageset/Contents.json (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Welcome/illustration/elephant.three.on.grass.with.tree.two.imageset/untitled10004Group111.png (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Welcome/illustration/elephant.three.on.grass.with.tree.two.imageset/untitled10004Group111@2x.png (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Welcome/illustration/elephant.three.on.grass.with.tree.two.imageset/untitled10004Group111@3x.png (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Welcome/mastodon.logo.black.imageset/Contents.json (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Welcome/mastodon.logo.black.imageset/mastodon.logo.black.pdf (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Welcome/mastodon.logo.black.large.imageset/Contents.json (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Welcome/mastodon.logo.black.large.imageset/mastodon.logo.black.large.pdf (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Welcome/mastodon.logo.imageset/Contents.json (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Welcome/mastodon.logo.imageset/logotypeFull1.pdf (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Welcome/mastodon.logo.large.imageset/Contents.json (100%) rename Mastodon/Resources/Assets.xcassets/{ => Scene}/Welcome/mastodon.logo.large.imageset/logotypeFull1.large.pdf (100%) diff --git a/Localization/app.json b/Localization/app.json index 08a70feb3..5d8ad2645 100644 --- a/Localization/app.json +++ b/Localization/app.json @@ -240,6 +240,7 @@ }, "content_input_placeholder": "Type or paste what's on your mind", "compose_action": "Publish", + "replying_to_user": "replying to %s", "attachment": { "photo": "photo", "video": "video", @@ -254,7 +255,8 @@ "six_hours": "6 Hours", "one_day": "1 Day", "three_days": "3 Days", - "seven_days": "7 Days" + "seven_days": "7 Days", + "option_number": "Option %ld" }, "content_warning": { "placeholder": "Write an accurate warning here..." @@ -336,4 +338,4 @@ } } } -} +} \ No newline at end of file diff --git a/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist b/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist index 6ec23cf5d..fd1ce69a1 100644 --- a/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist @@ -7,7 +7,7 @@ CoreDataStack.xcscheme_^#shared#^_ orderHint - 10 + 20 Mastodon - RTL.xcscheme_^#shared#^_ diff --git a/Mastodon/Diffiable/Section/ComposeStatusSection.swift b/Mastodon/Diffiable/Section/ComposeStatusSection.swift index 56aa32798..c8a8bc180 100644 --- a/Mastodon/Diffiable/Section/ComposeStatusSection.swift +++ b/Mastodon/Diffiable/Section/ComposeStatusSection.swift @@ -50,8 +50,15 @@ extension ComposeStatusSection { weak composeStatusPollExpiresOptionCollectionViewCellDelegate ] collectionView, indexPath, item -> UICollectionViewCell? in switch item { - case .replyTo(let repliedToStatusObjectID): + case .replyTo(let replyToStatusObjectID): let cell = collectionView.dequeueReusableCell(withReuseIdentifier: String(describing: ComposeRepliedToStatusContentCollectionViewCell.self), for: indexPath) as! ComposeRepliedToStatusContentCollectionViewCell + managedObjectContext.perform { + guard let replyTo = managedObjectContext.object(with: replyToStatusObjectID) as? Status else { + return + } + let status = replyTo.reblog ?? replyTo + cell.statusView.configure(with: AvatarConfigurableViewConfiguration(avatarImageURL: status.author.avatarImageURL())) + } return cell case .input(let replyToStatusObjectID, let attribute): let cell = collectionView.dequeueReusableCell(withReuseIdentifier: String(describing: ComposeStatusContentCollectionViewCell.self), for: indexPath) as! ComposeStatusContentCollectionViewCell @@ -63,9 +70,10 @@ extension ComposeStatusSection { return } cell.statusView.headerContainerStackView.isHidden = false - cell.statusView.headerInfoLabel.text = "[TODO] \(replyTo.author.displayName)" + cell.statusView.headerIconLabel.attributedText = StatusView.iconAttributedString(image: StatusView.replyIconImage) + cell.statusView.headerInfoLabel.text = L10n.Scene.Compose.replyingToUser(replyTo.author.displayNameWithFallback) } - ComposeStatusSection.configure(cell: cell, attribute: attribute) + ComposeStatusSection.configureStatusContent(cell: cell, attribute: attribute) cell.textEditorView.textAttributesDelegate = textEditorViewTextAttributesDelegate cell.composeContent .removeDuplicates() @@ -196,7 +204,7 @@ extension ComposeStatusSection { extension ComposeStatusSection { - static func configure( + static func configureStatusContent( cell: ComposeStatusContentCollectionViewCell, attribute: ComposeStatusItem.ComposeStatusAttribute ) { diff --git a/Mastodon/Diffiable/Section/StatusSection.swift b/Mastodon/Diffiable/Section/StatusSection.swift index d0f93921a..36d4853a8 100644 --- a/Mastodon/Diffiable/Section/StatusSection.swift +++ b/Mastodon/Diffiable/Section/StatusSection.swift @@ -393,7 +393,7 @@ extension StatusSection { ) { if status.reblog != nil { cell.statusView.headerContainerStackView.isHidden = false - cell.statusView.headerIconLabel.attributedText = StatusView.iconAttributedString(image: StatusView.boostIconImage) + cell.statusView.headerIconLabel.attributedText = StatusView.iconAttributedString(image: StatusView.reblogIconImage) cell.statusView.headerInfoLabel.text = { let author = status.author let name = author.displayName.isEmpty ? author.username : author.displayName diff --git a/Mastodon/Generated/Assets.swift b/Mastodon/Generated/Assets.swift index 843fce02c..52efbda77 100644 --- a/Mastodon/Generated/Assets.swift +++ b/Mastodon/Generated/Assets.swift @@ -91,26 +91,32 @@ internal enum Asset { internal enum Connectivity { internal static let photoFillSplit = ImageAsset(name: "Connectivity/photo.fill.split") } - internal enum Profile { - internal enum Banner { - internal static let bioEditBackgroundGray = ColorAsset(name: "Profile/Banner/bio.edit.background.gray") - internal static let nameEditBackgroundGray = ColorAsset(name: "Profile/Banner/name.edit.background.gray") - internal static let usernameGray = ColorAsset(name: "Profile/Banner/username.gray") + internal enum Scene { + internal enum Compose { + internal static let background = ColorAsset(name: "Scene/Compose/background") + internal static let toolbarBackground = ColorAsset(name: "Scene/Compose/toolbar.background") } - } - internal enum Welcome { - internal enum Illustration { - internal static let backgroundCyan = ColorAsset(name: "Welcome/illustration/background.cyan") - internal static let cloudBase = ImageAsset(name: "Welcome/illustration/cloud.base") - internal static let elephantOnAirplaneWithContrail = ImageAsset(name: "Welcome/illustration/elephant.on.airplane.with.contrail") - internal static let elephantThreeOnGrass = ImageAsset(name: "Welcome/illustration/elephant.three.on.grass") - internal static let elephantThreeOnGrassWithTreeThree = ImageAsset(name: "Welcome/illustration/elephant.three.on.grass.with.tree.three") - internal static let elephantThreeOnGrassWithTreeTwo = ImageAsset(name: "Welcome/illustration/elephant.three.on.grass.with.tree.two") + internal enum Profile { + internal enum Banner { + internal static let bioEditBackgroundGray = ColorAsset(name: "Scene/Profile/Banner/bio.edit.background.gray") + internal static let nameEditBackgroundGray = ColorAsset(name: "Scene/Profile/Banner/name.edit.background.gray") + internal static let usernameGray = ColorAsset(name: "Scene/Profile/Banner/username.gray") + } + } + internal enum Welcome { + internal enum Illustration { + internal static let backgroundCyan = ColorAsset(name: "Scene/Welcome/illustration/background.cyan") + internal static let cloudBase = ImageAsset(name: "Scene/Welcome/illustration/cloud.base") + internal static let elephantOnAirplaneWithContrail = ImageAsset(name: "Scene/Welcome/illustration/elephant.on.airplane.with.contrail") + internal static let elephantThreeOnGrass = ImageAsset(name: "Scene/Welcome/illustration/elephant.three.on.grass") + internal static let elephantThreeOnGrassWithTreeThree = ImageAsset(name: "Scene/Welcome/illustration/elephant.three.on.grass.with.tree.three") + internal static let elephantThreeOnGrassWithTreeTwo = ImageAsset(name: "Scene/Welcome/illustration/elephant.three.on.grass.with.tree.two") + } + internal static let mastodonLogoBlack = ImageAsset(name: "Scene/Welcome/mastodon.logo.black") + internal static let mastodonLogoBlackLarge = ImageAsset(name: "Scene/Welcome/mastodon.logo.black.large") + internal static let mastodonLogo = ImageAsset(name: "Scene/Welcome/mastodon.logo") + internal static let mastodonLogoLarge = ImageAsset(name: "Scene/Welcome/mastodon.logo.large") } - internal static let mastodonLogoBlack = ImageAsset(name: "Welcome/mastodon.logo.black") - internal static let mastodonLogoBlackLarge = ImageAsset(name: "Welcome/mastodon.logo.black.large") - internal static let mastodonLogo = ImageAsset(name: "Welcome/mastodon.logo") - internal static let mastodonLogoLarge = ImageAsset(name: "Welcome/mastodon.logo.large") } } // swiftlint:enable identifier_name line_length nesting type_body_length type_name diff --git a/Mastodon/Generated/Strings.swift b/Mastodon/Generated/Strings.swift index 685b47e4e..6eed41a29 100644 --- a/Mastodon/Generated/Strings.swift +++ b/Mastodon/Generated/Strings.swift @@ -224,6 +224,10 @@ internal enum L10n { internal static let composeAction = L10n.tr("Localizable", "Scene.Compose.ComposeAction") /// Type or paste what's on your mind internal static let contentInputPlaceholder = L10n.tr("Localizable", "Scene.Compose.ContentInputPlaceholder") + /// replying to %@ + internal static func replyingToUser(_ p1: Any) -> String { + return L10n.tr("Localizable", "Scene.Compose.ReplyingToUser", String(describing: p1)) + } internal enum Attachment { /// This %@ is broken and can't be\nuploaded to Mastodon. internal static func attachmentBroken(_ p1: Any) -> String { @@ -259,6 +263,10 @@ internal enum L10n { internal static let oneDay = L10n.tr("Localizable", "Scene.Compose.Poll.OneDay") /// 1 Hour internal static let oneHour = L10n.tr("Localizable", "Scene.Compose.Poll.OneHour") + /// Option %ld + internal static func optionNumber(_ p1: Int) -> String { + return L10n.tr("Localizable", "Scene.Compose.Poll.OptionNumber", p1) + } /// 7 Days internal static let sevenDays = L10n.tr("Localizable", "Scene.Compose.Poll.SevenDays") /// 6 Hours diff --git a/Mastodon/Resources/Assets.xcassets/Profile/Banner/Contents.json b/Mastodon/Resources/Assets.xcassets/Scene/Compose/Contents.json similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Profile/Banner/Contents.json rename to Mastodon/Resources/Assets.xcassets/Scene/Compose/Contents.json diff --git a/Mastodon/Resources/Assets.xcassets/Scene/Compose/background.colorset/Contents.json b/Mastodon/Resources/Assets.xcassets/Scene/Compose/background.colorset/Contents.json new file mode 100644 index 000000000..e13fb4690 --- /dev/null +++ b/Mastodon/Resources/Assets.xcassets/Scene/Compose/background.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "1.000", + "green" : "1.000", + "red" : "1.000" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x1E", + "green" : "0x1C", + "red" : "0x1C" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Mastodon/Resources/Assets.xcassets/Scene/Compose/toolbar.background.colorset/Contents.json b/Mastodon/Resources/Assets.xcassets/Scene/Compose/toolbar.background.colorset/Contents.json new file mode 100644 index 000000000..4ef70f635 --- /dev/null +++ b/Mastodon/Resources/Assets.xcassets/Scene/Compose/toolbar.background.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "222", + "green" : "216", + "red" : "214" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "43", + "green" : "43", + "red" : "43" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Mastodon/Resources/Assets.xcassets/Profile/Contents.json b/Mastodon/Resources/Assets.xcassets/Scene/Contents.json similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Profile/Contents.json rename to Mastodon/Resources/Assets.xcassets/Scene/Contents.json diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/Contents.json b/Mastodon/Resources/Assets.xcassets/Scene/Profile/Banner/Contents.json similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/Contents.json rename to Mastodon/Resources/Assets.xcassets/Scene/Profile/Banner/Contents.json diff --git a/Mastodon/Resources/Assets.xcassets/Profile/Banner/bio.edit.background.gray.colorset/Contents.json b/Mastodon/Resources/Assets.xcassets/Scene/Profile/Banner/bio.edit.background.gray.colorset/Contents.json similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Profile/Banner/bio.edit.background.gray.colorset/Contents.json rename to Mastodon/Resources/Assets.xcassets/Scene/Profile/Banner/bio.edit.background.gray.colorset/Contents.json diff --git a/Mastodon/Resources/Assets.xcassets/Profile/Banner/name.edit.background.gray.colorset/Contents.json b/Mastodon/Resources/Assets.xcassets/Scene/Profile/Banner/name.edit.background.gray.colorset/Contents.json similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Profile/Banner/name.edit.background.gray.colorset/Contents.json rename to Mastodon/Resources/Assets.xcassets/Scene/Profile/Banner/name.edit.background.gray.colorset/Contents.json diff --git a/Mastodon/Resources/Assets.xcassets/Profile/Banner/username.gray.colorset/Contents.json b/Mastodon/Resources/Assets.xcassets/Scene/Profile/Banner/username.gray.colorset/Contents.json similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Profile/Banner/username.gray.colorset/Contents.json rename to Mastodon/Resources/Assets.xcassets/Scene/Profile/Banner/username.gray.colorset/Contents.json diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/illustration/Contents.json b/Mastodon/Resources/Assets.xcassets/Scene/Profile/Contents.json similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/illustration/Contents.json rename to Mastodon/Resources/Assets.xcassets/Scene/Profile/Contents.json diff --git a/Mastodon/Resources/Assets.xcassets/Scene/Welcome/Contents.json b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/Contents.json new file mode 100644 index 000000000..6e965652d --- /dev/null +++ b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/Contents.json @@ -0,0 +1,9 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "provides-namespace" : true + } +} diff --git a/Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/Contents.json b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/Contents.json new file mode 100644 index 000000000..6e965652d --- /dev/null +++ b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/Contents.json @@ -0,0 +1,9 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "provides-namespace" : true + } +} diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/illustration/background.cyan.colorset/Contents.json b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/background.cyan.colorset/Contents.json similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/illustration/background.cyan.colorset/Contents.json rename to Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/background.cyan.colorset/Contents.json diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/illustration/cloud.base.imageset/Contents.json b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/cloud.base.imageset/Contents.json similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/illustration/cloud.base.imageset/Contents.json rename to Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/cloud.base.imageset/Contents.json diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/illustration/cloud.base.imageset/untitled10007Group61.png b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/cloud.base.imageset/untitled10007Group61.png similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/illustration/cloud.base.imageset/untitled10007Group61.png rename to Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/cloud.base.imageset/untitled10007Group61.png diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/illustration/cloud.base.imageset/untitled10007Group61@2x.png b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/cloud.base.imageset/untitled10007Group61@2x.png similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/illustration/cloud.base.imageset/untitled10007Group61@2x.png rename to Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/cloud.base.imageset/untitled10007Group61@2x.png diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/illustration/cloud.base.imageset/untitled10007Group61@3x.png b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/cloud.base.imageset/untitled10007Group61@3x.png similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/illustration/cloud.base.imageset/untitled10007Group61@3x.png rename to Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/cloud.base.imageset/untitled10007Group61@3x.png diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.on.airplane.with.contrail.imageset/Contents.json b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.on.airplane.with.contrail.imageset/Contents.json similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.on.airplane.with.contrail.imageset/Contents.json rename to Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.on.airplane.with.contrail.imageset/Contents.json diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.on.airplane.with.contrail.imageset/untitled10006Group21.png b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.on.airplane.with.contrail.imageset/untitled10006Group21.png similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.on.airplane.with.contrail.imageset/untitled10006Group21.png rename to Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.on.airplane.with.contrail.imageset/untitled10006Group21.png diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.on.airplane.with.contrail.imageset/untitled10006Group21@2x.png b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.on.airplane.with.contrail.imageset/untitled10006Group21@2x.png similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.on.airplane.with.contrail.imageset/untitled10006Group21@2x.png rename to Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.on.airplane.with.contrail.imageset/untitled10006Group21@2x.png diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.on.airplane.with.contrail.imageset/untitled10006Group21@3x.png b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.on.airplane.with.contrail.imageset/untitled10006Group21@3x.png similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.on.airplane.with.contrail.imageset/untitled10006Group21@3x.png rename to Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.on.airplane.with.contrail.imageset/untitled10006Group21@3x.png diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.three.on.grass.imageset/Contents.json b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.three.on.grass.imageset/Contents.json similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.three.on.grass.imageset/Contents.json rename to Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.three.on.grass.imageset/Contents.json diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.three.on.grass.imageset/untitled10003Group11.png b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.three.on.grass.imageset/untitled10003Group11.png similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.three.on.grass.imageset/untitled10003Group11.png rename to Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.three.on.grass.imageset/untitled10003Group11.png diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.three.on.grass.imageset/untitled10003Group11@2x.png b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.three.on.grass.imageset/untitled10003Group11@2x.png similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.three.on.grass.imageset/untitled10003Group11@2x.png rename to Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.three.on.grass.imageset/untitled10003Group11@2x.png diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.three.on.grass.imageset/untitled10003Group11@3x.png b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.three.on.grass.imageset/untitled10003Group11@3x.png similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.three.on.grass.imageset/untitled10003Group11@3x.png rename to Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.three.on.grass.imageset/untitled10003Group11@3x.png diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.three.on.grass.with.tree.three.imageset/Contents.json b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.three.on.grass.with.tree.three.imageset/Contents.json similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.three.on.grass.with.tree.three.imageset/Contents.json rename to Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.three.on.grass.with.tree.three.imageset/Contents.json diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.three.on.grass.with.tree.three.imageset/untitled10005Group101.png b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.three.on.grass.with.tree.three.imageset/untitled10005Group101.png similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.three.on.grass.with.tree.three.imageset/untitled10005Group101.png rename to Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.three.on.grass.with.tree.three.imageset/untitled10005Group101.png diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.three.on.grass.with.tree.three.imageset/untitled10005Group101@2x.png b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.three.on.grass.with.tree.three.imageset/untitled10005Group101@2x.png similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.three.on.grass.with.tree.three.imageset/untitled10005Group101@2x.png rename to Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.three.on.grass.with.tree.three.imageset/untitled10005Group101@2x.png diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.three.on.grass.with.tree.three.imageset/untitled10005Group101@3x.png b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.three.on.grass.with.tree.three.imageset/untitled10005Group101@3x.png similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.three.on.grass.with.tree.three.imageset/untitled10005Group101@3x.png rename to Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.three.on.grass.with.tree.three.imageset/untitled10005Group101@3x.png diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.three.on.grass.with.tree.two.imageset/Contents.json b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.three.on.grass.with.tree.two.imageset/Contents.json similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.three.on.grass.with.tree.two.imageset/Contents.json rename to Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.three.on.grass.with.tree.two.imageset/Contents.json diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.three.on.grass.with.tree.two.imageset/untitled10004Group111.png b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.three.on.grass.with.tree.two.imageset/untitled10004Group111.png similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.three.on.grass.with.tree.two.imageset/untitled10004Group111.png rename to Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.three.on.grass.with.tree.two.imageset/untitled10004Group111.png diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.three.on.grass.with.tree.two.imageset/untitled10004Group111@2x.png b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.three.on.grass.with.tree.two.imageset/untitled10004Group111@2x.png similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.three.on.grass.with.tree.two.imageset/untitled10004Group111@2x.png rename to Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.three.on.grass.with.tree.two.imageset/untitled10004Group111@2x.png diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.three.on.grass.with.tree.two.imageset/untitled10004Group111@3x.png b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.three.on.grass.with.tree.two.imageset/untitled10004Group111@3x.png similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/illustration/elephant.three.on.grass.with.tree.two.imageset/untitled10004Group111@3x.png rename to Mastodon/Resources/Assets.xcassets/Scene/Welcome/illustration/elephant.three.on.grass.with.tree.two.imageset/untitled10004Group111@3x.png diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/mastodon.logo.black.imageset/Contents.json b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/mastodon.logo.black.imageset/Contents.json similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/mastodon.logo.black.imageset/Contents.json rename to Mastodon/Resources/Assets.xcassets/Scene/Welcome/mastodon.logo.black.imageset/Contents.json diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/mastodon.logo.black.imageset/mastodon.logo.black.pdf b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/mastodon.logo.black.imageset/mastodon.logo.black.pdf similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/mastodon.logo.black.imageset/mastodon.logo.black.pdf rename to Mastodon/Resources/Assets.xcassets/Scene/Welcome/mastodon.logo.black.imageset/mastodon.logo.black.pdf diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/mastodon.logo.black.large.imageset/Contents.json b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/mastodon.logo.black.large.imageset/Contents.json similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/mastodon.logo.black.large.imageset/Contents.json rename to Mastodon/Resources/Assets.xcassets/Scene/Welcome/mastodon.logo.black.large.imageset/Contents.json diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/mastodon.logo.black.large.imageset/mastodon.logo.black.large.pdf b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/mastodon.logo.black.large.imageset/mastodon.logo.black.large.pdf similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/mastodon.logo.black.large.imageset/mastodon.logo.black.large.pdf rename to Mastodon/Resources/Assets.xcassets/Scene/Welcome/mastodon.logo.black.large.imageset/mastodon.logo.black.large.pdf diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/mastodon.logo.imageset/Contents.json b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/mastodon.logo.imageset/Contents.json similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/mastodon.logo.imageset/Contents.json rename to Mastodon/Resources/Assets.xcassets/Scene/Welcome/mastodon.logo.imageset/Contents.json diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/mastodon.logo.imageset/logotypeFull1.pdf b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/mastodon.logo.imageset/logotypeFull1.pdf similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/mastodon.logo.imageset/logotypeFull1.pdf rename to Mastodon/Resources/Assets.xcassets/Scene/Welcome/mastodon.logo.imageset/logotypeFull1.pdf diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/mastodon.logo.large.imageset/Contents.json b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/mastodon.logo.large.imageset/Contents.json similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/mastodon.logo.large.imageset/Contents.json rename to Mastodon/Resources/Assets.xcassets/Scene/Welcome/mastodon.logo.large.imageset/Contents.json diff --git a/Mastodon/Resources/Assets.xcassets/Welcome/mastodon.logo.large.imageset/logotypeFull1.large.pdf b/Mastodon/Resources/Assets.xcassets/Scene/Welcome/mastodon.logo.large.imageset/logotypeFull1.large.pdf similarity index 100% rename from Mastodon/Resources/Assets.xcassets/Welcome/mastodon.logo.large.imageset/logotypeFull1.large.pdf rename to Mastodon/Resources/Assets.xcassets/Scene/Welcome/mastodon.logo.large.imageset/logotypeFull1.large.pdf diff --git a/Mastodon/Resources/en.lproj/Localizable.strings b/Mastodon/Resources/en.lproj/Localizable.strings index f8e5c516d..c35d6e633 100644 --- a/Mastodon/Resources/en.lproj/Localizable.strings +++ b/Mastodon/Resources/en.lproj/Localizable.strings @@ -86,10 +86,12 @@ uploaded to Mastodon."; "Scene.Compose.Poll.DurationTime" = "Duration: %@"; "Scene.Compose.Poll.OneDay" = "1 Day"; "Scene.Compose.Poll.OneHour" = "1 Hour"; +"Scene.Compose.Poll.OptionNumber" = "Option %ld"; "Scene.Compose.Poll.SevenDays" = "7 Days"; "Scene.Compose.Poll.SixHours" = "6 Hours"; "Scene.Compose.Poll.ThirtyMinutes" = "30 minutes"; "Scene.Compose.Poll.ThreeDays" = "3 Days"; +"Scene.Compose.ReplyingToUser" = "replying to %@"; "Scene.Compose.Title.NewPost" = "New Post"; "Scene.Compose.Title.NewReply" = "New Reply"; "Scene.Compose.Visibility.Direct" = "Only people I mention"; diff --git a/Mastodon/Scene/Compose/CollectionViewCell/ComposeRepliedToStatusContentCollectionViewCell.swift b/Mastodon/Scene/Compose/CollectionViewCell/ComposeRepliedToStatusContentCollectionViewCell.swift index 0163a54cd..9d84653e6 100644 --- a/Mastodon/Scene/Compose/CollectionViewCell/ComposeRepliedToStatusContentCollectionViewCell.swift +++ b/Mastodon/Scene/Compose/CollectionViewCell/ComposeRepliedToStatusContentCollectionViewCell.swift @@ -6,9 +6,22 @@ // import UIKit +import Combine final class ComposeRepliedToStatusContentCollectionViewCell: UICollectionViewCell { + var disposeBag = Set() + + let statusView = StatusView() + + override func prepareForReuse() { + super.prepareForReuse() + + statusView.isStatusTextSensitive = false + statusView.cleanUpContentWarning() + disposeBag.removeAll() + } + override init(frame: CGRect) { super.init(frame: frame) _init() @@ -24,7 +37,19 @@ final class ComposeRepliedToStatusContentCollectionViewCell: UICollectionViewCel extension ComposeRepliedToStatusContentCollectionViewCell { private func _init() { + backgroundColor = .clear + statusView.contentWarningBlurContentImageView.backgroundColor = Asset.Scene.Compose.background.color + + statusView.translatesAutoresizingMaskIntoConstraints = false + contentView.addSubview(statusView) + NSLayoutConstraint.activate([ + statusView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 20), + statusView.leadingAnchor.constraint(equalTo: contentView.readableContentGuide.leadingAnchor), + contentView.readableContentGuide.trailingAnchor.constraint(equalTo: statusView.trailingAnchor), + contentView.bottomAnchor.constraint(equalTo: statusView.bottomAnchor), + ]) + statusView.actionToolbarContainer.isHidden = true } } diff --git a/Mastodon/Scene/Compose/ComposeViewController.swift b/Mastodon/Scene/Compose/ComposeViewController.swift index 3e82cd51a..e68be7295 100644 --- a/Mastodon/Scene/Compose/ComposeViewController.swift +++ b/Mastodon/Scene/Compose/ComposeViewController.swift @@ -31,7 +31,7 @@ final class ComposeViewController: UIViewController, NeedsDependency { button.setBackgroundImage(.placeholder(color: Asset.Colors.Button.normal.color.withAlphaComponent(0.5)), for: .highlighted) button.setBackgroundImage(.placeholder(color: Asset.Colors.Button.disabled.color), for: .disabled) button.setTitleColor(.white, for: .normal) - button.contentEdgeInsets = UIEdgeInsets(top: 3, left: 16, bottom: 3, right: 16) + button.contentEdgeInsets = UIEdgeInsets(top: 5.5, left: 16, bottom: 5.5, right: 16) // set 28pt height button.adjustsImageWhenHighlighted = false return button }() @@ -66,18 +66,18 @@ final class ComposeViewController: UIViewController, NeedsDependency { return view }() - let composeToolbarView: ComposeToolbarView = { - let composeToolbarView = ComposeToolbarView() - let text = UITextView() - let inputView = UIInputView(frame: .init(x: 0, y: 0, width: 40, height: 40), inputViewStyle: .keyboard) - text.inputAccessoryView = inputView - composeToolbarView.backgroundColor = inputView.backgroundColor - return composeToolbarView - }() + let composeToolbarView = ComposeToolbarView() var composeToolbarViewBottomLayoutConstraint: NSLayoutConstraint! let composeToolbarBackgroundView: UIView = { let backgroundView = UIView() - backgroundView.backgroundColor = .secondarySystemBackground + // set keyboard background to make the keyboard blurred color fixed + backgroundView.backgroundColor = UIColor(dynamicProvider: { traitCollection -> UIColor in + // avoid elevated color + switch traitCollection.userInterfaceStyle { + case .light: return .white + default: return .black + } + }) return backgroundView }() @@ -135,7 +135,7 @@ extension ComposeViewController { self.title = title } .store(in: &disposeBag) - view.backgroundColor = Asset.Colors.Background.systemBackground.color + view.backgroundColor = Asset.Scene.Compose.background.color navigationItem.leftBarButtonItem = UIBarButtonItem(title: L10n.Common.Controls.Actions.cancel, style: .plain, target: self, action: #selector(ComposeViewController.cancelBarButtonItemPressed(_:))) navigationItem.rightBarButtonItem = publishBarButtonItem publishButton.addTarget(self, action: #selector(ComposeViewController.publishBarButtonItemPressed(_:)), for: .touchUpInside) @@ -266,13 +266,17 @@ extension ComposeViewController { .store(in: &disposeBag) // bind visibility toolbar UI - viewModel.selectedStatusVisibility - .receive(on: DispatchQueue.main) - .sink { [weak self] type in - guard let self = self else { return } - self.composeToolbarView.visibilityButton.setImage(type.image, for: .normal) - } - .store(in: &disposeBag) + Publishers.CombineLatest( + viewModel.selectedStatusVisibility, + viewModel.traitCollectionDidChangePublisher + ) + .receive(on: DispatchQueue.main) + .sink { [weak self] type, _ in + guard let self = self else { return } + let image = type.image(interfaceStyle: self.traitCollection.userInterfaceStyle) + self.composeToolbarView.visibilityButton.setImage(image, for: .normal) + } + .store(in: &disposeBag) viewModel.characterCount .receive(on: DispatchQueue.main) @@ -336,6 +340,12 @@ extension ComposeViewController { } } + override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { + super.traitCollectionDidChange(previousTraitCollection) + + viewModel.traitCollectionDidChangePublisher.send() + } + } extension ComposeViewController { diff --git a/Mastodon/Scene/Compose/ComposeViewModel.swift b/Mastodon/Scene/Compose/ComposeViewModel.swift index f52c38a17..1043d8bec 100644 --- a/Mastodon/Scene/Compose/ComposeViewModel.swift +++ b/Mastodon/Scene/Compose/ComposeViewModel.swift @@ -29,6 +29,7 @@ final class ComposeViewModel { let selectedStatusVisibility = CurrentValueSubject(.public) let activeAuthentication: CurrentValueSubject let activeAuthenticationBox: CurrentValueSubject + let traitCollectionDidChangePublisher = PassthroughSubject() // output var diffableDataSource: UICollectionViewDiffableDataSource! diff --git a/Mastodon/Scene/Compose/View/ComposeToolbarView.swift b/Mastodon/Scene/Compose/View/ComposeToolbarView.swift index efe408265..18aa0c0ba 100644 --- a/Mastodon/Scene/Compose/View/ComposeToolbarView.swift +++ b/Mastodon/Scene/Compose/View/ComposeToolbarView.swift @@ -80,8 +80,12 @@ final class ComposeToolbarView: UIView { } extension ComposeToolbarView { + private func _init() { - backgroundColor = .secondarySystemBackground + // magic keyboard color (iOS 14): + // light with white background: RGB 214 216 222 + // dark with black background: RGB 43 43 43 + backgroundColor = Asset.Scene.Compose.toolbarBackground.color let stackView = UIStackView() stackView.axis = .horizontal @@ -125,9 +129,18 @@ extension ComposeToolbarView { pollButton.addTarget(self, action: #selector(ComposeToolbarView.pollButtonDidPressed(_:)), for: .touchUpInside) emojiButton.addTarget(self, action: #selector(ComposeToolbarView.emojiButtonDidPressed(_:)), for: .touchUpInside) contentWarningButton.addTarget(self, action: #selector(ComposeToolbarView.contentWarningButtonDidPressed(_:)), for: .touchUpInside) - visibilityButton.menu = createVisibilityContextMenu() + visibilityButton.menu = createVisibilityContextMenu(interfaceStyle: traitCollection.userInterfaceStyle) visibilityButton.showsMenuAsPrimaryAction = true + + updateToolbarButtonUserInterfaceStyle() } + + override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { + super.traitCollectionDidChange(previousTraitCollection) + + updateToolbarButtonUserInterfaceStyle() + } + } extension ComposeToolbarView { @@ -152,9 +165,15 @@ extension ComposeToolbarView { } } - var image: UIImage { + func image(interfaceStyle: UIUserInterfaceStyle) -> UIImage { switch self { - case .public: return UIImage(systemName: "person.3", withConfiguration: UIImage.SymbolConfiguration(pointSize: 15, weight: .medium))! + case .public: + switch interfaceStyle { + case .light: + return UIImage(systemName: "person.3", withConfiguration: UIImage.SymbolConfiguration(pointSize: 15, weight: .medium))! + default: + return UIImage(systemName: "person.3.fill", withConfiguration: UIImage.SymbolConfiguration(pointSize: 15, weight: .medium))! + } case .unlisted: return UIImage(systemName: "eye.slash", withConfiguration: UIImage.SymbolConfiguration(pointSize: 20, weight: .medium))! case .private: return UIImage(systemName: "person.crop.circle.badge.plus", withConfiguration: UIImage.SymbolConfiguration(pointSize: 20, weight: .medium))! case .direct: return UIImage(systemName: "at", withConfiguration: UIImage.SymbolConfiguration(pointSize: 20, weight: .medium))! @@ -182,6 +201,25 @@ extension ComposeToolbarView { button.layer.cornerCurve = .continuous } + private func updateToolbarButtonUserInterfaceStyle() { + switch traitCollection.userInterfaceStyle { + case .light: + mediaButton.setImage(UIImage(systemName: "photo", withConfiguration: UIImage.SymbolConfiguration(pointSize: 20, weight: .regular))!, for: .normal) + emojiButton.setImage(UIImage(systemName: "face.smiling", withConfiguration: UIImage.SymbolConfiguration(pointSize: 20, weight: .regular))!, for: .normal) + contentWarningButton.setImage(UIImage(systemName: "exclamationmark.shield", withConfiguration: UIImage.SymbolConfiguration(pointSize: 20, weight: .regular))!, for: .normal) + + case .dark: + mediaButton.setImage(UIImage(systemName: "photo.fill", withConfiguration: UIImage.SymbolConfiguration(pointSize: 20, weight: .regular))!, for: .normal) + emojiButton.setImage(UIImage(systemName: "face.smiling.fill", withConfiguration: UIImage.SymbolConfiguration(pointSize: 20, weight: .regular))!, for: .normal) + contentWarningButton.setImage(UIImage(systemName: "exclamationmark.shield.fill", withConfiguration: UIImage.SymbolConfiguration(pointSize: 20, weight: .regular))!, for: .normal) + + default: + assertionFailure() + } + + visibilityButton.menu = createVisibilityContextMenu(interfaceStyle: traitCollection.userInterfaceStyle) + } + private func createMediaContextMenu() -> UIMenu { var children: [UIMenuElement] = [] let photoLibraryAction = UIAction(title: L10n.Scene.Compose.MediaSelection.photoLibrary, image: UIImage(systemName: "rectangle.on.rectangle"), identifier: nil, discoverabilityTitle: nil, attributes: [], state: .off) { [weak self] _ in @@ -208,9 +246,9 @@ extension ComposeToolbarView { return UIMenu(title: "", image: nil, identifier: nil, options: .displayInline, children: children) } - private func createVisibilityContextMenu() -> UIMenu { + private func createVisibilityContextMenu(interfaceStyle: UIUserInterfaceStyle) -> UIMenu { let children: [UIMenuElement] = VisibilitySelectionType.allCases.map { type in - UIAction(title: type.title, image: type.image, identifier: nil, discoverabilityTitle: nil, attributes: [], state: .off) { [weak self] action in + UIAction(title: type.title, image: type.image(interfaceStyle: interfaceStyle), identifier: nil, discoverabilityTitle: nil, attributes: [], state: .off) { [weak self] action in guard let self = self else { return } os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: visibilitySelectionType: %s", ((#file as NSString).lastPathComponent), #line, #function, type.rawValue) self.delegate?.composeToolbarView(self, visibilityButtonDidPressed: self.visibilityButton, visibilitySelectionType: type) diff --git a/Mastodon/Scene/Onboarding/Welcome/View/WelcomeIllustrationView.swift b/Mastodon/Scene/Onboarding/Welcome/View/WelcomeIllustrationView.swift index 9512ea78b..f5d8c41c8 100644 --- a/Mastodon/Scene/Onboarding/Welcome/View/WelcomeIllustrationView.swift +++ b/Mastodon/Scene/Onboarding/Welcome/View/WelcomeIllustrationView.swift @@ -16,14 +16,14 @@ final class WelcomeIllustrationView: UIView { let leftHillImageView = UIImageView() let centerHillImageView = UIImageView() - private let cloudBaseImage = Asset.Welcome.Illustration.cloudBase.image - private let elephantThreeOnGrassWithTreeTwoImage = Asset.Welcome.Illustration.elephantThreeOnGrassWithTreeTwo.image - private let elephantThreeOnGrassWithTreeThreeImage = Asset.Welcome.Illustration.elephantThreeOnGrassWithTreeThree.image - private let elephantThreeOnGrassImage = Asset.Welcome.Illustration.elephantThreeOnGrass.image + private let cloudBaseImage = Asset.Scene.Welcome.Illustration.cloudBase.image + private let elephantThreeOnGrassWithTreeTwoImage = Asset.Scene.Welcome.Illustration.elephantThreeOnGrassWithTreeTwo.image + private let elephantThreeOnGrassWithTreeThreeImage = Asset.Scene.Welcome.Illustration.elephantThreeOnGrassWithTreeThree.image + private let elephantThreeOnGrassImage = Asset.Scene.Welcome.Illustration.elephantThreeOnGrass.image // layout outside let elephantOnAirplaneWithContrailImageView: UIImageView = { - let imageView = UIImageView(image: Asset.Welcome.Illustration.elephantOnAirplaneWithContrail.image) + let imageView = UIImageView(image: Asset.Scene.Welcome.Illustration.elephantOnAirplaneWithContrail.image) imageView.contentMode = .scaleAspectFill return imageView }() @@ -43,7 +43,7 @@ final class WelcomeIllustrationView: UIView { extension WelcomeIllustrationView { private func _init() { - backgroundColor = Asset.Welcome.Illustration.backgroundCyan.color + backgroundColor = Asset.Scene.Welcome.Illustration.backgroundCyan.color let topPaddingView = UIView() diff --git a/Mastodon/Scene/Onboarding/Welcome/WelcomeViewController.swift b/Mastodon/Scene/Onboarding/Welcome/WelcomeViewController.swift index c647d04ca..de89cd457 100644 --- a/Mastodon/Scene/Onboarding/Welcome/WelcomeViewController.swift +++ b/Mastodon/Scene/Onboarding/Welcome/WelcomeViewController.swift @@ -17,7 +17,7 @@ final class WelcomeViewController: UIViewController, NeedsDependency { var welcomeIllustrationViewBottomAnchorLayoutConstraint: NSLayoutConstraint? private(set) lazy var logoImageView: UIImageView = { - let image = view.traitCollection.userInterfaceIdiom == .phone ? Asset.Welcome.mastodonLogo.image : Asset.Welcome.mastodonLogoBlackLarge.image + let image = view.traitCollection.userInterfaceIdiom == .phone ? Asset.Scene.Welcome.mastodonLogo.image : Asset.Scene.Welcome.mastodonLogoBlackLarge.image let imageView = UIImageView(image: image) imageView.translatesAutoresizingMaskIntoConstraints = false return imageView diff --git a/Mastodon/Scene/Profile/Header/View/ProfileHeaderView.swift b/Mastodon/Scene/Profile/Header/View/ProfileHeaderView.swift index 2fba55e66..09d99c51e 100644 --- a/Mastodon/Scene/Profile/Header/View/ProfileHeaderView.swift +++ b/Mastodon/Scene/Profile/Header/View/ProfileHeaderView.swift @@ -100,7 +100,7 @@ final class ProfileHeaderView: UIView { label.font = UIFontMetrics(forTextStyle: .subheadline).scaledFont(for: .systemFont(ofSize: 15, weight: .regular)) label.adjustsFontSizeToFitWidth = true label.minimumScaleFactor = 0.5 - label.textColor = Asset.Profile.Banner.usernameGray.color + label.textColor = Asset.Scene.Profile.Banner.usernameGray.color label.text = "@alice" label.applyShadow(color: UIColor.black.withAlphaComponent(0.2), alpha: 0.5, x: 0, y: 2, blur: 2, spread: 0) return label @@ -131,7 +131,7 @@ final class ProfileHeaderView: UIView { textEditorView.scrollView.isScrollEnabled = false textEditorView.isScrollEnabled = false textEditorView.font = .preferredFont(forTextStyle: .body) - textEditorView.backgroundColor = Asset.Profile.Banner.bioEditBackgroundGray.color + textEditorView.backgroundColor = Asset.Scene.Profile.Banner.bioEditBackgroundGray.color textEditorView.layer.masksToBounds = true textEditorView.layer.cornerCurve = .continuous textEditorView.layer.cornerRadius = 10 @@ -356,9 +356,9 @@ extension ProfileHeaderView { bioTextEditorView.backgroundColor = .clear animator.addAnimations { self.bannerImageViewOverlayView.backgroundColor = ProfileHeaderView.bannerImageViewOverlayViewBackgroundEditingColor - self.nameTextFieldBackgroundView.backgroundColor = Asset.Profile.Banner.nameEditBackgroundGray.color + self.nameTextFieldBackgroundView.backgroundColor = Asset.Scene.Profile.Banner.nameEditBackgroundGray.color self.editAvatarBackgroundView.alpha = 1 - self.bioTextEditorView.backgroundColor = Asset.Profile.Banner.bioEditBackgroundGray.color + self.bioTextEditorView.backgroundColor = Asset.Scene.Profile.Banner.bioEditBackgroundGray.color } } diff --git a/Mastodon/Scene/Share/View/Content/StatusView.swift b/Mastodon/Scene/Share/View/Content/StatusView.swift index fc0fda099..63e8bb8f1 100644 --- a/Mastodon/Scene/Share/View/Content/StatusView.swift +++ b/Mastodon/Scene/Share/View/Content/StatusView.swift @@ -29,7 +29,7 @@ final class StatusView: UIView { static let avatarToLabelSpacing: CGFloat = 5 static let contentWarningBlurRadius: CGFloat = 12 - static let boostIconImage: UIImage = { + static let reblogIconImage: UIImage = { let font = UIFont.systemFont(ofSize: 13, weight: .medium) let configuration = UIImage.SymbolConfiguration(font: font) let image = UIImage(systemName: "arrow.2.squarepath", withConfiguration: configuration)!.withTintColor(Asset.Colors.Label.secondary.color) @@ -61,7 +61,7 @@ final class StatusView: UIView { let headerIconLabel: UILabel = { let label = UILabel() - label.attributedText = StatusView.iconAttributedString(image: StatusView.boostIconImage) + label.attributedText = StatusView.iconAttributedString(image: StatusView.reblogIconImage) return label }()