feat: set theme color for share action extension

This commit is contained in:
CMK 2021-07-20 19:24:24 +08:00
parent 9c25bebaba
commit 7b8500e120
67 changed files with 501 additions and 313 deletions

View File

@ -524,7 +524,7 @@
}, },
"boring_zone": { "boring_zone": {
"title": "The Boring Zone", "title": "The Boring Zone",
"account_settings": "Account settings", "account_settings": "Account Settings",
"terms": "Terms of Service", "terms": "Terms of Service",
"privacy": "Privacy Policy" "privacy": "Privacy Policy"
}, },

View File

@ -34,7 +34,7 @@ extension CategoryPickerSection {
cell.categoryView.titleLabel.textColor = .white cell.categoryView.titleLabel.textColor = .white
} }
} else { } else {
cell.categoryView.bgView.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color cell.categoryView.bgView.backgroundColor = Asset.Theme.Mastodon.secondaryGroupedSystemBackground.color
cell.categoryView.bgView.applyShadow(color: Asset.Colors.brandBlue.color, alpha: 0, x: 0, y: 0, blur: 0.0) cell.categoryView.bgView.applyShadow(color: Asset.Colors.brandBlue.color, alpha: 0, x: 0, y: 0, blur: 0.0)
if case .all = item { if case .all = item {
cell.categoryView.titleLabel.textColor = Asset.Colors.brandBlue.color cell.categoryView.titleLabel.textColor = Asset.Colors.brandBlue.color

View File

@ -33,16 +33,6 @@ extension SearchResultSection {
let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: SearchResultTableViewCell.self), for: indexPath) as! SearchResultTableViewCell let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: SearchResultTableViewCell.self), for: indexPath) as! SearchResultTableViewCell
cell.config(with: tag) cell.config(with: tag)
return cell return cell
// case .hashtagObjectID(let hashtagObjectID):
// let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: SearchingTableViewCell.self), for: indexPath) as! SearchingTableViewCell
// let tag = dependency.context.managedObjectContext.object(with: hashtagObjectID) as! Tag
// cell.config(with: tag)
// return cell
// case .accountObjectID(let accountObjectID):
// let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: SearchingTableViewCell.self), for: indexPath) as! SearchingTableViewCell
// let user = dependency.context.managedObjectContext.object(with: accountObjectID) as! MastodonUser
// cell.config(with: user)
// return cell
case .status(let statusObjectID, let attribute): case .status(let statusObjectID, let attribute):
let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: StatusTableViewCell.self), for: indexPath) as! StatusTableViewCell let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: StatusTableViewCell.self), for: indexPath) as! StatusTableViewCell
if let status = try? dependency.context.managedObjectContext.existingObject(with: statusObjectID) as? Status { if let status = try? dependency.context.managedObjectContext.existingObject(with: statusObjectID) as? Status {
@ -73,8 +63,6 @@ extension SearchResultSection {
cell.loadMoreLabel.isHidden = true cell.loadMoreLabel.isHidden = true
} }
return cell return cell
default:
fatalError()
} // end switch } // end switch
} // end UITableViewDiffableDataSource } // end UITableViewDiffableDataSource
} // end func } // end func

View File

@ -103,7 +103,7 @@ extension PollSection {
cell.pollOptionView.optionPercentageLabel.isHidden = false cell.pollOptionView.optionPercentageLabel.isHidden = false
cell.pollOptionView.optionPercentageLabel.text = String(Int(100 * percentage)) + "%" cell.pollOptionView.optionPercentageLabel.text = String(Int(100 * percentage)) + "%"
cell.pollOptionView.voteProgressStripView.isHidden = false cell.pollOptionView.voteProgressStripView.isHidden = false
cell.pollOptionView.voteProgressStripView.tintColor = voted ? Asset.Colors.brandBlue.color : Asset.Colors.Background.Poll.disabled.color cell.pollOptionView.voteProgressStripView.tintColor = voted ? Asset.Colors.brandBlue.color : Asset.Colors.Poll.disabled.color
cell.pollOptionView.voteProgressStripView.setProgress(CGFloat(percentage), animated: animated) cell.pollOptionView.voteProgressStripView.setProgress(CGFloat(percentage), animated: animated)
} }
} }

View File

