Skip to content

Commit ecb1711

Browse files
committed
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
2 parents 1f43a83 + b9aa229 commit ecb1711

File tree

89 files changed

+5738
-4008
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+5738
-4008
lines changed

.cursorignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
# Add directories or file patterns to ignore during indexing (e.g. foo/ or *.csv)
2+
spm-files

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,4 @@ buildServer.json
7373
.build/**
7474
Telegram.LSP.json
7575
**/.build/**
76+
spm-files

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@
1111
},
1212
"search.exclude": {
1313
".git/**": true
14+
},
15+
"files.associations": {
16+
"memory": "cpp"
1417
}
1518
}

Telegram/BUILD

Lines changed: 44 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ load("@build_bazel_rules_apple//apple:resources.bzl",
5555
"swift_intent_library",
5656
)
5757

58+
load("//build-system/bazel-utils:spm.bzl",
59+
"generate_spm",
60+
)
61+
5862
config_setting(
5963
name = "debug",
6064
values = {
@@ -952,29 +956,6 @@ plist_fragment(
952956
)
953957
)
954958

955-
ios_framework(
956-
name = "TelegramApiFramework",
957-
bundle_id = "{telegram_bundle_id}.TelegramApi".format(
958-
telegram_bundle_id = telegram_bundle_id,
959-
),
960-
families = [
961-
"iphone",
962-
"ipad",
963-
],
964-
infoplists = [
965-
":TelegramApiInfoPlist",
966-
":BuildNumberInfoPlist",
967-
":VersionInfoPlist",
968-
":RequiredDeviceCapabilitiesPlist",
969-
],
970-
minimum_os_version = minimum_os_version,
971-
extension_safe = True,
972-
ipa_post_processor = strip_framework,
973-
deps = [
974-
"//submodules/TelegramApi:TelegramApi",
975-
],
976-
)
977-
978959
plist_fragment(
979960
name = "TelegramCoreInfoPlist",
980961
extension = "plist",
@@ -2022,7 +2003,45 @@ xcodeproj(
20222003
default_xcode_configuration = "Debug"
20232004
)
20242005

2025-
# Temporary targets used to simplify webrtc build tests
2006+
# Temporary targets used to simplify build tests
2007+
2008+
ios_application(
2009+
name = "spm_build_app",
2010+
bundle_id = "{telegram_bundle_id}".format(
2011+
telegram_bundle_id = telegram_bundle_id,
2012+
),
2013+
families = ["iphone", "ipad"],
2014+
minimum_os_version = minimum_os_version,
2015+
provisioning_profile = select({
2016+
":disableProvisioningProfilesSetting": None,
2017+
"//conditions:default": "@build_configuration//provisioning:Telegram.mobileprovision",
2018+
}),
2019+
entitlements = ":TelegramEntitlements.entitlements",
2020+
infoplists = [
2021+
":TelegramInfoPlist",
2022+
":BuildNumberInfoPlist",
2023+
":VersionInfoPlist",
2024+
":RequiredDeviceCapabilitiesPlist",
2025+
":UrlTypesInfoPlist",
2026+
],
2027+
deps = [
2028+
#"//submodules/MtProtoKit",
2029+
#"//submodules/SSignalKit/SwiftSignalKit",
2030+
#"//submodules/Postbox",
2031+
#"//submodules/TelegramApi",
2032+
#"//submodules/TelegramCore",
2033+
#"//submodules/FFMpegBinding",
2034+
"//submodules/Display",
2035+
#"//third-party/webrtc",
2036+
],
2037+
)
2038+
2039+
generate_spm(
2040+
name = "spm_build_root",
2041+
deps = [
2042+
":spm_build_app",
2043+
]
2044+
)
20262045

20272046
ios_application(
20282047
name = "webrtc_build_test",
@@ -2044,7 +2063,7 @@ ios_application(
20442063
":UrlTypesInfoPlist",
20452064
],
20462065
deps = [
2047-
"//third-party/webrtc:webrtc_lib",
2066+
"//third-party/webrtc:webrtc",
20482067
],
20492068
)
20502069

Telegram/BroadcastUpload/BroadcastUploadExtension.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ private final class EmbeddedBroadcastUploadImpl: BroadcastUploadImpl {
336336
let logsPath = rootPath + "/logs/broadcast-logs"
337337
let _ = try? FileManager.default.createDirectory(atPath: logsPath, withIntermediateDirectories: true, attributes: nil)
338338

339-
let embeddedBroadcastImplementationTypePath = rootPath + "/broadcast-coordination-type"
339+
let embeddedBroadcastImplementationTypePath = rootPath + "/broadcast-coordination-type-v2"
340340

341341
var useIPCContext = false
342342
if let typeData = try? Data(contentsOf: URL(fileURLWithPath: embeddedBroadcastImplementationTypePath)), let type = String(data: typeData, encoding: .utf8) {

Telegram/Telegram-iOS/en.lproj/Localizable.strings

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14262,6 +14262,7 @@ Sorry for the inconvenience.";
1426214262

1426314263
"PeerInfo.Gifts.Sale" = "sale";
1426414264

14265+
"Gift.Store.ForResaleNoResults" = "no results";
1426514266
"Gift.Store.ForResale_1" = "%@ for resale";
1426614267
"Gift.Store.ForResale_any" = "%@ for resale";
1426714268
"Gift.Store.Sort.Price" = "Price";
@@ -14291,8 +14292,31 @@ Sorry for the inconvenience.";
1429114292
"MediaPicker.CreateStory_any" = "Create %@ Stories";
1429214293
"MediaPicker.CombineIntoCollage" = "Combine into Collage";
1429314294

14294-
"Gift.Resale.Unavailable.Title" = "Resell Gift";
14295-
"Gift.Resale.Unavailable.Text" = "Sorry, you can't list this gift yet.\n\Reselling will be available on %@.";
14295+
"Gift.Resale.Unavailable.Title" = "Try Later";
14296+
"Gift.Resale.Unavailable.Text" = "You will be able to resell this gift on %@.";
1429614297

14297-
"Gift.Transfer.Unavailable.Title" = "Transfer Gift";
14298-
"Gift.Transfer.Unavailable.Text" = "Sorry, you can't transfer this gift yet.\n\Transferring will be available on %@.";
14298+
"Gift.Transfer.Unavailable.Title" = "Try Later";
14299+
"Gift.Transfer.Unavailable.Text" = "You will be able to transfer this gift on %@.";
14300+
14301+
"Premium.CreateMultipleStories" = "Create Multiple Stories";
14302+
14303+
"FrozenAccount.Violation.TextNew" = "Your account was frozen for breaking Telegram's [Terms and Conditions]().";
14304+
"FrozenAccount.Violation.TextNew_URL" = "https://telegram.org/tos";
14305+
14306+
"Stars.Purchase.BuyStarGiftInfo" = "Buy Stars to acquire a unique collectible.";
14307+
14308+
"Stars.Purchase.EnoughStars" = "You have enough stars at the moment.";
14309+
"Stars.Purchase.BuyAnyway" = "Buy Anyway";
14310+
14311+
"Gift.Buy.Confirm.Title" = "Confirm Payment";
14312+
"Gift.Buy.Confirm.Text" = "Do you really want to buy **%1$@** for %2$@?";
14313+
"Gift.Buy.Confirm.GiftText" = "Do you really want to buy **%1$@** for %2$@ and gift it to **%3$@**?";
14314+
"Gift.Buy.Confirm.Text.Stars_1" = "**%@** Star";
14315+
"Gift.Buy.Confirm.Text.Stars_any" = "**%@** Stars";
14316+
"Gift.Buy.Confirm.BuyFor_1" = "Buy for %@ Star";
14317+
"Gift.Buy.Confirm.BuyFor_any" = "Buy for %@ Stars";
14318+
14319+
"Calls.HideCallsTab" = "Hide Calls Tab";
14320+
14321+
"Story.Editor.TooltipSelection_1" = "Tap here to view your %@ story";
14322+
"Story.Editor.TooltipSelection_any" = "Tap here to view your %@ stories";

Tests/CallUITest/Sources/ViewController.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ public final class ViewController: UIViewController {
3535
isRemoteAudioMuted: false,
3636
localVideo: nil,
3737
remoteVideo: nil,
38-
isRemoteBatteryLow: false
38+
isRemoteBatteryLow: false,
39+
enableVideoSharpening: false
3940
)
4041

4142
private var currentLayout: (size: CGSize, insets: UIEdgeInsets)?

build-system/Make/Make.py

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,58 @@ def invoke_query(self, query_args):
393393
print(subprocess.list2cmdline(combined_arguments))
394394
call_executable(combined_arguments)
395395

396+
def get_spm_aspect_invocation(self):
397+
combined_arguments = [
398+
self.build_environment.bazel_path
399+
]
400+
combined_arguments += self.get_startup_bazel_arguments()
401+
combined_arguments += ['build']
402+
403+
if self.custom_target is not None:
404+
combined_arguments += [self.custom_target]
405+
else:
406+
combined_arguments += ['Telegram/Telegram']
407+
408+
if self.continue_on_error:
409+
combined_arguments += ['--keep_going']
410+
if self.show_actions:
411+
combined_arguments += ['--subcommands']
412+
413+
if self.enable_sandbox:
414+
combined_arguments += ['--spawn_strategy=sandboxed']
415+
416+
if self.disable_provisioning_profiles:
417+
combined_arguments += ['--//Telegram:disableProvisioningProfiles']
418+
419+
if self.configuration_path is None:
420+
raise Exception('configuration_path is not defined')
421+
422+
combined_arguments += [
423+
'--override_repository=build_configuration={}'.format(self.configuration_path)
424+
]
425+
426+
combined_arguments += self.common_args
427+
combined_arguments += self.common_build_args
428+
combined_arguments += self.get_define_arguments()
429+
combined_arguments += self.get_additional_build_arguments()
430+
431+
if self.remote_cache is not None:
432+
combined_arguments += [
433+
'--remote_cache={}'.format(self.remote_cache),
434+
'--experimental_remote_downloader={}'.format(self.remote_cache)
435+
]
436+
elif self.cache_dir is not None:
437+
combined_arguments += [
438+
'--disk_cache={path}'.format(path=self.cache_dir)
439+
]
440+
441+
combined_arguments += self.configuration_args
442+
443+
combined_arguments += ['--aspects', '//build-system/bazel-utils:spm.bzl%spm_text_aspect']
444+
445+
print(subprocess.list2cmdline(combined_arguments))
446+
call_executable(combined_arguments)
447+
396448

397449
def clean(bazel, arguments):
398450
bazel_command_line = BazelCommandLine(
@@ -696,6 +748,36 @@ def query(bazel, arguments):
696748
bazel_command_line.invoke_query(query_args)
697749

698750

751+
def get_spm_aspect_invocation(bazel, arguments):
752+
bazel_command_line = BazelCommandLine(
753+
bazel=bazel,
754+
override_bazel_version=arguments.overrideBazelVersion,
755+
override_xcode_version=arguments.overrideXcodeVersion,
756+
bazel_user_root=arguments.bazelUserRoot
757+
)
758+
759+
if arguments.cacheDir is not None:
760+
bazel_command_line.add_cache_dir(arguments.cacheDir)
761+
elif arguments.cacheHost is not None:
762+
bazel_command_line.add_remote_cache(arguments.cacheHost)
763+
764+
resolve_configuration(
765+
base_path=os.getcwd(),
766+
bazel_command_line=bazel_command_line,
767+
arguments=arguments,
768+
additional_codesigning_output_path=None
769+
)
770+
771+
bazel_command_line.set_configuration(arguments.configuration)
772+
bazel_command_line.set_build_number(arguments.buildNumber)
773+
bazel_command_line.set_custom_target(arguments.target)
774+
bazel_command_line.set_continue_on_error(False)
775+
bazel_command_line.set_show_actions(False)
776+
bazel_command_line.set_enable_sandbox(False)
777+
bazel_command_line.set_split_swiftmodules(False)
778+
779+
bazel_command_line.get_spm_aspect_invocation()
780+
699781
def add_codesigning_common_arguments(current_parser: argparse.ArgumentParser):
700782
configuration_group = current_parser.add_mutually_exclusive_group(required=True)
701783
configuration_group.add_argument(
@@ -1121,6 +1203,38 @@ def add_project_and_build_common_arguments(current_parser: argparse.ArgumentPars
11211203
metavar='query_string'
11221204
)
11231205

1206+
spm_parser = subparsers.add_parser('spm', help='Generate SPM package')
1207+
spm_parser.add_argument(
1208+
'--target',
1209+
type=str,
1210+
help='A custom bazel target name to build.',
1211+
metavar='target_name'
1212+
)
1213+
spm_parser.add_argument(
1214+
'--buildNumber',
1215+
required=False,
1216+
type=int,
1217+
default=10000,
1218+
help='Build number.',
1219+
metavar='number'
1220+
)
1221+
spm_parser.add_argument(
1222+
'--configuration',
1223+
choices=[
1224+
'debug_universal',
1225+
'debug_arm64',
1226+
'debug_armv7',
1227+
'debug_sim_arm64',
1228+
'release_sim_arm64',
1229+
'release_arm64',
1230+
'release_armv7',
1231+
'release_universal'
1232+
],
1233+
required=True,
1234+
help='Build configuration'
1235+
)
1236+
add_codesigning_common_arguments(spm_parser)
1237+
11241238
if len(sys.argv) < 2:
11251239
parser.print_help()
11261240
sys.exit(1)
@@ -1229,6 +1343,8 @@ def add_project_and_build_common_arguments(current_parser: argparse.ArgumentPars
12291343
test(bazel=bazel_path, arguments=args)
12301344
elif args.commandName == 'query':
12311345
query(bazel=bazel_path, arguments=args)
1346+
elif args.commandName == 'spm':
1347+
get_spm_aspect_invocation(bazel=bazel_path, arguments=args)
12321348
else:
12331349
raise Exception('Unknown command')
12341350
except KeyboardInterrupt:
Submodule rules_xcodeproj updated 194 files

0 commit comments

Comments
 (0)