mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-02 04:38:33 +00:00
Move gradients to experiments
This commit is contained in:
parent
e571c6a8e1
commit
3431d42aef
@ -140,7 +140,7 @@ final class ThemeAccentColorControllerNode: ASDisplayNode, UIScrollViewDelegate
|
|||||||
let theme = makePresentationTheme(mediaBox: context.sharedContext.accountManager.mediaBox, themeReference: currentTheme, accentColor: color, serviceBackgroundColor: defaultServiceBackgroundColor, baseColor: nil, preview: true)
|
let theme = makePresentationTheme(mediaBox: context.sharedContext.accountManager.mediaBox, themeReference: currentTheme, accentColor: color, serviceBackgroundColor: defaultServiceBackgroundColor, baseColor: nil, preview: true)
|
||||||
|
|
||||||
let wallpaper = context.sharedContext.currentPresentationData.with { $0 }.chatWallpaper
|
let wallpaper = context.sharedContext.currentPresentationData.with { $0 }.chatWallpaper
|
||||||
let _ = PresentationResourcesChat.principalGraphics(mediaBox: context.account.postbox.mediaBox, knockoutWallpaper: context.sharedContext.immediateExperimentalUISettings.knockoutWallpaper, theme: theme, wallpaper: wallpaper)
|
let _ = PresentationResourcesChat.principalGraphics(mediaBox: context.account.postbox.mediaBox, knockoutWallpaper: context.sharedContext.immediateExperimentalUISettings.knockoutWallpaper, theme: theme, wallpaper: wallpaper, gradientBubbles: context.sharedContext.immediateExperimentalUISettings.gradientBubbles)
|
||||||
|
|
||||||
return theme
|
return theme
|
||||||
}
|
}
|
||||||
|
|||||||
@ -143,7 +143,7 @@ public final class PrincipalThemeEssentialGraphics {
|
|||||||
public let incomingBubbleGradientImage: UIImage?
|
public let incomingBubbleGradientImage: UIImage?
|
||||||
public let outgoingBubbleGradientImage: UIImage?
|
public let outgoingBubbleGradientImage: UIImage?
|
||||||
|
|
||||||
init(mediaBox: MediaBox, presentationTheme: PresentationTheme, wallpaper initialWallpaper: TelegramWallpaper, preview: Bool = false, knockoutMode: Bool) {
|
init(mediaBox: MediaBox, presentationTheme: PresentationTheme, wallpaper initialWallpaper: TelegramWallpaper, preview: Bool = false, knockoutMode: Bool, gradientBubbles: Bool) {
|
||||||
let theme = presentationTheme.chat
|
let theme = presentationTheme.chat
|
||||||
var wallpaper = initialWallpaper
|
var wallpaper = initialWallpaper
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ public final class PrincipalThemeEssentialGraphics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var outgoingGradientColors: (UIColor, UIColor)?
|
var outgoingGradientColors: (UIColor, UIColor)?
|
||||||
if false, let baseColor = presentationTheme.baseColor {
|
if gradientBubbles, let baseColor = presentationTheme.baseColor {
|
||||||
if presentationTheme.baseColor == .custom {
|
if presentationTheme.baseColor == .custom {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -67,11 +67,11 @@ public struct PresentationResourcesChat {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func principalGraphics(mediaBox: MediaBox, knockoutWallpaper: Bool, theme: PresentationTheme, wallpaper: TelegramWallpaper) -> PrincipalThemeEssentialGraphics {
|
public static func principalGraphics(mediaBox: MediaBox, knockoutWallpaper: Bool, theme: PresentationTheme, wallpaper: TelegramWallpaper, gradientBubbles: Bool) -> PrincipalThemeEssentialGraphics {
|
||||||
let hasWallpaper = !wallpaper.isEmpty
|
let hasWallpaper = !wallpaper.isEmpty
|
||||||
let key: PresentationResourceKey = !hasWallpaper ? PresentationResourceKey.chatPrincipalThemeEssentialGraphicsWithoutWallpaper : PresentationResourceKey.chatPrincipalThemeEssentialGraphicsWithWallpaper
|
let key: PresentationResourceKey = !hasWallpaper ? PresentationResourceKey.chatPrincipalThemeEssentialGraphicsWithoutWallpaper : PresentationResourceKey.chatPrincipalThemeEssentialGraphicsWithWallpaper
|
||||||
return theme.object(key.rawValue, { theme in
|
return theme.object(key.rawValue, { theme in
|
||||||
return PrincipalThemeEssentialGraphics(mediaBox: mediaBox, presentationTheme: theme, wallpaper: wallpaper, preview: theme.preview, knockoutMode: knockoutWallpaper)
|
return PrincipalThemeEssentialGraphics(mediaBox: mediaBox, presentationTheme: theme, wallpaper: wallpaper, preview: theme.preview, knockoutMode: knockoutWallpaper, gradientBubbles: gradientBubbles)
|
||||||
}) as! PrincipalThemeEssentialGraphics
|
}) as! PrincipalThemeEssentialGraphics
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6550,7 +6550,24 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
self.chatDisplayNode.dismissInput()
|
self.chatDisplayNode.dismissInput()
|
||||||
|
|
||||||
if let peer = peer as? TelegramChannel, let username = peer.username, !username.isEmpty {
|
if let peer = peer as? TelegramChannel, let username = peer.username, !username.isEmpty {
|
||||||
self.present(peerReportOptionsController(context: self.context, subject: .peer(peer.id), present: { [weak self] c, a in
|
let actionSheet = ActionSheetController(presentationTheme: self.presentationData.theme)
|
||||||
|
|
||||||
|
var items: [ActionSheetItem] = []
|
||||||
|
items.append(ActionSheetButtonItem(title: self.presentationData.strings.Conversation_ReportSpamAndLeave, color: .destructive, action: { [weak self, weak actionSheet] in
|
||||||
|
actionSheet?.dismissAnimated()
|
||||||
|
if let strongSelf = self {
|
||||||
|
strongSelf.deleteChat(reportChatSpam: true)
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
actionSheet.setItemGroups([ActionSheetItemGroup(items: items), ActionSheetItemGroup(items: [
|
||||||
|
ActionSheetButtonItem(title: self.presentationData.strings.Common_Cancel, color: .accent, action: { [weak actionSheet] in
|
||||||
|
actionSheet?.dismissAnimated()
|
||||||
|
})
|
||||||
|
])])
|
||||||
|
|
||||||
|
self.present(actionSheet, in: .window(.root))
|
||||||
|
|
||||||
|
/*self.present(peerReportOptionsController(context: self.context, subject: .peer(peer.id), present: { [weak self] c, a in
|
||||||
self?.present(c, in: .window(.root))
|
self?.present(c, in: .window(.root))
|
||||||
}, completion: { [weak self] success in
|
}, completion: { [weak self] success in
|
||||||
guard let strongSelf = self, success else {
|
guard let strongSelf = self, success else {
|
||||||
@ -6558,7 +6575,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
}
|
}
|
||||||
let _ = removePeerChat(account: strongSelf.context.account, peerId: chatPeer.id, reportChatSpam: false).start()
|
let _ = removePeerChat(account: strongSelf.context.account, peerId: chatPeer.id, reportChatSpam: false).start()
|
||||||
(strongSelf.navigationController as? NavigationController)?.filterController(strongSelf, animated: true)
|
(strongSelf.navigationController as? NavigationController)?.filterController(strongSelf, animated: true)
|
||||||
}), in: .window(.root))
|
}), in: .window(.root))*/
|
||||||
} else if let _ = peer as? TelegramUser {
|
} else if let _ = peer as? TelegramUser {
|
||||||
let presentationData = self.presentationData
|
let presentationData = self.presentationData
|
||||||
let controller = ActionSheetController(presentationTheme: presentationData.theme)
|
let controller = ActionSheetController(presentationTheme: presentationData.theme)
|
||||||
|
|||||||
@ -1493,7 +1493,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePrevewItemNode
|
|||||||
|
|
||||||
let layout = ListViewItemNodeLayout(contentSize: layoutSize, insets: layoutInsets)
|
let layout = ListViewItemNodeLayout(contentSize: layoutSize, insets: layoutInsets)
|
||||||
|
|
||||||
let graphics = PresentationResourcesChat.principalGraphics(mediaBox: item.context.account.postbox.mediaBox, knockoutWallpaper: item.context.sharedContext.immediateExperimentalUISettings.knockoutWallpaper, theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper)
|
let graphics = PresentationResourcesChat.principalGraphics(mediaBox: item.context.account.postbox.mediaBox, knockoutWallpaper: item.context.sharedContext.immediateExperimentalUISettings.knockoutWallpaper, theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper, gradientBubbles: item.context.sharedContext.immediateExperimentalUISettings.gradientBubbles)
|
||||||
|
|
||||||
var updatedMergedTop = mergedBottom
|
var updatedMergedTop = mergedBottom
|
||||||
var updatedMergedBottom = mergedTop
|
var updatedMergedBottom = mergedTop
|
||||||
@ -2686,7 +2686,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePrevewItemNode
|
|||||||
if self.highlightedState != highlighted {
|
if self.highlightedState != highlighted {
|
||||||
self.highlightedState = highlighted
|
self.highlightedState = highlighted
|
||||||
if let backgroundType = self.backgroundType {
|
if let backgroundType = self.backgroundType {
|
||||||
let graphics = PresentationResourcesChat.principalGraphics(mediaBox: item.context.account.postbox.mediaBox, knockoutWallpaper: item.context.sharedContext.immediateExperimentalUISettings.knockoutWallpaper, theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper)
|
let graphics = PresentationResourcesChat.principalGraphics(mediaBox: item.context.account.postbox.mediaBox, knockoutWallpaper: item.context.sharedContext.immediateExperimentalUISettings.knockoutWallpaper, theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper, gradientBubbles: item.context.sharedContext.immediateExperimentalUISettings.gradientBubbles)
|
||||||
|
|
||||||
if highlighted {
|
if highlighted {
|
||||||
self.backgroundNode.setType(type: backgroundType, highlighted: true, graphics: graphics, maskMode: self.contextSourceNode.isExtractedToContextPreview, transition: .immediate)
|
self.backgroundNode.setType(type: backgroundType, highlighted: true, graphics: graphics, maskMode: self.contextSourceNode.isExtractedToContextPreview, transition: .immediate)
|
||||||
|
|||||||
@ -145,7 +145,7 @@ class ChatMessageDateAndStatusNode: ASDisplayNode {
|
|||||||
|
|
||||||
let themeUpdated = presentationData.theme != currentTheme || type != currentType
|
let themeUpdated = presentationData.theme != currentTheme || type != currentType
|
||||||
|
|
||||||
let graphics = PresentationResourcesChat.principalGraphics(mediaBox: context.account.postbox.mediaBox, knockoutWallpaper: context.sharedContext.immediateExperimentalUISettings.knockoutWallpaper, theme: presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper)
|
let graphics = PresentationResourcesChat.principalGraphics(mediaBox: context.account.postbox.mediaBox, knockoutWallpaper: context.sharedContext.immediateExperimentalUISettings.knockoutWallpaper, theme: presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper, gradientBubbles: context.sharedContext.immediateExperimentalUISettings.gradientBubbles)
|
||||||
let offset: CGFloat = -UIScreenPixel
|
let offset: CGFloat = -UIScreenPixel
|
||||||
|
|
||||||
switch type {
|
switch type {
|
||||||
|
|||||||
@ -120,7 +120,7 @@ final class ChatMessageDateHeaderNode: ListViewItemHeaderNode {
|
|||||||
|
|
||||||
self.transform = CATransform3DMakeRotation(CGFloat.pi, 0.0, 0.0, 1.0)
|
self.transform = CATransform3DMakeRotation(CGFloat.pi, 0.0, 0.0, 1.0)
|
||||||
|
|
||||||
let graphics = PresentationResourcesChat.principalGraphics(mediaBox: context.account.postbox.mediaBox, knockoutWallpaper: context.sharedContext.immediateExperimentalUISettings.knockoutWallpaper, theme: presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper)
|
let graphics = PresentationResourcesChat.principalGraphics(mediaBox: context.account.postbox.mediaBox, knockoutWallpaper: context.sharedContext.immediateExperimentalUISettings.knockoutWallpaper, theme: presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper, gradientBubbles: context.sharedContext.immediateExperimentalUISettings.gradientBubbles)
|
||||||
|
|
||||||
self.backgroundNode.image = graphics.dateStaticBackground
|
self.backgroundNode.image = graphics.dateStaticBackground
|
||||||
self.stickBackgroundNode.image = graphics.dateFloatingBackground
|
self.stickBackgroundNode.image = graphics.dateFloatingBackground
|
||||||
@ -173,7 +173,7 @@ final class ChatMessageDateHeaderNode: ListViewItemHeaderNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func updatePresentationData(_ presentationData: ChatPresentationData, context: AccountContext) {
|
func updatePresentationData(_ presentationData: ChatPresentationData, context: AccountContext) {
|
||||||
let graphics = PresentationResourcesChat.principalGraphics(mediaBox: context.account.postbox.mediaBox, knockoutWallpaper: context.sharedContext.immediateExperimentalUISettings.knockoutWallpaper, theme: presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper)
|
let graphics = PresentationResourcesChat.principalGraphics(mediaBox: context.account.postbox.mediaBox, knockoutWallpaper: context.sharedContext.immediateExperimentalUISettings.knockoutWallpaper, theme: presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper, gradientBubbles: context.sharedContext.immediateExperimentalUISettings.gradientBubbles)
|
||||||
|
|
||||||
self.backgroundNode.image = graphics.dateStaticBackground
|
self.backgroundNode.image = graphics.dateStaticBackground
|
||||||
self.stickBackgroundNode.image = graphics.dateFloatingBackground
|
self.stickBackgroundNode.image = graphics.dateFloatingBackground
|
||||||
|
|||||||
@ -434,7 +434,7 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
|
|||||||
if hasThumbnail {
|
if hasThumbnail {
|
||||||
fileIconImage = nil
|
fileIconImage = nil
|
||||||
} else {
|
} else {
|
||||||
let principalGraphics = PresentationResourcesChat.principalGraphics(mediaBox: context.account.postbox.mediaBox, knockoutWallpaper: context.sharedContext.immediateExperimentalUISettings.knockoutWallpaper, theme: presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper)
|
let principalGraphics = PresentationResourcesChat.principalGraphics(mediaBox: context.account.postbox.mediaBox, knockoutWallpaper: context.sharedContext.immediateExperimentalUISettings.knockoutWallpaper, theme: presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper, gradientBubbles: context.sharedContext.immediateExperimentalUISettings.gradientBubbles)
|
||||||
|
|
||||||
fileIconImage = incoming ? principalGraphics.radialIndicatorFileIconIncoming : principalGraphics.radialIndicatorFileIconOutgoing
|
fileIconImage = incoming ? principalGraphics.radialIndicatorFileIconIncoming : principalGraphics.radialIndicatorFileIconOutgoing
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,17 +8,19 @@ public struct ExperimentalUISettings: Equatable, PreferencesEntry {
|
|||||||
public var crashOnLongQueries: Bool
|
public var crashOnLongQueries: Bool
|
||||||
public var chatListPhotos: Bool
|
public var chatListPhotos: Bool
|
||||||
public var knockoutWallpaper: Bool
|
public var knockoutWallpaper: Bool
|
||||||
|
public var gradientBubbles: Bool
|
||||||
|
|
||||||
public static var defaultSettings: ExperimentalUISettings {
|
public static var defaultSettings: ExperimentalUISettings {
|
||||||
return ExperimentalUISettings(keepChatNavigationStack: false, skipReadHistory: false, crashOnLongQueries: false, chatListPhotos: false, knockoutWallpaper: false)
|
return ExperimentalUISettings(keepChatNavigationStack: false, skipReadHistory: false, crashOnLongQueries: false, chatListPhotos: false, knockoutWallpaper: false, gradientBubbles: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(keepChatNavigationStack: Bool, skipReadHistory: Bool, crashOnLongQueries: Bool, chatListPhotos: Bool, knockoutWallpaper: Bool) {
|
public init(keepChatNavigationStack: Bool, skipReadHistory: Bool, crashOnLongQueries: Bool, chatListPhotos: Bool, knockoutWallpaper: Bool, gradientBubbles: Bool) {
|
||||||
self.keepChatNavigationStack = keepChatNavigationStack
|
self.keepChatNavigationStack = keepChatNavigationStack
|
||||||
self.skipReadHistory = skipReadHistory
|
self.skipReadHistory = skipReadHistory
|
||||||
self.crashOnLongQueries = crashOnLongQueries
|
self.crashOnLongQueries = crashOnLongQueries
|
||||||
self.chatListPhotos = chatListPhotos
|
self.chatListPhotos = chatListPhotos
|
||||||
self.knockoutWallpaper = knockoutWallpaper
|
self.knockoutWallpaper = knockoutWallpaper
|
||||||
|
self.gradientBubbles = gradientBubbles
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(decoder: PostboxDecoder) {
|
public init(decoder: PostboxDecoder) {
|
||||||
@ -27,6 +29,7 @@ public struct ExperimentalUISettings: Equatable, PreferencesEntry {
|
|||||||
self.crashOnLongQueries = decoder.decodeInt32ForKey("crashOnLongQueries", orElse: 0) != 0
|
self.crashOnLongQueries = decoder.decodeInt32ForKey("crashOnLongQueries", orElse: 0) != 0
|
||||||
self.chatListPhotos = decoder.decodeInt32ForKey("chatListPhotos", orElse: 0) != 0
|
self.chatListPhotos = decoder.decodeInt32ForKey("chatListPhotos", orElse: 0) != 0
|
||||||
self.knockoutWallpaper = decoder.decodeInt32ForKey("knockoutWallpaper", orElse: 0) != 0
|
self.knockoutWallpaper = decoder.decodeInt32ForKey("knockoutWallpaper", orElse: 0) != 0
|
||||||
|
self.gradientBubbles = decoder.decodeInt32ForKey("gradientBubbles", orElse: 0) != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
public func encode(_ encoder: PostboxEncoder) {
|
public func encode(_ encoder: PostboxEncoder) {
|
||||||
@ -35,6 +38,7 @@ public struct ExperimentalUISettings: Equatable, PreferencesEntry {
|
|||||||
encoder.encodeInt32(self.crashOnLongQueries ? 1 : 0, forKey: "crashOnLongQueries")
|
encoder.encodeInt32(self.crashOnLongQueries ? 1 : 0, forKey: "crashOnLongQueries")
|
||||||
encoder.encodeInt32(self.chatListPhotos ? 1 : 0, forKey: "chatListPhotos")
|
encoder.encodeInt32(self.chatListPhotos ? 1 : 0, forKey: "chatListPhotos")
|
||||||
encoder.encodeInt32(self.knockoutWallpaper ? 1 : 0, forKey: "knockoutWallpaper")
|
encoder.encodeInt32(self.knockoutWallpaper ? 1 : 0, forKey: "knockoutWallpaper")
|
||||||
|
encoder.encodeInt32(self.gradientBubbles ? 1 : 0, forKey: "gradientBubbles")
|
||||||
}
|
}
|
||||||
|
|
||||||
public func isEqual(to: PreferencesEntry) -> Bool {
|
public func isEqual(to: PreferencesEntry) -> Bool {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user