Cloud themes improvements

This commit is contained in:
Ilya Laktyushin
2019-08-29 05:31:34 +03:00
parent 4ac24e4369
commit f3db3a29b0
64 changed files with 3452 additions and 3048 deletions

View File

@@ -140,12 +140,14 @@ public final class PresentationThemeRootController {
public let tabBar: PresentationThemeRootTabBar
public let navigationBar: PresentationThemeRootNavigationBar
public let navigationSearchBar: PresentationThemeNavigationSearchBar
public let keyboardColor: PresentationThemeKeyboardColor
public init(statusBarStyle: PresentationThemeStatusBarStyle, tabBar: PresentationThemeRootTabBar, navigationBar: PresentationThemeRootNavigationBar, navigationSearchBar: PresentationThemeNavigationSearchBar) {
public init(statusBarStyle: PresentationThemeStatusBarStyle, tabBar: PresentationThemeRootTabBar, navigationBar: PresentationThemeRootNavigationBar, navigationSearchBar: PresentationThemeNavigationSearchBar, keyboardColor: PresentationThemeKeyboardColor) {
self.statusBarStyle = statusBarStyle
self.tabBar = tabBar
self.navigationBar = navigationBar
self.navigationSearchBar = navigationSearchBar
self.keyboardColor = keyboardColor
}
}
@@ -397,7 +399,6 @@ public final class PresentationThemeChatList {
public let regularSearchBarColor: UIColor
public let sectionHeaderFillColor: UIColor
public let sectionHeaderTextColor: UIColor
public let searchBarKeyboardColor: PresentationThemeKeyboardColor
public let verifiedIconFillColor: UIColor
public let verifiedIconForegroundColor: UIColor
public let secretIconColor: UIColor
@@ -405,7 +406,7 @@ public final class PresentationThemeChatList {
public let unpinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors
public let onlineDotColor: UIColor
init(backgroundColor: UIColor, itemSeparatorColor: UIColor, itemBackgroundColor: UIColor, pinnedItemBackgroundColor: UIColor, itemHighlightedBackgroundColor: UIColor, itemSelectedBackgroundColor: UIColor, titleColor: UIColor, secretTitleColor: UIColor, dateTextColor: UIColor, authorNameColor: UIColor, messageTextColor: UIColor, messageDraftTextColor: UIColor, checkmarkColor: UIColor, pendingIndicatorColor: UIColor, failedFillColor: UIColor, failedForegroundColor: UIColor, muteIconColor: UIColor, unreadBadgeActiveBackgroundColor: UIColor, unreadBadgeActiveTextColor: UIColor, unreadBadgeInactiveBackgroundColor: UIColor, unreadBadgeInactiveTextColor: UIColor, pinnedBadgeColor: UIColor, pinnedSearchBarColor: UIColor, regularSearchBarColor: UIColor, sectionHeaderFillColor: UIColor, sectionHeaderTextColor: UIColor, searchBarKeyboardColor: PresentationThemeKeyboardColor, verifiedIconFillColor: UIColor, verifiedIconForegroundColor: UIColor, secretIconColor: UIColor, pinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors, unpinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors, onlineDotColor: UIColor) {
init(backgroundColor: UIColor, itemSeparatorColor: UIColor, itemBackgroundColor: UIColor, pinnedItemBackgroundColor: UIColor, itemHighlightedBackgroundColor: UIColor, itemSelectedBackgroundColor: UIColor, titleColor: UIColor, secretTitleColor: UIColor, dateTextColor: UIColor, authorNameColor: UIColor, messageTextColor: UIColor, messageDraftTextColor: UIColor, checkmarkColor: UIColor, pendingIndicatorColor: UIColor, failedFillColor: UIColor, failedForegroundColor: UIColor, muteIconColor: UIColor, unreadBadgeActiveBackgroundColor: UIColor, unreadBadgeActiveTextColor: UIColor, unreadBadgeInactiveBackgroundColor: UIColor, unreadBadgeInactiveTextColor: UIColor, pinnedBadgeColor: UIColor, pinnedSearchBarColor: UIColor, regularSearchBarColor: UIColor, sectionHeaderFillColor: UIColor, sectionHeaderTextColor: UIColor, verifiedIconFillColor: UIColor, verifiedIconForegroundColor: UIColor, secretIconColor: UIColor, pinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors, unpinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors, onlineDotColor: UIColor) {
self.backgroundColor = backgroundColor
self.itemSeparatorColor = itemSeparatorColor
self.itemBackgroundColor = itemBackgroundColor
@@ -432,7 +433,6 @@ public final class PresentationThemeChatList {
self.regularSearchBarColor = regularSearchBarColor
self.sectionHeaderFillColor = sectionHeaderFillColor
self.sectionHeaderTextColor = sectionHeaderTextColor
self.searchBarKeyboardColor = searchBarKeyboardColor
self.verifiedIconFillColor = verifiedIconFillColor
self.verifiedIconForegroundColor = verifiedIconForegroundColor
self.secretIconColor = secretIconColor
@@ -715,10 +715,9 @@ public final class PresentationThemeChatInputPanel {
public let primaryTextColor: UIColor
public let secondaryTextColor: UIColor
public let mediaRecordingDotColor: UIColor
public let keyboardColor: PresentationThemeKeyboardColor
public let mediaRecordingControl: PresentationThemeChatInputPanelMediaRecordingControl
public init(panelBackgroundColor: UIColor, panelSeparatorColor: UIColor, panelControlAccentColor: UIColor, panelControlColor: UIColor, panelControlDisabledColor: UIColor, panelControlDestructiveColor: UIColor, inputBackgroundColor: UIColor, inputStrokeColor: UIColor, inputPlaceholderColor: UIColor, inputTextColor: UIColor, inputControlColor: UIColor, actionControlFillColor: UIColor, actionControlForegroundColor: UIColor, primaryTextColor: UIColor, secondaryTextColor: UIColor, mediaRecordingDotColor: UIColor, keyboardColor: PresentationThemeKeyboardColor, mediaRecordingControl: PresentationThemeChatInputPanelMediaRecordingControl) {
public init(panelBackgroundColor: UIColor, panelSeparatorColor: UIColor, panelControlAccentColor: UIColor, panelControlColor: UIColor, panelControlDisabledColor: UIColor, panelControlDestructiveColor: UIColor, inputBackgroundColor: UIColor, inputStrokeColor: UIColor, inputPlaceholderColor: UIColor, inputTextColor: UIColor, inputControlColor: UIColor, actionControlFillColor: UIColor, actionControlForegroundColor: UIColor, primaryTextColor: UIColor, secondaryTextColor: UIColor, mediaRecordingDotColor: UIColor, mediaRecordingControl: PresentationThemeChatInputPanelMediaRecordingControl) {
self.panelBackgroundColor = panelBackgroundColor
self.panelSeparatorColor = panelSeparatorColor
self.panelControlAccentColor = panelControlAccentColor
@@ -735,7 +734,6 @@ public final class PresentationThemeChatInputPanel {
self.primaryTextColor = primaryTextColor
self.secondaryTextColor = secondaryTextColor
self.mediaRecordingDotColor = mediaRecordingDotColor
self.keyboardColor = keyboardColor
self.mediaRecordingControl = mediaRecordingControl
}
}
@@ -822,6 +820,10 @@ public final class PresentationThemeChat {
self.inputButtonPanel = inputButtonPanel
self.historyNavigation = historyNavigation
}
public func withUpdatedDefaultWallpaper(_ defaultWallpaper: TelegramWallpaper?) -> PresentationThemeChat {
return PresentationThemeChat(defaultWallpaper: defaultWallpaper ?? self.defaultWallpaper, message: self.message, serviceMessage: self.serviceMessage, inputPanel: self.inputPanel, inputMediaPanel: self.inputMediaPanel, inputButtonPanel: self.inputButtonPanel, historyNavigation: self.historyNavigation)
}
}
public enum PresentationThemeExpandedNotificationBackgroundType: Int32 {
@@ -974,4 +976,21 @@ public final class PresentationTheme: Equatable {
public static func ==(lhs: PresentationTheme, rhs: PresentationTheme) -> Bool {
return lhs === rhs
}
public func withUpdated(name: String?, author: String?, defaultWallpaper: TelegramWallpaper?) -> PresentationTheme {
var defaultWallpaper = defaultWallpaper
if let wallpaper = defaultWallpaper {
switch wallpaper {
case .image:
defaultWallpaper = nil
case let .file(file):
if file.isPattern {
defaultWallpaper = nil
}
default:
break
}
}
return PresentationTheme(name: name.flatMap(PresentationThemeName.custom) ?? .custom(self.name.string), author: author ?? self.author, referenceTheme: self.referenceTheme, overallDarkAppearance: self.overallDarkAppearance, baseColor: nil, intro: self.intro, passcode: self.passcode, rootController: self.rootController, list: self.list, chatList: self.chatList, chat: self.chat.withUpdatedDefaultWallpaper(defaultWallpaper), actionSheet: self.actionSheet, contextMenu: self.contextMenu, inAppNotification: self.inAppNotification)
}
}