load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application", "ios_extension", "ios_framework", ) load("@build_bazel_rules_apple//apple:watchos.bzl", "watchos_application", "watchos_extension", ) load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library", ) load("//build-system/bazel-utils:plist_fragment.bzl", "plist_fragment", ) load( "//build-input/data:variables.bzl", "telegram_build_number", "telegram_version", "telegram_bundle_id", "telegram_aps_environment", "telegram_team_id", ) config_setting( name = "debug", values = { "compilation_mode": "dbg", }, ) genrule( name = "empty", outs = ["empty.swift"], cmd = "touch $(OUTS)", ) swift_library( name = "_LocalDebugOptions", srcs = [":empty"], copts = [ "-Xfrontend", "-serialize-debugging-options", ], deps = [ "//submodules/AsyncDisplayKit:AsyncDisplayKit", "//submodules/AppBundle:AppBundle", "//submodules/ObjCRuntimeUtils:ObjCRuntimeUtils", "//submodules/UIKitRuntimeUtils:UIKitRuntimeUtils", "//submodules/Crc32:Crc32", "//submodules/MurMurHash32:MurMurHash32", "//submodules/StringTransliteration:StringTransliteration", "//submodules/sqlcipher:sqlcipher", "//submodules/NumberPluralizationForm:NumberPluralizationForm", "//submodules/EncryptionProvider:EncryptionProvider", "//submodules/MtProtoKit:MtProtoKit", ], module_name = "_LocalDebugOptions", tags = ["no-remote"], visibility = ["//visibility:public"], ) debug_deps = select({ ":debug": [":_LocalDebugOptions"], "//conditions:default": [], }) strip_framework = select({ ":debug": None, "//conditions:default": ":StripFramework", }) filegroup( name = "AppResources", srcs = glob([ "Telegram-iOS/Resources/**/*", ], exclude = ["Telegram-iOS/Resources/**/.*"]), ) filegroup( name = "AppStringResources", srcs = glob([ "Telegram-iOS/*.lproj/Localizable.strings", ], exclude = ["Telegram-iOS/*.lproj/**/.*"]), ) filegroup( name = "WatchAppStringResources", srcs = glob([ "Telegram-iOS/*.lproj/Localizable.strings", ], exclude = ["Telegram-iOS/*.lproj/**/.*"]), ) filegroup( name = "AppIntentVocabularyResources", srcs = glob([ "Telegram-iOS/*.lproj/AppIntentVocabulary.plist", ], exclude = ["Telegram-iOS/*.lproj/**/.*"]), ) filegroup( name = "InfoPlistStringResources", srcs = glob([ "Telegram-iOS/*.lproj/InfoPlist.strings", ], exclude = ["Telegram-iOS/*.lproj/**/.*"]), ) filegroup( name = "Icons", srcs = glob([ "Telegram-iOS/Icons.xcassets/**/*", ], exclude = ["Telegram-iOS/Icons.xcassets/**/.*"]), ) filegroup( name = "AppIcons", srcs = glob([ "Telegram-iOS/AppIcons.xcassets/**/*", ], exclude = ["Telegram-iOS/AppIcons.xcassets/**/.*"]), ) filegroup( name = "DefaultAppIcon", srcs = glob([ "Telegram-iOS/DefaultAppIcon.xcassets/**/*", ], exclude = ["Telegram-iOS/DefaultAppIcon.xcassets/**/.*"]), ) filegroup( name = "DefaultIcon", srcs = glob([ "Telegram-iOS/AppIcons.xcassets/BlueIcon.appiconset/*.png", ]), ) filegroup( name = "AdditionalIcons", srcs = glob([ "Telegram-iOS/*.png", ]), ) filegroup( name = "LaunchScreen", srcs = glob([ "Telegram-iOS/Base.lproj/LaunchScreen.xib", ]), ) objc_library( name = "Main", srcs = [ "Telegram-iOS/main.m" ], ) swift_library( name = "Lib", srcs = glob([ "Telegram-iOS/Application.swift", ]), data = [ ":AppResources", ":AppIntentVocabularyResources", ":InfoPlistStringResources", "//submodules/LegacyComponents:LegacyComponentsResources", "//submodules/LegacyComponents:LegacyComponentsAssets", "//submodules/OverlayStatusController:OverlayStatusControllerResources", "//submodules/PasswordSetupUI:PasswordSetupUIResources", "//submodules/PasswordSetupUI:PasswordSetupUIAssets", "//submodules/TelegramUI:TelegramUIResources", "//submodules/TelegramUI:TelegramUIAssets", ], deps = [ "//submodules/TelegramUI:TelegramUI", ], ) plist_fragment( name = "AdditionalInfoPlist", extension = "plist", template = """ CFBundleShortVersionString {telegram_version} CFBundleVersion {telegram_build_number} CFBundleURLTypes CFBundleTypeRole Viewer CFBundleURLName {telegram_bundle_id} CFBundleURLSchemes telegram CFBundleTypeRole Viewer CFBundleURLName {telegram_bundle_id}.ton CFBundleURLSchemes ton CFBundleTypeRole Viewer CFBundleURLName {telegram_bundle_id}.compatibility CFBundleURLSchemes tg """.format( telegram_version = telegram_version, telegram_build_number = telegram_build_number, telegram_bundle_id = telegram_bundle_id, ) ) official_apple_pay_merchants = [ "merchant.ph.telegra.Telegraph", "merchant.yandex.ph.telegra.Telegraph", "merchant.sberbank.ph.telegra.Telegraph", "merchant.sberbank.test.ph.telegra.Telegraph", "merchant.privatbank.test.telergramios", "merchant.privatbank.prod.telergram", "merchant.telegram.tranzzo.test", ] official_bundle_ids = [ "ph.telegra.Telegraph", "org.telegram.Telegram-iOS", ] apple_pay_merchants = official_apple_pay_merchants if telegram_bundle_id == "ph.telegra.Telegraph" else "" apple_pay_merchants_fragment = "" if apple_pay_merchants == "" else """ com.apple.developer.in-app-payments """ + "\n".join([ " {}".format(merchant_id) for merchant_id in apple_pay_merchants ]) + "\n" + """ """ official_unrestricted_voip_fragment = """ com.apple.developer.pushkit.unrestricted-voip """ unrestricted_voip_fragment = official_unrestricted_voip_fragment if telegram_bundle_id in official_bundle_ids else "" telegram_entitlements_template = """ com.apple.developer.icloud-services CloudKit CloudDocuments com.apple.developer.icloud-container-identifiers iCloud.{telegram_bundle_id} aps-environment {telegram_aps_environment} com.apple.developer.associated-domains applinks:telegram.me applinks:t.me com.apple.developer.siri com.apple.security.application-groups group.{telegram_bundle_id} application-identifier {telegram_team_id}.{telegram_bundle_id} """ + apple_pay_merchants_fragment + unrestricted_voip_fragment plist_fragment( name = "TelegramEntitlements", extension = "entitlements", template = telegram_entitlements_template.format( telegram_bundle_id = telegram_bundle_id, telegram_team_id = telegram_team_id, telegram_aps_environment = telegram_aps_environment, ) ) filegroup( name = "TelegramWatchExtensionResources", srcs = glob([ "Watch/Extension/Resources/**/*", ], exclude = ["Watch/Extension/Resources/**/.*"]), ) filegroup( name = "TelegramWatchAppResources", srcs = glob([ "Watch/Extension/Resources/**/*.png", ], exclude = ["Watch/Extension/Resources/**/.*"]), ) filegroup( name = "TelegramWatchAppAssets", srcs = glob([ "Watch/App/Assets.xcassets/**/*", ], exclude = ["Watch/App/Assets.xcassets/**/.*"]), ) filegroup( name = "TelegramWatchAppInterface", srcs = glob([ "Watch/App/Base.lproj/Interface.storyboard", ]), ) objc_library( name = "TelegramWatchLib", srcs = glob([ "Watch/Extension/**/*.m", "Watch/SSignalKit/**/*.m", "Watch/Bridge/**/*.m", "Watch/WatchCommonWatch/**/*.m", "Watch/Extension/**/*.h", "Watch/SSignalKit/**/*.h", "Watch/Bridge/**/*.h", "Watch/WatchCommonWatch/**/*.h", ]), copts = [ "-DTARGET_OS_WATCH=1", "-ITelegram/Watch", "-ITelegram/Watch/Extension", "-ITelegram/Watch/Bridge", ], sdk_frameworks = [ "WatchKit", "WatchConnectivity", "ClockKit", "UserNotifications", "CoreLocation", "CoreGraphics", ], ) plist_fragment( name = "VersionInfoPlist", extension = "plist", template = """ CFBundleShortVersionString {telegram_version} CFBundleVersion {telegram_build_number} """.format( telegram_version = telegram_version, telegram_build_number = telegram_build_number, ) ) plist_fragment( name = "AppNameInfoPlist", extension = "plist", template = """ CFBundleDisplayName Telegram """ ) plist_fragment( name = "WatchExtensionNSExtensionInfoPlist", extension = "plist", template = """ NSExtension NSExtensionAttributes WKAppBundleIdentifier {telegram_bundle_id}.watchkitapp NSExtensionPointIdentifier com.apple.watchkit """.format( telegram_bundle_id = telegram_bundle_id, ) ) plist_fragment( name = "WatchAppCompanionInfoPlist", extension = "plist", template = """ WKCompanionAppBundleIdentifier {telegram_bundle_id} """.format( telegram_bundle_id = telegram_bundle_id, ) ) plist_fragment( name = "WatchExtensionInfoPlist", extension = "plist", template = """ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier {telegram_bundle_id}.watchkitapp.watchkitextension CFBundleName Telegram CFBundlePackageType XPC! WKExtensionDelegateClassName TGExtensionDelegate """.format( telegram_bundle_id = telegram_bundle_id, ) ) plist_fragment( name = "WatchAppInfoPlist", extension = "plist", template = """ CFBundleDevelopmentRegion en CFBundleIdentifier {telegram_bundle_id}.watchkitapp CFBundleName Telegram UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown WKWatchKitApp """.format( telegram_bundle_id = telegram_bundle_id, ) ) watchos_extension( name = "TelegramWatchExtension", bundle_id = "{telegram_bundle_id}.watchkitapp.watchkitextension".format( telegram_bundle_id = telegram_bundle_id, ), bundle_name = "TelegramWatchExtension", infoplists = [ ":WatchExtensionInfoPlist", ":VersionInfoPlist", ":AppNameInfoPlist", ":WatchExtensionNSExtensionInfoPlist", ], minimum_os_version = "5.0", provisioning_profile = "//build-input/data/provisioning-profiles:WatchExtension.mobileprovision", resources = [ ":TelegramWatchExtensionResources", ], strings = [ ":WatchAppStringResources", ], deps = [ ":TelegramWatchLib", ], ) watchos_application( name = "TelegramWatchApp", #app_icons = , bundle_id = "{telegram_bundle_id}.watchkitapp".format( telegram_bundle_id = telegram_bundle_id, ), bundle_name = "TelegramWatch", extension = ":TelegramWatchExtension", infoplists = [ ":WatchAppInfoPlist", ":VersionInfoPlist", ":AppNameInfoPlist", ":WatchAppCompanionInfoPlist", ], minimum_os_version = "5.0", provisioning_profile = "//build-input/data/provisioning-profiles:WatchApp.mobileprovision", resources = [ ":TelegramWatchAppResources", ":TelegramWatchAppAssets", ], storyboards = [ ":TelegramWatchAppInterface", ], strings = [ ], ) plist_fragment( name = "MtProtoKitInfoPlist", extension = "plist", template = """ CFBundleIdentifier {telegram_bundle_id}.MtProtoKit CFBundleVersion {telegram_build_number} CFBundleDevelopmentRegion en CFBundleName MtProtoKit CFBundleShortVersionString {telegram_version} """.format( telegram_bundle_id = telegram_bundle_id, telegram_version = telegram_version, telegram_build_number = telegram_build_number, ) ) ios_framework( name = "MtProtoKitFramework", bundle_id = "{telegram_bundle_id}.MtProtoKit".format( telegram_bundle_id = telegram_bundle_id, ), families = [ "iphone", "ipad", ], infoplists = [ ":MtProtoKitInfoPlist", ], minimum_os_version = "9.0", ipa_post_processor = strip_framework, deps = [ "//submodules/MtProtoKit:MtProtoKit", ], ) plist_fragment( name = "SwiftSignalKitInfoPlist", extension = "plist", template = """ CFBundleIdentifier {telegram_bundle_id}.SwiftSignalKit CFBundleVersion {telegram_build_number} CFBundleDevelopmentRegion en CFBundleName SwiftSignalKit CFBundleShortVersionString {telegram_version} """.format( telegram_bundle_id = telegram_bundle_id, telegram_version = telegram_version, telegram_build_number = telegram_build_number, ) ) ios_framework( name = "SwiftSignalKitFramework", bundle_id = "{telegram_bundle_id}.SwiftSignalKit".format( telegram_bundle_id = telegram_bundle_id, ), families = [ "iphone", "ipad", ], infoplists = [ ":SwiftSignalKitInfoPlist", ], minimum_os_version = "9.0", ipa_post_processor = strip_framework, deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", ], ) plist_fragment( name = "PostboxInfoPlist", extension = "plist", template = """ CFBundleIdentifier {telegram_bundle_id}.Postbox CFBundleVersion {telegram_build_number} CFBundleDevelopmentRegion en CFBundleName Postbox CFBundleShortVersionString {telegram_version} """.format( telegram_bundle_id = telegram_bundle_id, telegram_version = telegram_version, telegram_build_number = telegram_build_number, ) ) ios_framework( name = "PostboxFramework", bundle_id = "{telegram_bundle_id}.Postbox".format( telegram_bundle_id = telegram_bundle_id, ), families = [ "iphone", "ipad", ], infoplists = [ ":PostboxInfoPlist", ], frameworks = [ ":SwiftSignalKitFramework", ], minimum_os_version = "9.0", ipa_post_processor = strip_framework, deps = [ "//submodules/Postbox:Postbox", ], ) plist_fragment( name = "TelegramApiInfoPlist", extension = "plist", template = """ CFBundleIdentifier {telegram_bundle_id}.TelegramApi CFBundleVersion {telegram_build_number} CFBundleDevelopmentRegion en CFBundleName TelegramApi CFBundleShortVersionString {telegram_version} """.format( telegram_bundle_id = telegram_bundle_id, telegram_version = telegram_version, telegram_build_number = telegram_build_number, ) ) ios_framework( name = "TelegramApiFramework", bundle_id = "{telegram_bundle_id}.TelegramApi".format( telegram_bundle_id = telegram_bundle_id, ), families = [ "iphone", "ipad", ], infoplists = [ ":TelegramApiInfoPlist", ], minimum_os_version = "9.0", ipa_post_processor = strip_framework, deps = [ "//submodules/TelegramApi:TelegramApi", ], ) plist_fragment( name = "SyncCoreInfoPlist", extension = "plist", template = """ CFBundleIdentifier {telegram_bundle_id}.SyncCore CFBundleVersion {telegram_build_number} CFBundleDevelopmentRegion en CFBundleName SyncCore CFBundleShortVersionString {telegram_version} """.format( telegram_bundle_id = telegram_bundle_id, telegram_version = telegram_version, telegram_build_number = telegram_build_number, ) ) ios_framework( name = "SyncCoreFramework", bundle_id = "{telegram_bundle_id}.SyncCore".format( telegram_bundle_id = telegram_bundle_id, ), families = [ "iphone", "ipad", ], infoplists = [ ":SyncCoreInfoPlist", ], frameworks = [ ":SwiftSignalKitFramework", ":PostboxFramework", ], minimum_os_version = "9.0", ipa_post_processor = strip_framework, deps = [ "//submodules/SyncCore:SyncCore", ], ) plist_fragment( name = "TelegramCoreInfoPlist", extension = "plist", template = """ CFBundleIdentifier {telegram_bundle_id}.TelegramCore CFBundleVersion {telegram_build_number} CFBundleDevelopmentRegion en CFBundleName TelegramCore CFBundleShortVersionString {telegram_version} """.format( telegram_bundle_id = telegram_bundle_id, telegram_version = telegram_version, telegram_build_number = telegram_build_number, ) ) ios_framework( name = "TelegramCoreFramework", bundle_id = "{telegram_bundle_id}.TelegramCore".format( telegram_bundle_id = telegram_bundle_id, ), families = [ "iphone", "ipad", ], infoplists = [ ":TelegramCoreInfoPlist", ], frameworks = [ ":MtProtoKitFramework", ":SwiftSignalKitFramework", ":PostboxFramework", ":SyncCoreFramework", ":TelegramApiFramework", ], minimum_os_version = "9.0", ipa_post_processor = strip_framework, deps = [ "//submodules/TelegramCore:TelegramCore", ], ) plist_fragment( name = "AsyncDisplayKitInfoPlist", extension = "plist", template = """ CFBundleIdentifier {telegram_bundle_id}.AsyncDisplayKit CFBundleVersion {telegram_build_number} CFBundleDevelopmentRegion en CFBundleName AsyncDisplayKit CFBundleShortVersionString {telegram_version} """.format( telegram_bundle_id = telegram_bundle_id, telegram_version = telegram_version, telegram_build_number = telegram_build_number, ) ) ios_framework( name = "AsyncDisplayKitFramework", bundle_id = "{telegram_bundle_id}.AsyncDisplayKit".format( telegram_bundle_id = telegram_bundle_id, ), families = [ "iphone", "ipad", ], infoplists = [ ":AsyncDisplayKitInfoPlist", ], minimum_os_version = "9.0", ipa_post_processor = strip_framework, deps = [ "//submodules/AsyncDisplayKit:AsyncDisplayKit", ], ) plist_fragment( name = "DisplayInfoPlist", extension = "plist", template = """ CFBundleIdentifier {telegram_bundle_id}.Display CFBundleVersion {telegram_build_number} CFBundleDevelopmentRegion en CFBundleName Display CFBundleShortVersionString {telegram_version} """.format( telegram_bundle_id = telegram_bundle_id, telegram_version = telegram_version, telegram_build_number = telegram_build_number, ) ) genrule( name = "StripFramework", cmd_bash = """ echo 'for f in $$1/*.framework; do binary_name=`echo $$(basename $$f) | sed -e "s/\\\\.framework//"`; strip -ST $$f/$$binary_name; done;' > $(location StripFramework.sh) echo '' >> $(location StripFramework.sh) """, outs = [ "StripFramework.sh", ], executable = True, visibility = [ "//visibility:public", ] ) ios_framework( name = "DisplayFramework", bundle_id = "{telegram_bundle_id}.Display".format( telegram_bundle_id = telegram_bundle_id, ), families = [ "iphone", "ipad", ], infoplists = [ ":DisplayInfoPlist", ], frameworks = [ ":SwiftSignalKitFramework", ":AsyncDisplayKitFramework", ], minimum_os_version = "9.0", ipa_post_processor = strip_framework, deps = [ "//submodules/Display:Display", ], ) plist_fragment( name = "TelegramUIInfoPlist", extension = "plist", template = """ CFBundleIdentifier {telegram_bundle_id}.TelegramUI CFBundleVersion {telegram_build_number} CFBundleDevelopmentRegion en CFBundleName TelegramUI CFBundleShortVersionString {telegram_version} """.format( telegram_bundle_id = telegram_bundle_id, telegram_version = telegram_version, telegram_build_number = telegram_build_number, ) ) ios_framework( name = "TelegramUIFramework", bundle_id = "{telegram_bundle_id}.TelegramUI".format( telegram_bundle_id = telegram_bundle_id, ), families = [ "iphone", "ipad", ], infoplists = [ ":TelegramUIInfoPlist", ], frameworks = [ ":MtProtoKitFramework", ":SwiftSignalKitFramework", ":PostboxFramework", ":TelegramApiFramework", ":SyncCoreFramework", ":TelegramCoreFramework", ":AsyncDisplayKitFramework", ":DisplayFramework", ], minimum_os_version = "9.0", ipa_post_processor = strip_framework, deps = [ "//submodules/TelegramUI:TelegramUI", ] + debug_deps, ) plist_fragment( name = "ShareInfoPlist", extension = "plist", template = """ CFBundleDevelopmentRegion en CFBundleIdentifier {telegram_bundle_id}.Share CFBundleName Telegram CFBundlePackageType XPC! NSExtension NSExtensionAttributes IntentsSupported INSendMessageIntent NSExtensionActivationRule SUBQUERY ( extensionItems, $extensionItem, SUBQUERY ( $extensionItem.attachments, $attachment, ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.file-url" || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.movie" || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.image" || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.url" || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.text" || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.audio" || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.data" || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.vcard" || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.apple.pkpass" ).@count == $extensionItem.attachments.@count ).@count > 0 NSExtensionPointIdentifier com.apple.share-services NSExtensionPrincipalClass ShareRootController """.format( telegram_bundle_id = telegram_bundle_id, ) ) swift_library( name = "ShareExtensionLib", module_name = "ShareExtensionLib", srcs = glob([ "Share/**/*.swift", ]), deps = [ "//submodules/TelegramUI:TelegramUI" ], ) ios_extension( name = "ShareExtension", bundle_id = "{telegram_bundle_id}.Share".format( telegram_bundle_id = telegram_bundle_id, ), families = [ "iphone", "ipad", ], infoplists = [ ":ShareInfoPlist", ":VersionInfoPlist", ":AppNameInfoPlist", ], minimum_os_version = "9.0", provisioning_profile = "//build-input/data/provisioning-profiles:Share.mobileprovision", deps = [":ShareExtensionLib"], frameworks = [ ":TelegramUIFramework" ], ) plist_fragment( name = "NotificationContentInfoPlist", extension = "plist", template = """ CFBundleDevelopmentRegion en CFBundleIdentifier {telegram_bundle_id}.NotificationContent CFBundleName Telegram CFBundlePackageType XPC! NSExtension NSExtensionAttributes UNNotificationExtensionCategory withReplyMedia withMuteMedia UNNotificationExtensionInitialContentSizeRatio 0.0001 NSExtensionPointIdentifier com.apple.usernotifications.content-extension NSExtensionPrincipalClass NotificationViewController """.format( telegram_bundle_id = telegram_bundle_id, ) ) swift_library( name = "NotificationContentExtensionLib", module_name = "NotificationContentExtensionLib", srcs = glob([ "NotificationContent/**/*.swift", ]), deps = [ "//submodules/TelegramUI:TelegramUI" ], ) ios_extension( name = "NotificationContentExtension", bundle_id = "{telegram_bundle_id}.NotificationContent".format( telegram_bundle_id = telegram_bundle_id, ), families = [ "iphone", "ipad", ], infoplists = [ ":NotificationContentInfoPlist", ":VersionInfoPlist", ":AppNameInfoPlist", ], minimum_os_version = "9.0", provisioning_profile = "//build-input/data/provisioning-profiles:NotificationContent.mobileprovision", deps = [":NotificationContentExtensionLib"], frameworks = [ ":TelegramUIFramework" ], ) plist_fragment( name = "WidgetInfoPlist", extension = "plist", template = """ CFBundleDevelopmentRegion en CFBundleIdentifier {telegram_bundle_id}.Widget CFBundleName Telegram CFBundlePackageType XPC! NSExtension NSExtensionPointIdentifier com.apple.widgetkit-extension """.format( telegram_bundle_id = telegram_bundle_id, ) ) swift_library( name = "WidgetExtensionLib", module_name = "WidgetExtensionLib", srcs = glob([ "WidgetKitWidget/**/*.swift", ]), deps = [ "//submodules/BuildConfig:BuildConfig", "//submodules/WidgetItems:WidgetItems", "//submodules/AppLockState:AppLockState", ], ) ios_extension( name = "WidgetExtension", bundle_id = "{telegram_bundle_id}.Widget".format( telegram_bundle_id = telegram_bundle_id, ), families = [ "iphone", "ipad", ], infoplists = [ ":WidgetInfoPlist", ":VersionInfoPlist", ":AppNameInfoPlist", ], minimum_os_version = "14.0", provides_main = True, provisioning_profile = "//build-input/data/provisioning-profiles:Widget.mobileprovision", deps = [":WidgetExtensionLib"], frameworks = [], ) plist_fragment( name = "IntentsInfoPlist", extension = "plist", template = """ CFBundleDevelopmentRegion en CFBundleIdentifier {telegram_bundle_id}.SiriIntents CFBundleName Telegram CFBundlePackageType XPC! NSExtension NSExtensionAttributes IntentsRestrictedWhileLocked IntentsRestrictedWhileProtectedDataUnavailable IntentsSupported INSendMessageIntent INStartAudioCallIntent INSearchForMessagesIntent INSetMessageAttributeIntent INSearchCallHistoryIntent NSExtensionPointIdentifier com.apple.intents-service NSExtensionPrincipalClass IntentHandler """.format( telegram_bundle_id = telegram_bundle_id, ) ) swift_library( name = "IntentsExtensionLib", module_name = "IntentsExtensionLib", srcs = glob([ "SiriIntents/**/*.swift", ]), deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/Postbox:Postbox", "//submodules/TelegramApi:TelegramApi", "//submodules/SyncCore:SyncCore", "//submodules/TelegramCore:TelegramCore", "//submodules/BuildConfig:BuildConfig", "//submodules/OpenSSLEncryptionProvider:OpenSSLEncryptionProvider", "//submodules/AppLockState:AppLockState", ], ) ios_extension( name = "IntentsExtension", bundle_id = "{telegram_bundle_id}.SiriIntents".format( telegram_bundle_id = telegram_bundle_id, ), families = [ "iphone", "ipad", ], infoplists = [ ":IntentsInfoPlist", ":VersionInfoPlist", ":AppNameInfoPlist", ], minimum_os_version = "9.0", provisioning_profile = "//build-input/data/provisioning-profiles:Intents.mobileprovision", deps = [":IntentsExtensionLib"], frameworks = [ ":SwiftSignalKitFramework", ":PostboxFramework", ":TelegramApiFramework", ":SyncCoreFramework", ], ) plist_fragment( name = "NotificationServiceInfoPlist", extension = "plist", template = """ CFBundleDevelopmentRegion en CFBundleIdentifier {telegram_bundle_id}.NotificationService CFBundleName Telegram CFBundlePackageType XPC! NSExtension NSExtensionPointIdentifier com.apple.usernotifications.service NSExtensionPrincipalClass NotificationService """.format( telegram_bundle_id = telegram_bundle_id, ) ) ios_extension( name = "NotificationServiceExtension", bundle_id = "{telegram_bundle_id}.NotificationService".format( telegram_bundle_id = telegram_bundle_id, ), families = [ "iphone", "ipad", ], infoplists = [ ":NotificationServiceInfoPlist", ":VersionInfoPlist", ":AppNameInfoPlist", ], minimum_os_version = "10.0", provisioning_profile = "//build-input/data/provisioning-profiles:NotificationService.mobileprovision", deps = ["//Telegram/NotificationService:NotificationServiceExtensionLib"], frameworks = [ ":MtProtoKitFramework", ":SwiftSignalKitFramework", ":PostboxFramework", ":TelegramApiFramework", ":SyncCoreFramework", ], ) plist_fragment( name = "TelegramInfoPlist", extension = "plist", template = """ BGTaskSchedulerPermittedIdentifiers {telegram_bundle_id}.refresh CFBundleAllowMixedLocalizations CFBundleDevelopmentRegion en CFBundleDisplayName Telegram CFBundleIdentifier {telegram_bundle_id} CFBundleName Telegram ITSAppUsesNonExemptEncryption LSApplicationQueriesSchemes instagram comgooglemaps-x-callback foursquare here-location yandexmaps yandexnavi comgooglemaps youtube twitter vk waze googlechrome firefox touch-http yandexbrowser-open-url vimeo vine coub uber citymapper lyft opera-http firefox-focus ddgQuickLink moovit alook dgis microsoft-edge-http brave onionhttp ucbrowser dolphin instagram-stories LSRequiresIPhoneOS NSAppTransportSecurity NSAllowsArbitraryLoads NSCameraUsageDescription We need this so that you can take and share photos and videos. NSContactsUsageDescription Telegram stores your contacts heavily encrypted in the cloud to let you connect with your friends across all your devices. NSFaceIDUsageDescription You can use Face ID to unlock the app. NSLocationAlwaysUsageDescription When you send your location to your friends, Telegram needs access to show them a map. You also need this to send locations from an Apple Watch. NSLocationWhenInUseUsageDescription When you send your location to your friends, Telegram needs access to show them a map. NSMicrophoneUsageDescription We need this so that you can record and share voice messages and videos with sound. NSMotionUsageDescription When you send your location to your friends, Telegram needs access to show them a map. NSPhotoLibraryAddUsageDescription We need this so that you can share photos and videos from your photo library. NSPhotoLibraryUsageDescription We need this so that you can share photos and videos from your photo library. NSSiriUsageDescription You can use Siri to send messages. NSUserActivityTypes INSendMessageIntent RemindAboutChatIntent UIAppFonts SFCompactRounded-Semibold.otf UIBackgroundModes audio fetch location remote-notification voip UIDeviceFamily 1 2 UIFileSharingEnabled UILaunchStoryboardName LaunchScreen UIRequiredDeviceCapabilities armv7 UIRequiresPersistentWiFi UIStatusBarStyle UIStatusBarStyleDefault UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UISupportedInterfaceOrientations~ipad UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIViewControllerBasedStatusBarAppearance UIViewEdgeAntialiasing UIViewGroupOpacity UTImportedTypeDeclarations UTTypeConformsTo public.data UTTypeDescription Telegram iOS Color Theme File UTTypeIconFiles BlueIcon@3x.png UTTypeIdentifier org.telegram.Telegram-iOS.theme UTTypeTagSpecification public.filename-extension tgios-theme """.format( telegram_bundle_id = telegram_bundle_id, ) ) plist_fragment( name = "TelegramInfoIconsPlist", extension = "plist", template = """ CFBundleIcons CFBundleAlternateIcons Black CFBundleIconFiles BlackIcon BlackNotificationIcon UIPrerenderedIcon BlackClassic CFBundleIconFiles BlackClassicIcon BlackClassicNotificationIcon UIPrerenderedIcon BlackFilled CFBundleIconFiles BlackFilledIcon UIPrerenderedIcon Blue CFBundleIconFiles BlueIcon BlueNotificationIcon UIPrerenderedIcon BlueClassic CFBundleIconFiles BlueClassicIcon BlueClassicNotificationIcon UIPrerenderedIcon BlueFilled CFBundleIconFiles BlueFilledIcon UIPrerenderedIcon WhiteFilled CFBundleIconFiles WhiteFilledIcon UIPrerenderedIcon CFBundlePrimaryIcon CFBundleIconFiles IconDefault-60 IconDefault-76 IconDefault-83.5 IconDefault-Small-40 IconDefault-Small UIPrerenderedIcon CFBundleIcons~ipad CFBundleAlternateIcons Black CFBundleIconFiles BlackIconIpad BlackIconLargeIpad BlackNotificationIcon UIPrerenderedIcon BlackClassic CFBundleIconFiles BlackClassicIconIpad BlackClassicIconLargeIpad BlackClassicNotificationIcon UIPrerenderedIcon BlackFilled CFBundleIconFiles BlackFilledIconIpad BlackFilledIconLargeIpad UIPrerenderedIcon Blue CFBundleIconFiles BlueIconIpad BlueIconLargeIpad BlueNotificationIcon UIPrerenderedIcon BlueClassic CFBundleIconFiles BlueClassicIconIpad BlueClassicIconLargeIpad BlueClassicNotificationIcon UIPrerenderedIcon BlueFilled CFBundleIconFiles BlueFilledIconIpad BlueFilledIconLargeIpad UIPrerenderedIcon WhiteFilled CFBundleIconFiles WhiteFilledIcon UIPrerenderedIcon CFBundlePrimaryIcon CFBundleIconFiles IconDefault-60 IconDefault-76 IconDefault-83.5 IconDefault-Small-40 IconDefault-Small UIPrerenderedIcon """) ios_application( name = "Telegram", bundle_id = "{telegram_bundle_id}".format( telegram_bundle_id = telegram_bundle_id, ), families = ["iphone", "ipad"], minimum_os_version = "9.0", provisioning_profile = "//build-input/data/provisioning-profiles:Telegram.mobileprovision", entitlements = ":TelegramEntitlements.entitlements", infoplists = [ ":TelegramInfoPlist", ":AdditionalInfoPlist", ":TelegramInfoIconsPlist", ], #app_icons = [ # ":DefaultAppIcon", #], resources = [ ":AdditionalIcons", #":DefaultAppIcon", #":AppIcons", ], frameworks = [ ":MtProtoKitFramework", ":SwiftSignalKitFramework", ":PostboxFramework", ":TelegramApiFramework", ":SyncCoreFramework", ":TelegramCoreFramework", ":AsyncDisplayKitFramework", ":DisplayFramework", ":TelegramUIFramework", ], strings = [ ":AppStringResources", ], extensions = [ ":ShareExtension", ":WidgetExtension", ":NotificationContentExtension", ":NotificationServiceExtension", ":IntentsExtension", ], watch_application = ":TelegramWatchApp", deps = [ ":Main", ":Lib", ], )