mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Fixes
This commit is contained in:
parent
a85da95943
commit
aeb0ded0cd
@ -482,12 +482,19 @@ public func privacyAndSecurityController(context: AccountContext, initialSetting
|
|||||||
let updateHasTwoStepAuth: () -> Void = {
|
let updateHasTwoStepAuth: () -> Void = {
|
||||||
let signal = twoStepVerificationConfiguration(account: context.account)
|
let signal = twoStepVerificationConfiguration(account: context.account)
|
||||||
|> map { value -> TwoStepVerificationAccessConfiguration? in
|
|> map { value -> TwoStepVerificationAccessConfiguration? in
|
||||||
return TwoStepVerificationAccessConfiguration(configuration: value, password: nil)
|
return TwoStepVerificationAccessConfiguration(configuration: value, password: nil)
|
||||||
}
|
}
|
||||||
|> deliverOnMainQueue
|
|> deliverOnMainQueue
|
||||||
updateTwoStepAuthDisposable.set(
|
updateTwoStepAuthDisposable.set(
|
||||||
signal.start(next: { value in
|
signal.start(next: { value in
|
||||||
twoStepAuthDataValue.set(.single(value))
|
twoStepAuthDataValue.set(.single(value))
|
||||||
|
if let value = value {
|
||||||
|
if case .set = value {
|
||||||
|
updatedHasTwoStepAuth?(true)
|
||||||
|
} else {
|
||||||
|
updatedHasTwoStepAuth?(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -945,7 +945,7 @@ public func settingsController(context: AccountContext, accountManager: AccountM
|
|||||||
blockedPeers.set(.single(blockedPeersContext))
|
blockedPeers.set(.single(blockedPeersContext))
|
||||||
}, updatedHasTwoStepAuth: { hasTwoStepAuthValue in
|
}, updatedHasTwoStepAuth: { hasTwoStepAuthValue in
|
||||||
hasTwoStepAuthPromise.set(.single(hasTwoStepAuthValue))
|
hasTwoStepAuthPromise.set(.single(hasTwoStepAuthValue))
|
||||||
}, activeSessionsContext: activeSessionsContext, webSessionsContext: webSessionsContext, blockedPeersContext: blockedPeersContext))
|
}, activeSessionsContext: activeSessionsContext, webSessionsContext: webSessionsContext, blockedPeersContext: blockedPeersContext, hasTwoStepAuth: hasTwoStepAuth))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}, openDataAndStorage: {
|
}, openDataAndStorage: {
|
||||||
|
@ -443,8 +443,7 @@ final class ThemeAccentColorController: ViewController {
|
|||||||
var defaultPatternWallpaper: TelegramWallpaper?
|
var defaultPatternWallpaper: TelegramWallpaper?
|
||||||
|
|
||||||
for wallpaper in wallpapers {
|
for wallpaper in wallpapers {
|
||||||
//JqSUrO0-mFIBAAAAWwTvLzoWGQI, 25
|
if case let .file(file) = wallpaper, file.slug == "JqSUrO0-mFIBAAAAWwTvLzoWGQI" {
|
||||||
if case let .file(file) = wallpaper, file.slug == "-Xc-np9y2VMCAAAARKr0yNNPYW0" {
|
|
||||||
defaultPatternWallpaper = wallpaper
|
defaultPatternWallpaper = wallpaper
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,6 @@ extension TelegramWallpaper: Codable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if components.count >= 2 && components.count <= 5 && [6, 8].contains(components[0].count) && !optionKeys.contains(components[0]) && [6, 8].contains(components[1].count) && !optionKeys.contains(components[1]), let topColor = UIColor(hexString: components[0]), let bottomColor = UIColor(hexString: components[1]) {
|
if components.count >= 2 && components.count <= 5 && [6, 8].contains(components[0].count) && !optionKeys.contains(components[0]) && [6, 8].contains(components[1].count) && !optionKeys.contains(components[1]), let topColor = UIColor(hexString: components[0]), let bottomColor = UIColor(hexString: components[1]) {
|
||||||
|
|
||||||
var rotation: Int32?
|
var rotation: Int32?
|
||||||
if components.count > 2, components[2].count <= 3, let value = Int32(components[2]) {
|
if components.count > 2, components[2].count <= 3, let value = Int32(components[2]) {
|
||||||
if value >= 0 && value < 360 {
|
if value >= 0 && value < 360 {
|
||||||
|
@ -429,17 +429,7 @@ public func patternWallpaperImageInternal(thumbnailData: Data?, fullSizeData: Da
|
|||||||
var scale = scale
|
var scale = scale
|
||||||
|
|
||||||
let drawingRect = arguments.drawingRect
|
let drawingRect = arguments.drawingRect
|
||||||
var fittedSize = arguments.imageSize
|
|
||||||
if abs(fittedSize.width - arguments.boundingSize.width).isLessThanOrEqualTo(CGFloat(1.0)) {
|
|
||||||
fittedSize.width = arguments.boundingSize.width
|
|
||||||
}
|
|
||||||
if abs(fittedSize.height - arguments.boundingSize.height).isLessThanOrEqualTo(CGFloat(1.0)) {
|
|
||||||
fittedSize.height = arguments.boundingSize.height
|
|
||||||
}
|
|
||||||
fittedSize = fittedSize.aspectFilled(arguments.drawingRect.size)
|
|
||||||
|
|
||||||
let fittedRect = CGRect(origin: CGPoint(x: drawingRect.origin.x + (drawingRect.size.width - fittedSize.width) / 2.0, y: drawingRect.origin.y + (drawingRect.size.height - fittedSize.height) / 2.0), size: fittedSize)
|
|
||||||
|
|
||||||
if let customArguments = arguments.custom as? PatternWallpaperArguments, let combinedColor = customArguments.colors.first {
|
if let customArguments = arguments.custom as? PatternWallpaperArguments, let combinedColor = customArguments.colors.first {
|
||||||
if customArguments.preview {
|
if customArguments.preview {
|
||||||
scale = max(1.0, UIScreenScale - 1.0)
|
scale = max(1.0, UIScreenScale - 1.0)
|
||||||
@ -479,6 +469,17 @@ public func patternWallpaperImageInternal(thumbnailData: Data?, fullSizeData: Da
|
|||||||
|
|
||||||
let image = customArguments.preview ? (scaledSizeImage ?? fullSizeImage) : fullSizeImage
|
let image = customArguments.preview ? (scaledSizeImage ?? fullSizeImage) : fullSizeImage
|
||||||
if let image = image {
|
if let image = image {
|
||||||
|
var fittedSize = CGSize(width: image.width, height: image.height)
|
||||||
|
if abs(fittedSize.width - arguments.boundingSize.width).isLessThanOrEqualTo(CGFloat(1.0)) {
|
||||||
|
fittedSize.width = arguments.boundingSize.width
|
||||||
|
}
|
||||||
|
if abs(fittedSize.height - arguments.boundingSize.height).isLessThanOrEqualTo(CGFloat(1.0)) {
|
||||||
|
fittedSize.height = arguments.boundingSize.height
|
||||||
|
}
|
||||||
|
fittedSize = fittedSize.aspectFilled(arguments.drawingRect.size)
|
||||||
|
|
||||||
|
let fittedRect = CGRect(origin: CGPoint(x: drawingRect.origin.x + (drawingRect.size.width - fittedSize.width) / 2.0, y: drawingRect.origin.y + (drawingRect.size.height - fittedSize.height) / 2.0), size: fittedSize)
|
||||||
|
|
||||||
c.setBlendMode(.normal)
|
c.setBlendMode(.normal)
|
||||||
c.interpolationQuality = customArguments.preview ? .low : .medium
|
c.interpolationQuality = customArguments.preview ? .low : .medium
|
||||||
c.clip(to: fittedRect, mask: image)
|
c.clip(to: fittedRect, mask: image)
|
||||||
@ -538,7 +539,7 @@ public func solidColorImage(_ color: UIColor) -> Signal<(TransformImageArguments
|
|||||||
let context = DrawingContext(size: arguments.drawingSize, clear: true)
|
let context = DrawingContext(size: arguments.drawingSize, clear: true)
|
||||||
|
|
||||||
context.withFlippedContext { c in
|
context.withFlippedContext { c in
|
||||||
c.setFillColor(color.cgColor)
|
c.setFillColor(color.withAlphaComponent(1.0).cgColor)
|
||||||
c.fill(arguments.drawingRect)
|
c.fill(arguments.drawingRect)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -563,7 +564,7 @@ public func gradientImage(_ colors: [UIColor], rotation: Int32? = nil) -> Signal
|
|||||||
let context = DrawingContext(size: arguments.drawingSize, clear: !arguments.corners.isEmpty)
|
let context = DrawingContext(size: arguments.drawingSize, clear: !arguments.corners.isEmpty)
|
||||||
|
|
||||||
context.withContext { c in
|
context.withContext { c in
|
||||||
let gradientColors = colors.map { $0.cgColor } as CFArray
|
let gradientColors = colors.map { $0.withAlphaComponent(1.0).cgColor } as CFArray
|
||||||
let delta: CGFloat = 1.0 / (CGFloat(colors.count) - 1.0)
|
let delta: CGFloat = 1.0 / (CGFloat(colors.count) - 1.0)
|
||||||
|
|
||||||
var locations: [CGFloat] = []
|
var locations: [CGFloat] = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user