mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-01-06 13:12:49 +00:00
Don't blur if not necessary
This commit is contained in:
@@ -71,7 +71,7 @@ public struct WallpaperSettings: PostboxCoding, Equatable {
|
||||
public enum TelegramWallpaper: OrderedItemListEntryContents, Equatable {
|
||||
case builtin(WallpaperSettings)
|
||||
case color(UInt32)
|
||||
case gradient([UInt32], WallpaperSettings)
|
||||
case gradient(Int64?, [UInt32], WallpaperSettings)
|
||||
case image([TelegramMediaImageRepresentation], WallpaperSettings)
|
||||
case file(id: Int64, accessHash: Int64, isCreator: Bool, isDefault: Bool, isPattern: Bool, isDark: Bool, slug: String, file: TelegramMediaFile, settings: WallpaperSettings)
|
||||
|
||||
@@ -106,7 +106,7 @@ public enum TelegramWallpaper: OrderedItemListEntryContents, Equatable {
|
||||
colors = decoder.decodeInt32ArrayForKey("colors").map(UInt32.init(bitPattern:))
|
||||
}
|
||||
|
||||
self = .gradient(colors, settings)
|
||||
self = .gradient(decoder.decodeOptionalInt64ForKey("id"), colors, settings)
|
||||
default:
|
||||
assertionFailure()
|
||||
self = .color(0xffffff)
|
||||
@@ -130,8 +130,13 @@ public enum TelegramWallpaper: OrderedItemListEntryContents, Equatable {
|
||||
case let .color(color):
|
||||
encoder.encodeInt32(1, forKey: "v")
|
||||
encoder.encodeInt32(Int32(bitPattern: color), forKey: "c")
|
||||
case let .gradient(colors, settings):
|
||||
case let .gradient(id, colors, settings):
|
||||
encoder.encodeInt32(4, forKey: "v")
|
||||
if let id = id {
|
||||
encoder.encodeInt64(id, forKey: "id")
|
||||
} else {
|
||||
encoder.encodeNil(forKey: "id")
|
||||
}
|
||||
encoder.encodeInt32Array(colors.map(Int32.init(bitPattern:)), forKey: "colors")
|
||||
encoder.encodeObject(settings, forKey: "settings")
|
||||
case let .image(representations, settings):
|
||||
@@ -166,8 +171,8 @@ public enum TelegramWallpaper: OrderedItemListEntryContents, Equatable {
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case let .gradient(colors, settings):
|
||||
if case .gradient(colors, settings) = rhs {
|
||||
case let .gradient(id, colors, settings):
|
||||
if case .gradient(id, colors, settings) = rhs {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
@@ -201,8 +206,8 @@ public enum TelegramWallpaper: OrderedItemListEntryContents, Equatable {
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case let .gradient(colors, _):
|
||||
if case .gradient(colors, _) = wallpaper {
|
||||
case let .gradient(_, colors, _):
|
||||
if case .gradient(_, colors, _) = wallpaper {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
@@ -224,7 +229,7 @@ public enum TelegramWallpaper: OrderedItemListEntryContents, Equatable {
|
||||
|
||||
public var settings: WallpaperSettings? {
|
||||
switch self {
|
||||
case let .builtin(settings), let .gradient(_, settings), let .image(_, settings), let .file(_, _, _, _, _, _, _, _, settings):
|
||||
case let .builtin(settings), let .gradient(_, _, settings), let .image(_, settings), let .file(_, _, _, _, _, _, _, _, settings):
|
||||
return settings
|
||||
default:
|
||||
return nil
|
||||
@@ -237,8 +242,8 @@ public enum TelegramWallpaper: OrderedItemListEntryContents, Equatable {
|
||||
return .builtin(settings)
|
||||
case .color:
|
||||
return self
|
||||
case let .gradient(colors, _):
|
||||
return .gradient(colors, settings)
|
||||
case let .gradient(id, colors, _):
|
||||
return .gradient(id, colors, settings)
|
||||
case let .image(representations, _):
|
||||
return .image(representations, settings)
|
||||
case let .file(id, accessHash, isCreator, isDefault, isPattern, isDark, slug, file, _):
|
||||
|
||||
Reference in New Issue
Block a user