Build and run

This commit is contained in:
Ali 2020-02-24 19:23:09 +04:00
parent 5380b12805
commit 92febb8319
228 changed files with 1638 additions and 980 deletions

2
.gitignore vendored
View File

@ -61,3 +61,5 @@ bazel-testlogs/*
*/*.swp
build-input/data
build-input/data/*
build-input/gen
build-input/gen/*

View File

@ -39,6 +39,7 @@ BUCK_OPTIONS=\
--config custom.developmentProvisioningProfileWatchExtension="${DEVELOPMENT_PROVISIONING_PROFILE_WATCH_EXTENSION}" \
--config custom.distributionProvisioningProfileWatchExtension="${DISTRIBUTION_PROVISIONING_PROFILE_WATCH_EXTENSION}"
BAZEL=$(shell which bazel)
build_arm64: check_env
$(BUCK) build \
@ -395,3 +396,6 @@ project_buckdebug: check_env kill_xcode
temp_project: check_env kill_xcode
$(BUCK) project //Temp:workspace --config custom.mode=project ${BUCK_OPTIONS} ${BUCK_DEBUG_OPTIONS}
open Temp/Telegram_Buck.xcworkspace
tulsi_project:
${HOME}/Applications/Tulsi.app/Contents/MacOS/Tulsi -- --verbose --genconfig Telegram/Telegram.tulsiproj:Default --bazel "${BAZEL}" --build-options ${BAZEL_OPTIONS} --startup-options ${BAZEL_OPTIONS}

View File

@ -3,16 +3,28 @@ load("@build_bazel_rules_apple//apple:ios.bzl",
"ios_framework",
)
load("@build_bazel_rules_apple//apple:watchos.bzl",
"watchos_application",
"watchos_extension",
)
load("@build_bazel_rules_apple//apple:versioning.bzl",
"apple_bundle_version",
)
load("@build_bazel_rules_swift//swift:swift.bzl",
"swift_library",
)
load("//build-system:defines.bzl",
"file_from_define",
load("//build-system:info_plist_fragment.bzl",
"info_plist_fragment",
)
load(":telegram_info_plist.bzl",
"telegram_info_plist",
load(
"//build-input/data:variables.bzl",
"telegram_build_number",
"telegram_version",
"telegram_bundle_id",
)
filegroup(
@ -29,6 +41,13 @@ filegroup(
], exclude = ["Telegram-iOS/*.lproj/**/.*"]),
)
filegroup(
name = "WatchAppStringResources",
srcs = glob([
"Telegram-iOS/*.lproj/Localizable.strings",
], exclude = ["Telegram-iOS/*.lproj/**/.*"]),
)
filegroup(
name = "AppIntentVocabularyResources",
srcs = glob([
@ -46,15 +65,22 @@ filegroup(
filegroup(
name = "Icons",
srcs = glob([
"Telegram-iOS/Icons.xcassets",
]),
"Telegram-iOS/Icons.xcassets/**/*",
], exclude = ["Telegram-iOS/Icons.xcassets/**/.*"]),
)
filegroup(
name = "AppIcons",
srcs = glob([
"Telegram-iOS/AppIcons.xcassets",
]),
"Telegram-iOS/AppIcons.xcassets/**/*",
], exclude = ["Telegram-iOS/AppIcons.xcassets/**/.*"]),
)
filegroup(
name = "DefaultAppIcon",
srcs = glob([
"Telegram-iOS/DefaultAppIcon.xcassets/**/*",
], exclude = ["Telegram-iOS/DefaultAppIcon.xcassets/**/.*"]),
)
filegroup(
@ -84,73 +110,247 @@ swift_library(
"Telegram-iOS/Application.swift",
]),
data = [
":AppStringResources",
":AppResources",
":AppIntentVocabularyResources",
":InfoPlistStringResources",
],
deps = [
"//submodules/GZip:GZip",
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
"//submodules/SSignalKit/SSignalKit:SSignalKit",
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/ObjCRuntimeUtils:ObjCRuntimeUtils",
"//submodules/UIKitRuntimeUtils:UIKitRuntimeUtils",
"//submodules/Display:Display",
"//submodules/AlertUI:AlertUI",
"//submodules/ActivityIndicator:ActivityIndicator",
"//submodules/OverlayStatusController:OverlayStatusController",
"//submodules/openssl:openssl",
"//submodules/OpenSSLEncryptionProvider:OpenSSLEncryptionProvider",
"//submodules/WalletCore:WalletCore",
"//submodules/BuildConfig:BuildConfig",
"//submodules/AppBundle:AppBundle",
"//submodules/SolidRoundedButtonNode:SolidRoundedButtonNode",
"//submodules/Camera:Camera",
"//submodules/QrCode:QrCode",
"//submodules/MergeLists:MergeLists",
"//submodules/GlassButtonNode:GlassButtonNode",
"//submodules/UrlEscaping:UrlEscaping",
"//submodules/LocalAuth:LocalAuth",
"//submodules/ScreenCaptureDetection:ScreenCaptureDetection",
"//submodules/WalletUrl:WalletUrl",
"//submodules/ProgressNavigationButtonNode:ProgressNavigationButtonNode",
"//submodules/Markdown:Markdown",
"//submodules/StringPluralization:StringPluralization",
"//submodules/YuvConversion:YuvConversion",
"//submodules/rlottie:RLottieBinding",
"//submodules/AnimatedStickerNode:AnimatedStickerNode",
"//submodules/WalletUI:WalletUI",
"//submodules/WebsiteType:WebsiteType",
"//submodules/MtProtoKit:MtProtoKit",
"//submodules/Postbox:Postbox",
"//submodules/SyncCore:SyncCore",
"//submodules/TelegramCore:TelegramCore",
"//submodules/AccountContext:AccountContext",
"//submodules/lottie-ios:Lottie",
"//submodules/ChatListUI:ChatListUI",
"//submodules/TelegramUI:TelegramUI",
],
)
additional_info_plist = telegram_info_plist(
additional_info_plist = info_plist_fragment(
name = "AdditionalInfoPlist",
app_name = "Telegram",
url_scheme = "tg",
bundle_id_define = "telegram_bundle_id",
app_version_define = "telegram_version",
build_number_define = "telegram_build_number",
template =
"""
<key>CFBundleShortVersionString</key>
<string>{telegram_version}</string>
<key>CFBundleVersion</key>
<string>{telegram_build_number}</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleURLName</key>
<string>{telegram_bundle_id}</string>
<key>CFBundleURLSchemes</key>
<array>
<string>telegram</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleURLName</key>
<string>{telegram_bundle_id}.ton</string>
<key>CFBundleURLSchemes</key>
<array>
<string>ton</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleURLName</key>
<string>{telegram_bundle_id}.compatibility</string>
<key>CFBundleURLSchemes</key>
<array>
<string>tg</string>
</array>
</dict>
</array>
""".format(
telegram_version = telegram_version,
telegram_build_number = telegram_build_number,
telegram_bundle_id = telegram_bundle_id,
)
)
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",
],
)
info_plist_fragment(
name = "WatchVersionInfoPlist",
template =
"""
<key>CFBundleShortVersionString</key>
<string>{telegram_version}</string>
<key>CFBundleVersion</key>
<string>{telegram_build_number}</string>
""".format(
telegram_version = telegram_version,
telegram_build_number = telegram_build_number,
)
)
info_plist_fragment(
name = "WatchAppNameInfoPlist",
template =
"""
<key>CFBundleDisplayName</key>
<string>Telegram</string>
"""
)
info_plist_fragment(
name = "WatchExtensionNSExtensionInfoPlist",
template =
"""
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>WKAppBundleIdentifier</key>
<string>{telegram_bundle_id}.watchkitapp</string>
</dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.watchkit</string>
</dict>
""".format(
telegram_bundle_id = telegram_bundle_id,
)
)
info_plist_fragment(
name = "WatchAppCompanionInfoPlist",
template =
"""
<key>WKCompanionAppBundleIdentifier</key>
<string>{telegram_bundle_id}</string>
""".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 = [
"Watch/Extension/Info.plist",
":WatchVersionInfoPlist",
":WatchAppNameInfoPlist",
":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 = [
"Watch/App/Info.plist",
":WatchVersionInfoPlist",
":WatchAppNameInfoPlist",
":WatchAppCompanionInfoPlist",
],
minimum_os_version = "5.0",
provisioning_profile = "//build-input/data/provisioning-profiles:WatchApp.mobileprovision",
resources = [
":TelegramWatchAppResources",
":TelegramWatchAppAssets",
],
storyboards = [
":TelegramWatchAppInterface",
],
strings = [
],
)
ios_application(
name = "Telegram",
bundle_id = "{telegram_bundle_id}",
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:App.mobileprovision",
provisioning_profile = "//build-input/data/provisioning-profiles:Telegram.mobileprovision",
entitlements = "Telegram-iOS/Telegram-iOS-Hockeyapp.entitlements",
infoplists = [
"Info.plist",
":AdditionalInfoPlist",
],
app_icons = [
":DefaultAppIcon",
],
frameworks = [
#":AsyncDisplayKitFramework",
],
strings = [
":AppStringResources",
],
watch_application = ":TelegramWatchApp",
deps = [
":Main",
":Lib",

View File

@ -14,172 +14,6 @@
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIcons</key>
<dict>
<key>CFBundleAlternateIcons</key>
<dict>
<key>Black</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlackIcon</string>
<string>BlackNotificationIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>BlackClassic</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlackClassicIcon</string>
<string>BlackClassicNotificationIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>BlackFilled</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlackFilledIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>Blue</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlueIcon</string>
<string>BlueNotificationIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>BlueClassic</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlueClassicIcon</string>
<string>BlueClassicNotificationIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>BlueFilled</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlueFilledIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>WhiteFilled</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>WhiteFilledIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
</dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconName</key>
<string>AppIconLLC</string>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
</dict>
<key>CFBundleIcons~ipad</key>
<dict>
<key>CFBundleAlternateIcons</key>
<dict>
<key>Black</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlackIconIpad</string>
<string>BlackIconLargeIpad</string>
<string>BlackNotificationIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>BlackClassic</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlackClassicIconIpad</string>
<string>BlackClassicIconLargeIpad</string>
<string>BlackClassicNotificationIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>BlackFilled</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlackFilledIconIpad</string>
<string>BlackFilledIconLargeIpad</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>Blue</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlueIconIpad</string>
<string>BlueIconLargeIpad</string>
<string>BlueNotificationIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>BlueClassic</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlueClassicIconIpad</string>
<string>BlueClassicIconLargeIpad</string>
<string>BlueClassicNotificationIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>BlueFilled</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlueFilledIconIpad</string>
<string>BlueFilledIconLargeIpad</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>WhiteFilled</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>WhiteFilledIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
</dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconName</key>
<string>AppIconLLC</string>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
</dict>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>

View File

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

View File

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

View File

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

View File

@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -1,104 +0,0 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "icon@120px.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "icon@180px.png",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "icon@76px.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "icon@152px.png",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "icon@167px.png",
"scale" : "2x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "icon@1024px.png",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 370 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

View File

@ -14,172 +14,6 @@
<string>${APP_NAME}</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIcons</key>
<dict>
<key>CFBundleAlternateIcons</key>
<dict>
<key>Black</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlackIcon</string>
<string>BlackNotificationIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>BlackClassic</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlackClassicIcon</string>
<string>BlackClassicNotificationIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>BlackFilled</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlackFilledIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>Blue</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlueIcon</string>
<string>BlueNotificationIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>BlueClassic</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlueClassicIcon</string>
<string>BlueClassicNotificationIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>BlueFilled</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlueFilledIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>WhiteFilled</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>WhiteFilledIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
</dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconName</key>
<string>AppIconLLC</string>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
</dict>
<key>CFBundleIcons~ipad</key>
<dict>
<key>CFBundleAlternateIcons</key>
<dict>
<key>Black</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlackIconIpad</string>
<string>BlackIconLargeIpad</string>
<string>BlackNotificationIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>BlackClassic</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlackClassicIconIpad</string>
<string>BlackClassicIconLargeIpad</string>
<string>BlackClassicNotificationIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>BlackFilled</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlackFilledIconIpad</string>
<string>BlackFilledIconLargeIpad</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>Blue</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlueIconIpad</string>
<string>BlueIconLargeIpad</string>
<string>BlueNotificationIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>BlueClassic</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlueClassicIconIpad</string>
<string>BlueClassicIconLargeIpad</string>
<string>BlueClassicNotificationIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>BlueFilled</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlueFilledIconIpad</string>
<string>BlueFilledIconLargeIpad</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>WhiteFilled</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>WhiteFilledIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
</dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconName</key>
<string>AppIconLLC</string>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
</dict>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>

View File

@ -34,5 +34,7 @@
</array>
<key>com.apple.developer.pushkit.unrestricted-voip</key>
<true/>
<key>application-identifier</key>
<string>X834Q8SBVP.org.telegram.Telegram-iOS</string>
</dict>
</plist>

View File

@ -4,8 +4,6 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>$(APP_NAME)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
@ -16,10 +14,6 @@
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(PRODUCT_BUNDLE_SHORT_VERSION)</string>
<key>CFBundleVersion</key>
<string>${BUILD_NUMBER}</string>
<key>UIDeviceFamily</key>
<array>
<integer>4</integer>
@ -29,8 +23,6 @@
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>WKCompanionAppBundleIdentifier</key>
<string>$(APP_BUNDLE_ID)</string>
<key>WKWatchKitApp</key>
<true/>
</dict>

View File

@ -4,8 +4,6 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>$(APP_NAME)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
@ -16,20 +14,6 @@
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>$(PRODUCT_BUNDLE_SHORT_VERSION)</string>
<key>CFBundleVersion</key>
<string>${BUILD_NUMBER}</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>WKAppBundleIdentifier</key>
<string>$(APP_BUNDLE_ID).watchkitapp</string>
</dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.watchkit</string>
</dict>
<key>WKExtensionDelegateClassName</key>
<string>TGExtensionDelegate</string>
</dict>

View File

@ -9,7 +9,7 @@
],
"optionSet" : {
"BazelBuildOptionsDebug" : {
"p" : "$(inherited) --features=swift.use_global_module_cache --features=swift.swift.no_generated_header --spawn_strategy=standalone --strategy=SwiftCompile=standalone"
"p" : "$(inherited) --features=swift.use_global_module_cache --features=swift.swift.no_generated_header --spawn_strategy=standalone --strategy=SwiftCompile=standalone --define=wallet_bundle_id=org.ton.TonWallet-iOS"
},
"BazelBuildOptionsRelease" : {
"p" : "$(inherited)"

@ -1 +1 @@
Subproject commit 2e869ab0be373d4bd25f5da92052e3c51434e20f
Subproject commit 6e1f592277650a2727b6e84705ec1a2dc17764fa

View File

@ -1,12 +1,54 @@
#!/bin/zsh
#!/bin/sh
set -e
if [ "$PROVISIONING_PROFILE_SEARCH_PATH" = "" ]; then
>&2 echo "PROVISIONING_PROFILE_SEARCH_PATH not defined"
if [ "$CODESIGNING_DATA_PATH" = "" ]; then
>&2 echo "CODESIGNING_DATA_PATH not defined"
exit 1
fi
EXPECTED_VARIABLES=(\
DEVELOPMENT_PROVISIONING_PROFILE_APP \
DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_SHARE \
DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_WIDGET \
DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONSERVICE \
DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONCONTENT \
DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_INTENTS \
DEVELOPMENT_PROVISIONING_PROFILE_WATCH_APP \
DEVELOPMENT_PROVISIONING_PROFILE_WATCH_EXTENSION \
)
EXPECTED_VARIABLE_NAMES=(\
Telegram \
Share \
Widget \
NotificationService \
NotificationContent \
Intents \
WatchApp \
WatchExtension \
)
SEARCH_NAMES=()
MISSING_VARIABLES="0"
for VARIABLE_NAME in ${EXPECTED_VARIABLES[@]}; do
if [ "${!VARIABLE_NAME}" = "" ]; then
echo "$VARIABLE_NAME not defined"
MISSING_VARIABLES="1"
fi
done
if [ "$MISSING_VARIABLES" == "1" ]; then
exit 1
fi
VARIABLE_COUNT=${#EXPECTED_VARIABLES[@]}
for (( i=0; i<$VARIABLE_COUNT; i=i+1 )); do
VARIABLE_NAME="${EXPECTED_VARIABLES[$(($i))]}"
SEARCH_NAMES=("${SEARCH_NAMES[@]}" "${EXPECTED_VARIABLE_NAMES[$i]}" "${!VARIABLE_NAME}")
done
touch "build-input/data/BUILD"
OUTPUT_DIRECTORY="build-input/data/provisioning-profiles"
@ -18,7 +60,6 @@ touch "$BUILD_PATH"
echo "exports_files([" >> "$BUILD_PATH"
SEARCH_NAMES=($@)
ELEMENT_COUNT=${#SEARCH_NAMES[@]}
REMAINDER=$(($ELEMENT_COUNT % 2))
@ -27,18 +68,17 @@ if [ $REMAINDER != 0 ]; then
exit 1
fi
declare -A FOUND_PROFILES
for PROFILE in `find "$PROVISIONING_PROFILE_SEARCH_PATH" -type f -name "*.mobileprovision"`; do
for PROFILE in `find "$CODESIGNING_DATA_PATH" -type f -name "*.mobileprovision"`; do
PROFILE_DATA=$(security cms -D -i "$PROFILE")
PROFILE_NAME=$(/usr/libexec/PlistBuddy -c "Print :Name" /dev/stdin <<< $(echo $PROFILE_DATA))
for (( i=1; i<$ELEMENT_COUNT+1; i=i+2 )); do
for (( i=0; i<$ELEMENT_COUNT; i=i+2 )); do
ID=${SEARCH_NAMES[$i]}
SEARCH_NAME=${SEARCH_NAMES[$(($i + 1))]}
if [ "$PROFILE_NAME" = "$SEARCH_NAME" ]; then
if [ "${FOUND_PROFILES[\"$SEARCH_NAME\"]}" = "" ]; then
FOUND_PROFILES["$SEARCH_NAME"]="$PROFILE"
else
VARIABLE_NAME="FOUND_PROFILE_$ID"
if [ "${!VARIABLE_NAME}" = "" ]; then
eval "FOUND_PROFILE_$ID=\"$PROFILE\""
else
>&2 echo "Found multiple profiles with name \"$SEARCH_NAME\""
exit 1
fi
@ -46,10 +86,11 @@ for PROFILE in `find "$PROVISIONING_PROFILE_SEARCH_PATH" -type f -name "*.mobile
done
done
for (( i=1; i<$ELEMENT_COUNT+1; i=i+2 )); do
for (( i=0; i<$ELEMENT_COUNT; i=i+2 )); do
ID=${SEARCH_NAMES[$i]}
SEARCH_NAME=${SEARCH_NAMES[$(($i + 1))]}
FOUND_PROFILE="${FOUND_PROFILES[\"$SEARCH_NAME\"]}"
VARIABLE_NAME="FOUND_PROFILE_$ID"
FOUND_PROFILE="${!VARIABLE_NAME}"
if [ "$FOUND_PROFILE" = "" ]; then
>&2 echo "Profile \"$SEARCH_NAME\" not found"
exit 1

View File

@ -0,0 +1,93 @@
#!/bin/zsh
set -e
BAZEL="$(which bazel)"
if [ "$BAZEL" = "" ]; then
echo "bazel not found in PATH"
exit 1
fi
EXPECTED_VARIABLES=(\
BUILD_NUMBER \
APP_VERSION \
BUNDLE_ID \
API_ID \
API_HASH \
APP_CENTER_ID \
IS_INTERNAL_BUILD \
IS_APPSTORE_BUILD \
APPSTORE_ID \
APP_SPECIFIC_URL_SCHEME \
)
MISSING_VARIABLES="0"
for VARIABLE_NAME in ${EXPECTED_VARIABLES[@]}; do
if [ "${!VARIABLE_NAME}" = "" ]; then
echo "$VARIABLE_NAME not defined"
MISSING_VARIABLES="1"
fi
done
if [ "$MISSING_VARIABLES" == "1" ]; then
exit 1
fi
VARIABLES_DIRECTORY="build-input/data"
mkdir -p "$VARIABLES_DIRECTORY"
VARIABLES_PATH="$VARIABLES_DIRECTORY/variables.bzl"
rm -f "$VARIABLES_PATH"
GEN_DIRECTORY="build-input/gen/project"
rm -rf "$GEN_DIRECTORY"
mkdir -p "$GEN_DIRECTORY"
echo "telegram_build_number = \"$BUILD_NUMBER\"" >> "$VARIABLES_PATH"
echo "telegram_version = \"$APP_VERSION\"" >> "$VARIABLES_PATH"
echo "telegram_bundle_id = \"$BUNDLE_ID\"" >> "$VARIABLES_PATH"
echo "telegram_api_id = \"$API_ID\"" >> "$VARIABLES_PATH"
echo "telegram_api_hash = \"$API_HASH\"" >> "$VARIABLES_PATH"
echo "telegram_app_center_id = \"$APP_CENTER_ID\"" >> "$VARIABLES_PATH"
echo "telegram_is_internal_build = \"$IS_INTERNAL_BUILD\"" >> "$VARIABLES_PATH"
echo "telegram_is_appstore_build = \"$IS_APPSTORE_BUILD\"" >> "$VARIABLES_PATH"
echo "telegram_appstore_id = \"$APPSTORE_ID\"" >> "$VARIABLES_PATH"
echo "telegram_app_specific_url_scheme = \"$APP_SPECIFIC_URL_SCHEME\"" >> "$VARIABLES_PATH"
BAZEL_OPTIONS=(\
--features=swift.use_global_module_cache \
--spawn_strategy=standalone \
--strategy=SwiftCompile=standalone \
--define=telegram_build_number="$BUILD_NUMBER" \
--define=telegram_version="$APP_VERSION" \
--define=telegram_bundle_id="$BUNDLE_ID" \
--define=telegram_api_id="$API_ID" \
--define=telegram_api_hash="$API_HASH" \
--define=telegram_app_center_id="$APP_CENTER_ID" \
--define=telegram_is_internal_build="$IS_INTERNAL_BUILD" \
--define=telegram_is_appstore_build="$IS_APPSTORE_BUILD" \
--define=telegram_appstore_id="$APPSTORE_ID" \
--define=telegram_app_specific_url_scheme="$APP_SPECIFIC_URL_SCHEME" \
)
$HOME/Applications/Tulsi.app/Contents/MacOS/Tulsi -- \
--verbose \
--create-tulsiproj Telegram \
--workspaceroot ./ \
--bazel "$BAZEL" \
--outputfolder "$GEN_DIRECTORY" \
--target Telegram:Telegram \
--target Telegram:Main \
--target Telegram:Lib \
PATCH_OPTIONS="BazelBuildOptionsDebug BazelBuildOptionsRelease"
for NAME in $PATCH_OPTIONS; do
sed -i "" -e '1h;2,$H;$!d;g' -e 's/\("'"$NAME"'" : {\n[ ]*"p" : "$(inherited)\)/\1'" ${BAZEL_OPTIONS[*]}"'/' "$GEN_DIRECTORY/Telegram.tulsiproj/Configs/Telegram.tulsigen"
done
sed -i "" -e '1h;2,$H;$!d;g' -e 's/\("sourceFilters" : \[\n[ ]*\)"\.\/\.\.\."/\1"Telegram\/...", "submodules\/..."/' "$GEN_DIRECTORY/Telegram.tulsiproj/Configs/Telegram.tulsigen"
${HOME}/Applications/Tulsi.app/Contents/MacOS/Tulsi -- \
--verbose \
--genconfig "$GEN_DIRECTORY/Telegram.tulsiproj:Telegram" \
--bazel "$BAZEL" \
--outputfolder "$GEN_DIRECTORY" \

View File

@ -0,0 +1,51 @@
load("//build-system:defines.bzl",
"string_value",
)
def _info_plist_fragment(ctx):
output = ctx.outputs.out
found_keys = list()
template = ctx.attr.template
current_start = 0
for i in range(len(template)):
start_index = template.find("{", current_start)
if start_index == -1:
break
end_index = template.find("}", start_index + 1)
if end_index == -1:
fail("Could not find the matching '}' for the '{' at {}".format(start_index))
found_keys.append(template[start_index + 1:end_index])
current_start = end_index + 1
resolved_values = dict()
for key in found_keys:
value = ctx.var.get(key, None)
if value == None:
fail("Expected value for --define={} was not found".format(key))
resolved_values[key] = value
plist_string = """
<?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>
""" + template.format(**resolved_values) + """
</dict>
</plist>
"""
ctx.actions.write(
output = output,
content = plist_string,
)
info_plist_fragment = rule(
implementation = _info_plist_fragment,
attrs = {
"template": attr.string(mandatory = True),
},
outputs = {
"out": "%{name}.plist"
},
)

View File

@ -9,6 +9,7 @@ import TelegramPresentationData
import PasscodeUI
import TelegramUIPreferences
import ImageBlur
import FastBlur
import AppLockState
private func isLocked(passcodeSettings: PresentationPasscodeSettings, state: LockState, isApplicationActive: Bool) -> Bool {

View File

@ -1,12 +1,12 @@
load(
"@bazel_skylib//rules:common_settings.bzl",
"string_flag",
)
string_flag(
name = "apiId",
build_setting_default = "",
visibility = ["//visibility:public"],
"//build-input/data:variables.bzl",
"telegram_api_id",
"telegram_api_hash",
"telegram_app_center_id",
"telegram_is_internal_build",
"telegram_is_appstore_build",
"telegram_appstore_id",
"telegram_app_specific_url_scheme",
)
objc_library(
@ -17,13 +17,13 @@ objc_library(
"Sources/*.m",
]),
copts = [
'-DAPP_CONFIG_API_ID=0',
'-DAPP_CONFIG_API_HASH="1"',
'-DAPP_CONFIG_APP_CENTER_ID="1"',
'-DAPP_CONFIG_IS_INTERNAL_BUILD=false',
'-DAPP_CONFIG_IS_APPSTORE_BUILD=true',
'-DAPP_CONFIG_APPSTORE_ID=0',
'-DAPP_SPECIFIC_URL_SCHEME="1"',
"-DAPP_CONFIG_API_ID={}".format(telegram_api_id),
"-DAPP_CONFIG_API_HASH=\\\"{}\\\"".format(telegram_api_hash),
"-DAPP_CONFIG_APP_CENTER_ID=\\\"{}\\\"".format(telegram_app_center_id),
"-DAPP_CONFIG_IS_INTERNAL_BUILD={}".format(telegram_is_internal_build),
"-DAPP_CONFIG_IS_APPSTORE_BUILD={}".format(telegram_is_appstore_build),
"-DAPP_CONFIG_APPSTORE_ID={}".format(telegram_appstore_id),
"-DAPP_SPECIFIC_URL_SCHEME=\\\"{}\\\"".format(telegram_app_specific_url_scheme),
],
hdrs = glob([
"Sources/*.h",

View File

@ -0,0 +1,25 @@
objc_library(
name = "BuildConfigExtra",
enable_modules = True,
module_name = "BuildConfigExtra",
srcs = glob([
"Sources/**/*.m",
"Sources/**/*.h",
]),
hdrs = glob([
"PublicHeaders/**/*.h",
]),
includes = [
"PublicHeaders",
],
deps = [
"//submodules/PKCS:PKCS",
],
sdk_frameworks = [
"Foundation",
],
visibility = [
"//visibility:public",
],
)

View File

@ -1,4 +1,4 @@
#import "BuildConfigExtra.h"
#import <BuildConfigExtra/BuildConfigExtra.h>
#include <mach-o/arch.h>
#include <mach-o/loader.h>

View File

@ -4,7 +4,8 @@ objc_library(
enable_modules = True,
module_name = "Crc32",
srcs = glob([
"Sources/*.m",
"Sources/**/*.m",
"Sources/**/*.h",
]),
hdrs = glob([
"PublicHeaders/**/*.h",
@ -13,7 +14,7 @@ objc_library(
"PublicHeaders",
],
sdk_frameworks = [
"Foundation",
"Foundation",
],
visibility = [
"//visibility:public",

View File

@ -26,6 +26,8 @@ public class ImmediateTextNode: TextNode {
return .byTruncatingMiddle
case .end:
return .byTruncatingTail
@unknown default:
return .byTruncatingTail
}
} set(value) {
switch value {
@ -186,4 +188,4 @@ public class ASTextNode: ImmediateTextNode {
override public func calculateSizeThatFits(_ constrainedSize: CGSize) -> CGSize {
return self.updateLayout(constrainedSize)
}
}
}

View File

@ -132,7 +132,8 @@ public final class TextNodeLayout: NSObject {
fileprivate let truncationType: CTLineTruncationType
fileprivate let backgroundColor: UIColor?
fileprivate let constrainedSize: CGSize
fileprivate let alignment: NSTextAlignment
fileprivate let explicitAlignment: NSTextAlignment
fileprivate let resolvedAlignment: NSTextAlignment
fileprivate let lineSpacing: CGFloat
fileprivate let cutout: TextNodeCutout?
fileprivate let insets: UIEdgeInsets
@ -147,12 +148,13 @@ public final class TextNodeLayout: NSObject {
fileprivate let textStroke: (UIColor, CGFloat)?
public let hasRTL: Bool
fileprivate init(attributedString: NSAttributedString?, maximumNumberOfLines: Int, truncationType: CTLineTruncationType, constrainedSize: CGSize, alignment: NSTextAlignment, lineSpacing: CGFloat, cutout: TextNodeCutout?, insets: UIEdgeInsets, size: CGSize, rawTextSize: CGSize, truncated: Bool, firstLineOffset: CGFloat, lines: [TextNodeLine], blockQuotes: [TextNodeBlockQuote], backgroundColor: UIColor?, lineColor: UIColor?, textShadowColor: UIColor?, textStroke: (UIColor, CGFloat)?) {
fileprivate init(attributedString: NSAttributedString?, maximumNumberOfLines: Int, truncationType: CTLineTruncationType, constrainedSize: CGSize, explicitAlignment: NSTextAlignment, resolvedAlignment: NSTextAlignment, lineSpacing: CGFloat, cutout: TextNodeCutout?, insets: UIEdgeInsets, size: CGSize, rawTextSize: CGSize, truncated: Bool, firstLineOffset: CGFloat, lines: [TextNodeLine], blockQuotes: [TextNodeBlockQuote], backgroundColor: UIColor?, lineColor: UIColor?, textShadowColor: UIColor?, textStroke: (UIColor, CGFloat)?) {
self.attributedString = attributedString
self.maximumNumberOfLines = maximumNumberOfLines
self.truncationType = truncationType
self.constrainedSize = constrainedSize
self.alignment = alignment
self.explicitAlignment = explicitAlignment
self.resolvedAlignment = resolvedAlignment
self.lineSpacing = lineSpacing
self.cutout = cutout
self.insets = insets
@ -240,7 +242,7 @@ public final class TextNodeLayout: NSObject {
for line in self.lines {
lineIndex += 1
var lineFrame = CGRect(origin: CGPoint(x: line.frame.origin.x, y: line.frame.origin.y - line.frame.size.height + self.firstLineOffset), size: line.frame.size)
switch self.alignment {
switch self.resolvedAlignment {
case .center:
lineFrame.origin.x = floor((self.size.width - lineFrame.size.width) / 2.0)
case .natural:
@ -308,7 +310,7 @@ public final class TextNodeLayout: NSObject {
for line in self.lines {
lineIndex += 1
var lineFrame = CGRect(origin: CGPoint(x: line.frame.origin.x, y: line.frame.origin.y - line.frame.size.height + self.firstLineOffset), size: line.frame.size)
switch self.alignment {
switch self.resolvedAlignment {
case .center:
lineFrame.origin.x = floor((self.size.width - lineFrame.size.width) / 2.0)
case .natural:
@ -383,7 +385,7 @@ public final class TextNodeLayout: NSObject {
for line in self.lines {
lineIndex += 1
var lineFrame = CGRect(origin: CGPoint(x: line.frame.origin.x, y: line.frame.origin.y - line.frame.size.height + self.firstLineOffset), size: line.frame.size)
switch self.alignment {
switch self.resolvedAlignment {
case .center:
lineFrame.origin.x = floor((self.size.width - lineFrame.size.width) / 2.0)
case .natural:
@ -823,17 +825,26 @@ public class TextNode: ASDisplayNode {
private class func calculateLayout(attributedString: NSAttributedString?, minimumNumberOfLines: Int, maximumNumberOfLines: Int, truncationType: CTLineTruncationType, backgroundColor: UIColor?, constrainedSize: CGSize, alignment: NSTextAlignment, lineSpacingFactor: CGFloat, cutout: TextNodeCutout?, insets: UIEdgeInsets, lineColor: UIColor?, textShadowColor: UIColor?, textStroke: (UIColor, CGFloat)?) -> TextNodeLayout {
if let attributedString = attributedString {
let stringLength = attributedString.length
let font: CTFont
let resolvedAlignment: NSTextAlignment
if stringLength != 0 {
if let stringFont = attributedString.attribute(NSAttributedString.Key.font, at: 0, effectiveRange: nil) {
font = stringFont as! CTFont
} else {
font = defaultFont
}
if let paragraphStyle = attributedString.attribute(NSAttributedString.Key.paragraphStyle, at: 0, effectiveRange: nil) as? NSParagraphStyle {
resolvedAlignment = paragraphStyle.alignment
} else {
resolvedAlignment = alignment
}
} else {
font = defaultFont
resolvedAlignment = alignment
}
let fontAscent = CTFontGetAscent(font)
@ -847,7 +858,7 @@ public class TextNode: ASDisplayNode {
var maybeTypesetter: CTTypesetter?
maybeTypesetter = CTTypesetterCreateWithAttributedString(attributedString as CFAttributedString)
if maybeTypesetter == nil {
return TextNodeLayout(attributedString: attributedString, maximumNumberOfLines: maximumNumberOfLines, truncationType: truncationType, constrainedSize: constrainedSize, alignment: alignment, lineSpacing: lineSpacingFactor, cutout: cutout, insets: insets, size: CGSize(), rawTextSize: CGSize(), truncated: false, firstLineOffset: 0.0, lines: [], blockQuotes: [], backgroundColor: backgroundColor, lineColor: lineColor, textShadowColor: textShadowColor, textStroke: textStroke)
return TextNodeLayout(attributedString: attributedString, maximumNumberOfLines: maximumNumberOfLines, truncationType: truncationType, constrainedSize: constrainedSize, explicitAlignment: alignment, resolvedAlignment: resolvedAlignment, lineSpacing: lineSpacingFactor, cutout: cutout, insets: insets, size: CGSize(), rawTextSize: CGSize(), truncated: false, firstLineOffset: 0.0, lines: [], blockQuotes: [], backgroundColor: backgroundColor, lineColor: lineColor, textShadowColor: textShadowColor, textStroke: textStroke)
}
let typesetter = maybeTypesetter!
@ -1056,9 +1067,9 @@ public class TextNode: ASDisplayNode {
}
}
return TextNodeLayout(attributedString: attributedString, maximumNumberOfLines: maximumNumberOfLines, truncationType: truncationType, constrainedSize: constrainedSize, alignment: alignment, lineSpacing: lineSpacingFactor, cutout: cutout, insets: insets, size: CGSize(width: ceil(layoutSize.width) + insets.left + insets.right, height: ceil(layoutSize.height) + insets.top + insets.bottom), rawTextSize: CGSize(width: ceil(rawLayoutSize.width) + insets.left + insets.right, height: ceil(rawLayoutSize.height) + insets.top + insets.bottom), truncated: truncated, firstLineOffset: firstLineOffset, lines: lines, blockQuotes: blockQuotes, backgroundColor: backgroundColor, lineColor: lineColor, textShadowColor: textShadowColor, textStroke: textStroke)
return TextNodeLayout(attributedString: attributedString, maximumNumberOfLines: maximumNumberOfLines, truncationType: truncationType, constrainedSize: constrainedSize, explicitAlignment: alignment, resolvedAlignment: resolvedAlignment, lineSpacing: lineSpacingFactor, cutout: cutout, insets: insets, size: CGSize(width: ceil(layoutSize.width) + insets.left + insets.right, height: ceil(layoutSize.height) + insets.top + insets.bottom), rawTextSize: CGSize(width: ceil(rawLayoutSize.width) + insets.left + insets.right, height: ceil(rawLayoutSize.height) + insets.top + insets.bottom), truncated: truncated, firstLineOffset: firstLineOffset, lines: lines, blockQuotes: blockQuotes, backgroundColor: backgroundColor, lineColor: lineColor, textShadowColor: textShadowColor, textStroke: textStroke)
} else {
return TextNodeLayout(attributedString: attributedString, maximumNumberOfLines: maximumNumberOfLines, truncationType: truncationType, constrainedSize: constrainedSize, alignment: alignment, lineSpacing: lineSpacingFactor, cutout: cutout, insets: insets, size: CGSize(), rawTextSize: CGSize(), truncated: false, firstLineOffset: 0.0, lines: [], blockQuotes: [], backgroundColor: backgroundColor, lineColor: lineColor, textShadowColor: textShadowColor, textStroke: textStroke)
return TextNodeLayout(attributedString: attributedString, maximumNumberOfLines: maximumNumberOfLines, truncationType: truncationType, constrainedSize: constrainedSize, explicitAlignment: alignment, resolvedAlignment: alignment, lineSpacing: lineSpacingFactor, cutout: cutout, insets: insets, size: CGSize(), rawTextSize: CGSize(), truncated: false, firstLineOffset: 0.0, lines: [], blockQuotes: [], backgroundColor: backgroundColor, lineColor: lineColor, textShadowColor: textShadowColor, textStroke: textStroke)
}
}
@ -1110,7 +1121,7 @@ public class TextNode: ASDisplayNode {
let textPosition = context.textPosition
context.textMatrix = CGAffineTransform(scaleX: 1.0, y: -1.0)
let alignment = layout.alignment
let alignment = layout.resolvedAlignment
let offset = CGPoint(x: layout.insets.left, y: layout.insets.top)
for i in 0 ..< layout.lines.count {
@ -1187,7 +1198,7 @@ public class TextNode: ASDisplayNode {
let layout: TextNodeLayout
var updated = false
if let existingLayout = existingLayout, existingLayout.constrainedSize == arguments.constrainedSize && existingLayout.maximumNumberOfLines == arguments.maximumNumberOfLines && existingLayout.truncationType == arguments.truncationType && existingLayout.cutout == arguments.cutout && existingLayout.alignment == arguments.alignment && existingLayout.lineSpacing.isEqual(to: arguments.lineSpacing) {
if let existingLayout = existingLayout, existingLayout.constrainedSize == arguments.constrainedSize && existingLayout.maximumNumberOfLines == arguments.maximumNumberOfLines && existingLayout.truncationType == arguments.truncationType && existingLayout.cutout == arguments.cutout && existingLayout.explicitAlignment == arguments.alignment && existingLayout.lineSpacing.isEqual(to: arguments.lineSpacing) {
let stringMatch: Bool
var colorMatch: Bool = true

View File

@ -0,0 +1,17 @@
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
swift_library(
name = "EncryptionKeyVisualization",
module_name = "EncryptionKeyVisualization",
srcs = glob([
"Sources/**/*.swift",
]),
deps = [
"//submodules/TelegramCore:TelegramCore",
"//submodules/SyncCore:SyncCore",
"//submodules/EncryptionKeyVisualization/Impl:EncryptionKeyVisualizationImpl",
],
visibility = [
"//visibility:public",
],
)

View File

@ -0,0 +1,22 @@
objc_library(
name = "EncryptionKeyVisualizationImpl",
enable_modules = True,
module_name = "EncryptionKeyVisualizationImpl",
srcs = glob([
"Sources/**/*.m",
"Sources/**/*.h",
]),
hdrs = glob([
"PublicHeaders/**/*.h",
]),
includes = [
"PublicHeaders",
],
sdk_frameworks = [
"Foundation",
],
visibility = [
"//visibility:public",
],
)

View File

@ -0,0 +1,5 @@
#import <UIKit/UIKit.h>
#import <EncryptionKeyVisualizationImpl/SecretChatKeyVisualization.h>

View File

@ -1,4 +1,4 @@
#import "SecretChatKeyVisualization.h"
#import <EncryptionKeyVisualizationImpl/SecretChatKeyVisualization.h>
#import <objc/runtime.h>

View File

@ -1,11 +0,0 @@
#import <UIKit/UIKit.h>
//! Project version number for EncryptionKeyVisualization.
FOUNDATION_EXPORT double EncryptionKeyVisualizationVersionNumber;
//! Project version string for EncryptionKeyVisualization.
FOUNDATION_EXPORT const unsigned char EncryptionKeyVisualizationVersionString[];
#import <EncryptionKeyVisualization/SecretChatKeyVisualization.h>

View File

@ -1,6 +1,8 @@
import Foundation
import UIKit
import TelegramCore
import SyncCore
import EncryptionKeyVisualizationImpl
public func secretChatKeyImage(_ fingerprint: SecretChatKeyFingerprint, size: CGSize) -> UIImage? {
let keySignatureData = fingerprint.sha1.data()

View File

@ -7,10 +7,10 @@ swift_library(
"Sources/**/*.swift",
]),
deps = [
"//submodules/TelegramCore:TelegramCore#shared",
"//submodules/SyncCore:SyncCore#shared",
"//submodules/Postbox:Postbox#shared",
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#shared",
"//submodules/TelegramCore:TelegramCore",
"//submodules/SyncCore:SyncCore",
"//submodules/Postbox:Postbox",
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/TelegramUIPreferences:TelegramUIPreferences",
"//submodules/PersistentStringHash:PersistentStringHash",
],

View File

@ -0,0 +1,23 @@
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
swift_library(
name = "LegacyDataImport",
module_name = "LegacyDataImport",
srcs = glob([
"Sources/**/*.swift",
]),
deps = [
"//submodules/TelegramCore:TelegramCore",
"//submodules/SyncCore:SyncCore",
"//submodules/Postbox:Postbox",
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/TelegramNotices:TelegramNotices",
"//submodules/TelegramUIPreferences:TelegramUIPreferences",
"//submodules/RadialStatusNode:RadialStatusNode",
"//submodules/LegacyComponents:LegacyComponents",
"//submodules/LegacyDataImport/Impl:LegacyDataImportImpl",
],
visibility = [
"//visibility:public",
],
)

View File

@ -0,0 +1,22 @@
objc_library(
name = "LegacyDataImportImpl",
enable_modules = True,
module_name = "LegacyDataImportImpl",
srcs = glob([
"Sources/**/*.m",
"Sources/**/*.h",
]),
hdrs = glob([
"PublicHeaders/**/*.h",
]),
includes = [
"PublicHeaders",
],
sdk_frameworks = [
"Foundation",
],
visibility = [
"//visibility:public",
],
)

View File

@ -0,0 +1,7 @@
#import <UIKit/UIKit.h>
#import <LegacyDataImportImpl/TGProxyItem.h>
#import <LegacyDataImportImpl/TGAutoDownloadPreferences.h>
#import <LegacyDataImportImpl/TGPresentationAutoNightPreferences.h>

View File

@ -1,4 +1,4 @@
#import "TGAutoDownloadPreferences.h"
#import <LegacyDataImportImpl/TGAutoDownloadPreferences.h>
@implementation TGAutoDownloadPreferences

View File

@ -1,4 +1,4 @@
#import "TGPresentationAutoNightPreferences.h"
#import <LegacyDataImportImpl/TGPresentationAutoNightPreferences.h>
@implementation TGPresentationAutoNightPreferences

View File

@ -1,4 +1,4 @@
#import "TGProxyItem.h"
#import <LegacyDataImportImpl/TGProxyItem.h>
static bool TGObjectCompare(id obj1, id obj2) {
if (obj1 == nil && obj2 == nil)

View File

@ -0,0 +1,250 @@
#import <LegacyDataImportImpl/TGAutoDownloadPreferences.h>
@implementation TGAutoDownloadPreferences
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
self = [super init];
if (self != nil)
{
_disabled = [aDecoder decodeBoolForKey:@"disabled"];
_photos = [aDecoder decodeInt32ForKey:@"photos"];
_videos = [aDecoder decodeInt32ForKey:@"videos"];
_maximumVideoSize = [aDecoder decodeInt32ForKey:@"maxVideoSize"];
_documents = [aDecoder decodeInt32ForKey:@"documents"];
_maximumDocumentSize = [aDecoder decodeInt32ForKey:@"maxDocumentSize"];
_voiceMessages = [aDecoder decodeInt32ForKey:@"voiceMessages"];
_videoMessages = [aDecoder decodeInt32ForKey:@"videoMessages"];
}
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeBool:_disabled forKey:@"disabled"];
[aCoder encodeInt32:_photos forKey:@"photos"];
[aCoder encodeInt32:_videos forKey:@"videos"];
[aCoder encodeInt32:_maximumVideoSize forKey:@"maxVideoSize"];
[aCoder encodeInt32:_documents forKey:@"documents"];
[aCoder encodeInt32:_maximumDocumentSize forKey:@"maxDocumentSize"];
[aCoder encodeInt32:_voiceMessages forKey:@"voiceMessages"];
[aCoder encodeInt32:_videoMessages forKey:@"videoMessages"];
}
+ (instancetype)defaultPreferences
{
TGAutoDownloadPreferences *preferences = [[TGAutoDownloadPreferences alloc] init];
preferences->_photos = TGAutoDownloadModeAll;
preferences->_videos = TGAutoDownloadModeNone;
preferences->_maximumVideoSize = 10;
preferences->_documents = TGAutoDownloadModeNone;
preferences->_maximumDocumentSize = 10;
preferences->_voiceMessages = TGAutoDownloadModeAll;
preferences->_videoMessages = TGAutoDownloadModeAll;
return preferences;
}
+ (instancetype)preferencesWithLegacyDownloadPrivatePhotos:(bool)privatePhotos groupPhotos:(bool)groupPhotos privateVoiceMessages:(bool)privateVoiceMessages groupVoiceMessages:(bool)groupVoiceMessages privateVideoMessages:(bool)privateVideoMessages groupVideoMessages:(bool)groupVideoMessages
{
TGAutoDownloadPreferences *preferences = [[TGAutoDownloadPreferences alloc] init];
if (privatePhotos)
preferences->_photos |= TGAutoDownloadModeAllPrivateChats;
if (groupPhotos)
preferences->_photos |= TGAutoDownloadModeAllGroups;
if (privateVoiceMessages)
preferences->_voiceMessages |= TGAutoDownloadModeAllPrivateChats;
if (groupVoiceMessages)
preferences->_voiceMessages |= TGAutoDownloadModeAllGroups;
if (privateVideoMessages)
preferences->_videoMessages |= TGAutoDownloadModeAllPrivateChats;
if (groupVideoMessages)
preferences->_videoMessages |= TGAutoDownloadModeAllGroups;
preferences->_maximumVideoSize = 10;
preferences->_maximumDocumentSize = 10;
return preferences;
}
- (instancetype)updateDisabled:(bool)disabled
{
TGAutoDownloadPreferences *preferences = [[TGAutoDownloadPreferences alloc] init];
preferences->_disabled = disabled;
preferences->_photos = _photos;
preferences->_videos = _videos;
preferences->_maximumVideoSize = _maximumVideoSize;
preferences->_documents = _documents;
preferences->_maximumDocumentSize = _maximumDocumentSize;
preferences->_voiceMessages = _voiceMessages;
preferences->_videoMessages = _videoMessages;
return preferences;
}
- (instancetype)updatePhotosMode:(TGAutoDownloadMode)mode
{
TGAutoDownloadPreferences *preferences = [[TGAutoDownloadPreferences alloc] init];
preferences->_photos = mode;
preferences->_videos = _videos;
preferences->_maximumVideoSize = _maximumVideoSize;
preferences->_documents = _documents;
preferences->_maximumDocumentSize = _maximumDocumentSize;
preferences->_voiceMessages = _voiceMessages;
preferences->_videoMessages = _videoMessages;
return preferences;
}
- (instancetype)updateVideosMode:(TGAutoDownloadMode)mode maximumSize:(int32_t)maximumSize
{
TGAutoDownloadPreferences *preferences = [[TGAutoDownloadPreferences alloc] init];
preferences->_photos = _photos;
preferences->_videos = mode;
preferences->_maximumVideoSize = maximumSize;
preferences->_documents = _documents;
preferences->_maximumDocumentSize = _maximumDocumentSize;
preferences->_voiceMessages = _voiceMessages;
preferences->_videoMessages = _videoMessages;
return preferences;
}
- (instancetype)updateDocumentsMode:(TGAutoDownloadMode)mode maximumSize:(int32_t)maximumSize
{
TGAutoDownloadPreferences *preferences = [[TGAutoDownloadPreferences alloc] init];
preferences->_photos = _photos;
preferences->_videos = _videos;
preferences->_maximumVideoSize = _maximumVideoSize;
preferences->_documents = mode;
preferences->_maximumDocumentSize = maximumSize;
preferences->_voiceMessages = _voiceMessages;
preferences->_videoMessages = _videoMessages;
return preferences;
}
- (instancetype)updateVoiceMessagesMode:(TGAutoDownloadMode)mode
{
TGAutoDownloadPreferences *preferences = [[TGAutoDownloadPreferences alloc] init];
preferences->_photos = _photos;
preferences->_videos = _videos;
preferences->_maximumVideoSize = _maximumVideoSize;
preferences->_documents = _documents;
preferences->_maximumDocumentSize = _maximumDocumentSize;
preferences->_voiceMessages = mode;
preferences->_videoMessages = _videoMessages;
return preferences;
}
- (instancetype)updateVideoMessagesMode:(TGAutoDownloadMode)mode
{
TGAutoDownloadPreferences *preferences = [[TGAutoDownloadPreferences alloc] init];
preferences->_photos = _photos;
preferences->_videos = _videos;
preferences->_maximumVideoSize = _maximumVideoSize;
preferences->_documents = _documents;
preferences->_maximumDocumentSize = _maximumDocumentSize;
preferences->_voiceMessages = _voiceMessages;
preferences->_videoMessages = mode;
return preferences;
}
+ (bool)shouldDownload:(TGAutoDownloadMode)mode inChat:(TGAutoDownloadChat)chat networkType:(TGNetworkType)networkType
{
bool isWiFi = networkType == TGNetworkTypeWiFi;
bool isCellular = !isWiFi && networkType != TGNetworkTypeNone;
bool shouldDownload = false;
switch (chat)
{
case TGAutoDownloadChatContact:
if (isCellular)
shouldDownload = (mode & TGAutoDownloadModeCellularContacts) != 0;
else if (isWiFi)
shouldDownload = (mode & TGAutoDownloadModeWifiContacts) != 0;
break;
case TGAutoDownloadChatOtherPrivateChat:
if (isCellular)
shouldDownload = (mode & TGAutoDownloadModeCellularPrivateChats) != 0;
else if (isWiFi)
shouldDownload = (mode & TGAutoDownloadModeWifiPrivateChats) != 0;
break;
case TGAutoDownloadChatGroup:
if (isCellular)
shouldDownload = (mode & TGAutoDownloadModeCellularGroups) != 0;
else if (isWiFi)
shouldDownload = (mode & TGAutoDownloadModeWifiGroups) != 0;
break;
case TGAutoDownloadChatChannel:
if (isCellular)
shouldDownload = (mode & TGAutoDownloadModeCellularChannels) != 0;
else if (isWiFi)
shouldDownload = (mode & TGAutoDownloadModeWifiChannels) != 0;
break;
default:
break;
}
return shouldDownload;
}
- (bool)shouldDownloadPhotoInChat:(TGAutoDownloadChat)chat networkType:(TGNetworkType)networkType
{
if (self.disabled)
return false;
return [TGAutoDownloadPreferences shouldDownload:_photos inChat:chat networkType:networkType];
}
- (bool)shouldDownloadVideoInChat:(TGAutoDownloadChat)chat networkType:(TGNetworkType)networkType
{
if (self.disabled)
return false;
return [TGAutoDownloadPreferences shouldDownload:_videos inChat:chat networkType:networkType];
}
- (bool)shouldDownloadDocumentInChat:(TGAutoDownloadChat)chat networkType:(TGNetworkType)networkType
{
if (self.disabled)
return false;
return [TGAutoDownloadPreferences shouldDownload:_documents inChat:chat networkType:networkType];
}
- (bool)shouldDownloadVoiceMessageInChat:(TGAutoDownloadChat)chat networkType:(TGNetworkType)networkType
{
if (self.disabled)
return false;
return [TGAutoDownloadPreferences shouldDownload:_voiceMessages inChat:chat networkType:networkType];
}
- (bool)shouldDownloadVideoMessageInChat:(TGAutoDownloadChat)chat networkType:(TGNetworkType)networkType
{
if (self.disabled)
return false;
return [TGAutoDownloadPreferences shouldDownload:_videoMessages inChat:chat networkType:networkType];
}
- (bool)isDefaultPreferences
{
return [self isEqual:[TGAutoDownloadPreferences defaultPreferences]];
}
- (BOOL)isEqual:(id)object
{
if (object == self)
return YES;
if (!object || ![object isKindOfClass:[self class]])
return NO;
TGAutoDownloadPreferences *preferences = (TGAutoDownloadPreferences *)object;
return preferences.photos == _photos && preferences.videos == _videos && preferences.documents == _documents && preferences.voiceMessages == _voiceMessages && preferences.videoMessages == _videoMessages && preferences.maximumVideoSize == _maximumVideoSize && preferences.maximumDocumentSize == _maximumDocumentSize && preferences.disabled == _disabled;
}
@end

View File

@ -0,0 +1,23 @@
#import <LegacyDataImportImpl/TGPresentationAutoNightPreferences.h>
@implementation TGPresentationAutoNightPreferences
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
self = [super init];
if (self != nil) {
_mode = [aDecoder decodeInt32ForKey:@"m"];
_brightnessThreshold = [aDecoder decodeDoubleForKey:@"b"];
_scheduleStart = [aDecoder decodeInt32ForKey:@"ss"];
_scheduleEnd = [aDecoder decodeInt32ForKey:@"se"];
_latitude = [aDecoder decodeDoubleForKey:@"lat"];
_longitude = [aDecoder decodeDoubleForKey:@"lon"];
_cachedLocationName = [aDecoder decodeObjectForKey:@"loc"];
_preferredPalette = [aDecoder decodeInt32ForKey:@"p"];
}
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder {
}
@end

View File

@ -0,0 +1,73 @@
#import <LegacyDataImportImpl/TGProxyItem.h>
static bool TGObjectCompare(id obj1, id obj2) {
if (obj1 == nil && obj2 == nil)
return true;
return [obj1 isEqual:obj2];
}
@implementation TGProxyItem
- (instancetype)initWithServer:(NSString *)server port:(int16_t)port username:(NSString *)username password:(NSString *)password secret:(NSString *)secret
{
self = [super init];
if (self != nil)
{
_server = server;
_port = port;
_username = username;
_password = password;
_secret = secret;
}
return self;
}
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
return [self initWithServer:[aDecoder decodeObjectForKey:@"server"] port:(int16_t)[aDecoder decodeInt32ForKey:@"port"] username:[aDecoder decodeObjectForKey:@"user"] password:[aDecoder decodeObjectForKey:@"pass"] secret:[aDecoder decodeObjectForKey:@"secret"]];
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_server forKey:@"server"];
[aCoder encodeInt32:_port forKey:@"port"];
[aCoder encodeObject:_username forKey:@"user"];
[aCoder encodeObject:_password forKey:@"pass"];
[aCoder encodeObject:_secret forKey:@"secret"];
}
- (bool)isMTProxy
{
return _secret.length > 0;
}
- (BOOL)isEqual:(id)object
{
if (object == self)
return true;
if (!object || ![object isKindOfClass:[self class]])
return false;
TGProxyItem *proxy = (TGProxyItem *)object;
if (![_server isEqualToString:proxy.server])
return false;
if (_port != proxy.port)
return false;
if (!TGObjectCompare(_username ?: @"", proxy.username ?: @""))
return false;
if (!TGObjectCompare(_password ?: @"", proxy.password ?: @""))
return false;
if (!TGObjectCompare(_secret ?: @"", proxy.secret ?: @""))
return false;
return true;
}
@end

View File

@ -1,22 +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>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
</dict>
</plist>

View File

@ -1,13 +0,0 @@
#import <UIKit/UIKit.h>
//! Project version number for LegacyDataImport.
FOUNDATION_EXPORT double LegacyDataImportVersionNumber;
//! Project version string for LegacyDataImport.
FOUNDATION_EXPORT const unsigned char LegacyDataImportVersionString[];
#import <LegacyDataImport/TGProxyItem.h>
#import <LegacyDataImport/TGAutoDownloadPreferences.h>
#import <LegacyDataImport/TGPresentationAutoNightPreferences.h>

View File

@ -4,11 +4,8 @@ import TelegramCore
import SyncCore
import SwiftSignalKit
import Postbox
#if BUCK
import MtProtoKit
#else
import MtProtoKitDynamic
#endif
import LegacyDataImportImpl
public enum AccountImportError: Error {
case generic

View File

@ -4,14 +4,11 @@ import TelegramCore
import SyncCore
import SwiftSignalKit
import Postbox
#if BUCK
import MtProtoKit
#else
import MtProtoKitDynamic
#endif
import TelegramUIPreferences
import LegacyComponents
import TelegramNotices
import LegacyDataImportImpl
@objc(TGPresentationState) private final class TGPresentationState: NSObject, NSCoding {
let pallete: Int32

View File

@ -0,0 +1,29 @@
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
swift_library(
name = "LegacyMediaPickerUI",
module_name = "LegacyMediaPickerUI",
srcs = glob([
"Sources/**/*.swift",
]),
deps = [
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
"//submodules/Display:Display",
"//submodules/Postbox:Postbox",
"//submodules/TelegramCore:TelegramCore",
"//submodules/SyncCore:SyncCore",
"//submodules/TelegramPresentationData:TelegramPresentationData",
"//submodules/AccountContext:AccountContext",
"//submodules/LegacyComponents:LegacyComponents",
"//submodules/LegacyUI:LegacyUI",
"//submodules/MimeTypes:MimeTypes",
"//submodules/LocalMediaResources:LocalMediaResources",
"//submodules/SearchPeerMembers:SearchPeerMembers",
"//submodules/SaveToCameraRoll:SaveToCameraRoll",
"//submodules/LegacyMediaPickerUI/LegacyImageProcessors:LegacyImageProcessors",
],
visibility = [
"//visibility:public",
],
)

View File

@ -1,22 +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>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
</dict>
</plist>

View File

@ -0,0 +1,26 @@
objc_library(
name = "LegacyImageProcessors",
enable_modules = True,
module_name = "LegacyImageProcessors",
srcs = glob([
"Sources/**/*.m",
"Sources/**/*.h",
]),
hdrs = glob([
"PublicHeaders/**/*.h",
]),
includes = [
"PublicHeaders",
],
deps = [
"//submodules/LegacyComponents:LegacyComponents",
],
sdk_frameworks = [
"Foundation",
"UIKit",
],
visibility = [
"//visibility:public",
],
)

View File

@ -1,4 +1,4 @@
#import "LegacyImageProcessors.h"
#import <LegacyImageProcessors/LegacyImageProcessors.h>
#import <LegacyComponents/LegacyComponents.h>

View File

@ -1,19 +0,0 @@
//
// LegacyMediaPickerUI.h
// LegacyMediaPickerUI
//
// Created by Peter on 8/15/19.
// Copyright © 2019 Telegram Messenger LLP. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for LegacyMediaPickerUI.
FOUNDATION_EXPORT double LegacyMediaPickerUIVersionNumber;
//! Project version string for LegacyMediaPickerUI.
FOUNDATION_EXPORT const unsigned char LegacyMediaPickerUIVersionString[];
#import <LegacyMediaPickerUI/LegacyImageProcessors.h>

25
submodules/LegacyUI/BUILD Normal file
View File

@ -0,0 +1,25 @@
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
swift_library(
name = "LegacyUI",
module_name = "LegacyUI",
srcs = glob([
"Sources/**/*.swift",
]),
deps = [
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/Postbox:Postbox",
"//submodules/TelegramCore:TelegramCore",
"//submodules/SyncCore:SyncCore",
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
"//submodules/Display:Display",
"//submodules/AccountContext:AccountContext",
"//submodules/TelegramAudio:TelegramAudio",
"//submodules/DeviceAccess:DeviceAccess",
"//submodules/LegacyComponents:LegacyComponents",
"//submodules/StickerResources:StickerResources",
],
visibility = [
"//visibility:public",
],
)

View File

@ -1,22 +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>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
</dict>
</plist>

View File

@ -1,9 +1,5 @@
import Foundation
#if BUCK
import MtProtoKit
#else
import MtProtoKitDynamic
#endif
import LegacyComponents

View File

@ -1,19 +0,0 @@
//
// LegacyUI.h
// LegacyUI
//
// Created by Peter on 8/12/19.
// Copyright © 2019 Telegram Messenger LLP. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for LegacyUI.
FOUNDATION_EXPORT double LegacyUIVersionNumber;
//! Project version string for LegacyUI.
FOUNDATION_EXPORT const unsigned char LegacyUIVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <LegacyUI/PublicHeader.h>

View File

@ -3,11 +3,7 @@ import UIKit
import TelegramCore
import SyncCore
import SwiftSignalKit
#if BUCK
import MtProtoKit
#else
import MtProtoKitDynamic
#endif
import Display
import TelegramPresentationData
import DeviceAccess

View File

@ -1,11 +0,0 @@
#import <UIKit/UIKit.h>
//! Project version number for MimeTypes.
FOUNDATION_EXPORT double MimeTypesVersionNumber;
//! Project version string for MimeTypes.
FOUNDATION_EXPORT const unsigned char MimeTypesVersionString[];
#import <MimeTypes/TGMimeTypeMap.h>

View File

@ -0,0 +1,5 @@
#import <UIKit/UIKit.h>
#import <MimeTypes/TGMimeTypeMap.h>

View File

@ -0,0 +1,60 @@
#import <Foundation/Foundation.h>
#import <MtProtoKit/MTDatacenterAuthInfo.h>
#import <MtProtoKit/AFHTTPRequestOperation.h>
#import <MtProtoKit/AFURLConnectionOperation.h>
#import <MtProtoKit/MTApiEnvironment.h>
#import <MtProtoKit/MTAtomic.h>
#import <MtProtoKit/MTBackupAddressSignals.h>
#import <MtProtoKit/MTBag.h>
#import <MtProtoKit/MTContext.h>
#import <MtProtoKit/MTDatacenterAddress.h>
#import <MtProtoKit/MTDatacenterAddressListData.h>
#import <MtProtoKit/MTDatacenterAddressSet.h>
#import <MtProtoKit/MTDatacenterAuthAction.h>
#import <MtProtoKit/MTDatacenterAuthMessageService.h>
#import <MtProtoKit/MTDatacenterSaltInfo.h>
#import <MtProtoKit/MTDatacenterTransferAuthAction.h>
#import <MtProtoKit/MTDatacenterVerificationData.h>
#import <MtProtoKit/MTDisposable.h>
#import <MtProtoKit/MTDropResponseContext.h>
#import <MtProtoKit/MTEncryption.h>
#import <MtProtoKit/MTExportedAuthorizationData.h>
#import <MtProtoKit/MTFileBasedKeychain.h>
#import <MtProtoKit/MTGzip.h>
#import <MtProtoKit/MTHttpRequestOperation.h>
#import <MtProtoKit/MTIncomingMessage.h>
#import <MtProtoKit/MTInputStream.h>
#import <MtProtoKit/MTInternalId.h>
#import <MtProtoKit/MTKeychain.h>
#import <MtProtoKit/MTLogging.h>
#import <MtProtoKit/MTMessageEncryptionKey.h>
#import <MtProtoKit/MTMessageService.h>
#import <MtProtoKit/MTMessageTransaction.h>
#import <MtProtoKit/MTNetworkAvailability.h>
#import <MtProtoKit/MTNetworkUsageCalculationInfo.h>
#import <MtProtoKit/MTNetworkUsageManager.h>
#import <MtProtoKit/MTOutgoingMessage.h>
#import <MtProtoKit/MTOutputStream.h>
#import <MtProtoKit/MTPreparedMessage.h>
#import <MtProtoKit/MTProto.h>
#import <MtProtoKit/MTProxyConnectivity.h>
#import <MtProtoKit/MTQueue.h>
#import <MtProtoKit/MTRequest.h>
#import <MtProtoKit/MTRequestContext.h>
#import <MtProtoKit/MTRequestErrorContext.h>
#import <MtProtoKit/MTRequestMessageService.h>
#import <MtProtoKit/MTResendMessageService.h>
#import <MtProtoKit/MTRpcError.h>
#import <MtProtoKit/MTSerialization.h>
#import <MtProtoKit/MTSessionInfo.h>
#import <MtProtoKit/MTSignal.h>
#import <MtProtoKit/MTSubscriber.h>
#import <MtProtoKit/MTTcpTransport.h>
#import <MtProtoKit/MTTime.h>
#import <MtProtoKit/MTTimeFixContext.h>
#import <MtProtoKit/MTTimer.h>
#import <MtProtoKit/MTTimeSyncMessageService.h>
#import <MtProtoKit/MTTransport.h>
#import <MtProtoKit/MTTransportScheme.h>
#import <MtProtoKit/MTTransportTransaction.h>

View File

@ -162,7 +162,7 @@ void MyAesIgeDecrypt(const void *inBytes, int length, void *outBytes, const void
}
void MyAesCbcDecrypt(const void *inBytes, int length, void *outBytes, const void *key, int keyLength, void *iv) {
int outLength = 0;
size_t outLength = 0;
CCCryptorStatus status = CCCrypt(kCCDecrypt, kCCAlgorithmAES128, 0, key, keyLength, iv, inBytes, length, outBytes, length, &outLength);
assert(status == kCCSuccess);
assert(outLength == length);

View File

@ -769,7 +769,7 @@ static NSData *decrypt_TL_data(id<EncryptionProvider> provider, unsigned char bu
if ([context modExpInto:y a:x b:rsaKeyE mod:rsaKeyN]) {
NSData *yBytes = [context getBin:y];
unsigned l = 256 - (unsigned)yBytes.length;
memset(bytes, 0, l);
assert(l >= 0);
[yBytes getBytes:bytes + l length:256 - l];
@ -781,7 +781,7 @@ static NSData *decrypt_TL_data(id<EncryptionProvider> provider, unsigned char bu
NSData *keyBytes = [[NSData alloc] initWithBytes:bytes length:32];
NSMutableData *decryptedBytes = [[NSMutableData alloc] initWithLength:encryptedBytes.length];
MyAesCbcDecrypt(encryptedBytes.bytes, encryptedBytes.length, decryptedBytes.mutableBytes, keyBytes.bytes, keyBytes.length, iv.mutableBytes);
MyAesCbcDecrypt(encryptedBytes.bytes, (int)encryptedBytes.length, decryptedBytes.mutableBytes, keyBytes.bytes, (int)keyBytes.length, iv.mutableBytes);
if (decryptedBytes == nil) {
return nil;

View File

@ -1,14 +1,26 @@
objc_library(
name = "OpenSSLEncryptionProvider",
enable_modules = True,
module_name = "OpenSSLEncryptionProvider",
srcs = glob([
"Sources/**/*.m",
]),
hdrs = glob([
"Sources/**/*.h",
]),
hdrs = glob([
"PublicHeaders/**/*.h",
]),
includes = [
"PublicHeaders",
],
deps = [
"//submodules/EncryptionProvider:EncryptionProvider",
"//submodules/openssl:openssl",
],
visibility = ["//visibility:public"],
sdk_frameworks = [
"Foundation",
],
visibility = [
"//visibility:public",
],
)

View File

@ -1,4 +1,4 @@
#import "OpenSSLEncryptionProvider.h"
#import <OpenSSLEncryptionProvider/OpenSSLEncryptionProvider.h>
#import <openssl/bn.h>
#import <openssl/rsa.h>

31
submodules/OpusBinding/BUILD vendored Normal file
View File

@ -0,0 +1,31 @@
objc_library(
name = "OpusBinding",
enable_modules = True,
module_name = "OpusBinding",
srcs = glob([
"Sources/**/*.m",
"Sources/**/*.c",
"Sources/**/*.h",
]),
hdrs = glob([
"PublicHeaders/**/*.h",
]),
includes = [
"PublicHeaders",
],
copts = [
"-Isubmodules/OpusBinding/Sources",
"-Isubmodules/OpusBinding/Sources/opusfile",
"-Isubmodules/OpusBinding/PublicHeaders/OpusBinding",
],
deps = [
"//submodules/Opus:opus",
],
sdk_frameworks = [
"Foundation",
],
visibility = [
"//visibility:public",
],
)

View File

@ -0,0 +1,5 @@
#import <Foundation/Foundation.h>
#import <OpusBinding/OggOpusReader.h>
#import <OpusBinding/TGDataItem.h>
#import <OpusBinding/TGOggOpusWriter.h>

Some files were not shown because too many files have changed in this diff Show More