diff --git a/submodules/SettingsUI/Sources/Themes/ThemeColorPresets.swift b/submodules/SettingsUI/Sources/Themes/ThemeColorPresets.swift index 12dac6ea37..69a988cfeb 100644 --- a/submodules/SettingsUI/Sources/Themes/ThemeColorPresets.swift +++ b/submodules/SettingsUI/Sources/Themes/ThemeColorPresets.swift @@ -8,10 +8,11 @@ private func patternWallpaper(slug: String, topColor: UInt32, bottomColor: UInt3 } var dayClassicColorPresets: [PresentationThemeAccentColor] = [ - PresentationThemeAccentColor(index: 106, baseColor: .preset, accentColor: 0xf55783, bubbleColors: (0xd6f5ff, nil), wallpaper: patternWallpaper(slug: "p-pXcflrmFIBAAAAvXYQk-mCwZU", topColor: 0xfce3ec, bottomColor: nil, intensity: 40, rotation: nil)), + PresentationThemeAccentColor(index: 106, baseColor: .preset, accentColor: 0xf55783, bubbleColors: (0xd6f5ff, 0xc9fdfe), wallpaper: patternWallpaper(slug: "p-pXcflrmFIBAAAAvXYQk-mCwZU", topColor: 0xfce3ec, bottomColor: 0xfec8ff, intensity: 50, rotation: 45)), PresentationThemeAccentColor(index: 102, baseColor: .preset, accentColor: 0xff5fa9, bubbleColors: (0xfff4d7, nil), wallpaper: patternWallpaper(slug: "51nnTjx8mFIBAAAAaFGJsMIvWkk", topColor: 0xf6b594, bottomColor: 0xebf6cd, intensity: 46, rotation: 45)), - PresentationThemeAccentColor(index: 104, baseColor: .preset, accentColor: 0x5a9e29, bubbleColors: (0xdcf8c6, nil), wallpaper: patternWallpaper(slug: "R3j69wKskFIBAAAAoUdXWCKMzCM", topColor: 0xede6dd, bottomColor: nil, intensity: 50, rotation: nil)), + PresentationThemeAccentColor(index: 104, baseColor: .preset, accentColor: 0x5a9e29, bubbleColors: (0xfff8df, 0xdcf8c6), wallpaper: patternWallpaper(slug: "R3j69wKskFIBAAAAoUdXWCKMzCM", topColor: 0xede6dd, bottomColor: 0xffd59e, intensity: 50, rotation: nil)), PresentationThemeAccentColor(index: 101, baseColor: .preset, accentColor: 0x7e5fe5, bubbleColors: (0xf5e2ff, nil), wallpaper: patternWallpaper(slug: "nQcFYJe1mFIBAAAAcI95wtIK0fk", topColor: 0xfcccf4, bottomColor: 0xae85f0, intensity: 54, rotation: nil)), + PresentationThemeAccentColor(index: 107, baseColor: .preset, accentColor: 0x2cb9ed, bubbleColors: (0xadf7b5, 0xfcff8b), wallpaper: patternWallpaper(slug: "nQcFYJe1mFIBAAAAcI95wtIK0fk", topColor: 0x1a2d1a, bottomColor: 0x5f6f54, intensity: 50, rotation: 225)), PresentationThemeAccentColor(index: 103, baseColor: .preset, accentColor: 0x199972, bubbleColors: (0xfffec7, nil), wallpaper: patternWallpaper(slug: "fqv01SQemVIBAAAApND8LDRUhRU", topColor: 0xc1e7cb, bottomColor: nil, intensity: 50, rotation: nil)), PresentationThemeAccentColor(index: 105, baseColor: .preset, accentColor: 0x009eee, bubbleColors: (0x94fff9, 0xccffc7), wallpaper: patternWallpaper(slug: "p-pXcflrmFIBAAAAvXYQk-mCwZU", topColor: 0xffbca6, bottomColor: 0xff63bd, intensity: 57, rotation: 225)) ] diff --git a/submodules/SettingsUI/Sources/Themes/ThemeSettingsController.swift b/submodules/SettingsUI/Sources/Themes/ThemeSettingsController.swift index 32f3dbd9ed..60c73d24a5 100644 --- a/submodules/SettingsUI/Sources/Themes/ThemeSettingsController.swift +++ b/submodules/SettingsUI/Sources/Themes/ThemeSettingsController.swift @@ -352,7 +352,7 @@ private enum ThemeSettingsControllerEntry: ItemListNodeEntry { } } var currentColor = color ?? defaultColor.flatMap { .accentColor($0) } - if let color = currentColor, case let .accentColor(accentColor) = color { + if let color = currentColor, case let .accentColor(accentColor) = color, accentColor.baseColor == .theme { var themeExists = false if let _ = themes.first(where: { $0.index == accentColor.themeIndex }) { themeExists = true @@ -862,7 +862,7 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The if let accentColor = accentColor { if case let .accentColor(color) = accentColor, color.baseColor != .custom { } else if case let .theme(theme) = accentColor, case let .cloud(cloudTheme) = theme { - if cloudTheme.theme.isCreator { + if cloudTheme.theme.isCreator && cloudThemeExists { items.append(.action(ContextMenuActionItem(text: presentationData.strings.Appearance_EditTheme, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/ApplyTheme"), color: theme.contextMenu.primaryColor) }, action: { c, f in let controller = editThemeController(context: context, mode: .edit(cloudTheme), navigateToChat: { peerId in if let navigationController = getNavigationControllerImpl?() { diff --git a/submodules/SettingsUI/Sources/Themes/WallpaperColorPanelNode.swift b/submodules/SettingsUI/Sources/Themes/WallpaperColorPanelNode.swift index 5faa7048b9..3bb307b4ab 100644 --- a/submodules/SettingsUI/Sources/Themes/WallpaperColorPanelNode.swift +++ b/submodules/SettingsUI/Sources/Themes/WallpaperColorPanelNode.swift @@ -772,13 +772,18 @@ final class WallpaperColorPanelNode: ASDisplayNode { let secondColor: UIColor if updated.simpleGradientGeneration { - var colorHsb = color.hsb - if color.hsb.2 > 0.5 { - secondColor = UIColor(hue: colorHsb.0, saturation: colorHsb.1, brightness: max(0.28, color.hsb.2 - 0.3), alpha: 1.0) + var hsb = color.hsb + if hsb.1 > 0.5 { + hsb.1 -= 0.15 } else { - secondColor = UIColor(hue: colorHsb.0, saturation: colorHsb.1, brightness: min(0.88, color.hsb.2 + 0.3), alpha: 1.0) + hsb.1 += 0.15 } - updated.secondColor = secondColor + if hsb.0 > 0.5 { + hsb.0 -= 0.05 + } else { + hsb.0 += 0.05 + } + updated.secondColor = UIColor(hue: hsb.0, saturation: hsb.1, brightness: hsb.2, alpha: 1.0) } else { updated.secondColor = generateGradientColors(color: color).1 } diff --git a/submodules/TelegramApi/Sources/Api0.swift b/submodules/TelegramApi/Sources/Api0.swift index 5755ee2af2..ba15174d5d 100644 --- a/submodules/TelegramApi/Sources/Api0.swift +++ b/submodules/TelegramApi/Sources/Api0.swift @@ -629,6 +629,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-69724536] = { return Api.BaseTheme.parse_baseThemeDay($0) } dict[-1212997976] = { return Api.BaseTheme.parse_baseThemeNight($0) } dict[1834973166] = { return Api.BaseTheme.parse_baseThemeTinted($0) } + dict[1527845466] = { return Api.BaseTheme.parse_baseThemeArctic($0) } dict[398898678] = { return Api.help.Support.parse_support($0) } dict[1474492012] = { return Api.MessagesFilter.parse_inputMessagesFilterEmpty($0) } dict[-1777752804] = { return Api.MessagesFilter.parse_inputMessagesFilterPhotos($0) } diff --git a/submodules/TelegramApi/Sources/Api1.swift b/submodules/TelegramApi/Sources/Api1.swift index caacbb6606..dfdba7d654 100644 --- a/submodules/TelegramApi/Sources/Api1.swift +++ b/submodules/TelegramApi/Sources/Api1.swift @@ -17784,6 +17784,7 @@ public extension Api { case baseThemeDay case baseThemeNight case baseThemeTinted + case baseThemeArctic public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -17810,6 +17811,12 @@ public extension Api { buffer.appendInt32(1834973166) } + break + case .baseThemeArctic: + if boxed { + buffer.appendInt32(1527845466) + } + break } } @@ -17824,6 +17831,8 @@ public extension Api { return ("baseThemeNight", []) case .baseThemeTinted: return ("baseThemeTinted", []) + case .baseThemeArctic: + return ("baseThemeArctic", []) } } @@ -17839,6 +17848,9 @@ public extension Api { public static func parse_baseThemeTinted(_ reader: BufferReader) -> BaseTheme? { return Api.BaseTheme.baseThemeTinted } + public static func parse_baseThemeArctic(_ reader: BufferReader) -> BaseTheme? { + return Api.BaseTheme.baseThemeArctic + } } public enum MessagesFilter: TypeConstructorDescription { diff --git a/submodules/TelegramApi/Sources/Api3.swift b/submodules/TelegramApi/Sources/Api3.swift index 7dadc1cf31..4d4168b2e0 100644 --- a/submodules/TelegramApi/Sources/Api3.swift +++ b/submodules/TelegramApi/Sources/Api3.swift @@ -5962,6 +5962,24 @@ public extension Api { return result }) } + + public static func getMultiWallPapers(wallpapers: [Api.InputWallPaper]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Api.WallPaper]>) { + let buffer = Buffer() + buffer.appendInt32(1705865692) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(wallpapers.count)) + for item in wallpapers { + item.serialize(buffer, true) + } + return (FunctionDescription(name: "account.getMultiWallPapers", parameters: [("wallpapers", wallpapers)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.WallPaper]? in + let reader = BufferReader(buffer) + var result: [Api.WallPaper]? + if let _ = reader.readInt32() { + result = Api.parseVector(reader, elementSignature: 0, elementType: Api.WallPaper.self) + } + return result + }) + } } public struct wallet { public static func sendLiteRequest(body: Buffer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { diff --git a/submodules/TelegramCore/Sources/Theme.swift b/submodules/TelegramCore/Sources/Theme.swift index 217d2e0545..7a421768a8 100644 --- a/submodules/TelegramCore/Sources/Theme.swift +++ b/submodules/TelegramCore/Sources/Theme.swift @@ -27,6 +27,8 @@ extension TelegramBaseTheme { self = .night case .baseThemeTinted: self = .tinted + case .baseThemeArctic: + self = .day } }