mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Theme fixes
This commit is contained in:
@@ -323,10 +323,6 @@ private enum ThemeSettingsControllerEntry: ItemListNodeEntry {
|
||||
colorItems.append(.default)
|
||||
defaultColor = nil
|
||||
|
||||
let patternWallpaper: (String, Int32, Int32?, Int32?, Int32?) -> TelegramWallpaper = { slug, topColor, bottomColor, intensity, rotation in
|
||||
return TelegramWallpaper.file(id: 0, accessHash: 0, isCreator: false, isDefault: true, isPattern: true, isDark: false, slug: slug, file: TelegramMediaFile(fileId: MediaId(namespace: 0, id: 0), partialReference: nil, resource: LocalFileMediaResource(fileId: 0), previewRepresentations: [], immediateThumbnailData: nil, mimeType: "", size: nil, attributes: []), settings: WallpaperSettings(color: topColor, bottomColor: bottomColor, intensity: intensity ?? 50, rotation: rotation))
|
||||
}
|
||||
|
||||
for preset in dayClassicColorPresets {
|
||||
colorItems.append(.preset(preset))
|
||||
}
|
||||
@@ -706,9 +702,19 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The
|
||||
let _ = (cloudThemes.get()
|
||||
|> take(1)
|
||||
|> deliverOnMainQueue).start(next: { themes in
|
||||
removedThemeIndexesPromise.set(.single(removedThemeIndexes.modify({ value in
|
||||
var updated = value
|
||||
updated.insert(theme.theme.id)
|
||||
return updated
|
||||
})))
|
||||
|
||||
if isCurrent, let currentThemeIndex = themes.firstIndex(where: { $0.id == theme.theme.id }) {
|
||||
if let settings = theme.theme.settings {
|
||||
selectAccentColorImpl?(nil)
|
||||
if settings.baseTheme == .night {
|
||||
selectAccentColorImpl?(PresentationThemeAccentColor(baseColor: .blue))
|
||||
} else {
|
||||
selectAccentColorImpl?(nil)
|
||||
}
|
||||
} else {
|
||||
let previousThemeIndex = themes.prefix(upTo: currentThemeIndex).reversed().firstIndex(where: { $0.file != nil })
|
||||
let newTheme: PresentationThemeReference
|
||||
@@ -721,12 +727,6 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The
|
||||
}
|
||||
}
|
||||
|
||||
removedThemeIndexesPromise.set(.single(removedThemeIndexes.modify({ value in
|
||||
var updated = value
|
||||
updated.insert(theme.theme.id)
|
||||
return updated
|
||||
})))
|
||||
|
||||
let _ = deleteThemeInteractively(account: context.account, accountManager: context.sharedContext.accountManager, theme: theme.theme).start()
|
||||
})
|
||||
}))
|
||||
@@ -907,6 +907,12 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The
|
||||
let _ = (cloudThemes.get()
|
||||
|> take(1)
|
||||
|> deliverOnMainQueue).start(next: { themes in
|
||||
removedThemeIndexesPromise.set(.single(removedThemeIndexes.modify({ value in
|
||||
var updated = value
|
||||
updated.insert(cloudTheme.theme.id)
|
||||
return updated
|
||||
})))
|
||||
|
||||
if isCurrent, let settings = cloudTheme.theme.settings {
|
||||
let colorThemes = themes.filter { theme in
|
||||
if let settings = theme.settings {
|
||||
@@ -922,17 +928,15 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The
|
||||
if let previousThemeIndex = previousThemeIndex {
|
||||
selectThemeImpl?(.cloud(PresentationCloudTheme(theme: themes[themes.index(before: previousThemeIndex.base)], resolvedWallpaper: nil)))
|
||||
} else {
|
||||
selectAccentColorImpl?(nil)
|
||||
if settings.baseTheme == .night {
|
||||
selectAccentColorImpl?(PresentationThemeAccentColor(baseColor: .blue))
|
||||
} else {
|
||||
selectAccentColorImpl?(nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
removedThemeIndexesPromise.set(.single(removedThemeIndexes.modify({ value in
|
||||
var updated = value
|
||||
updated.insert(cloudTheme.theme.id)
|
||||
return updated
|
||||
})))
|
||||
|
||||
let _ = deleteThemeInteractively(account: context.account, accountManager: context.sharedContext.accountManager, theme: cloudTheme.theme).start()
|
||||
})
|
||||
}))
|
||||
@@ -1208,7 +1212,6 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The
|
||||
var updatedAutomaticThemeSwitchSetting = current.automaticThemeSwitchSetting
|
||||
|
||||
if autoNightModeTriggered {
|
||||
var updatedAutomaticThemeSwitchSetting = current.automaticThemeSwitchSetting
|
||||
updatedAutomaticThemeSwitchSetting.theme = generalThemeReference
|
||||
} else {
|
||||
updatedTheme = generalThemeReference
|
||||
|
||||
Reference in New Issue
Block a user