@ -32,23 +32,6 @@ internal enum Asset {
internal static let plusCircle = ImageAsset(name: "Circles/plus.circle") internal static let plusCircle = ImageAsset(name: "Circles/plus.circle")
} }
internal enum Colors { internal enum Colors {
internal enum Background {
internal enum Poll {
internal static let disabled = ColorAsset(name: "Colors/Background/Poll/disabled")
}
internal static let alertYellow = ColorAsset(name: "Colors/Background/alert.yellow")
internal static let dangerBorder = ColorAsset(name: "Colors/Background/danger.border")
internal static let danger = ColorAsset(name: "Colors/Background/danger")
internal static let mediaTypeIndicotor = ColorAsset(name: "Colors/Background/media.type.indicotor")
internal static let onboardingBackground = ColorAsset(name: "Colors/Background/onboarding.background")
internal static let secondaryGroupedSystemBackground = ColorAsset(name: "Colors/Background/secondary.grouped.system.background")
internal static let secondarySystemBackground = ColorAsset(name: "Colors/Background/secondary.system.background")
internal static let systemBackground = ColorAsset(name: "Colors/Background/system.background")
internal static let systemElevatedBackground = ColorAsset(name: "Colors/Background/system.elevated.background")
internal static let systemGroupedBackground = ColorAsset(name: "Colors/Background/system.grouped.background")
internal static let tertiarySystemBackground = ColorAsset(name: "Colors/Background/tertiary.system.background")
internal static let tertiarySystemGroupedBackground = ColorAsset(name: "Colors/Background/tertiary.system.grouped.background")
}
internal enum Border { internal enum Border {
internal static let composePoll = ColorAsset(name: "Colors/Border/compose.poll") internal static let composePoll = ColorAsset(name: "Colors/Border/compose.poll")
internal static let notificationStatus = ColorAsset(name: "Colors/Border/notification.status") internal static let notificationStatus = ColorAsset(name: "Colors/Border/notification.status")
@ -73,6 +56,9 @@ internal enum Asset {
internal static let mention = ColorAsset(name: "Colors/Notification/mention") internal static let mention = ColorAsset(name: "Colors/Notification/mention")
internal static let reblog = ColorAsset(name: "Colors/Notification/reblog") internal static let reblog = ColorAsset(name: "Colors/Notification/reblog")
} }
internal enum Poll {
internal static let disabled = ColorAsset(name: "Colors/Poll/disabled")
}
internal enum Shadow { internal enum Shadow {
internal static let searchCard = ColorAsset(name: "Colors/Shadow/SearchCard") internal static let searchCard = ColorAsset(name: "Colors/Shadow/SearchCard")
} }
@ -87,12 +73,15 @@ internal enum Asset {
internal static let invalid = ColorAsset(name: "Colors/TextField/invalid") internal static let invalid = ColorAsset(name: "Colors/TextField/invalid")
internal static let valid = ColorAsset(name: "Colors/TextField/valid") internal static let valid = ColorAsset(name: "Colors/TextField/valid")
} }
internal static let alertYellow = ColorAsset(name: "Colors/alert.yellow")
internal static let battleshipGrey = ColorAsset(name: "Colors/battleshipGrey") internal static let battleshipGrey = ColorAsset(name: "Colors/battleshipGrey")
internal static let brandBlue = ColorAsset(name: "Colors/brand.blue") internal static let brandBlue = ColorAsset(name: "Colors/brand.blue")
internal static let brandBlueDarken20 = ColorAsset(name: "Colors/brand.blue.darken.20") internal static let brandBlueDarken20 = ColorAsset(name: "Colors/brand.blue.darken.20")
internal static let dangerBorder = ColorAsset(name: "Colors/danger.border")
internal static let danger = ColorAsset(name: "Colors/danger") internal static let danger = ColorAsset(name: "Colors/danger")
internal static let disabled = ColorAsset(name: "Colors/disabled") internal static let disabled = ColorAsset(name: "Colors/disabled")
internal static let inactive = ColorAsset(name: "Colors/inactive") internal static let inactive = ColorAsset(name: "Colors/inactive")
internal static let mediaTypeIndicotor = ColorAsset(name: "Colors/media.type.indicotor")
internal static let successGreen = ColorAsset(name: "Colors/success.green") internal static let successGreen = ColorAsset(name: "Colors/success.green")
internal static let systemOrange = ColorAsset(name: "Colors/system.orange") internal static let systemOrange = ColorAsset(name: "Colors/system.orange")
} }
@ -103,10 +92,6 @@ internal enum Asset {
internal static let faceSmilingAdaptive = ImageAsset(name: "Human/face.smiling.adaptive") internal static let faceSmilingAdaptive = ImageAsset(name: "Human/face.smiling.adaptive")
} }
internal enum Scene { 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 Profile { internal enum Profile {
internal enum Banner { internal enum Banner {
internal static let bioEditBackgroundGray = ColorAsset(name: "Scene/Profile/Banner/bio.edit.background.gray") internal static let bioEditBackgroundGray = ColorAsset(name: "Scene/Profile/Banner/bio.edit.background.gray")
@ -136,6 +121,7 @@ internal enum Asset {
} }
internal enum Theme { internal enum Theme {
internal enum Mastodon { internal enum Mastodon {
internal static let composeToolbarBackground = ColorAsset(name: "Theme/Mastodon/compose.toolbar.background")
internal static let contentWarningOverlayBackground = ColorAsset(name: "Theme/Mastodon/content.warning.overlay.background") internal static let contentWarningOverlayBackground = ColorAsset(name: "Theme/Mastodon/content.warning.overlay.background")
internal static let navigationBarBackground = ColorAsset(name: "Theme/Mastodon/navigation.bar.background") internal static let navigationBarBackground = ColorAsset(name: "Theme/Mastodon/navigation.bar.background")
internal static let profileFieldCollectionViewBackground = ColorAsset(name: "Theme/Mastodon/profile.field.collection.view.background") internal static let profileFieldCollectionViewBackground = ColorAsset(name: "Theme/Mastodon/profile.field.collection.view.background")
@ -153,6 +139,7 @@ internal enum Asset {
internal static let tabBarItemInactiveIconColor = ColorAsset(name: "Theme/Mastodon/tab.bar.item.inactive.icon.color") internal static let tabBarItemInactiveIconColor = ColorAsset(name: "Theme/Mastodon/tab.bar.item.inactive.icon.color")
} }
internal enum System { internal enum System {
internal static let composeToolbarBackground = ColorAsset(name: "Theme/system/compose.toolbar.background")
internal static let contentWarningOverlayBackground = ColorAsset(name: "Theme/system/content.warning.overlay.background") internal static let contentWarningOverlayBackground = ColorAsset(name: "Theme/system/content.warning.overlay.background")
internal static let navigationBarBackground = ColorAsset(name: "Theme/system/navigation.bar.background") internal static let navigationBarBackground = ColorAsset(name: "Theme/system/navigation.bar.background")
internal static let profileFieldCollectionViewBackground = ColorAsset(name: "Theme/system/profile.field.collection.view.background") internal static let profileFieldCollectionViewBackground = ColorAsset(name: "Theme/system/profile.field.collection.view.background")
@ -170,6 +157,23 @@ internal enum Asset {
internal static let tabBarItemInactiveIconColor = ColorAsset(name: "Theme/system/tab.bar.item.inactive.icon.color") internal static let tabBarItemInactiveIconColor = ColorAsset(name: "Theme/system/tab.bar.item.inactive.icon.color")
} }
} }
internal enum Deprecated {
internal enum Background {
internal static let danger = ColorAsset(name: "_Deprecated/Background/danger")
internal static let onboardingBackground = ColorAsset(name: "_Deprecated/Background/onboarding.background")
internal static let secondaryGroupedSystemBackground = ColorAsset(name: "_Deprecated/Background/secondary.grouped.system.background")
internal static let secondarySystemBackground = ColorAsset(name: "_Deprecated/Background/secondary.system.background")
internal static let systemBackground = ColorAsset(name: "_Deprecated/Background/system.background")
internal static let systemElevatedBackground = ColorAsset(name: "_Deprecated/Background/system.elevated.background")
internal static let systemGroupedBackground = ColorAsset(name: "_Deprecated/Background/system.grouped.background")
internal static let tertiarySystemBackground = ColorAsset(name: "_Deprecated/Background/tertiary.system.background")
internal static let tertiarySystemGroupedBackground = ColorAsset(name: "_Deprecated/Background/tertiary.system.grouped.background")
}
internal enum Compose {
internal static let background = ColorAsset(name: "_Deprecated/Compose/background")
internal static let toolbarBackground = ColorAsset(name: "_Deprecated/Compose/toolbar.background")
}
}
} }
// swiftlint:enable identifier_name line_length nesting type_body_length type_name // swiftlint:enable identifier_name line_length nesting type_body_length type_name

View File

@ -950,7 +950,7 @@ internal enum L10n {
internal static let trueBlackDarkMode = L10n.tr("Localizable", "Scene.Settings.Section.AppearanceSettings.TrueBlackDarkMode") internal static let trueBlackDarkMode = L10n.tr("Localizable", "Scene.Settings.Section.AppearanceSettings.TrueBlackDarkMode")
} }
internal enum BoringZone { internal enum BoringZone {
/// Account settings /// Account Settings
internal static let accountSettings = L10n.tr("Localizable", "Scene.Settings.Section.BoringZone.AccountSettings") internal static let accountSettings = L10n.tr("Localizable", "Scene.Settings.Section.BoringZone.AccountSettings")
/// Privacy Policy /// Privacy Policy
internal static let privacy = L10n.tr("Localizable", "Scene.Settings.Section.BoringZone.Privacy") internal static let privacy = L10n.tr("Localizable", "Scene.Settings.Section.BoringZone.Privacy")

View File

@ -1,20 +0,0 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "232",
"green" : "225",
"red" : "217"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -1,38 +0,0 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xE8",
"green" : "0xE1",
"red" : "0xD9"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "34",
"green" : "27",
"red" : "25"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -1,38 +0,0 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xFE",
"green" : "0xFF",
"red" : "0xFE"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "55",
"green" : "44",
"red" : "40"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -1,38 +0,0 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xE8",
"green" : "0xE1",
"red" : "0xD9"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "67",
"green" : "53",
"red" : "49"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -5,9 +5,9 @@
"color-space" : "srgb", "color-space" : "srgb",
"components" : { "components" : {
"alpha" : "1.000", "alpha" : "1.000",
"blue" : "66", "blue" : "0.259",
"green" : "46", "green" : "0.180",
"red" : "163" "red" : "0.639"
} }
}, },
"idiom" : "universal" "idiom" : "universal"

View File

@ -5,9 +5,9 @@
"color-space" : "srgb", "color-space" : "srgb",
"components" : { "components" : {
"alpha" : "0.600", "alpha" : "0.600",
"blue" : "0", "blue" : "0.000",
"green" : "0", "green" : "0.000",
"red" : "0" "red" : "0.000"
} }
}, },
"idiom" : "universal" "idiom" : "universal"

View File

@ -1,38 +0,0 @@
{
"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" : "32",
"green" : "32",
"red" : "32"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -5,9 +5,9 @@
"color-space" : "srgb", "color-space" : "srgb",
"components" : { "components" : {
"alpha" : "1.000", "alpha" : "1.000",
"blue" : "254", "blue" : "0.871",
"green" : "255", "green" : "0.847",
"red" : "254" "red" : "0.839"
} }
}, },
"idiom" : "universal" "idiom" : "universal"
@ -23,9 +23,9 @@
"color-space" : "srgb", "color-space" : "srgb",
"components" : { "components" : {
"alpha" : "1.000", "alpha" : "1.000",
"blue" : "67", "blue" : "0.263",
"green" : "53", "green" : "0.208",
"red" : "49" "red" : "0.192"
} }
}, },
"idiom" : "universal" "idiom" : "universal"

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.871",
"green" : "0.847",
"red" : "0.839"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "0.920",
"blue" : "0.125",
"green" : "0.125",
"red" : "0.125"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -5,9 +5,9 @@
"color-space" : "srgb", "color-space" : "srgb",
"components" : { "components" : {
"alpha" : "1.000", "alpha" : "1.000",
"blue" : "90", "blue" : "0.353",
"green" : "64", "green" : "0.251",
"red" : "223" "red" : "0.875"
} }
}, },
"idiom" : "universal" "idiom" : "universal"

