diff --git a/.buckconfig b/.buckconfig index 20904c7a22..9cc2f1b7bc 100644 --- a/.buckconfig +++ b/.buckconfig @@ -1,14 +1,14 @@ [cxx] - default_platform = iphonesimulator-x86_64 + default_platform = iphoneos-armv7 cflags = -g -fmodules -fobjc-arc -D BUCK -D DEBUG -w $(config custom.other_cflags) - cxxflags = -fobjc-arc -std=c++14 -D BUCK -D DEBUG -g $(config custom.other_cxxflags) + cxxflags = -fobjc-arc -std=c++14 -D BUCK -D DEBUG -g -w $(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 -enable-batch-mode -g -Onone $(config custom.other_swift_compiler_flags) + compiler_flags = -DBUCK -enable-testing -g -Onone -whole-module-optimization -suppress-warnings $(config custom.other_swift_compiler_flags) use_filelist = true [apple] diff --git a/.gitignore b/.gitignore index 79b3d809e0..51c2c450ed 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,4 @@ buck-out/* AppBinary.xcworkspace/* Project.xcodeproj/* Watch/Watch.xcodeproj/* +AppBundle.xcworkspace/* diff --git a/BUCK b/BUCK index 24e85ed24c..b1443dbcae 100644 --- a/BUCK +++ b/BUCK @@ -1,16 +1,21 @@ -load('//tools:buck_utils.bzl', 'config_with_updated_linker_flags', 'configs_with_config') +load('//tools:buck_utils.bzl', 'config_with_updated_linker_flags', 'configs_with_config', 'combined_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' +BUILD_NUMBER = '2001' + 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_NAME': 'Telegram', + 'BUILD_NUMBER': BUILD_NUMBER, + 'CODE_SIGN_ENTITLEMENTS': 'Telegram-iOS/Telegram-iOS-AppStoreLLC.entitlements', } APP_CONFIGS.update(SHARED_CONFIGS) @@ -21,6 +26,30 @@ apple_resource( ], ) +apple_resource( + name = "StringResources", + files = [], + variants = glob([ + "Telegram-iOS/*.lproj/Localizable.strings", + ]), +) + +apple_resource( + name = "InfoPlistStringResources", + files = [], + variants = glob([ + "Telegram-iOS/*.lproj/InfoPlist.strings", + ]), +) + +apple_resource( + name = "AppIntentVocabularyStringResources", + files = [], + variants = glob([ + "Telegram-iOS/*.lproj/AppIntentVocabulary.plist", + ]), +) + apple_asset_catalog( name = 'Images', dirs = [ @@ -78,7 +107,6 @@ apple_library( 'Telegram-iOS/UIImage+ImageEffects.h', ], modular = True, - #visibility = ['//submodules/TelegramUI:TelegramUI'], visibility = ['PUBLIC'], deps = [ '//submodules/SSignalKit:SSignalKit', @@ -90,31 +118,35 @@ apple_library( apple_binary( name = 'AppBinary', configs = configs_with_config(config_with_updated_linker_flags(APP_CONFIGS, ALL_LOAD_LINKER_FLAG)), - srcs = glob([ - 'Telegram-iOS/*.swift', - ]) + [ - 'Telegram-iOS/main.m', - ], + #srcs = glob([ + # 'Telegram-iOS/*.swift', + #]) + [ + # 'Telegram-iOS/main.m', + #], + srcs = ['Telegram-iOS/TempMain.m'], entitlements_file = 'Telegram-iOS/Telegram-iOS-AppStoreLLC.entitlements', deps = [ ':LaunchScreenXib', + ':StringResources', + ':InfoPlistStringResources', + ':AppIntentVocabularyStringResources', ':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/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', - '//submodules/webp:WebP', - '//submodules/ffmpeg:FFMpeg', - '//submodules/TelegramUI:TelegramUI', - '//submodules/TelegramUI:TelegramUIPrivateModule', - '//Watch:WatchUtils', + #'//submodules/webp:WebPImage', + #'//submodules/ffmpeg:FFMpeg', + #'//submodules/TelegramUI:TelegramUI', + '//submodules/TelegramUI:TelegramUIFramework', + #'//Watch:WatchUtils', ':BuildConfig', ':AppBinaryPrivate', ], @@ -140,7 +172,7 @@ apple_bundle( 'PRODUCT_NAME': 'Telegram', 'APP_SPECIFIC_URL_SCHEME': 'tgapp', 'VERSION': '5.8', - 'BUILD_NUMBER': '2001', + 'BUILD_NUMBER': BUILD_NUMBER, }, ) diff --git a/Telegram-iOS.xcodeproj/project.pbxproj b/Telegram-iOS.xcodeproj/project.pbxproj index 10adbe83c4..f8c8447329 100644 --- a/Telegram-iOS.xcodeproj/project.pbxproj +++ b/Telegram-iOS.xcodeproj/project.pbxproj @@ -5240,6 +5240,7 @@ "$(inherited)", "$(PROJECT_DIR)/submodules/TelegramUI/third-party/opus/lib", ); + ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "-ObjC", "-lz", diff --git a/Telegram-iOS/AppDelegate.swift b/Telegram-iOS/AppDelegate.swift index 2a6dd69b2c..138f21156a 100644 --- a/Telegram-iOS/AppDelegate.swift +++ b/Telegram-iOS/AppDelegate.swift @@ -1145,7 +1145,9 @@ final class SharedApplicationContext { BITHockeyManager.shared().configure(withIdentifier: hockeyAppId, delegate: self) BITHockeyManager.shared().crashManager.crashManagerStatus = .alwaysAsk BITHockeyManager.shared().start() - //BITHockeyManager.shared().authenticator.authenticateInstallation() + #if !BUCK + BITHockeyManager.shared().authenticator.authenticateInstallation() + #endif } NotificationCenter.default.addObserver(forName: NSNotification.Name.UIWindowDidBecomeHidden, object: nil, queue: nil, using: { notification in diff --git a/Telegram-iOS/en.lproj/Localizable.strings b/Telegram-iOS/en.lproj/Localizable.strings index 56a4825898..a260079d4b 100644 --- a/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram-iOS/en.lproj/Localizable.strings @@ -4358,6 +4358,7 @@ Any member of this group will be able to see messages in the channel."; "Conversation.Block" = "Block"; "Conversation.ShareMyPhoneNumber" = "Share My Phone Number"; "Conversation.AddToContacts" = "Add to Contacts"; +"Conversation.AddNameToContacts" = "Add %@ to Contacts"; "AddContact.ContactWillBeSharedNow" = "When you tap **Done**, your phone number will become visible to %@."; "AddContact.ContactWillBeSharedAfterMutual" = "Phone number vill be visible once %1$@ adds you as a contact. Your phone number will become visible to %1$@."; @@ -4396,3 +4397,6 @@ Any member of this group will be able to see messages in the channel."; "Channel.Management.LabelOwner" = "Owner"; "Channel.Management.LabelAdministrator" = "Administrator"; +"ContactInfo.PhoneNumberHidden" = "Hidden"; + +"Common.ActionNotAllowedError" = "Sorry, you are not allowed to do this."; diff --git a/Watch/BUCK b/Watch/BUCK index 52ec784420..57366e6538 100644 --- a/Watch/BUCK +++ b/Watch/BUCK @@ -1,5 +1,5 @@ -load('//tools:buck_utils.bzl', 'config_with_updated_linker_flags', 'configs_with_config') -load('//tools:buck_defs.bzl', 'combined_config', 'SHARED_CONFIGS', 'LIB_SPECIFIC_CONFIG') +load('//tools:buck_utils.bzl', 'config_with_updated_linker_flags', 'configs_with_config', 'combined_config') +load('//tools:buck_defs.bzl', 'SHARED_CONFIGS', 'EXTENSION_LIB_SPECIFIC_CONFIG') apple_library( name = 'WatchUtils', @@ -63,7 +63,7 @@ apple_library( 'Bridge/TGBridgeReplyMessageMediaAttachment.h', ], modular = True, - configs = configs_with_config(combined_config([SHARED_CONFIGS, LIB_SPECIFIC_CONFIG])), + configs = configs_with_config(combined_config([SHARED_CONFIGS, EXTENSION_LIB_SPECIFIC_CONFIG])), compiler_flags = [ '-w', ], diff --git a/submodules/AsyncDisplayKit b/submodules/AsyncDisplayKit index 13bd90f34b..02bedc1281 160000 --- a/submodules/AsyncDisplayKit +++ b/submodules/AsyncDisplayKit @@ -1 +1 @@ -Subproject commit 13bd90f34b5970f188ceb24fd4b8492e2287d68a +Subproject commit 02bedc12816e251ad71777f9d2578329b6d2bef6 diff --git a/submodules/Display b/submodules/Display index de4fff07b0..bc5c8f60d4 160000 --- a/submodules/Display +++ b/submodules/Display @@ -1 +1 @@ -Subproject commit de4fff07b0ab438537dfe79e9ee2ddaf85cef951 +Subproject commit bc5c8f60d4f9a0dbd66243008563a86fa1a7c652 diff --git a/submodules/HockeySDK-iOS b/submodules/HockeySDK-iOS index 8f73ff36e5..c7d0c70263 160000 --- a/submodules/HockeySDK-iOS +++ b/submodules/HockeySDK-iOS @@ -1 +1 @@ -Subproject commit 8f73ff36e501761ef55ea0e68386f70fab06c0a3 +Subproject commit c7d0c7026303253e2ac576c02655691e5d314fe2 diff --git a/submodules/LegacyComponents b/submodules/LegacyComponents index 0b8dd35b1d..d559434616 160000 --- a/submodules/LegacyComponents +++ b/submodules/LegacyComponents @@ -1 +1 @@ -Subproject commit 0b8dd35b1d244b9dd3134632b54825571de60934 +Subproject commit d5594346161c1b7f203d1e87068bbe77bcaac019 diff --git a/submodules/MtProtoKit b/submodules/MtProtoKit index af62022e7e..14ab734b97 160000 --- a/submodules/MtProtoKit +++ b/submodules/MtProtoKit @@ -1 +1 @@ -Subproject commit af62022e7e7abb6998c267bf4ef8f4e4bfb7a566 +Subproject commit 14ab734b977fd4f1686a2a13415f6a4c9b9fdd6d diff --git a/submodules/Postbox b/submodules/Postbox index 6c114a297d..9667e7f7d8 160000 --- a/submodules/Postbox +++ b/submodules/Postbox @@ -1 +1 @@ -Subproject commit 6c114a297de7e1eb3f0c9280c990a211997a677a +Subproject commit 9667e7f7d8e466bb15485f041b086f01d9e0f8dd diff --git a/submodules/SSignalKit b/submodules/SSignalKit index b3cbbf58a1..359b2ee7c9 160000 --- a/submodules/SSignalKit +++ b/submodules/SSignalKit @@ -1 +1 @@ -Subproject commit b3cbbf58a13341e09c7183bc41fb7cf23341d741 +Subproject commit 359b2ee7c9f20f99f221f78e307369ef5ad0ece2 diff --git a/submodules/TelegramCore b/submodules/TelegramCore index 9e97905da4..5603d1fc09 160000 --- a/submodules/TelegramCore +++ b/submodules/TelegramCore @@ -1 +1 @@ -Subproject commit 9e97905da47478400e081d6d0c2dff6de82cf106 +Subproject commit 5603d1fc0955af46143bfcd77422f478c6875ce5 diff --git a/submodules/TelegramUI b/submodules/TelegramUI index 014a685642..3a98bd9872 160000 --- a/submodules/TelegramUI +++ b/submodules/TelegramUI @@ -1 +1 @@ -Subproject commit 014a685642b97236e0891cc1afd2bc07aa0f7cb0 +Subproject commit 3a98bd98720e1f9863bdf43263f0f15160c2e674 diff --git a/submodules/ffmpeg b/submodules/ffmpeg index 6a9bbdfbba..0c7f6f030d 160000 --- a/submodules/ffmpeg +++ b/submodules/ffmpeg @@ -1 +1 @@ -Subproject commit 6a9bbdfbbaddd3884c66fab4dc1c33f03eaa821c +Subproject commit 0c7f6f030d3e6a700c1f2be9691a8388a967661a diff --git a/submodules/libtgvoip b/submodules/libtgvoip index 2a3b3e3230..d122740f39 160000 --- a/submodules/libtgvoip +++ b/submodules/libtgvoip @@ -1 +1 @@ -Subproject commit 2a3b3e3230553cb250d47660976843e78ad5f57f +Subproject commit d122740f39d90123ad8aca46c0775738352ba74c diff --git a/submodules/lottie-ios b/submodules/lottie-ios index ec26df4768..ff36611457 160000 --- a/submodules/lottie-ios +++ b/submodules/lottie-ios @@ -1 +1 @@ -Subproject commit ec26df47682ff0923f5a37ace434cad72a252d27 +Subproject commit ff3661145762d1a85da0f045b702411e48e294e6 diff --git a/submodules/webp b/submodules/webp index 62dd2a96b4..4476fa2f8d 160000 --- a/submodules/webp +++ b/submodules/webp @@ -1 +1 @@ -Subproject commit 62dd2a96b4841e61bc78a56936993a9a01a97d91 +Subproject commit 4476fa2f8d85c9767ddd750918c4d97f1ee0d0e0 diff --git a/tools/buck_defs.bzl b/tools/buck_defs.bzl index 1d2ab2daf9..d6db55ef19 100644 --- a/tools/buck_defs.bzl +++ b/tools/buck_defs.bzl @@ -10,11 +10,9 @@ SHARED_CONFIGS = { 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 +EXTENSION_LIB_SPECIFIC_CONFIG = { + 'SKIP_INSTALL': 'YES', + 'APPLICATION_EXTENSION_API_ONLY': 'YES', +} diff --git a/tools/buck_utils.bzl b/tools/buck_utils.bzl index 2c6058d22a..ca933c023e 100644 --- a/tools/buck_utils.bzl +++ b/tools/buck_utils.bzl @@ -75,16 +75,16 @@ def glob_sub_map(prefix, glob_specs): result[file_key] = path return result -def gen_header_targets(header_paths, prefix, source_rule, source_path): +def gen_header_targets(header_paths, prefix, flavor, source_rule, source_path): result = dict() for header_path in header_paths: name = prefix + header_path.replace('/', '_sub_') native.genrule( - name = name, + name = name + flavor, cmd = 'cp $(location :' + source_rule + ')/' + source_path + '/' + header_path + ' $OUT', out = name, ) - result[header_path] = ':' + name + result[header_path] = ':' + name + flavor return result def lib_basename(name): @@ -95,14 +95,17 @@ def lib_basename(name): result = result[:-2] return result -def gen_lib_targets(lib_paths, prefix, source_rule, source_path): - result = [] - for lib_path in lib_paths: - name = lib_path.replace('/', '_sub_') - native.genrule( - name = name, - cmd = 'cp $(location :' + source_rule + ')/' + source_path + '/' + lib_path + ' $OUT', - out = name - ) - result.append(name) +def combined_config(dicts): + result = dict() + for d in dicts: + result.update(d) return result + +valid_build_variants = ['project', 'release'] + +def get_build_variant(): + build_variant = native.read_config('build', 'variant', '') + if build_variant not in valid_build_variants: + fail('build_variant should be one of %s' % valid_build_variants) + return build_variant +