Combo update

This commit is contained in:
Ali
2021-05-25 19:00:50 +04:00
parent af59d15412
commit ef99bb604f
29 changed files with 408 additions and 154 deletions

View File

@@ -294,30 +294,28 @@ func openResolvedUrlImpl(_ resolvedUrl: ResolvedUrl, context: AccountContext, ur
let signal: Signal<TelegramWallpaper, GetWallpaperError>
var options: WallpaperPresentationOptions?
var topColor: UIColor?
var bottomColor: UIColor?
var colors: [UInt32] = []
var intensity: Int32?
var rotation: Int32?
switch parameter {
case let .slug(slug, wallpaperOptions, firstColor, secondColor, intensityValue, rotationValue):
case let .slug(slug, wallpaperOptions, colorsValue, intensityValue, rotationValue):
signal = getWallpaper(network: context.account.network, slug: slug)
options = wallpaperOptions
topColor = firstColor
bottomColor = secondColor
colors = colorsValue
intensity = intensityValue
rotation = rotationValue
controller = OverlayStatusController(theme: presentationData.theme, type: .loading(cancelled: nil))
present(controller!, nil)
case let .color(color):
signal = .single(.color(color.argb))
case let .gradient(topColor, bottomColor, rotation):
signal = .single(.gradient([topColor.argb, bottomColor.argb], WallpaperSettings(rotation: rotation)))
case let .gradient(colors, rotation):
signal = .single(.gradient(colors, WallpaperSettings(rotation: rotation)))
}
let _ = (signal
|> deliverOnMainQueue).start(next: { [weak controller] wallpaper in
controller?.dismiss()
let galleryController = WallpaperGalleryController(context: context, source: .wallpaper(wallpaper, options, topColor, bottomColor, intensity, rotation, nil))
let galleryController = WallpaperGalleryController(context: context, source: .wallpaper(wallpaper, options, colors, intensity, rotation, nil))
present(galleryController, nil)
}, error: { [weak controller] error in
controller?.dismiss()