View File

@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.910",
"green" : "0.882",
"red" : "0.851"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -5,9 +5,9 @@
"color-space" : "srgb", "color-space" : "srgb",
"components" : { "components" : {
"alpha" : "1.000", "alpha" : "1.000",
"blue" : "232", "blue" : "0.996",
"green" : "225", "green" : "1.000",
"red" : "217" "red" : "0.996"
} }
}, },
"idiom" : "universal" "idiom" : "universal"
@ -23,9 +23,9 @@
"color-space" : "srgb", "color-space" : "srgb",
"components" : { "components" : {
"alpha" : "1.000", "alpha" : "1.000",
"blue" : "34", "blue" : "0.263",
"green" : "27", "green" : "0.208",
"red" : "25" "red" : "0.192"
} }
}, },
"idiom" : "universal" "idiom" : "universal"

View File

@ -5,9 +5,9 @@
"color-space" : "srgb", "color-space" : "srgb",
"components" : { "components" : {
"alpha" : "1.000", "alpha" : "1.000",
"blue" : "254", "blue" : "0.910",
"green" : "255", "green" : "0.882",
"red" : "254" "red" : "0.851"
} }
}, },
"idiom" : "universal" "idiom" : "universal"
@ -23,9 +23,9 @@
"color-space" : "srgb", "color-space" : "srgb",
"components" : { "components" : {
"alpha" : "1.000", "alpha" : "1.000",
"blue" : "0x37", "blue" : "0.133",
"green" : "0x2C", "green" : "0.106",
"red" : "0x28" "red" : "0.098"
} }
}, },
"idiom" : "universal" "idiom" : "universal"

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.996",
"green" : "1.000",
"red" : "0.996"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.216",
"green" : "0.173",
"red" : "0.157"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -23,9 +23,9 @@
"color-space" : "srgb", "color-space" : "srgb",
"components" : { "components" : {
"alpha" : "1.000", "alpha" : "1.000",
"blue" : "55", "blue" : "0.216",
"green" : "44", "green" : "0.173",
"red" : "40" "red" : "0.157"
} }
}, },
"idiom" : "universal" "idiom" : "universal"

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.910",
"green" : "0.882",
"red" : "0.851"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.133",
"green" : "0.106",
"red" : "0.098"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.996",
"green" : "1.000",
"red" : "0.996"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.216",
"green" : "0.173",
"red" : "0.157"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.910",
"green" : "0.882",
"red" : "0.851"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.263",
"green" : "0.208",
"red" : "0.192"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -23,9 +23,9 @@
"color-space" : "srgb", "color-space" : "srgb",
"components" : { "components" : {
"alpha" : "1.000", "alpha" : "1.000",
"blue" : "0x37", "blue" : "0.216",
"green" : "0x2C", "green" : "0.173",
"red" : "0x28" "red" : "0.157"
} }
}, },
"idiom" : "universal" "idiom" : "universal"

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.871",
"green" : "0.847",
"red" : "0.839"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "0.920",
"blue" : "0.125",
"green" : "0.125",
"red" : "0.125"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,9 @@
{
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"provides-namespace" : true
}
}

View File

@ -323,7 +323,7 @@ any server.";
"Scene.Settings.Section.Appearance.Title" = "Appearance"; "Scene.Settings.Section.Appearance.Title" = "Appearance";
"Scene.Settings.Section.AppearanceSettings.DisableAvatarAnimation" = "Disable animated avatars"; "Scene.Settings.Section.AppearanceSettings.DisableAvatarAnimation" = "Disable animated avatars";
"Scene.Settings.Section.AppearanceSettings.TrueBlackDarkMode" = "True black dark mode"; "Scene.Settings.Section.AppearanceSettings.TrueBlackDarkMode" = "True black dark mode";
"Scene.Settings.Section.BoringZone.AccountSettings" = "Account settings"; "Scene.Settings.Section.BoringZone.AccountSettings" = "Account Settings";
"Scene.Settings.Section.BoringZone.Privacy" = "Privacy Policy"; "Scene.Settings.Section.BoringZone.Privacy" = "Privacy Policy";
"Scene.Settings.Section.BoringZone.Terms" = "Terms of Service"; "Scene.Settings.Section.BoringZone.Terms" = "Terms of Service";
"Scene.Settings.Section.BoringZone.Title" = "The Boring Zone"; "Scene.Settings.Section.BoringZone.Title" = "The Boring Zone";

View File

@ -323,7 +323,7 @@ any server.";
"Scene.Settings.Section.Appearance.Title" = "Appearance"; "Scene.Settings.Section.Appearance.Title" = "Appearance";
"Scene.Settings.Section.AppearanceSettings.DisableAvatarAnimation" = "Disable animated avatars"; "Scene.Settings.Section.AppearanceSettings.DisableAvatarAnimation" = "Disable animated avatars";
"Scene.Settings.Section.AppearanceSettings.TrueBlackDarkMode" = "True black dark mode"; "Scene.Settings.Section.AppearanceSettings.TrueBlackDarkMode" = "True black dark mode";
"Scene.Settings.Section.BoringZone.AccountSettings" = "Account settings"; "Scene.Settings.Section.BoringZone.AccountSettings" = "Account Settings";
"Scene.Settings.Section.BoringZone.Privacy" = "Privacy Policy"; "Scene.Settings.Section.BoringZone.Privacy" = "Privacy Policy";
"Scene.Settings.Section.BoringZone.Terms" = "Terms of Service"; "Scene.Settings.Section.BoringZone.Terms" = "Terms of Service";
"Scene.Settings.Section.BoringZone.Title" = "The Boring Zone"; "Scene.Settings.Section.BoringZone.Title" = "The Boring Zone";

View File

