Merge branch 'master' into experimental-2

This commit is contained in:
Ali 2020-08-28 17:32:25 +01:00
commit 0b48fe6a52
14 changed files with 217 additions and 85 deletions

View File

@ -1 +1 @@
NC8Ilqd9zpOXIij3OOYFUJxDucj8mEwygMYgxbeBpE0=
8tRwQybvfoDddhSIfdMSOMv4FZd9LSHiWmObmx6d7rE=

View File

@ -9,6 +9,7 @@ static_library(
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#shared",
"//submodules/AsyncDisplayKit:AsyncDisplayKit#shared",
"//submodules/Display:Display#shared",
"//submodules/Postbox:Postbox#shared",
"//submodules/TelegramCore:TelegramCore#shared",
"//submodules/TelegramPresentationData:TelegramPresentationData",
"//submodules/TelegramStringFormatting:TelegramStringFormatting",

View File

@ -10,6 +10,7 @@ swift_library(
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
"//submodules/Display:Display",
"//submodules/Postbox:Postbox",
"//submodules/TelegramCore:TelegramCore",
"//submodules/TelegramPresentationData:TelegramPresentationData",
"//submodules/TelegramStringFormatting:TelegramStringFormatting",

View File

@ -236,6 +236,7 @@ public final class AuthorizationSequenceCountrySelectionController: ViewControll
}
public static func lookupPatternByNumber(_ number: String, preferredCountries: [String: String]) -> String? {
let number = removePlus(number)
if let (_, code) = lookupCountryIdByNumber(number, preferredCountries: preferredCountries), !code.patterns.isEmpty {
var prefixes: [String: String] = [:]
for pattern in code.patterns {

View File

@ -2,6 +2,7 @@ import Foundation
import UIKit
import AsyncDisplayKit
import Display
import Postbox
import TelegramCore
import SyncCore
import TelegramPresentationData
@ -73,6 +74,75 @@ func localizedCountryNamesAndCodes(strings: PresentationStrings) -> [((String, S
return result
}
private func stringTokens(_ string: String) -> [ValueBoxKey] {
let nsString = string.replacingOccurrences(of: ".", with: "").folding(options: .diacriticInsensitive, locale: .current).lowercased() as NSString
let flag = UInt(kCFStringTokenizerUnitWord)
let tokenizer = CFStringTokenizerCreate(kCFAllocatorDefault, nsString, CFRangeMake(0, nsString.length), flag, CFLocaleCopyCurrent())
var tokenType = CFStringTokenizerAdvanceToNextToken(tokenizer)
var tokens: [ValueBoxKey] = []
var addedTokens = Set<ValueBoxKey>()
while tokenType != [] {
let currentTokenRange = CFStringTokenizerGetCurrentTokenRange(tokenizer)
if currentTokenRange.location >= 0 && currentTokenRange.length != 0 {
let token = ValueBoxKey(length: currentTokenRange.length * 2)
nsString.getCharacters(token.memory.assumingMemoryBound(to: unichar.self), range: NSMakeRange(currentTokenRange.location, currentTokenRange.length))
if !addedTokens.contains(token) {
tokens.append(token)
addedTokens.insert(token)
}
}
tokenType = CFStringTokenizerAdvanceToNextToken(tokenizer)
}
return tokens
}
private func matchStringTokens(_ tokens: [ValueBoxKey], with other: [ValueBoxKey]) -> Bool {
if other.isEmpty {
return false
} else if other.count == 1 {
let otherToken = other[0]
for token in tokens {
if otherToken.isPrefix(to: token) {
return true
}
}
} else {
for otherToken in other {
var found = false
for token in tokens {
if otherToken.isPrefix(to: token) {
found = true
break
}
}
if !found {
return false
}
}
return true
}
return false
}
private func searchCountries(items: [((String, String), String, Int)], query: String) -> [((String, String), String, Int)] {
let queryTokens = stringTokens(query.lowercased())
var result: [((String, String), String, Int)] = []
for item in items {
let string = "\(item.0) \(item.1)"
let tokens = stringTokens(string)
if matchStringTokens(tokens, with: queryTokens) {
result.append(item)
}
}
return result
}
final class AuthorizationSequenceCountrySelectionControllerNode: ASDisplayNode, UITableViewDelegate, UITableViewDataSource {
let itemSelected: (((String, String), String, Int)) -> Void
@ -88,6 +158,7 @@ final class AuthorizationSequenceCountrySelectionControllerNode: ASDisplayNode,
private let sectionTitles: [String]
private var searchResults: [((String, String), String, Int)] = []
private let countryNamesAndCodes: [((String, String), String, Int)]
init(theme: PresentationTheme, strings: PresentationStrings, displayCodes: Bool, itemSelected: @escaping (((String, String), String, Int)) -> Void) {
self.theme = theme
@ -107,6 +178,7 @@ final class AuthorizationSequenceCountrySelectionControllerNode: ASDisplayNode,
}
let countryNamesAndCodes = localizedCountryNamesAndCodes(strings: strings)
self.countryNamesAndCodes = countryNamesAndCodes
var sections: [(String, [((String, String), String, Int)])] = []
for (names, id, code) in countryNamesAndCodes.sorted(by: { lhs, rhs in
@ -176,18 +248,7 @@ final class AuthorizationSequenceCountrySelectionControllerNode: ASDisplayNode,
self.searchTableView.reloadData()
self.searchTableView.isHidden = true
} else {
let normalizedQuery = query.lowercased().trimmingCharacters(in: .whitespacesAndNewlines)
var results: [((String, String), String, Int)] = []
for (_, items) in self.sections {
for item in items {
if item.0.0.lowercased().hasPrefix(normalizedQuery) || item.0.1.lowercased().hasPrefix(normalizedQuery) {
results.append(item)
}
}
}
self.searchResults = results
self.searchResults = searchCountries(items: self.countryNamesAndCodes, query: query)
self.searchTableView.isHidden = false
self.searchTableView.reloadData()
}

View File

@ -162,13 +162,21 @@
_initialAdjustments = adjustments;
_screenImage = screenImage;
CGSize originalSize = _item.originalSize;
if ([self presentedForAvatarCreation]) {
CGFloat maxSide = [GPUImageContext maximumTextureSizeForThisDevice];
if (MAX(_item.originalSize.width, _item.originalSize.height) > maxSide) {
originalSize = TGScaleToFit(_item.originalSize, CGSizeMake(maxSide, maxSide));
}
}
_queue = [[SQueue alloc] init];
_photoEditor = [[PGPhotoEditor alloc] initWithOriginalSize:_item.originalSize adjustments:adjustments forVideo:item.isVideo enableStickers:(intent & TGPhotoEditorControllerSignupAvatarIntent) == 0];
_photoEditor = [[PGPhotoEditor alloc] initWithOriginalSize:originalSize adjustments:adjustments forVideo:item.isVideo enableStickers:(intent & TGPhotoEditorControllerSignupAvatarIntent) == 0];
if ([self presentedForAvatarCreation])
{
_photoEditor.cropOnLast = true;
CGFloat shortSide = MIN(_item.originalSize.width, _item.originalSize.height);
_photoEditor.cropRect = CGRectMake((_item.originalSize.width - shortSide) / 2, (_item.originalSize.height - shortSide) / 2, shortSide, shortSide);
CGFloat shortSide = MIN(originalSize.width, originalSize.height);
_photoEditor.cropRect = CGRectMake((originalSize.width - shortSide) / 2, (originalSize.height - shortSide) / 2, shortSide, shortSide);
}
if ([adjustments isKindOfClass:[TGVideoEditAdjustments class]])
@ -354,7 +362,7 @@
[_scrubberView addSubview:_dotMarkerView];
_dotMarkerView.center = CGPointMake(30.0, -20.0);
_dotImageView = [[TGMediaPickerGalleryVideoScrubberThumbnailView alloc] initWithImage:nil originalSize:_item.originalSize cropRect:CGRectZero cropOrientation:UIImageOrientationUp cropMirrored:false];
_dotImageView = [[TGMediaPickerGalleryVideoScrubberThumbnailView alloc] initWithImage:nil originalSize:_photoEditor.originalSize cropRect:CGRectZero cropOrientation:UIImageOrientationUp cropMirrored:false];
_dotImageView.frame = CGRectMake(0.0, 0.0, 160.0, 160.0);
_dotImageView.userInteractionEnabled = true;
@ -505,7 +513,13 @@
}] map:^UIImage *(UIImage *image)
{
if (avatar) {
return image;
CGFloat maxSide = [GPUImageContext maximumTextureSizeForThisDevice];
if (MAX(image.size.width, image.size.height) > maxSide) {
CGSize fittedSize = TGScaleToFit(image.size, CGSizeMake(maxSide, maxSide));
return TGScaleImageToPixelSize(image, fittedSize);
} else {
return image;
}
} else {
return TGPhotoEditorCrop(image, nil, photoEditor.cropOrientation, photoEditor.cropRotation, photoEditor.cropRect, photoEditor.cropMirrored, TGPhotoEditorScreenImageMaxSize(), photoEditor.originalSize, true);
}

View File

@ -10,7 +10,7 @@ import PhoneInputNode
import CountrySelectionUI
private func generateCountryButtonBackground(color: UIColor, strokeColor: UIColor) -> UIImage? {
return generateImage(CGSize(width: 45.0, height: 44.0 + 6.0), rotatedContext: { size, context in
return generateImage(CGSize(width: 56, height: 44.0 + 6.0), rotatedContext: { size, context in
let arrowSize: CGFloat = 6.0
let lineWidth = UIScreenPixel
@ -37,11 +37,11 @@ private func generateCountryButtonBackground(color: UIColor, strokeColor: UIColo
context.move(to: CGPoint(x: 0.0, y: lineWidth / 2.0))
context.addLine(to: CGPoint(x: size.width, y: lineWidth / 2.0))
context.strokePath()
})?.stretchableImage(withLeftCapWidth: 46, topCapHeight: 1)
})?.stretchableImage(withLeftCapWidth: 55, topCapHeight: 1)
}
private func generateCountryButtonHighlightedBackground(color: UIColor) -> UIImage? {
return generateImage(CGSize(width: 45.0, height: 44.0 + 6.0), rotatedContext: { size, context in
return generateImage(CGSize(width: 56.0, height: 44.0 + 6.0), rotatedContext: { size, context in
let arrowSize: CGFloat = 6.0
context.clear(CGRect(origin: CGPoint(), size: size))
context.setFillColor(color.cgColor)
@ -52,11 +52,11 @@ private func generateCountryButtonHighlightedBackground(color: UIColor) -> UIIma
context.addLine(to: CGPoint(x: size.width - 1.0 - arrowSize - arrowSize, y: size.height - arrowSize))
context.closePath()
context.fillPath()
})?.stretchableImage(withLeftCapWidth: 46, topCapHeight: 2)
})?.stretchableImage(withLeftCapWidth: 55, topCapHeight: 2)
}
private func generatePhoneInputBackground(color: UIColor, strokeColor: UIColor) -> UIImage? {
return generateImage(CGSize(width: 60.0, height: 44.0), rotatedContext: { size, context in
return generateImage(CGSize(width: 82.0, height: 44.0), rotatedContext: { size, context in
let lineWidth = UIScreenPixel
context.clear(CGRect(origin: CGPoint(), size: size))
context.setFillColor(color.cgColor)
@ -69,7 +69,7 @@ private func generatePhoneInputBackground(color: UIColor, strokeColor: UIColor)
context.move(to: CGPoint(x: size.width - 2.0 + lineWidth / 2.0, y: size.height - lineWidth / 2.0))
context.addLine(to: CGPoint(x: size.width - 2.0 + lineWidth / 2.0, y: 0.0))
context.strokePath()
})?.stretchableImage(withLeftCapWidth: 61, topCapHeight: 2)
})?.stretchableImage(withLeftCapWidth: 81, topCapHeight: 2)
}
final class ChangePhoneNumberControllerNode: ASDisplayNode {
@ -261,9 +261,9 @@ final class ChangePhoneNumberControllerNode: ASDisplayNode {
transition.updateFrame(node: self.countryButton, frame: CGRect(origin: CGPoint(x: 0.0, y: navigationHeight), size: CGSize(width: layout.size.width, height: 44.0 + 6.0)))
transition.updateFrame(node: self.phoneBackground, frame: CGRect(origin: CGPoint(x: 0.0, y: navigationHeight + 44.0), size: CGSize(width: layout.size.width, height: 44.0)))
let countryCodeFrame = CGRect(origin: CGPoint(x: 9.0, y: navigationHeight + 44.0 + 1.0), size: CGSize(width: 45.0, height: 44.0))
let numberFrame = CGRect(origin: CGPoint(x: 70.0, y: navigationHeight + 44.0 + 1.0), size: CGSize(width: layout.size.width - 70.0 - 8.0, height: 44.0))
let placeholderFrame = numberFrame.offsetBy(dx: -1.0, dy: 8.0)
let countryCodeFrame = CGRect(origin: CGPoint(x: 11.0, y: navigationHeight + 44.0 + 1.0), size: CGSize(width: 67.0, height: 44.0))
let numberFrame = CGRect(origin: CGPoint(x: 92.0, y: navigationHeight + 44.0 + 1.0), size: CGSize(width: layout.size.width - 70.0 - 8.0, height: 44.0))
let placeholderFrame = numberFrame.offsetBy(dx: 0.0, dy: 8.0)
let phoneInputFrame = countryCodeFrame.union(numberFrame)

View File

@ -593,27 +593,6 @@ public final class ShareController: ViewController {
}
self.controllerNode.shareExternal = { [weak self] in
if let strongSelf = self {
// if case let .messages(messages) = strongSelf.subject, let message = messages.first, let peer = message.peers[message.id.peerId] {
// let renderer = MessageStoryRenderer(context: strongSelf.currentContext, messages: messages)
//
// let layout = ContainerViewLayout(size: CGSize(width: 414.0, height: 896.0), metrics: LayoutMetrics(widthClass: .compact, heightClass: .compact), deviceMetrics: .iPhoneX, intrinsicInsets: UIEdgeInsets(), safeInsets: UIEdgeInsets(), statusBarHeight: 0.0, inputHeight: nil, inputHeightIsInteractivellyChanging: false, inVoiceOver: false)
// renderer.update(layout: layout) { image in
// if let data = image?.pngData() {
// let pasteboardItems: [[String: Any]] = [["com.instagram.sharedSticker.backgroundImage": data,
// "com.instagram.sharedSticker.contentURL": "https://t.me/\(peer.addressName ?? "")/\(message.id.id)"]]
// if #available(iOS 10.0, *) {
// UIPasteboard.general.setItems(pasteboardItems, options: [.expirationDate: Date().addingTimeInterval(5 * 60)])
// } else {
//// UIPasteboard.general.setItems(pasteboardItems)
// }
// strongSelf.sharedContext.applicationBindings.openUrl("instagram-stories://share")
// }
// }
//
// return .complete()
// }
var collectableItems: [CollectableExternalShareItem] = []
switch strongSelf.subject {
case let .url(text):
@ -695,7 +674,25 @@ public final class ShareController: ViewController {
activityItems.append(url)
}
}
let activityController = UIActivityViewController(activityItems: activityItems, applicationActivities: nil)
var activities: [UIActivity]?
if false, #available(iOS 10.0, *), strongSelf.sharedContext.applicationBindings.canOpenUrl("instagram-stories://"), case let .messages(messages) = strongSelf.subject, let message = messages.first, let peer = message.peers[message.id.peerId] {
let shareToInstagram = ShareToInstagramActivity(action: { sharedItems in
let renderer = MessageStoryRenderer(context: strongSelf.currentContext, messages: messages)
let layout = ContainerViewLayout(size: CGSize(width: 414.0, height: 896.0), metrics: LayoutMetrics(widthClass: .compact, heightClass: .compact), deviceMetrics: .iPhoneX, intrinsicInsets: UIEdgeInsets(), safeInsets: UIEdgeInsets(), statusBarHeight: 0.0, inputHeight: nil, inputHeightIsInteractivellyChanging: false, inVoiceOver: false)
renderer.update(layout: layout) { image in
if let data = image?.pngData() {
let pasteboardItems: [[String: Any]] = [["com.instagram.sharedSticker.backgroundImage": data,
"com.instagram.sharedSticker.contentURL": "https://t.me/\(peer.addressName ?? "")/\(message.id.id)"]]
UIPasteboard.general.setItems(pasteboardItems, options: [.expirationDate: Date().addingTimeInterval(5 * 60)])
strongSelf.sharedContext.applicationBindings.openUrl("instagram-stories://share")
}
}
})
activities = [shareToInstagram]
}
let activityController = UIActivityViewController(activityItems: activityItems, applicationActivities: activities)
if let window = strongSelf.view.window, let rootViewController = window.rootViewController {
activityController.popoverPresentationController?.sourceView = window
@ -1015,3 +1012,42 @@ final class MessageStoryRenderer {
dateHeaderNode.updateLayout(size: self.containerNode.frame.size, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right)
}
}
private class ShareToInstagramActivity: UIActivity {
private var activityItems = [Any]()
private var action: ([Any]) -> Void
init(action: @escaping ([Any]) -> Void) {
self.action = action
super.init()
}
override var activityTitle: String? {
return "Share to Instagram Stories"
}
override var activityImage: UIImage? {
return nil
}
override var activityType: UIActivity.ActivityType? {
return UIActivity.ActivityType(rawValue: "org.telegram.Telegram.ShareToInstagram")
}
override class var activityCategory: UIActivity.Category {
return .action
}
override func canPerform(withActivityItems activityItems: [Any]) -> Bool {
return true
}
override func prepare(withActivityItems activityItems: [Any]) {
self.activityItems = activityItems
}
override func perform() {
self.action(self.activityItems)
activityDidFinish(true)
}
}

View File

@ -355,7 +355,7 @@ func fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId rawPeerId: PeerI
if (flags & (1 << 10)) == 0 {
channelFlags.insert(.preHistoryEnabled)
}
if (flags & (1 << 12)) != 0 {
if (flags & (1 << 20)) != 0 {
channelFlags.insert(.canViewStats)
}
if (flags & (1 << 7)) != 0 {

View File

@ -27,7 +27,7 @@ private final class PhoneAndCountryNode: ASDisplayNode {
init(strings: PresentationStrings, theme: PresentationTheme) {
self.strings = strings
let countryButtonBackground = generateImage(CGSize(width: 61.0, height: 67.0), rotatedContext: { size, context in
let countryButtonBackground = generateImage(CGSize(width: 68.0, height: 67.0), rotatedContext: { size, context in
let arrowSize: CGFloat = 10.0
let lineWidth = UIScreenPixel
context.clear(CGRect(origin: CGPoint(), size: size))
@ -43,9 +43,9 @@ private final class PhoneAndCountryNode: ASDisplayNode {
context.addLine(to: CGPoint(x: size.width - 1.0 - arrowSize - arrowSize, y: size.height - arrowSize - lineWidth / 2.0))
context.addLine(to: CGPoint(x: 15.0, y: size.height - arrowSize - lineWidth / 2.0))
context.strokePath()
})?.stretchableImage(withLeftCapWidth: 61, topCapHeight: 1)
})?.stretchableImage(withLeftCapWidth: 67, topCapHeight: 1)
let countryButtonHighlightedBackground = generateImage(CGSize(width: 60.0, height: 67.0), rotatedContext: { size, context in
let countryButtonHighlightedBackground = generateImage(CGSize(width: 68.0, height: 67.0), rotatedContext: { size, context in
let arrowSize: CGFloat = 10.0
context.clear(CGRect(origin: CGPoint(), size: size))
context.setFillColor(theme.list.itemHighlightedBackgroundColor.cgColor)
@ -56,9 +56,9 @@ private final class PhoneAndCountryNode: ASDisplayNode {
context.addLine(to: CGPoint(x: size.width - 1.0 - arrowSize - arrowSize, y: size.height - arrowSize))
context.closePath()
context.fillPath()
})?.stretchableImage(withLeftCapWidth: 61, topCapHeight: 2)
})?.stretchableImage(withLeftCapWidth: 67, topCapHeight: 2)
let phoneInputBackground = generateImage(CGSize(width: 85.0, height: 57.0), rotatedContext: { size, context in
let phoneInputBackground = generateImage(CGSize(width: 96.0, height: 57.0), rotatedContext: { size, context in
let lineWidth = UIScreenPixel
context.clear(CGRect(origin: CGPoint(), size: size))
context.setStrokeColor(theme.list.itemPlainSeparatorColor.cgColor)
@ -69,7 +69,7 @@ private final class PhoneAndCountryNode: ASDisplayNode {
context.move(to: CGPoint(x: size.width - 2.0 + lineWidth / 2.0, y: size.height - lineWidth / 2.0))
context.addLine(to: CGPoint(x: size.width - 2.0 + lineWidth / 2.0, y: 0.0))
context.strokePath()
})?.stretchableImage(withLeftCapWidth: 84, topCapHeight: 2)
})?.stretchableImage(withLeftCapWidth: 95, topCapHeight: 2)
self.countryButton = ASButtonNode()
self.countryButton.displaysAsynchronously = false
@ -190,9 +190,9 @@ private final class PhoneAndCountryNode: ASDisplayNode {
self.countryButton.frame = CGRect(origin: CGPoint(), size: CGSize(width: size.width, height: 67.0))
self.phoneBackground.frame = CGRect(origin: CGPoint(x: 0.0, y: size.height - 57.0), size: CGSize(width: size.width, height: 57.0))
let countryCodeFrame = CGRect(origin: CGPoint(x: 18.0, y: size.height - 57.0), size: CGSize(width: 60.0, height: 57.0))
let numberFrame = CGRect(origin: CGPoint(x: 96.0, y: size.height - 57.0), size: CGSize(width: size.width - 96.0 - 8.0, height: 57.0))
let placeholderFrame = numberFrame.offsetBy(dx: -1.0, dy: 16.0)
let countryCodeFrame = CGRect(origin: CGPoint(x: 18.0, y: size.height - 57.0), size: CGSize(width: 71.0, height: 57.0))
let numberFrame = CGRect(origin: CGPoint(x: 107.0, y: size.height - 57.0), size: CGSize(width: size.width - 96.0 - 8.0, height: 57.0))
let placeholderFrame = numberFrame.offsetBy(dx: 0.0, dy: 16.0)
let phoneInputFrame = countryCodeFrame.union(numberFrame)

View File

@ -855,14 +855,44 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
}
}
let updateProgress = { [weak self] in
Queue.mainQueue().async {
if let strongSelf = self {
strongSelf.updateChatPresentationInterfaceState(animated: true, interactive: true, {
return $0.updatedTitlePanelContext {
if let index = $0.firstIndex(where: {
switch $0 {
case .requestInProgress:
return true
default:
return false
}
}) {
var updatedContexts = $0
updatedContexts.remove(at: index)
return updatedContexts
}
return $0
}
})
}
}
}
let account = strongSelf.context.account
if requiresPassword {
strongSelf.messageActionCallbackDisposable.set((requestMessageActionCallbackPasswordCheck(account: account, messageId: messageId, isGame: isGame, data: data)
|> deliverOnMainQueue).start(error: { error in
strongSelf.messageActionCallbackDisposable.set(((requestMessageActionCallbackPasswordCheck(account: account, messageId: messageId, isGame: isGame, data: data)
|> afterDisposed {
updateProgress()
})
|> deliverOnMainQueue).start(error: { error in
let controller = ownershipTransferController(context: context, initialError: error, present: { c, a in
strongSelf.present(c, in: .window(.root), with: a)
}, commit: { password in
return requestMessageActionCallback(account: account, messageId: messageId, isGame: isGame, password: password, data: data)
return requestMessageActionCallback(account: account, messageId: messageId, isGame: isGame, password: password, data: data)
|> afterDisposed {
updateProgress()
}
}, completion: { result in
proceedWithResult(result)
})
@ -871,27 +901,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
} else {
strongSelf.messageActionCallbackDisposable.set(((requestMessageActionCallback(account: account, messageId: messageId, isGame: isGame, password: nil, data: data)
|> afterDisposed {
Queue.mainQueue().async {
if let strongSelf = self {
strongSelf.updateChatPresentationInterfaceState(animated: true, interactive: true, {
return $0.updatedTitlePanelContext {
if let index = $0.firstIndex(where: {
switch $0 {
case .requestInProgress:
return true
default:
return false
}
}) {
var updatedContexts = $0
updatedContexts.remove(at: index)
return updatedContexts
}
return $0
}
})
}
}
updateProgress()
})
|> deliverOnMainQueue).start(next: { result in
proceedWithResult(result)

View File

@ -412,7 +412,12 @@ func contextMenuForChatPresentationIntefaceState(chatPresentationInterfaceState:
let logsPath = callLogsPath(account: context.account)
let logPath = logsPath + "/" + logName
let start = logName.index(logName.startIndex, offsetBy: "\(id)".count + 1)
let end = logName.index(logName.endIndex, offsetBy: -4 - 5)
let end: String.Index
if logName.hasSuffix(".log.json") {
end = logName.index(logName.endIndex, offsetBy: -4 - 5)
} else {
end = logName.index(logName.endIndex, offsetBy: -4)
}
let accessHash = logName[start..<end]
if let accessHash = Int64(accessHash) {
callId = CallId(id: id, accessHash: accessHash)

View File

@ -42,6 +42,9 @@ public func callLogNameForId(id: Int64, account: Account) -> String? {
for url in enumerator {
if let url = url as? URL {
if url.lastPathComponent.hasPrefix(namePrefix) {
if url.lastPathComponent.hasSuffix(".log.json") {
continue
}
return url.lastPathComponent
}
}

@ -1 +1 @@
Subproject commit 970fa3ae9f2f567ca260981e2f4304d6abfd88b7
Subproject commit af8d9313db00e216d5d1572369477e741fc4d461