Update for Xcode 14.3

This commit is contained in:
Ali 2023-04-09 23:14:31 +04:00
parent e70ac49311
commit 0e5ef71348
8 changed files with 20 additions and 19 deletions

View File

@ -302,7 +302,7 @@ public func chatMessageBubbleMosaicLayout(maxSize: CGSize, itemSizes: [CGSize],
innerPositionFlags.insert(.right) innerPositionFlags.insert(.right)
} }
if positionFlags == .none { if positionFlags == [] {
innerPositionFlags = .inside innerPositionFlags = .inside
} }

View File

@ -72,8 +72,8 @@ public func fetchCompressedLottieFirstFrameAJpeg(data: Data, size: CGSize, fitzM
let alphaData = NSMutableData() let alphaData = NSMutableData()
if let colorDestination = CGImageDestinationCreateWithData(colorData as CFMutableData, kUTTypeJPEG, 1, nil), let alphaDestination = CGImageDestinationCreateWithData(alphaData as CFMutableData, kUTTypeJPEG, 1, nil) { if let colorDestination = CGImageDestinationCreateWithData(colorData as CFMutableData, kUTTypeJPEG, 1, nil), let alphaDestination = CGImageDestinationCreateWithData(alphaData as CFMutableData, kUTTypeJPEG, 1, nil) {
CGImageDestinationSetProperties(colorDestination, [:] as CFDictionary) CGImageDestinationSetProperties(colorDestination, NSDictionary() as CFDictionary)
CGImageDestinationSetProperties(alphaDestination, [:] as CFDictionary) CGImageDestinationSetProperties(alphaDestination, NSDictionary() as CFDictionary)
let colorQuality: Float let colorQuality: Float
let alphaQuality: Float let alphaQuality: Float

View File

@ -286,11 +286,11 @@ private extension CurrentImpl {
case .mediaStream: case .mediaStream:
let ssrcId = UInt32.random(in: 0 ..< UInt32(Int32.max - 1)) let ssrcId = UInt32.random(in: 0 ..< UInt32(Int32.max - 1))
let dict: [String: Any] = [ let dict: [String: Any] = [
"fingerprints": [], "fingerprints": [] as [Any],
"ufrag": "", "ufrag": "",
"pwd": "", "pwd": "",
"ssrc": Int32(bitPattern: ssrcId), "ssrc": Int32(bitPattern: ssrcId),
"ssrc-groups": [] "ssrc-groups": [] as [Any]
] ]
guard let jsonString = (try? JSONSerialization.data(withJSONObject: dict, options: [])).flatMap({ String(data: $0, encoding: .utf8) }) else { guard let jsonString = (try? JSONSerialization.data(withJSONObject: dict, options: [])).flatMap({ String(data: $0, encoding: .utf8) }) else {
return .never() return .never()

View File

@ -52,7 +52,7 @@ public struct EmojiInteraction: Equatable {
fileprivate let roundingBehavior = NSDecimalNumberHandler(roundingMode: .plain, scale: 2, raiseOnExactness: false, raiseOnOverflow: false, raiseOnUnderflow: false, raiseOnDivideByZero: true) fileprivate let roundingBehavior = NSDecimalNumberHandler(roundingMode: .plain, scale: 2, raiseOnExactness: false, raiseOnOverflow: false, raiseOnUnderflow: false, raiseOnDivideByZero: true)
public var apiDataJson: Api.DataJSON { public var apiDataJson: Api.DataJSON {
let dict = ["v": 1, "a": self.animations.map({ ["i": $0.index, "t": NSDecimalNumber(value: $0.timeOffset).rounding(accordingToBehavior: roundingBehavior)] })] as [String : Any] let dict = ["v": 1, "a": self.animations.map({ ["i": $0.index, "t": NSDecimalNumber(value: $0.timeOffset).rounding(accordingToBehavior: roundingBehavior)] as [String : Any] })] as [String : Any]
if let data = try? JSONSerialization.data(withJSONObject: dict, options: []), let dataString = String(data: data, encoding: .utf8) { if let data = try? JSONSerialization.data(withJSONObject: dict, options: []), let dataString = String(data: data, encoding: .utf8) {
return .dataJSON(data: dataString) return .dataJSON(data: dataString)
} else { } else {

View File

@ -205,8 +205,8 @@ private func fetchCachedStickerAJpegRepresentation(account: Account, resource: M
}, scale: 1.0) }, scale: 1.0)
if let alphaImage = alphaImage, let colorDestination = CGImageDestinationCreateWithData(colorData as CFMutableData, kUTTypeJPEG, 1, nil), let alphaDestination = CGImageDestinationCreateWithData(alphaData as CFMutableData, kUTTypeJPEG, 1, nil) { if let alphaImage = alphaImage, let colorDestination = CGImageDestinationCreateWithData(colorData as CFMutableData, kUTTypeJPEG, 1, nil), let alphaDestination = CGImageDestinationCreateWithData(alphaData as CFMutableData, kUTTypeJPEG, 1, nil) {
CGImageDestinationSetProperties(colorDestination, [:] as CFDictionary) CGImageDestinationSetProperties(colorDestination, NSDictionary() as CFDictionary)
CGImageDestinationSetProperties(alphaDestination, [:] as CFDictionary) CGImageDestinationSetProperties(alphaDestination, NSDictionary() as CFDictionary)
let colorQuality: Float let colorQuality: Float
let alphaQuality: Float let alphaQuality: Float
@ -270,7 +270,7 @@ private func fetchCachedScaledImageRepresentation(resource: MediaResource, resou
}, scale: 1.0)! }, scale: 1.0)!
if let colorDestination = CGImageDestinationCreateWithURL(url as CFURL, kUTTypeJPEG, 1, nil) { if let colorDestination = CGImageDestinationCreateWithURL(url as CFURL, kUTTypeJPEG, 1, nil) {
CGImageDestinationSetProperties(colorDestination, [:] as CFDictionary) CGImageDestinationSetProperties(colorDestination, NSDictionary() as CFDictionary)
let colorQuality: Float = 0.5 let colorQuality: Float = 0.5
@ -330,7 +330,7 @@ private func fetchCachedVideoFirstFrameRepresentation(account: Account, resource
let url = URL(fileURLWithPath: path) let url = URL(fileURLWithPath: path)
if let colorDestination = CGImageDestinationCreateWithURL(url as CFURL, kUTTypeJPEG, 1, nil) { if let colorDestination = CGImageDestinationCreateWithURL(url as CFURL, kUTTypeJPEG, 1, nil) {
CGImageDestinationSetProperties(colorDestination, [:] as CFDictionary) CGImageDestinationSetProperties(colorDestination, NSDictionary() as CFDictionary)
let colorQuality: Float = 0.6 let colorQuality: Float = 0.6
@ -371,7 +371,7 @@ private func fetchCachedScaledVideoFirstFrameRepresentation(account: Account, re
}, scale: 1.0)! }, scale: 1.0)!
if let colorDestination = CGImageDestinationCreateWithURL(url as CFURL, kUTTypeJPEG, 1, nil) { if let colorDestination = CGImageDestinationCreateWithURL(url as CFURL, kUTTypeJPEG, 1, nil) {
CGImageDestinationSetProperties(colorDestination, [:] as CFDictionary) CGImageDestinationSetProperties(colorDestination, NSDictionary() as CFDictionary)
let colorQuality: Float = 0.5 let colorQuality: Float = 0.5
@ -399,7 +399,7 @@ private func fetchCachedBlurredWallpaperRepresentation(resource: MediaResource,
let url = URL(fileURLWithPath: path) let url = URL(fileURLWithPath: path)
if let colorImage = blurredImage(image, radius: 20.0), let colorDestination = CGImageDestinationCreateWithURL(url as CFURL, kUTTypeJPEG, 1, nil) { if let colorImage = blurredImage(image, radius: 20.0), let colorDestination = CGImageDestinationCreateWithURL(url as CFURL, kUTTypeJPEG, 1, nil) {
CGImageDestinationSetProperties(colorDestination, [:] as CFDictionary) CGImageDestinationSetProperties(colorDestination, NSDictionary() as CFDictionary)
let colorQuality: Float = 0.5 let colorQuality: Float = 0.5
@ -448,7 +448,7 @@ private func fetchCachedBlurredWallpaperRepresentation(account: Account, resourc
let url = URL(fileURLWithPath: path) let url = URL(fileURLWithPath: path)
if let colorImage = blurredImage(image, radius: 20.0), let colorDestination = CGImageDestinationCreateWithURL(url as CFURL, kUTTypeJPEG, 1, nil) { if let colorImage = blurredImage(image, radius: 20.0), let colorDestination = CGImageDestinationCreateWithURL(url as CFURL, kUTTypeJPEG, 1, nil) {
CGImageDestinationSetProperties(colorDestination, [:] as CFDictionary) CGImageDestinationSetProperties(colorDestination, NSDictionary() as CFDictionary)
let colorQuality: Float = 0.5 let colorQuality: Float = 0.5
@ -491,7 +491,7 @@ private func fetchCachedAlbumArtworkRepresentation(account: Account, resource: M
})! })!
if let colorDestination = CGImageDestinationCreateWithURL(url as CFURL, kUTTypeJPEG, 1, nil) { if let colorDestination = CGImageDestinationCreateWithURL(url as CFURL, kUTTypeJPEG, 1, nil) {
CGImageDestinationSetProperties(colorDestination, [:] as CFDictionary) CGImageDestinationSetProperties(colorDestination, NSDictionary() as CFDictionary)
let colorQuality: Float = 0.5 let colorQuality: Float = 0.5

View File

@ -653,10 +653,10 @@ public final class YoutubeEmbedFramePreview: FramePreview {
let frame: Int32 = globalFrame % framesOnStoryboard let frame: Int32 = globalFrame % framesOnStoryboard
let num: Int32 = Int32(floor(Double(globalFrame) / Double(framesOnStoryboard))) let num: Int32 = Int32(floor(Double(globalFrame) / Double(framesOnStoryboard)))
let url = storyboardUrl(spec: storyboardSpec, sizeIndex: bestSize.0, num: num) let url = strongSelf.storyboardUrl(spec: storyboardSpec, sizeIndex: bestSize.0, num: num)
strongSelf.framePipe.putNext(.waitingForData) strongSelf.framePipe.putNext(.waitingForData)
strongSelf.currentFrameDisposable.set(youtubeEmbedStoryboardImage(account: strongSelf.context.account, resource: YoutubeEmbedStoryboardMediaResource(videoId: youtubeImpl.videoId, storyboardId: num, url: url), frame: frame, size: bestSize.1).start(next: { [weak self] image in strongSelf.currentFrameDisposable.set(youtubeEmbedStoryboardImage(account: strongSelf.context.account, resource: YoutubeEmbedStoryboardMediaResource(videoId: youtubeImpl.videoId, storyboardId: num, url: url), frame: frame, size: bestSize.1).start(next: { image in
if let strongSelf = self { if let strongSelf = self {
if let image = image { if let image = image {
strongSelf.framePipe.putNext(.image(image)) strongSelf.framePipe.putNext(.image(image))

View File

@ -60,7 +60,7 @@ final class WatchChatListHandler: WatchRequestHandler {
users = users.merging(chatUsers, uniquingKeysWith: { (_, last) in last }) users = users.merging(chatUsers, uniquingKeysWith: { (_, last) in last })
} }
} }
subscriber.putNext([ TGBridgeChatsArrayKey: chats, TGBridgeUsersDictionaryKey: users ]) subscriber.putNext([ TGBridgeChatsArrayKey: chats, TGBridgeUsersDictionaryKey: users ] as [String: Any])
}) })
return SBlockDisposable { return SBlockDisposable {
@ -108,7 +108,7 @@ final class WatchChatMessagesHandler: WatchRequestHandler {
users = users.merging(messageUsers, uniquingKeysWith: { (_, last) in last }) users = users.merging(messageUsers, uniquingKeysWith: { (_, last) in last })
} }
} }
subscriber.putNext([ TGBridgeMessagesArrayKey: messages, TGBridgeUsersDictionaryKey: users ]) subscriber.putNext([ TGBridgeMessagesArrayKey: messages, TGBridgeUsersDictionaryKey: users ] as [String: Any])
}) })
return SBlockDisposable { return SBlockDisposable {
@ -295,7 +295,7 @@ final class WatchPeerInfoHandler: WatchRequestHandler {
}) })
let disposable = signal.start(next: { view in let disposable = signal.start(next: { view in
let (chat, users) = makeBridgeChat(peerViewMainPeer(view), view: view) let (chat, users) = makeBridgeChat(peerViewMainPeer(view), view: view)
subscriber.putNext([ TGBridgeChatKey: chat, TGBridgeUsersDictionaryKey: users ]) subscriber.putNext([ TGBridgeChatKey: chat, TGBridgeUsersDictionaryKey: users ] as [String: Any])
}) })
return SBlockDisposable { return SBlockDisposable {

View File

@ -51,6 +51,7 @@ posix_copts = [
"-Wwrite-strings", "-Wwrite-strings",
"-Wshadow", "-Wshadow",
"-fno-common", "-fno-common",
"-Wno-unused-but-set-variable",
# Modern build environments should be able to set this to use atomic # Modern build environments should be able to set this to use atomic
# operations for reference counting rather than locks. However, it's # operations for reference counting rather than locks. However, it's