@ -6,8 +6,11 @@
// //
import UIKit import UIKit
import Combine
final class AutoCompleteTopChevronView: UIView { final class AutoCompleteTopChevronView: UIView {
var disposeBag = Set<AnyCancellable>()
static let chevronSize = CGSize(width: 20, height: 12) static let chevronSize = CGSize(width: 20, height: 12)
@ -16,10 +19,10 @@ final class AutoCompleteTopChevronView: UIView {
private let maskLayer = CAShapeLayer() private let maskLayer = CAShapeLayer()
var chevronMinX: CGFloat = 0 var chevronMinX: CGFloat = 0
var topViewBackgroundColor = Asset.Scene.Compose.background.color { var topViewBackgroundColor = ThemeService.shared.currentTheme.value.systemElevatedBackgroundColor {
didSet { setNeedsLayout() } didSet { setNeedsLayout() }
} }
var bottomViewBackgroundColor = Asset.Colors.Background.systemBackground.color { var bottomViewBackgroundColor = ThemeService.shared.currentTheme.value.systemBackgroundColor {
didSet { setNeedsLayout() } didSet { setNeedsLayout() }
} }
@ -70,6 +73,15 @@ extension AutoCompleteTopChevronView {
shadowLayer.fillColor = topViewBackgroundColor.cgColor shadowLayer.fillColor = topViewBackgroundColor.cgColor
shadowView.layer.addSublayer(shadowLayer) shadowView.layer.addSublayer(shadowLayer)
setupBackgroundColor(theme: ThemeService.shared.currentTheme.value)
ThemeService.shared.currentTheme
.receive(on: DispatchQueue.main)
.sink { [weak self] theme in
guard let self = self else { return }
self.setupBackgroundColor(theme: theme)
}
.store(in: &disposeBag)
} }
override func layoutSubviews() { override func layoutSubviews() {
@ -114,6 +126,13 @@ extension AutoCompleteTopChevronView {
} }
extension AutoCompleteTopChevronView {
private func setupBackgroundColor(theme: Theme) {
topViewBackgroundColor = theme.systemElevatedBackgroundColor
bottomViewBackgroundColor = theme.systemBackgroundColor
}
}
extension AutoCompleteTopChevronView { extension AutoCompleteTopChevronView {
func invertMask(in rect: CGRect) -> CAShapeLayer { func invertMask(in rect: CGRect) -> CAShapeLayer {
let path = UIBezierPath() let path = UIBezierPath()
@ -153,7 +172,7 @@ struct AutoCompleteTopChevronView_Previews: PreviewProvider {
view.chevronMinX = 10 view.chevronMinX = 10
return view return view
} }
.background(Color(Asset.Scene.Compose.background.color)) .background(Color(ThemeService.shared.currentTheme.value.systemElevatedBackgroundColor))
.padding(20) .padding(20)
.previewLayout(.fixed(width: 375 + 40, height: 100 + 40)) .previewLayout(.fixed(width: 375 + 40, height: 100 + 40))
UIViewPreview(width: 375) { UIViewPreview(width: 375) {
@ -166,7 +185,7 @@ struct AutoCompleteTopChevronView_Previews: PreviewProvider {
view.chevronMinX = 10 view.chevronMinX = 10
return view return view
} }
.background(Color(Asset.Scene.Compose.background.color)) .background(Color(ThemeService.shared.currentTheme.value.systemElevatedBackgroundColor))
.preferredColorScheme(.dark) .preferredColorScheme(.dark)
.padding(20) .padding(20)
.previewLayout(.fixed(width: 375 + 40, height: 100 + 40)) .previewLayout(.fixed(width: 375 + 40, height: 100 + 40))

View File

@ -32,10 +32,10 @@ final class ComposeStatusAttachmentCollectionViewCell: UICollectionViewCell {
let image = UIImage(systemName: "minus")!.withConfiguration(UIImage.SymbolConfiguration(pointSize: 14, weight: .bold)) let image = UIImage(systemName: "minus")!.withConfiguration(UIImage.SymbolConfiguration(pointSize: 14, weight: .bold))
button.tintColor = .white button.tintColor = .white
button.setImage(image, for: .normal) button.setImage(image, for: .normal)
button.setBackgroundImage(.placeholder(color: Asset.Colors.Background.danger.color), for: .normal) button.setBackgroundImage(.placeholder(color: Asset.Colors.danger.color), for: .normal)
button.layer.masksToBounds = true button.layer.masksToBounds = true
button.layer.cornerRadius = ComposeStatusAttachmentCollectionViewCell.removeButtonSize.width * 0.5 button.layer.cornerRadius = ComposeStatusAttachmentCollectionViewCell.removeButtonSize.width * 0.5
button.layer.borderColor = Asset.Colors.Background.dangerBorder.color.cgColor button.layer.borderColor = Asset.Colors.dangerBorder.color.cgColor
button.layer.borderWidth = 1 button.layer.borderWidth = 1
return button return button
}() }()

View File

@ -76,11 +76,7 @@ final class ComposeViewController: UIViewController, NeedsDependency {
let composeToolbarView = ComposeToolbarView() let composeToolbarView = ComposeToolbarView()
var composeToolbarViewBottomLayoutConstraint: NSLayoutConstraint! var composeToolbarViewBottomLayoutConstraint: NSLayoutConstraint!
let composeToolbarBackgroundView: UIView = { let composeToolbarBackgroundView = UIView()
let view = UIView()
view.backgroundColor = Asset.Scene.Compose.toolbarBackground.color
return view
}()
static func createPhotoLibraryPickerConfiguration(selectionLimit: Int = 4) -> PHPickerConfiguration { static func createPhotoLibraryPickerConfiguration(selectionLimit: Int = 4) -> PHPickerConfiguration {
var configuration = PHPickerConfiguration() var configuration = PHPickerConfiguration()
@ -591,6 +587,7 @@ extension ComposeViewController {
private func setupBackgroundColor(theme: Theme) { private func setupBackgroundColor(theme: Theme) {
view.backgroundColor = theme.systemElevatedBackgroundColor view.backgroundColor = theme.systemElevatedBackgroundColor
tableView.backgroundColor = theme.systemElevatedBackgroundColor tableView.backgroundColor = theme.systemElevatedBackgroundColor
composeToolbarBackgroundView.backgroundColor = theme.composeToolbarBackgroundColor
} }
} }

View File

@ -88,7 +88,7 @@ extension ComposeStatusAttachmentTableViewCell {
guard let image = thumbnailImage else { guard let image = thumbnailImage else {
let placeholder = UIImage.placeholder( let placeholder = UIImage.placeholder(
size: size, size: size,
color: Asset.Colors.Background.systemGroupedBackground.color color: ThemeService.shared.currentTheme.value.systemGroupedBackgroundColor
) )
.af.imageRounded( .af.imageRounded(
withCornerRadius: AttachmentContainerView.containerViewCornerRadius withCornerRadius: AttachmentContainerView.containerViewCornerRadius

View File

@ -96,8 +96,15 @@ final class ComposeToolbarView: UIView {
extension ComposeToolbarView { extension ComposeToolbarView {
private func _init() { private func _init() {
backgroundColor = Asset.Scene.Compose.toolbarBackground.color setupBackgroundColor(theme: ThemeService.shared.currentTheme.value)
ThemeService.shared.currentTheme
.receive(on: DispatchQueue.main)
.sink { [weak self] theme in
guard let self = self else { return }
self.setupBackgroundColor(theme: theme)
}
.store(in: &disposeBag)
let stackView = UIStackView() let stackView = UIStackView()
stackView.axis = .horizontal stackView.axis = .horizontal
stackView.spacing = 0 stackView.spacing = 0
@ -212,6 +219,10 @@ extension ComposeToolbarView {
extension ComposeToolbarView { extension ComposeToolbarView {
private func setupBackgroundColor(theme: Theme) {
backgroundColor = theme.composeToolbarBackgroundColor
}
private static func configureToolbarButtonAppearance(button: UIButton) { private static func configureToolbarButtonAppearance(button: UIButton) {
button.tintColor = Asset.Colors.brandBlue.color button.tintColor = Asset.Colors.brandBlue.color
button.setBackgroundImage(.placeholder(size: ComposeToolbarView.toolbarButtonSize, color: .systemFill), for: .highlighted) button.setBackgroundImage(.placeholder(size: ComposeToolbarView.toolbarButtonSize, color: .systemFill), for: .highlighted)

View File

@ -114,7 +114,7 @@ extension HomeTimelineNavigationBarTitleView {
configureButton( configureButton(
title: L10n.Scene.HomeTimeline.NavigationBarState.offline, title: L10n.Scene.HomeTimeline.NavigationBarState.offline,
textColor: .white, textColor: .white,
backgroundColor: Asset.Colors.Background.danger.color backgroundColor: Asset.Colors.danger.color
) )
button.isHidden = false button.isHidden = false
case .publishingPostLabel: case .publishingPostLabel:

View File

@ -54,13 +54,13 @@ final class NotificationStatusTableViewCell: UITableViewCell, StatusCell {
let actionImageView: UIImageView = { let actionImageView: UIImageView = {
let imageView = UIImageView() let imageView = UIImageView()
imageView.contentMode = .center imageView.contentMode = .center
imageView.tintColor = Asset.Colors.Background.systemBackground.color imageView.tintColor = Asset.Theme.Mastodon.systemBackground.color
imageView.isOpaque = true imageView.isOpaque = true
imageView.layer.masksToBounds = true imageView.layer.masksToBounds = true
imageView.layer.cornerRadius = NotificationStatusTableViewCell.actionImageViewSize.width * 0.5 imageView.layer.cornerRadius = NotificationStatusTableViewCell.actionImageViewSize.width * 0.5
imageView.layer.cornerCurve = .circular imageView.layer.cornerCurve = .circular
imageView.layer.borderWidth = NotificationStatusTableViewCell.actionImageBorderWidth imageView.layer.borderWidth = NotificationStatusTableViewCell.actionImageBorderWidth
imageView.layer.borderColor = Asset.Colors.Background.systemBackground.color.cgColor imageView.layer.borderColor = Asset.Theme.Mastodon.systemBackground.color.cgColor
imageView.layer.shouldRasterize = true imageView.layer.shouldRasterize = true
imageView.layer.rasterizationScale = UIScreen.main.scale imageView.layer.rasterizationScale = UIScreen.main.scale
return imageView return imageView
@ -288,7 +288,7 @@ extension NotificationStatusTableViewCell {
super.traitCollectionDidChange(previousTraitCollection) super.traitCollectionDidChange(previousTraitCollection)
resetSeparatorLineLayout() resetSeparatorLineLayout()
avatarImageView.layer.borderColor = Asset.Colors.Background.systemBackground.color.cgColor avatarImageView.layer.borderColor = Asset.Theme.Mastodon.systemBackground.color.cgColor
statusContainerView.layer.borderColor = Asset.Colors.Border.notificationStatus.color.cgColor statusContainerView.layer.borderColor = Asset.Colors.Border.notificationStatus.color.cgColor
} }

View File

@ -115,7 +115,7 @@ extension MastodonPickServerViewController {
tableViewTopPaddingView.trailingAnchor.constraint(equalTo: view.trailingAnchor), tableViewTopPaddingView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
tableViewTopPaddingViewHeightLayoutConstraint, tableViewTopPaddingViewHeightLayoutConstraint,
]) ])
tableViewTopPaddingView.backgroundColor = Asset.Colors.Background.systemGroupedBackground.color tableViewTopPaddingView.backgroundColor = Asset.Theme.Mastodon.systemGroupedBackground.color
view.addSubview(tableView) view.addSubview(tableView)
NSLayoutConstraint.activate([ NSLayoutConstraint.activate([
@ -422,7 +422,7 @@ extension MastodonPickServerViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let headerView = UIView() let headerView = UIView()
headerView.backgroundColor = Asset.Colors.Background.systemGroupedBackground.color headerView.backgroundColor = Asset.Theme.Mastodon.systemGroupedBackground.color
return headerView return headerView
} }

View File

@ -55,7 +55,7 @@ extension PickServerCategoriesCell {
private func _init() { private func _init() {
selectionStyle = .none selectionStyle = .none
backgroundColor = Asset.Colors.Background.systemGroupedBackground.color backgroundColor = Asset.Theme.Mastodon.systemGroupedBackground.color
metricView.translatesAutoresizingMaskIntoConstraints = false metricView.translatesAutoresizingMaskIntoConstraints = false
contentView.addSubview(metricView) contentView.addSubview(metricView)

View File

@ -27,7 +27,7 @@ class PickServerCell: UITableViewCell {
let containerView: UIView = { let containerView: UIView = {
let view = UIView() let view = UIView()
view.layoutMargins = UIEdgeInsets(top: 16, left: 16, bottom: 10, right: 16) view.layoutMargins = UIEdgeInsets(top: 16, left: 16, bottom: 10, right: 16)
view.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color view.backgroundColor = Asset.Theme.Mastodon.secondaryGroupedSystemBackground.color
view.translatesAutoresizingMaskIntoConstraints = false view.translatesAutoresizingMaskIntoConstraints = false
return view return view
}() }()
@ -101,7 +101,7 @@ class PickServerCell: UITableViewCell {
let separator: UIView = { let separator: UIView = {
let view = UIView() let view = UIView()
view.backgroundColor = Asset.Colors.Background.systemGroupedBackground.color view.backgroundColor = Asset.Theme.Mastodon.systemGroupedBackground.color
view.translatesAutoresizingMaskIntoConstraints = false view.translatesAutoresizingMaskIntoConstraints = false
return view return view
}() }()

View File

@ -13,14 +13,14 @@ final class PickServerLoaderTableViewCell: TimelineLoaderTableViewCell {
let containerView: UIView = { let containerView: UIView = {
let view = UIView() let view = UIView()
view.layoutMargins = UIEdgeInsets(top: 16, left: 16, bottom: 10, right: 16) view.layoutMargins = UIEdgeInsets(top: 16, left: 16, bottom: 10, right: 16)
view.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color view.backgroundColor = Asset.Theme.Mastodon.secondaryGroupedSystemBackground.color
view.translatesAutoresizingMaskIntoConstraints = false view.translatesAutoresizingMaskIntoConstraints = false
return view return view
}() }()
let seperator: UIView = { let seperator: UIView = {
let view = UIView() let view = UIView()
view.backgroundColor = Asset.Colors.Background.systemGroupedBackground.color view.backgroundColor = Asset.Theme.Mastodon.systemGroupedBackground.color
view.translatesAutoresizingMaskIntoConstraints = false view.translatesAutoresizingMaskIntoConstraints = false
return view return view
}() }()

View File

@ -17,7 +17,7 @@ class PickServerSearchCell: UITableViewCell {
private var bgView: UIView = { private var bgView: UIView = {
let view = UIView() let view = UIView()
view.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color view.backgroundColor = Asset.Theme.Mastodon.secondaryGroupedSystemBackground.color
view.translatesAutoresizingMaskIntoConstraints = false view.translatesAutoresizingMaskIntoConstraints = false
view.layer.maskedCorners = [ view.layer.maskedCorners = [
.layerMinXMinYCorner, .layerMinXMinYCorner,
@ -108,7 +108,7 @@ class PickServerSearchCell: UITableViewCell {
extension PickServerSearchCell { extension PickServerSearchCell {
private func _init() { private func _init() {
selectionStyle = .none selectionStyle = .none
backgroundColor = Asset.Colors.Background.systemGroupedBackground.color backgroundColor = Asset.Theme.Mastodon.systemGroupedBackground.color
searchTextField.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged) searchTextField.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged)
searchTextField.delegate = self searchTextField.delegate = self

View File

@ -35,7 +35,7 @@ extension PickServerTitleCell {
private func _init() { private func _init() {
selectionStyle = .none selectionStyle = .none
backgroundColor = Asset.Colors.Background.systemGroupedBackground.color backgroundColor = Asset.Theme.Mastodon.systemBackground.color
contentView.addSubview(titleLabel) contentView.addSubview(titleLabel)
NSLayoutConstraint.activate([ NSLayoutConstraint.activate([

View File

@ -48,7 +48,7 @@ extension PickServerCategoryView {
addSubview(bgView) addSubview(bgView)
addSubview(titleLabel) addSubview(titleLabel)
bgView.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color bgView.backgroundColor = Asset.Theme.Mastodon.secondaryGroupedSystemBackground.color
NSLayoutConstraint.activate([ NSLayoutConstraint.activate([
bgView.leadingAnchor.constraint(equalTo: self.leadingAnchor), bgView.leadingAnchor.constraint(equalTo: self.leadingAnchor),

View File

@ -44,7 +44,7 @@ final class PickServerEmptyStateView: UIView {
extension PickServerEmptyStateView { extension PickServerEmptyStateView {
private func _init() { private func _init() {
backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color backgroundColor = Asset.Theme.Mastodon.secondaryGroupedSystemBackground.color
layer.maskedCorners = [ layer.maskedCorners = [
.layerMinXMaxYCorner, .layerMinXMaxYCorner,
.layerMaxXMaxYCorner .layerMaxXMaxYCorner

View File

@ -84,7 +84,7 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O
button.setImage(image?.withRenderingMode(UIImage.RenderingMode.alwaysTemplate), for: UIControl.State.normal) button.setImage(image?.withRenderingMode(UIImage.RenderingMode.alwaysTemplate), for: UIControl.State.normal)
button.imageView?.tintColor = Asset.Colors.Label.secondary.color button.imageView?.tintColor = Asset.Colors.Label.secondary.color
button.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color button.backgroundColor = Asset.Theme.Mastodon.secondaryGroupedSystemBackground.color
button.layer.cornerRadius = 10 button.layer.cornerRadius = 10
button.clipsToBounds = true button.clipsToBounds = true
@ -99,7 +99,7 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O
icon.backgroundColor = UIColor(dynamicProvider: { collection in icon.backgroundColor = UIColor(dynamicProvider: { collection in
switch collection.userInterfaceStyle { switch collection.userInterfaceStyle {
case .dark: case .dark:
return Asset.Colors.Background.secondaryGroupedSystemBackground.color return Asset.Theme.Mastodon.secondaryGroupedSystemBackground.color
default: default:
return .white return .white
} }
@ -119,7 +119,7 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O
textField.returnKeyType = .next textField.returnKeyType = .next
textField.autocapitalizationType = .none textField.autocapitalizationType = .none
textField.autocorrectionType = .no textField.autocorrectionType = .no
textField.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color textField.backgroundColor = Asset.Theme.Mastodon.secondaryGroupedSystemBackground.color
textField.textColor = Asset.Colors.Label.primary.color textField.textColor = Asset.Colors.Label.primary.color
textField.attributedPlaceholder = NSAttributedString(string: L10n.Scene.Register.Input.Username.placeholder, textField.attributedPlaceholder = NSAttributedString(string: L10n.Scene.Register.Input.Username.placeholder,
attributes: [NSAttributedString.Key.foregroundColor: Asset.Colors.Label.secondary.color, attributes: [NSAttributedString.Key.foregroundColor: Asset.Colors.Label.secondary.color,
@ -170,7 +170,7 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O
textField.returnKeyType = .next textField.returnKeyType = .next
textField.autocapitalizationType = .none textField.autocapitalizationType = .none
textField.autocorrectionType = .no textField.autocorrectionType = .no
textField.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color textField.backgroundColor = Asset.Theme.Mastodon.secondaryGroupedSystemBackground.color
textField.textColor = Asset.Colors.Label.primary.color textField.textColor = Asset.Colors.Label.primary.color
textField.attributedPlaceholder = NSAttributedString(string: L10n.Scene.Register.Input.DisplayName.placeholder, textField.attributedPlaceholder = NSAttributedString(string: L10n.Scene.Register.Input.DisplayName.placeholder,
attributes: [NSAttributedString.Key.foregroundColor: Asset.Colors.Label.secondary.color, attributes: [NSAttributedString.Key.foregroundColor: Asset.Colors.Label.secondary.color,
@ -189,7 +189,7 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O
textField.autocapitalizationType = .none textField.autocapitalizationType = .none
textField.autocorrectionType = .no textField.autocorrectionType = .no
textField.keyboardType = .emailAddress textField.keyboardType = .emailAddress
textField.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color textField.backgroundColor = Asset.Theme.Mastodon.secondaryGroupedSystemBackground.color
textField.textColor = Asset.Colors.Label.primary.color textField.textColor = Asset.Colors.Label.primary.color
textField.attributedPlaceholder = NSAttributedString(string: L10n.Scene.Register.Input.Email.placeholder, textField.attributedPlaceholder = NSAttributedString(string: L10n.Scene.Register.Input.Email.placeholder,
attributes: [NSAttributedString.Key.foregroundColor: Asset.Colors.Label.secondary.color, attributes: [NSAttributedString.Key.foregroundColor: Asset.Colors.Label.secondary.color,
@ -216,7 +216,7 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O
textField.autocorrectionType = .no textField.autocorrectionType = .no
textField.keyboardType = .asciiCapable textField.keyboardType = .asciiCapable
textField.isSecureTextEntry = true textField.isSecureTextEntry = true
textField.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color textField.backgroundColor = Asset.Theme.Mastodon.secondaryGroupedSystemBackground.color
textField.textColor = Asset.Colors.Label.primary.color textField.textColor = Asset.Colors.Label.primary.color
textField.attributedPlaceholder = NSAttributedString(string: L10n.Scene.Register.Input.Password.placeholder, textField.attributedPlaceholder = NSAttributedString(string: L10n.Scene.Register.Input.Password.placeholder,
attributes: [NSAttributedString.Key.foregroundColor: Asset.Colors.Label.secondary.color, attributes: [NSAttributedString.Key.foregroundColor: Asset.Colors.Label.secondary.color,
@ -248,7 +248,7 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O
textField.returnKeyType = .next // set to "Return" depends on if the last input field or not textField.returnKeyType = .next // set to "Return" depends on if the last input field or not
textField.autocapitalizationType = .none textField.autocapitalizationType = .none
textField.autocorrectionType = .no textField.autocorrectionType = .no
textField.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color textField.backgroundColor = Asset.Theme.Mastodon.secondaryGroupedSystemBackground.color
textField.textColor = Asset.Colors.Label.primary.color textField.textColor = Asset.Colors.Label.primary.color
textField.attributedPlaceholder = NSAttributedString(string: L10n.Scene.Register.Input.Invite.registrationUserInviteRequest, textField.attributedPlaceholder = NSAttributedString(string: L10n.Scene.Register.Input.Invite.registrationUserInviteRequest,
attributes: [NSAttributedString.Key.foregroundColor: Asset.Colors.Label.secondary.color, attributes: [NSAttributedString.Key.foregroundColor: Asset.Colors.Label.secondary.color,

View File

@ -49,7 +49,7 @@ final class MastodonServerRulesViewController: UIViewController, NeedsDependency
let bottomContainerView: UIView = { let bottomContainerView: UIView = {
let view = UIView() let view = UIView()
view.backgroundColor = Asset.Colors.Background.systemGroupedBackground.color view.backgroundColor = Asset.Theme.Mastodon.systemGroupedBackground.color
return view return view
}() }()
@ -60,7 +60,7 @@ final class MastodonServerRulesViewController: UIViewController, NeedsDependency
textView.isSelectable = true textView.isSelectable = true
textView.isEditable = false textView.isEditable = false
textView.isScrollEnabled = false textView.isScrollEnabled = false
textView.backgroundColor = Asset.Colors.Background.systemGroupedBackground.color textView.backgroundColor = Asset.Theme.Mastodon.systemGroupedBackground.color
return textView return textView
}() }()

View File

@ -20,7 +20,7 @@ extension OnboardingViewControllerAppearance {
static var viewBottomPaddingHeight: CGFloat { return 11 } static var viewBottomPaddingHeight: CGFloat { return 11 }
func setupOnboardingAppearance() { func setupOnboardingAppearance() {
view.backgroundColor = Asset.Colors.Background.systemGroupedBackground.color view.backgroundColor = Asset.Theme.Mastodon.systemGroupedBackground.color
setupNavigationBarAppearance() setupNavigationBarAppearance()
@ -42,7 +42,7 @@ extension OnboardingViewControllerAppearance {
func setupNavigationBarBackgroundView() { func setupNavigationBarBackgroundView() {
let navigationBarBackgroundView: UIView = { let navigationBarBackgroundView: UIView = {
let view = UIView() let view = UIView()
view.backgroundColor = Asset.Colors.Background.systemGroupedBackground.color view.backgroundColor = Asset.Theme.Mastodon.systemGroupedBackground.color
return view return view
}() }()

View File

@ -76,7 +76,7 @@ final class ProfileHeaderView: UIView {
let avatarImageView: UIImageView = { let avatarImageView: UIImageView = {
let imageView = FLAnimatedImageView() let imageView = FLAnimatedImageView()
let placeholderImage = UIImage let placeholderImage = UIImage
.placeholder(size: ProfileHeaderView.avatarImageViewSize, color: Asset.Colors.Background.systemGroupedBackground.color) .placeholder(size: ProfileHeaderView.avatarImageViewSize, color: Asset.Theme.Mastodon.systemGroupedBackground.color)
.af.imageRounded(withCornerRadius: ProfileHeaderView.avatarImageViewCornerRadius, divideRadiusByImageScale: false) .af.imageRounded(withCornerRadius: ProfileHeaderView.avatarImageViewCornerRadius, divideRadiusByImageScale: false)
imageView.image = placeholderImage imageView.image = placeholderImage
return imageView return imageView

View File

@ -441,9 +441,9 @@ extension ProfileViewModel {
case .request: return Asset.Colors.brandBlue.color case .request: return Asset.Colors.brandBlue.color
case .pending: return Asset.Colors.brandBlue.color case .pending: return Asset.Colors.brandBlue.color
case .following: return Asset.Colors.brandBlue.color case .following: return Asset.Colors.brandBlue.color
case .muting: return Asset.Colors.Background.alertYellow.color case .muting: return Asset.Colors.alertYellow.color
case .blocked: return Asset.Colors.brandBlue.color case .blocked: return Asset.Colors.brandBlue.color
case .blocking: return Asset.Colors.Background.danger.color case .blocking: return Asset.Colors.danger.color
case .suspended: return Asset.Colors.brandBlue.color case .suspended: return Asset.Colors.brandBlue.color
case .edit: return Asset.Colors.brandBlue.color case .edit: return Asset.Colors.brandBlue.color
case .editing: return Asset.Colors.brandBlue.color case .editing: return Asset.Colors.brandBlue.color

View File

@ -63,7 +63,7 @@ extension PlayerContainerView {
extension PlayerContainerView.MediaTypeIndicatorView { extension PlayerContainerView.MediaTypeIndicatorView {
private func _init() { private func _init() {
backgroundColor = Asset.Colors.Background.mediaTypeIndicotor.color backgroundColor = Asset.Colors.mediaTypeIndicotor.color
layoutMargins = UIEdgeInsets(top: 3, left: 13, bottom: 0, right: 6) layoutMargins = UIEdgeInsets(top: 3, left: 13, bottom: 0, right: 6)
addSubview(label) addSubview(label)

View File

@ -29,7 +29,8 @@ final class PollOptionView: UIView {
let checkmarkBackgroundView: UIView = { let checkmarkBackgroundView: UIView = {
let view = UIView() let view = UIView()
view.backgroundColor = Asset.Colors.Background.tertiarySystemBackground.color // FIXME: missing update trigger
view.backgroundColor = ThemeService.shared.currentTheme.value.tertiarySystemBackgroundColor
return view return view
}() }()

View File

@ -58,7 +58,6 @@ extension ThreadReplyLoaderTableViewCell {
func _init() { func _init() {
selectionStyle = .none selectionStyle = .none
backgroundColor = Asset.Colors.Background.systemGroupedBackground.color
loadMoreButton.translatesAutoresizingMaskIntoConstraints = false loadMoreButton.translatesAutoresizingMaskIntoConstraints = false
contentView.addSubview(loadMoreButton) contentView.addSubview(loadMoreButton)
@ -124,7 +123,7 @@ extension ThreadReplyLoaderTableViewCell {
} }
private func setupBackgroundColor(theme: Theme) { private func setupBackgroundColor(theme: Theme) {
loadMoreButton.backgroundColor = theme.secondarySystemGroupedBackgroundColor backgroundColor = theme.systemGroupedBackgroundColor
} }
} }

View File

@ -32,7 +32,7 @@ class SuggestionAccountViewController: UIViewController, NeedsDependency {
lazy var tableHeader: UIView = { lazy var tableHeader: UIView = {
let view = UIView() let view = UIView()
view.backgroundColor = Asset.Colors.Background.systemGroupedBackground.color view.backgroundColor = ThemeService.shared.currentTheme.value.systemGroupedBackgroundColor
view.frame = CGRect(origin: .zero, size: CGSize(width: tableView.frame.width, height: 156)) view.frame = CGRect(origin: .zero, size: CGSize(width: tableView.frame.width, height: 156))
return view return view
}() }()
@ -67,12 +67,12 @@ extension SuggestionAccountViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = ThemeService.shared.currentTheme.value.systemBackgroundColor setupBackgroundColor(theme: ThemeService.shared.currentTheme.value)
ThemeService.shared.currentTheme ThemeService.shared.currentTheme
.receive(on: RunLoop.main) .receive(on: RunLoop.main)
.sink { [weak self] theme in .sink { [weak self] theme in
guard let self = self else { return } guard let self = self else { return }
self.view.backgroundColor = theme.systemBackgroundColor self.setupBackgroundColor(theme: theme)
} }
.store(in: &disposeBag) .store(in: &disposeBag)
@ -146,6 +146,11 @@ extension SuggestionAccountViewController {
tableView.tableHeaderView = tableHeader tableView.tableHeaderView = tableHeader
} }
private func setupBackgroundColor(theme: Theme) {
view.backgroundColor = theme.systemBackgroundColor
tableHeader.backgroundColor = theme.systemGroupedBackgroundColor
}
} }
extension SuggestionAccountViewController: UICollectionViewDelegateFlowLayout { extension SuggestionAccountViewController: UICollectionViewDelegateFlowLayout {

View File

@ -33,4 +33,5 @@ struct MastodonTheme: Theme {
let contentWarningOverlayBackgroundColor = Asset.Theme.Mastodon.contentWarningOverlayBackground.color let contentWarningOverlayBackgroundColor = Asset.Theme.Mastodon.contentWarningOverlayBackground.color
let profileFieldCollectionViewBackgroundColor = Asset.Theme.Mastodon.profileFieldCollectionViewBackground.color let profileFieldCollectionViewBackgroundColor = Asset.Theme.Mastodon.profileFieldCollectionViewBackground.color
let composeToolbarBackgroundColor = Asset.Theme.Mastodon.composeToolbarBackground.color
} }

View File

@ -33,4 +33,5 @@ struct SystemTheme: Theme {
let contentWarningOverlayBackgroundColor = Asset.Theme.System.contentWarningOverlayBackground.color let contentWarningOverlayBackgroundColor = Asset.Theme.System.contentWarningOverlayBackground.color
let profileFieldCollectionViewBackgroundColor = Asset.Theme.System.profileFieldCollectionViewBackground.color let profileFieldCollectionViewBackgroundColor = Asset.Theme.System.profileFieldCollectionViewBackground.color
let composeToolbarBackgroundColor = Asset.Theme.System.composeToolbarBackground.color
} }

View File

@ -8,6 +8,7 @@
import UIKit import UIKit
public protocol Theme { public protocol Theme {
var systemBackgroundColor: UIColor { get } var systemBackgroundColor: UIColor { get }
var secondarySystemBackgroundColor: UIColor { get } var secondarySystemBackgroundColor: UIColor { get }
var tertiarySystemBackgroundColor: UIColor { get } var tertiarySystemBackgroundColor: UIColor { get }
@ -33,6 +34,7 @@ public protocol Theme {
var contentWarningOverlayBackgroundColor: UIColor { get } var contentWarningOverlayBackgroundColor: UIColor { get }
var profileFieldCollectionViewBackgroundColor: UIColor { get } var profileFieldCollectionViewBackgroundColor: UIColor { get }
var composeToolbarBackgroundColor: UIColor { get }
} }

View File

@ -49,11 +49,7 @@ class ShareViewController: UIViewController {
let viewSafeAreaDidChange = PassthroughSubject<Void, Never>() let viewSafeAreaDidChange = PassthroughSubject<Void, Never>()
let composeToolbarView = ComposeToolbarView() let composeToolbarView = ComposeToolbarView()
var composeToolbarViewBottomLayoutConstraint: NSLayoutConstraint! var composeToolbarViewBottomLayoutConstraint: NSLayoutConstraint!
let composeToolbarBackgroundView: UIView = { let composeToolbarBackgroundView = UIView()
let view = UIView()
view.backgroundColor = Asset.Scene.Compose.toolbarBackground.color
return view
}()
} }
extension ShareViewController { extension ShareViewController {
@ -61,7 +57,16 @@ extension ShareViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Asset.Colors.Background.systemBackground.color navigationController?.presentationController?.delegate = self
setupBackgroundColor(theme: ThemeService.shared.currentTheme.value)
ThemeService.shared.currentTheme
.receive(on: DispatchQueue.main)
.sink { [weak self] theme in
guard let self = self else { return }
self.setupBackgroundColor(theme: theme)
}
.store(in: &disposeBag)
navigationItem.leftBarButtonItem = cancelBarButtonItem navigationItem.leftBarButtonItem = cancelBarButtonItem
viewModel.isBusy viewModel.isBusy
@ -203,10 +208,37 @@ extension ShareViewController {
} }
extension ShareViewController {
private func setupBackgroundColor(theme: Theme) {
view.backgroundColor = theme.systemElevatedBackgroundColor
viewModel.composeViewModel.backgroundColor = theme.systemElevatedBackgroundColor
composeToolbarBackgroundView.backgroundColor = theme.composeToolbarBackgroundColor
let barAppearance = UINavigationBarAppearance()
barAppearance.configureWithDefaultBackground()
barAppearance.backgroundColor = theme.navigationBarBackgroundColor
navigationItem.standardAppearance = barAppearance
navigationItem.compactAppearance = barAppearance
navigationItem.scrollEdgeAppearance = barAppearance
}
private func showDismissConfirmAlertController() {
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) // can not use alert in extension
let discardAction = UIAlertAction(title: L10n.Common.Controls.Actions.discard, style: .destructive) { _ in
self.extensionContext?.cancelRequest(withError: ShareViewModel.ShareError.userCancelShare)
}
alertController.addAction(discardAction)
let okAction = UIAlertAction(title: L10n.Common.Controls.Actions.ok, style: .cancel, handler: nil)
alertController.addAction(okAction)
self.present(alertController, animated: true, completion: nil)
}
}
extension ShareViewController { extension ShareViewController {
@objc private func cancelBarButtonItemPressed(_ sender: UIBarButtonItem) { @objc private func cancelBarButtonItemPressed(_ sender: UIBarButtonItem) {
logger.debug("\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") logger.debug("\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)")
extensionContext?.cancelRequest(withError: ShareViewModel.ShareError.userCancelShare)
showDismissConfirmAlertController()
} }
@objc private func publishBarButtonItemPressed(_ sender: UIBarButtonItem) { @objc private func publishBarButtonItemPressed(_ sender: UIBarButtonItem) {
@ -267,5 +299,23 @@ extension ShareViewController: ComposeToolbarViewDelegate {
viewModel.selectedStatusVisibility.value = type viewModel.selectedStatusVisibility.value = type
} }
}
// MARK: - UIAdaptivePresentationControllerDelegate
extension ShareViewController: UIAdaptivePresentationControllerDelegate {
func presentationControllerShouldDismiss(_ presentationController: UIPresentationController) -> Bool {
return viewModel.shouldDismiss.value
}
func presentationControllerDidAttemptToDismiss(_ presentationController: UIPresentationController) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
showDismissConfirmAlertController()
}
func presentationControllerDidDismiss(_ presentationController: UIPresentationController) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
}
} }

View File

@ -37,6 +37,7 @@ final class ShareViewModel {
let isPublishing = CurrentValueSubject<Bool, Never>(false) let isPublishing = CurrentValueSubject<Bool, Never>(false)
let isBusy = CurrentValueSubject<Bool, Never>(true) let isBusy = CurrentValueSubject<Bool, Never>(true)
let isValid = CurrentValueSubject<Bool, Never>(false) let isValid = CurrentValueSubject<Bool, Never>(false)
let shouldDismiss = CurrentValueSubject<Bool, Never>(true)
let composeViewModel = ComposeViewModel() let composeViewModel = ComposeViewModel()
let characterCount = CurrentValueSubject<Int, Never>(0) let characterCount = CurrentValueSubject<Int, Never>(0)
@ -134,6 +135,11 @@ final class ShareViewModel {
// bind compose bar button item UI state // bind compose bar button item UI state
let isComposeContentEmpty = composeViewModel.$statusContent let isComposeContentEmpty = composeViewModel.$statusContent
.map { $0.isEmpty } .map { $0.isEmpty }
isComposeContentEmpty
.assign(to: \.value, on: shouldDismiss)
.store(in: &disposeBag)
let isComposeContentValid = composeViewModel.$characterCount let isComposeContentValid = composeViewModel.$characterCount
.map { characterCount -> Bool in .map { characterCount -> Bool in
return characterCount <= ShareViewModel.composeContentLimit return characterCount <= ShareViewModel.composeContentLimit

View File

@ -67,7 +67,14 @@ final class ComposeToolbarView: UIView {
extension ComposeToolbarView { extension ComposeToolbarView {
private func _init() { private func _init() {
backgroundColor = Asset.Scene.Compose.toolbarBackground.color setupBackgroundColor(theme: ThemeService.shared.currentTheme.value)
ThemeService.shared.currentTheme
.receive(on: DispatchQueue.main)
.sink { [weak self] theme in
guard let self = self else { return }
self.setupBackgroundColor(theme: theme)
}
.store(in: &disposeBag)
let stackView = UIStackView() let stackView = UIStackView()
stackView.axis = .horizontal stackView.axis = .horizontal
@ -127,6 +134,12 @@ extension ComposeToolbarView {
} }
extension ComposeToolbarView {
private func setupBackgroundColor(theme: Theme) {
backgroundColor = theme.composeToolbarBackgroundColor
}
}
extension ComposeToolbarView { extension ComposeToolbarView {
enum MediaSelectionType: String { enum MediaSelectionType: String {
case camera case camera

View File

@ -29,7 +29,7 @@ public struct ComposeView: View {
.padding(EdgeInsets(top: 6, leading: horizontalMargin, bottom: 6, trailing: horizontalMargin)) .padding(EdgeInsets(top: 6, leading: horizontalMargin, bottom: 6, trailing: horizontalMargin))
.background(viewModel.contentWarningBackgroundColor) .background(viewModel.contentWarningBackgroundColor)
.transition(.opacity) .transition(.opacity)
.listRow() .listRow(backgroundColor: Color(viewModel.backgroundColor))
} }
// Author // Author
@ -39,7 +39,7 @@ public struct ComposeView: View {
username: viewModel.authorUsername username: viewModel.authorUsername
) )
.padding(EdgeInsets(top: 20, leading: horizontalMargin, bottom: 16, trailing: horizontalMargin)) .padding(EdgeInsets(top: 20, leading: horizontalMargin, bottom: 16, trailing: horizontalMargin))
.listRow() .listRow(backgroundColor: Color(viewModel.backgroundColor))
// Editor // Editor
StatusEditorView( StatusEditorView(
@ -53,7 +53,7 @@ public struct ComposeView: View {
.frame(width: statusEditorViewWidth) .frame(width: statusEditorViewWidth)
.frame(minHeight: 100) .frame(minHeight: 100)
.padding(EdgeInsets(top: 0, leading: horizontalMargin, bottom: 0, trailing: horizontalMargin)) .padding(EdgeInsets(top: 0, leading: horizontalMargin, bottom: 0, trailing: horizontalMargin))
.listRow() .listRow(backgroundColor: Color(viewModel.backgroundColor))
// Attachments // Attachments
ForEach(viewModel.attachmentViewModels) { attachmentViewModel in ForEach(viewModel.attachmentViewModels) { attachmentViewModel in
@ -78,12 +78,12 @@ public struct ComposeView: View {
} }
.padding(EdgeInsets(top: 16, leading: horizontalMargin, bottom: 0, trailing: horizontalMargin)) .padding(EdgeInsets(top: 16, leading: horizontalMargin, bottom: 0, trailing: horizontalMargin))
.fixedSize(horizontal: false, vertical: true) .fixedSize(horizontal: false, vertical: true)
.listRow() .listRow(backgroundColor: Color(viewModel.backgroundColor))
// bottom padding // bottom padding
Color.clear Color.clear
.frame(height: viewModel.toolbarHeight + 20) .frame(height: viewModel.toolbarHeight + 20)
.listRow() .listRow(backgroundColor: Color(viewModel.backgroundColor))
} // end List } // end List
.introspectTableView(customize: { tableView in .introspectTableView(customize: { tableView in
// tableView.keyboardDismissMode = .onDrag // tableView.keyboardDismissMode = .onDrag
@ -97,9 +97,13 @@ public struct ComposeView: View {
var frame = frame var frame = frame
frame.size.width = frame.width - 2 * horizontalMargin frame.size.width = frame.width - 2 * horizontalMargin
statusEditorViewWidth = frame.width statusEditorViewWidth = frame.width
} } // end List
} .introspectTableView(customize: { tableView in
} tableView.backgroundColor = .clear
})
.background(Color(viewModel.backgroundColor).ignoresSafeArea())
} // end GeometryReader
} // end body
} }
struct ComposeListViewFramePreferenceKey: PreferenceKey { struct ComposeListViewFramePreferenceKey: PreferenceKey {
@ -108,10 +112,10 @@ struct ComposeListViewFramePreferenceKey: PreferenceKey {
} }
extension View { extension View {
func listRow() -> some View { func listRow(backgroundColor: Color) -> some View {
self.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .leading) self.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .leading)
.listRowInsets(EdgeInsets(top: -1, leading: -1, bottom: -1, trailing: -1)) .listRowInsets(EdgeInsets(top: -1, leading: -1, bottom: -1, trailing: -1))
.background(Color(.systemBackground)) .background(backgroundColor)
} }
} }

View File

@ -16,6 +16,7 @@ class ComposeViewModel: ObservableObject {
@Published var authentication: MastodonAuthentication? @Published var authentication: MastodonAuthentication?
@Published var backgroundColor: UIColor = .clear
@Published var toolbarHeight: CGFloat = 0 @Published var toolbarHeight: CGFloat = 0
@Published var viewDidAppear = false @Published var viewDidAppear = false

View File

@ -43,6 +43,7 @@ public struct StatusEditorView: UIViewRepresentable {
textView.textColor = .label textView.textColor = .label
textView.keyboardType = keyboardType textView.keyboardType = keyboardType
textView.delegate = context.coordinator textView.delegate = context.coordinator
textView.backgroundColor = .clear
textView.translatesAutoresizingMaskIntoConstraints = false textView.translatesAutoresizingMaskIntoConstraints = false
let widthLayoutConstraint = textView.widthAnchor.constraint(equalToConstant: 100) let widthLayoutConstraint = textView.widthAnchor.constraint(equalToConstant: 100)