This commit is contained in:
Peter 2019-08-31 15:36:24 +04:00
parent 9a055b4832
commit 072754c8fe
26 changed files with 4714 additions and 378 deletions

270
BUCK
View File

@ -1,5 +1,30 @@
load("//Config:configs.bzl", "app_binary_configs", "share_extension_configs", "library_configs", "pretty", "info_plist_substitutions", "app_info_plist_substitutions", "share_extension_info_plist_substitutions", "DEVELOPMENT_LANGUAGE")
load("//Config:buck_rule_macros.bzl", "apple_lib", "framework_binary_dependencies", "framework_bundle_dependencies")
load("//Config:configs.bzl",
"app_binary_configs",
"share_extension_configs",
"widget_extension_configs",
"notification_content_extension_configs",
"notification_service_extension_configs",
"intents_extension_configs",
"watch_extension_binary_configs",
"watch_binary_configs",
"library_configs",
"info_plist_substitutions",
"app_info_plist_substitutions",
"share_extension_info_plist_substitutions",
"widget_extension_info_plist_substitutions",
"notification_content_extension_info_plist_substitutions",
"notification_service_extension_info_plist_substitutions",
"intents_extension_info_plist_substitutions",
"watch_extension_info_plist_substitutions",
"watch_info_plist_substitutions",
"DEVELOPMENT_LANGUAGE"
,)
load("//Config:buck_rule_macros.bzl",
"apple_lib",
"framework_binary_dependencies",
"framework_bundle_dependencies",
)
static_library_dependencies = [
]
@ -113,12 +138,6 @@ apple_binary(
+ resource_dependencies,
)
xcode_workspace_config(
name = "workspace",
workspace_name = "Telegram_Buck",
src_target = ":Telegram",
)
apple_bundle(
name = "Telegram",
visibility = [
@ -131,10 +150,17 @@ apple_bundle(
info_plist_substitutions = app_info_plist_substitutions("Telegram"),
deps = [
":ShareExtension",
":WidgetExtension",
":NotificationContentExtension",
":NotificationServiceExtension",
":IntentsExtension",
":WatchApp#watch",
]
+ framework_bundle_dependencies(framework_dependencies),
)
# Share Extension
apple_binary(
name = "ShareBinary",
srcs = glob([
@ -152,6 +178,10 @@ apple_binary(
deps = [
"//submodules/TelegramUI:TelegramUI#shared",
],
frameworks = [
"$SDKROOT/System/Library/Frameworks/UIKit.framework",
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
],
)
apple_bundle(
@ -165,7 +195,231 @@ apple_bundle(
xcode_product_type = "com.apple.product-type.app-extension",
)
# Widget
apple_binary(
name = "WidgetBinary",
srcs = glob([
"Widget/**/*.swift",
]),
configs = widget_extension_configs("Widget"),
linker_flags = [
"-e",
"_NSExtensionMain",
"-Xlinker",
"-rpath",
"-Xlinker",
"@executable_path/../../Frameworks",
],
deps = [
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#shared",
"//submodules/TelegramCore:TelegramCore#shared",
"//submodules/Postbox:Postbox#shared",
"//submodules/BuildConfig:BuildConfig",
],
frameworks = [
"$SDKROOT/System/Library/Frameworks/UIKit.framework",
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
"$SDKROOT/System/Library/Frameworks/NotificationCenter.framework",
],
)
apple_bundle(
name = "WidgetExtension",
binary = ":WidgetBinary",
extension = "appex",
info_plist = "Widget/Info.plist",
info_plist_substitutions = widget_extension_info_plist_substitutions("Widget"),
deps = [
],
xcode_product_type = "com.apple.product-type.app-extension",
)
# Notification Content
apple_binary(
name = "NotificationContentBinary",
srcs = glob([
"NotificationContent/**/*.swift",
]),
configs = notification_content_extension_configs("NotificationContent"),
linker_flags = [
"-e",
"_NSExtensionMain",
"-Xlinker",
"-rpath",
"-Xlinker",
"@executable_path/../../Frameworks",
],
deps = [
"//submodules/TelegramUI:TelegramUI#shared",
],
frameworks = [
"$SDKROOT/System/Library/Frameworks/UIKit.framework",
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
"$SDKROOT/System/Library/Frameworks/UserNotificationsUI.framework",
],
)
apple_bundle(
name = "NotificationContentExtension",
binary = ":NotificationContentBinary",
extension = "appex",
info_plist = "Widget/Info.plist",
info_plist_substitutions = notification_content_extension_info_plist_substitutions("NotificationContent"),
deps = [
],
xcode_product_type = "com.apple.product-type.app-extension",
)
#Notification Service
apple_binary(
name = "NotificationServiceBinary",
srcs = glob([
"NotificationService/**/*.m",
]),
headers = glob([
"NotificationService/**/*.h",
]),
configs = notification_service_extension_configs("NotificationService"),
linker_flags = [
"-e",
"_NSExtensionMain",
"-Xlinker",
"-rpath",
"-Xlinker",
"@executable_path/../../Frameworks",
],
deps = [
"//submodules/BuildConfig:BuildConfig",
"//submodules/MtProtoKit:MtProtoKit#shared",
],
frameworks = [
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
"$SDKROOT/System/Library/Frameworks/UserNotifications.framework",
],
)
apple_bundle(
name = "NotificationServiceExtension",
binary = ":NotificationServiceBinary",
extension = "appex",
info_plist = "Widget/Info.plist",
info_plist_substitutions = notification_service_extension_info_plist_substitutions("NotificationService"),
deps = [
],
xcode_product_type = "com.apple.product-type.app-extension",
)
# Intents
apple_binary(
name = "IntentsBinary",
srcs = glob([
"SiriIntents/**/*.swift",
]),
configs = intents_extension_configs("SiriIntents"),
linker_flags = [
"-e",
"_NSExtensionMain",
"-Xlinker",
"-rpath",
"-Xlinker",
"@executable_path/../../Frameworks",
],
deps = [
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#shared",
"//submodules/Postbox:Postbox#shared",
"//submodules/TelegramCore:TelegramCore#shared",
"//submodules/BuildConfig:BuildConfig",
],
frameworks = [
"$SDKROOT/System/Library/Frameworks/UIKit.framework",
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
],
)
apple_bundle(
name = "IntentsExtension",
binary = ":IntentsBinary",
extension = "appex",
info_plist = "Widget/Info.plist",
info_plist_substitutions = intents_extension_info_plist_substitutions("SiriIntents"),
deps = [
],
xcode_product_type = "com.apple.product-type.app-extension",
)
# Watch
apple_binary(
name = "WatchAppExtensionBinary",
srcs = glob([
"Watch/Extension/**/*.m",
]),
headers = glob([
"Watch/Extension/**/*.h",
]),
compiler_flags = [
"-DTARGET_OS_WATCH=1",
],
configs = watch_extension_binary_configs("watchkitapp.watchkitextension"),
deps = [
"//submodules/WatchCommon:WatchCommonWatch",
],
frameworks = [
"$SDKROOT/System/Library/Frameworks/UserNotifications.framework",
"$SDKROOT/System/Library/Frameworks/CoreLocation.framework",
"$SDKROOT/System/Library/Frameworks/CoreGraphics.framework",
],
)
apple_bundle(
name = "WatchAppExtension",
binary = ":WatchAppExtensionBinary",
extension = "appex",
info_plist = "Watch/Extension/Info.plist",
info_plist_substitutions = watch_extension_info_plist_substitutions("watchkitapp.watchkitextension"),
xcode_product_type = "com.apple.product-type.watchkit2-extension",
)
apple_binary(
name = "WatchAppBinary",
configs = watch_binary_configs("watch.app")
)
apple_bundle(
name = "WatchApp",
binary = ":WatchAppBinary",
visibility = [
"//:",
],
extension = "app",
info_plist = "Watch/App/Info.plist",
info_plist_substitutions = watch_info_plist_substitutions("watchkitapp"),
xcode_product_type = "com.apple.product-type.application.watchapp2",
deps = [
":WatchAppExtension",
":WatchAppResources",
],
)
apple_resource(
name = "WatchAppResources",
dirs = [],
files = glob(["Watch/Extension/Resources/*.png"])
)
# Package
apple_package(
name = "AppPackage",
bundle = ":Telegram",
)
xcode_workspace_config(
name = "workspace",
workspace_name = "Telegram_Buck",
src_target = ":Telegram",
)

View File

@ -36,10 +36,11 @@ SHARED_CONFIGS = {
}
def optimization_config():
return {"SWIFT_OPTIMIZATION_LEVEL": native.read_config('custom', 'optimization')}
return {
"SWIFT_OPTIMIZATION_LEVEL": native.read_config('custom', 'optimization'),
}
# Adding `-all_load` to our binaries works around https://bugs.swift.org/browse/SR-6004. See the
# longer comment in `ViewController.swift` for more details.
# Adding `-all_load` to our binaries works around https://bugs.swift.org/browse/SR-6004.
ALL_LOAD_LINKER_FLAG = "-all_load"
def bundle_identifier(name):
@ -123,6 +124,106 @@ def share_extension_configs(name):
binary_config = config_with_updated_linker_flags(binary_config, ALL_LOAD_LINKER_FLAG)
return configs_with_config(binary_config)
def widget_extension_configs(name):
binary_specific_config = {
"ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES": "NO",
"DEVELOPMENT_LANGUAGE": DEVELOPMENT_LANGUAGE,
"PRODUCT_BUNDLE_IDENTIFIER": "org.telegram.Telegram-iOS." + name,
"CODE_SIGN_IDENTITY": "iPhone Developer: Peter Iakovlev (9J4EJ3F97G)",
"CODE_SIGN_ENTITLEMENTS": "Widget/Widget-HockeyApp.entitlements",
"DEVELOPMENT_TEAM": "X834Q8SBVP",
"PROVISIONING_PROFILE_SPECIFIER": "match Development org.telegram.Telegram-iOS.Widget",
"BUILD_NUMBER": appConfig()["buildNumber"],
"APP_NAME": "Telegram",
"PRODUCT_NAME": "WidgetExtension",
}
binary_config = merge_dict(SHARED_CONFIGS, binary_specific_config)
binary_config = merge_dict(binary_config, optimization_config())
binary_config = config_with_updated_linker_flags(binary_config, ALL_LOAD_LINKER_FLAG)
return configs_with_config(binary_config)
def notification_content_extension_configs(name):
binary_specific_config = {
"ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES": "NO",
"DEVELOPMENT_LANGUAGE": DEVELOPMENT_LANGUAGE,
"PRODUCT_BUNDLE_IDENTIFIER": "org.telegram.Telegram-iOS." + name,
"CODE_SIGN_IDENTITY": "iPhone Developer: Peter Iakovlev (9J4EJ3F97G)",
"CODE_SIGN_ENTITLEMENTS": "NotificationContent/NotificationContent-HockeyApp.entitlements",
"DEVELOPMENT_TEAM": "X834Q8SBVP",
"PROVISIONING_PROFILE_SPECIFIER": "match Development org.telegram.Telegram-iOS.NotificationContent",
"BUILD_NUMBER": appConfig()["buildNumber"],
"APP_NAME": "Telegram",
"PRODUCT_NAME": "NotificationContentExtension",
}
binary_config = merge_dict(SHARED_CONFIGS, binary_specific_config)
binary_config = merge_dict(binary_config, optimization_config())
binary_config = config_with_updated_linker_flags(binary_config, ALL_LOAD_LINKER_FLAG)
return configs_with_config(binary_config)
def notification_service_extension_configs(name):
binary_specific_config = {
"ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES": "NO",
"DEVELOPMENT_LANGUAGE": DEVELOPMENT_LANGUAGE,
"PRODUCT_BUNDLE_IDENTIFIER": "org.telegram.Telegram-iOS." + name,
"CODE_SIGN_IDENTITY": "iPhone Developer: Peter Iakovlev (9J4EJ3F97G)",
"CODE_SIGN_ENTITLEMENTS": "NotificationService/NotificationService-HockeyApp.entitlements",
"DEVELOPMENT_TEAM": "X834Q8SBVP",
"PROVISIONING_PROFILE_SPECIFIER": "match Development org.telegram.Telegram-iOS.NotificationService",
"BUILD_NUMBER": appConfig()["buildNumber"],
"APP_NAME": "Telegram",
"PRODUCT_NAME": "NotificationServiceExtension",
}
binary_config = merge_dict(SHARED_CONFIGS, binary_specific_config)
binary_config = merge_dict(binary_config, optimization_config())
binary_config = config_with_updated_linker_flags(binary_config, ALL_LOAD_LINKER_FLAG)
return configs_with_config(binary_config)
def intents_extension_configs(name):
binary_specific_config = {
"ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES": "NO",
"DEVELOPMENT_LANGUAGE": DEVELOPMENT_LANGUAGE,
"PRODUCT_BUNDLE_IDENTIFIER": "org.telegram.Telegram-iOS." + name,
"CODE_SIGN_IDENTITY": "iPhone Developer: Peter Iakovlev (9J4EJ3F97G)",
"CODE_SIGN_ENTITLEMENTS": "SiriIntents/SiriIntents-HockeyApp.entitlements",
"DEVELOPMENT_TEAM": "X834Q8SBVP",
"PROVISIONING_PROFILE_SPECIFIER": "match Development org.telegram.Telegram-iOS.SiriIntents",
"BUILD_NUMBER": appConfig()["buildNumber"],
"APP_NAME": "Telegram",
"PRODUCT_NAME": "IntentsExtension",
}
binary_config = merge_dict(SHARED_CONFIGS, binary_specific_config)
binary_config = merge_dict(binary_config, optimization_config())
binary_config = config_with_updated_linker_flags(binary_config, ALL_LOAD_LINKER_FLAG)
return configs_with_config(binary_config)
def watch_extension_binary_configs(name):
config = {
"SDKROOT": "watchos",
"WATCHOS_DEPLOYMENT_TARGET": "4.0",
"TARGETED_DEVICE_FAMILY": "4",
"PRODUCT_BUNDLE_IDENTIFIER": bundle_identifier("watchkitapp.watchkitextension"),
"LD_RUNPATH_SEARCH_PATHS": "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks",
"WK_COMPANION_APP_BUNDLE_IDENTIFIER": bundle_identifier("watchkitapp"),
"WK_APP_BUNDLE_IDENTIFIER": bundle_identifier("watchkitapp"),
"ENABLE_BITCODE": "YES",
}
config = config_with_updated_linker_flags(config, ALL_LOAD_LINKER_FLAG)
return configs_with_config(config)
def watch_binary_configs(name):
config = {
"SDKROOT": "watchos",
"WATCHOS_DEPLOYMENT_TARGET": "4.0",
"TARGETED_DEVICE_FAMILY": "4",
"PRODUCT_BUNDLE_IDENTIFIER": bundle_identifier("watchkitapp"),
"LD_RUNPATH_SEARCH_PATHS": "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks",
"WK_COMPANION_APP_BUNDLE_IDENTIFIER": bundle_identifier("watchkitapp"),
"WK_APP_BUNDLE_IDENTIFIER": bundle_identifier("watchkitapp"),
"ENABLE_BITCODE": "YES",
}
config = config_with_updated_linker_flags(config, ALL_LOAD_LINKER_FLAG)
return configs_with_config(config)
def info_plist_substitutions(name):
substitutions = {
"DEVELOPMENT_LANGUAGE": DEVELOPMENT_LANGUAGE,
@ -159,3 +260,79 @@ def share_extension_info_plist_substitutions(name):
"BUILD_NUMBER": appConfig()["buildNumber"],
}
return substitutions
def widget_extension_info_plist_substitutions(name):
substitutions = {
"DEVELOPMENT_LANGUAGE": DEVELOPMENT_LANGUAGE,
"EXECUTABLE_NAME": name,
"PRODUCT_BUNDLE_IDENTIFIER": "org.telegram.Telegram-iOS.Widget",
"PRODUCT_NAME": name,
"CURRENT_PROJECT_VERSION": "1",
"CODE_SIGN_IDENTITY": "iPhone Developer: Peter Iakovlev (9J4EJ3F97G)",
"APP_SPECIFIC_URL_SCHEME": appConfig()["appSpecificUrlScheme"],
"BUILD_NUMBER": appConfig()["buildNumber"],
}
return substitutions
def notification_content_extension_info_plist_substitutions(name):
substitutions = {
"DEVELOPMENT_LANGUAGE": DEVELOPMENT_LANGUAGE,
"EXECUTABLE_NAME": name,
"PRODUCT_BUNDLE_IDENTIFIER": "org.telegram.Telegram-iOS.NotificationContent",
"PRODUCT_NAME": name,
"CURRENT_PROJECT_VERSION": "1",
"CODE_SIGN_IDENTITY": "iPhone Developer: Peter Iakovlev (9J4EJ3F97G)",
"APP_SPECIFIC_URL_SCHEME": appConfig()["appSpecificUrlScheme"],
"BUILD_NUMBER": appConfig()["buildNumber"],
}
return substitutions
def notification_service_extension_info_plist_substitutions(name):
substitutions = {
"DEVELOPMENT_LANGUAGE": DEVELOPMENT_LANGUAGE,
"EXECUTABLE_NAME": name,
"PRODUCT_BUNDLE_IDENTIFIER": "org.telegram.Telegram-iOS.NotificationService",
"PRODUCT_NAME": name,
"CURRENT_PROJECT_VERSION": "1",
"CODE_SIGN_IDENTITY": "iPhone Developer: Peter Iakovlev (9J4EJ3F97G)",
"APP_SPECIFIC_URL_SCHEME": appConfig()["appSpecificUrlScheme"],
"BUILD_NUMBER": appConfig()["buildNumber"],
}
return substitutions
def intents_extension_info_plist_substitutions(name):
substitutions = {
"DEVELOPMENT_LANGUAGE": DEVELOPMENT_LANGUAGE,
"EXECUTABLE_NAME": name,
"PRODUCT_BUNDLE_IDENTIFIER": "org.telegram.Telegram-iOS.SiriIntents",
"PRODUCT_NAME": name,
"CURRENT_PROJECT_VERSION": "1",
"CODE_SIGN_IDENTITY": "iPhone Developer: Peter Iakovlev (9J4EJ3F97G)",
"APP_SPECIFIC_URL_SCHEME": appConfig()["appSpecificUrlScheme"],
"BUILD_NUMBER": appConfig()["buildNumber"],
}
return substitutions
def watch_extension_info_plist_substitutions(name):
substitutions = {
"DEVELOPMENT_LANGUAGE": DEVELOPMENT_LANGUAGE,
"EXECUTABLE_NAME": name,
"PRODUCT_BUNDLE_IDENTIFIER": "org.telegram.Telegram-iOS.watchkitapp.watchkitextension",
"PRODUCT_NAME": name,
"CURRENT_PROJECT_VERSION": "1",
"CODE_SIGN_IDENTITY": "iPhone Developer: Peter Iakovlev (9J4EJ3F97G)",
"BUILD_NUMBER": appConfig()["buildNumber"],
}
return substitutions
def watch_info_plist_substitutions(name):
substitutions = {
"DEVELOPMENT_LANGUAGE": DEVELOPMENT_LANGUAGE,
"EXECUTABLE_NAME": name,
"PRODUCT_BUNDLE_IDENTIFIER": "org.telegram.Telegram-iOS.watchkitapp",
"PRODUCT_NAME": name,
"CURRENT_PROJECT_VERSION": "1",
"CODE_SIGN_IDENTITY": "iPhone Developer: Peter Iakovlev (9J4EJ3F97G)",
"BUILD_NUMBER": appConfig()["buildNumber"],
}
return substitutions

View File

@ -1,260 +0,0 @@
import Foundation
import Display
import TelegramCore
import TelegramUI
import Postbox
import SwiftSignalKit
private let accountCache = Atomic<[AccountRecordId: Account]>(value: [:])
private struct ChatHistoryFragmentEntry: Comparable, Identifiable {
let message: Message
let read: Bool
var stableId: UInt32 {
return self.message.stableId
}
}
private func==(lhs: ChatHistoryFragmentEntry, rhs: ChatHistoryFragmentEntry) -> Bool {
if MessageIndex(lhs.message) == MessageIndex(rhs.message) && lhs.message.flags == rhs.message.flags {
if lhs.message.media.count != rhs.message.media.count {
return false
}
if lhs.read != rhs.read {
return false
}
for i in 0 ..< lhs.message.media.count {
if !lhs.message.media[i].isEqual(rhs.message.media[i]) {
return false
}
}
return true
} else {
return false
}
}
private func <(lhs: ChatHistoryFragmentEntry, rhs: ChatHistoryFragmentEntry) -> Bool {
return MessageIndex(lhs.message) < MessageIndex(rhs.message)
}
private final class ChatHistoryFragmentDisplayItem {
fileprivate let item: ListViewItem
fileprivate var node: ListViewItemNode?
init(item: ListViewItem) {
self.item = item
}
init(item: ListViewItem, node: ListViewItemNode?) {
self.item = item
self.node = node
}
}
final class ChatHistoryFragmentView: UIView {
private let sizeUpdated: (CGSize) -> Void
private var layoutWidth: CGFloat?
private var displayItems: [ChatHistoryFragmentDisplayItem] = []
private let disposable = MetaDisposable()
let account = Promise<Account>()
init(peerId: PeerId, width: CGFloat, sizeUpdated: @escaping (CGSize) -> Void) {
self.sizeUpdated = sizeUpdated
self.layoutWidth = width
super.init(frame: CGRect())
/*let appBundleIdentifier = Bundle.main.bundleIdentifier!
guard let lastDotRange = appBundleIdentifier.range(of: ".", options: [.backwards]) else {
return
}
let appGroupName = "group.\(appBundleIdentifier.substring(to: lastDotRange.lowerBound))"
let maybeAppGroupUrl = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroupName)
guard let appGroupUrl = maybeAppGroupUrl else {
return
}
let accountPromise = self.account
let accountId = currentAccountId(appGroupPath: appGroupUrl.path, testingEnvironment: false)
let authorizedAccount: Signal<Account, NoError>
let cachedAccount = accountCache.with { dict -> Account? in
if let account = dict[accountId] {
return account
} else {
return nil
}
}
if let cachedAccount = cachedAccount {
authorizedAccount = .single(cachedAccount)
} else {
authorizedAccount = accountWithId(accountId, appGroupPath: appGroupUrl.path, logger: .named("notification-content"), testingEnvironment: false) |> mapToSignal { account -> Signal<Account, NoError> in
switch account {
case .left:
return .complete()
case let .right(authorizedAccount):
setupAccount(authorizedAccount)
let _ = accountCache.modify { dict in
var dict = dict
dict[accountId] = authorizedAccount
return dict
}
return .single(authorizedAccount)
}
}
}
let view = authorizedAccount
|> take(1)
|> mapToSignal { account -> Signal<(Account, MessageHistoryView, ViewUpdateType), NoError> in
accountPromise.set(.single(account))
account.stateManager.reset()
account.shouldBeServiceTaskMaster.set(.single(.now))
let view = account.viewTracker.aroundMessageHistoryViewForPeerId(peerId, index: MessageIndex.upperBound(peerId: peerId), count: 20, anchorIndex: MessageIndex.upperBound(peerId: peerId), fixedCombinedReadStates: nil, tagMask: nil)
|> map { view, updateType, _ -> (Account, MessageHistoryView, ViewUpdateType) in
return (account, view, updateType)
}
return view
}
let previousEntries = Atomic<[ChatHistoryFragmentEntry]>(value: [])
let controllerInteraction = ChatControllerInteraction(openMessage: { _ in }, openSecretMessagePreview: { _ in }, closeSecretMessagePreview: { }, openPeer: { _ in }, openPeerMention: { _ in }, openMessageContextMenu: { _ in }, navigateToMessage: { _ in }, clickThroughMessage: { }, toggleMessagesSelection: { _ in }, sendMessage: { _ in }, sendSticker: { _ in }, requestMessageActionCallback: { _ in }, openUrl: { _ in }, shareCurrentLocation: {}, shareAccountContact: {}, sendBotCommand: { _, _ in }, openInstantPage: { _ in }, openHashtag: { _ in }, updateInputState: { _ in })
let messages = view
|> map { (account, view, viewUpdateType) -> (Account, [ChatHistoryFragmentEntry], [Int: Int]) in
var entries: [ChatHistoryFragmentEntry] = []
for entry in view.entries.reversed() {
switch entry {
case let .MessageEntry(message, read, _):
entries.append(ChatHistoryFragmentEntry(message: message, read: read))
default:
break
}
}
var previousIndices: [Int: Int] = [:]
let _ = previousEntries.modify { previousEntries in
var index = 0
for entry in entries {
var previousIndex = 0
for previousEntry in previousEntries {
if previousEntry.stableId == entry.stableId {
previousIndices[index] = previousIndex
break
}
previousIndex += 1
}
index += 1
}
return entries
}
return (account, entries, previousIndices)
}
let displayItems = messages
|> map { (account, messages, previousIndices) -> ([ChatHistoryFragmentDisplayItem], [Int: Int]) in
var result: [ChatHistoryFragmentDisplayItem] = []
for entry in messages {
result.append(ChatHistoryFragmentDisplayItem(item: ChatMessageItem(account: account, peerId: peerId, controllerInteraction: controllerInteraction, message: entry.message, read: entry.read)))
}
return (result, previousIndices)
}
let semaphore = DispatchSemaphore(value: 0)
var resultItems: [ChatHistoryFragmentDisplayItem]?
disposable.set(displayItems.start(next: { [weak self] (displayItems, previousIndices) in
if resultItems == nil {
resultItems = displayItems
semaphore.signal()
} else {
Queue.mainQueue().async {
if let strongSelf = self {
var updatedDisplayItems: [ChatHistoryFragmentDisplayItem] = []
for i in 0 ..< displayItems.count {
if let previousIndex = previousIndices[i] {
updatedDisplayItems.append(ChatHistoryFragmentDisplayItem(item: displayItems[i].item, node: strongSelf.displayItems[previousIndex].node))
} else {
updatedDisplayItems.append(displayItems[i])
}
}
let previousIndexSet = Set(previousIndices.values)
for i in 0 ..< strongSelf.displayItems.count {
if !previousIndexSet.contains(i) {
strongSelf.displayItems[i].node?.removeFromSupernode()
}
}
strongSelf.displayItems = updatedDisplayItems
if let layoutWidth = strongSelf.layoutWidth {
strongSelf.updateDisplayItems(width: layoutWidth)
}
}
}
}
}))
semaphore.wait()
if let resultItems = resultItems {
self.displayItems = resultItems
}
if let layoutWidth = self.layoutWidth {
self.updateDisplayItems(width: layoutWidth)
}*/
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
deinit {
self.disposable.dispose()
}
private func updateDisplayItems(width: CGFloat) {
for i in 0 ..< self.displayItems.count {
if let node = self.displayItems[i].node {
self.displayItems[i].item.updateNode(async: { $0() }, node: node, width: width, previousItem: i == 0 ? nil : self.displayItems[i - 1].item, nextItem: i == self.displayItems.count - 1 ? nil : self.displayItems[i + 1].item, animation: .None, completion: { layout, apply in
node.insets = layout.insets
node.contentSize = layout.contentSize
apply()
})
node.layoutForWidth(width, item: self.displayItems[i].item, previousItem: i == 0 ? nil : self.displayItems[i - 1].item, nextItem: i == self.displayItems.count - 1 ? nil : self.displayItems[i + 1].item)
} else {
self.displayItems[i].item.nodeConfiguredForWidth(async: { $0() }, width: width, previousItem: i == 0 ? nil : self.displayItems[i - 1].item, nextItem: i == self.displayItems.count - 1 ? nil : self.displayItems[i + 1].item, completion: { node, apply in
apply()
self.displayItems[i].node = node
self.addSubnode(node)
})
}
}
var verticalOffset: CGFloat = 4.0
for displayItem in self.displayItems {
if let node = displayItem.node {
node.frame = CGRect(origin: CGPoint(x: 0.0, y: verticalOffset), size: node.layout.size)
verticalOffset += node.layout.size.height
}
}
let displaySize = CGSize(width: width, height: verticalOffset + 4.0)
self.sizeUpdated(displaySize)
}
override func layoutSubviews() {
super.layoutSubviews()
if self.layoutWidth != self.bounds.size.width {
self.layoutWidth = self.bounds.size.width
self.updateDisplayItems(width: self.bounds.size.width)
}
}
}

View File

@ -5,6 +5,7 @@ import TelegramUI
import BuildConfig
@objc(NotificationViewController)
@available(iOSApplicationExtension 10.0, *)
class NotificationViewController: UIViewController, UNNotificationContentExtension {
private var impl: NotificationViewControllerImpl?

View File

@ -1,6 +1,11 @@
#import "Attachments.h"
#import <MtProtoKitDynamic/MtProtoKitDynamic.h>
#ifdef BUCK
#import <MTProtoKit/MTProtoKit.h>
#else
#import <MTProtoKitDynamic/MTProtoKitDynamic.h>
#endif
#import "Api.h"
id _Nullable parseAttachment(NSData * _Nonnull data) {

View File

@ -1,6 +1,10 @@
#import "FetchImage.h"
#ifdef BUCK
#import <MTProtoKit/MTProtoKit.h>
#else
#import <MTProtoKitDynamic/MTProtoKitDynamic.h>
#endif
#import "Serialization.h"

View File

@ -1,5 +1,10 @@
#import <Foundation/Foundation.h>
#ifdef BUCK
#import <MTProtoKit/MTProtoKit.h>
#else
#import <MTProtoKitDynamic/MTProtoKitDynamic.h>
#endif
NS_ASSUME_NONNULL_BEGIN

View File

@ -1,6 +1,11 @@
#import "StoredAccountInfos.h"
#import <MtProtoKitDynamic/MtProtoKitDynamic.h>
#ifdef BUCK
#import <MTProtoKit/MTProtoKit.h>
#else
#import <MTProtoKitDynamic/MTProtoKitDynamic.h>
#endif
#import <CommonCrypto/CommonDigest.h>
@implementation AccountNotificationKey

View File

@ -45,6 +45,7 @@ private func cleanPhoneNumber(_ text: String) -> String {
return result
}
@available(iOSApplicationExtension 10.0, *)
func matchingDeviceContacts(stableIds: [String]) -> Signal<[MatchingDeviceContact], IntentContactsError> {
guard CNContactStore.authorizationStatus(for: .contacts) == .authorized else {
return .fail(.generic)
@ -118,6 +119,7 @@ func matchingCloudContact(postbox: Postbox, peerId: PeerId) -> Signal<TelegramUs
}
}
@available(iOSApplicationExtension 10.0, *)
func personWithUser(stableId: String, user: TelegramUser) -> INPerson {
var nameComponents = PersonNameComponents()
nameComponents.givenName = user.firstName

View File

@ -47,6 +47,7 @@ enum IntentHandlingError {
case generic
}
@available(iOSApplicationExtension 10.0, *)
class IntentHandler: INExtension, INSendMessageIntentHandling, INSearchForMessagesIntentHandling, INSetMessageAttributeIntentHandling, INStartAudioCallIntentHandling, INSearchCallHistoryIntentHandling {
private let accountPromise = Promise<Account?>()

View File

@ -16,6 +16,7 @@ extension MessageId {
}
}
@available(iOSApplicationExtension 10.0, *)
func getMessages(account: Account, ids: [MessageId]) -> Signal<[INMessage], NoError> {
return account.postbox.transaction { transaction -> [INMessage] in
var messages: [INMessage] = []
@ -28,6 +29,7 @@ func getMessages(account: Account, ids: [MessageId]) -> Signal<[INMessage], NoEr
}
}
@available(iOSApplicationExtension 10.0, *)
func unreadMessages(account: Account) -> Signal<[INMessage], NoError> {
return account.postbox.tailChatListView(groupId: .root, count: 20, summaryComponents: ChatListEntrySummaryComponents())
|> take(1)
@ -86,6 +88,7 @@ func unreadMessages(account: Account) -> Signal<[INMessage], NoError> {
}
}
@available(iOSApplicationExtension 10.0, *)
struct CallRecord {
let identifier: String
let date: Date
@ -99,6 +102,7 @@ struct CallRecord {
}
}
@available(iOSApplicationExtension 10.0, *)
func missedCalls(account: Account) -> Signal<[CallRecord], NoError> {
return account.viewTracker.callListView(type: .missed, index: MessageIndex.absoluteUpperBound(), count: 30)
|> take(1)
@ -120,6 +124,7 @@ func missedCalls(account: Account) -> Signal<[CallRecord], NoError> {
}
}
@available(iOSApplicationExtension 10.0, *)
private func callWithTelegramMessage(_ telegramMessage: Message, account: Account) -> CallRecord? {
guard let author = telegramMessage.author, let user = telegramMessage.peers[author.id] as? TelegramUser else {
return nil
@ -158,6 +163,7 @@ private func callWithTelegramMessage(_ telegramMessage: Message, account: Accoun
return CallRecord(identifier: identifier, date: date, caller: caller, duration: duration, unseen: true)
}
@available(iOSApplicationExtension 10.0, *)
private func messageWithTelegramMessage(_ telegramMessage: Message) -> INMessage? {
guard let author = telegramMessage.author, let user = telegramMessage.peers[author.id] as? TelegramUser, user.id.id != 777000 else {
return nil

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "9999"
wasCreatedForAppExtension = "YES"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E66DC04EB2C34D2100000000"
BuildableName = "Telegram.app"
BlueprintName = "Telegram"
ReferencedContainer = "container:Project.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E66DC04ECA074AD000000000"
BuildableName = "IntentsExtension.appex"
BlueprintName = "IntentsExtension#iphonesimulator-x86_64"
ReferencedContainer = "container:Project.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E66DC04EB2C34D2100000000"
BuildableName = "Telegram.app"
BlueprintName = "Telegram"
ReferencedContainer = "container:Project.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E66DC04EB2C34D2100000000"
BuildableName = "Telegram.app"
BlueprintName = "Telegram"
ReferencedContainer = "container:Project.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "9999"
wasCreatedForAppExtension = "YES"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E66DC04EB2C34D2100000000"
BuildableName = "Telegram.app"
BlueprintName = "Telegram"
ReferencedContainer = "container:Project.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E66DC04EF6E8B68700000000"
BuildableName = "NotificationContentExtension.appex"
BlueprintName = "NotificationContentExtension#iphonesimulator-x86_64"
ReferencedContainer = "container:Project.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E66DC04EB2C34D2100000000"
BuildableName = "Telegram.app"
BlueprintName = "Telegram"
ReferencedContainer = "container:Project.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E66DC04EB2C34D2100000000"
BuildableName = "Telegram.app"
BlueprintName = "Telegram"
ReferencedContainer = "container:Project.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "9999"
wasCreatedForAppExtension = "YES"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E66DC04EB2C34D2100000000"
BuildableName = "Telegram.app"
BlueprintName = "Telegram"
ReferencedContainer = "container:Project.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E66DC04E8C3D58C300000000"
BuildableName = "NotificationServiceExtension.appex"
BlueprintName = "NotificationServiceExtension#iphonesimulator-x86_64"
ReferencedContainer = "container:Project.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E66DC04EB2C34D2100000000"
BuildableName = "Telegram.app"
BlueprintName = "Telegram"
ReferencedContainer = "container:Project.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E66DC04EB2C34D2100000000"
BuildableName = "Telegram.app"
BlueprintName = "Telegram"
ReferencedContainer = "container:Project.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -1 +1,97 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><Scheme LastUpgradeVersion="9999" version="1.7" wasCreatedForAppExtension="YES"><BuildAction buildImplicitDependencies="YES" parallelizeBuildables="YES"><BuildActionEntries><BuildActionEntry buildForAnalyzing="YES" buildForArchiving="YES" buildForProfiling="YES" buildForRunning="YES" buildForTesting="YES"><BuildableReference BlueprintIdentifier="E66DC04EB2C34D2100000000" BlueprintName="Telegram" BuildableIdentifier="primary" BuildableName="Telegram.app" ReferencedContainer="container:Project.xcodeproj"/></BuildActionEntry><BuildActionEntry buildForAnalyzing="YES" buildForArchiving="YES" buildForProfiling="YES" buildForRunning="YES" buildForTesting="YES"><BuildableReference BlueprintIdentifier="E66DC04EE64F555800000000" BlueprintName="ShareExtension" BuildableIdentifier="primary" BuildableName="ShareExtension.appex" ReferencedContainer="container:Project.xcodeproj"/></BuildActionEntry></BuildActionEntries></BuildAction><TestAction buildConfiguration="Debug" shouldUseLaunchSchemeArgsEnv="YES"><Testables/></TestAction><LaunchAction buildConfiguration="Debug" launchStyle="0"><BuildableProductRunnable><BuildableReference BlueprintIdentifier="E66DC04EB2C34D2100000000" BlueprintName="Telegram" BuildableIdentifier="primary" BuildableName="Telegram.app" ReferencedContainer="container:Project.xcodeproj"/></BuildableProductRunnable></LaunchAction><ProfileAction buildConfiguration="Release" shouldUseLaunchSchemeArgsEnv="YES"><BuildableProductRunnable><BuildableReference BlueprintIdentifier="E66DC04EB2C34D2100000000" BlueprintName="Telegram" BuildableIdentifier="primary" BuildableName="Telegram.app" ReferencedContainer="container:Project.xcodeproj"/></BuildableProductRunnable></ProfileAction><AnalyzeAction buildConfiguration="Debug"/><ArchiveAction buildConfiguration="Release" revealArchiveInOrganizer="YES"/></Scheme>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "9999"
wasCreatedForAppExtension = "YES"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E66DC04EB2C34D2100000000"
BuildableName = "Telegram.app"
BlueprintName = "Telegram"
ReferencedContainer = "container:Project.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E66DC04EE64F555800000000"
BuildableName = "ShareExtension.appex"
BlueprintName = "ShareExtension#iphonesimulator-x86_64"
ReferencedContainer = "container:Project.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E66DC04EB2C34D2100000000"
BuildableName = "Telegram.app"
BlueprintName = "Telegram"
ReferencedContainer = "container:Project.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E66DC04EB2C34D2100000000"
BuildableName = "Telegram.app"
BlueprintName = "Telegram"
ReferencedContainer = "container:Project.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "9999"
wasCreatedForAppExtension = "YES"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E66DC04EB2C34D2100000000"
BuildableName = "Telegram.app"
BlueprintName = "Telegram"
ReferencedContainer = "container:Project.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E66DC04E86ED67FD00000000"
BuildableName = "WidgetExtension.appex"
BlueprintName = "WidgetExtension#iphonesimulator-x86_64"
ReferencedContainer = "container:Project.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E66DC04EB2C34D2100000000"
BuildableName = "Telegram.app"
BlueprintName = "Telegram"
ReferencedContainer = "container:Project.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E66DC04EB2C34D2100000000"
BuildableName = "Telegram.app"
BlueprintName = "Telegram"
ReferencedContainer = "container:Project.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

File diff suppressed because one or more lines are too long

View File

@ -72,7 +72,7 @@ private func avatarViewLettersImage(size: CGSize, peerId: PeerId, accountPeerId:
context?.setBlendMode(.normal)
let string = letters.count == 0 ? "" : (letters[0] + (letters.count == 1 ? "" : letters[1]))
let attributedString = NSAttributedString(string: string, attributes: [NSAttributedStringKey.font: UIFont.systemFont(ofSize: 20.0), NSAttributedStringKey.foregroundColor: UIColor.white])
let attributedString = NSAttributedString(string: string, attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 20.0), NSAttributedString.Key.foregroundColor: UIColor.white])
let line = CTLineCreateWithAttributedString(attributedString)
let lineBounds = CTLineGetBoundsWithOptions(line, .useGlyphPathBounds)

View File

@ -222,7 +222,7 @@ class TodayViewController: UIViewController, NCWidgetProviding {
self.view.drawHierarchy(in: self.view.bounds, afterScreenUpdates: false)
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
if let image = image, let data = UIImagePNGRepresentation(image) {
if let image = image, let data = image.pngData() {
let _ = try? FileManager.default.removeItem(atPath: path)
do {
try data.write(to: URL(fileURLWithPath: path))

View File

@ -1 +1,71 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><Scheme LastUpgradeVersion="9999" version="1.7"><BuildAction buildImplicitDependencies="YES" parallelizeBuildables="YES"><BuildActionEntries><BuildActionEntry buildForAnalyzing="YES" buildForArchiving="YES" buildForProfiling="YES" buildForRunning="YES" buildForTesting="YES"><BuildableReference BlueprintIdentifier="E66DC04E89A74F8D00000000" BlueprintName="SwiftSignalKit" BuildableIdentifier="primary" BuildableName="libSwiftSignalKit.dylib" ReferencedContainer="container:SwiftSignalKit.xcodeproj"/></BuildActionEntry></BuildActionEntries></BuildAction><TestAction buildConfiguration="Debug" shouldUseLaunchSchemeArgsEnv="YES"><Testables/></TestAction><LaunchAction buildConfiguration="Debug"/><ProfileAction buildConfiguration="Release"/><AnalyzeAction buildConfiguration="Debug"/><ArchiveAction buildConfiguration="Release" revealArchiveInOrganizer="YES"/></Scheme>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "9999"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E66DC04E89A74F8D00000000"
BuildableName = "libSwiftSignalKit.dylib"
BlueprintName = "SwiftSignalKit#shared"
ReferencedContainer = "container:SwiftSignalKit.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E66DC04E89A74F8D00000000"
BuildableName = "libSwiftSignalKit.dylib"
BlueprintName = "SwiftSignalKit#shared"
ReferencedContainer = "container:SwiftSignalKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -3,10 +3,10 @@
#import <Foundation/Foundation.h>
NSData * _Nonnull CryptoMD5(const void *bytes, int count);
NSData * _Nonnull CryptoSHA1(const void *bytes, int count);
NSData * _Nonnull CryptoSHA256(const void *bytes, int count);
NSData * _Nonnull CryptoSHA512(const void *bytes, int count);
NSData * _Nonnull CryptoMD5(const void * _Nonnull bytes, int count);
NSData * _Nonnull CryptoSHA1(const void * _Nonnull bytes, int count);
NSData * _Nonnull CryptoSHA256(const void * _Nonnull bytes, int count);
NSData * _Nonnull CryptoSHA512(const void * _Nonnull bytes, int count);
@interface IncrementalMD5 : NSObject

View File

@ -2,25 +2,25 @@
#import <CommonCrypto/CommonCrypto.h>
NSData * _Nonnull CryptoMD5(const void *bytes, int count) {
NSData * _Nonnull CryptoMD5(const void * _Nonnull bytes, int count) {
NSMutableData *result = [[NSMutableData alloc] initWithLength:(NSUInteger)CC_MD5_DIGEST_LENGTH];
CC_MD5(bytes, (CC_LONG)count, result.mutableBytes);
return result;
}
NSData * _Nonnull CryptoSHA1(const void *bytes, int count) {
NSData * _Nonnull CryptoSHA1(const void * _Nonnull bytes, int count) {
NSMutableData *result = [[NSMutableData alloc] initWithLength:(NSUInteger)CC_SHA1_DIGEST_LENGTH];
CC_SHA1(bytes, (CC_LONG)count, result.mutableBytes);
return result;
}
NSData * _Nonnull CryptoSHA256(const void *bytes, int count) {
NSData * _Nonnull CryptoSHA256(const void * _Nonnull bytes, int count) {
NSMutableData *result = [[NSMutableData alloc] initWithLength:(NSUInteger)CC_SHA256_DIGEST_LENGTH];
CC_SHA256(bytes, (CC_LONG)count, result.mutableBytes);
return result;
}
NSData * _Nonnull CryptoSHA512(const void *bytes, int count) {
NSData * _Nonnull CryptoSHA512(const void * _Nonnull bytes, int count) {
NSMutableData *result = [[NSMutableData alloc] initWithLength:(NSUInteger)CC_SHA512_DIGEST_LENGTH];
CC_SHA512(bytes, (CC_LONG)count, result.mutableBytes);
return result;

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><Scheme LastUpgradeVersion="9999" version="1.7"><BuildAction buildImplicitDependencies="YES" parallelizeBuildables="YES"><BuildActionEntries><BuildActionEntry buildForAnalyzing="YES" buildForArchiving="YES" buildForProfiling="YES" buildForRunning="YES" buildForTesting="YES"><BuildableReference BlueprintIdentifier="E66DC04E7ACF6B7A00000000" BlueprintName="WatchCommon" BuildableIdentifier="primary" BuildableName="libWatchCommon.a" ReferencedContainer="container:WatchCommon.xcodeproj"/></BuildActionEntry></BuildActionEntries></BuildAction><TestAction buildConfiguration="Debug" shouldUseLaunchSchemeArgsEnv="YES"><Testables/></TestAction><LaunchAction buildConfiguration="Debug"/><ProfileAction buildConfiguration="Release"/><AnalyzeAction buildConfiguration="Debug"/><ArchiveAction buildConfiguration="Release" revealArchiveInOrganizer="YES"/></Scheme>
<?xml version="1.0" encoding="UTF-8" standalone="no"?><Scheme LastUpgradeVersion="9999" version="1.7"><BuildAction buildImplicitDependencies="YES" parallelizeBuildables="YES"><BuildActionEntries><BuildActionEntry buildForAnalyzing="YES" buildForArchiving="YES" buildForProfiling="YES" buildForRunning="YES" buildForTesting="YES"><BuildableReference BlueprintIdentifier="E66DC04E7ACF6B7A00000000" BlueprintName="WatchCommon" BuildableIdentifier="primary" BuildableName="libWatchCommon.a" ReferencedContainer="container:WatchCommon.xcodeproj"/></BuildActionEntry><BuildActionEntry buildForAnalyzing="YES" buildForArchiving="YES" buildForProfiling="YES" buildForRunning="YES" buildForTesting="YES"><BuildableReference BlueprintIdentifier="E66DC04E5A42857500000000" BlueprintName="WatchCommonWatch" BuildableIdentifier="primary" BuildableName="libWatchCommonWatch.a" ReferencedContainer="container:WatchCommon.xcodeproj"/></BuildActionEntry></BuildActionEntries></BuildAction><TestAction buildConfiguration="Debug" shouldUseLaunchSchemeArgsEnv="YES"><Testables/></TestAction><LaunchAction buildConfiguration="Debug"/><ProfileAction buildConfiguration="Release"/><AnalyzeAction buildConfiguration="Debug"/><ArchiveAction buildConfiguration="Release" revealArchiveInOrganizer="YES"/></Scheme>

View File

@ -1,89 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AppIDName</key>
<string>Telegram iOS</string>
<key>ApplicationIdentifierPrefix</key>
<array>
<string>X834Q8SBVP</string>
</array>
<key>CreationDate</key>
<date>2018-11-02T22:14:21Z</date>
<key>Platform</key>
<array>
<string>iOS</string>
</array>
<key>IsXcodeManaged</key>
<false/>
<key>DeveloperCertificates</key>
<array>
<data>MIIFlDCCBHygAwIBAgIIela2HzM/EwQwDQYJKoZIhvcNAQEFBQAwgZYxCzAJBgNVBAYTAlVTMRMwEQYDVQQKDApBcHBsZSBJbmMuMSwwKgYDVQQLDCNBcHBsZSBXb3JsZHdpZGUgRGV2ZWxvcGVyIFJlbGF0aW9uczFEMEIGA1UEAww7QXBwbGUgV29ybGR3aWRlIERldmVsb3BlciBSZWxhdGlvbnMgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTgxMTAyMjIwMzU5WhcNMjExMTAxMjIwMzU5WjCBlTEaMBgGCgmSJomT8ixkAQEMClg4MzRROFNCVlAxNDAyBgNVBAMMK2lQaG9uZSBEaXN0cmlidXRpb246IFRFTEVHUkFNIE1FU1NFTkdFUiBMTFAxEzARBgNVBAsMClg4MzRROFNCVlAxHzAdBgNVBAoMFlRFTEVHUkFNIE1FU1NFTkdFUiBMTFAxCzAJBgNVBAYTAkdCMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/L6ntx8MRezWVRAJZOJRCE+ITkPaygFNY5yI01wvaqZTgncla+gftsTM9h0OJkW4xOAy+0zbV7uAbhwtREK0HSkw0Rl3QyNXqVHwtz0pDytWkzfYnOdbWLG2fS4UFWX0OK328rEHZeuZtlIkjl/mPHC6yQpwQcZeAsg+wilRPXe8I4n1ymzu2NmEf3r4Ci+LDNaChO88j589TDC7dI6AajBJEFyXawVKWmMORDxtWTMbvzDV6TiEqu0igokoXQLejs7mtsqy5gnIeBMlj6rIT1hLExEuQj8FZq21p485N171Rfe0WDxUpO6XsM9tiJ9xCWfiRVrFiiXl5rGwmV8iCQIDAQABo4IB4zCCAd8wDAYDVR0TAQH/BAIwADAfBgNVHSMEGDAWgBSIJxcJqbYYYIvs67r2R1nFUlSjtzA/BggrBgEFBQcBAQQzMDEwLwYIKwYBBQUHMAGGI2h0dHA6Ly9vY3NwLmFwcGxlLmNvbS9vY3NwMDItd3dkcjAxMIIBDwYDVR0gBIIBBjCCAQIwgf8GCSqGSIb3Y2QFATCB8TCBwwYIKwYBBQUHAgIwgbYMgbNSZWxpYW5jZSBvbiB0aGlzIGNlcnRpZmljYXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJsZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRlIHBvbGljeSBhbmQgY2VydGlmaWNhdGlvbiBwcmFjdGljZSBzdGF0ZW1lbnRzLjApBggrBgEFBQcCARYdaHR0cDovL3d3dy5hcHBsZS5jb20vYXBwbGVjYS8wFgYDVR0lAQH/BAwwCgYIKwYBBQUHAwMwHQYDVR0OBBYEFCDr/Jte3cDM3K5DtQY2dDG9rHxqMA4GA1UdDwEB/wQEAwIHgDATBgoqhkiG92NkBgEEAQH/BAIFADANBgkqhkiG9w0BAQUFAAOCAQEAYpNcj2gQHbLyD4NEPlCOl4GbTLqy0+amp0VhjhImOelNug+N/gxTz6px+DPCNSeZbZaHJ5rYvo5Rhlx7Zk/khN6A2yVhFMgdJMyGYvmLpn/70rwCB0VxJW8zpiL6J5F5IVf4259cwawmkGWst1aakiW+g62BfGqZzhJ/ojwK7Cy/JPn03zteeSlJrJd8ZCXFFQkvyIjs+ycRa9yls3vjqvf7mbVdTjCCos3KAdTblgHLiXktOj4RUTzyNaIrDnnmfM5CSZ4t81bd9ycNaPjCkUY4JidvL9A2O8rF7rl1k3Fuj+wKoVahcaEhkntQrojt6tlfTx/jWYcu2yQjuk1IcA==</data>
</array>
<key>Entitlements</key>
<dict>
<key>keychain-access-groups</key>
<array>
<string>X834Q8SBVP.*</string>
</array>
<key>get-task-allow</key>
<false/>
<key>application-identifier</key>
<string>X834Q8SBVP.org.telegram.Telegram-iOS</string>
<key>com.apple.developer.ubiquity-kvstore-identifier</key>
<string>X834Q8SBVP.*</string>
<key>com.apple.developer.icloud-services</key>
<string>*</string>
<key>com.apple.developer.icloud-container-environment</key>
<array>
<string>Development</string>
<string>Production</string>
</array>
<key>com.apple.developer.icloud-container-identifiers</key>
<array>
<string>iCloud.org.telegram.Telegram-iOS</string>
</array>
<key>com.apple.developer.icloud-container-development-container-identifiers</key>
<array>
<string>iCloud.org.telegram.Telegram-iOS</string>
</array>
<key>com.apple.developer.ubiquity-container-identifiers</key>
<array>
<string>iCloud.org.telegram.Telegram-iOS</string>
</array>
<key>com.apple.developer.associated-domains</key>
<string>*</string>
<key>com.apple.security.application-groups</key>
<array>
<string>group.org.telegram.Telegram-iOS</string>
</array>
<key>com.apple.developer.team-identifier</key>
<string>X834Q8SBVP</string>
<key>aps-environment</key>
<string>production</string>
<key>com.apple.developer.siri</key>
<true/>
</dict>
<key>ExpirationDate</key>
<date>2019-11-02T22:14:21Z</date>
<key>Name</key>
<string>match InHouse org.telegram.Telegram-iOS</string>
<key>ProvisionsAllDevices</key>
<true/>
<key>TeamIdentifier</key>
<array>
<string>X834Q8SBVP</string>
</array>
<key>TeamName</key>
<string>TELEGRAM MESSENGER LLP</string>
<key>TimeToLive</key>
<integer>365</integer>
<key>UUID</key>
<string>569d19a4-e9f1-460f-a8e5-ba75ae51cd71</string>
<key>Version</key>
<integer>1</integer>
</dict>
</plist>