diff --git a/.buckconfig b/.buckconfig
new file mode 100644
index 0000000000..4c0639e003
--- /dev/null
+++ b/.buckconfig
@@ -0,0 +1,38 @@
+[cxx]
+ default_platform = iphonesimulator-x86_64
+ cflags = -g -fmodules -fobjc-arc -D BUCK -w $(config custom.other_cflags)
+ cxxflags = -fobjc-arc -std=c++14 -D DEBUG -g $(config custom.other_cxxflags)
+ combined_preprocess_and_compile = true
+ pch_enabled = false
+ ldflags = -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime $(config custom.other_cxxflags)
+
+[swift]
+ version = 4.0
+ compiler_flags = -DBUCK -enable-testing -g -Onone $(config custom.other_swift_compiler_flags)
+ use_filelist = true
+
+[apple]
+ use_swift_delegate = false
+ use_header_maps_in_xcode = false
+ generate_missing_umbrella_headers = true
+ iphonesimulator_target_sdk_version = 8.0
+ iphoneos_target_sdk_version = 8.0
+ provisioning_profile_read_command = security cms -Di
+ xctool_default_destination_specifier = platform=iOS Simulator,OS=latest
+ ;provisioning_profile_search_path = ./
+ ;xctool_path = tools/xctool/bin/xctool
+
+[parser]
+ polyglot_parsing_enabled = true
+ default_build_file_syntax = SKYLARK
+
+[project]
+ ide_force_kill = always
+ project_schemes = true
+ ide = xcode
+ allow_symlinks = forbid
+ ignore = tools, \
+ .git, \
+
+[build]
+ thread_core_ratio = 2.0
diff --git a/.gitignore b/.gitignore
index af7c90407f..f4cc9674a3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,3 +24,5 @@ DerivedData
*.dSYM.zip
*.ipa
*/xcuserdata/*
+buck-out/*
+.buckd/*
diff --git a/BUCK b/BUCK
new file mode 100644
index 0000000000..12802a3a90
--- /dev/null
+++ b/BUCK
@@ -0,0 +1,76 @@
+load('//tools:buck_utils.bzl', 'config_with_updated_linker_flags', 'configs_with_config')
+load('//tools:buck_defs.bzl', 'SHARED_CONFIGS')
+
+# 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.
+ALL_LOAD_LINKER_FLAG = '-all_load'
+
+APP_CONFIGS = {
+ 'ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES': 'YES',
+ 'DEVELOPMENT_LANGUAGE': 'Swift',
+ 'PRODUCT_BUNDLE_IDENTIFIER': 'ph.telegra.Telegraph',
+ 'PROVISIONING_PROFILE_SPECIFIER': 'match Development ph.telegra.Telegraph',
+ 'TARGETED_DEVICE_FAMILY': '1,2',
+}
+APP_CONFIGS.update(SHARED_CONFIGS)
+
+apple_resource(
+ name = 'LaunchScreenXib',
+ files = [
+ 'Telegram-iOS/Base.lproj/LaunchScreen.xib',
+ ],
+)
+
+apple_asset_catalog(
+ name = 'Images',
+ dirs = [
+ 'Telegram-iOS/Images.xcassets',
+ ],
+ app_icon = 'AppIconLLC',
+)
+
+apple_binary(
+ name = 'AppBinary',
+ configs = configs_with_config(config_with_updated_linker_flags(APP_CONFIGS, ALL_LOAD_LINKER_FLAG)),
+ swift_version = '4.2',
+ srcs = [
+ 'Telegram-iOS/TempRoot.swift',
+ 'Telegram-iOS/TempMain.m',
+ ],
+ deps = [
+ ':LaunchScreenXib',
+ ':Images',
+ '//submodules/AsyncDisplayKit:AsyncDisplayKit',
+ '//submodules/MtProtoKit:MtProtoKit',
+ '//submodules/SSignalKit:SwiftSignalKit',
+ '//submodules/SSignalKit:SSignalKit',
+ '//submodules/Display:Display',
+ '//submodules/Postbox:Postbox',
+ '//submodules/TelegramCore:TelegramCore',
+ '//submodules/LegacyComponents:LegacyComponents',
+ '//submodules/HockeySDK-iOS:HockeySDK',
+ '//submodules/lottie-ios:Lottie',
+ '//submodules/libtgvoip:tgvoip',
+ ],
+)
+
+apple_bundle(
+ name = 'AppBundle',
+ extension = 'app',
+ binary = ':AppBinary',
+ product_name = 'Telegram',
+ info_plist = 'Info.plist',
+ info_plist_substitutions = {
+ 'DEVELOPMENT_LANGUAGE': 'en-us',
+ 'EXECUTABLE_NAME': 'TelegramApp',
+ 'PRODUCT_BUNDLE_IDENTIFIER': 'ph.telegra.Telegraph',
+ 'PRODUCT_NAME': 'TelegramApp',
+ 'VERSION': '5.8',
+ 'BUILD_NUMBER': '2001',
+ },
+)
+
+apple_package(
+ name = 'AppPackage',
+ bundle = ':AppBundle',
+)
diff --git a/NotificationContent/Info.plist b/NotificationContent/Info.plist
index 0d9a4034ad..fff8a30b83 100644
--- a/NotificationContent/Info.plist
+++ b/NotificationContent/Info.plist
@@ -17,7 +17,7 @@
CFBundlePackageType
XPC!
CFBundleShortVersionString
- 5.7
+ 5.7.1
CFBundleVersion
${BUILD_NUMBER}
NSExtension
diff --git a/NotificationService/Info.plist b/NotificationService/Info.plist
index c809e1e744..3acba1e5e4 100644
--- a/NotificationService/Info.plist
+++ b/NotificationService/Info.plist
@@ -17,7 +17,7 @@
CFBundlePackageType
XPC!
CFBundleShortVersionString
- 5.7
+ 5.7.1
CFBundleVersion
${BUILD_NUMBER}
NSExtension
diff --git a/NotificationService/Serialization.swift b/NotificationService/Serialization.swift
index 5db3530ae2..c0f90c192d 100644
--- a/NotificationService/Serialization.swift
+++ b/NotificationService/Serialization.swift
@@ -10,7 +10,7 @@ public class BoxedMessage: NSObject {
public class Serialization: NSObject, MTSerialization {
public func currentLayer() -> UInt {
- return 100
+ return 102
}
public func parseMessage(_ data: Data!) -> Any! {
diff --git a/Share/Info.plist b/Share/Info.plist
index c0123616b8..1a8a3b3916 100644
--- a/Share/Info.plist
+++ b/Share/Info.plist
@@ -17,7 +17,7 @@
CFBundlePackageType
XPC!
CFBundleShortVersionString
- 5.7
+ 5.7.1
CFBundleVersion
${BUILD_NUMBER}
NSExtension
diff --git a/SiriIntents/Info.plist b/SiriIntents/Info.plist
index fa91f55266..9303fbf984 100644
--- a/SiriIntents/Info.plist
+++ b/SiriIntents/Info.plist
@@ -17,7 +17,7 @@
CFBundlePackageType
XPC!
CFBundleShortVersionString
- 5.7
+ 5.7.1
CFBundleVersion
${BUILD_NUMBER}
NSExtension
diff --git a/Telegram-iOS.xcodeproj/project.pbxproj b/Telegram-iOS.xcodeproj/project.pbxproj
index fa75fac625..640ee440b3 100644
--- a/Telegram-iOS.xcodeproj/project.pbxproj
+++ b/Telegram-iOS.xcodeproj/project.pbxproj
@@ -1053,6 +1053,8 @@
D073E51E21FF7CE900742DDD /* Crypto.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Crypto.h; sourceTree = ""; };
D073E51F21FF7CE900742DDD /* Crypto.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Crypto.m; sourceTree = ""; };
D073E52122003E1E00742DDD /* Data.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Data.swift; sourceTree = ""; };
+ D07477B522A72B1F002737C4 /* TempRoot.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TempRoot.swift; sourceTree = ""; };
+ D07477B722A732F1002737C4 /* TempMain.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TempMain.m; sourceTree = ""; };
D079FD001F06BBD10038FADE /* Telegram-iOS-AppStore.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = "Telegram-iOS-AppStore.entitlements"; sourceTree = ""; };
D084023120E1883500065674 /* ApplicationShortcutItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApplicationShortcutItem.swift; sourceTree = ""; };
D08410431FABDC5B008FFE92 /* TGItemProviderSignals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGItemProviderSignals.h; sourceTree = ""; };
@@ -2000,6 +2002,8 @@
D0B21B0E220438E9003F741D /* SharedNotificationManager.swift */,
D09B79C42219C784003B1F9D /* SharedAccountInfo.swift */,
D09B79C72219C7AE003B1F9D /* ManageSharedAccountInfo.swift */,
+ D07477B522A72B1F002737C4 /* TempRoot.swift */,
+ D07477B722A732F1002737C4 /* TempMain.m */,
);
path = "Telegram-iOS";
sourceTree = "";
diff --git a/Telegram-iOS/Info.plist b/Telegram-iOS/Info.plist
index 038d5b1aa4..fcfb93bdca 100644
--- a/Telegram-iOS/Info.plist
+++ b/Telegram-iOS/Info.plist
@@ -23,33 +23,33 @@
UIPrerenderedIcon
- Blue
-
- CFBundleIconFiles
-
- BlueIcon
-
- UIPrerenderedIcon
-
-
- BlackFilled
-
- CFBundleIconFiles
-
- BlackFilledIcon
-
- UIPrerenderedIcon
-
-
- BlueFilled
-
- CFBundleIconFiles
-
- BlueFilledIcon
-
- UIPrerenderedIcon
-
-
+ BlackFilled
+
+ CFBundleIconFiles
+
+ BlackFilledIcon
+
+ UIPrerenderedIcon
+
+
+ Blue
+
+ CFBundleIconFiles
+
+ BlueIcon
+
+ UIPrerenderedIcon
+
+
+ BlueFilled
+
+ CFBundleIconFiles
+
+ BlueFilledIcon
+
+ UIPrerenderedIcon
+
+
CFBundlePrimaryIcon
@@ -68,7 +68,7 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 5.7
+ 5.7.1
CFBundleSignature
????
CFBundleURLTypes
diff --git a/Telegram-iOS/LegacyPreferencesImport.swift b/Telegram-iOS/LegacyPreferencesImport.swift
index 458ecb3257..20f86715d4 100644
--- a/Telegram-iOS/LegacyPreferencesImport.swift
+++ b/Telegram-iOS/LegacyPreferencesImport.swift
@@ -41,7 +41,7 @@ private enum PreferencesProvider {
private func loadLegacyCustomProperyData(database: SqliteInterface, key: String) -> Data? {
var result: Data?
- database.select("SELECT value FROM service_v29 WHERE key=\(murMurHash32(key))", { cursor in
+ database.select("SELECT value FROM service_v29 WHERE key=\(HashFunctions.murMurHash32(key))", { cursor in
result = cursor.getData(at: 0)
return false
})
diff --git a/Telegram-iOS/TempMain.m b/Telegram-iOS/TempMain.m
new file mode 100644
index 0000000000..81d976a847
--- /dev/null
+++ b/Telegram-iOS/TempMain.m
@@ -0,0 +1,7 @@
+#import
+
+int main(int argc, char *argv[]) {
+ @autoreleasepool {
+ return UIApplicationMain(argc, argv, @"Application", @"AppDelegate");
+ }
+}
diff --git a/Telegram-iOS/TempRoot.swift b/Telegram-iOS/TempRoot.swift
new file mode 100644
index 0000000000..c0f69cf9ad
--- /dev/null
+++ b/Telegram-iOS/TempRoot.swift
@@ -0,0 +1,29 @@
+import Foundation
+import AsyncDisplayKit
+import MtProtoKit
+import SwiftSignalKit
+import SSignalKit
+import Display
+import Postbox
+import TelegramCore
+import LegacyComponents
+import HockeySDK
+import Lottie
+
+func test() {
+ let _ = ASDisplayNode()
+ let _ = MTProto()
+ let _ = Signal { subscriber in
+ return ActionDisposable {
+ }
+ }
+ let _ = SSignal(generator: { subscriber in
+ return SBlockDisposable {
+ }
+ })
+ let _ = ListView()
+ let _ = SqliteValueBox(basePath: "", queue: .mainQueue(), encryptionParameters: nil, upgradeProgress: { _ in }, inMemory: true)
+ initializeAccountManagement()
+ BITHockeyManager.shared().crashManager.crashManagerStatus = .alwaysAsk
+ let _ = LOTComposition(json: [:])
+}
diff --git a/Watch/App/Info.plist b/Watch/App/Info.plist
index 0e92d2b1d3..032962aab6 100644
--- a/Watch/App/Info.plist
+++ b/Watch/App/Info.plist
@@ -17,7 +17,7 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 5.7
+ 5.7.1
CFBundleVersion
${BUILD_NUMBER}
UISupportedInterfaceOrientations
diff --git a/Watch/Extension/Info.plist b/Watch/Extension/Info.plist
index 195abe3bec..a6348f47eb 100644
--- a/Watch/Extension/Info.plist
+++ b/Watch/Extension/Info.plist
@@ -17,7 +17,7 @@
CFBundlePackageType
XPC!
CFBundleShortVersionString
- 5.7
+ 5.7.1
CFBundleVersion
${BUILD_NUMBER}
NSExtension
diff --git a/Widget/Info.plist b/Widget/Info.plist
index 69e1748c28..447743f2b1 100644
--- a/Widget/Info.plist
+++ b/Widget/Info.plist
@@ -17,7 +17,7 @@
CFBundlePackageType
XPC!
CFBundleShortVersionString
- 5.7
+ 5.7.1
CFBundleVersion
${BUILD_NUMBER}
NSExtension
diff --git a/submodules/AsyncDisplayKit b/submodules/AsyncDisplayKit
index 75d4f47c24..2bfec3d11d 160000
--- a/submodules/AsyncDisplayKit
+++ b/submodules/AsyncDisplayKit
@@ -1 +1 @@
-Subproject commit 75d4f47c24dbaf1ddf25be6cf7c636d5162f1425
+Subproject commit 2bfec3d11d47ea93522dce1fb380bffff5b7e828
diff --git a/submodules/Display b/submodules/Display
index ffb131ac55..a9e3741319 160000
--- a/submodules/Display
+++ b/submodules/Display
@@ -1 +1 @@
-Subproject commit ffb131ac55bed21c37052a09c27150d5d380321e
+Subproject commit a9e374131912f68bb599f6c87b9da26a3687513e
diff --git a/submodules/HockeySDK-iOS b/submodules/HockeySDK-iOS
index 95615527a9..923ee1b409 160000
--- a/submodules/HockeySDK-iOS
+++ b/submodules/HockeySDK-iOS
@@ -1 +1 @@
-Subproject commit 95615527a9946b0efe6bd593f83f90946ad195b9
+Subproject commit 923ee1b409eb1c4dbe836196740fd662c8f3ddb6
diff --git a/submodules/LegacyComponents b/submodules/LegacyComponents
index 62c8606f55..270d32faef 160000
--- a/submodules/LegacyComponents
+++ b/submodules/LegacyComponents
@@ -1 +1 @@
-Subproject commit 62c8606f554cbd96e981e186f95cc4a0f77b1f5a
+Subproject commit 270d32faef878aa39dc3c8b5cbb6edf2c3856492
diff --git a/submodules/MtProtoKit b/submodules/MtProtoKit
index 3c271bb144..ab27f2f195 160000
--- a/submodules/MtProtoKit
+++ b/submodules/MtProtoKit
@@ -1 +1 @@
-Subproject commit 3c271bb1446bafe39bb460dfaa926ccc7ffb20d9
+Subproject commit ab27f2f195fbf8c3ea9df18c8bc37c7facc1cf1d
diff --git a/submodules/Postbox b/submodules/Postbox
index 20e6e10a50..08820b13cf 160000
--- a/submodules/Postbox
+++ b/submodules/Postbox
@@ -1 +1 @@
-Subproject commit 20e6e10a50e4e4ab2ffe1d161ef13f122ffbd8c9
+Subproject commit 08820b13cfdd014dc8a1de94a84b5b311e621c43
diff --git a/submodules/SSignalKit b/submodules/SSignalKit
index 09c1d8049d..bbf43c967c 160000
--- a/submodules/SSignalKit
+++ b/submodules/SSignalKit
@@ -1 +1 @@
-Subproject commit 09c1d8049d38fdbe9ba829d6c07ee85a9338308f
+Subproject commit bbf43c967cd7b87e00f18f7fd16b4a66a26c0513
diff --git a/submodules/TelegramCore b/submodules/TelegramCore
index ef5cdf919f..a56806593c 160000
--- a/submodules/TelegramCore
+++ b/submodules/TelegramCore
@@ -1 +1 @@
-Subproject commit ef5cdf919f7b996218e089705abdf31b68ce0cd8
+Subproject commit a56806593c21485c474f1077feb588dfd2adc4a9
diff --git a/submodules/TelegramUI b/submodules/TelegramUI
index fc95b3e572..33a1ee7e9e 160000
--- a/submodules/TelegramUI
+++ b/submodules/TelegramUI
@@ -1 +1 @@
-Subproject commit fc95b3e572ea0c9d59fbb63df3ad8c1cb5fee4cd
+Subproject commit 33a1ee7e9ee60a7393ef58a3103cc6bce213bfe4
diff --git a/submodules/lottie-ios b/submodules/lottie-ios
index 279b805ad5..8de8984ef0 160000
--- a/submodules/lottie-ios
+++ b/submodules/lottie-ios
@@ -1 +1 @@
-Subproject commit 279b805ad5fcbaae029bbf195b375a40f5e14a36
+Subproject commit 8de8984ef02d8f302b358b69c74ac3696d8c614d
diff --git a/tools/buck_defs.bzl b/tools/buck_defs.bzl
new file mode 100644
index 0000000000..1d2ab2daf9
--- /dev/null
+++ b/tools/buck_defs.bzl
@@ -0,0 +1,20 @@
+SHARED_CONFIGS = {
+ 'IPHONEOS_DEPLOYMENT_TARGET': '8.0', # common target version
+ 'SDKROOT': 'iphoneos', # platform
+ 'GCC_OPTIMIZATION_LEVEL': '0', # clang optimization
+ 'SWIFT_OPTIMIZATION_LEVEL': '-Onone', # swiftc optimization
+ 'SWIFT_WHOLE_MODULE_OPTIMIZATION': 'NO', # for build performance
+ 'ONLY_ACTIVE_ARCH': 'YES',
+ 'LD_RUNPATH_SEARCH_PATHS': '@executable_path/Frameworks', # To allow source files in binary
+}
+
+LIB_SPECIFIC_CONFIG = {
+ 'SKIP_INSTALL': 'YES',
+ 'APPLICATION_EXTENSION_API_ONLY': 'YES',
+}
+
+def combined_config(dicts):
+ result = dict()
+ for d in dicts:
+ result.update(d)
+ return result
diff --git a/tools/buck_utils.bzl b/tools/buck_utils.bzl
new file mode 100644
index 0000000000..988198f143
--- /dev/null
+++ b/tools/buck_utils.bzl
@@ -0,0 +1,97 @@
+OTHER_LINKER_FLAGS_KEY = 'OTHER_LDFLAGS'
+
+# Either appends or assigns `other_linker_flags` to `config` under `config_key`.
+# Params:
+# - config: A dictionary of config names and their values
+# - additional_linker_flags: A string-representable value of additional linker flags
+# - config_key: The key to which to append or assign the additional linker flags
+def config_with_updated_linker_flags(config, other_linker_flags, config_key=OTHER_LINKER_FLAGS_KEY):
+ new_config = { }
+ config_key_found = False
+ for key in config:
+ if key == config_key:
+ new_config[key] = config[key] + (" %s" % other_linker_flags)
+ config_key_found = True
+ else:
+ new_config[key] = config[key]
+
+ if config_key_found == False:
+ # If `config` does not currently contain `config_key`, add it. Inherit for good measure.
+ new_config[config_key] = '$(inherited) ' + other_linker_flags
+
+ return new_config
+
+# Creates a dictionary where the top level keys are the supported build configurations and the value of each key is `config`.
+def configs_with_config(config):
+ return {
+ "Debug": config,
+ "Profile": config,
+ "Release": config,
+ }
+
+def subdir_glob(glob_specs, exclude = None, prefix = ""):
+ """Returns a dict of sub-directory relative paths to full paths.
+
+ The subdir_glob() function is useful for defining header maps for C/C++
+ libraries which should be relative the given sub-directory.
+ Given a list of tuples, the form of (relative-sub-directory, glob-pattern),
+ it returns a dict of sub-directory relative paths to full paths.
+
+ Please refer to native.glob() for explanations and examples of the pattern.
+
+ Args:
+ glob_specs: The array of tuples in form of
+ (relative-sub-directory, glob-pattern inside relative-sub-directory).
+ type: List[Tuple[str, str]]
+ exclude: A list of patterns to identify files that should be removed
+ from the set specified by the first argument. Defaults to [].
+ type: Optional[List[str]]
+ prefix: If is not None, prepends it to each key in the dictionary.
+ Defaults to None.
+ type: Optional[str]
+
+ Returns:
+ A dict of sub-directory relative paths to full paths.
+ """
+ if exclude == None:
+ exclude = []
+
+ results = []
+
+ for dirpath, glob_pattern in glob_specs:
+ results.append(
+ _single_subdir_glob(dirpath, glob_pattern, exclude, prefix),
+ )
+
+ return _merge_maps(*results)
+
+def _merge_maps(*file_maps):
+ result = {}
+ for file_map in file_maps:
+ for key in file_map:
+ if key in result and result[key] != file_map[key]:
+ fail(
+ "Conflicting files in file search paths. " +
+ "\"%s\" maps to both \"%s\" and \"%s\"." %
+ (key, result[key], file_map[key]),
+ )
+
+ result[key] = file_map[key]
+
+ return result
+
+def _single_subdir_glob(dirpath, glob_pattern, exclude = None, prefix = None):
+ if exclude == None:
+ exclude = []
+ results = {}
+ files = native.glob([dirpath + '/' + glob_pattern], exclude = exclude)
+ for f in files:
+ if dirpath:
+ key = f[len(dirpath) + 1:]
+ else:
+ key = f
+ if prefix:
+ key =prefix + '/' + key
+ results[key] = f
+
+ return results
\ No newline at end of file