diff --git a/.bazelrc b/.bazelrc
index b083e61e..4471fa12 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -22,9 +22,20 @@ build --spawn_strategy=standalone
build --strategy=SwiftCompile=standalone
build --define RULES_SWIFT_BUILD_DUMMY_WORKER=1
+build:swift_profile --jobs=1
+build:swift_profile --local_cpu_resources=1
+build:swift_profile --features=-swift.enable_batch_mode
+build:swift_profile --experimental_ui_max_stdouterr_bytes=104857600
+build:swift_profile --@build_bazel_rules_swift//swift:copt=-Xfrontend
+build:swift_profile --@build_bazel_rules_swift//swift:copt=-warn-long-function-bodies=350
+build:swift_profile --@build_bazel_rules_swift//swift:copt=-Xfrontend
+build:swift_profile --@build_bazel_rules_swift//swift:copt=-warn-long-expression-type-checking=350
+
common:index_build --experimental_convenience_symlinks=ignore
common:index_build --bes_backend= --bes_results_url=
common:index_build --nolegacy_important_outputs
common:index_build --show_result=0
common:index_build --define=buildNumber=10000
common:index_build --define=telegramVersion=12.2.2
+
+common --registry=https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/
diff --git a/.gitignore b/.gitignore
index 230ee773..100cdd79 100644
--- a/.gitignore
+++ b/.gitignore
@@ -59,8 +59,6 @@ bazel-telegram-ios
bazel-telegram-ios/*
bazel-testlogs
bazel-testlogs/*
-bazel-telegram-antidelete
-bazel-telegram-antidelete/*
xcodeproj.bazelrc
*/*.swp
*.swp
@@ -76,10 +74,7 @@ buildServer.json
Telegram.LSP.json
**/.build/**
spm-files
+xcode-files
.bsp/**
-
-*.mobileprovision
-build-system/fake-codesigning/profiles/*
-
-*.backup
-*_BACKUP*
\ No newline at end of file
+/.claude/
+/buildbox/*
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 39daf6b3..b9fde043 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -50,6 +50,11 @@ internal_testflight:
- python3 -u build-system/Make/Make.py remote-deploy-testflight --darwinContainers="$DARWIN_CONTAINERS" --darwinContainersHost="$DARWIN_CONTAINERS_HOST" --ipa="build/artifacts/Telegram.ipa" --dsyms="build/artifacts/Telegram.DSYMs.zip"
environment:
name: testflight_llc
+ artifacts:
+ when: always
+ paths:
+ - build/artifacts
+ expire_in: 1 week
appstore_development:
tags:
@@ -80,7 +85,7 @@ experimental_i:
- export PATH=/opt/homebrew/opt/ruby/bin:$PATH
- export PATH=`gem environment gemdir`/bin:$PATH
- python3 -u build-system/Make/Make.py remote-build --darwinContainers="$DARWIN_CONTAINERS" --darwinContainersHost="$DARWIN_CONTAINERS_HOST" --cacheHost="$TELEGRAM_BAZEL_CACHE_HOST" --configurationPath="build-system/appcenter-configuration.json" --gitCodesigningRepository="$TELEGRAM_GIT_CODESIGNING_REPOSITORY" --gitCodesigningType=adhoc --configuration=release_arm64
- - python3 -u build-system/Make/DeployToFirebase.py --configuration="$TELEGRAM_PRIVATE_DATA_PATH/firebase-configurations/firebase-internal.json" --ipa="build/artifacts/Telegram.ipa" --dsyms="build/artifacts/Telegram.DSYMs.zip"
+ - python3 -u build-system/Make/Make.py remote-deploy-testflight --darwinContainers="$DARWIN_CONTAINERS" --darwinContainersHost="$DARWIN_CONTAINERS_HOST" --ipa="build/artifacts/Telegram.ipa" --dsyms="build/artifacts/Telegram.DSYMs.zip"
environment:
name: experimental
artifacts:
diff --git a/.sourcekit-lsp/config.json b/.sourcekit-lsp/config.json
index 7715da74..8837d093 100644
--- a/.sourcekit-lsp/config.json
+++ b/.sourcekit-lsp/config.json
@@ -1,6 +1,8 @@
{
"backgroundIndexing": true,
"backgroundPreparationMode": "build",
+ "buildServerWorkspaceRequestsTimeout": 999,
+ "buildSettingsTimeout": 999,
"defaultWorkspaceType": "buildServer",
"logging": {
"level": "error",
diff --git a/BUILD.bazel b/BUILD.bazel
index 37688a7c..929cf6a2 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -2,7 +2,7 @@ load("@sourcekit_bazel_bsp//rules:setup_sourcekit_bsp.bzl", "setup_sourcekit_bsp
setup_sourcekit_bsp(
name = "setup_sourcekit_bsp_telegram_project",
- bazel_wrapper = "./build-input/bazel-8.4.2-darwin-arm64",
+ bazel_wrapper = "./build-input/bazel-8.4.2-darwin-x86_64",
files_to_watch = [
"**/*.swift",
],
diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock
index ff664751..c24d0548 100644
--- a/MODULE.bazel.lock
+++ b/MODULE.bazel.lock
@@ -1,156 +1,156 @@
{
"lockFileVersion": 18,
"registryFileHashes": {
- "https://bcr.bazel.build/bazel_registry.json": "8a28e4aff06ee60aed2a8c281907fb8bcbf3b753c91fb5a5c57da3215d5b3497",
- "https://bcr.bazel.build/modules/abseil-cpp/20210324.2/MODULE.bazel": "7cd0312e064fde87c8d1cd79ba06c876bd23630c83466e9500321be55c96ace2",
- "https://bcr.bazel.build/modules/abseil-cpp/20211102.0/MODULE.bazel": "70390338f7a5106231d20620712f7cccb659cd0e9d073d1991c038eb9fc57589",
- "https://bcr.bazel.build/modules/abseil-cpp/20230125.1/MODULE.bazel": "89047429cb0207707b2dface14ba7f8df85273d484c2572755be4bab7ce9c3a0",
- "https://bcr.bazel.build/modules/abseil-cpp/20230802.0.bcr.1/MODULE.bazel": "1c8cec495288dccd14fdae6e3f95f772c1c91857047a098fad772034264cc8cb",
- "https://bcr.bazel.build/modules/abseil-cpp/20230802.0/MODULE.bazel": "d253ae36a8bd9ee3c5955384096ccb6baf16a1b1e93e858370da0a3b94f77c16",
- "https://bcr.bazel.build/modules/abseil-cpp/20230802.1/MODULE.bazel": "fa92e2eb41a04df73cdabeec37107316f7e5272650f81d6cc096418fe647b915",
- "https://bcr.bazel.build/modules/abseil-cpp/20240116.1/MODULE.bazel": "37bcdb4440fbb61df6a1c296ae01b327f19e9bb521f9b8e26ec854b6f97309ed",
- "https://bcr.bazel.build/modules/abseil-cpp/20240116.1/source.json": "9be551b8d4e3ef76875c0d744b5d6a504a27e3ae67bc6b28f46415fd2d2957da",
- "https://bcr.bazel.build/modules/bazel_features/1.1.1/MODULE.bazel": "27b8c79ef57efe08efccbd9dd6ef70d61b4798320b8d3c134fd571f78963dbcd",
- "https://bcr.bazel.build/modules/bazel_features/1.11.0/MODULE.bazel": "f9382337dd5a474c3b7d334c2f83e50b6eaedc284253334cf823044a26de03e8",
- "https://bcr.bazel.build/modules/bazel_features/1.15.0/MODULE.bazel": "d38ff6e517149dc509406aca0db3ad1efdd890a85e049585b7234d04238e2a4d",
- "https://bcr.bazel.build/modules/bazel_features/1.17.0/MODULE.bazel": "039de32d21b816b47bd42c778e0454217e9c9caac4a3cf8e15c7231ee3ddee4d",
- "https://bcr.bazel.build/modules/bazel_features/1.18.0/MODULE.bazel": "1be0ae2557ab3a72a57aeb31b29be347bcdc5d2b1eb1e70f39e3851a7e97041a",
- "https://bcr.bazel.build/modules/bazel_features/1.19.0/MODULE.bazel": "59adcdf28230d220f0067b1f435b8537dd033bfff8db21335ef9217919c7fb58",
- "https://bcr.bazel.build/modules/bazel_features/1.21.0/MODULE.bazel": "675642261665d8eea09989aa3b8afb5c37627f1be178382c320d1b46afba5e3b",
- "https://bcr.bazel.build/modules/bazel_features/1.27.0/MODULE.bazel": "621eeee06c4458a9121d1f104efb80f39d34deff4984e778359c60eaf1a8cb65",
- "https://bcr.bazel.build/modules/bazel_features/1.28.0/MODULE.bazel": "4b4200e6cbf8fa335b2c3f43e1d6ef3e240319c33d43d60cc0fbd4b87ece299d",
- "https://bcr.bazel.build/modules/bazel_features/1.3.0/MODULE.bazel": "cdcafe83ec318cda34e02948e81d790aab8df7a929cec6f6969f13a489ccecd9",
- "https://bcr.bazel.build/modules/bazel_features/1.30.0/MODULE.bazel": "a14b62d05969a293b80257e72e597c2da7f717e1e69fa8b339703ed6731bec87",
- "https://bcr.bazel.build/modules/bazel_features/1.30.0/source.json": "b07e17f067fe4f69f90b03b36ef1e08fe0d1f3cac254c1241a1818773e3423bc",
- "https://bcr.bazel.build/modules/bazel_features/1.4.1/MODULE.bazel": "e45b6bb2350aff3e442ae1111c555e27eac1d915e77775f6fdc4b351b758b5d7",
- "https://bcr.bazel.build/modules/bazel_features/1.9.0/MODULE.bazel": "885151d58d90d8d9c811eb75e3288c11f850e1d6b481a8c9f766adee4712358b",
- "https://bcr.bazel.build/modules/bazel_features/1.9.1/MODULE.bazel": "8f679097876a9b609ad1f60249c49d68bfab783dd9be012faf9d82547b14815a",
- "https://bcr.bazel.build/modules/bazel_skylib/1.0.3/MODULE.bazel": "bcb0fd896384802d1ad283b4e4eb4d718eebd8cb820b0a2c3a347fb971afd9d8",
- "https://bcr.bazel.build/modules/bazel_skylib/1.1.1/MODULE.bazel": "1add3e7d93ff2e6998f9e118022c84d163917d912f5afafb3058e3d2f1545b5e",
- "https://bcr.bazel.build/modules/bazel_skylib/1.2.0/MODULE.bazel": "44fe84260e454ed94ad326352a698422dbe372b21a1ac9f3eab76eb531223686",
- "https://bcr.bazel.build/modules/bazel_skylib/1.2.1/MODULE.bazel": "f35baf9da0efe45fa3da1696ae906eea3d615ad41e2e3def4aeb4e8bc0ef9a7a",
- "https://bcr.bazel.build/modules/bazel_skylib/1.3.0/MODULE.bazel": "20228b92868bf5cfc41bda7afc8a8ba2a543201851de39d990ec957b513579c5",
- "https://bcr.bazel.build/modules/bazel_skylib/1.4.1/MODULE.bazel": "a0dcb779424be33100dcae821e9e27e4f2901d9dfd5333efe5ac6a8d7ab75e1d",
- "https://bcr.bazel.build/modules/bazel_skylib/1.4.2/MODULE.bazel": "3bd40978e7a1fac911d5989e6b09d8f64921865a45822d8b09e815eaa726a651",
- "https://bcr.bazel.build/modules/bazel_skylib/1.5.0/MODULE.bazel": "32880f5e2945ce6a03d1fbd588e9198c0a959bb42297b2cfaf1685b7bc32e138",
- "https://bcr.bazel.build/modules/bazel_skylib/1.6.1/MODULE.bazel": "8fdee2dbaace6c252131c00e1de4b165dc65af02ea278476187765e1a617b917",
- "https://bcr.bazel.build/modules/bazel_skylib/1.7.0/MODULE.bazel": "0db596f4563de7938de764cc8deeabec291f55e8ec15299718b93c4423e9796d",
- "https://bcr.bazel.build/modules/bazel_skylib/1.7.1/MODULE.bazel": "3120d80c5861aa616222ec015332e5f8d3171e062e3e804a2a0253e1be26e59b",
- "https://bcr.bazel.build/modules/bazel_skylib/1.7.1/source.json": "f121b43eeefc7c29efbd51b83d08631e2347297c95aac9764a701f2a6a2bb953",
- "https://bcr.bazel.build/modules/buildozer/7.1.2/MODULE.bazel": "2e8dd40ede9c454042645fd8d8d0cd1527966aa5c919de86661e62953cd73d84",
- "https://bcr.bazel.build/modules/buildozer/7.1.2/source.json": "c9028a501d2db85793a6996205c8de120944f50a0d570438fcae0457a5f9d1f8",
- "https://bcr.bazel.build/modules/google_benchmark/1.8.2/MODULE.bazel": "a70cf1bba851000ba93b58ae2f6d76490a9feb74192e57ab8e8ff13c34ec50cb",
- "https://bcr.bazel.build/modules/googletest/1.11.0/MODULE.bazel": "3a83f095183f66345ca86aa13c58b59f9f94a2f81999c093d4eeaa2d262d12f4",
- "https://bcr.bazel.build/modules/googletest/1.14.0.bcr.1/MODULE.bazel": "22c31a561553727960057361aa33bf20fb2e98584bc4fec007906e27053f80c6",
- "https://bcr.bazel.build/modules/googletest/1.14.0.bcr.1/source.json": "41e9e129f80d8c8bf103a7acc337b76e54fad1214ac0a7084bf24f4cd924b8b4",
- "https://bcr.bazel.build/modules/googletest/1.14.0/MODULE.bazel": "cfbcbf3e6eac06ef9d85900f64424708cc08687d1b527f0ef65aa7517af8118f",
- "https://bcr.bazel.build/modules/jsoncpp/1.9.5/MODULE.bazel": "31271aedc59e815656f5736f282bb7509a97c7ecb43e927ac1a37966e0578075",
- "https://bcr.bazel.build/modules/jsoncpp/1.9.5/source.json": "4108ee5085dd2885a341c7fab149429db457b3169b86eb081fa245eadf69169d",
- "https://bcr.bazel.build/modules/libpfm/4.11.0/MODULE.bazel": "45061ff025b301940f1e30d2c16bea596c25b176c8b6b3087e92615adbd52902",
- "https://bcr.bazel.build/modules/nlohmann_json/3.6.1/MODULE.bazel": "6f7b417dcc794d9add9e556673ad25cb3ba835224290f4f848f8e2db1e1fca74",
- "https://bcr.bazel.build/modules/nlohmann_json/3.6.1/source.json": "f448c6e8963fdfa7eb831457df83ad63d3d6355018f6574fb017e8169deb43a9",
- "https://bcr.bazel.build/modules/platforms/0.0.10/MODULE.bazel": "8cb8efaf200bdeb2150d93e162c40f388529a25852b332cec879373771e48ed5",
- "https://bcr.bazel.build/modules/platforms/0.0.11/MODULE.bazel": "0daefc49732e227caa8bfa834d65dc52e8cc18a2faf80df25e8caea151a9413f",
- "https://bcr.bazel.build/modules/platforms/0.0.11/source.json": "f7e188b79ebedebfe75e9e1d098b8845226c7992b307e28e1496f23112e8fc29",
- "https://bcr.bazel.build/modules/platforms/0.0.4/MODULE.bazel": "9b328e31ee156f53f3c416a64f8491f7eb731742655a47c9eec4703a71644aee",
- "https://bcr.bazel.build/modules/platforms/0.0.5/MODULE.bazel": "5733b54ea419d5eaf7997054bb55f6a1d0b5ff8aedf0176fef9eea44f3acda37",
- "https://bcr.bazel.build/modules/platforms/0.0.6/MODULE.bazel": "ad6eeef431dc52aefd2d77ed20a4b353f8ebf0f4ecdd26a807d2da5aa8cd0615",
- "https://bcr.bazel.build/modules/platforms/0.0.7/MODULE.bazel": "72fd4a0ede9ee5c021f6a8dd92b503e089f46c227ba2813ff183b71616034814",
- "https://bcr.bazel.build/modules/platforms/0.0.8/MODULE.bazel": "9f142c03e348f6d263719f5074b21ef3adf0b139ee4c5133e2aa35664da9eb2d",
- "https://bcr.bazel.build/modules/platforms/0.0.9/MODULE.bazel": "4a87a60c927b56ddd67db50c89acaa62f4ce2a1d2149ccb63ffd871d5ce29ebc",
- "https://bcr.bazel.build/modules/protobuf/21.7/MODULE.bazel": "a5a29bb89544f9b97edce05642fac225a808b5b7be74038ea3640fae2f8e66a7",
- "https://bcr.bazel.build/modules/protobuf/27.0/MODULE.bazel": "7873b60be88844a0a1d8f80b9d5d20cfbd8495a689b8763e76c6372998d3f64c",
- "https://bcr.bazel.build/modules/protobuf/27.1/MODULE.bazel": "703a7b614728bb06647f965264967a8ef1c39e09e8f167b3ca0bb1fd80449c0d",
- "https://bcr.bazel.build/modules/protobuf/29.0-rc2/MODULE.bazel": "6241d35983510143049943fc0d57937937122baf1b287862f9dc8590fc4c37df",
- "https://bcr.bazel.build/modules/protobuf/29.0-rc3/MODULE.bazel": "33c2dfa286578573afc55a7acaea3cada4122b9631007c594bf0729f41c8de92",
- "https://bcr.bazel.build/modules/protobuf/29.0/MODULE.bazel": "319dc8bf4c679ff87e71b1ccfb5a6e90a6dbc4693501d471f48662ac46d04e4e",
- "https://bcr.bazel.build/modules/protobuf/29.0/source.json": "b857f93c796750eef95f0d61ee378f3420d00ee1dd38627b27193aa482f4f981",
- "https://bcr.bazel.build/modules/protobuf/3.19.0/MODULE.bazel": "6b5fbb433f760a99a22b18b6850ed5784ef0e9928a72668b66e4d7ccd47db9b0",
- "https://bcr.bazel.build/modules/pybind11_bazel/2.11.1/MODULE.bazel": "88af1c246226d87e65be78ed49ecd1e6f5e98648558c14ce99176da041dc378e",
- "https://bcr.bazel.build/modules/pybind11_bazel/2.11.1/source.json": "be4789e951dd5301282729fe3d4938995dc4c1a81c2ff150afc9f1b0504c6022",
- "https://bcr.bazel.build/modules/re2/2023-09-01/MODULE.bazel": "cb3d511531b16cfc78a225a9e2136007a48cf8a677e4264baeab57fe78a80206",
- "https://bcr.bazel.build/modules/re2/2023-09-01/source.json": "e044ce89c2883cd957a2969a43e79f7752f9656f6b20050b62f90ede21ec6eb4",
- "https://bcr.bazel.build/modules/rules_android/0.1.1/MODULE.bazel": "48809ab0091b07ad0182defb787c4c5328bd3a278938415c00a7b69b50c4d3a8",
- "https://bcr.bazel.build/modules/rules_android/0.1.1/source.json": "e6986b41626ee10bdc864937ffb6d6bf275bb5b9c65120e6137d56e6331f089e",
- "https://bcr.bazel.build/modules/rules_cc/0.0.1/MODULE.bazel": "cb2aa0747f84c6c3a78dad4e2049c154f08ab9d166b1273835a8174940365647",
- "https://bcr.bazel.build/modules/rules_cc/0.0.10/MODULE.bazel": "ec1705118f7eaedd6e118508d3d26deba2a4e76476ada7e0e3965211be012002",
- "https://bcr.bazel.build/modules/rules_cc/0.0.13/MODULE.bazel": "0e8529ed7b323dad0775ff924d2ae5af7640b23553dfcd4d34344c7e7a867191",
- "https://bcr.bazel.build/modules/rules_cc/0.0.14/MODULE.bazel": "5e343a3aac88b8d7af3b1b6d2093b55c347b8eefc2e7d1442f7a02dc8fea48ac",
- "https://bcr.bazel.build/modules/rules_cc/0.0.15/MODULE.bazel": "6704c35f7b4a72502ee81f61bf88706b54f06b3cbe5558ac17e2e14666cd5dcc",
- "https://bcr.bazel.build/modules/rules_cc/0.0.16/MODULE.bazel": "7661303b8fc1b4d7f532e54e9d6565771fea666fbdf839e0a86affcd02defe87",
- "https://bcr.bazel.build/modules/rules_cc/0.0.2/MODULE.bazel": "6915987c90970493ab97393024c156ea8fb9f3bea953b2f3ec05c34f19b5695c",
- "https://bcr.bazel.build/modules/rules_cc/0.0.6/MODULE.bazel": "abf360251023dfe3efcef65ab9d56beefa8394d4176dd29529750e1c57eaa33f",
- "https://bcr.bazel.build/modules/rules_cc/0.0.8/MODULE.bazel": "964c85c82cfeb6f3855e6a07054fdb159aced38e99a5eecf7bce9d53990afa3e",
- "https://bcr.bazel.build/modules/rules_cc/0.0.9/MODULE.bazel": "836e76439f354b89afe6a911a7adf59a6b2518fafb174483ad78a2a2fde7b1c5",
- "https://bcr.bazel.build/modules/rules_cc/0.1.1/MODULE.bazel": "2f0222a6f229f0bf44cd711dc13c858dad98c62d52bd51d8fc3a764a83125513",
- "https://bcr.bazel.build/modules/rules_cc/0.1.2/MODULE.bazel": "557ddc3a96858ec0d465a87c0a931054d7dcfd6583af2c7ed3baf494407fd8d0",
- "https://bcr.bazel.build/modules/rules_cc/0.1.2/source.json": "53fcb09b5816c83ca60d9d7493faf3bfaf410dfc2f15deb52d6ddd146b8d43f0",
- "https://bcr.bazel.build/modules/rules_foreign_cc/0.9.0/MODULE.bazel": "c9e8c682bf75b0e7c704166d79b599f93b72cfca5ad7477df596947891feeef6",
- "https://bcr.bazel.build/modules/rules_fuzzing/0.5.2/MODULE.bazel": "40c97d1144356f52905566c55811f13b299453a14ac7769dfba2ac38192337a8",
- "https://bcr.bazel.build/modules/rules_fuzzing/0.5.2/source.json": "c8b1e2c717646f1702290959a3302a178fb639d987ab61d548105019f11e527e",
- "https://bcr.bazel.build/modules/rules_java/4.0.0/MODULE.bazel": "5a78a7ae82cd1a33cef56dc578c7d2a46ed0dca12643ee45edbb8417899e6f74",
- "https://bcr.bazel.build/modules/rules_java/5.3.5/MODULE.bazel": "a4ec4f2db570171e3e5eb753276ee4b389bae16b96207e9d3230895c99644b86",
- "https://bcr.bazel.build/modules/rules_java/6.0.0/MODULE.bazel": "8a43b7df601a7ec1af61d79345c17b31ea1fedc6711fd4abfd013ea612978e39",
- "https://bcr.bazel.build/modules/rules_java/6.4.0/MODULE.bazel": "e986a9fe25aeaa84ac17ca093ef13a4637f6107375f64667a15999f77db6c8f6",
- "https://bcr.bazel.build/modules/rules_java/6.5.2/MODULE.bazel": "1d440d262d0e08453fa0c4d8f699ba81609ed0e9a9a0f02cd10b3e7942e61e31",
- "https://bcr.bazel.build/modules/rules_java/7.10.0/MODULE.bazel": "530c3beb3067e870561739f1144329a21c851ff771cd752a49e06e3dc9c2e71a",
- "https://bcr.bazel.build/modules/rules_java/7.12.2/MODULE.bazel": "579c505165ee757a4280ef83cda0150eea193eed3bef50b1004ba88b99da6de6",
- "https://bcr.bazel.build/modules/rules_java/7.2.0/MODULE.bazel": "06c0334c9be61e6cef2c8c84a7800cef502063269a5af25ceb100b192453d4ab",
- "https://bcr.bazel.build/modules/rules_java/7.3.2/MODULE.bazel": "50dece891cfdf1741ea230d001aa9c14398062f2b7c066470accace78e412bc2",
- "https://bcr.bazel.build/modules/rules_java/7.6.1/MODULE.bazel": "2f14b7e8a1aa2f67ae92bc69d1ec0fa8d9f827c4e17ff5e5f02e91caa3b2d0fe",
- "https://bcr.bazel.build/modules/rules_java/8.14.0/MODULE.bazel": "717717ed40cc69994596a45aec6ea78135ea434b8402fb91b009b9151dd65615",
- "https://bcr.bazel.build/modules/rules_java/8.14.0/source.json": "8a88c4ca9e8759da53cddc88123880565c520503321e2566b4e33d0287a3d4bc",
- "https://bcr.bazel.build/modules/rules_java/8.3.2/MODULE.bazel": "7336d5511ad5af0b8615fdc7477535a2e4e723a357b6713af439fe8cf0195017",
- "https://bcr.bazel.build/modules/rules_java/8.5.1/MODULE.bazel": "d8a9e38cc5228881f7055a6079f6f7821a073df3744d441978e7a43e20226939",
- "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/MODULE.bazel": "a56b85e418c83eb1839819f0b515c431010160383306d13ec21959ac412d2fe7",
- "https://bcr.bazel.build/modules/rules_jvm_external/5.1/MODULE.bazel": "33f6f999e03183f7d088c9be518a63467dfd0be94a11d0055fe2d210f89aa909",
- "https://bcr.bazel.build/modules/rules_jvm_external/5.2/MODULE.bazel": "d9351ba35217ad0de03816ef3ed63f89d411349353077348a45348b096615036",
- "https://bcr.bazel.build/modules/rules_jvm_external/5.3/MODULE.bazel": "bf93870767689637164657731849fb887ad086739bd5d360d90007a581d5527d",
- "https://bcr.bazel.build/modules/rules_jvm_external/6.1/MODULE.bazel": "75b5fec090dbd46cf9b7d8ea08cf84a0472d92ba3585b476f44c326eda8059c4",
- "https://bcr.bazel.build/modules/rules_jvm_external/6.3/MODULE.bazel": "c998e060b85f71e00de5ec552019347c8bca255062c990ac02d051bb80a38df0",
- "https://bcr.bazel.build/modules/rules_jvm_external/6.3/source.json": "6f5f5a5a4419ae4e37c35a5bb0a6ae657ed40b7abc5a5189111b47fcebe43197",
- "https://bcr.bazel.build/modules/rules_kotlin/1.9.0/MODULE.bazel": "ef85697305025e5a61f395d4eaede272a5393cee479ace6686dba707de804d59",
- "https://bcr.bazel.build/modules/rules_kotlin/1.9.6/MODULE.bazel": "d269a01a18ee74d0335450b10f62c9ed81f2321d7958a2934e44272fe82dcef3",
- "https://bcr.bazel.build/modules/rules_kotlin/1.9.6/source.json": "2faa4794364282db7c06600b7e5e34867a564ae91bda7cae7c29c64e9466b7d5",
- "https://bcr.bazel.build/modules/rules_license/0.0.3/MODULE.bazel": "627e9ab0247f7d1e05736b59dbb1b6871373de5ad31c3011880b4133cafd4bd0",
- "https://bcr.bazel.build/modules/rules_license/0.0.7/MODULE.bazel": "088fbeb0b6a419005b89cf93fe62d9517c0a2b8bb56af3244af65ecfe37e7d5d",
- "https://bcr.bazel.build/modules/rules_license/1.0.0/MODULE.bazel": "a7fda60eefdf3d8c827262ba499957e4df06f659330bbe6cdbdb975b768bb65c",
- "https://bcr.bazel.build/modules/rules_license/1.0.0/source.json": "a52c89e54cc311196e478f8382df91c15f7a2bfdf4c6cd0e2675cc2ff0b56efb",
- "https://bcr.bazel.build/modules/rules_pkg/0.7.0/MODULE.bazel": "df99f03fc7934a4737122518bb87e667e62d780b610910f0447665a7e2be62dc",
- "https://bcr.bazel.build/modules/rules_pkg/1.0.1/MODULE.bazel": "5b1df97dbc29623bccdf2b0dcd0f5cb08e2f2c9050aab1092fd39a41e82686ff",
- "https://bcr.bazel.build/modules/rules_pkg/1.0.1/source.json": "bd82e5d7b9ce2d31e380dd9f50c111d678c3bdaca190cb76b0e1c71b05e1ba8a",
- "https://bcr.bazel.build/modules/rules_proto/4.0.0/MODULE.bazel": "a7a7b6ce9bee418c1a760b3d84f83a299ad6952f9903c67f19e4edd964894e06",
- "https://bcr.bazel.build/modules/rules_proto/5.3.0-21.7/MODULE.bazel": "e8dff86b0971688790ae75528fe1813f71809b5afd57facb44dad9e8eca631b7",
- "https://bcr.bazel.build/modules/rules_proto/6.0.2/MODULE.bazel": "ce916b775a62b90b61888052a416ccdda405212b6aaeb39522f7dc53431a5e73",
- "https://bcr.bazel.build/modules/rules_proto/7.0.2/MODULE.bazel": "bf81793bd6d2ad89a37a40693e56c61b0ee30f7a7fdbaf3eabbf5f39de47dea2",
- "https://bcr.bazel.build/modules/rules_proto/7.0.2/source.json": "1e5e7260ae32ef4f2b52fd1d0de8d03b606a44c91b694d2f1afb1d3b28a48ce1",
- "https://bcr.bazel.build/modules/rules_python/0.10.2/MODULE.bazel": "cc82bc96f2997baa545ab3ce73f196d040ffb8756fd2d66125a530031cd90e5f",
- "https://bcr.bazel.build/modules/rules_python/0.23.1/MODULE.bazel": "49ffccf0511cb8414de28321f5fcf2a31312b47c40cc21577144b7447f2bf300",
- "https://bcr.bazel.build/modules/rules_python/0.25.0/MODULE.bazel": "72f1506841c920a1afec76975b35312410eea3aa7b63267436bfb1dd91d2d382",
- "https://bcr.bazel.build/modules/rules_python/0.27.1/MODULE.bazel": "65dc875cc1a06c30d5bbdba7ab021fd9e551a6579e408a3943a61303e2228a53",
- "https://bcr.bazel.build/modules/rules_python/0.28.0/MODULE.bazel": "cba2573d870babc976664a912539b320cbaa7114cd3e8f053c720171cde331ed",
- "https://bcr.bazel.build/modules/rules_python/0.31.0/MODULE.bazel": "93a43dc47ee570e6ec9f5779b2e64c1476a6ce921c48cc9a1678a91dd5f8fd58",
- "https://bcr.bazel.build/modules/rules_python/0.4.0/MODULE.bazel": "9208ee05fd48bf09ac60ed269791cf17fb343db56c8226a720fbb1cdf467166c",
- "https://bcr.bazel.build/modules/rules_python/0.40.0/MODULE.bazel": "9d1a3cd88ed7d8e39583d9ffe56ae8a244f67783ae89b60caafc9f5cf318ada7",
- "https://bcr.bazel.build/modules/rules_python/1.3.0/MODULE.bazel": "8361d57eafb67c09b75bf4bbe6be360e1b8f4f18118ab48037f2bd50aa2ccb13",
- "https://bcr.bazel.build/modules/rules_python/1.3.0/source.json": "25932f917cd279c7baefa6cb1d3fa8750a7a29de522024449b19af6eab51f4a0",
- "https://bcr.bazel.build/modules/rules_shell/0.2.0/MODULE.bazel": "fda8a652ab3c7d8fee214de05e7a9916d8b28082234e8d2c0094505c5268ed3c",
- "https://bcr.bazel.build/modules/rules_shell/0.3.0/MODULE.bazel": "de4402cd12f4cc8fda2354fce179fdb068c0b9ca1ec2d2b17b3e21b24c1a937b",
- "https://bcr.bazel.build/modules/rules_shell/0.3.0/source.json": "c55ed591aa5009401ddf80ded9762ac32c358d2517ee7820be981e2de9756cf3",
- "https://bcr.bazel.build/modules/stardoc/0.5.1/MODULE.bazel": "1a05d92974d0c122f5ccf09291442580317cdd859f07a8655f1db9a60374f9f8",
- "https://bcr.bazel.build/modules/stardoc/0.5.3/MODULE.bazel": "c7f6948dae6999bf0db32c1858ae345f112cacf98f174c7a8bb707e41b974f1c",
- "https://bcr.bazel.build/modules/stardoc/0.5.6/MODULE.bazel": "c43dabc564990eeab55e25ed61c07a1aadafe9ece96a4efabb3f8bf9063b71ef",
- "https://bcr.bazel.build/modules/stardoc/0.7.0/MODULE.bazel": "05e3d6d30c099b6770e97da986c53bd31844d7f13d41412480ea265ac9e8079c",
- "https://bcr.bazel.build/modules/stardoc/0.7.1/MODULE.bazel": "3548faea4ee5dda5580f9af150e79d0f6aea934fc60c1cc50f4efdd9420759e7",
- "https://bcr.bazel.build/modules/stardoc/0.7.2/MODULE.bazel": "fc152419aa2ea0f51c29583fab1e8c99ddefd5b3778421845606ee628629e0e5",
- "https://bcr.bazel.build/modules/stardoc/0.7.2/source.json": "58b029e5e901d6802967754adf0a9056747e8176f017cfe3607c0851f4d42216",
- "https://bcr.bazel.build/modules/swift_argument_parser/1.3.1.1/MODULE.bazel": "5e463fbfba7b1701d957555ed45097d7f984211330106ccd1352c6e0af0dcf91",
- "https://bcr.bazel.build/modules/swift_argument_parser/1.3.1.1/source.json": "32bd87e5f4d7acc57c5b2ff7c325ae3061d5e242c0c4c214ae87e0f1c13e54cb",
- "https://bcr.bazel.build/modules/upb/0.0.0-20220923-a547704/MODULE.bazel": "7298990c00040a0e2f121f6c32544bab27d4452f80d9ce51349b1a28f3005c43",
- "https://bcr.bazel.build/modules/zlib/1.2.11/MODULE.bazel": "07b389abc85fdbca459b69e2ec656ae5622873af3f845e1c9d80fe179f3effa0",
- "https://bcr.bazel.build/modules/zlib/1.3.1.bcr.5/MODULE.bazel": "eec517b5bbe5492629466e11dae908d043364302283de25581e3eb944326c4ca",
- "https://bcr.bazel.build/modules/zlib/1.3.1.bcr.5/source.json": "22bc55c47af97246cfc093d0acf683a7869377de362b5d1c552c2c2e16b7a806",
- "https://bcr.bazel.build/modules/zlib/1.3.1/MODULE.bazel": "751c9940dcfe869f5f7274e1295422a34623555916eb98c174c1e945594bf198"
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/bazel_registry.json": "8a28e4aff06ee60aed2a8c281907fb8bcbf3b753c91fb5a5c57da3215d5b3497",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/abseil-cpp/20210324.2/MODULE.bazel": "7cd0312e064fde87c8d1cd79ba06c876bd23630c83466e9500321be55c96ace2",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/abseil-cpp/20211102.0/MODULE.bazel": "70390338f7a5106231d20620712f7cccb659cd0e9d073d1991c038eb9fc57589",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/abseil-cpp/20230125.1/MODULE.bazel": "89047429cb0207707b2dface14ba7f8df85273d484c2572755be4bab7ce9c3a0",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/abseil-cpp/20230802.0.bcr.1/MODULE.bazel": "1c8cec495288dccd14fdae6e3f95f772c1c91857047a098fad772034264cc8cb",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/abseil-cpp/20230802.0/MODULE.bazel": "d253ae36a8bd9ee3c5955384096ccb6baf16a1b1e93e858370da0a3b94f77c16",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/abseil-cpp/20230802.1/MODULE.bazel": "fa92e2eb41a04df73cdabeec37107316f7e5272650f81d6cc096418fe647b915",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/abseil-cpp/20240116.1/MODULE.bazel": "37bcdb4440fbb61df6a1c296ae01b327f19e9bb521f9b8e26ec854b6f97309ed",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/abseil-cpp/20240116.1/source.json": "9be551b8d4e3ef76875c0d744b5d6a504a27e3ae67bc6b28f46415fd2d2957da",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/bazel_features/1.1.1/MODULE.bazel": "27b8c79ef57efe08efccbd9dd6ef70d61b4798320b8d3c134fd571f78963dbcd",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/bazel_features/1.11.0/MODULE.bazel": "f9382337dd5a474c3b7d334c2f83e50b6eaedc284253334cf823044a26de03e8",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/bazel_features/1.15.0/MODULE.bazel": "d38ff6e517149dc509406aca0db3ad1efdd890a85e049585b7234d04238e2a4d",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/bazel_features/1.17.0/MODULE.bazel": "039de32d21b816b47bd42c778e0454217e9c9caac4a3cf8e15c7231ee3ddee4d",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/bazel_features/1.18.0/MODULE.bazel": "1be0ae2557ab3a72a57aeb31b29be347bcdc5d2b1eb1e70f39e3851a7e97041a",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/bazel_features/1.19.0/MODULE.bazel": "59adcdf28230d220f0067b1f435b8537dd033bfff8db21335ef9217919c7fb58",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/bazel_features/1.21.0/MODULE.bazel": "675642261665d8eea09989aa3b8afb5c37627f1be178382c320d1b46afba5e3b",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/bazel_features/1.27.0/MODULE.bazel": "621eeee06c4458a9121d1f104efb80f39d34deff4984e778359c60eaf1a8cb65",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/bazel_features/1.28.0/MODULE.bazel": "4b4200e6cbf8fa335b2c3f43e1d6ef3e240319c33d43d60cc0fbd4b87ece299d",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/bazel_features/1.3.0/MODULE.bazel": "cdcafe83ec318cda34e02948e81d790aab8df7a929cec6f6969f13a489ccecd9",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/bazel_features/1.30.0/MODULE.bazel": "a14b62d05969a293b80257e72e597c2da7f717e1e69fa8b339703ed6731bec87",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/bazel_features/1.30.0/source.json": "b07e17f067fe4f69f90b03b36ef1e08fe0d1f3cac254c1241a1818773e3423bc",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/bazel_features/1.4.1/MODULE.bazel": "e45b6bb2350aff3e442ae1111c555e27eac1d915e77775f6fdc4b351b758b5d7",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/bazel_features/1.9.0/MODULE.bazel": "885151d58d90d8d9c811eb75e3288c11f850e1d6b481a8c9f766adee4712358b",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/bazel_features/1.9.1/MODULE.bazel": "8f679097876a9b609ad1f60249c49d68bfab783dd9be012faf9d82547b14815a",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/bazel_skylib/1.0.3/MODULE.bazel": "bcb0fd896384802d1ad283b4e4eb4d718eebd8cb820b0a2c3a347fb971afd9d8",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/bazel_skylib/1.1.1/MODULE.bazel": "1add3e7d93ff2e6998f9e118022c84d163917d912f5afafb3058e3d2f1545b5e",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/bazel_skylib/1.2.0/MODULE.bazel": "44fe84260e454ed94ad326352a698422dbe372b21a1ac9f3eab76eb531223686",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/bazel_skylib/1.2.1/MODULE.bazel": "f35baf9da0efe45fa3da1696ae906eea3d615ad41e2e3def4aeb4e8bc0ef9a7a",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/bazel_skylib/1.3.0/MODULE.bazel": "20228b92868bf5cfc41bda7afc8a8ba2a543201851de39d990ec957b513579c5",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/bazel_skylib/1.4.1/MODULE.bazel": "a0dcb779424be33100dcae821e9e27e4f2901d9dfd5333efe5ac6a8d7ab75e1d",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/bazel_skylib/1.4.2/MODULE.bazel": "3bd40978e7a1fac911d5989e6b09d8f64921865a45822d8b09e815eaa726a651",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/bazel_skylib/1.5.0/MODULE.bazel": "32880f5e2945ce6a03d1fbd588e9198c0a959bb42297b2cfaf1685b7bc32e138",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/bazel_skylib/1.6.1/MODULE.bazel": "8fdee2dbaace6c252131c00e1de4b165dc65af02ea278476187765e1a617b917",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/bazel_skylib/1.7.0/MODULE.bazel": "0db596f4563de7938de764cc8deeabec291f55e8ec15299718b93c4423e9796d",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/bazel_skylib/1.7.1/MODULE.bazel": "3120d80c5861aa616222ec015332e5f8d3171e062e3e804a2a0253e1be26e59b",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/bazel_skylib/1.7.1/source.json": "f121b43eeefc7c29efbd51b83d08631e2347297c95aac9764a701f2a6a2bb953",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/buildozer/7.1.2/MODULE.bazel": "2e8dd40ede9c454042645fd8d8d0cd1527966aa5c919de86661e62953cd73d84",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/buildozer/7.1.2/source.json": "c9028a501d2db85793a6996205c8de120944f50a0d570438fcae0457a5f9d1f8",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/google_benchmark/1.8.2/MODULE.bazel": "a70cf1bba851000ba93b58ae2f6d76490a9feb74192e57ab8e8ff13c34ec50cb",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/googletest/1.11.0/MODULE.bazel": "3a83f095183f66345ca86aa13c58b59f9f94a2f81999c093d4eeaa2d262d12f4",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/googletest/1.14.0.bcr.1/MODULE.bazel": "22c31a561553727960057361aa33bf20fb2e98584bc4fec007906e27053f80c6",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/googletest/1.14.0.bcr.1/source.json": "41e9e129f80d8c8bf103a7acc337b76e54fad1214ac0a7084bf24f4cd924b8b4",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/googletest/1.14.0/MODULE.bazel": "cfbcbf3e6eac06ef9d85900f64424708cc08687d1b527f0ef65aa7517af8118f",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/jsoncpp/1.9.5/MODULE.bazel": "31271aedc59e815656f5736f282bb7509a97c7ecb43e927ac1a37966e0578075",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/jsoncpp/1.9.5/source.json": "4108ee5085dd2885a341c7fab149429db457b3169b86eb081fa245eadf69169d",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/libpfm/4.11.0/MODULE.bazel": "45061ff025b301940f1e30d2c16bea596c25b176c8b6b3087e92615adbd52902",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/nlohmann_json/3.6.1/MODULE.bazel": "6f7b417dcc794d9add9e556673ad25cb3ba835224290f4f848f8e2db1e1fca74",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/nlohmann_json/3.6.1/source.json": "f448c6e8963fdfa7eb831457df83ad63d3d6355018f6574fb017e8169deb43a9",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/platforms/0.0.10/MODULE.bazel": "8cb8efaf200bdeb2150d93e162c40f388529a25852b332cec879373771e48ed5",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/platforms/0.0.11/MODULE.bazel": "0daefc49732e227caa8bfa834d65dc52e8cc18a2faf80df25e8caea151a9413f",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/platforms/0.0.11/source.json": "f7e188b79ebedebfe75e9e1d098b8845226c7992b307e28e1496f23112e8fc29",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/platforms/0.0.4/MODULE.bazel": "9b328e31ee156f53f3c416a64f8491f7eb731742655a47c9eec4703a71644aee",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/platforms/0.0.5/MODULE.bazel": "5733b54ea419d5eaf7997054bb55f6a1d0b5ff8aedf0176fef9eea44f3acda37",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/platforms/0.0.6/MODULE.bazel": "ad6eeef431dc52aefd2d77ed20a4b353f8ebf0f4ecdd26a807d2da5aa8cd0615",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/platforms/0.0.7/MODULE.bazel": "72fd4a0ede9ee5c021f6a8dd92b503e089f46c227ba2813ff183b71616034814",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/platforms/0.0.8/MODULE.bazel": "9f142c03e348f6d263719f5074b21ef3adf0b139ee4c5133e2aa35664da9eb2d",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/platforms/0.0.9/MODULE.bazel": "4a87a60c927b56ddd67db50c89acaa62f4ce2a1d2149ccb63ffd871d5ce29ebc",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/protobuf/21.7/MODULE.bazel": "a5a29bb89544f9b97edce05642fac225a808b5b7be74038ea3640fae2f8e66a7",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/protobuf/27.0/MODULE.bazel": "7873b60be88844a0a1d8f80b9d5d20cfbd8495a689b8763e76c6372998d3f64c",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/protobuf/27.1/MODULE.bazel": "703a7b614728bb06647f965264967a8ef1c39e09e8f167b3ca0bb1fd80449c0d",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/protobuf/29.0-rc2/MODULE.bazel": "6241d35983510143049943fc0d57937937122baf1b287862f9dc8590fc4c37df",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/protobuf/29.0-rc3/MODULE.bazel": "33c2dfa286578573afc55a7acaea3cada4122b9631007c594bf0729f41c8de92",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/protobuf/29.0/MODULE.bazel": "319dc8bf4c679ff87e71b1ccfb5a6e90a6dbc4693501d471f48662ac46d04e4e",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/protobuf/29.0/source.json": "b857f93c796750eef95f0d61ee378f3420d00ee1dd38627b27193aa482f4f981",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/protobuf/3.19.0/MODULE.bazel": "6b5fbb433f760a99a22b18b6850ed5784ef0e9928a72668b66e4d7ccd47db9b0",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/pybind11_bazel/2.11.1/MODULE.bazel": "88af1c246226d87e65be78ed49ecd1e6f5e98648558c14ce99176da041dc378e",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/pybind11_bazel/2.11.1/source.json": "be4789e951dd5301282729fe3d4938995dc4c1a81c2ff150afc9f1b0504c6022",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/re2/2023-09-01/MODULE.bazel": "cb3d511531b16cfc78a225a9e2136007a48cf8a677e4264baeab57fe78a80206",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/re2/2023-09-01/source.json": "e044ce89c2883cd957a2969a43e79f7752f9656f6b20050b62f90ede21ec6eb4",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_android/0.1.1/MODULE.bazel": "48809ab0091b07ad0182defb787c4c5328bd3a278938415c00a7b69b50c4d3a8",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_android/0.1.1/source.json": "e6986b41626ee10bdc864937ffb6d6bf275bb5b9c65120e6137d56e6331f089e",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_cc/0.0.1/MODULE.bazel": "cb2aa0747f84c6c3a78dad4e2049c154f08ab9d166b1273835a8174940365647",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_cc/0.0.10/MODULE.bazel": "ec1705118f7eaedd6e118508d3d26deba2a4e76476ada7e0e3965211be012002",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_cc/0.0.13/MODULE.bazel": "0e8529ed7b323dad0775ff924d2ae5af7640b23553dfcd4d34344c7e7a867191",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_cc/0.0.14/MODULE.bazel": "5e343a3aac88b8d7af3b1b6d2093b55c347b8eefc2e7d1442f7a02dc8fea48ac",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_cc/0.0.15/MODULE.bazel": "6704c35f7b4a72502ee81f61bf88706b54f06b3cbe5558ac17e2e14666cd5dcc",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_cc/0.0.16/MODULE.bazel": "7661303b8fc1b4d7f532e54e9d6565771fea666fbdf839e0a86affcd02defe87",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_cc/0.0.2/MODULE.bazel": "6915987c90970493ab97393024c156ea8fb9f3bea953b2f3ec05c34f19b5695c",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_cc/0.0.6/MODULE.bazel": "abf360251023dfe3efcef65ab9d56beefa8394d4176dd29529750e1c57eaa33f",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_cc/0.0.8/MODULE.bazel": "964c85c82cfeb6f3855e6a07054fdb159aced38e99a5eecf7bce9d53990afa3e",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_cc/0.0.9/MODULE.bazel": "836e76439f354b89afe6a911a7adf59a6b2518fafb174483ad78a2a2fde7b1c5",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_cc/0.1.1/MODULE.bazel": "2f0222a6f229f0bf44cd711dc13c858dad98c62d52bd51d8fc3a764a83125513",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_cc/0.1.2/MODULE.bazel": "557ddc3a96858ec0d465a87c0a931054d7dcfd6583af2c7ed3baf494407fd8d0",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_cc/0.1.2/source.json": "53fcb09b5816c83ca60d9d7493faf3bfaf410dfc2f15deb52d6ddd146b8d43f0",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_foreign_cc/0.9.0/MODULE.bazel": "c9e8c682bf75b0e7c704166d79b599f93b72cfca5ad7477df596947891feeef6",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_fuzzing/0.5.2/MODULE.bazel": "40c97d1144356f52905566c55811f13b299453a14ac7769dfba2ac38192337a8",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_fuzzing/0.5.2/source.json": "c8b1e2c717646f1702290959a3302a178fb639d987ab61d548105019f11e527e",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_java/4.0.0/MODULE.bazel": "5a78a7ae82cd1a33cef56dc578c7d2a46ed0dca12643ee45edbb8417899e6f74",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_java/5.3.5/MODULE.bazel": "a4ec4f2db570171e3e5eb753276ee4b389bae16b96207e9d3230895c99644b86",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_java/6.0.0/MODULE.bazel": "8a43b7df601a7ec1af61d79345c17b31ea1fedc6711fd4abfd013ea612978e39",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_java/6.4.0/MODULE.bazel": "e986a9fe25aeaa84ac17ca093ef13a4637f6107375f64667a15999f77db6c8f6",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_java/6.5.2/MODULE.bazel": "1d440d262d0e08453fa0c4d8f699ba81609ed0e9a9a0f02cd10b3e7942e61e31",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_java/7.10.0/MODULE.bazel": "530c3beb3067e870561739f1144329a21c851ff771cd752a49e06e3dc9c2e71a",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_java/7.12.2/MODULE.bazel": "579c505165ee757a4280ef83cda0150eea193eed3bef50b1004ba88b99da6de6",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_java/7.2.0/MODULE.bazel": "06c0334c9be61e6cef2c8c84a7800cef502063269a5af25ceb100b192453d4ab",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_java/7.3.2/MODULE.bazel": "50dece891cfdf1741ea230d001aa9c14398062f2b7c066470accace78e412bc2",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_java/7.6.1/MODULE.bazel": "2f14b7e8a1aa2f67ae92bc69d1ec0fa8d9f827c4e17ff5e5f02e91caa3b2d0fe",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_java/8.14.0/MODULE.bazel": "717717ed40cc69994596a45aec6ea78135ea434b8402fb91b009b9151dd65615",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_java/8.14.0/source.json": "8a88c4ca9e8759da53cddc88123880565c520503321e2566b4e33d0287a3d4bc",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_java/8.3.2/MODULE.bazel": "7336d5511ad5af0b8615fdc7477535a2e4e723a357b6713af439fe8cf0195017",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_java/8.5.1/MODULE.bazel": "d8a9e38cc5228881f7055a6079f6f7821a073df3744d441978e7a43e20226939",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_jvm_external/4.4.2/MODULE.bazel": "a56b85e418c83eb1839819f0b515c431010160383306d13ec21959ac412d2fe7",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_jvm_external/5.1/MODULE.bazel": "33f6f999e03183f7d088c9be518a63467dfd0be94a11d0055fe2d210f89aa909",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_jvm_external/5.2/MODULE.bazel": "d9351ba35217ad0de03816ef3ed63f89d411349353077348a45348b096615036",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_jvm_external/5.3/MODULE.bazel": "bf93870767689637164657731849fb887ad086739bd5d360d90007a581d5527d",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_jvm_external/6.1/MODULE.bazel": "75b5fec090dbd46cf9b7d8ea08cf84a0472d92ba3585b476f44c326eda8059c4",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_jvm_external/6.3/MODULE.bazel": "c998e060b85f71e00de5ec552019347c8bca255062c990ac02d051bb80a38df0",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_jvm_external/6.3/source.json": "6f5f5a5a4419ae4e37c35a5bb0a6ae657ed40b7abc5a5189111b47fcebe43197",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_kotlin/1.9.0/MODULE.bazel": "ef85697305025e5a61f395d4eaede272a5393cee479ace6686dba707de804d59",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_kotlin/1.9.6/MODULE.bazel": "d269a01a18ee74d0335450b10f62c9ed81f2321d7958a2934e44272fe82dcef3",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_kotlin/1.9.6/source.json": "2faa4794364282db7c06600b7e5e34867a564ae91bda7cae7c29c64e9466b7d5",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_license/0.0.3/MODULE.bazel": "627e9ab0247f7d1e05736b59dbb1b6871373de5ad31c3011880b4133cafd4bd0",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_license/0.0.7/MODULE.bazel": "088fbeb0b6a419005b89cf93fe62d9517c0a2b8bb56af3244af65ecfe37e7d5d",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_license/1.0.0/MODULE.bazel": "a7fda60eefdf3d8c827262ba499957e4df06f659330bbe6cdbdb975b768bb65c",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_license/1.0.0/source.json": "a52c89e54cc311196e478f8382df91c15f7a2bfdf4c6cd0e2675cc2ff0b56efb",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_pkg/0.7.0/MODULE.bazel": "df99f03fc7934a4737122518bb87e667e62d780b610910f0447665a7e2be62dc",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_pkg/1.0.1/MODULE.bazel": "5b1df97dbc29623bccdf2b0dcd0f5cb08e2f2c9050aab1092fd39a41e82686ff",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_pkg/1.0.1/source.json": "bd82e5d7b9ce2d31e380dd9f50c111d678c3bdaca190cb76b0e1c71b05e1ba8a",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_proto/4.0.0/MODULE.bazel": "a7a7b6ce9bee418c1a760b3d84f83a299ad6952f9903c67f19e4edd964894e06",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_proto/5.3.0-21.7/MODULE.bazel": "e8dff86b0971688790ae75528fe1813f71809b5afd57facb44dad9e8eca631b7",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_proto/6.0.2/MODULE.bazel": "ce916b775a62b90b61888052a416ccdda405212b6aaeb39522f7dc53431a5e73",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_proto/7.0.2/MODULE.bazel": "bf81793bd6d2ad89a37a40693e56c61b0ee30f7a7fdbaf3eabbf5f39de47dea2",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_proto/7.0.2/source.json": "1e5e7260ae32ef4f2b52fd1d0de8d03b606a44c91b694d2f1afb1d3b28a48ce1",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_python/0.10.2/MODULE.bazel": "cc82bc96f2997baa545ab3ce73f196d040ffb8756fd2d66125a530031cd90e5f",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_python/0.23.1/MODULE.bazel": "49ffccf0511cb8414de28321f5fcf2a31312b47c40cc21577144b7447f2bf300",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_python/0.25.0/MODULE.bazel": "72f1506841c920a1afec76975b35312410eea3aa7b63267436bfb1dd91d2d382",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_python/0.27.1/MODULE.bazel": "65dc875cc1a06c30d5bbdba7ab021fd9e551a6579e408a3943a61303e2228a53",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_python/0.28.0/MODULE.bazel": "cba2573d870babc976664a912539b320cbaa7114cd3e8f053c720171cde331ed",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_python/0.31.0/MODULE.bazel": "93a43dc47ee570e6ec9f5779b2e64c1476a6ce921c48cc9a1678a91dd5f8fd58",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_python/0.4.0/MODULE.bazel": "9208ee05fd48bf09ac60ed269791cf17fb343db56c8226a720fbb1cdf467166c",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_python/0.40.0/MODULE.bazel": "9d1a3cd88ed7d8e39583d9ffe56ae8a244f67783ae89b60caafc9f5cf318ada7",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_python/1.3.0/MODULE.bazel": "8361d57eafb67c09b75bf4bbe6be360e1b8f4f18118ab48037f2bd50aa2ccb13",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_python/1.3.0/source.json": "25932f917cd279c7baefa6cb1d3fa8750a7a29de522024449b19af6eab51f4a0",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_shell/0.2.0/MODULE.bazel": "fda8a652ab3c7d8fee214de05e7a9916d8b28082234e8d2c0094505c5268ed3c",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_shell/0.3.0/MODULE.bazel": "de4402cd12f4cc8fda2354fce179fdb068c0b9ca1ec2d2b17b3e21b24c1a937b",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/rules_shell/0.3.0/source.json": "c55ed591aa5009401ddf80ded9762ac32c358d2517ee7820be981e2de9756cf3",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/stardoc/0.5.1/MODULE.bazel": "1a05d92974d0c122f5ccf09291442580317cdd859f07a8655f1db9a60374f9f8",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/stardoc/0.5.3/MODULE.bazel": "c7f6948dae6999bf0db32c1858ae345f112cacf98f174c7a8bb707e41b974f1c",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/stardoc/0.5.6/MODULE.bazel": "c43dabc564990eeab55e25ed61c07a1aadafe9ece96a4efabb3f8bf9063b71ef",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/stardoc/0.7.0/MODULE.bazel": "05e3d6d30c099b6770e97da986c53bd31844d7f13d41412480ea265ac9e8079c",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/stardoc/0.7.1/MODULE.bazel": "3548faea4ee5dda5580f9af150e79d0f6aea934fc60c1cc50f4efdd9420759e7",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/stardoc/0.7.2/MODULE.bazel": "fc152419aa2ea0f51c29583fab1e8c99ddefd5b3778421845606ee628629e0e5",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/stardoc/0.7.2/source.json": "58b029e5e901d6802967754adf0a9056747e8176f017cfe3607c0851f4d42216",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/swift_argument_parser/1.3.1.1/MODULE.bazel": "5e463fbfba7b1701d957555ed45097d7f984211330106ccd1352c6e0af0dcf91",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/swift_argument_parser/1.3.1.1/source.json": "32bd87e5f4d7acc57c5b2ff7c325ae3061d5e242c0c4c214ae87e0f1c13e54cb",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/upb/0.0.0-20220923-a547704/MODULE.bazel": "7298990c00040a0e2f121f6c32544bab27d4452f80d9ce51349b1a28f3005c43",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/zlib/1.2.11/MODULE.bazel": "07b389abc85fdbca459b69e2ec656ae5622873af3f845e1c9d80fe179f3effa0",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/zlib/1.3.1.bcr.5/MODULE.bazel": "eec517b5bbe5492629466e11dae908d043364302283de25581e3eb944326c4ca",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/zlib/1.3.1.bcr.5/source.json": "22bc55c47af97246cfc093d0acf683a7869377de362b5d1c552c2c2e16b7a806",
+ "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/zlib/1.3.1/MODULE.bazel": "751c9940dcfe869f5f7274e1295422a34623555916eb98c174c1e945594bf198"
},
"selectedYankedVersions": {},
"moduleExtensions": {
diff --git a/README.md b/README.md
index 22582050..79f325aa 100644
--- a/README.md
+++ b/README.md
@@ -1,72 +1,116 @@
-# ๐ป Ghostgram iOS
+# Telegram iOS Source Code Compilation Guide
-
-
-
+We welcome all developers to use our API and source code to create applications on our platform.
+There are several things we require from **all developers** for the moment.
-
- The ultimate Telegram fork for privacy, control, and freedom.
-
+# Creating your Telegram Application
-
-
-
-
-
+1. [**Obtain your own api_id**](https://core.telegram.org/api/obtaining_api_id) for your application.
+2. Please **do not** use the name Telegram for your app โ or make sure your users understand that it is unofficial.
+3. Kindly **do not** use our standard logo (white paper plane in a blue circle) as your app's logo.
+3. Please study our [**security guidelines**](https://core.telegram.org/mtproto/security_guidelines) and take good care of your users' data and privacy.
+4. Please remember to publish **your** code too in order to comply with the licences.
----
+# Quick Compilation Guide
-## ๐ Key Features
+## Get the Code
-### ๐ก๏ธ Anti-Delete System
-*Never miss a message again. Ghostgram keeps what others try to hide.*
-- **Local Archive:** Automatically saves messages deleted by the sender for everyone.
-- **Media Preservation:** Photos and videos from deleted messages are archived locally.
-- **Edit History:** View original content of edited messages.
-- **Visual Indicators:** Deleted messages are clearly marked with a ๐๏ธ icon.
+```
+git clone --recursive -j8 https://github.com/TelegramMessenger/Telegram-iOS.git
+```
-### ๐ค Ghost Mode
-- **Invisible Reading:** Read messages without sending "Read" receipts (single checkmark).
-- **Stealth Stories:** View stories anonymously without appearing in the viewer list.
-- **Hidden Input:** Hide "Typing..." status from your contacts.
-- **Online Privacy:** Hide your online status or use **Force Offline** to always appear as "last seen recently".
+## Setup Xcode
-### ๐๏ธ Advanced Audio Tools
-- **Free Transcription:** Get text from voice and video messages without Telegram Premium (On-device processing).
-- **Voice Morpher:** Real-time voice changer for your outgoing audio messages.
+Install Xcode (directly from https://developer.apple.com/download/applications or using the App Store).
-### ๐ Bypass Limits
-- **Copy Protection Bypass:** Forward or save content from channels that have restricted it.
-- **Infinite View-Once:** View-once media stays available as long as you need.
-- **Secret Screenshots:** Take screenshots in secret chats without notification.
+## Adjust Configuration
-### ๐ ๏ธ More Features
-- **Device Spoofing:** Change how your device appears to others.
-- **Ad Blocker:** Say goodbye to sponsored messages in channels.
-- **Always Online:** Keep your status active even when the app is in the background.
+1. Generate a random identifier:
+```
+openssl rand -hex 8
+```
+2. Create a new Xcode project. Use `Telegram` as the Product Name. Use `org.{identifier from step 1}` as the Organization Identifier.
+3. Open `Keychain Access` and navigate to `Certificates`. Locate `Apple Development: your@email.address (XXXXXXXXXX)` and double tap the certificate. Under `Details`, locate `Organizational Unit`. This is the Team ID.
+4. Edit `build-system/template_minimal_development_configuration.json`. Use data from the previous steps.
----
+## Generate an Xcode project
-## ๐ Installation & Building
+```
+python3 build-system/Make/Make.py \
+ --cacheDir="$HOME/telegram-bazel-cache" \
+ generateProject \
+ --configurationPath=build-system/template_minimal_development_configuration.json \
+ --xcodeManagedCodesigning
+```
-Ghostgram is a developer-centric fork. To build it from source, follow our detailed guide:
+# Advanced Compilation Guide
-๐ **[Build & Compilation Guide](BUILD.md)**
+## Xcode
----
+1. Copy and edit `build-system/appstore-configuration.json`.
+2. Copy `build-system/fake-codesigning`. Create and download provisioning profiles, using the `profiles` folder as a reference for the entitlements.
+3. Generate an Xcode project:
+```
+python3 build-system/Make/Make.py \
+ --cacheDir="$HOME/telegram-bazel-cache" \
+ generateProject \
+ --configurationPath=configuration_from_step_1.json \
+ --codesigningInformationPath=directory_from_step_2
+```
-## โ ๏ธ Disclaimer & Legal
+## IPA
-> **Educational Use Only:** This is a modified version of the Telegram client. Use it at your own risk. The developer is not responsible for any account bans or data loss.
+1. Repeat the steps from the previous section. Use distribution provisioning profiles.
+2. Run:
+```
+python3 build-system/Make/Make.py \
+ --cacheDir="$HOME/telegram-bazel-cache" \
+ build \
+ --configurationPath=...see previous section... \
+ --codesigningInformationPath=...see previous section... \
+ --buildNumber=100001 \
+ --configuration=release_arm64
+```
-- **Unofficial:** This project is not affiliated with, endorsed by, or in any way officially connected with Telegram Messenger Inc.
-- **Terms of Service:** Using third-party clients may violate Telegram's ToS.
-- **License:** Based on [Telegram-iOS](https://github.com/TelegramMessenger/Telegram-iOS), licensed under **GPLv2**.
+# FAQ
----
+## Xcode is stuck at "build-request.json not updated yet"
-### ๐จโ๐ป Support & Community
-Report issues or join the discussion:
-- **Telegram:** [@ceopoco](https://t.me/ceosppw)
+Occasionally, you might observe the following message in your build log:
+```
+"/Users/xxx/Library/Developer/Xcode/DerivedData/Telegram-xxx/Build/Intermediates.noindex/XCBuildData/xxx.xcbuilddata/build-request.json" not updated yet, waiting...
+```
-**Made with ๐ค for the community.**
+Should this occur, simply cancel the ongoing build and initiate a new one.
+
+## Telegram_xcodeproj: no such package
+
+Following a system restart, the auto-generated Xcode project might encounter a build failure accompanied by this error:
+```
+ERROR: Skipping '@rules_xcodeproj_generated//generator/Telegram/Telegram_xcodeproj:Telegram_xcodeproj': no such package '@rules_xcodeproj_generated//generator/Telegram/Telegram_xcodeproj': BUILD file not found in directory 'generator/Telegram/Telegram_xcodeproj' of external repository @rules_xcodeproj_generated. Add a BUILD file to a directory to mark it as a package.
+```
+
+If you encounter this issue, re-run the project generation steps in the README.
+
+
+# Tips
+
+## Codesigning is not required for simulator-only builds
+
+Add `--disableProvisioningProfiles`:
+```
+python3 build-system/Make/Make.py \
+ --cacheDir="$HOME/telegram-bazel-cache" \
+ generateProject \
+ --configurationPath=path-to-configuration.json \
+ --codesigningInformationPath=path-to-provisioning-data \
+ --disableProvisioningProfiles
+```
+
+## Versions
+
+Each release is built using a specific Xcode version (see `versions.json`). The helper script checks the versions of the installed software and reports an error if they don't match the ones specified in `versions.json`. It is possible to bypass these checks:
+
+```
+python3 build-system/Make/Make.py --overrideXcodeVersion build ... # Don't check the version of Xcode
+```
diff --git a/Telegram/BUILD b/Telegram/BUILD
index 74b3ecae..4b84ab9c 100644
--- a/Telegram/BUILD
+++ b/Telegram/BUILD
@@ -8,8 +8,6 @@ load("@build_bazel_rules_apple//apple:ios.bzl",
"ios_application",
"ios_extension",
"ios_framework",
- "ios_unit_test",
- "ios_ui_test",
)
load("@build_bazel_rules_apple//apple:resources.bzl",
@@ -22,7 +20,6 @@ load("@build_bazel_rules_swift//swift:swift.bzl",
load(
"@rules_xcodeproj//xcodeproj:defs.bzl",
- "top_level_target",
"top_level_targets",
"xcodeproj",
"xcode_provisioning_profile",
@@ -338,6 +335,7 @@ filegroup(
objc_library(
name = "Main",
+ module_name = "Main",
srcs = [
"Telegram-iOS/main.m"
],
@@ -345,6 +343,7 @@ objc_library(
swift_library(
name = "Lib",
+ module_name = "Lib",
srcs = glob([
"Telegram-iOS/Application.swift",
]),
@@ -1810,7 +1809,7 @@ ios_application(
#"//third-party/boringssl:ssl",
#"//third-party/boringssl:crypto",
#"//submodules/TelegramVoip",
- #"//third-party/recaptcha:RecaptchaEnterprise",
+ #"//third-party/recaptcha:RecaptchaEnterpriseSDK",
"//submodules/TelegramUI",
],
)
diff --git a/Telegram/Telegram-iOS/Config-AppStoreLLC.xcconfig b/Telegram/Telegram-iOS/Config-AppStoreLLC.xcconfig
index a220df74..76c1f1e5 100644
--- a/Telegram/Telegram-iOS/Config-AppStoreLLC.xcconfig
+++ b/Telegram/Telegram-iOS/Config-AppStoreLLC.xcconfig
@@ -5,4 +5,4 @@ APP_SPECIFIC_URL_SCHEME=tgapp
GLOBAL_CONSTANTS = APP_CONFIG_IS_INTERNAL_BUILD=false APP_CONFIG_IS_APPSTORE_BUILD=true APP_CONFIG_APPSTORE_ID=686449807 APP_SPECIFIC_URL_SCHEME="\"$(APP_SPECIFIC_URL_SCHEME)\""
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) $(GLOBAL_CONSTANTS)
-GCC_PREPROCESSOR_DEFINITIONS = $(inherited) APP_CONFIG_API_ID=YOUR_API_ID APP_CONFIG_API_HASH="\"YOUR_API_HASH\"" APP_CONFIG_HOCKEYAPP_ID="\"ad8831329ffc8f8aff9a2b0b86558b24\""
+GCC_PREPROCESSOR_DEFINITIONS = $(inherited) APP_CONFIG_API_ID=8 APP_CONFIG_API_HASH="\"7245de8e747a0d6fbe11f7cc14fcc0bb\"" APP_CONFIG_HOCKEYAPP_ID="\"ad8831329ffc8f8aff9a2b0b86558b24\""
diff --git a/Telegram/Telegram-iOS/Config-Fork.xcconfig b/Telegram/Telegram-iOS/Config-Fork.xcconfig
index 2e78f776..c3192251 100644
--- a/Telegram/Telegram-iOS/Config-Fork.xcconfig
+++ b/Telegram/Telegram-iOS/Config-Fork.xcconfig
@@ -5,4 +5,4 @@ APP_SPECIFIC_URL_SCHEME=tgfork
GLOBAL_CONSTANTS = APP_CONFIG_IS_INTERNAL_BUILD=false APP_CONFIG_IS_APPSTORE_BUILD=true APP_CONFIG_APPSTORE_ID=0 APP_SPECIFIC_URL_SCHEME="\"$(APP_SPECIFIC_URL_SCHEME)\""
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) $(GLOBAL_CONSTANTS)
-GCC_PREPROCESSOR_DEFINITIONS = $(inherited) APP_CONFIG_API_ID=YOUR_API_ID APP_CONFIG_API_HASH="\"YOUR_API_HASH\"" APP_CONFIG_HOCKEYAPP_ID="\"\""
\ No newline at end of file
+GCC_PREPROCESSOR_DEFINITIONS = $(inherited) APP_CONFIG_API_ID=8 APP_CONFIG_API_HASH="\"7245de8e747a0d6fbe11f7cc14fcc0bb\"" APP_CONFIG_HOCKEYAPP_ID="\"\""
\ No newline at end of file
diff --git a/Telegram/Telegram-iOS/DefaultAppIcon.xcassets/AppIconLLC.appiconset/Contents.json b/Telegram/Telegram-iOS/DefaultAppIcon.xcassets/AppIconLLC.appiconset/Contents.json
index 4d654570..221e2b44 100644
--- a/Telegram/Telegram-iOS/DefaultAppIcon.xcassets/AppIconLLC.appiconset/Contents.json
+++ b/Telegram/Telegram-iOS/DefaultAppIcon.xcassets/AppIconLLC.appiconset/Contents.json
@@ -1,115 +1,116 @@
{
- "images" : [
+ "images": [
{
- "filename" : "BlueNotificationIcon@2x.png",
- "idiom" : "iphone",
- "scale" : "2x",
- "size" : "20x20"
+ "filename": "GhostIcon@40x40.png",
+ "idiom": "iphone",
+ "scale": "2x",
+ "size": "20x20"
},
{
- "filename" : "BlueNotificationIcon@3x.png",
- "idiom" : "iphone",
- "scale" : "3x",
- "size" : "20x20"
+ "filename": "GhostIcon@60x60.png",
+ "idiom": "iphone",
+ "scale": "3x",
+ "size": "20x20"
},
{
- "filename" : "Simple@58x58.png",
- "idiom" : "iphone",
- "scale" : "2x",
- "size" : "29x29"
+ "filename": "GhostIcon@58x58.png",
+ "idiom": "iphone",
+ "scale": "2x",
+ "size": "29x29"
},
{
- "filename" : "Simple@87x87.png",
- "idiom" : "iphone",
- "scale" : "3x",
- "size" : "29x29"
+ "filename": "GhostIcon@87x87.png",
+ "idiom": "iphone",
+ "scale": "3x",
+ "size": "29x29"
},
{
- "filename" : "Simple@80x80.png",
- "idiom" : "iphone",
- "scale" : "2x",
- "size" : "40x40"
+ "filename": "GhostIcon@80x80.png",
+ "idiom": "iphone",
+ "scale": "2x",
+ "size": "40x40"
},
{
- "filename" : "BlueIcon@2x-1.png",
- "idiom" : "iphone",
- "scale" : "3x",
- "size" : "40x40"
+ "filename": "GhostIcon@120x120.png",
+ "idiom": "iphone",
+ "scale": "3x",
+ "size": "40x40"
},
{
- "filename" : "BlueIcon@2x.png",
- "idiom" : "iphone",
- "scale" : "2x",
- "size" : "60x60"
+ "filename": "GhostIcon@120x120.png",
+ "idiom": "iphone",
+ "scale": "2x",
+ "size": "60x60"
},
{
- "filename" : "BlueIcon@3x.png",
- "idiom" : "iphone",
- "scale" : "3x",
- "size" : "60x60"
+ "filename": "GhostIcon@180x180.png",
+ "idiom": "iphone",
+ "scale": "3x",
+ "size": "60x60"
},
{
- "filename" : "BlueNotificationIcon.png",
- "idiom" : "ipad",
- "scale" : "1x",
- "size" : "20x20"
+ "filename": "GhostIcon@20x20.png",
+ "idiom": "ipad",
+ "scale": "1x",
+ "size": "20x20"
},
{
- "filename" : "BlueNotificationIcon@2x-1.png",
- "idiom" : "ipad",
- "scale" : "2x",
- "size" : "20x20"
+ "filename": "GhostIcon@40x40.png",
+ "idiom": "ipad",
+ "scale": "2x",
+ "size": "20x20"
},
{
- "filename" : "Simple@29x29.png",
- "idiom" : "ipad",
- "scale" : "1x",
- "size" : "29x29"
+ "filename": "GhostIcon@29x29.png",
+ "idiom": "ipad",
+ "scale": "1x",
+ "size": "29x29"
},
{
- "filename" : "Simple@58x58-1.png",
- "idiom" : "ipad",
- "scale" : "2x",
- "size" : "29x29"
+ "filename": "GhostIcon@58x58.png",
+ "idiom": "ipad",
+ "scale": "2x",
+ "size": "29x29"
},
{
- "filename" : "Simple@40x40-1.png",
- "idiom" : "ipad",
- "scale" : "1x",
- "size" : "40x40"
+ "filename": "GhostIcon@40x40.png",
+ "idiom": "ipad",
+ "scale": "1x",
+ "size": "40x40"
},
{
- "filename" : "Simple@80x80-1.png",
- "idiom" : "ipad",
- "scale" : "2x",
- "size" : "40x40"
+ "filename": "GhostIcon@80x80.png",
+ "idiom": "ipad",
+ "scale": "2x",
+ "size": "40x40"
},
{
- "idiom" : "ipad",
- "scale" : "1x",
- "size" : "76x76"
+ "filename": "GhostIcon@76x76.png",
+ "idiom": "ipad",
+ "scale": "1x",
+ "size": "76x76"
},
{
- "filename" : "BlueIconIpad@2x.png",
- "idiom" : "ipad",
- "scale" : "2x",
- "size" : "76x76"
+ "filename": "GhostIcon@152x152.png",
+ "idiom": "ipad",
+ "scale": "2x",
+ "size": "76x76"
},
{
- "filename" : "BlueIconLargeIpad@2x.png",
- "idiom" : "ipad",
- "scale" : "2x",
- "size" : "83.5x83.5"
+ "filename": "GhostIcon@167x167.png",
+ "idiom": "ipad",
+ "scale": "2x",
+ "size": "83.5x83.5"
},
{
- "filename" : "Simple-iTunesArtwork.png",
- "idiom" : "ios-marketing",
- "scale" : "1x",
- "size" : "1024x1024"
+ "filename": "GhostIcon@1024x1024.png",
+ "idiom": "ios-marketing",
+ "scale": "1x",
+ "size": "1024x1024"
}
],
- "info" : {
- "author" : "xcode",
- "version" : 1
+ "info": {
+ "author": "xcode",
+ "version": 1
}
-}
+}
\ No newline at end of file
diff --git a/Telegram/Telegram-iOS/IconDefault-60@2x.png b/Telegram/Telegram-iOS/IconDefault-60@2x.png
index 9525324b..bc3738e3 100644
Binary files a/Telegram/Telegram-iOS/IconDefault-60@2x.png and b/Telegram/Telegram-iOS/IconDefault-60@2x.png differ
diff --git a/Telegram/Telegram-iOS/IconDefault-60@3x.png b/Telegram/Telegram-iOS/IconDefault-60@3x.png
index facbf49f..336e7bd2 100644
Binary files a/Telegram/Telegram-iOS/IconDefault-60@3x.png and b/Telegram/Telegram-iOS/IconDefault-60@3x.png differ
diff --git a/Telegram/Telegram-iOS/IconDefault-76.png b/Telegram/Telegram-iOS/IconDefault-76.png
index 07de5603..88823054 100644
Binary files a/Telegram/Telegram-iOS/IconDefault-76.png and b/Telegram/Telegram-iOS/IconDefault-76.png differ
diff --git a/Telegram/Telegram-iOS/IconDefault-76@2x.png b/Telegram/Telegram-iOS/IconDefault-76@2x.png
index d71dcd20..b7d12ca8 100644
Binary files a/Telegram/Telegram-iOS/IconDefault-76@2x.png and b/Telegram/Telegram-iOS/IconDefault-76@2x.png differ
diff --git a/Telegram/Telegram-iOS/IconDefault-83.5@2x.png b/Telegram/Telegram-iOS/IconDefault-83.5@2x.png
index f51ae17d..a514afb2 100644
Binary files a/Telegram/Telegram-iOS/IconDefault-83.5@2x.png and b/Telegram/Telegram-iOS/IconDefault-83.5@2x.png differ
diff --git a/Telegram/Telegram-iOS/IconDefault-Small-40.png b/Telegram/Telegram-iOS/IconDefault-Small-40.png
index e2b1ba78..7425a650 100644
Binary files a/Telegram/Telegram-iOS/IconDefault-Small-40.png and b/Telegram/Telegram-iOS/IconDefault-Small-40.png differ
diff --git a/Telegram/Telegram-iOS/IconDefault-Small-40@2x.png b/Telegram/Telegram-iOS/IconDefault-Small-40@2x.png
index 8d4fe9ef..4a76bc85 100644
Binary files a/Telegram/Telegram-iOS/IconDefault-Small-40@2x.png and b/Telegram/Telegram-iOS/IconDefault-Small-40@2x.png differ
diff --git a/Telegram/Telegram-iOS/IconDefault-Small-40@3x.png b/Telegram/Telegram-iOS/IconDefault-Small-40@3x.png
index 9525324b..bc3738e3 100644
Binary files a/Telegram/Telegram-iOS/IconDefault-Small-40@3x.png and b/Telegram/Telegram-iOS/IconDefault-Small-40@3x.png differ
diff --git a/Telegram/Telegram-iOS/IconDefault-Small.png b/Telegram/Telegram-iOS/IconDefault-Small.png
index 4865bb8b..840c5956 100644
Binary files a/Telegram/Telegram-iOS/IconDefault-Small.png and b/Telegram/Telegram-iOS/IconDefault-Small.png differ
diff --git a/Telegram/Telegram-iOS/IconDefault-Small@2x.png b/Telegram/Telegram-iOS/IconDefault-Small@2x.png
index b9f52c59..b54ab402 100644
Binary files a/Telegram/Telegram-iOS/IconDefault-Small@2x.png and b/Telegram/Telegram-iOS/IconDefault-Small@2x.png differ
diff --git a/Telegram/Telegram-iOS/IconDefault-Small@3x.png b/Telegram/Telegram-iOS/IconDefault-Small@3x.png
index 95b278c2..0b4de296 100644
Binary files a/Telegram/Telegram-iOS/IconDefault-Small@3x.png and b/Telegram/Telegram-iOS/IconDefault-Small@3x.png differ
diff --git a/Telegram/Telegram-iOS/InfoBazel.plist b/Telegram/Telegram-iOS/InfoBazel.plist
index ae1b92de..e0172c99 100644
--- a/Telegram/Telegram-iOS/InfoBazel.plist
+++ b/Telegram/Telegram-iOS/InfoBazel.plist
@@ -110,17 +110,17 @@
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.
+ Ghostgram 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.
+ When you send your location to your friends, Ghostgram 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.
+ When you send your location to your friends, Ghostgram 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.
+ When you send your location to your friends, Ghostgram needs access to show them a map.
NSPhotoLibraryAddUsageDescription
We need this so that you can share photos and videos from your photo library.
NSPhotoLibraryUsageDescription
@@ -188,7 +188,7 @@
public.data
UTTypeDescription
- Telegram iOS Color Theme File
+ Ghostgram iOS Color Theme File
UTTypeIconFiles
BlueIcon@3x.png
diff --git a/Telegram/Telegram-iOS/Resources/Cocoon.tgs b/Telegram/Telegram-iOS/Resources/Cocoon.tgs
new file mode 100644
index 00000000..9eba8213
Binary files /dev/null and b/Telegram/Telegram-iOS/Resources/Cocoon.tgs differ
diff --git a/Telegram/Telegram-iOS/en.lproj/InfoPlist.strings b/Telegram/Telegram-iOS/en.lproj/InfoPlist.strings
index ca338663..0daf084e 100644
--- a/Telegram/Telegram-iOS/en.lproj/InfoPlist.strings
+++ b/Telegram/Telegram-iOS/en.lproj/InfoPlist.strings
@@ -1,12 +1,16 @@
/* Localized versions of Info.plist keys */
-"NSContactsUsageDescription" = "Telegram will continuously upload your contacts to its heavily encrypted cloud servers to let you connect with your friends across all your devices.";
-"NSLocationWhenInUseUsageDescription" = "When you send your location to your friends, Telegram needs access to show them a map.";
-"NSLocationAlwaysAndWhenInUseUsageDescription" = "When you choose to share your Live Location with friends in a chat, Telegram needs background access to your location to keep them updated for the duration of the live sharing.";
-"NSLocationAlwaysUsageDescription" = "When you choose to share your live location with friends in a chat, Telegram needs background access to your location to keep them updated for the duration of the live sharing. You also need this to send locations from an Apple Watch.";
+/* GHOSTGRAM: App display name */
+"CFBundleDisplayName" = "Ghostgram";
+"CFBundleName" = "Ghostgram";
+
+"NSContactsUsageDescription" = "Ghostgram will continuously upload your contacts to its heavily encrypted cloud servers to let you connect with your friends across all your devices.";
+"NSLocationWhenInUseUsageDescription" = "When you send your location to your friends, Ghostgram needs access to show them a map.";
+"NSLocationAlwaysAndWhenInUseUsageDescription" = "When you choose to share your Live Location with friends in a chat, Ghostgram needs background access to your location to keep them updated for the duration of the live sharing.";
+"NSLocationAlwaysUsageDescription" = "When you choose to share your live location with friends in a chat, Ghostgram needs background access to your location to keep them updated for the duration of the live sharing. You also need this to send locations from an Apple Watch.";
"NSCameraUsageDescription" = "We need this so that you can take and share photos and videos, as well as make video calls.";
-"NSPhotoLibraryUsageDescription" = "We need this so that you can share photos and videos from your photo library.";
-"NSPhotoLibraryAddUsageDescription" = "We need this so that you can save photos and videos to your photo library.";
+"NSPhotoLibraryUsageDescription" = "We need this so that you can share photos and videos from your photo library and save the ones you capture.";
+"NSPhotoLibraryAddUsageDescription" = "We need this so that you can save photos and videos to your photo library and save the ones you capture.";
"NSMicrophoneUsageDescription" = "We need this so that you can record and share voice messages and videos with sound.";
"NSSiriUsageDescription" = "You can use Siri to send messages.";
"NSFaceIDUsageDescription" = "You can use Face ID to unlock the app.";
diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings
index 597ef1ad..16b14dc7 100644
--- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings
+++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings
@@ -4856,12 +4856,9 @@ Sorry for the inconvenience.";
"Conversation.SendMessage.SetReminder" = "Set a Reminder";
-"Conversation.SelectedMessages_1" = "%@ Selected";
-"Conversation.SelectedMessages_2" = "%@ Selected";
-"Conversation.SelectedMessages_3_10" = "%@ Selected";
-"Conversation.SelectedMessages_any" = "%@ Selected";
-"Conversation.SelectedMessages_many" = "%@ Selected";
-"Conversation.SelectedMessages_0" = "%@ Selected";
+"Conversation.SelectedMessagesFormat_1" = "{} Selected";
+"Conversation.SelectedMessagesFormat_any" = "{} Selected";
+
"AccentColor.Title" = "Accent Color";
@@ -15459,6 +15456,8 @@ Error: %8$@";
"Notification.StarsGiftOffer.Expired" = "%1$@ didn't respond to your offer for %2$@ within %3$@ โ your %4$@ have been refunded";
"Notification.StarsGiftOffer.Expired.Stars_1" = "%@ Star";
"Notification.StarsGiftOffer.Expired.Stars_any" = "%@ Stars";
+"Notification.StarsGiftOffer.Expired.Hours_1" = "%@ hours";
+"Notification.StarsGiftOffer.Expired.Hours_any" = "%@ hours";
"Notification.StarsGiftOffer.ExpiredYou" = "The offer from %1$@ to buy your %2$@ for %3$@ has expired";
"Notification.StarsGiftOffer.ExpiredYou.Stars_1" = "%@ Star";
"Notification.StarsGiftOffer.ExpiredYou.Stars_any" = "%@ Stars";
@@ -15623,3 +15622,50 @@ Error: %8$@";
"Chat.GiftPurchaseOffer.AcceptConfirmation.BadValue" = "The value of this gift is **%@** higher than the offer.";
"Chat.GiftPurchaseOffer.AcceptConfirmation.Confirm" = "Confirm Sale";
+"Notification.PremiumGift.DaysTitle_1" = "%@ Day Premium";
+"Notification.PremiumGift.DaysTitle_any" = "%@ Days Premium";
+
+"MediaEditor.Audio.Title" = "Audio";
+"MediaEditor.Audio.SavedMusic" = "SAVED MUSIC";
+"MediaEditor.Audio.ShowMore" = "Show More";
+
+"WebApp.AddToAttachmentTitle" = "Add to Attachment Menu";
+
+"Gift.Upgrade.Wearable.Title" = "Wearable";
+"Gift.Upgrade.Wearable.Text" = "Display gifts on your page and set them as profile covers or statuses.";
+"Gift.Upgrade.ViewAllVariants" = "View all variants";
+
+"CocoonInfo.Title" = "COCOON";
+"CocoonInfo.Description" = "**Cocoon** (**Co**nfidential **Co**mpute **O**pen **N**etwork) handles AI tasks **safely** and **efficiently**.";
+"CocoonInfo.Private.Title" = "Private";
+"CocoonInfo.Private.Text" = "No third party can access any data, such as translations, inside Cocoon.";
+"CocoonInfo.Efficient.Title" = "Efficient";
+"CocoonInfo.Efficient.Text" = "Cocoon has allowed Telegram to reduce translation costs by 6x.";
+"CocoonInfo.ForEveryone.Title" = "For Everyone";
+"CocoonInfo.ForEveryone.Text" = "Any developer can use Cocoon for AI features. Learn more at [@cocoon](telegram) or [cocoon.org](web).";
+"CocoonInfo.IntergrateInfo" = "Want to integrate Cocoon into your projects?\nReach out at [t.me/cocoon?direct]()";
+"CocoonInfo.Understood" = "Understood";
+
+"Conversation.Translation.CocoonInfo" = "Translations are powered by\n**#Cocoon**. [How does it work?]()";
+
+"Conversation.EmojiStake.Won" = "%1$@ won %2$@";
+"Conversation.EmojiStake.WonYou" = "You won %@";
+"Conversation.EmojiStake.Lost" = "%1$@ lost %2$@";
+"Conversation.EmojiStake.LostYou" = "You lost %@";
+
+"Conversation.Dice.Stake" = "Stake:";
+"Conversation.Dice.Change" = "change";
+
+"EmojiStake.Title" = "Emoji Stake";
+"EmojiStake.Description" = "An experimental feature for Telegram Premium users.";
+"EmojiStake.ResultsTitle" = "RESULTS AND RETURNS";
+"EmojiStake.StreakInfo" = "A streak resets after 3 # or a stake change.";
+"EmojiStake.StakeTitle" = "STAKE";
+"EmojiStake.StakePlaceholder" = "Amount";
+"EmojiStake.Roll" = "Save and Roll";
+
+"Conversation.Summary.Title" = "AI Summary";
+"Conversation.Summary.Text" = "Tap to see original text";
+
+"Conversation.Summary.Limit.Title" = "AI Summary";
+"Conversation.Summary.Limit.Text" = "Summarize large messages with AI โ unlimited with Telegram Premium.";
diff --git a/Telegram/Telegram-iOS/ru.lproj/InfoPlist.strings b/Telegram/Telegram-iOS/ru.lproj/InfoPlist.strings
index 08c349a3..18b5cac0 100644
--- a/Telegram/Telegram-iOS/ru.lproj/InfoPlist.strings
+++ b/Telegram/Telegram-iOS/ru.lproj/InfoPlist.strings
@@ -1,7 +1,11 @@
/* Localized versions of Info.plist keys */
-"NSContactsUsageDescription" = "ะะบััะฐะปัะฝะฐั ะธะฝัะพัะผะฐัะธั ะพ ะฒะฐัะธั
ะบะพะฝัะฐะบัะฐั
ะฑัะดะตั ั
ัะฐะฝะธัััั ะทะฐัะธััะพะฒะฐะฝะฝะพะน ะฒ ะพะฑะปะฐะบะต Telegram, ััะพะฑั ะฒั ะผะพะณะปะธ ัะฒัะทะฐัััั ั ะดััะทััะผะธ ั ะปัะฑะพะณะพ ััััะพะนััะฒะฐ.";
-"NSLocationWhenInUseUsageDescription" = "ะะพะณะดะฐ ะฒั ะพัะฟัะฐะฒะปัะตัะต ะดััะทััะผ ะณะตะพะฟะพะทะธัะธั, Telegram ะฝัะถะฝะพ ัะฐะทัะตัะตะฝะธะต, ััะพะฑั ะฟะพะบะฐะทะฐัั ะธะผ ะบะฐััั.";
+/* GHOSTGRAM: App display name */
+"CFBundleDisplayName" = "Ghostgram";
+"CFBundleName" = "Ghostgram";
+
+"NSContactsUsageDescription" = "ะะบััะฐะปัะฝะฐั ะธะฝัะพัะผะฐัะธั ะพ ะฒะฐัะธั
ะบะพะฝัะฐะบัะฐั
ะฑัะดะตั ั
ัะฐะฝะธัััั ะทะฐัะธััะพะฒะฐะฝะฝะพะน ะฒ ะพะฑะปะฐะบะต Ghostgram, ััะพะฑั ะฒั ะผะพะณะปะธ ัะฒัะทะฐัััั ั ะดััะทััะผะธ ั ะปัะฑะพะณะพ ััััะพะนััะฒะฐ.";
+"NSLocationWhenInUseUsageDescription" = "ะะพะณะดะฐ ะฒั ะพัะฟัะฐะฒะปัะตัะต ะดััะทััะผ ะณะตะพะฟะพะทะธัะธั, Ghostgram ะฝัะถะฝะพ ัะฐะทัะตัะตะฝะธะต, ััะพะฑั ะฟะพะบะฐะทะฐัั ะธะผ ะบะฐััั.";
"NSLocationAlwaysAndWhenInUseUsageDescription" = "ะคะพะฝะพะฒัะน ะดะพัััะฟ ะบ ะณะตะพะฟะพะทะธัะธะธ ััะตะฑัะตััั, ััะพะฑั ะพะฑะฝะพะฒะปััั ะฒะฐัั ะณะตะพะฟะพะทะธัะธั, ะบะพะณะดะฐ ะฒั ััะฐะฝัะปะธััะตัะต ะตั ะฒ ัะฐั ั ะดััะทััะผะธ.";
"NSLocationAlwaysUsageDescription" = "ะคะพะฝะพะฒัะน ะดะพัััะฟ ะบ ะณะตะพะฟะพะทะธัะธะธ ััะตะฑัะตััั, ััะพะฑั ะพะฑะฝะพะฒะปััั ะฒะฐัั ะณะตะพะฟะพะทะธัะธั, ะบะพะณะดะฐ ะฒั ััะฐะฝัะปะธััะตัะต ะตั ะฒ ัะฐั ั ะดััะทััะผะธ. ะะฝ ัะฐะบะถะต ะฝะตะพะฑั
ะพะดะธะผ ะดะปั ะพัะฟัะฐะฒะบะธ ะณะตะพะฟะพะทะธัะธะธ ั Apple Watch.";
"NSCameraUsageDescription" = "ะญัะพ ะฝะตะพะฑั
ะพะดะธะผะพ, ััะพะฑั ะฒั ะผะพะณะปะธ ะดะตะปะธัััั ัะฝัััะผะธ ัะพัะพะณัะฐัะธัะผะธ ะธ ะฒะธะดะตะพ.";
@@ -10,3 +14,4 @@
"NSMicrophoneUsageDescription" = "ะญัะพ ะฝะตะพะฑั
ะพะดะธะผะพ, ััะพะฑั ะฒั ะผะพะณะปะธ ะดะตะปะธัััั ะณะพะปะพัะพะฒัะผะธ ัะพะพะฑัะตะฝะธัะผะธ ะธ ะฒะธะดะตะพ ัะพ ะทะฒัะบะพะผ.";
"NSSiriUsageDescription" = "ะั ะผะพะถะตัะต ะธัะฟะพะปัะทะพะฒะฐัั Siri ะดะปั ะพัะฟัะฐะฒะบะธ ัะพะพะฑัะตะฝะธะน.";
"NSFaceIDUsageDescription" = "ะั ะผะพะถะตัะต ัะฐะทะฑะปะพะบะธัะพะฒะฐัั ะฟัะธะปะพะถะตะฝะธะต ั ะฟะพะผะพััั Face ID.";
+
diff --git a/bazel-telegram-antidelete b/bazel-telegram-antidelete
new file mode 120000
index 00000000..824f1c9e
--- /dev/null
+++ b/bazel-telegram-antidelete
@@ -0,0 +1 @@
+/private/var/tmp/_bazel_ichmagmaus812/b1f80ab1863cefaee5ee828c8e6100cf/execroot/_main
\ No newline at end of file
diff --git a/build-system/Make/GenerateProfiles.py b/build-system/Make/GenerateProfiles.py
index 0992d95a..df51eb6f 100644
--- a/build-system/Make/GenerateProfiles.py
+++ b/build-system/Make/GenerateProfiles.py
@@ -5,40 +5,165 @@ import shutil
import tempfile
import plistlib
import argparse
+import subprocess
+import base64
from BuildEnvironment import run_executable_with_output, check_run_system
-def get_certificate_base64():
- certificate_data = run_executable_with_output('security', arguments=['find-certificate', '-c', 'Apple Distribution: Telegram FZ-LLC (C67CF9S4VU)', '-p'])
- certificate_data = certificate_data.replace('-----BEGIN CERTIFICATE-----', '')
- certificate_data = certificate_data.replace('-----END CERTIFICATE-----', '')
- certificate_data = certificate_data.replace('\n', '')
- return certificate_data
+def setup_temp_keychain(p12_path, p12_password=''):
+ """Create a temporary keychain and import the p12 certificate."""
+ keychain_name = 'generate-profiles-temp.keychain'
+ keychain_password = 'temp123'
+
+ # Delete if exists
+ run_executable_with_output('security', arguments=['delete-keychain', keychain_name], check_result=False)
+
+ # Create keychain
+ run_executable_with_output('security', arguments=[
+ 'create-keychain', '-p', keychain_password, keychain_name
+ ], check_result=True)
+
+ # Add to search list
+ existing = run_executable_with_output('security', arguments=['list-keychains', '-d', 'user'])
+ run_executable_with_output('security', arguments=[
+ 'list-keychains', '-d', 'user', '-s', keychain_name, existing.replace('"', '')
+ ], check_result=True)
+
+ # Unlock and set settings
+ run_executable_with_output('security', arguments=['set-keychain-settings', keychain_name])
+ run_executable_with_output('security', arguments=[
+ 'unlock-keychain', '-p', keychain_password, keychain_name
+ ])
+
+ # Import p12
+ run_executable_with_output('security', arguments=[
+ 'import', p12_path, '-k', keychain_name, '-P', p12_password,
+ '-T', '/usr/bin/codesign', '-T', '/usr/bin/security'
+ ], check_result=True)
+
+ # Set partition list for access
+ run_executable_with_output('security', arguments=[
+ 'set-key-partition-list', '-S', 'apple-tool:,apple:', '-k', keychain_password, keychain_name
+ ], check_result=True)
+
+ return keychain_name
-def process_provisioning_profile(source, destination, certificate_data):
+def cleanup_temp_keychain(keychain_name):
+ """Remove the temporary keychain."""
+ run_executable_with_output('security', arguments=['delete-keychain', keychain_name], check_result=False)
+
+
+def get_signing_identity_from_p12(p12_path, p12_password=''):
+ """Extract the common name (signing identity) from the p12 certificate."""
+ proc = subprocess.Popen(
+ ['openssl', 'pkcs12', '-in', p12_path, '-passin', 'pass:' + p12_password, '-nokeys', '-legacy'],
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE
+ )
+ cert_pem, _ = proc.communicate()
+
+ proc2 = subprocess.Popen(
+ ['openssl', 'x509', '-noout', '-subject', '-nameopt', 'oneline,-esc_msb'],
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE
+ )
+ subject, _ = proc2.communicate(cert_pem)
+ subject = subject.decode('utf-8').strip()
+
+ # Parse CN from subject line like: subject= C = AE, O = ..., CN = Some Name
+ if 'CN = ' in subject:
+ cn = subject.split('CN = ')[-1].split(',')[0].strip()
+ return cn
+
+ return None
+
+
+def get_certificate_base64_from_p12(p12_path, p12_password=''):
+ """Extract the certificate as base64 from p12 file."""
+ # Extract certificate in PEM format
+ proc = subprocess.Popen(
+ ['openssl', 'pkcs12', '-in', p12_path, '-passin', 'pass:' + p12_password, '-nokeys', '-legacy'],
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE
+ )
+ cert_pem, _ = proc.communicate()
+
+ # Convert to DER format
+ proc2 = subprocess.Popen(
+ ['openssl', 'x509', '-outform', 'DER'],
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE
+ )
+ cert_der, _ = proc2.communicate(cert_pem)
+
+ return base64.b64encode(cert_der).decode('utf-8')
+
+
+def process_provisioning_profile(source, destination, certificate_data, signing_identity, keychain_name):
parsed_plist = run_executable_with_output('security', arguments=['cms', '-D', '-i', source], check_result=True)
parsed_plist_file = tempfile.mktemp()
with open(parsed_plist_file, 'w+') as file:
file.write(parsed_plist)
- run_executable_with_output('plutil', arguments=['-remove', 'DeveloperCertificates.0', parsed_plist_file])
+ # Remove all existing developer certificates
+ while True:
+ result = run_executable_with_output('plutil', arguments=['-remove', 'DeveloperCertificates.0', parsed_plist_file], check_result=False)
+ if result is None or 'Could not' in str(result) or result == '':
+ # Check if the removal actually failed by trying to extract
+ check = run_executable_with_output('plutil', arguments=['-extract', 'DeveloperCertificates.0', 'raw', parsed_plist_file], check_result=False)
+ if check is None or 'Could not' in str(check):
+ break
+
+ # Insert the new certificate
run_executable_with_output('plutil', arguments=['-insert', 'DeveloperCertificates.0', '-data', certificate_data, parsed_plist_file])
+
+ # Remove the DER-Encoded-Profile (signature)
run_executable_with_output('plutil', arguments=['-remove', 'DER-Encoded-Profile', parsed_plist_file])
- run_executable_with_output('security', arguments=['cms', '-S', '-N', 'Apple Distribution: Telegram FZ-LLC (C67CF9S4VU)', '-i', parsed_plist_file, '-o', destination])
+ # Sign with the certificate from the temporary keychain
+ run_executable_with_output('security', arguments=[
+ 'cms', '-S', '-k', keychain_name, '-N', signing_identity, '-i', parsed_plist_file, '-o', destination
+ ], check_result=True)
os.unlink(parsed_plist_file)
-def generate_provisioning_profiles(source_path, destination_path):
- certificate_data = get_certificate_base64()
+def generate_provisioning_profiles(source_path, destination_path, certs_path):
+ p12_path = os.path.join(certs_path, 'SelfSigned.p12')
- if not os.path.exists(destination_path):
- print('{} does not exits'.format(destination_path))
+ if not os.path.exists(p12_path):
+ print('{} does not exist'.format(p12_path))
sys.exit(1)
- for file_name in os.listdir(source_path):
- if file_name.endswith('.mobileprovision'):
- process_provisioning_profile(source=source_path + '/' + file_name, destination=destination_path + '/' + file_name, certificate_data=certificate_data)
+ if not os.path.exists(destination_path):
+ print('{} does not exist'.format(destination_path))
+ sys.exit(1)
+
+ # Extract certificate info from p12
+ p12_password = '' # fake-codesigning uses empty password
+ certificate_data = get_certificate_base64_from_p12(p12_path, p12_password)
+ signing_identity = get_signing_identity_from_p12(p12_path, p12_password)
+
+ if not signing_identity:
+ print('Could not extract signing identity from {}'.format(p12_path))
+ sys.exit(1)
+
+ print('Using signing identity: {}'.format(signing_identity))
+
+ # Setup temporary keychain with the certificate
+ keychain_name = setup_temp_keychain(p12_path, p12_password)
+
+ try:
+ for file_name in os.listdir(source_path):
+ if file_name.endswith('.mobileprovision'):
+ print('Processing {}'.format(file_name))
+ process_provisioning_profile(
+ source=os.path.join(source_path, file_name),
+ destination=os.path.join(destination_path, file_name),
+ certificate_data=certificate_data,
+ signing_identity=signing_identity,
+ keychain_name=keychain_name
+ )
+ print('Done. Generated {} profiles.'.format(
+ len([f for f in os.listdir(destination_path) if f.endswith('.mobileprovision')])
+ ))
+ finally:
+ cleanup_temp_keychain(keychain_name)
diff --git a/build-system/Make/Make.py b/build-system/Make/Make.py
index 1898ad5c..93b6a56d 100644
--- a/build-system/Make/Make.py
+++ b/build-system/Make/Make.py
@@ -46,6 +46,7 @@ class BazelCommandLine:
self.show_actions = False
self.enable_sandbox = False
self.disable_provisioning_profiles = False
+ self.profile_swift = False
self.common_args = [
# https://docs.bazel.build/versions/master/command-line-reference.html
@@ -143,6 +144,9 @@ class BazelCommandLine:
def set_disable_provisioning_profiles(self):
self.disable_provisioning_profiles = True
+ def set_profile_swift(self, value):
+ self.profile_swift = value
+
def set_configuration(self, configuration):
if configuration == 'debug_arm64':
self.configuration_args = [
@@ -300,6 +304,8 @@ class BazelCommandLine:
]
combined_arguments += self.configuration_args
+ if self.profile_swift:
+ combined_arguments += ['--config=swift_profile']
print('TelegramBuild: running')
print(subprocess.list2cmdline(combined_arguments))
@@ -369,17 +375,15 @@ class BazelCommandLine:
print(subprocess.list2cmdline(combined_arguments))
call_executable(combined_arguments)
- def get_spm_aspect_invocation(self):
+ def invoke_spm_build(self):
combined_arguments = [
self.build_environment.bazel_path
]
combined_arguments += self.get_startup_bazel_arguments()
combined_arguments += ['build']
- if self.custom_target is not None:
- combined_arguments += [self.custom_target]
- else:
- combined_arguments += ['Telegram/Telegram']
+ # Build the generate_spm target directly to get the dependency tree JSON
+ combined_arguments += ['//Telegram:spm_build_root']
if self.continue_on_error:
combined_arguments += ['--keep_going']
@@ -409,8 +413,6 @@ class BazelCommandLine:
combined_arguments += self.configuration_args
- combined_arguments += ['--aspects', '//build-system/bazel-utils:spm.bzl%spm_text_aspect']
-
print(subprocess.list2cmdline(combined_arguments))
call_executable(combined_arguments)
@@ -624,6 +626,7 @@ def build(bazel, arguments):
bazel_command_line.set_continue_on_error(arguments.continueOnError)
bazel_command_line.set_show_actions(arguments.showActions)
bazel_command_line.set_enable_sandbox(arguments.sandbox)
+ bazel_command_line.set_profile_swift(arguments.profileSwift)
bazel_command_line.set_split_swiftmodules(arguments.enableParallelSwiftmoduleGeneration)
@@ -719,7 +722,7 @@ def query(bazel, arguments):
bazel_command_line.invoke_query(query_args)
-def get_spm_aspect_invocation(bazel, arguments):
+def build_spm(bazel, arguments):
bazel_command_line = BazelCommandLine(
bazel=bazel,
override_bazel_version=arguments.overrideBazelVersion,
@@ -741,13 +744,12 @@ def get_spm_aspect_invocation(bazel, arguments):
bazel_command_line.set_configuration(arguments.configuration)
bazel_command_line.set_build_number(arguments.buildNumber)
- bazel_command_line.set_custom_target(arguments.target)
bazel_command_line.set_continue_on_error(False)
bazel_command_line.set_show_actions(False)
bazel_command_line.set_enable_sandbox(False)
bazel_command_line.set_split_swiftmodules(False)
- bazel_command_line.get_spm_aspect_invocation()
+ bazel_command_line.invoke_spm_build()
def add_codesigning_common_arguments(current_parser: argparse.ArgumentParser):
configuration_group = current_parser.add_mutually_exclusive_group(required=True)
@@ -977,6 +979,12 @@ if __name__ == '__main__':
help='Generate .swiftmodule files in parallel to building modules, can speed up compilation on multi-core '
'systems. '
)
+ buildParser.add_argument(
+ '--profileSwift',
+ action='store_true',
+ default=False,
+ help='Enable single-core Swift compile profiling flags.'
+ )
buildParser.add_argument(
'--target',
type=str,
@@ -1068,6 +1076,13 @@ if __name__ == '__main__':
type=str,
help='Path to the destination directory.'
)
+ generate_profiles_build_parser.add_argument(
+ '--certsPath',
+ required=False,
+ type=str,
+ default='build-system/fake-codesigning/certs',
+ help='Path to the directory containing SelfSigned.p12 certificate.'
+ )
remote_upload_testflight_parser = subparsers.add_parser('remote-deploy-testflight', help='Build the app using a remote environment.')
remote_upload_testflight_parser.add_argument(
@@ -1188,13 +1203,7 @@ if __name__ == '__main__':
metavar='query_string'
)
- spm_parser = subparsers.add_parser('spm', help='Generate SPM package')
- spm_parser.add_argument(
- '--target',
- type=str,
- help='A custom bazel target name to build.',
- metavar='target_name'
- )
+ spm_parser = subparsers.add_parser('spm', help='Generate SPM package (outputs bazel-bin/Telegram/spm_build_root_modules.json)')
spm_parser.add_argument(
'--buildNumber',
required=False,
@@ -1315,7 +1324,7 @@ if __name__ == '__main__':
additional_codesigning_output_path=remote_input_path
)
- GenerateProfiles.generate_provisioning_profiles(source_path=remote_input_path + '/profiles', destination_path=args.destination)
+ GenerateProfiles.generate_provisioning_profiles(source_path=remote_input_path + '/profiles', destination_path=args.destination, certs_path=args.certsPath)
elif args.commandName == 'remote-deploy-testflight':
env = os.environ
if 'APPSTORE_CONNECT_USERNAME' not in env:
@@ -1351,7 +1360,7 @@ if __name__ == '__main__':
elif args.commandName == 'query':
query(bazel=bazel_path, arguments=args)
elif args.commandName == 'spm':
- get_spm_aspect_invocation(bazel=bazel_path, arguments=args)
+ build_spm(bazel=bazel_path, arguments=args)
else:
raise Exception('Unknown command')
except KeyboardInterrupt:
diff --git a/build-system/Make/TartBuild.py b/build-system/Make/TartBuild.py
index 449e9ce0..9f890ca3 100644
--- a/build-system/Make/TartBuild.py
+++ b/build-system/Make/TartBuild.py
@@ -604,7 +604,7 @@ def remote_build_tart(macos_version, bazel_cache_host, configuration, build_inpu
else:
guest_build_sh += '--cacheHost="$CACHE_HOST" \\'
guest_build_sh += 'build \\'
- guest_build_sh += '--lock \\'
+ #guest_build_sh += '--lock \\'
guest_build_sh += '--buildNumber={} \\'.format(build_number)
guest_build_sh += '--configuration={} \\'.format(configuration)
guest_build_sh += '--configurationPath=$HOME/telegram-build-input/configuration.json \\'
diff --git a/build-system/MakeProject/Package.resolved b/build-system/MakeProject/Package.resolved
new file mode 100644
index 00000000..d9f1a9dc
--- /dev/null
+++ b/build-system/MakeProject/Package.resolved
@@ -0,0 +1,50 @@
+{
+ "pins" : [
+ {
+ "identity" : "aexml",
+ "kind" : "remoteSourceControl",
+ "location" : "https://github.com/tadija/AEXML.git",
+ "state" : {
+ "revision" : "38f7d00b23ecd891e1ee656fa6aeebd6ba04ecc3",
+ "version" : "4.6.1"
+ }
+ },
+ {
+ "identity" : "pathkit",
+ "kind" : "remoteSourceControl",
+ "location" : "https://github.com/kylef/PathKit.git",
+ "state" : {
+ "revision" : "3bfd2737b700b9a36565a8c94f4ad2b050a5e574",
+ "version" : "1.0.1"
+ }
+ },
+ {
+ "identity" : "spectre",
+ "kind" : "remoteSourceControl",
+ "location" : "https://github.com/kylef/Spectre.git",
+ "state" : {
+ "revision" : "26cc5e9ae0947092c7139ef7ba612e34646086c7",
+ "version" : "0.10.1"
+ }
+ },
+ {
+ "identity" : "swift-argument-parser",
+ "kind" : "remoteSourceControl",
+ "location" : "https://github.com/apple/swift-argument-parser",
+ "state" : {
+ "revision" : "309a47b2b1d9b5e991f36961c983ecec72275be3",
+ "version" : "1.6.1"
+ }
+ },
+ {
+ "identity" : "xcodeproj",
+ "kind" : "remoteSourceControl",
+ "location" : "https://github.com/tuist/XcodeProj.git",
+ "state" : {
+ "revision" : "dc3b87a4e69f9cd06c6cb16199f5d0472e57ef6b",
+ "version" : "8.24.3"
+ }
+ }
+ ],
+ "version" : 2
+}
diff --git a/build-system/MakeProject/Package.swift b/build-system/MakeProject/Package.swift
new file mode 100644
index 00000000..8e81f4a7
--- /dev/null
+++ b/build-system/MakeProject/Package.swift
@@ -0,0 +1,26 @@
+// swift-tools-version:5.8
+
+import PackageDescription
+
+let package = Package(
+ name: "MakeProject",
+ platforms: [
+ .macOS(.v13)
+ ],
+ products: [
+ .executable(name: "MakeProject", targets: ["MakeProject"])
+ ],
+ dependencies: [
+ .package(url: "https://github.com/tuist/XcodeProj.git", from: "8.15.0"),
+ .package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.2.0"),
+ ],
+ targets: [
+ .executableTarget(
+ name: "MakeProject",
+ dependencies: [
+ .product(name: "XcodeProj", package: "XcodeProj"),
+ .product(name: "ArgumentParser", package: "swift-argument-parser"),
+ ]
+ )
+ ]
+)
diff --git a/build-system/MakeProject/Sources/MakeProject/ModuleJSON.swift b/build-system/MakeProject/Sources/MakeProject/ModuleJSON.swift
new file mode 100644
index 00000000..fa47427c
--- /dev/null
+++ b/build-system/MakeProject/Sources/MakeProject/ModuleJSON.swift
@@ -0,0 +1,54 @@
+import Foundation
+
+struct ModuleDefinition: Codable {
+ let name: String
+ let moduleName: String?
+ let type: String
+ let path: String
+ let sources: [String]
+ let deps: [String]?
+ let copts: [String]?
+ let cxxopts: [String]?
+ let defines: [String]?
+ let includes: [String]?
+ let sdkFrameworks: [String]?
+ let sdkDylibs: [String]?
+ let hdrs: [String]?
+ let textualHdrs: [String]?
+ let weakSdkFrameworks: [String]?
+
+ enum CodingKeys: String, CodingKey {
+ case name
+ case moduleName = "module_name"
+ case type
+ case path
+ case sources
+ case deps
+ case copts
+ case cxxopts
+ case defines
+ case includes
+ case sdkFrameworks = "sdk_frameworks"
+ case sdkDylibs = "sdk_dylibs"
+ case hdrs
+ case textualHdrs = "textual_hdrs"
+ case weakSdkFrameworks = "weak_sdk_frameworks"
+ }
+}
+
+enum ModuleType: String {
+ case swiftLibrary = "swift_library"
+ case objcLibrary = "objc_library"
+ case ccLibrary = "cc_library"
+ case xcframework = "apple_static_xcframework_import"
+
+ init?(from definition: ModuleDefinition) {
+ self.init(rawValue: definition.type)
+ }
+}
+
+func loadModules(from path: String) throws -> [String: ModuleDefinition] {
+ let url = URL(fileURLWithPath: path)
+ let data = try Data(contentsOf: url)
+ return try JSONDecoder().decode([String: ModuleDefinition].self, from: data)
+}
diff --git a/build-system/MakeProject/Sources/MakeProject/ProjectGenerator.swift b/build-system/MakeProject/Sources/MakeProject/ProjectGenerator.swift
new file mode 100644
index 00000000..92f965af
--- /dev/null
+++ b/build-system/MakeProject/Sources/MakeProject/ProjectGenerator.swift
@@ -0,0 +1,147 @@
+import Foundation
+import PathKit
+import XcodeProj
+
+class ProjectGenerator {
+ let modulesPath: Path
+ let outputDir: Path
+ let projectRoot: Path
+
+ init(modulesPath: Path, outputDir: Path, projectRoot: Path) {
+ self.modulesPath = modulesPath
+ self.outputDir = outputDir
+ self.projectRoot = projectRoot
+ }
+
+ func generate() throws {
+ print("Loading modules from \(modulesPath)...")
+ let modules = try loadModules(from: modulesPath.string)
+ print("Loaded \(modules.count) modules")
+
+ // Filter out empty modules, but keep:
+ // - Modules with source files (excluding .a)
+ // - Static library modules (only .a files)
+ // - XCFramework imports
+ let validModules = modules.filter { name, module in
+ let nonStaticSources = module.sources.filter { !$0.hasSuffix(".a") }
+ let staticLibs = module.sources.filter { $0.hasSuffix(".a") }
+ return !nonStaticSources.isEmpty ||
+ !staticLibs.isEmpty ||
+ module.type == "apple_static_xcframework_import"
+ }
+ print("Processing \(validModules.count) non-empty modules")
+
+ // Setup output directory
+ try outputDir.mkpath()
+
+ // Create symlink manager
+ let symlinkManager = SymlinkManager(outputDir: outputDir, projectRoot: projectRoot)
+ symlinkManager.scanExistingFiles()
+
+ // Create project
+ let projectPath = outputDir + "Telegram.xcodeproj"
+ let pbxproj = PBXProj()
+
+ // Create main group
+ let mainGroup = PBXGroup(children: [], sourceTree: .group)
+ pbxproj.add(object: mainGroup)
+
+ // Create project-level build configurations
+ let projectDebugSettings: BuildSettings = [
+ "ALWAYS_SEARCH_USER_PATHS": "NO",
+ "CLANG_CXX_LANGUAGE_STANDARD": "c++17",
+ "CLANG_ENABLE_MODULES": "YES",
+ "CLANG_ENABLE_OBJC_ARC": "YES",
+ "CLANG_ENABLE_EXPLICIT_MODULES": "NO", // Disable explicit module builds for ObjC-Swift interop
+ "SWIFT_ENABLE_EXPLICIT_MODULES": "NO", // Disable explicit module builds for Swift
+ "ENABLE_STRICT_OBJC_MSGSEND": "YES",
+ "GCC_NO_COMMON_BLOCKS": "YES",
+ "IPHONEOS_DEPLOYMENT_TARGET": "13.0",
+ "MTL_ENABLE_DEBUG_INFO": "INCLUDE_SOURCE",
+ "ONLY_ACTIVE_ARCH": "YES",
+ "SDKROOT": "iphoneos",
+ "SWIFT_VERSION": "5.0",
+ "TARGETED_DEVICE_FAMILY": "1,2",
+ "DEBUG_INFORMATION_FORMAT": "dwarf",
+ "ENABLE_BITCODE": "NO",
+ ]
+
+ var projectReleaseSettings = projectDebugSettings
+ projectReleaseSettings["DEBUG_INFORMATION_FORMAT"] = "dwarf-with-dsym"
+ projectReleaseSettings["MTL_ENABLE_DEBUG_INFO"] = "NO"
+ projectReleaseSettings["ONLY_ACTIVE_ARCH"] = "NO"
+
+ let projectDebugConfig = XCBuildConfiguration(name: "Debug", buildSettings: projectDebugSettings)
+ let projectReleaseConfig = XCBuildConfiguration(name: "Release", buildSettings: projectReleaseSettings)
+ pbxproj.add(object: projectDebugConfig)
+ pbxproj.add(object: projectReleaseConfig)
+
+ let projectConfigList = XCConfigurationList(
+ buildConfigurations: [projectDebugConfig, projectReleaseConfig],
+ defaultConfigurationName: "Release"
+ )
+ pbxproj.add(object: projectConfigList)
+
+ // Create project
+ let project = PBXProject(
+ name: "Telegram",
+ buildConfigurationList: projectConfigList,
+ compatibilityVersion: "Xcode 14.0",
+ preferredProjectObjectVersion: 56,
+ minimizedProjectReferenceProxies: 0,
+ mainGroup: mainGroup
+ )
+ pbxproj.add(object: project)
+
+ // Create target builder
+ let targetBuilder = TargetBuilder(
+ project: project,
+ pbxproj: pbxproj,
+ mainGroup: mainGroup,
+ outputDir: outputDir,
+ symlinkManager: symlinkManager
+ )
+
+ // Build targets
+ print("Creating targets...")
+ var builtCount = 0
+ for (name, module) in validModules.sorted(by: { $0.key < $1.key }) {
+ do {
+ if let _ = try targetBuilder.buildTarget(for: module, allModules: validModules) {
+ builtCount += 1
+ if builtCount % 50 == 0 {
+ print(" Created \(builtCount) targets...")
+ }
+ }
+ } catch {
+ print("Warning: Failed to build target \(name): \(error)")
+ }
+ }
+ print("Created \(builtCount) targets")
+
+ // Wire up dependencies
+ print("Wiring up dependencies...")
+ try targetBuilder.wireUpDependencies(modules: validModules)
+
+ // Write project
+ print("Writing project to \(projectPath)...")
+ pbxproj.rootObject = project
+ let xcodeproj = XcodeProj(workspace: XCWorkspace(), pbxproj: pbxproj)
+ try xcodeproj.write(path: projectPath)
+
+ // Generate scheme for main target
+ if let telegramTarget = targetBuilder.getTarget(named: "TelegramUI") {
+ print("Generating scheme...")
+ let schemeGenerator = SchemeGenerator(projectPath: projectPath, pbxproj: pbxproj)
+ try schemeGenerator.generateScheme(for: telegramTarget, named: "TelegramUI")
+ } else {
+ print("Warning: Could not find TelegramUI target for scheme")
+ }
+
+ // Clean up stale files
+ print("Cleaning up stale symlinks...")
+ symlinkManager.cleanupStaleFiles()
+
+ print("Done! Project written to \(projectPath)")
+ }
+}
diff --git a/build-system/MakeProject/Sources/MakeProject/SchemeGenerator.swift b/build-system/MakeProject/Sources/MakeProject/SchemeGenerator.swift
new file mode 100644
index 00000000..1c1b7632
--- /dev/null
+++ b/build-system/MakeProject/Sources/MakeProject/SchemeGenerator.swift
@@ -0,0 +1,74 @@
+import Foundation
+import PathKit
+import XcodeProj
+
+class SchemeGenerator {
+ let projectPath: Path
+ let pbxproj: PBXProj
+
+ init(projectPath: Path, pbxproj: PBXProj) {
+ self.projectPath = projectPath
+ self.pbxproj = pbxproj
+ }
+
+ func generateScheme(for target: PBXNativeTarget, named schemeName: String) throws {
+ let schemesDir = projectPath + "xcshareddata" + "xcschemes"
+ try schemesDir.mkpath()
+
+ let buildableReference = XCScheme.BuildableReference(
+ referencedContainer: "container:Telegram.xcodeproj",
+ blueprint: target,
+ buildableName: "\(target.name).framework",
+ blueprintName: target.name
+ )
+
+ let buildAction = XCScheme.BuildAction(
+ buildActionEntries: [
+ XCScheme.BuildAction.Entry(
+ buildableReference: buildableReference,
+ buildFor: [.running, .testing, .profiling, .archiving, .analyzing]
+ )
+ ],
+ parallelizeBuild: true,
+ buildImplicitDependencies: true
+ )
+
+ let launchAction = XCScheme.LaunchAction(
+ runnable: nil,
+ buildConfiguration: "Debug"
+ )
+
+ let testAction = XCScheme.TestAction(
+ buildConfiguration: "Debug",
+ macroExpansion: buildableReference
+ )
+
+ let profileAction = XCScheme.ProfileAction(
+ runnable: nil,
+ buildConfiguration: "Release",
+ macroExpansion: buildableReference
+ )
+
+ let analyzeAction = XCScheme.AnalyzeAction(buildConfiguration: "Debug")
+
+ let archiveAction = XCScheme.ArchiveAction(
+ buildConfiguration: "Release",
+ revealArchiveInOrganizer: true
+ )
+
+ let scheme = XCScheme(
+ name: schemeName,
+ lastUpgradeVersion: nil,
+ version: nil,
+ buildAction: buildAction,
+ testAction: testAction,
+ launchAction: launchAction,
+ profileAction: profileAction,
+ analyzeAction: analyzeAction,
+ archiveAction: archiveAction
+ )
+
+ let schemePath = schemesDir + "\(schemeName).xcscheme"
+ try scheme.write(path: schemePath, override: true)
+ }
+}
diff --git a/build-system/MakeProject/Sources/MakeProject/SymlinkManager.swift b/build-system/MakeProject/Sources/MakeProject/SymlinkManager.swift
new file mode 100644
index 00000000..1ee9da3d
--- /dev/null
+++ b/build-system/MakeProject/Sources/MakeProject/SymlinkManager.swift
@@ -0,0 +1,116 @@
+import Foundation
+import PathKit
+
+class SymlinkManager {
+ let outputDir: Path
+ let projectRoot: Path
+ private var previousFiles: Set = []
+ private var currentFiles: Set = []
+
+ init(outputDir: Path, projectRoot: Path) {
+ self.outputDir = outputDir
+ self.projectRoot = projectRoot
+ }
+
+ func scanExistingFiles() {
+ previousFiles = []
+ scanDirectory(outputDir)
+ }
+
+ private func scanDirectory(_ path: Path) {
+ guard path.exists else { return }
+ do {
+ for item in try path.children() {
+ let name = item.lastComponent
+ // Skip build artifacts and xcodeproj bundles
+ if name == ".build" || name.hasSuffix(".xcodeproj") { continue }
+ previousFiles.insert(item)
+ if item.isDirectory && !item.isSymlink {
+ scanDirectory(item)
+ }
+ }
+ } catch {
+ print("Warning: Could not scan \(path): \(error)")
+ }
+ }
+
+ func createDirectory(_ path: Path) throws {
+ currentFiles.insert(path)
+ var parent = path.parent()
+ while parent != outputDir && parent.string.count > outputDir.string.count {
+ currentFiles.insert(parent)
+ parent = parent.parent()
+ }
+ if !path.exists {
+ try path.mkpath()
+ }
+ }
+
+ func createSymlink(from source: Path, to target: Path) throws {
+ currentFiles.insert(target)
+ var parent = target.parent()
+ while parent != outputDir && parent.string.count > outputDir.string.count {
+ currentFiles.insert(parent)
+ parent = parent.parent()
+ }
+
+ // Calculate relative path from target back to source
+ let targetDir = target.parent()
+ let depth = targetDir.components.count - outputDir.components.count + 1
+ let relativePrefix = Array(repeating: "..", count: depth).joined(separator: "/")
+ let relativePath = Path(relativePrefix) + source
+
+ if target.isSymlink {
+ let existingTarget = try? target.symlinkDestination()
+ if existingTarget == relativePath {
+ return // Already correct
+ }
+ try target.delete()
+ } else if target.exists {
+ try target.delete()
+ }
+
+ try targetDir.mkpath()
+ try FileManager.default.createSymbolicLink(
+ atPath: target.string,
+ withDestinationPath: relativePath.string
+ )
+ }
+
+ func cleanupStaleFiles() {
+ let staleFiles = previousFiles.subtracting(currentFiles)
+ let sortedStale = staleFiles.sorted { $0.components.count > $1.components.count }
+
+ for path in sortedStale {
+ do {
+ if path.isSymlink || path.isFile {
+ try path.delete()
+ } else if path.isDirectory {
+ if (try? path.children().isEmpty) == true {
+ try path.delete()
+ }
+ }
+ } catch {
+ print("Warning: Could not remove \(path): \(error)")
+ }
+ }
+ }
+
+ func markFile(_ path: Path) {
+ currentFiles.insert(path)
+ }
+}
+
+extension Path {
+ var isSymlink: Bool {
+ var isDir: ObjCBool = false
+ let exists = FileManager.default.fileExists(atPath: self.string, isDirectory: &isDir)
+ guard exists else { return false }
+ do {
+ let attrs = try FileManager.default.attributesOfItem(atPath: self.string)
+ return attrs[.type] as? FileAttributeType == .typeSymbolicLink
+ } catch {
+ return false
+ }
+ }
+}
diff --git a/build-system/MakeProject/Sources/MakeProject/TargetBuilder.swift b/build-system/MakeProject/Sources/MakeProject/TargetBuilder.swift
new file mode 100644
index 00000000..8252f47c
--- /dev/null
+++ b/build-system/MakeProject/Sources/MakeProject/TargetBuilder.swift
@@ -0,0 +1,792 @@
+import Foundation
+import PathKit
+import XcodeProj
+
+class TargetBuilder {
+ let project: PBXProject
+ let pbxproj: PBXProj
+ let mainGroup: PBXGroup
+ let outputDir: Path
+ let symlinkManager: SymlinkManager
+
+ private var targetsByName: [String: PBXNativeTarget] = [:]
+ private var groupsByPath: [String: PBXGroup] = [:]
+
+ init(project: PBXProject, pbxproj: PBXProj, mainGroup: PBXGroup, outputDir: Path, symlinkManager: SymlinkManager) {
+ self.project = project
+ self.pbxproj = pbxproj
+ self.mainGroup = mainGroup
+ self.outputDir = outputDir
+ self.symlinkManager = symlinkManager
+ }
+
+ // Track which modules are header-only (have no linkable code)
+ private var headerOnlyModules: Set = []
+ // Track which modules are static library collections (.a files)
+ private var staticLibraryModules: [String: [String]] = [:] // module name -> list of .a file paths
+
+ func isHeaderOnlyModule(_ name: String) -> Bool {
+ return headerOnlyModules.contains(name)
+ }
+
+ func isStaticLibraryModule(_ name: String) -> Bool {
+ return staticLibraryModules[name] != nil
+ }
+
+ func getStaticLibraries(for name: String) -> [String] {
+ return staticLibraryModules[name] ?? []
+ }
+
+ func buildTarget(for module: ModuleDefinition, allModules: [String: ModuleDefinition]) throws -> PBXNativeTarget? {
+ guard let moduleType = ModuleType(from: module) else {
+ print("Warning: Unknown module type \(module.type) for \(module.name)")
+ return nil
+ }
+
+ // Check for static library modules (only .a files)
+ let staticLibs = module.sources.filter { $0.hasSuffix(".a") }
+ let nonStaticLibs = module.sources.filter { !$0.hasSuffix(".a") }
+ let isStaticLibOnly = !staticLibs.isEmpty && nonStaticLibs.allSatisfy { $0.hasSuffix(".h") || $0.hasSuffix(".hpp") }
+
+ if isStaticLibOnly && moduleType != .xcframework {
+ // This is a static library module - track its .a files but don't create a framework
+ staticLibraryModules[module.name] = staticLibs
+ return nil // Don't create a target, just track the static libs
+ }
+
+ // Check if module is header-only (only header files, no real sources)
+ let sourceFiles = module.sources.filter { source in
+ !source.hasSuffix(".a") && !source.hasSuffix(".h") && !source.hasSuffix(".hpp")
+ }
+ let isHeaderOnly = sourceFiles.isEmpty && moduleType != .xcframework
+
+ // Skip modules with no sources at all
+ if module.sources.isEmpty && moduleType != .xcframework {
+ return nil
+ }
+
+ switch moduleType {
+ case .xcframework:
+ return try buildXCFrameworkTarget(for: module)
+ case .swiftLibrary, .objcLibrary, .ccLibrary:
+ if isHeaderOnly {
+ headerOnlyModules.insert(module.name)
+ return try buildHeaderOnlyFrameworkTarget(for: module)
+ } else {
+ return try buildFrameworkTarget(for: module, moduleType: moduleType)
+ }
+ }
+ }
+
+ private func buildXCFrameworkTarget(for module: ModuleDefinition) throws -> PBXNativeTarget {
+ // For xcframeworks, we create a reference but no build phases
+ let target = PBXNativeTarget(
+ name: module.name,
+ buildConfigurationList: createConfigurationList(for: module, isXCFramework: true),
+ buildPhases: [],
+ productName: module.name,
+ productType: .framework
+ )
+ pbxproj.add(object: target)
+ project.targets.append(target)
+ targetsByName[module.name] = target
+ return target
+ }
+
+ private func buildFrameworkTarget(for module: ModuleDefinition, moduleType: ModuleType) throws -> PBXNativeTarget {
+ // Create group for module
+ let moduleGroup = try getOrCreateGroup(for: module.path)
+
+ // Create symlinks and file references
+ var sourceRefs: [PBXFileReference] = []
+ var publicHeaderRefs: [PBXFileReference] = []
+ var seenPublicHeaderNames: Set = [] // Track header filenames to avoid duplicates in headers build phase
+
+ // Determine public header detection:
+ // 1. If hdrs is provided, use those (explicit public headers)
+ // 2. Otherwise, headers in includes directories are public
+ let explicitPublicHeaders = Set(module.hdrs ?? [])
+
+ let allSourceFiles = module.sources + (module.hdrs ?? []) + (module.textualHdrs ?? [])
+
+ for source in allSourceFiles {
+ if source.hasSuffix(".a") { continue }
+
+ let sourcePath = Path(source)
+ let fileName = sourcePath.lastComponent
+
+ // Calculate relative path within module
+ let relativeToModule: String
+ if source.hasPrefix(module.path + "/") {
+ relativeToModule = String(source.dropFirst(module.path.count + 1))
+ } else if source.hasPrefix("bazel-out/") {
+ // Generated file
+ if let range = source.range(of: module.path + "/") {
+ relativeToModule = String(source[range.upperBound...])
+ } else {
+ relativeToModule = fileName
+ }
+ } else {
+ relativeToModule = fileName
+ }
+
+ // Create symlink
+ let symlinkPath = outputDir + module.path + relativeToModule
+ try symlinkManager.createDirectory(symlinkPath.parent())
+ try symlinkManager.createSymlink(from: Path(source), to: symlinkPath)
+
+ // Create file reference
+ let fileRef = try getOrCreateFileReference(
+ path: relativeToModule,
+ in: moduleGroup,
+ modulePath: module.path,
+ fileName: fileName
+ )
+
+ let isHeader = source.hasSuffix(".h") || source.hasSuffix(".hpp")
+
+ // Determine if this is a public header:
+ // 1. Explicitly in hdrs array
+ // 2. Located in an includes directory
+ let isPublicHeader: Bool
+ if !isHeader {
+ isPublicHeader = false
+ } else if !explicitPublicHeaders.isEmpty {
+ // If hdrs is provided, only those are public
+ isPublicHeader = explicitPublicHeaders.contains(source)
+ } else {
+ // Headers in include directories are public (handles bazel-out paths)
+ isPublicHeader = isInIncludesDirectory(source: source, modulePath: module.path, includes: module.includes)
+ }
+
+ if isPublicHeader {
+ // Skip duplicate header filenames to avoid "multiple commands produce" errors
+ if !seenPublicHeaderNames.contains(fileName) {
+ seenPublicHeaderNames.insert(fileName)
+ publicHeaderRefs.append(fileRef)
+ }
+ } else if !source.hasSuffix(".inc") && !isHeader {
+ // Source files (not headers)
+ sourceRefs.append(fileRef)
+ }
+ // Private headers are not added to any build phase
+ }
+
+ // Build phases
+ var buildPhases: [PBXBuildPhase] = []
+
+ // Sources build phase
+ let sourcesBuildPhase = PBXSourcesBuildPhase(
+ files: sourceRefs.map { ref in
+ let buildFile = PBXBuildFile(file: ref)
+ pbxproj.add(object: buildFile)
+ return buildFile
+ }
+ )
+ pbxproj.add(object: sourcesBuildPhase)
+ buildPhases.append(sourcesBuildPhase)
+
+ // Generate modulemap for ObjC/C++ modules (SPM-style explicit headers)
+ var modulemapPath: Path? = nil
+ if moduleType == .objcLibrary || moduleType == .ccLibrary {
+ modulemapPath = try generateModulemap(for: module)
+
+ // Headers build phase with public headers - needed for ObjC #import to work
+ if !publicHeaderRefs.isEmpty {
+ let headersBuildPhase = PBXHeadersBuildPhase(
+ files: publicHeaderRefs.map { ref in
+ let buildFile = PBXBuildFile(file: ref, settings: ["ATTRIBUTES": ["Public"]])
+ pbxproj.add(object: buildFile)
+ return buildFile
+ }
+ )
+ pbxproj.add(object: headersBuildPhase)
+ buildPhases.append(headersBuildPhase)
+ }
+ }
+
+ // Frameworks build phase
+ let frameworksBuildPhase = PBXFrameworksBuildPhase(files: [])
+ pbxproj.add(object: frameworksBuildPhase)
+ buildPhases.append(frameworksBuildPhase)
+
+ // Create target with custom modulemap if generated
+ let configList = createConfigurationList(for: module, isXCFramework: false, modulemapPath: modulemapPath)
+
+ let target = PBXNativeTarget(
+ name: module.name,
+ buildConfigurationList: configList,
+ buildPhases: buildPhases,
+ productName: module.name,
+ productType: .framework
+ )
+ pbxproj.add(object: target)
+ project.targets.append(target)
+ targetsByName[module.name] = target
+
+ return target
+ }
+
+ /// Build a framework target for header-only modules (just headers + modulemap, no sources)
+ private func buildHeaderOnlyFrameworkTarget(for module: ModuleDefinition) throws -> PBXNativeTarget {
+ // Create group for module
+ let moduleGroup = try getOrCreateGroup(for: module.path)
+
+ // Symlink header files and create file references
+ var publicHeaderRefs: [PBXFileReference] = []
+ var seenPublicHeaderNames: Set = [] // Track header filenames to avoid duplicates
+ let allHeaders = module.sources.filter { $0.hasSuffix(".h") || $0.hasSuffix(".hpp") } + (module.hdrs ?? []) + (module.textualHdrs ?? [])
+
+ for source in allHeaders {
+ let sourcePath = Path(source)
+ let fileName = sourcePath.lastComponent
+ let relativeToModule = relativePathInModule(source: source, modulePath: module.path)
+
+ // Create parent group
+ let parentPath = (Path(module.path) + Path(relativeToModule).parent()).string
+ let parentGroup = try getOrCreateGroup(for: parentPath)
+
+ // Create symlink
+ let symlinkPath = outputDir + module.path + relativeToModule
+ try symlinkManager.createDirectory(symlinkPath.parent())
+ try symlinkManager.createSymlink(from: Path(source), to: symlinkPath)
+
+ // Create file reference
+ let fileType = lastKnownFileType(for: fileName)
+ let fileRef = PBXFileReference(
+ sourceTree: .group,
+ name: fileName,
+ lastKnownFileType: fileType,
+ path: fileName
+ )
+ pbxproj.add(object: fileRef)
+ parentGroup.children.append(fileRef)
+
+ // Check if it's a public header (in includes directories)
+ // Use helper that properly handles bazel-out paths
+ let isPublic = isInIncludesDirectory(source: source, modulePath: module.path, includes: module.includes)
+ if isPublic {
+ // Skip duplicate header filenames to avoid "multiple commands produce" errors
+ if !seenPublicHeaderNames.contains(fileName) {
+ seenPublicHeaderNames.insert(fileName)
+ publicHeaderRefs.append(fileRef)
+ }
+ }
+ }
+
+ // Generate modulemap for this header-only module
+ let modulemapPath = try generateModulemap(for: module)
+
+ // Create build phases
+ var buildPhases: [PBXBuildPhase] = []
+
+ // Headers build phase with public headers - needed for ObjC #import to work
+ if !publicHeaderRefs.isEmpty {
+ let headersBuildPhase = PBXHeadersBuildPhase(
+ files: publicHeaderRefs.map { ref in
+ let buildFile = PBXBuildFile(file: ref, settings: ["ATTRIBUTES": ["Public"]])
+ pbxproj.add(object: buildFile)
+ return buildFile
+ }
+ )
+ pbxproj.add(object: headersBuildPhase)
+ buildPhases.append(headersBuildPhase)
+ }
+
+ // Empty frameworks phase (needed for Xcode, but won't link anything)
+ let frameworksBuildPhase = PBXFrameworksBuildPhase(files: [])
+ pbxproj.add(object: frameworksBuildPhase)
+ buildPhases.append(frameworksBuildPhase)
+
+ // Create target with custom modulemap
+ let configList = createConfigurationList(for: module, isXCFramework: false, modulemapPath: modulemapPath)
+
+ let target = PBXNativeTarget(
+ name: module.name,
+ buildConfigurationList: configList,
+ buildPhases: buildPhases,
+ productName: module.name,
+ productType: .framework
+ )
+ pbxproj.add(object: target)
+ project.targets.append(target)
+ targetsByName[module.name] = target
+
+ return target
+ }
+
+ /// Collect all transitive dependencies for a module
+ private func collectAllDependencies(for moduleName: String, modules: [String: ModuleDefinition], visited: inout Set) -> Set {
+ guard !visited.contains(moduleName) else { return [] }
+ visited.insert(moduleName)
+
+ guard let module = modules[moduleName], let deps = module.deps else {
+ return []
+ }
+
+ var allDeps = Set(deps)
+ for depName in deps {
+ allDeps.formUnion(collectAllDependencies(for: depName, modules: modules, visited: &visited))
+ }
+ return allDeps
+ }
+
+ func wireUpDependencies(modules: [String: ModuleDefinition]) throws {
+ for (name, module) in modules {
+ guard let target = targetsByName[name],
+ let deps = module.deps else { continue }
+
+ // Find frameworks build phase
+ guard let frameworksPhase = target.buildPhases.compactMap({ $0 as? PBXFrameworksBuildPhase }).first else {
+ continue
+ }
+
+ // Track all frameworks we've added to avoid duplicates
+ var linkedFrameworks: Set = []
+ // Track library search paths for static libraries
+ var staticLibSearchPaths: Set = []
+
+ // Add target dependency (only for direct deps)
+ for depName in deps {
+ if let depTarget = targetsByName[depName] {
+ let dependency = PBXTargetDependency(target: depTarget)
+ pbxproj.add(object: dependency)
+ target.dependencies.append(dependency)
+ }
+ }
+
+ // Collect all transitive dependencies to link
+ var visited = Set()
+ let allDeps = collectAllDependencies(for: name, modules: modules, visited: &visited)
+
+ // Collect header paths from ALL dependencies (direct and transitive)
+ var depHeaderPaths: [String] = []
+ for depName in allDeps {
+ if let depModule = modules[depName] {
+ depHeaderPaths.append(contentsOf: exportedHeaderPaths(for: depModule))
+ }
+ }
+
+ // Link all dependencies (direct and transitive) that have targets
+ for depName in allDeps {
+ // Skip if already linked
+ guard !linkedFrameworks.contains(depName) else { continue }
+
+ // Check if this is a static library module - link .a files directly
+ if isStaticLibraryModule(depName) {
+ // Link static libraries directly
+ for libPath in getStaticLibraries(for: depName) {
+ let libName = Path(libPath).lastComponent
+ // Create an absolute path to the project root then to the static library
+ // SRCROOT is xcode-files, so we need to go up one level to get to telegram-ios
+ let projectRoot = outputDir.parent()
+ let absoluteLibPath = (projectRoot + libPath).string
+ let libRef = PBXFileReference(
+ sourceTree: .absolute,
+ name: libName,
+ lastKnownFileType: "archive.ar",
+ path: absoluteLibPath
+ )
+ pbxproj.add(object: libRef)
+ let buildFile = PBXBuildFile(file: libRef)
+ pbxproj.add(object: buildFile)
+ frameworksPhase.files?.append(buildFile)
+
+ // Add the library's directory to LIBRARY_SEARCH_PATHS
+ let libDir = Path(absoluteLibPath).parent().string
+ if !staticLibSearchPaths.contains(libDir) {
+ staticLibSearchPaths.insert(libDir)
+ }
+ }
+ linkedFrameworks.insert(depName)
+ continue
+ }
+
+ // Skip header-only modules (no framework to link)
+ if isHeaderOnlyModule(depName) { continue }
+
+ // Regular framework dependency
+ guard targetsByName[depName] != nil else { continue }
+
+ linkedFrameworks.insert(depName)
+ let frameworkRef = PBXFileReference(
+ sourceTree: .buildProductsDir,
+ name: "\(depName).framework",
+ lastKnownFileType: "wrapper.framework",
+ path: "\(depName).framework"
+ )
+ pbxproj.add(object: frameworkRef)
+ let buildFile = PBXBuildFile(file: frameworkRef)
+ pbxproj.add(object: buildFile)
+ frameworksPhase.files?.append(buildFile)
+ }
+
+ // Update build configurations with dependency paths
+ if !depHeaderPaths.isEmpty || !deps.isEmpty || !staticLibSearchPaths.isEmpty {
+ for config in target.buildConfigurationList?.buildConfigurations ?? [] {
+ // Add header search paths
+ if !depHeaderPaths.isEmpty {
+ let existing = config.buildSettings["HEADER_SEARCH_PATHS"] as? String ?? "$(inherited)"
+ config.buildSettings["HEADER_SEARCH_PATHS"] = existing + " " + depHeaderPaths.joined(separator: " ")
+ }
+ // Ensure framework and module search paths include built products
+ config.buildSettings["FRAMEWORK_SEARCH_PATHS"] = "$(inherited) $(BUILT_PRODUCTS_DIR)"
+ config.buildSettings["SWIFT_INCLUDE_PATHS"] = "$(inherited) $(BUILT_PRODUCTS_DIR)"
+ // Add library search paths for static libraries
+ if !staticLibSearchPaths.isEmpty {
+ let existing = config.buildSettings["LIBRARY_SEARCH_PATHS"] as? String ?? "$(inherited)"
+ config.buildSettings["LIBRARY_SEARCH_PATHS"] = existing + " " + staticLibSearchPaths.sorted().joined(separator: " ")
+ }
+ }
+ }
+
+ // Collect SDK frameworks from this module and all transitive dependencies
+ var allSdkFrameworks: Set = []
+ if let sdkFrameworks = module.sdkFrameworks {
+ allSdkFrameworks.formUnion(sdkFrameworks)
+ }
+ for depName in allDeps {
+ if let depModule = modules[depName], let depFrameworks = depModule.sdkFrameworks {
+ allSdkFrameworks.formUnion(depFrameworks)
+ }
+ }
+
+ // Add SDK frameworks
+ for framework in allSdkFrameworks {
+ let fileRef = PBXFileReference(
+ sourceTree: .sdkRoot,
+ name: "\(framework).framework",
+ lastKnownFileType: "wrapper.framework",
+ path: "System/Library/Frameworks/\(framework).framework"
+ )
+ pbxproj.add(object: fileRef)
+ let buildFile = PBXBuildFile(file: fileRef)
+ pbxproj.add(object: buildFile)
+ frameworksPhase.files?.append(buildFile)
+ }
+
+ // Collect SDK dylibs from this module and all transitive dependencies
+ var allSdkDylibs: Set = []
+ if let sdkDylibs = module.sdkDylibs {
+ allSdkDylibs.formUnion(sdkDylibs)
+ }
+ for depName in allDeps {
+ if let depModule = modules[depName], let depDylibs = depModule.sdkDylibs {
+ allSdkDylibs.formUnion(depDylibs)
+ }
+ }
+
+ // Add SDK dylibs (system libraries like libz, libiconv, etc.)
+ for dylib in allSdkDylibs {
+ // Clean up the library name - remove 'lib' prefix if present
+ let libName = dylib.hasPrefix("lib") ? String(dylib.dropFirst(3)) : dylib
+ let fileRef = PBXFileReference(
+ sourceTree: .sdkRoot,
+ name: "lib\(libName).tbd",
+ lastKnownFileType: "sourcecode.text-based-dylib-definition",
+ path: "usr/lib/lib\(libName).tbd"
+ )
+ pbxproj.add(object: fileRef)
+ let buildFile = PBXBuildFile(file: fileRef)
+ pbxproj.add(object: buildFile)
+ frameworksPhase.files?.append(buildFile)
+ }
+ }
+ }
+
+ /// Returns the header search paths that this module exports to its dependents
+ private func exportedHeaderPaths(for module: ModuleDefinition) -> [String] {
+ var paths: [String] = []
+ if let includes = module.includes, !includes.isEmpty {
+ for inc in includes {
+ if inc == "." {
+ paths.append("$(SRCROOT)/\(module.path)")
+ } else {
+ paths.append("$(SRCROOT)/\(module.path)/\(inc)")
+ }
+ }
+ } else {
+ // No includes specified, export module's own path
+ paths.append("$(SRCROOT)/\(module.path)")
+ }
+ return paths
+ }
+
+ func getTarget(named name: String) -> PBXNativeTarget? {
+ return targetsByName[name]
+ }
+
+
+ private func createConfigurationList(for module: ModuleDefinition, isXCFramework: Bool, modulemapPath: Path? = nil) -> XCConfigurationList {
+ let debugSettings = createBuildSettings(for: module, isDebug: true, isXCFramework: isXCFramework, modulemapPath: modulemapPath)
+ let releaseSettings = createBuildSettings(for: module, isDebug: false, isXCFramework: isXCFramework, modulemapPath: modulemapPath)
+
+ let debugConfig = XCBuildConfiguration(name: "Debug", buildSettings: debugSettings)
+ let releaseConfig = XCBuildConfiguration(name: "Release", buildSettings: releaseSettings)
+
+ pbxproj.add(object: debugConfig)
+ pbxproj.add(object: releaseConfig)
+
+ let configList = XCConfigurationList(
+ buildConfigurations: [debugConfig, releaseConfig],
+ defaultConfigurationName: "Release"
+ )
+ pbxproj.add(object: configList)
+
+ return configList
+ }
+
+ private func createBuildSettings(for module: ModuleDefinition, isDebug: Bool, isXCFramework: Bool, modulemapPath: Path? = nil) -> BuildSettings {
+ var settings: BuildSettings = [
+ "PRODUCT_NAME": "$(TARGET_NAME)",
+ "PRODUCT_BUNDLE_IDENTIFIER": "org.telegram.\(module.name)",
+ "INFOPLIST_FILE": "",
+ "SKIP_INSTALL": "YES",
+ "GENERATE_INFOPLIST_FILE": "YES",
+ ]
+
+ let moduleType = ModuleType(from: module)
+
+ // Swift settings
+ if moduleType == .swiftLibrary {
+ settings["SWIFT_VERSION"] = "5.0"
+ settings["DEFINES_MODULE"] = "YES"
+
+ if let copts = module.copts, !copts.isEmpty {
+ let filtered = copts.filter { !$0.hasPrefix("-warnings") }
+ if !filtered.isEmpty {
+ settings["OTHER_SWIFT_FLAGS"] = "$(inherited) " + filtered.joined(separator: " ")
+ }
+ }
+
+ if let defines = module.defines, !defines.isEmpty {
+ settings["SWIFT_ACTIVE_COMPILATION_CONDITIONS"] = "$(inherited) " + defines.joined(separator: " ")
+ }
+ }
+
+ // C/ObjC settings
+ if moduleType == .objcLibrary || moduleType == .ccLibrary {
+ // Always suppress deprecated warnings (e.g., OSSpinLock) and don't treat warnings as errors
+ var cflags = ["-Wno-deprecated-declarations"]
+ if let copts = module.copts, !copts.isEmpty {
+ let filtered = copts.filter { !$0.hasPrefix("-warnings") && !$0.hasPrefix("-W") }
+ cflags.append(contentsOf: filtered)
+ }
+ settings["OTHER_CFLAGS"] = "$(inherited) " + cflags.joined(separator: " ")
+ settings["GCC_TREAT_WARNINGS_AS_ERRORS"] = "NO"
+
+ if let cxxopts = module.cxxopts, !cxxopts.isEmpty {
+ let filtered = cxxopts.filter { !$0.hasPrefix("-std=") }
+ if !filtered.isEmpty {
+ settings["OTHER_CPLUSPLUSFLAGS"] = "$(inherited) " + filtered.joined(separator: " ")
+ }
+ }
+
+ if let defines = module.defines, !defines.isEmpty {
+ settings["GCC_PREPROCESSOR_DEFINITIONS"] = "$(inherited) " + defines.joined(separator: " ")
+ }
+
+ // Always include module's own path for header search
+ var headerPaths = ["$(SRCROOT)/\(module.path)"]
+ if let includes = module.includes {
+ for inc in includes where inc != "." {
+ headerPaths.append("$(SRCROOT)/\(module.path)/\(inc)")
+ }
+ }
+ settings["HEADER_SEARCH_PATHS"] = "$(inherited) " + headerPaths.joined(separator: " ")
+
+ // Use custom modulemap if provided (SPM-style)
+ if let modmap = modulemapPath {
+ // Get relative path from SRCROOT
+ let relativePath = modmap.string.replacingOccurrences(of: outputDir.string + "/", with: "")
+ settings["MODULEMAP_FILE"] = "$(SRCROOT)/\(relativePath)"
+ }
+ settings["DEFINES_MODULE"] = "YES"
+ }
+
+ return settings
+ }
+
+ private func getOrCreateGroup(for path: String) throws -> PBXGroup {
+ if let existing = groupsByPath[path] {
+ return existing
+ }
+
+ let components = path.split(separator: "/").map(String.init)
+ var currentGroup = mainGroup
+ var currentPath = ""
+
+ for component in components {
+ currentPath = currentPath.isEmpty ? component : currentPath + "/" + component
+
+ if let existing = groupsByPath[currentPath] {
+ currentGroup = existing
+ } else {
+ let newGroup = PBXGroup(children: [], sourceTree: .group, name: component, path: component)
+ pbxproj.add(object: newGroup)
+ currentGroup.children.append(newGroup)
+ groupsByPath[currentPath] = newGroup
+ currentGroup = newGroup
+ }
+ }
+
+ return currentGroup
+ }
+
+ private func getOrCreateFileReference(path: String, in group: PBXGroup, modulePath: String, fileName: String) throws -> PBXFileReference {
+ let pathComponents = path.split(separator: "/").map(String.init)
+
+ var currentGroup = group
+ var currentPath = modulePath
+
+ // Navigate/create intermediate groups
+ for component in pathComponents.dropLast() {
+ currentPath = currentPath + "/" + component
+ if let existing = groupsByPath[currentPath] {
+ currentGroup = existing
+ } else {
+ let newGroup = PBXGroup(children: [], sourceTree: .group, name: component, path: component)
+ pbxproj.add(object: newGroup)
+ currentGroup.children.append(newGroup)
+ groupsByPath[currentPath] = newGroup
+ currentGroup = newGroup
+ }
+ }
+
+ // Create file reference
+ let fileType = lastKnownFileType(for: fileName)
+ let fileRef = PBXFileReference(
+ sourceTree: .group,
+ name: fileName,
+ lastKnownFileType: fileType,
+ path: fileName
+ )
+ pbxproj.add(object: fileRef)
+ currentGroup.children.append(fileRef)
+
+ return fileRef
+ }
+
+ private func lastKnownFileType(for fileName: String) -> String {
+ let ext = (fileName as NSString).pathExtension.lowercased()
+ switch ext {
+ case "swift": return "sourcecode.swift"
+ case "m": return "sourcecode.c.objc"
+ case "mm": return "sourcecode.cpp.objcpp"
+ case "c": return "sourcecode.c.c"
+ case "cc", "cpp", "cxx": return "sourcecode.cpp.cpp"
+ case "h": return "sourcecode.c.h"
+ case "hpp": return "sourcecode.cpp.h"
+ case "metal": return "sourcecode.metal"
+ case "json": return "text.json"
+ case "plist": return "text.plist.xml"
+ default: return "text"
+ }
+ }
+
+ /// Extract the relative path within a module from a source path
+ /// Handles both regular paths (submodules/Foo/...) and bazel-out paths (bazel-out/.../bin/submodules/Foo/...)
+ private func relativePathInModule(source: String, modulePath: String) -> String {
+ if source.hasPrefix(modulePath + "/") {
+ return String(source.dropFirst(modulePath.count + 1))
+ } else if source.hasPrefix("bazel-out/") {
+ // Generated file - extract path after the module path portion
+ if let range = source.range(of: modulePath + "/") {
+ return String(source[range.upperBound...])
+ } else {
+ return Path(source).lastComponent
+ }
+ } else {
+ return Path(source).lastComponent
+ }
+ }
+
+ /// Check if a source file is in one of the includes directories
+ private func isInIncludesDirectory(source: String, modulePath: String, includes: [String]?) -> Bool {
+ guard let includes = includes, !includes.isEmpty else {
+ return false
+ }
+ let relative = relativePathInModule(source: source, modulePath: modulePath)
+ return includes.contains { inc in
+ if inc == "." {
+ return true // All files in module are public
+ } else {
+ return relative.hasPrefix(inc + "/") || relative == inc
+ }
+ }
+ }
+
+ /// Generates an explicit module.modulemap for ObjC/C++ modules (SPM-style)
+ /// Returns the path to the modulemap, or nil if no public headers
+ func generateModulemap(for module: ModuleDefinition) throws -> Path? {
+ let moduleType = ModuleType(from: module)
+ guard moduleType == .objcLibrary || moduleType == .ccLibrary else {
+ return nil
+ }
+
+ // Determine public header prefix from includes
+ let publicHeaderPrefix: String
+ if let includes = module.includes, !includes.isEmpty {
+ let firstInclude = includes[0]
+ publicHeaderPrefix = firstInclude == "." ? "" : firstInclude
+ } else {
+ publicHeaderPrefix = ""
+ }
+
+ // Determine public headers
+ let explicitPublicHeaders = Set(module.hdrs ?? [])
+
+ let allFiles = module.sources + (module.hdrs ?? []) + (module.textualHdrs ?? [])
+ let allHeaders = allFiles.filter { $0.hasSuffix(".h") || $0.hasSuffix(".hpp") }
+
+ // Determine which headers are public
+ let publicHeaders: [String]
+ if !explicitPublicHeaders.isEmpty {
+ publicHeaders = allHeaders.filter { explicitPublicHeaders.contains($0) }
+ } else if module.includes != nil && !module.includes!.isEmpty {
+ // Use helper that properly handles bazel-out paths
+ publicHeaders = allHeaders.filter { header in
+ isInIncludesDirectory(source: header, modulePath: module.path, includes: module.includes)
+ }
+ } else {
+ publicHeaders = []
+ }
+
+ guard !publicHeaders.isEmpty else {
+ return nil
+ }
+
+ // Generate explicit modulemap content (SPM-style)
+ var content = "// module.modulemap for \(module.name)\n"
+ content += "// Auto-generated - do not edit\n\n"
+ content += "module \(module.name) {\n"
+
+ for header in publicHeaders {
+ // Calculate the symlinked path - matches the symlink creation in buildFrameworkTarget
+ // The symlink is at: outputDir + module.path + relativeToModule
+ let relativeToModule = relativePathInModule(source: header, modulePath: module.path)
+ let symlinkPath = outputDir + module.path + relativeToModule
+ content += " header \"\(symlinkPath.string)\"\n"
+ }
+
+ content += " export *\n"
+ content += "}\n"
+
+ // Write modulemap to the public headers directory
+ let modulemapDir: Path
+ if !publicHeaderPrefix.isEmpty {
+ modulemapDir = outputDir + module.path + publicHeaderPrefix
+ } else {
+ modulemapDir = outputDir + module.path
+ }
+ let modulemapPath = modulemapDir + "module.modulemap"
+
+ try modulemapDir.mkpath()
+ try modulemapPath.write(content)
+
+ // Track this file so it doesn't get cleaned up
+ symlinkManager.markFile(modulemapPath)
+
+ return modulemapPath
+ }
+}
diff --git a/build-system/MakeProject/Sources/MakeProject/main.swift b/build-system/MakeProject/Sources/MakeProject/main.swift
new file mode 100644
index 00000000..31fd3656
--- /dev/null
+++ b/build-system/MakeProject/Sources/MakeProject/main.swift
@@ -0,0 +1,51 @@
+import Foundation
+import ArgumentParser
+import PathKit
+
+struct MakeProject: ParsableCommand {
+ static let configuration = CommandConfiguration(
+ commandName: "MakeProject",
+ abstract: "Generate Xcode project from Bazel module definitions"
+ )
+
+ @Option(name: .long, help: "Path to modules JSON file")
+ var modulesJson: String = "bazel-bin/Telegram/spm_build_root_modules.json"
+
+ @Option(name: .long, help: "Output directory for generated project")
+ var output: String = "xcode-files"
+
+ func run() throws {
+ // Determine project root (where we find the modules JSON)
+ let currentDir = Path.current
+ var projectRoot = currentDir
+
+ // Walk up to find project root (contains bazel-bin or the modules file)
+ var searchDir = currentDir
+ for _ in 0..<5 {
+ if (searchDir + modulesJson).exists {
+ projectRoot = searchDir
+ break
+ }
+ searchDir = searchDir.parent()
+ }
+
+ let modulesPath = projectRoot + modulesJson
+ let outputDir = projectRoot + output
+
+ guard modulesPath.exists else {
+ print("Error: Modules JSON not found at \(modulesPath)")
+ print("Run 'bazel build //Telegram:spm_build_root' first")
+ throw ExitCode.failure
+ }
+
+ let generator = ProjectGenerator(
+ modulesPath: modulesPath,
+ outputDir: outputDir,
+ projectRoot: projectRoot
+ )
+
+ try generator.generate()
+ }
+}
+
+MakeProject.main()
diff --git a/build-system/appcenter-configuration.json b/build-system/appcenter-configuration.json
index 5623b6d4..b86e141c 100755
--- a/build-system/appcenter-configuration.json
+++ b/build-system/appcenter-configuration.json
@@ -1,7 +1,7 @@
{
"bundle_id": "ph.telegra.Telegraph",
"api_id": "8",
- "api_hash": "YOUR_API_HASH",
+ "api_hash": "7245de8e747a0d6fbe11f7cc14fcc0bb",
"team_id": "C67CF9S4VU",
"app_center_id": "4c816ed0-df83-423c-846b-a0a8467dc7d2",
"is_internal_build": "false",
diff --git a/build-system/appstore-configuration.json b/build-system/appstore-configuration.json
index 79702e8a..9dea3548 100755
--- a/build-system/appstore-configuration.json
+++ b/build-system/appstore-configuration.json
@@ -1,7 +1,7 @@
{
"bundle_id": "ph.telegra.Telegraph",
"api_id": "8",
- "api_hash": "YOUR_API_HASH",
+ "api_hash": "7245de8e747a0d6fbe11f7cc14fcc0bb",
"team_id": "C67CF9S4VU",
"app_center_id": "0",
"is_internal_build": "false",
diff --git a/build-system/example-configuration/provisioning/BroadcastUpload.mobileprovision b/build-system/example-configuration/provisioning/BroadcastUpload.mobileprovision
new file mode 100644
index 00000000..90bc0e0e
Binary files /dev/null and b/build-system/example-configuration/provisioning/BroadcastUpload.mobileprovision differ
diff --git a/build-system/example-configuration/provisioning/Intents.mobileprovision b/build-system/example-configuration/provisioning/Intents.mobileprovision
new file mode 100644
index 00000000..3de2acb5
Binary files /dev/null and b/build-system/example-configuration/provisioning/Intents.mobileprovision differ
diff --git a/build-system/example-configuration/provisioning/NotificationContent.mobileprovision b/build-system/example-configuration/provisioning/NotificationContent.mobileprovision
new file mode 100644
index 00000000..2866dd88
Binary files /dev/null and b/build-system/example-configuration/provisioning/NotificationContent.mobileprovision differ
diff --git a/build-system/example-configuration/provisioning/NotificationService.mobileprovision b/build-system/example-configuration/provisioning/NotificationService.mobileprovision
new file mode 100644
index 00000000..a0f5e98a
Binary files /dev/null and b/build-system/example-configuration/provisioning/NotificationService.mobileprovision differ
diff --git a/build-system/example-configuration/provisioning/Share.mobileprovision b/build-system/example-configuration/provisioning/Share.mobileprovision
new file mode 100644
index 00000000..636d4658
Binary files /dev/null and b/build-system/example-configuration/provisioning/Share.mobileprovision differ
diff --git a/build-system/example-configuration/provisioning/Telegram.mobileprovision b/build-system/example-configuration/provisioning/Telegram.mobileprovision
new file mode 100644
index 00000000..534e1305
Binary files /dev/null and b/build-system/example-configuration/provisioning/Telegram.mobileprovision differ
diff --git a/build-system/example-configuration/provisioning/WatchApp.mobileprovision b/build-system/example-configuration/provisioning/WatchApp.mobileprovision
new file mode 100644
index 00000000..112b95d6
Binary files /dev/null and b/build-system/example-configuration/provisioning/WatchApp.mobileprovision differ
diff --git a/build-system/example-configuration/provisioning/WatchExtension.mobileprovision b/build-system/example-configuration/provisioning/WatchExtension.mobileprovision
new file mode 100644
index 00000000..87440042
Binary files /dev/null and b/build-system/example-configuration/provisioning/WatchExtension.mobileprovision differ
diff --git a/build-system/example-configuration/provisioning/Widget.mobileprovision b/build-system/example-configuration/provisioning/Widget.mobileprovision
new file mode 100644
index 00000000..7f4ae880
Binary files /dev/null and b/build-system/example-configuration/provisioning/Widget.mobileprovision differ
diff --git a/build-system/example-configuration/variables.bzl b/build-system/example-configuration/variables.bzl
index c035abfc..ed0fce46 100644
--- a/build-system/example-configuration/variables.bzl
+++ b/build-system/example-configuration/variables.bzl
@@ -1,7 +1,7 @@
telegram_bundle_id = "ph.telegra.Telegraph"
telegram_api_id = "8"
-telegram_api_hash = "YOUR_API_HASH"
+telegram_api_hash = "7245de8e747a0d6fbe11f7cc14fcc0bb"
telegram_team_id = "C67CF9S4VU"
telegram_app_center_id = "0"
telegram_is_internal_build = "false"
diff --git a/build-system/fake-codesigning/profiles/BroadcastUpload.mobileprovision b/build-system/fake-codesigning/profiles/BroadcastUpload.mobileprovision
new file mode 100644
index 00000000..76d68f79
Binary files /dev/null and b/build-system/fake-codesigning/profiles/BroadcastUpload.mobileprovision differ
diff --git a/build-system/fake-codesigning/profiles/Intents.mobileprovision b/build-system/fake-codesigning/profiles/Intents.mobileprovision
new file mode 100644
index 00000000..5d102699
Binary files /dev/null and b/build-system/fake-codesigning/profiles/Intents.mobileprovision differ
diff --git a/build-system/fake-codesigning/profiles/NotificationContent.mobileprovision b/build-system/fake-codesigning/profiles/NotificationContent.mobileprovision
new file mode 100644
index 00000000..1f3b13bf
Binary files /dev/null and b/build-system/fake-codesigning/profiles/NotificationContent.mobileprovision differ
diff --git a/build-system/fake-codesigning/profiles/NotificationService.mobileprovision b/build-system/fake-codesigning/profiles/NotificationService.mobileprovision
new file mode 100644
index 00000000..809c9c8a
Binary files /dev/null and b/build-system/fake-codesigning/profiles/NotificationService.mobileprovision differ
diff --git a/build-system/fake-codesigning/profiles/Share.mobileprovision b/build-system/fake-codesigning/profiles/Share.mobileprovision
new file mode 100644
index 00000000..cc40fa6a
Binary files /dev/null and b/build-system/fake-codesigning/profiles/Share.mobileprovision differ
diff --git a/build-system/fake-codesigning/profiles/Telegram.mobileprovision b/build-system/fake-codesigning/profiles/Telegram.mobileprovision
new file mode 100644
index 00000000..0db3e47c
Binary files /dev/null and b/build-system/fake-codesigning/profiles/Telegram.mobileprovision differ
diff --git a/build-system/fake-codesigning/profiles/WatchApp.mobileprovision b/build-system/fake-codesigning/profiles/WatchApp.mobileprovision
new file mode 100644
index 00000000..b766d12e
Binary files /dev/null and b/build-system/fake-codesigning/profiles/WatchApp.mobileprovision differ
diff --git a/build-system/fake-codesigning/profiles/WatchExtension.mobileprovision b/build-system/fake-codesigning/profiles/WatchExtension.mobileprovision
new file mode 100644
index 00000000..43d092ff
Binary files /dev/null and b/build-system/fake-codesigning/profiles/WatchExtension.mobileprovision differ
diff --git a/build-system/fake-codesigning/profiles/Widget.mobileprovision b/build-system/fake-codesigning/profiles/Widget.mobileprovision
new file mode 100644
index 00000000..e578d141
Binary files /dev/null and b/build-system/fake-codesigning/profiles/Widget.mobileprovision differ
diff --git a/build-system/verify.sh b/build-system/verify.sh
index 30894933..fce7a685 100644
--- a/build-system/verify.sh
+++ b/build-system/verify.sh
@@ -7,7 +7,7 @@ export DISTRIBUTION_CODE_SIGN_IDENTITY="iPhone Distribution: Digital Fortress LL
export DEVELOPMENT_TEAM="C67CF9S4VU"
export API_ID="8"
-export API_HASH="YOUR_API_HASH"
+export API_HASH="7245de8e747a0d6fbe11f7cc14fcc0bb"
export BUNDLE_ID="ph.telegra.Telegraph"
export APP_CENTER_ID="0"
diff --git a/buildbox/fake-codesigning/profiles/appstore/AppStore_ph.telegra.Telegraph.NotificationContent.mobileprovision b/buildbox/fake-codesigning/profiles/appstore/AppStore_ph.telegra.Telegraph.NotificationContent.mobileprovision
new file mode 100644
index 00000000..bd054573
Binary files /dev/null and b/buildbox/fake-codesigning/profiles/appstore/AppStore_ph.telegra.Telegraph.NotificationContent.mobileprovision differ
diff --git a/buildbox/fake-codesigning/profiles/appstore/AppStore_ph.telegra.Telegraph.NotificationService.mobileprovision b/buildbox/fake-codesigning/profiles/appstore/AppStore_ph.telegra.Telegraph.NotificationService.mobileprovision
new file mode 100644
index 00000000..663bd68b
Binary files /dev/null and b/buildbox/fake-codesigning/profiles/appstore/AppStore_ph.telegra.Telegraph.NotificationService.mobileprovision differ
diff --git a/buildbox/fake-codesigning/profiles/appstore/AppStore_ph.telegra.Telegraph.Share.mobileprovision b/buildbox/fake-codesigning/profiles/appstore/AppStore_ph.telegra.Telegraph.Share.mobileprovision
new file mode 100644
index 00000000..e49de2d7
Binary files /dev/null and b/buildbox/fake-codesigning/profiles/appstore/AppStore_ph.telegra.Telegraph.Share.mobileprovision differ
diff --git a/buildbox/fake-codesigning/profiles/appstore/AppStore_ph.telegra.Telegraph.SiriIntents.mobileprovision b/buildbox/fake-codesigning/profiles/appstore/AppStore_ph.telegra.Telegraph.SiriIntents.mobileprovision
new file mode 100644
index 00000000..8cb484f9
Binary files /dev/null and b/buildbox/fake-codesigning/profiles/appstore/AppStore_ph.telegra.Telegraph.SiriIntents.mobileprovision differ
diff --git a/buildbox/fake-codesigning/profiles/appstore/AppStore_ph.telegra.Telegraph.Widget.mobileprovision b/buildbox/fake-codesigning/profiles/appstore/AppStore_ph.telegra.Telegraph.Widget.mobileprovision
new file mode 100644
index 00000000..37de9fe5
Binary files /dev/null and b/buildbox/fake-codesigning/profiles/appstore/AppStore_ph.telegra.Telegraph.Widget.mobileprovision differ
diff --git a/buildbox/fake-codesigning/profiles/appstore/AppStore_ph.telegra.Telegraph.mobileprovision b/buildbox/fake-codesigning/profiles/appstore/AppStore_ph.telegra.Telegraph.mobileprovision
new file mode 100644
index 00000000..15926743
Binary files /dev/null and b/buildbox/fake-codesigning/profiles/appstore/AppStore_ph.telegra.Telegraph.mobileprovision differ
diff --git a/buildbox/fake-codesigning/profiles/appstore/AppStore_ph.telegra.Telegraph.watchkitapp.mobileprovision b/buildbox/fake-codesigning/profiles/appstore/AppStore_ph.telegra.Telegraph.watchkitapp.mobileprovision
new file mode 100644
index 00000000..2b0558a2
Binary files /dev/null and b/buildbox/fake-codesigning/profiles/appstore/AppStore_ph.telegra.Telegraph.watchkitapp.mobileprovision differ
diff --git a/buildbox/fake-codesigning/profiles/appstore/AppStore_ph.telegra.Telegraph.watchkitapp.watchkitextension.mobileprovision b/buildbox/fake-codesigning/profiles/appstore/AppStore_ph.telegra.Telegraph.watchkitapp.watchkitextension.mobileprovision
new file mode 100644
index 00000000..ba9ce392
Binary files /dev/null and b/buildbox/fake-codesigning/profiles/appstore/AppStore_ph.telegra.Telegraph.watchkitapp.watchkitextension.mobileprovision differ
diff --git a/codesigning/profiles_backup/Ghostgram_BroadcastUpload_Distribution.mobileprovision b/codesigning/profiles_backup/Ghostgram_BroadcastUpload_Distribution.mobileprovision
new file mode 100644
index 00000000..a0439365
Binary files /dev/null and b/codesigning/profiles_backup/Ghostgram_BroadcastUpload_Distribution.mobileprovision differ
diff --git a/codesigning/profiles_backup/Ghostgram_Distribution.mobileprovision b/codesigning/profiles_backup/Ghostgram_Distribution.mobileprovision
new file mode 100644
index 00000000..fac7f9c4
Binary files /dev/null and b/codesigning/profiles_backup/Ghostgram_Distribution.mobileprovision differ
diff --git a/codesigning/profiles_backup/Ghostgram_NotificationContent_Distribution.mobileprovision b/codesigning/profiles_backup/Ghostgram_NotificationContent_Distribution.mobileprovision
new file mode 100644
index 00000000..c7ae0b3f
Binary files /dev/null and b/codesigning/profiles_backup/Ghostgram_NotificationContent_Distribution.mobileprovision differ
diff --git a/codesigning/profiles_backup/Ghostgram_NotificationService_Dist.mobileprovision b/codesigning/profiles_backup/Ghostgram_NotificationService_Dist.mobileprovision
new file mode 100644
index 00000000..af2aad2f
Binary files /dev/null and b/codesigning/profiles_backup/Ghostgram_NotificationService_Dist.mobileprovision differ
diff --git a/codesigning/profiles_backup/Ghostgram_Share_Distribution.mobileprovision b/codesigning/profiles_backup/Ghostgram_Share_Distribution.mobileprovision
new file mode 100644
index 00000000..0be3546f
Binary files /dev/null and b/codesigning/profiles_backup/Ghostgram_Share_Distribution.mobileprovision differ
diff --git a/codesigning/profiles_backup/Ghostgram_SiriIntents_Distribution.mobileprovision b/codesigning/profiles_backup/Ghostgram_SiriIntents_Distribution.mobileprovision
new file mode 100644
index 00000000..a5da2b13
Binary files /dev/null and b/codesigning/profiles_backup/Ghostgram_SiriIntents_Distribution.mobileprovision differ
diff --git a/codesigning/profiles_backup/Ghostgram_WatchApp_Distribution.mobileprovision b/codesigning/profiles_backup/Ghostgram_WatchApp_Distribution.mobileprovision
new file mode 100644
index 00000000..51a6911e
Binary files /dev/null and b/codesigning/profiles_backup/Ghostgram_WatchApp_Distribution.mobileprovision differ
diff --git a/codesigning/profiles_backup/Ghostgram_WatchExtension_Distribution.mobileprovision b/codesigning/profiles_backup/Ghostgram_WatchExtension_Distribution.mobileprovision
new file mode 100644
index 00000000..7e41ac87
Binary files /dev/null and b/codesigning/profiles_backup/Ghostgram_WatchExtension_Distribution.mobileprovision differ
diff --git a/codesigning/profiles_backup/Ghostgram_Widget_Distribution.mobileprovision b/codesigning/profiles_backup/Ghostgram_Widget_Distribution.mobileprovision
new file mode 100644
index 00000000..f2e8498e
Binary files /dev/null and b/codesigning/profiles_backup/Ghostgram_Widget_Distribution.mobileprovision differ
diff --git a/submodules/AccountContext/Sources/AccountContext.swift b/submodules/AccountContext/Sources/AccountContext.swift
index 0081e2c6..608bd418 100644
--- a/submodules/AccountContext/Sources/AccountContext.swift
+++ b/submodules/AccountContext/Sources/AccountContext.swift
@@ -1376,7 +1376,7 @@ public protocol SharedAccountContext: AnyObject {
func makeBotPreviewEditorScreen(context: AccountContext, source: Any?, target: Stories.PendingTarget, transitionArguments: (UIView, CGRect, UIImage?)?, transitionOut: @escaping () -> BotPreviewEditorTransitionOut?, externalState: MediaEditorTransitionOutExternalState, completion: @escaping (MediaEditorScreenResult, @escaping (@escaping () -> Void) -> Void) -> Void, cancelled: @escaping () -> Void) -> ViewController
func makeStickerEditorScreen(context: AccountContext, source: Any?, intro: Bool, transitionArguments: (UIView, CGRect, UIImage?)?, completion: @escaping (TelegramMediaFile, [String], @escaping () -> Void) -> Void, cancelled: @escaping () -> Void) -> ViewController
func makeStickerMediaPickerScreen(context: AccountContext, getSourceRect: @escaping () -> CGRect?, completion: @escaping (Any?, UIView?, CGRect, UIImage?, Bool, @escaping (Bool?) -> (UIView, CGRect)?, @escaping () -> Void) -> Void, dismissed: @escaping () -> Void) -> ViewController
- func makeAvatarMediaPickerScreen(context: AccountContext, getSourceRect: @escaping () -> CGRect?, canDelete: Bool, performDelete: @escaping () -> Void, completion: @escaping (Any?, UIView?, CGRect, UIImage?, Bool, @escaping (Bool?) -> (UIView, CGRect)?, @escaping () -> Void) -> Void, dismissed: @escaping () -> Void) -> ViewController
+ func makeAvatarMediaPickerScreen(context: AccountContext, getSourceRect: @escaping () -> CGRect?, canDelete: Bool, performDelete: @escaping () -> Void, completion: @escaping (Any?, UIView?, CGRect, UIImage?, Bool, @escaping (Bool?) -> (UIView, CGRect)?, @escaping () -> Void) -> Void, dismissed: @escaping () -> Void) -> (ViewController?, Any?)
func makeStoryMediaPickerScreen(context: AccountContext, isDark: Bool, forCollage: Bool, selectionLimit: Int?, getSourceRect: @escaping () -> CGRect, completion: @escaping (Any, UIView, CGRect, UIImage?, @escaping (Bool?) -> (UIView, CGRect)?, @escaping () -> Void) -> Void, multipleCompletion: @escaping ([Any], Bool) -> Void, dismissed: @escaping () -> Void, groupsPresented: @escaping () -> Void) -> ViewController
func makeStickerPickerScreen(context: AccountContext, inputData: Promise, completion: @escaping (FileMediaReference) -> Void) -> ViewController
func makeProxySettingsController(sharedContext: SharedAccountContext, account: UnauthorizedAccount) -> ViewController
@@ -1407,10 +1407,10 @@ public protocol SharedAccountContext: AnyObject {
func makeGiftUpgradePreviewScreen(context: AccountContext, attributes: [StarGift.UniqueGift.Attribute], peerName: String) -> ViewController
func makeGiftAuctionInfoScreen(context: AccountContext, auctionContext: GiftAuctionContext, completion: (() -> Void)?) -> ViewController
func makeGiftAuctionBidScreen(context: AccountContext, toPeerId: EnginePeer.Id, text: String?, entities: [MessageTextEntity]?, hideName: Bool, auctionContext: GiftAuctionContext, acquiredGifts: Signal<[GiftAuctionAcquiredGift], NoError>?) -> ViewController
- func makeGiftAuctionViewScreen(context: AccountContext, auctionContext: GiftAuctionContext, completion: @escaping (Signal<[GiftAuctionAcquiredGift], NoError>, [StarGift.UniqueGift.Attribute]?) -> Void) -> ViewController
+ func makeGiftAuctionViewScreen(context: AccountContext, auctionContext: GiftAuctionContext, peerId: EnginePeer.Id?, completion: @escaping (Signal<[GiftAuctionAcquiredGift], NoError>, [StarGift.UniqueGift.Attribute]?) -> Void) -> ViewController
func makeGiftAuctionActiveBidsScreen(context: AccountContext) -> ViewController
- func makeGiftOfferScreen(context: AccountContext, gift: StarGift.UniqueGift, peer: EnginePeer, amount: CurrencyAmount, commit: @escaping () -> Void) -> ViewController
- func makeGiftUpgradeVariantsPreviewScreen(context: AccountContext, gift: StarGift, attributes: [StarGift.UniqueGift.Attribute]) -> ViewController
+ func makeGiftOfferScreen(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal)?, gift: StarGift.UniqueGift, peer: EnginePeer, amount: CurrencyAmount, commit: @escaping () -> Void) -> ViewController
+ func makeGiftUpgradeVariantsScreen(context: AccountContext, gift: StarGift, attributes: [StarGift.UniqueGift.Attribute], selectedAttributes: [StarGift.UniqueGift.Attribute]?, focusedAttribute: StarGift.UniqueGift.Attribute?) -> ViewController
func makeGiftAuctionWearPreviewScreen(context: AccountContext, auctionContext: GiftAuctionContext, acquiredGifts: Signal<[GiftAuctionAcquiredGift], NoError>?, attributes: [StarGift.UniqueGift.Attribute], completion: @escaping () -> Void) -> ViewController
func makeGiftDemoScreen(context: AccountContext) -> ViewController
func makeStorySharingScreen(context: AccountContext, subject: StorySharingSubject, parentController: ViewController) -> ViewController
@@ -1428,6 +1428,8 @@ public protocol SharedAccountContext: AnyObject {
func makeGalleryController(context: AccountContext, source: GalleryControllerItemSource, streamSingleVideo: Bool, isPreview: Bool) -> ViewController
func makeAccountFreezeInfoScreen(context: AccountContext) -> ViewController
func makeSendInviteLinkScreen(context: AccountContext, subject: SendInviteLinkScreenSubject, peers: [TelegramForbiddenInvitePeer], theme: PresentationTheme?) -> ViewController
+ func makeCocoonInfoScreen(context: AccountContext) -> ViewController
+ func makeLinkEditController(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal)?, text: String, link: String?, apply: @escaping (String?) -> Void) -> ViewController
@available(iOS 13.0, *)
func makePostSuggestionsSettingsScreen(context: AccountContext, peerId: EnginePeer.Id) async -> ViewController
@@ -1678,7 +1680,7 @@ public struct StarsSubscriptionConfiguration {
return StarsSubscriptionConfiguration(
maxFee: 2500,
usdWithdrawRate: 1200,
- tonUsdRate: 0,
+ tonUsdRate: 1.0,
paidMessageMaxAmount: 10000,
paidMessageCommissionPermille: 850,
paidMessagesAvailable: false,
@@ -1698,7 +1700,7 @@ public struct StarsSubscriptionConfiguration {
public let maxFee: Int64
public let usdWithdrawRate: Int64
- public let tonUsdRate: Int64
+ public let tonUsdRate: Double
public let paidMessageMaxAmount: Int64
public let paidMessageCommissionPermille: Int32
public let paidMessagesAvailable: Bool
@@ -1717,7 +1719,7 @@ public struct StarsSubscriptionConfiguration {
fileprivate init(
maxFee: Int64,
usdWithdrawRate: Int64,
- tonUsdRate: Int64,
+ tonUsdRate: Double,
paidMessageMaxAmount: Int64,
paidMessageCommissionPermille: Int32,
paidMessagesAvailable: Bool,
@@ -1756,7 +1758,7 @@ public struct StarsSubscriptionConfiguration {
if let data = appConfiguration.data {
let maxFee = (data["stars_subscription_amount_max"] as? Double).flatMap(Int64.init) ?? StarsSubscriptionConfiguration.defaultValue.maxFee
let usdWithdrawRate = (data["stars_usd_withdraw_rate_x1000"] as? Double).flatMap(Int64.init) ?? StarsSubscriptionConfiguration.defaultValue.usdWithdrawRate
- let tonUsdRate = (data["ton_usd_rate"] as? Double).flatMap(Int64.init) ?? StarsSubscriptionConfiguration.defaultValue.tonUsdRate
+ let tonUsdRate = (data["ton_usd_rate"] as? Double) ?? StarsSubscriptionConfiguration.defaultValue.tonUsdRate
let paidMessageMaxAmount = (data["stars_paid_message_amount_max"] as? Double).flatMap(Int64.init) ?? StarsSubscriptionConfiguration.defaultValue.paidMessageMaxAmount
let paidMessageCommissionPermille = (data["stars_paid_message_commission_permille"] as? Double).flatMap(Int32.init) ?? StarsSubscriptionConfiguration.defaultValue.paidMessageCommissionPermille
let paidMessagesAvailable = (data["stars_paid_messages_available"] as? Bool) ?? StarsSubscriptionConfiguration.defaultValue.paidMessagesAvailable
diff --git a/submodules/AccountContext/Sources/ChatController.swift b/submodules/AccountContext/Sources/ChatController.swift
index d8860963..e499fc07 100644
--- a/submodules/AccountContext/Sources/ChatController.swift
+++ b/submodules/AccountContext/Sources/ChatController.swift
@@ -1216,7 +1216,7 @@ public enum ChatHistoryListDisplayHeaders {
public enum ChatHistoryListMode: Equatable {
case bubbles
- case list(search: Bool, reversed: Bool, reverseGroups: Bool, displayHeaders: ChatHistoryListDisplayHeaders, hintLinks: Bool, isGlobalSearch: Bool)
+ case list(reversed: Bool, reverseGroups: Bool, displayHeaders: ChatHistoryListDisplayHeaders, hintLinks: Bool, isGlobalSearch: Bool)
}
public protocol ChatControllerInteractionProtocol: AnyObject {
diff --git a/submodules/AccountUtils/Sources/AccountUtils.swift b/submodules/AccountUtils/Sources/AccountUtils.swift
index 44d09f56..aa4f12eb 100644
--- a/submodules/AccountUtils/Sources/AccountUtils.swift
+++ b/submodules/AccountUtils/Sources/AccountUtils.swift
@@ -4,8 +4,9 @@ import TelegramCore
import TelegramUIPreferences
import AccountContext
-public let maximumNumberOfAccounts = 3
-public let maximumPremiumNumberOfAccounts = 4
+// GHOSTGRAM: Unlimited accounts bypass - always allow up to 10 accounts
+public let maximumNumberOfAccounts = 10
+public let maximumPremiumNumberOfAccounts = 10
public func activeAccountsAndPeers(context: AccountContext, includePrimary: Bool = false) -> Signal<((AccountContext, EnginePeer)?, [(AccountContext, EnginePeer, Int32)]), NoError> {
let sharedContext = context.sharedContext
diff --git a/submodules/AdUI/Sources/AdInfoScreen.swift b/submodules/AdUI/Sources/AdInfoScreen.swift
index 9a3309f9..7cecf822 100644
--- a/submodules/AdUI/Sources/AdInfoScreen.swift
+++ b/submodules/AdUI/Sources/AdInfoScreen.swift
@@ -73,7 +73,7 @@ public final class AdInfoScreen: ViewController {
self.titleNode = ImmediateTextNode()
self.titleNode.maximumNumberOfLines = 1
- self.titleNode.attributedText = NSAttributedString(string: self.presentationData.strings.SponsoredMessageInfoScreen_Title, font: NavigationBar.titleFont, textColor: self.presentationData.theme.rootController.navigationBar.primaryTextColor)
+ self.titleNode.attributedText = NSAttributedString(string: self.presentationData.strings.SponsoredMessageInfoScreen_Title, font: Font.with(size: 17.0, design: .regular, weight: .semibold, traits: [.monospacedNumbers]), textColor: self.presentationData.theme.rootController.navigationBar.primaryTextColor)
self.scrollNode = ASScrollNode()
self.scrollNode.view.showsVerticalScrollIndicator = true
diff --git a/submodules/AttachmentUI/BUILD b/submodules/AttachmentUI/BUILD
index d29a2ee4..21040b91 100644
--- a/submodules/AttachmentUI/BUILD
+++ b/submodules/AttachmentUI/BUILD
@@ -44,6 +44,8 @@ swift_library(
"//submodules/TelegramUI/Components/MinimizedContainer",
"//submodules/TelegramUI/Components/GlassBackgroundComponent",
"//submodules/TelegramUI/Components/EdgeEffect",
+ "//submodules/TelegramUI/Components/LiquidLens",
+ "//submodules/TelegramUI/Components/TabSelectionRecognizer",
],
visibility = [
"//visibility:public",
diff --git a/submodules/AttachmentUI/Sources/AttachmentPanel.swift b/submodules/AttachmentUI/Sources/AttachmentPanel.swift
index 66665ad2..d0f87723 100644
--- a/submodules/AttachmentUI/Sources/AttachmentPanel.swift
+++ b/submodules/AttachmentUI/Sources/AttachmentPanel.swift
@@ -24,6 +24,8 @@ import LegacyMessageInputPanelInputView
import ReactionSelectionNode
import TopMessageReactions
import GlassBackgroundComponent
+import LiquidLens
+import TabSelectionRecognizer
private let legacyButtonSize = CGSize(width: 88.0, height: 49.0)
private let glassButtonSize = CGSize(width: 72.0, height: 62.0)
@@ -887,7 +889,7 @@ private final class MainButtonNode: HighlightTrackingButtonNode {
}
}
-final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
+final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate, ASGestureRecognizerDelegate {
enum Style {
case glass
case legacy
@@ -912,12 +914,22 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
private let containerNode: ASDisplayNode
private var backgroundView: GlassBackgroundView?
+ private var liquidLensView: LiquidLensView?
private let backgroundNode: NavigationBackgroundNode
private let scrollNode: ASScrollNode
private let separatorNode: ASDisplayNode
private let selectionNode: ASImageNode
- private var buttonViews: [AnyHashable: ComponentHostView] = [:]
+
+ private var itemsContainer = UIView()
+ private var itemViews: [AnyHashable: ComponentHostView] = [:]
+ private var selectedItemsContainer = UIView()
+ private var selectedItemViews: [AnyHashable: ComponentHostView] = [:]
+ private var itemSizes: [AnyHashable: CGSize] = [:]
+
+ private var tabSelectionRecognizer: TabSelectionRecognizer?
+ private var selectionGestureState: (startX: CGFloat, currentX: CGFloat, itemId: AnyHashable, isLifted: Bool)?
+ private var lensIsLifted = false
private var textInputPanelNode: AttachmentTextInputPanelNode?
private var progressNode: LoadingProgressNode?
@@ -971,7 +983,7 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
self.makeEntityInputView = makeEntityInputView
- self.presentationInterfaceState = ChatPresentationInterfaceState(chatWallpaper: .builtin(WallpaperSettings()), theme: self.presentationData.theme, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameDisplayOrder: self.presentationData.nameDisplayOrder, limitsConfiguration: self.context.currentLimitsConfiguration.with { $0 }, fontSize: self.presentationData.chatFontSize, bubbleCorners: self.presentationData.chatBubbleCorners, accountPeerId: self.context.account.peerId, mode: .standard(.default), chatLocation: chatLocation ?? .peer(id: context.account.peerId), subject: nil, peerNearbyData: nil, greetingData: nil, pendingUnpinnedAllMessages: false, activeGroupCallInfo: nil, hasActiveGroupCall: false, importState: nil, threadData: nil, isGeneralThreadClosed: nil, replyMessage: nil, accountPeerColor: nil, businessIntro: nil)
+ self.presentationInterfaceState = ChatPresentationInterfaceState(chatWallpaper: .builtin(WallpaperSettings()), theme: self.presentationData.theme, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameDisplayOrder: self.presentationData.nameDisplayOrder, limitsConfiguration: self.context.currentLimitsConfiguration.with { $0 }, fontSize: self.presentationData.chatFontSize, bubbleCorners: self.presentationData.chatBubbleCorners, accountPeerId: self.context.account.peerId, mode: .standard(.default), chatLocation: chatLocation ?? .peer(id: context.account.peerId), subject: nil, peerNearbyData: nil, greetingData: nil, pendingUnpinnedAllMessages: false, activeGroupCallInfo: nil, hasActiveGroupCall: false, threadData: nil, isGeneralThreadClosed: nil, replyMessage: nil, accountPeerColor: nil, businessIntro: nil)
self.containerNode = ASDisplayNode()
self.containerNode.clipsToBounds = false
@@ -987,7 +999,7 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
self.mainButtonNode = MainButtonNode()
self.secondaryButtonNode = MainButtonNode()
-
+
super.init()
self.addSubnode(self.containerNode)
@@ -995,7 +1007,6 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
switch style {
case .glass:
self.scrollNode.cornerRadius = glassButtonSize.height * 0.5
- self.scrollNode.addSubnode(self.selectionNode)
case .legacy:
self.containerNode.addSubnode(self.backgroundNode)
self.containerNode.addSubnode(self.separatorNode)
@@ -1135,7 +1146,7 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
}
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
- let controller = chatTextLinkEditController(sharedContext: strongSelf.context.sharedContext, updatedPresentationData: (presentationData, .never()), account: strongSelf.context.account, text: text?.string ?? "", link: link, apply: { [weak self] link in
+ let controller = chatTextLinkEditController(context: strongSelf.context, updatedPresentationData: (presentationData, .never()), text: text?.string ?? "", link: link, apply: { [weak self] link in
if let strongSelf = self, let inputMode = inputMode, let selectionRange = selectionRange {
if let link = link {
strongSelf.updateChatPresentationInterfaceState(animated: true, { state in
@@ -1419,6 +1430,12 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
self.view.accessibilityTraits = .tabBar
}
+ func requestLayout(transition: ContainedViewLayoutTransition) {
+ if let layout = self.validLayout {
+ let _ = self.update(layout: layout, buttons: self.buttons, isSelecting: self.isSelecting, selectionCount: self.selectionCount, elevateProgress: self.elevateProgress, transition: transition)
+ }
+ }
+
@objc private func mainButtonPressed() {
self.onMainButtonPressed()
}
@@ -1473,6 +1490,105 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
}
}
+ private func item(at point: CGPoint) -> AnyHashable? {
+ let contentOffset = self.scrollNode.view.contentOffset.x
+ let point = point.offsetBy(dx: contentOffset, dy: 0.0)
+ var closestItem: (AnyHashable, CGFloat)?
+ for (id, itemView) in self.itemViews {
+ if itemView.frame.contains(point) {
+ return id
+ } else {
+ let distance = abs(point.x - itemView.center.x)
+ if let closestItemValue = closestItem {
+ if closestItemValue.1 > distance {
+ closestItem = (id, distance)
+ }
+ } else {
+ closestItem = (id, distance)
+ }
+ }
+ }
+ return closestItem?.0
+ }
+
+ @objc private func onTabSelectionGesture(_ recognizer: TabSelectionRecognizer) {
+ guard let liquidLensView = self.liquidLensView else {
+ return
+ }
+ let location = recognizer.location(in: liquidLensView.contentView)
+ switch recognizer.state {
+ case .began:
+ if let itemId = self.item(at: location), let itemView = self.itemViews[itemId] {
+ let startX = itemView.frame.minX
+ self.selectionGestureState = (startX, startX, itemId, !self.scrollNode.view.isScrollEnabled)
+
+ self.requestLayout(transition: .animated(duration: 0.4, curve: .spring))
+ }
+ case .changed:
+ if var selectionGestureState = self.selectionGestureState {
+ selectionGestureState.currentX = selectionGestureState.startX + recognizer.translation(in: self.view).x
+ if let itemId = self.item(at: location) {
+ selectionGestureState.itemId = itemId
+ }
+ self.selectionGestureState = selectionGestureState
+ self.requestLayout(transition: .immediate)
+ }
+ case .ended, .cancelled:
+ if let selectionGestureState = self.selectionGestureState {
+ if !selectionGestureState.isLifted {
+ self.lensIsLifted = true
+ self.requestLayout(transition: .animated(duration: 0.4, curve: .spring))
+
+ self.liquidLensView?.clipsToBounds = false
+
+ Queue.mainQueue().after(0.1, {
+ self.lensIsLifted = false
+ self.requestLayout(transition: .animated(duration: 0.4, curve: .spring))
+ Queue.mainQueue().after(0.4, {
+ self.liquidLensView?.clipsToBounds = true
+ })
+ })
+ }
+
+ self.selectionGestureState = nil
+ if case .ended = recognizer.state {
+ guard let index = self.buttons.firstIndex(where: { AnyHashable($0.key) == selectionGestureState.itemId }) else {
+ return
+ }
+ let button = self.buttons[index]
+ self.skipLensUpdate = true
+ if self.selectionChanged(button) {
+ self.selectedIndex = index
+ if self.buttons.count > 5, let button = self.itemViews[button.key] {
+ let transition = ComponentTransition.spring(duration: 0.4)
+
+ let scrollView = self.scrollNode.view
+ let targetRect = button.frame.insetBy(dx: -35.0, dy: 0.0)
+
+ var newBounds = scrollView.bounds
+ if targetRect.minX < scrollView.bounds.minX {
+ newBounds.origin.x = targetRect.minX
+ }
+ else if targetRect.maxX > scrollView.bounds.maxX {
+ newBounds.origin.x = targetRect.maxX - scrollView.bounds.width
+ }
+ let minX = 0.0
+ let maxX = scrollView.contentSize.width - scrollView.bounds.width
+ newBounds.origin.x = max(minX, min(newBounds.origin.x, maxX))
+
+ transition.setBounds(view: scrollView, bounds: newBounds)
+ self.updateItemContainers(contentOffset: newBounds.minX, transition: transition)
+ }
+ }
+ self.skipLensUpdate = false
+ }
+ self.requestLayout(transition: .animated(duration: 0.4, curve: .spring))
+ }
+ default:
+ break
+ }
+ }
+
func updateViews(transition: ComponentTransition) {
guard let layout = self.validLayout else {
return
@@ -1486,18 +1602,16 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
case .legacy:
panelSideInset = 3.0
}
-
- let visibleRect = self.scrollNode.bounds.insetBy(dx: -180.0, dy: 0.0)
-
+
var distanceBetweenNodes = floorToScreenPixels((width - panelSideInset * 2.0 - self.buttonSize.width) / CGFloat(max(1, self.buttons.count - 1)))
let internalWidth = distanceBetweenNodes * CGFloat(self.buttons.count - 1)
var buttonWidth = self.buttonSize.width
var leftNodeOriginX: CGFloat
- var maxButtonsToFit = 6
+ var maxButtonsToFit = 5
switch self.panelStyle {
case .glass:
- leftNodeOriginX = layout.safeInsets.left + 3.0 + buttonWidth / 2.0
- if layout.size.width < 400.0 {
+ leftNodeOriginX = layout.safeInsets.left + buttonWidth / 2.0
+ if layout.size.width < 420.0 {
maxButtonsToFit = 5
}
case .legacy:
@@ -1513,7 +1627,7 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
buttonWidth = smallButtonWidth
distanceBetweenNodes = 60.0
}
- leftNodeOriginX = layout.safeInsets.left + 3.0 + buttonWidth / 2.0
+ leftNodeOriginX = layout.safeInsets.left + buttonWidth / 2.0
}
var validIds = Set()
@@ -1521,25 +1635,28 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
var selectionFrame = CGRect()
var mostRightX = 0.0
for i in 0 ..< self.buttons.count {
- let originX = floor(leftNodeOriginX + CGFloat(i) * distanceBetweenNodes - buttonWidth / 2.0)
- let buttonFrame = CGRect(origin: CGPoint(x: originX, y: 0.0), size: CGSize(width: buttonWidth, height: self.buttonSize.height))
+ let originX = floorToScreenPixels(leftNodeOriginX + CGFloat(i) * distanceBetweenNodes - buttonWidth / 2.0)
+ let buttonFrame = CGRect(origin: CGPoint(x: originX, y: -3.0), size: CGSize(width: buttonWidth, height: self.buttonSize.height))
mostRightX = buttonFrame.maxX
- if !visibleRect.intersects(buttonFrame) {
- continue
- }
let type = self.buttons[i]
let _ = validIds.insert(type.key)
var buttonTransition = transition
let buttonView: ComponentHostView
- if let current = self.buttonViews[type.key] {
+ let selectedButtonView: ComponentHostView
+ if let current = self.itemViews[type.key], let currentSelected = self.selectedItemViews[type.key] {
buttonView = current
+ selectedButtonView = currentSelected
} else {
buttonTransition = .immediate
buttonView = ComponentHostView()
- self.buttonViews[type.key] = buttonView
- self.scrollNode.view.addSubview(buttonView)
+ self.itemViews[type.key] = buttonView
+ self.itemsContainer.addSubview(buttonView)
+
+ selectedButtonView = ComponentHostView()
+ self.selectedItemViews[type.key] = selectedButtonView
+ self.selectedItemsContainer.addSubview(selectedButtonView)
}
if case let .app(bot) = type {
@@ -1578,7 +1695,7 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
style: self.panelStyle == .glass ? .glass : .legacy,
type: type,
isFirstOrLast: i == 0 || i == self.buttons.count - 1,
- isSelected: i == self.selectedIndex,
+ isSelected: false,
strings: self.presentationData.strings,
theme: self.presentationData.theme,
action: { [weak self] in
@@ -1587,7 +1704,7 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
strongSelf.selectedIndex = i
strongSelf.updateViews(transition: .init(animation: .curve(duration: 0.2, curve: .spring)))
- if strongSelf.buttons.count > 5, let button = strongSelf.buttonViews[type.key] {
+ if strongSelf.buttons.count > 5, let button = strongSelf.itemViews[type.key] {
strongSelf.scrollNode.view.scrollRectToVisible(button.frame.insetBy(dx: -35.0, dy: 0.0), animated: true)
}
}
@@ -1601,11 +1718,32 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
environment: {},
containerSize: CGSize(width: buttonWidth, height: self.buttonSize.height)
)
+ self.itemSizes[type.key] = actualButtonSize
+
+ let _ = selectedButtonView.update(
+ transition: buttonTransition,
+ component: AnyComponent(AttachButtonComponent(
+ context: self.context,
+ style: self.panelStyle == .glass ? .glass : .legacy,
+ type: type,
+ isFirstOrLast: i == 0 || i == self.buttons.count - 1,
+ isSelected: true,
+ strings: self.presentationData.strings,
+ theme: self.presentationData.theme,
+ action: {
+ },
+ longPressAction: {
+ })
+ ),
+ environment: {},
+ containerSize: CGSize(width: buttonWidth, height: self.buttonSize.height)
+ )
if i == self.selectedIndex {
selectionFrame = CGRect(origin: CGPoint(x: buttonFrame.midX - actualButtonSize.width * 0.5, y: buttonFrame.minY), size: actualButtonSize)
}
buttonTransition.setFrame(view: buttonView, frame: buttonFrame)
+ buttonTransition.setFrame(view: selectedButtonView, frame: buttonFrame)
var accessibilityTitle = ""
switch type {
case .gallery:
@@ -1634,14 +1772,14 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
buttonView.accessibilityTraits = [.button]
}
var removeIds: [AnyHashable] = []
- for (id, itemView) in self.buttonViews {
+ for (id, itemView) in self.itemViews {
if !validIds.contains(id) {
removeIds.append(id)
itemView.removeFromSuperview()
}
}
for id in removeIds {
- self.buttonViews.removeValue(forKey: id)
+ self.itemViews.removeValue(forKey: id)
}
selectionFrame = selectionFrame.insetBy(dx: 1.0, dy: 4.0)
@@ -1651,9 +1789,10 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
mostRightX += layout.safeInsets.right + 3.0
let contentSize = CGSize(width: mostRightX, height: self.buttonSize.height)
- if contentSize != self.scrollNode.view.contentSize {
+ if contentSize != self.scrollNode.view.contentSize && self.scrollNode.view.bounds.width > 0.0 {
self.scrollNode.view.contentSize = contentSize
- self.scrollNode.view.isScrollEnabled = abs(contentSize.width - self.scrollNode.view.bounds.width) > 1.0
+ self.scrollNode.view.isScrollEnabled = contentSize.width - self.scrollNode.view.bounds.width > 1.0
+ self.liquidLensView?.clipsToBounds = self.scrollNode.view.isScrollEnabled
}
}
@@ -1916,31 +2055,65 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
textPanelWidth = layout.size.width - panelSideInset * 2.0
}
+ self.updateViews(transition: .immediate)
+
let glassPanelHeight: CGFloat = 62.0
let bounds = CGRect(origin: CGPoint(), size: CGSize(width: layout.size.width, height: self.buttonSize.height + insets.bottom))
if case .glass = self.panelStyle {
let backgroundView: GlassBackgroundView
- if let current = self.backgroundView {
- backgroundView = current
+ let liquidLensView: LiquidLensView
+ if let currentBackground = self.backgroundView, let currentLens = self.liquidLensView {
+ backgroundView = currentBackground
+ liquidLensView = currentLens
} else {
backgroundView = GlassBackgroundView()
- self.containerNode.view.addSubview(backgroundView)
- self.containerNode.view.addSubview(self.scrollNode.view)
self.backgroundView = backgroundView
+
+ liquidLensView = LiquidLensView(kind: .noContainer)
+ liquidLensView.clipsToBounds = true
+ liquidLensView.layer.cornerRadius = 28.0
+
+ self.containerNode.view.addSubview(backgroundView)
+ self.containerNode.view.addSubview(liquidLensView)
+ self.containerNode.view.addSubview(self.scrollNode.view)
+ self.liquidLensView = liquidLensView
+
+ liquidLensView.contentView.addSubview(self.itemsContainer)
+ liquidLensView.selectedContentView.addSubview(self.selectedItemsContainer)
+
+ self.itemsContainer.clipsToBounds = true
+ self.itemsContainer.layer.cornerRadius = 28.0
+ self.selectedItemsContainer.clipsToBounds = true
+ self.selectedItemsContainer.layer.cornerRadius = 28.0
+
+ let tabSelectionRecognizer = TabSelectionRecognizer(target: self, action: #selector(self.onTabSelectionGesture(_:)))
+ tabSelectionRecognizer.delegate = self.wrappedGestureRecognizerDelegate
+ self.tabSelectionRecognizer = tabSelectionRecognizer
+ self.scrollNode.view.addGestureRecognizer(tabSelectionRecognizer)
}
let panelSize = CGSize(width: isSelecting ? textPanelWidth : layout.size.width - layout.safeInsets.left - layout.safeInsets.right - panelSideInset * 2.0, height: isSelecting ? textPanelHeight - 11.0 : glassPanelHeight)
- let backgroundViewColor: UIColor
- if self.presentationData.theme.overallDarkAppearance {
- backgroundViewColor = self.presentationData.theme.list.modalBlocksBackgroundColor.withAlphaComponent(0.55)
- } else {
- backgroundViewColor = self.presentationData.theme.list.plainBackgroundColor.withAlphaComponent(0.75)
- }
-
+ let cornerRadius: CGFloat = isSelecting ? min(20.0, panelSize.height * 0.5) : panelSize.height * 0.5
let backgroundOriginX: CGFloat = isSelecting ? panelSideInset : floorToScreenPixels((layout.size.width - panelSize.width) / 2.0)
- backgroundView.update(size: panelSize, cornerRadius: isSelecting ? 20.0 : glassPanelHeight * 0.5, isDark: self.presentationData.theme.overallDarkAppearance, tintColor: .init(kind: .custom, color: backgroundViewColor), transition: ComponentTransition(transition))
+
+ backgroundView.update(size: panelSize, cornerRadius: cornerRadius, isDark: self.presentationData.theme.overallDarkAppearance, tintColor: .init(kind: .panel, color: UIColor(white: self.presentationData.theme.overallDarkAppearance ? 0.0 : 1.0, alpha: 0.6)), isInteractive: true, transition: ComponentTransition(transition))
+
+ let lensSideInset: CGFloat = defaultPanelSideInset + layout.safeInsets.left
+ let lensPanelSize = CGSize(width: layout.size.width - layout.safeInsets.left - layout.safeInsets.right - lensSideInset * 2.0, height: glassPanelHeight)
+ self.lensParams = (lensPanelSize, cornerRadius)
+ self.updateLiquidLens(transition: ComponentTransition(transition))
+
+ transition.updatePosition(layer: liquidLensView.layer, position: CGPoint(x: backgroundOriginX + panelSize.width * 0.5, y: panelSize.height * 0.5))
+ transition.updateBounds(layer: liquidLensView.layer, bounds: CGRect(origin: .zero, size: CGSize(width: lensPanelSize.width - 3.0 * 2.0, height: lensPanelSize.height - 3.0 * 2.0)))
+
transition.updatePosition(layer: backgroundView.layer, position: CGPoint(x: backgroundOriginX + panelSize.width * 0.5, y: panelSize.height * 0.5))
transition.updateBounds(layer: backgroundView.layer, bounds: CGRect(origin: .zero, size: panelSize))
+
+ let itemsContainerFrame = CGRect(origin: .zero, size: CGSize(width: lensPanelSize.width - 3.0 * 2.0, height: lensPanelSize.height - 3.0 * 2.0))
+ transition.updateBounds(layer: self.itemsContainer.layer, bounds: CGRect(origin: .zero, size: itemsContainerFrame.size))
+ transition.updateBounds(layer: self.selectedItemsContainer.layer, bounds: CGRect(origin: .zero, size: itemsContainerFrame.size))
+ transition.updatePosition(layer: self.itemsContainer.layer, position: itemsContainerFrame.center)
+ transition.updatePosition(layer: self.selectedItemsContainer.layer, position: itemsContainerFrame.center)
}
var containerTransition: ContainedViewLayoutTransition
@@ -2002,8 +2175,10 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
let alphaTransition = ContainedViewLayoutTransition.animated(duration: isSelecting ? 0.1 : 0.25, curve: .easeInOut)
alphaTransition.updateAlpha(node: self.scrollNode, alpha: isSelecting || isAnyButtonVisible ? 0.0 : 1.0)
containerTransition.updateTransformScale(node: self.scrollNode, scale: isSelecting || isAnyButtonVisible ? 0.85 : 1.0)
- if let backgroundView = self.backgroundView {
- containerTransition.updateTransformScale(layer: backgroundView.layer, scale: isAnyButtonVisible ? 0.85 : 1.0)
+
+ if let liquidLensView = self.liquidLensView {
+ alphaTransition.updateAlpha(layer: liquidLensView.layer, alpha: isSelecting || isAnyButtonVisible ? 0.0 : 1.0)
+ containerTransition.updateTransformScale(layer: liquidLensView.layer, scale: isSelecting || isAnyButtonVisible ? 0.85 : 1.0)
}
if isSelectingUpdated {
@@ -2022,7 +2197,10 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
alphaTransition.updateAlpha(node: textInputPanelNode, alpha: 1.0)
let componentTransition = ComponentTransition.easeInOut(duration: 0.25)
- componentTransition.animateBlur(layer: self.scrollNode.layer, fromRadius: 0.0, toRadius: 10.0)
+ if let liquidLensView = self.liquidLensView {
+ componentTransition.animateBlur(layer: liquidLensView.layer, fromRadius: 0.0, toRadius: 10.0)
+ transition.animatePositionAdditive(layer: liquidLensView.layer, offset: .zero, to: CGPoint(x: -27.0, y: 0.0))
+ }
let blurTransition = ComponentTransition.easeInOut(duration: 0.18)
transition.animateTransformScale(node: textInputPanelNode.opaqueActionButtons, from: 0.01)
@@ -2030,9 +2208,12 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
textInputPanelNode.opaqueActionButtons.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
transition.animatePosition(node: textInputPanelNode.opaqueActionButtons, from: CGPoint(x: textInputPanelNode.opaqueActionButtons.position.x, y: textInputPanelNode.opaqueActionButtons.position.y + heightDelta))
+ blurTransition.animateBlur(layer: textInputPanelNode.inputModeView.layer, fromRadius: 4.0, toRadius: 0.0)
+ componentTransition.animateAlpha(view: textInputPanelNode.inputModeView, from: 0.0, to: 1.0)
+
transition.animatePositionAdditive(layer: textInputPanelNode.textPlaceholderNode.layer, offset: CGPoint(x: 6.0, y: heightDelta))
transition.animatePositionAdditive(layer: textInputPanelNode.inputModeView.layer, offset: CGPoint(x: 64.0, y: heightDelta))
-
+
textInputPanelNode.animateIn(transition: transition)
} else {
textInputPanelNode.alpha = 1.0
@@ -2054,7 +2235,10 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
alphaTransition.updateAlpha(node: textInputPanelNode, alpha: 0.0)
let componentTransition = ComponentTransition.easeInOut(duration: 0.25)
- componentTransition.animateBlur(layer: self.scrollNode.layer, fromRadius: 10.0, toRadius: 0.0)
+ if let liquidLensView = self.liquidLensView {
+ componentTransition.animateBlur(layer: liquidLensView.layer, fromRadius: 10.0, toRadius: 0.0)
+ transition.animatePositionAdditive(layer: liquidLensView.layer, offset: CGPoint(x: -27.0, y: 0.0))
+ }
let blurTransition = ComponentTransition.easeInOut(duration: 0.18)
transition.animateTransformScale(layer: textInputPanelNode.opaqueActionButtons.layer, from: CGPoint(x: 1.0, y: 1.0), to: CGPoint(x: 0.01, y: 0.01))
@@ -2062,6 +2246,9 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
textInputPanelNode.opaqueActionButtons.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2)
transition.animatePosition(node: textInputPanelNode.opaqueActionButtons, to: CGPoint(x: textInputPanelNode.opaqueActionButtons.position.x, y: textInputPanelNode.opaqueActionButtons.position.y + heightDelta))
+ blurTransition.animateBlur(layer: textInputPanelNode.inputModeView.layer, fromRadius: 0.0, toRadius: 4.0)
+ componentTransition.animateAlpha(view: textInputPanelNode.inputModeView, from: 1.0, to: 0.0)
+
transition.animatePositionAdditive(layer: textInputPanelNode.textPlaceholderNode.layer, offset: .zero, to: CGPoint(x: 6.0, y: heightDelta))
transition.animatePositionAdditive(layer: textInputPanelNode.inputModeView.layer, offset: .zero, to: CGPoint(x: 64.0, y: heightDelta))
} else {
@@ -2086,8 +2273,6 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
transition.updateFrameAsPositionAndBounds(node: self.scrollNode, frame: CGRect(origin: CGPoint(x: self.isSelecting ? panelSideInset - defaultPanelSideInset : panelSideInset, y: self.isSelecting ? -11.0 : 0.0), size: CGSize(width: layout.size.width - panelSideInset * 2.0, height: self.buttonSize.height)))
}
- self.updateViews(transition: .immediate)
-
if let progress = self.loadingProgress {
let loadingProgressNode: LoadingProgressNode
if let current = self.progressNode {
@@ -2183,8 +2368,70 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
return containerFrame.height
}
+ func updateItemContainers(contentOffset: CGFloat, transition: ComponentTransition) {
+ let transform = CATransform3DMakeTranslation(-contentOffset, 0.0, 0.0)
+ transition.setSublayerTransform(view: self.itemsContainer, transform: transform)
+ transition.setSublayerTransform(view: self.selectedItemsContainer, transform: transform)
+ }
+
+ func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
+ if self.selectionGestureState != nil {
+ self.selectionGestureState = nil
+ self.requestLayout(transition: .animated(duration: 0.4, curve: .spring))
+ }
+ }
+
func scrollViewDidScroll(_ scrollView: UIScrollView) {
+ self.updateItemContainers(contentOffset: scrollView.contentOffset.x, transition: .immediate)
self.updateViews(transition: .immediate)
+ self.updateLiquidLens(transition: .immediate)
+ }
+
+ private var skipLensUpdate = false
+ private var lensParams: (panelSize: CGSize, cornerRadius: CGFloat)?
+ func updateLiquidLens(transition: ComponentTransition) {
+ guard !self.skipLensUpdate, let liquidLensView = self.liquidLensView, let (panelSize, _) = self.lensParams else {
+ return
+ }
+
+ var selectionFrame = CGRect()
+ if self.selectedIndex >= 0 && self.selectedIndex < self.buttons.count, let itemView = self.itemViews[self.buttons[self.selectedIndex].key], let itemSize = self.itemSizes[self.buttons[self.selectedIndex].key] {
+ let contentOffset = self.scrollNode.view.contentOffset.x
+ selectionFrame = CGRect(origin: CGPoint(x: itemView.center.x - itemSize.width / 2.0 - contentOffset, y: itemView.frame.minY), size: itemSize)
+ }
+
+ var lensSelection: (x: CGFloat, width: CGFloat)
+ if let selectionGestureState = self.selectionGestureState, selectionGestureState.isLifted {
+ lensSelection = (selectionGestureState.currentX, selectionFrame.width)
+ } else {
+ lensSelection = (selectionFrame.minX, selectionFrame.width)
+ }
+
+ if !self.scrollNode.view.isScrollEnabled {
+ lensSelection.x = max(0.0, min(lensSelection.x, panelSize.width - lensSelection.width))
+ }
+
+ var isLifted = self.selectionGestureState?.isLifted == true || self.lensIsLifted
+ if let widthClass = self.validLayout?.metrics.widthClass, case .regular = widthClass {
+ isLifted = false
+ }
+
+ let inset: CGFloat = 3.0
+ liquidLensView.update(size: CGSize(width: panelSize.width - inset * 2.0, height: panelSize.height - inset * 2.0), cornerRadius: 28.0, selectionOrigin: CGPoint(x: lensSelection.x, y: 0.0), selectionSize: CGSize(width: lensSelection.width, height: panelSize.height - inset * 2.0), inset: 0.0, isDark: self.presentationData.theme.overallDarkAppearance, isLifted: isLifted, isCollapsed: self.isSelecting || self.buttons.count < 2, transition: transition)
+ }
+
+ override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
+ if gestureRecognizer == self.tabSelectionRecognizer {
+ return true
+ }
+ return super.gestureRecognizerShouldBegin(gestureRecognizer)
+ }
+
+ func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
+ return true
+ }
+
+ func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
+ return true
}
}
-
diff --git a/submodules/AuthorizationUI/BUILD b/submodules/AuthorizationUI/BUILD
index 5a48a9b3..cc280f15 100644
--- a/submodules/AuthorizationUI/BUILD
+++ b/submodules/AuthorizationUI/BUILD
@@ -47,6 +47,7 @@ swift_library(
"//submodules/TelegramUI/Components/Premium/PremiumCoinComponent",
"//submodules/TelegramUI/Components/PlainButtonComponent",
"//submodules/Utils/DeviceModel",
+ "//submodules/PresentationDataUtils",
],
visibility = [
"//visibility:public",
diff --git a/submodules/AuthorizationUI/Sources/AuthorizationSequenceCodeEntryController.swift b/submodules/AuthorizationUI/Sources/AuthorizationSequenceCodeEntryController.swift
index 6cd8ce98..72f1db42 100644
--- a/submodules/AuthorizationUI/Sources/AuthorizationSequenceCodeEntryController.swift
+++ b/submodules/AuthorizationUI/Sources/AuthorizationSequenceCodeEntryController.swift
@@ -5,7 +5,9 @@ import AsyncDisplayKit
import SwiftSignalKit
import TelegramCore
import TelegramPresentationData
+import PresentationDataUtils
import ProgressNavigationButtonNode
+import AccountContext
public final class AuthorizationSequenceCodeEntryController: ViewController {
private var controllerNode: AuthorizationSequenceCodeEntryControllerNode {
@@ -14,6 +16,7 @@ public final class AuthorizationSequenceCodeEntryController: ViewController {
private var validLayout: ContainerViewLayout?
+ private let sharedContext: SharedAccountContext
private let strings: PresentationStrings
private let theme: PresentationTheme
@@ -45,7 +48,8 @@ public final class AuthorizationSequenceCodeEntryController: ViewController {
return self.data?.6 ?? false
}
- public init(presentationData: PresentationData, back: @escaping () -> Void) {
+ public init(sharedContext: SharedAccountContext, presentationData: PresentationData, back: @escaping () -> Void) {
+ self.sharedContext = sharedContext
self.strings = presentationData.strings
self.theme = presentationData.theme
@@ -61,11 +65,14 @@ public final class AuthorizationSequenceCodeEntryController: ViewController {
return false
}
self.navigationBar?.backPressed = { [weak self] in
+ guard let self else {
+ return
+ }
let text: String
let proceed: String
let stop: String
- if let (_, _, type, _, _, _, _) = self?.data, case .email = type {
+ if let (_, _, type, _, _, _, _) = self.data, case .email = type {
text = presentationData.strings.Login_CancelEmailVerification
proceed = presentationData.strings.Login_CancelEmailVerificationContinue
stop = presentationData.strings.Login_CancelEmailVerificationStop
@@ -75,7 +82,7 @@ public final class AuthorizationSequenceCodeEntryController: ViewController {
stop = presentationData.strings.Login_CancelPhoneVerificationStop
}
- self?.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: nil, text: text, actions: [TextAlertAction(type: .genericAction, title: proceed, action: {
+ self.present(textAlertController(sharedContext: self.sharedContext, title: nil, text: text, actions: [TextAlertAction(type: .genericAction, title: proceed, action: {
}), TextAlertAction(type: .defaultAction, title: stop, action: {
back()
})]), in: .window(.root))
diff --git a/submodules/AuthorizationUI/Sources/AuthorizationSequenceController.swift b/submodules/AuthorizationUI/Sources/AuthorizationSequenceController.swift
index b6d861d6..bc640f69 100644
--- a/submodules/AuthorizationUI/Sources/AuthorizationSequenceController.swift
+++ b/submodules/AuthorizationUI/Sources/AuthorizationSequenceController.swift
@@ -9,6 +9,7 @@ import MtProtoKit
import MessageUI
import CoreTelephony
import TelegramPresentationData
+import PresentationDataUtils
import TextFormat
import AccountContext
import CountrySelectionUI
@@ -33,7 +34,7 @@ private enum InnerState: Equatable {
public final class AuthorizationSequenceController: NavigationController, ASAuthorizationControllerDelegate, ASAuthorizationControllerPresentationContextProviding {
static func navigationBarTheme(_ theme: PresentationTheme) -> NavigationBarTheme {
- return NavigationBarTheme(buttonColor: theme.intro.accentTextColor, disabledButtonColor: theme.intro.disabledTextColor, primaryTextColor: theme.intro.primaryTextColor, backgroundColor: .clear, opaqueBackgroundColor: .clear, enableBackgroundBlur: false, separatorColor: .clear, badgeBackgroundColor: theme.rootController.navigationBar.badgeBackgroundColor, badgeStrokeColor: theme.rootController.navigationBar.badgeStrokeColor, badgeTextColor: theme.rootController.navigationBar.badgeTextColor)
+ return NavigationBarTheme(overallDarkAppearance: theme.overallDarkAppearance, buttonColor: theme.chat.inputPanel.panelControlColor, disabledButtonColor: theme.intro.disabledTextColor, primaryTextColor: theme.intro.primaryTextColor, backgroundColor: .clear, opaqueBackgroundColor: .clear, enableBackgroundBlur: false, separatorColor: .clear, badgeBackgroundColor: theme.rootController.navigationBar.badgeBackgroundColor, badgeStrokeColor: theme.rootController.navigationBar.badgeStrokeColor, badgeTextColor: theme.rootController.navigationBar.badgeTextColor, edgeEffectColor: .clear, style: .glass)
}
private let sharedContext: SharedAccountContext
@@ -247,7 +248,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
let carrier = CTCarrier()
let mnc = carrier.mobileNetworkCode ?? "none"
- AuthorizationSequenceController.presentEmailComposeController(address: "recover@telegram.org", subject: strongSelf.presentationData.strings.Login_InvalidPhoneEmailSubject(formattedNumber).string, body: strongSelf.presentationData.strings.Login_InvalidPhoneEmailBody(formattedNumber, appVersion, systemVersion, locale, mnc).string, from: controller, presentationData: strongSelf.presentationData)
+ AuthorizationSequenceController.presentEmailComposeController(sharedContext: strongSelf.sharedContext, address: "recover@telegram.org", subject: strongSelf.presentationData.strings.Login_InvalidPhoneEmailSubject(formattedNumber).string, body: strongSelf.presentationData.strings.Login_InvalidPhoneEmailBody(formattedNumber, appVersion, systemVersion, locale, mnc).string, from: controller, presentationData: strongSelf.presentationData)
}))
case .phoneLimitExceeded:
text = strongSelf.presentationData.strings.Login_PhoneFloodError
@@ -273,7 +274,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
let carrier = CTCarrier()
let mnc = carrier.mobileNetworkCode ?? "none"
- AuthorizationSequenceController.presentEmailComposeController(address: "recover@telegram.org", subject: strongSelf.presentationData.strings.Login_PhoneBannedEmailSubject(formattedNumber).string, body: strongSelf.presentationData.strings.Login_PhoneBannedEmailBody(formattedNumber, appVersion, systemVersion, locale, mnc).string, from: controller, presentationData: strongSelf.presentationData)
+ AuthorizationSequenceController.presentEmailComposeController(sharedContext: strongSelf.sharedContext, address: "recover@telegram.org", subject: strongSelf.presentationData.strings.Login_PhoneBannedEmailSubject(formattedNumber).string, body: strongSelf.presentationData.strings.Login_PhoneBannedEmailBody(formattedNumber, appVersion, systemVersion, locale, mnc).string, from: controller, presentationData: strongSelf.presentationData)
}))
case let .generic(info):
text = strongSelf.presentationData.strings.Login_UnknownError
@@ -295,7 +296,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
errorString = "unknown"
}
- AuthorizationSequenceController.presentEmailComposeController(address: "recover@telegram.org", subject: strongSelf.presentationData.strings.Login_PhoneGenericEmailSubject(formattedNumber).string, body: strongSelf.presentationData.strings.Login_PhoneGenericEmailBody(formattedNumber, errorString, appVersion, systemVersion, locale, mnc).string, from: controller, presentationData: strongSelf.presentationData)
+ AuthorizationSequenceController.presentEmailComposeController(sharedContext: strongSelf.sharedContext, address: "recover@telegram.org", subject: strongSelf.presentationData.strings.Login_PhoneGenericEmailSubject(formattedNumber).string, body: strongSelf.presentationData.strings.Login_PhoneGenericEmailBody(formattedNumber, errorString, appVersion, systemVersion, locale, mnc).string, from: controller, presentationData: strongSelf.presentationData)
}))
case .timeout:
text = strongSelf.presentationData.strings.Login_NetworkError
@@ -307,7 +308,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
controller.present(strongSelf.sharedContext.makeProxySettingsController(sharedContext: strongSelf.sharedContext, account: strongSelf.account), in: .window(.root), with: ViewControllerPresentationArguments(presentationAnimation: .modalSheet))
}))
}
- (controller.navigationController as? NavigationController)?.presentOverlay(controller: standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: nil, text: text, actions: actions), inGlobal: true, blockInteraction: true)
+ (controller.navigationController as? NavigationController)?.presentOverlay(controller: textAlertController(sharedContext: strongSelf.sharedContext, title: nil, text: text, actions: actions), inGlobal: true, blockInteraction: true)
controller.dismissConfirmation()
}
@@ -352,7 +353,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
text = strongSelf.presentationData.strings.Login_UnknownError
}
- controller.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ controller.present(textAlertController(sharedContext: strongSelf.sharedContext, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
}
}
}))
@@ -376,7 +377,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
if let currentController = currentController {
controller = currentController
} else {
- controller = AuthorizationSequenceCodeEntryController(presentationData: self.presentationData, back: { [weak self] in
+ controller = AuthorizationSequenceCodeEntryController(sharedContext: self.sharedContext, presentationData: self.presentationData, back: { [weak self] in
guard let strongSelf = self else {
return
}
@@ -451,7 +452,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
let _ = self.engine.auth.setState(state: UnauthorizedAccountState(isTestingEnvironment: account.testingEnvironment, masterDatacenterId: account.masterDatacenterId, contents: .empty)).startStandalone()
}
- controller.presentInGlobalOverlay(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {})]))
+ controller.presentInGlobalOverlay(textAlertController(sharedContext: self.sharedContext, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {})]))
}
})
)
@@ -510,7 +511,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
controller.resetCode()
}
- controller.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ controller.present(textAlertController(sharedContext: strongSelf.sharedContext, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
}
}
}
@@ -623,7 +624,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
controller.resetCode()
}
- controller.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ controller.present(textAlertController(sharedContext: strongSelf.sharedContext, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
}
}
}
@@ -645,7 +646,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
let mnc = carrier.mobileNetworkCode ?? "none"
let _ = strongSelf.engine.auth.reportMissingCode(phoneNumber: number, phoneCodeHash: phoneCodeHash, mnc: mnc).start()
- AuthorizationSequenceController.presentDidNotGetCodeUI(controller: controller, presentationData: strongSelf.presentationData, phoneNumber: number, mnc: mnc)
+ AuthorizationSequenceController.presentDidNotGetCodeUI(sharedContext: strongSelf.sharedContext, controller: controller, presentationData: strongSelf.presentationData, phoneNumber: number, mnc: mnc)
}
} else {
controller?.inProgress = true
@@ -681,7 +682,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
text = strongSelf.presentationData.strings.Login_NetworkError
}
- controller.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: nil, text: text, actions: actions), in: .window(.root))
+ controller.present(textAlertController(sharedContext: strongSelf.sharedContext, title: nil, text: text, actions: actions), in: .window(.root))
}
}))
}
@@ -780,7 +781,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
text = strongSelf.presentationData.strings.Login_EmailNotAllowedError
}
- controller.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ controller.present(textAlertController(sharedContext: strongSelf.sharedContext, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
}
}, completed: {
controller?.inProgress = false
@@ -827,7 +828,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
switch authorization.credential {
case let appleIdCredential as ASAuthorizationAppleIDCredential:
guard let tokenData = appleIdCredential.identityToken, let token = String(data: tokenData, encoding: .utf8) else {
- lastController?.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: nil, text: self.presentationData.strings.Login_UnknownError, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ lastController?.present(textAlertController(sharedContext: self.sharedContext, title: nil, text: self.presentationData.strings.Login_UnknownError, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
return
}
@@ -850,7 +851,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
case .emailNotAllowed:
text = strongSelf.presentationData.strings.Login_EmailNotAllowedError
}
- lastController.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: nil, text: text, actions: [TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ lastController.present(textAlertController(sharedContext: strongSelf.sharedContext, title: nil, text: text, actions: [TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
}
}))
} else {
@@ -891,7 +892,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
text = strongSelf.presentationData.strings.Login_InvalidEmailAddressError
}
- lastController.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ lastController.present(textAlertController(sharedContext: strongSelf.sharedContext, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
}
}
})
@@ -907,7 +908,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
guard let lastController = self.viewControllers.last as? ViewController else {
return
}
- lastController.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: nil, text: error.localizedDescription, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ lastController.present(textAlertController(sharedContext: self.sharedContext, title: nil, text: error.localizedDescription, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
}
@available(iOS 13.0, *)
@@ -927,7 +928,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
if let currentController = currentController {
controller = currentController
} else {
- controller = AuthorizationSequencePasswordEntryController(presentationData: self.presentationData, back: { [weak self] in
+ controller = AuthorizationSequencePasswordEntryController(sharedContext: self.sharedContext, presentationData: self.presentationData, back: { [weak self] in
guard let strongSelf = self else {
return
}
@@ -954,7 +955,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
text = strongSelf.presentationData.strings.Login_UnknownError
}
- controller.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ controller.present(textAlertController(sharedContext: strongSelf.sharedContext, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
controller.passwordIsInvalid()
}
}
@@ -988,14 +989,14 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
strongController.inProgress = false
- strongController.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: nil, text: strongSelf.presentationData.strings.TwoStepAuth_RecoveryUnavailable, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ strongController.present(textAlertController(sharedContext: strongSelf.sharedContext, title: nil, text: strongSelf.presentationData.strings.TwoStepAuth_RecoveryUnavailable, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
strongController.didForgotWithNoRecovery = true
}))
}
}
controller.reset = { [weak self, weak controller] in
if let strongSelf = self, let strongController = controller {
- strongController.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: nil, text: suggestReset ? strongSelf.presentationData.strings.TwoStepAuth_RecoveryFailed : strongSelf.presentationData.strings.TwoStepAuth_RecoveryUnavailable, actions: [
+ strongController.present(textAlertController(sharedContext: strongSelf.sharedContext, title: nil, text: suggestReset ? strongSelf.presentationData.strings.TwoStepAuth_RecoveryFailed : strongSelf.presentationData.strings.TwoStepAuth_RecoveryUnavailable, actions: [
TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_Cancel, action: {}),
TextAlertAction(type: .destructiveAction, title: strongSelf.presentationData.strings.Login_ResetAccountProtected_Reset, action: {
if let strongSelf = self, let strongController = controller {
@@ -1015,7 +1016,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
case .limitExceeded:
text = strongSelf.presentationData.strings.Login_ResetAccountProtected_LimitExceeded
}
- strongController.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ strongController.present(textAlertController(sharedContext: strongSelf.sharedContext, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
}
}))
}
@@ -1082,7 +1083,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
})
controller.reset = { [weak self, weak controller] in
if let strongSelf = self, let strongController = controller {
- strongController.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: nil, text: strongSelf.presentationData.strings.TwoStepAuth_ResetAccountConfirmation, actions: [
+ strongController.present(textAlertController(sharedContext: strongSelf.sharedContext, title: nil, text: strongSelf.presentationData.strings.TwoStepAuth_ResetAccountConfirmation, actions: [
TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_Cancel, action: {}),
TextAlertAction(type: .destructiveAction, title: strongSelf.presentationData.strings.Login_ResetAccountProtected_Reset, action: {
if let strongSelf = self, let strongController = controller {
@@ -1102,7 +1103,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
case .limitExceeded:
text = strongSelf.presentationData.strings.Login_ResetAccountProtected_LimitExceeded
}
- strongController.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ strongController.present(textAlertController(sharedContext: strongSelf.sharedContext, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
}
}))
}
@@ -1132,7 +1133,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
if let currentController = currentController {
controller = currentController
} else {
- controller = AuthorizationSequenceSignUpController(presentationData: self.presentationData, back: { [weak self] in
+ controller = AuthorizationSequenceSignUpController(sharedContext: self.sharedContext, presentationData: self.presentationData, back: { [weak self] in
guard let strongSelf = self else {
return
}
@@ -1231,7 +1232,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
text = strongSelf.presentationData.strings.Login_UnknownError
}
- controller.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ controller.present(textAlertController(sharedContext: strongSelf.sharedContext, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
}
}
}))
@@ -1379,7 +1380,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
}
}
- static func presentEmailComposeController(address: String, subject: String, body: String, from controller: ViewController, presentationData: PresentationData) {
+ static func presentEmailComposeController(sharedContext: SharedAccountContext, address: String, subject: String, body: String, from controller: ViewController, presentationData: PresentationData) {
if MFMailComposeViewController.canSendMail() {
final class ComposeDelegate: NSObject, MFMailComposeViewControllerDelegate {
@objc func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) {
@@ -1398,7 +1399,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
controller.view.window?.rootViewController?.present(composeController, animated: true, completion: nil)
} else {
- controller.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: nil, text: presentationData.strings.Login_EmailNotConfiguredError, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ controller.present(textAlertController(sharedContext: sharedContext, title: nil, text: presentationData.strings.Login_EmailNotConfiguredError, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), in: .window(.root))
}
}
@@ -1451,6 +1452,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
}
public static func presentDidNotGetCodeUI(
+ sharedContext: SharedAccountContext,
controller: ViewController,
presentationData: PresentationData,
phoneNumber: String,
@@ -1470,6 +1472,6 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
emailBody.append("Locale: \(locale)\n")
emailBody.append("MNC: \(mnc)")
- AuthorizationSequenceController.presentEmailComposeController(address: "sms@telegram.org", subject: presentationData.strings.Login_EmailCodeSubject(formattedNumber).string, body: emailBody, from: controller, presentationData: presentationData)
+ AuthorizationSequenceController.presentEmailComposeController(sharedContext: sharedContext, address: "sms@telegram.org", subject: presentationData.strings.Login_EmailCodeSubject(formattedNumber).string, body: emailBody, from: controller, presentationData: presentationData)
}
}
diff --git a/submodules/AuthorizationUI/Sources/AuthorizationSequencePasswordEntryController.swift b/submodules/AuthorizationUI/Sources/AuthorizationSequencePasswordEntryController.swift
index 000a0a49..913678b1 100644
--- a/submodules/AuthorizationUI/Sources/AuthorizationSequencePasswordEntryController.swift
+++ b/submodules/AuthorizationUI/Sources/AuthorizationSequencePasswordEntryController.swift
@@ -3,7 +3,9 @@ import UIKit
import Display
import AsyncDisplayKit
import TelegramPresentationData
+import PresentationDataUtils
import ProgressNavigationButtonNode
+import AccountContext
final class AuthorizationSequencePasswordEntryController: ViewController {
private var controllerNode: AuthorizationSequencePasswordEntryControllerNode {
@@ -12,6 +14,7 @@ final class AuthorizationSequencePasswordEntryController: ViewController {
private var validLayout: ContainerViewLayout?
+ private let sharedContext: SharedAccountContext
private let presentationData: PresentationData
var loginWithPassword: ((String) -> Void)?
@@ -40,7 +43,8 @@ final class AuthorizationSequencePasswordEntryController: ViewController {
}
}
- init(presentationData: PresentationData, back: @escaping () -> Void) {
+ init(sharedContext: SharedAccountContext, presentationData: PresentationData, back: @escaping () -> Void) {
+ self.sharedContext = sharedContext
self.presentationData = presentationData
super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: AuthorizationSequenceController.navigationBarTheme(presentationData.theme), strings: NavigationBarStrings(presentationStrings: presentationData.strings)))
@@ -153,10 +157,8 @@ final class AuthorizationSequencePasswordEntryController: ViewController {
}
func forgotPressed() {
- /*if self.suggestReset {
- self.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: nil, text: self.presentationData.strings.TwoStepAuth_RecoveryFailed, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
- } else*/ if self.didForgotWithNoRecovery {
- self.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: nil, text: self.presentationData.strings.TwoStepAuth_RecoveryUnavailable, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ if self.didForgotWithNoRecovery {
+ self.present(textAlertController(sharedContext: self.sharedContext, title: nil, text: self.presentationData.strings.TwoStepAuth_RecoveryUnavailable, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
} else {
self.forgot?()
}
diff --git a/submodules/AuthorizationUI/Sources/AuthorizationSequencePasswordEntryControllerNode.swift b/submodules/AuthorizationUI/Sources/AuthorizationSequencePasswordEntryControllerNode.swift
index 2a7c258b..e94a8f98 100644
--- a/submodules/AuthorizationUI/Sources/AuthorizationSequencePasswordEntryControllerNode.swift
+++ b/submodules/AuthorizationUI/Sources/AuthorizationSequencePasswordEntryControllerNode.swift
@@ -107,7 +107,7 @@ final class AuthorizationSequencePasswordEntryControllerNode: ASDisplayNode, UIT
self.codeField.textField.tintColor = self.theme.list.itemAccentColor
self.codeField.textField.accessibilityHint = self.strings.Login_VoiceOver_Password
- self.proceedNode = SolidRoundedButtonNode(title: self.strings.Login_Continue, theme: SolidRoundedButtonTheme(theme: self.theme), height: 50.0, cornerRadius: 11.0)
+ self.proceedNode = SolidRoundedButtonNode(title: self.strings.Login_Continue, theme: SolidRoundedButtonTheme(theme: self.theme), glass: true, height: 50.0, cornerRadius: 50.0 * 0.5)
self.proceedNode.progressType = .embedded
self.proceedNode.isEnabled = false
diff --git a/submodules/AuthorizationUI/Sources/AuthorizationSequencePaymentScreen.swift b/submodules/AuthorizationUI/Sources/AuthorizationSequencePaymentScreen.swift
index f261be57..61715e95 100644
--- a/submodules/AuthorizationUI/Sources/AuthorizationSequencePaymentScreen.swift
+++ b/submodules/AuthorizationUI/Sources/AuthorizationSequencePaymentScreen.swift
@@ -215,7 +215,7 @@ final class AuthorizationSequencePaymentScreenComponent: Component {
).string
let presentationData = component.presentationData
- AuthorizationSequenceController.presentEmailComposeController(address: component.supportEmailAddress, subject: environment.strings.Login_PhonePaidEmailSubject, body: body, from: controller, presentationData: presentationData)
+ AuthorizationSequenceController.presentEmailComposeController(sharedContext: component.sharedContext, address: component.supportEmailAddress, subject: environment.strings.Login_PhonePaidEmailSubject, body: body, from: controller, presentationData: presentationData)
}
func update(component: AuthorizationSequencePaymentScreenComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment, transition: ComponentTransition) -> CGSize {
diff --git a/submodules/AuthorizationUI/Sources/AuthorizationSequencePhoneEntryController.swift b/submodules/AuthorizationUI/Sources/AuthorizationSequencePhoneEntryController.swift
index 54855476..c28585b3 100644
--- a/submodules/AuthorizationUI/Sources/AuthorizationSequencePhoneEntryController.swift
+++ b/submodules/AuthorizationUI/Sources/AuthorizationSequencePhoneEntryController.swift
@@ -6,6 +6,7 @@ import SwiftSignalKit
import TelegramCore
import Postbox
import TelegramPresentationData
+import PresentationDataUtils
import ProgressNavigationButtonNode
import AccountContext
import CountrySelectionUI
@@ -91,7 +92,7 @@ public final class AuthorizationSequencePhoneEntryController: ViewController, MF
}
if !otherAccountPhoneNumbers.1.isEmpty {
- self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: presentationData.strings.Common_Cancel, style: .plain, target: self, action: #selector(self.cancelPressed))
+ self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "___close", style: .plain, target: self, action: #selector(self.cancelPressed))
}
if let countriesConfiguration {
@@ -173,7 +174,7 @@ public final class AuthorizationSequencePhoneEntryController: ViewController, MF
self.controllerNode.selectCountryCode = { [weak self] in
if let strongSelf = self {
- let controller = AuthorizationSequenceCountrySelectionController(strings: strongSelf.presentationData.strings, theme: strongSelf.presentationData.theme)
+ let controller = AuthorizationSequenceCountrySelectionController(strings: strongSelf.presentationData.strings, theme: strongSelf.presentationData.theme, glass: true)
controller.completeWithCountryCode = { code, name in
if let strongSelf = self, let currentData = strongSelf.currentData {
strongSelf.updateData(countryCode: Int32(code), countryName: name, number: currentData.2)
@@ -404,7 +405,7 @@ public final class AuthorizationSequencePhoneEntryController: ViewController, MF
}))
}
actions.append(TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {}))
- self.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: nil, text: self.presentationData.strings.Login_PhoneNumberAlreadyAuthorized, actions: actions), in: .window(.root))
+ self.present(textAlertController(sharedContext: self.sharedContext, title: nil, text: self.presentationData.strings.Login_PhoneNumberAlreadyAuthorized, actions: actions), in: .window(.root))
} else {
if let validLayout = self.validLayout, validLayout.size.width > 320.0 {
let (code, formattedNumber) = self.controllerNode.formattedCodeAndNumber
@@ -425,7 +426,7 @@ public final class AuthorizationSequencePhoneEntryController: ViewController, MF
strongSelf.loginWithNumber?(strongSelf.controllerNode.currentNumber, strongSelf.controllerNode.syncContacts)
}
}))
- self.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: logInNumber, text: self.presentationData.strings.Login_PhoneNumberConfirmation, actions: actions), in: .window(.root))
+ self.present(textAlertController(sharedContext: self.sharedContext, title: logInNumber, text: self.presentationData.strings.Login_PhoneNumberConfirmation, actions: actions), in: .window(.root))
}
}
} else {
diff --git a/submodules/AuthorizationUI/Sources/AuthorizationSequencePhoneEntryControllerNode.swift b/submodules/AuthorizationUI/Sources/AuthorizationSequencePhoneEntryControllerNode.swift
index 69ca7fc7..4b440530 100644
--- a/submodules/AuthorizationUI/Sources/AuthorizationSequencePhoneEntryControllerNode.swift
+++ b/submodules/AuthorizationUI/Sources/AuthorizationSequencePhoneEntryControllerNode.swift
@@ -423,7 +423,7 @@ final class AuthorizationSequencePhoneEntryControllerNode: ASDisplayNode {
self.phoneAndCountryNode = PhoneAndCountryNode(strings: strings, theme: theme)
- self.proceedNode = SolidRoundedButtonNode(title: self.strings.Login_Continue, theme: SolidRoundedButtonTheme(theme: self.theme), height: 50.0, cornerRadius: 11.0)
+ self.proceedNode = SolidRoundedButtonNode(title: self.strings.Login_Continue, theme: SolidRoundedButtonTheme(theme: self.theme), glass: true, height: 50.0, cornerRadius: 50 * 0.5)
self.proceedNode.progressType = .embedded
self.proceedNode.isEnabled = false
@@ -857,7 +857,7 @@ final class PhoneConfirmationController: ViewController {
self.cancelButton.accessibilityTraits = [.button]
self.cancelButton.accessibilityLabel = strings.Login_Edit
- self.proceedNode = SolidRoundedButtonNode(title: strings.Login_Continue, theme: SolidRoundedButtonTheme(theme: theme), height: 50.0, cornerRadius: 11.0)
+ self.proceedNode = SolidRoundedButtonNode(title: strings.Login_Continue, theme: SolidRoundedButtonTheme(theme: theme), glass: true, height: 50.0, cornerRadius: 50.0 * 0.5)
self.proceedNode.progressType = .embedded
let font = Font.with(size: 20.0, design: .regular, traits: [.monospacedNumbers])
diff --git a/submodules/AuthorizationUI/Sources/AuthorizationSequenceSignUpController.swift b/submodules/AuthorizationUI/Sources/AuthorizationSequenceSignUpController.swift
index 8c8fdd8d..2ec0d705 100644
--- a/submodules/AuthorizationUI/Sources/AuthorizationSequenceSignUpController.swift
+++ b/submodules/AuthorizationUI/Sources/AuthorizationSequenceSignUpController.swift
@@ -5,6 +5,7 @@ import AsyncDisplayKit
import SwiftSignalKit
import TelegramCore
import TelegramPresentationData
+import PresentationDataUtils
import LegacyComponents
import ProgressNavigationButtonNode
import ImageCompression
@@ -13,6 +14,7 @@ import Postbox
import TextFormat
import MoreButtonNode
import ContextUI
+import AccountContext
final class AuthorizationSequenceSignUpController: ViewController {
private var controllerNode: AuthorizationSequenceSignUpControllerNode {
@@ -23,6 +25,7 @@ final class AuthorizationSequenceSignUpController: ViewController {
private let moreButtonNode: MoreButtonNode
+ private let sharedContext: SharedAccountContext
private let presentationData: PresentationData
private let back: () -> Void
@@ -46,7 +49,8 @@ final class AuthorizationSequenceSignUpController: ViewController {
}
}
- init(presentationData: PresentationData, back: @escaping () -> Void, displayCancel: Bool) {
+ init(sharedContext: SharedAccountContext, presentationData: PresentationData, back: @escaping () -> Void, displayCancel: Bool) {
+ self.sharedContext = sharedContext
self.presentationData = presentationData
self.back = back
@@ -68,7 +72,7 @@ final class AuthorizationSequenceSignUpController: ViewController {
guard let strongSelf = self else {
return
}
- strongSelf.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: nil, text: presentationData.strings.Login_CancelSignUpConfirmation, actions: [TextAlertAction(type: .genericAction, title: presentationData.strings.Login_CancelPhoneVerificationContinue, action: {
+ strongSelf.present(textAlertController(sharedContext: strongSelf.sharedContext, title: nil, text: presentationData.strings.Login_CancelSignUpConfirmation, actions: [TextAlertAction(type: .genericAction, title: presentationData.strings.Login_CancelPhoneVerificationContinue, action: {
}), TextAlertAction(type: .defaultAction, title: presentationData.strings.Login_CancelPhoneVerificationStop, action: {
back()
})]), in: .window(.root))
@@ -92,7 +96,7 @@ final class AuthorizationSequenceSignUpController: ViewController {
}
@objc private func cancelPressed() {
- self.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: nil, text: self.presentationData.strings.Login_CancelSignUpConfirmation, actions: [TextAlertAction(type: .genericAction, title: self.presentationData.strings.Login_CancelPhoneVerificationContinue, action: {
+ self.present(textAlertController(sharedContext: self.sharedContext, title: nil, text: self.presentationData.strings.Login_CancelSignUpConfirmation, actions: [TextAlertAction(type: .genericAction, title: self.presentationData.strings.Login_CancelPhoneVerificationContinue, action: {
}), TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Login_CancelPhoneVerificationStop, action: { [weak self] in
self?.back()
})]), in: .window(.root))
diff --git a/submodules/AuthorizationUI/Sources/AuthorizationSequenceSplashController.swift b/submodules/AuthorizationUI/Sources/AuthorizationSequenceSplashController.swift
index 044c5c70..5f517176 100644
--- a/submodules/AuthorizationUI/Sources/AuthorizationSequenceSplashController.swift
+++ b/submodules/AuthorizationUI/Sources/AuthorizationSequenceSplashController.swift
@@ -73,10 +73,12 @@ public final class AuthorizationSequenceSplashController: ViewController {
self.controller = RMIntroViewController(backgroundColor: theme.list.plainBackgroundColor, primaryColor: theme.list.itemPrimaryTextColor, buttonColor: theme.intro.startButtonColor, accentColor: theme.list.itemAccentColor, regularDotColor: theme.intro.dotColor, highlightedDotColor: theme.list.itemAccentColor, suggestedLocalizationSignal: localizationSignal)
- self.startButton = SolidRoundedButtonNode(title: "Start Messaging", theme: SolidRoundedButtonTheme(theme: theme), height: 50.0, cornerRadius: 13.0, isShimmering: true)
+ self.startButton = SolidRoundedButtonNode(title: "Start Messaging", theme: SolidRoundedButtonTheme(theme: theme), glass: true, height: 50.0, cornerRadius: 50.0 * 0.5, isShimmering: true)
super.init(navigationBarPresentationData: nil)
+ self._hasGlassStyle = true
+
self.supportedOrientations = ViewControllerSupportedOrientations(regularSize: .all, compactSize: .portrait)
self.statusBar.statusBarStyle = theme.intro.statusBarStyle.style
diff --git a/submodules/BotPaymentsUI/Sources/BotCheckoutHeaderItem.swift b/submodules/BotPaymentsUI/Sources/BotCheckoutHeaderItem.swift
index c2c4a9c9..84ff2287 100644
--- a/submodules/BotPaymentsUI/Sources/BotCheckoutHeaderItem.swift
+++ b/submodules/BotPaymentsUI/Sources/BotCheckoutHeaderItem.swift
@@ -114,7 +114,7 @@ class BotCheckoutHeaderItemNode: ListViewItemNode {
self.highlightedBackgroundNode = ASDisplayNode()
self.highlightedBackgroundNode.isLayerBacked = true
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.backgroundNode)
self.addSubnode(self.imageNode)
diff --git a/submodules/BotPaymentsUI/Sources/BotCheckoutPriceItem.swift b/submodules/BotPaymentsUI/Sources/BotCheckoutPriceItem.swift
index a88ecb09..43c32de5 100644
--- a/submodules/BotPaymentsUI/Sources/BotCheckoutPriceItem.swift
+++ b/submodules/BotPaymentsUI/Sources/BotCheckoutPriceItem.swift
@@ -113,7 +113,7 @@ class BotCheckoutPriceItemNode: ListViewItemNode {
self.maskNode = ASImageNode()
self.maskNode.isUserInteractionEnabled = false
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.backgroundNode)
self.addSubnode(self.titleNode)
diff --git a/submodules/BotPaymentsUI/Sources/BotCheckoutTipItem.swift b/submodules/BotPaymentsUI/Sources/BotCheckoutTipItem.swift
index 7989f744..7b177db9 100644
--- a/submodules/BotPaymentsUI/Sources/BotCheckoutTipItem.swift
+++ b/submodules/BotPaymentsUI/Sources/BotCheckoutTipItem.swift
@@ -509,7 +509,7 @@ class BotCheckoutTipItemNode: ListViewItemNode, UITextFieldDelegate {
self.maskNode = ASImageNode()
self.maskNode.isUserInteractionEnabled = false
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.backgroundNode)
diff --git a/submodules/BrowserUI/BUILD b/submodules/BrowserUI/BUILD
index e031d767..472c7550 100644
--- a/submodules/BrowserUI/BUILD
+++ b/submodules/BrowserUI/BUILD
@@ -50,6 +50,13 @@ swift_library(
"//submodules/TelegramUI/Components/ListActionItemComponent",
"//submodules/Utils/DeviceModel",
"//submodules/LegacyMediaPickerUI",
+ "//submodules/TelegramUI/Components/AlertComponent",
+ "//submodules/TelegramUI/Components/GlassBackgroundComponent",
+ "//submodules/TelegramUI/Components/EdgeEffect",
+ "//submodules/TelegramUI/Components/ButtonComponent",
+ "//submodules/TelegramUI/Components/GlassBarButtonComponent",
+ "//submodules/TelegramUI/Components/SearchInputPanelComponent",
+ "//submodules/TelegramUI/Components/GlassControls",
],
visibility = [
"//visibility:public",
diff --git a/submodules/BrowserUI/Sources/BrowserAddressBarComponent.swift b/submodules/BrowserUI/Sources/BrowserAddressBarComponent.swift
index da83dddb..00915444 100644
--- a/submodules/BrowserUI/Sources/BrowserAddressBarComponent.swift
+++ b/submodules/BrowserUI/Sources/BrowserAddressBarComponent.swift
@@ -9,6 +9,9 @@ import AccountContext
import BundleIconComponent
import MultilineTextComponent
import UrlEscaping
+import GlassBackgroundComponent
+import GlassBarButtonComponent
+import EdgeEffect
final class AddressBarContentComponent: Component {
public typealias EnvironmentType = BrowserNavigationBarEnvironment
@@ -19,6 +22,8 @@ final class AddressBarContentComponent: Component {
let url: String
let isSecure: Bool
let isExpanded: Bool
+ let readingProgress: CGFloat
+ let loadingProgress: Double?
let performAction: ActionSlot
init(
@@ -28,6 +33,8 @@ final class AddressBarContentComponent: Component {
url: String,
isSecure: Bool,
isExpanded: Bool,
+ readingProgress: CGFloat,
+ loadingProgress: Double?,
performAction: ActionSlot
) {
self.theme = theme
@@ -36,6 +43,8 @@ final class AddressBarContentComponent: Component {
self.url = url
self.isSecure = isSecure
self.isExpanded = isExpanded
+ self.readingProgress = readingProgress
+ self.loadingProgress = loadingProgress
self.performAction = performAction
}
@@ -58,6 +67,12 @@ final class AddressBarContentComponent: Component {
if lhs.isExpanded != rhs.isExpanded {
return false
}
+ if lhs.readingProgress != rhs.readingProgress {
+ return false
+ }
+ if lhs.loadingProgress != rhs.loadingProgress {
+ return false
+ }
return true
}
@@ -85,6 +100,8 @@ final class AddressBarContentComponent: Component {
var isSecure: Bool
var collapseFraction: CGFloat
var isTablet: Bool
+ var readingProgress: CGFloat
+ var loadingProgress: Double?
static func ==(lhs: Params, rhs: Params) -> Bool {
if lhs.theme !== rhs.theme {
@@ -111,26 +128,33 @@ final class AddressBarContentComponent: Component {
if lhs.isTablet != rhs.isTablet {
return false
}
+ if lhs.readingProgress != rhs.readingProgress {
+ return false
+ }
+ if lhs.loadingProgress != rhs.loadingProgress {
+ return false
+ }
return true
}
}
private let activated: (Bool) -> Void = { _ in }
private let deactivated: (Bool) -> Void = { _ in }
-
- private let backgroundLayer: SimpleLayer
-
- private let iconView: UIImageView
+
+ private let backgroundView: GlassBackgroundView
private let clearIconView: UIImageView
private let clearIconButton: HighlightTrackingButton
- private let cancelButtonTitle: ComponentView
- private let cancelButton: HighlightTrackingButton
+ private let cancelButton = ComponentView()
private var placeholderContent = ComponentView()
private var titleContent = ComponentView()
+ private let clippingView = UIView()
+ private var loadingProgress = ComponentView()
+ private var readingProgressView = UIView()
+
private var textFrame: CGRect?
private var textField: TextField?
@@ -144,50 +168,30 @@ final class AddressBarContentComponent: Component {
}
init() {
- self.backgroundLayer = SimpleLayer()
-
- self.iconView = UIImageView()
+ self.backgroundView = GlassBackgroundView()
self.clearIconView = UIImageView()
self.clearIconButton = HighlightableButton()
self.clearIconView.isHidden = false
self.clearIconButton.isHidden = false
-
- self.cancelButtonTitle = ComponentView()
- self.cancelButton = HighlightTrackingButton()
-
+
super.init(frame: CGRect())
- self.layer.addSublayer(self.backgroundLayer)
+ self.clippingView.clipsToBounds = true
- self.addSubview(self.iconView)
- self.addSubview(self.clearIconView)
- self.addSubview(self.clearIconButton)
+ self.addSubview(self.backgroundView)
+ self.backgroundView.contentView.addSubview(self.clippingView)
+ self.clippingView.addSubview(self.readingProgressView)
+
+ self.backgroundView.contentView.addSubview(self.clearIconView)
+ self.backgroundView.contentView.addSubview(self.clearIconButton)
- self.addSubview(self.cancelButton)
self.clipsToBounds = true
let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(self.tapGesture(_:)))
self.tapRecognizer = tapRecognizer
self.addGestureRecognizer(tapRecognizer)
-
- self.cancelButton.highligthedChanged = { [weak self] highlighted in
- if let strongSelf = self {
- if highlighted {
- if let cancelButtonTitleView = strongSelf.cancelButtonTitle.view {
- cancelButtonTitleView.layer.removeAnimation(forKey: "opacity")
- cancelButtonTitleView.alpha = 0.4
- }
- } else {
- if let cancelButtonTitleView = strongSelf.cancelButtonTitle.view {
- cancelButtonTitleView.alpha = 1.0
- cancelButtonTitleView.layer.animateAlpha(from: 0.4, to: 1.0, duration: 0.2)
- }
- }
- }
- }
- self.cancelButton.addTarget(self, action: #selector(self.cancelPressed), for: .touchUpInside)
-
+
self.clearIconButton.highligthedChanged = { [weak self] highlighted in
if let strongSelf = self {
if highlighted {
@@ -263,11 +267,16 @@ final class AddressBarContentComponent: Component {
self.placeholderContent.view?.isHidden = !text.isEmpty
if let params = self.params {
- self.update(theme: params.theme, strings: params.strings, size: params.size, isActive: params.isActive, title: params.title, isSecure: params.isSecure, collapseFraction: params.collapseFraction, isTablet: params.isTablet, transition: .immediate)
+ self.update(theme: params.theme, strings: params.strings, size: params.size, isActive: params.isActive, title: params.title, isSecure: params.isSecure, collapseFraction: params.collapseFraction, isTablet: params.isTablet, readingProgress: params.readingProgress, loadingProgress: params.loadingProgress, transition: .immediate)
}
}
- func update(component: AddressBarContentComponent, availableSize: CGSize, environment: Environment, transition: ComponentTransition) -> CGSize {
+ func update(
+ component: AddressBarContentComponent,
+ availableSize: CGSize,
+ environment: Environment,
+ transition: ComponentTransition
+ ) -> CGSize {
let collapseFraction = environment[BrowserNavigationBarEnvironment.self].fraction
let wasExpanded = self.component?.isExpanded ?? false
@@ -282,12 +291,36 @@ final class AddressBarContentComponent: Component {
let isActive = self.textField?.isFirstResponder ?? false
let title = getDisplayUrl(component.url, hostOnly: true)
- self.update(theme: component.theme, strings: component.strings, size: availableSize, isActive: isActive, title: title.lowercased(), isSecure: component.isSecure, collapseFraction: collapseFraction, isTablet: component.metrics.isTablet, transition: transition)
+ self.update(
+ theme: component.theme,
+ strings: component.strings,
+ size: availableSize,
+ isActive: isActive,
+ title: title.lowercased(),
+ isSecure: component.isSecure,
+ collapseFraction: collapseFraction,
+ isTablet: component.metrics.isTablet,
+ readingProgress: component.readingProgress,
+ loadingProgress: component.loadingProgress,
+ transition: transition
+ )
return availableSize
}
- public func update(theme: PresentationTheme, strings: PresentationStrings, size: CGSize, isActive: Bool, title: String, isSecure: Bool, collapseFraction: CGFloat, isTablet: Bool, transition: ComponentTransition) {
+ public func update(
+ theme: PresentationTheme,
+ strings: PresentationStrings,
+ size: CGSize,
+ isActive: Bool,
+ title: String,
+ isSecure: Bool,
+ collapseFraction: CGFloat,
+ isTablet: Bool,
+ readingProgress: CGFloat,
+ loadingProgress: Double?,
+ transition: ComponentTransition
+ ) {
let params = Params(
theme: theme,
strings: strings,
@@ -296,7 +329,9 @@ final class AddressBarContentComponent: Component {
title: title,
isSecure: isSecure,
collapseFraction: collapseFraction,
- isTablet: isTablet
+ isTablet: isTablet,
+ readingProgress: readingProgress,
+ loadingProgress: loadingProgress
)
if self.params == params {
@@ -306,8 +341,6 @@ final class AddressBarContentComponent: Component {
let isActiveWithText = self.component?.isExpanded ?? false
if self.params?.theme !== theme {
- self.iconView.image = generateTintedImage(image: UIImage(bundleImageName: "Media Grid/Lock"), color: .white)?.withRenderingMode(.alwaysTemplate)
- self.iconView.tintColor = theme.rootController.navigationSearchBar.inputIconColor
self.clearIconView.image = generateTintedImage(image: UIImage(bundleImageName: "Components/Search Bar/Clear"), color: .white)?.withRenderingMode(.alwaysTemplate)
self.clearIconView.tintColor = theme.rootController.navigationSearchBar.inputClearButtonColor
}
@@ -315,57 +348,9 @@ final class AddressBarContentComponent: Component {
self.params = params
let sideInset: CGFloat = 10.0
- let inputHeight: CGFloat = 36.0
+ let inputHeight: CGFloat = 44.0
let topInset: CGFloat = (size.height - inputHeight) / 2.0
- self.backgroundLayer.backgroundColor = theme.rootController.navigationSearchBar.inputFillColor.cgColor
- self.backgroundLayer.cornerRadius = 10.5
- transition.setAlpha(layer: self.backgroundLayer, alpha: max(0.0, min(1.0, 1.0 - collapseFraction * 1.5)))
-
- let cancelTextSize = self.cancelButtonTitle.update(
- transition: .immediate,
- component: AnyComponent(Text(
- text: strings.Common_Cancel,
- font: Font.regular(17.0),
- color: theme.rootController.navigationBar.accentTextColor
- )),
- environment: {},
- containerSize: CGSize(width: size.width - 32.0, height: 100.0)
- )
-
- let cancelButtonSpacing: CGFloat = 8.0
-
- var backgroundFrame = CGRect(origin: CGPoint(x: sideInset, y: topInset), size: CGSize(width: size.width - sideInset * 2.0, height: inputHeight))
- if isActiveWithText && !isTablet {
- backgroundFrame.size.width -= cancelTextSize.width + cancelButtonSpacing
- }
- transition.setFrame(layer: self.backgroundLayer, frame: backgroundFrame)
-
- transition.setFrame(view: self.cancelButton, frame: CGRect(origin: CGPoint(x: backgroundFrame.maxX, y: 0.0), size: CGSize(width: cancelButtonSpacing + cancelTextSize.width, height: size.height)))
- self.cancelButton.isUserInteractionEnabled = isActiveWithText && !isTablet
-
- let textX: CGFloat = backgroundFrame.minX + sideInset
- let textFrame = CGRect(origin: CGPoint(x: textX, y: backgroundFrame.minY), size: CGSize(width: backgroundFrame.maxX - textX, height: backgroundFrame.height))
-
- let placeholderSize = self.placeholderContent.update(
- transition: transition,
- component: AnyComponent(
- Text(text: strings.WebBrowser_AddressPlaceholder, font: Font.regular(17.0), color: theme.rootController.navigationSearchBar.inputPlaceholderTextColor)
- ),
- environment: {},
- containerSize: size
- )
- if let placeholderContentView = self.placeholderContent.view {
- if placeholderContentView.superview == nil {
- placeholderContentView.alpha = 0.0
- placeholderContentView.isHidden = true
- self.addSubview(placeholderContentView)
- }
- let placeholderContentFrame = CGRect(origin: CGPoint(x: textFrame.minX, y: backgroundFrame.midY - placeholderSize.height / 2.0), size: placeholderSize)
- transition.setFrame(view: placeholderContentView, frame: placeholderContentFrame)
- transition.setAlpha(view: placeholderContentView, alpha: isActiveWithText ? 1.0 : 0.0)
- }
-
let titleSize = self.titleContent.update(
transition: transition,
component: AnyComponent(
@@ -379,51 +364,96 @@ final class AddressBarContentComponent: Component {
environment: {},
containerSize: CGSize(width: size.width - 36.0, height: size.height)
)
- var titleContentFrame = CGRect(origin: CGPoint(x: isActiveWithText ? textFrame.minX : backgroundFrame.midX - titleSize.width / 2.0, y: backgroundFrame.midY - titleSize.height / 2.0), size: titleSize)
- if isSecure && !isActiveWithText {
- titleContentFrame.origin.x += 7.0
+
+ let expandedBackgroundWidth = size.width - 14.0 * 2.0
+ let collapsedBackgroundWidth = titleSize.width + 32.0
+ var backgroundSize = CGSize(width: expandedBackgroundWidth * (1.0 - collapseFraction) + collapsedBackgroundWidth * collapseFraction, height: 44.0)
+
+ let cancelButtonSpacing: CGFloat = 8.0
+ let cancelSize = self.cancelButton.update(
+ transition: transition,
+ component: AnyComponent(
+ GlassBarButtonComponent(
+ size: CGSize(width: 44.0, height: 44.0),
+ backgroundColor: nil,
+ isDark: theme.overallDarkAppearance,
+ state: .glass,
+ component: AnyComponentWithIdentity(id: "close", component: AnyComponent(
+ BundleIconComponent(name: "Navigation/Close", tintColor: theme.chat.inputPanel.panelControlColor)
+ )),
+ action: { [weak self] _ in
+ self?.cancelPressed()
+ }
+ )
+ ),
+ environment: {},
+ containerSize: CGSize(width: 44.0, height: 44.0)
+ )
+
+ if isActiveWithText && !isTablet {
+ backgroundSize.width -= cancelSize.width + cancelButtonSpacing + 4.0
}
- var titleSizeChanged = false
+ self.backgroundView.update(size: backgroundSize, cornerRadius: backgroundSize.height * 0.5, isDark: theme.overallDarkAppearance, tintColor: .init(kind: .panel, color: UIColor(white: theme.overallDarkAppearance ? 0.0 : 1.0, alpha: 0.6)), isInteractive: true, transition: transition)
+
+
+ var backgroundFrame = CGRect(origin: CGPoint(x: floor((size.width - backgroundSize.width) / 2.0), y: topInset), size: backgroundSize)
+ if isActiveWithText && !isTablet {
+ backgroundFrame.origin.x = 16.0
+ }
+ transition.setFrame(view: self.backgroundView, frame: backgroundFrame)
+
+ transition.setFrame(view: self.clippingView, frame: CGRect(origin: .zero, size: backgroundFrame.size))
+ transition.setCornerRadius(layer: self.clippingView.layer, cornerRadius: backgroundFrame.size.height * 0.5)
+
+ let textX: CGFloat = sideInset
+ let textFrame = CGRect(origin: CGPoint(x: textX, y: 0.0), size: CGSize(width: backgroundFrame.maxX - textX, height: backgroundFrame.height))
+
+ let placeholderSize = self.placeholderContent.update(
+ transition: transition,
+ component: AnyComponent(
+ Text(text: strings.WebBrowser_AddressPlaceholder, font: Font.regular(17.0), color: theme.rootController.navigationSearchBar.inputPlaceholderTextColor)
+ ),
+ environment: {},
+ containerSize: size
+ )
+ if let placeholderContentView = self.placeholderContent.view {
+ if placeholderContentView.superview == nil {
+ placeholderContentView.alpha = 0.0
+ placeholderContentView.isHidden = true
+ self.backgroundView.contentView.addSubview(placeholderContentView)
+ }
+ let placeholderContentFrame = CGRect(origin: CGPoint(x: textFrame.minX, y: backgroundFrame.size.height / 2.0 - placeholderSize.height / 2.0), size: placeholderSize)
+ transition.setFrame(view: placeholderContentView, frame: placeholderContentFrame)
+ transition.setAlpha(view: placeholderContentView, alpha: isActiveWithText ? 1.0 : 0.0)
+ }
+
+ let titleContentFrame = CGRect(origin: CGPoint(x: isActiveWithText ? textFrame.minX : backgroundFrame.width / 2.0 - titleSize.width / 2.0, y: backgroundFrame.height / 2.0 - titleSize.height / 2.0), size: titleSize)
if let titleContentView = self.titleContent.view {
if titleContentView.superview == nil {
- self.addSubview(titleContentView)
- }
- if titleContentView.frame.width != titleContentFrame.size.width {
- titleSizeChanged = true
+ self.backgroundView.contentView.addSubview(titleContentView)
}
transition.setPosition(view: titleContentView, position: titleContentFrame.center)
titleContentView.bounds = CGRect(origin: .zero, size: titleContentFrame.size)
transition.setAlpha(view: titleContentView, alpha: isActiveWithText ? 0.0 : 1.0)
}
-
- if let image = self.iconView.image {
- let iconFrame = CGRect(origin: CGPoint(x: titleContentFrame.minX - image.size.width - 3.0, y: backgroundFrame.minY + floor((backgroundFrame.height - image.size.height) / 2.0)), size: image.size)
- var iconTransition = transition
- if titleSizeChanged {
- iconTransition = .immediate
- }
- iconTransition.setFrame(view: self.iconView, frame: iconFrame)
- transition.setAlpha(view: self.iconView, alpha: isActiveWithText || !isSecure ? 0.0 : 1.0)
- }
-
+
if let image = self.clearIconView.image {
- let iconFrame = CGRect(origin: CGPoint(x: backgroundFrame.maxX - image.size.width - 4.0, y: backgroundFrame.minY + floor((backgroundFrame.height - image.size.height) / 2.0)), size: image.size)
+ let iconFrame = CGRect(origin: CGPoint(x: backgroundFrame.width - image.size.width - 4.0, y: floor((backgroundFrame.height - image.size.height) / 2.0)), size: image.size)
transition.setFrame(view: self.clearIconView, frame: iconFrame)
transition.setFrame(view: self.clearIconButton, frame: iconFrame.insetBy(dx: -8.0, dy: -10.0))
transition.setAlpha(view: self.clearIconView, alpha: isActiveWithText ? 1.0 : 0.0)
self.clearIconButton.isUserInteractionEnabled = isActiveWithText
}
- if let cancelButtonTitleComponentView = self.cancelButtonTitle.view {
- if cancelButtonTitleComponentView.superview == nil {
- self.addSubview(cancelButtonTitleComponentView)
- cancelButtonTitleComponentView.isUserInteractionEnabled = false
+ if let cancelButtonView = self.cancelButton.view {
+ if cancelButtonView.superview == nil {
+ self.addSubview(cancelButtonView)
}
- transition.setFrame(view: cancelButtonTitleComponentView, frame: CGRect(origin: CGPoint(x: backgroundFrame.maxX + cancelButtonSpacing, y: floor((size.height - cancelTextSize.height) / 2.0)), size: cancelTextSize))
- transition.setAlpha(view: cancelButtonTitleComponentView, alpha: isActiveWithText && !isTablet ? 1.0 : 0.0)
+ transition.setFrame(view: cancelButtonView, frame: CGRect(origin: CGPoint(x: backgroundFrame.maxX + cancelButtonSpacing, y: floor((size.height - cancelSize.height) / 2.0)), size: cancelSize))
+ transition.setAlpha(view: cancelButtonView, alpha: isActiveWithText && !isTablet ? 1.0 : 0.0)
}
- let textFieldFrame = CGRect(origin: CGPoint(x: textFrame.minX, y: backgroundFrame.minY), size: CGSize(width: backgroundFrame.maxX - textFrame.minX, height: backgroundFrame.height))
+ let textFieldFrame = CGRect(origin: CGPoint(x: sideInset, y: 0.0), size: CGSize(width: backgroundFrame.width - sideInset, height: backgroundFrame.height))
let textField: TextField
if let current = self.textField {
@@ -434,7 +464,7 @@ final class AddressBarContentComponent: Component {
textField.autocorrectionType = .no
textField.keyboardType = .URL
textField.returnKeyType = .go
- self.insertSubview(textField, belowSubview: self.clearIconView)
+ self.backgroundView.contentView.insertSubview(textField, belowSubview: self.clearIconView)
self.textField = textField
textField.delegate = self
@@ -450,9 +480,34 @@ final class AddressBarContentComponent: Component {
}
textField.textColor = theme.rootController.navigationSearchBar.inputTextColor
- transition.setFrame(view: textField, frame: CGRect(origin: CGPoint(x: backgroundFrame.minX + sideInset, y: backgroundFrame.minY - UIScreenPixel), size: CGSize(width: backgroundFrame.width - sideInset - 32.0, height: backgroundFrame.height)))
+ transition.setFrame(view: textField, frame: CGRect(origin: CGPoint(x: sideInset, y: -UIScreenPixel), size: CGSize(width: backgroundFrame.width - sideInset - 32.0, height: backgroundFrame.height)))
transition.setAlpha(view: textField, alpha: isActiveWithText ? 1.0 : 0.0)
textField.isUserInteractionEnabled = isActiveWithText
+
+
+ let loadingProgressInset: CGFloat = 12.0
+ let loadingProgressSize = CGSize(width: backgroundSize.width - loadingProgressInset * 2.0, height: 2.0)
+ let _ = self.loadingProgress.update(
+ transition: transition,
+ component: AnyComponent(LoadingProgressComponent(
+ color: theme.rootController.navigationBar.accentTextColor,
+ height: loadingProgressSize.height,
+ value: params.loadingProgress ?? 0.0
+ )),
+ environment: {},
+ containerSize: loadingProgressSize
+ )
+ if let loadingProgressView = self.loadingProgress.view {
+ if loadingProgressView.superview == nil {
+ self.clippingView.addSubview(loadingProgressView)
+ }
+ transition.setFrame(view: loadingProgressView, frame: CGRect(origin: CGPoint(x: loadingProgressInset, y: backgroundSize.height - loadingProgressSize.height), size: loadingProgressSize))
+ transition.setAlpha(view: loadingProgressView, alpha: isActiveWithText ? 0.0 : 1.0)
+ }
+
+ self.readingProgressView.backgroundColor = theme.rootController.navigationBar.primaryTextColor.withMultipliedAlpha(0.07)
+ self.readingProgressView.frame = CGRect(origin: .zero, size: CGSize(width: backgroundSize.width * params.readingProgress, height: backgroundSize.height))
+ transition.setAlpha(view: self.readingProgressView, alpha: isActiveWithText ? 0.0 : 1.0)
}
}
diff --git a/submodules/BrowserUI/Sources/BrowserAddressListComponent.swift b/submodules/BrowserUI/Sources/BrowserAddressListComponent.swift
index 1551fcf4..cd308ad4 100644
--- a/submodules/BrowserUI/Sources/BrowserAddressListComponent.swift
+++ b/submodules/BrowserUI/Sources/BrowserAddressListComponent.swift
@@ -19,6 +19,7 @@ final class BrowserAddressListComponent: Component {
let insets: UIEdgeInsets
let metrics: LayoutMetrics
let addressBarFrame: CGRect
+ let navigationBarHeight: CGFloat
let performAction: ActionSlot
let presentInGlobalOverlay: (ViewController) -> Void
@@ -29,6 +30,7 @@ final class BrowserAddressListComponent: Component {
insets: UIEdgeInsets,
metrics: LayoutMetrics,
addressBarFrame: CGRect,
+ navigationBarHeight: CGFloat,
performAction: ActionSlot,
presentInGlobalOverlay: @escaping (ViewController) -> Void
) {
@@ -38,6 +40,7 @@ final class BrowserAddressListComponent: Component {
self.insets = insets
self.metrics = metrics
self.addressBarFrame = addressBarFrame
+ self.navigationBarHeight = navigationBarHeight
self.performAction = performAction
self.presentInGlobalOverlay = presentInGlobalOverlay
}
@@ -61,6 +64,9 @@ final class BrowserAddressListComponent: Component {
if lhs.addressBarFrame != rhs.addressBarFrame {
return false
}
+ if lhs.navigationBarHeight != rhs.navigationBarHeight {
+ return false
+ }
return true
}
@@ -214,15 +220,16 @@ final class BrowserAddressListComponent: Component {
var validIds: [AnyHashable] = []
var validSectionHeaders: [AnyHashable] = []
var sectionOffset: CGFloat = 0.0
+ let headerOffset: CGFloat = self.scrollView.frame.minY
let sideInset: CGFloat = 0.0
- let containerInset: CGFloat = 0.0
+ let containerInset: CGFloat = self.scrollView.frame.minY
for sectionIndex in 0 ..< itemLayout.sections.count {
let section = itemLayout.sections[sectionIndex]
do {
- var sectionHeaderFrame = CGRect(origin: CGPoint(x: sideInset, y: sectionOffset - self.scrollView.bounds.minY), size: CGSize(width: itemLayout.containerSize.width, height: section.insets.top))
+ var sectionHeaderFrame = CGRect(origin: CGPoint(x: sideInset, y: headerOffset + sectionOffset - self.scrollView.bounds.minY), size: CGSize(width: itemLayout.containerSize.width, height: section.insets.top))
let sectionHeaderMinY = topOffset + containerInset
let sectionHeaderMaxY = containerInset + sectionOffset - self.scrollView.bounds.minY + section.totalHeight - 28.0
@@ -540,7 +547,7 @@ final class BrowserAddressListComponent: Component {
let containerFrame: CGRect
if component.metrics.isTablet {
let containerSize = CGSize(width: component.addressBarFrame.width + 32.0, height: 540.0)
- containerFrame = CGRect(origin: CGPoint(x: floor(component.addressBarFrame.center.x - containerSize.width / 2.0), y: 72.0), size: containerSize)
+ containerFrame = CGRect(origin: CGPoint(x: floor(component.addressBarFrame.center.x - containerSize.width / 2.0), y: 100.0), size: containerSize)
self.backgroundView.layer.cornerRadius = 10.0
} else {
@@ -602,23 +609,28 @@ final class BrowserAddressListComponent: Component {
let itemLayout = ItemLayout(containerSize: containerFrame.size, insets: .zero, sections: sections)
self.itemLayout = itemLayout
- let containerWidth = containerFrame.size.width
let scrollContentHeight = max(itemLayout.contentHeight, containerFrame.size.height)
self.ignoreScrolling = true
- transition.setFrame(view: self.scrollView, frame: CGRect(origin: .zero, size: containerFrame.size))
- let contentSize = CGSize(width: containerWidth, height: scrollContentHeight)
+ let scrollFrame: CGRect
+ if component.metrics.isTablet {
+ scrollFrame = CGRect(origin: .zero, size: containerFrame.size)
+ } else {
+ scrollFrame = CGRect(origin: CGPoint(x: 0.0, y: component.navigationBarHeight), size: CGSize(width: containerFrame.size.width, height: containerFrame.size.height - component.navigationBarHeight))
+ }
+ transition.setFrame(view: self.scrollView, frame: scrollFrame)
+ let contentSize = CGSize(width: scrollFrame.width, height: scrollContentHeight)
if contentSize != self.scrollView.contentSize {
self.scrollView.contentSize = contentSize
}
if resetScrolling {
- self.scrollView.bounds = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: containerWidth, height: containerFrame.size.height))
+ self.scrollView.bounds = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: scrollFrame.size)
}
self.ignoreScrolling = false
self.updateScrolling(transition: transition)
transition.setFrame(view: self.backgroundView, frame: containerFrame)
- transition.setFrame(view: self.itemContainerView, frame: CGRect(origin: .zero, size: CGSize(width: containerWidth, height: scrollContentHeight)))
+ transition.setFrame(view: self.itemContainerView, frame: CGRect(origin: .zero, size: CGSize(width: scrollFrame.width, height: scrollContentHeight)))
if component.metrics.isTablet {
transition.setFrame(view: self.shadowView, frame: containerFrame.insetBy(dx: -60.0, dy: -60.0))
diff --git a/submodules/BrowserUI/Sources/BrowserAddressListItemComponent.swift b/submodules/BrowserUI/Sources/BrowserAddressListItemComponent.swift
index f41a5395..49c9ece4 100644
--- a/submodules/BrowserUI/Sources/BrowserAddressListItemComponent.swift
+++ b/submodules/BrowserUI/Sources/BrowserAddressListItemComponent.swift
@@ -12,8 +12,15 @@ import AccountContext
import ContextUI
import UrlEscaping
-private let iconFont = Font.with(size: 30.0, design: .round, weight: .bold)
-private let iconTextBackgroundImage = generateStretchableFilledCircleImage(radius: 6.0, color: UIColor(rgb: 0xFF9500))
+private let iconFont = Font.with(size: 28.0, design: .round, weight: .bold)
+private let iconTextBackgroundImage = generateImage(CGSize(width: 40.0, height: 40.0), contextGenerator: { size, context in
+ context.clear(CGRect(origin: CGPoint(), size: size))
+ context.setFillColor(UIColor(rgb: 0xFF9500).cgColor)
+
+ let path = UIBezierPath(roundedRect: CGRect(origin: .zero, size: size), cornerRadius: 12.0)
+ context.addPath(path.cgPath)
+ context.fillPath()
+})
final class BrowserAddressListItemComponent: Component {
let context: AccountContext
@@ -261,7 +268,7 @@ final class BrowserAddressListItemComponent: Component {
let iconImageLayout = self.icon.asyncLayout()
var iconImageApply: (() -> Void)?
if let iconImageReferenceAndRepresentation = iconImageReferenceAndRepresentation {
- let imageCorners = ImageCorners(radius: 6.0)
+ let imageCorners = ImageCorners(radius: 12.0, curve: .continuous)
let arguments = TransformImageArguments(corners: imageCorners, imageSize: iconImageReferenceAndRepresentation.1.dimensions.cgSize.aspectFilled(iconSize), boundingSize: iconSize, intrinsicInsets: UIEdgeInsets(), emptyColor: component.theme.list.mediaPlaceholderColor)
iconImageApply = iconImageLayout(arguments)
}
diff --git a/submodules/BrowserUI/Sources/BrowserBookmarksScreen.swift b/submodules/BrowserUI/Sources/BrowserBookmarksScreen.swift
index 274ce3b5..d5fa9632 100644
--- a/submodules/BrowserUI/Sources/BrowserBookmarksScreen.swift
+++ b/submodules/BrowserUI/Sources/BrowserBookmarksScreen.swift
@@ -18,6 +18,10 @@ import SearchBarNode
import ChatHistorySearchContainerNode
import ContextUI
import UndoUI
+import ComponentFlow
+import EdgeEffect
+import ButtonComponent
+import BundleIconComponent
public final class BrowserBookmarksScreen: ViewController {
final class Node: ViewControllerTracingNode, ASScrollViewDelegate {
@@ -196,7 +200,6 @@ public final class BrowserBookmarksScreen: ViewController {
controllerInteraction: self.controllerInteraction,
selectedMessages: .single(nil),
mode: .list(
- search: false,
reversed: false,
reverseGroups: false,
displayHeaders: .none,
@@ -287,9 +290,9 @@ public final class BrowserBookmarksScreen: ViewController {
}
let tagMask: MessageTags = .webPage
- self.searchDisplayController = SearchDisplayController(presentationData: self.presentationData, mode: .list, placeholder: self.presentationData.strings.Common_Search, hasBackground: true, contentNode: ChatHistorySearchContainerNode(context: self.context, peerId: self.context.account.peerId, threadId: nil, tagMask: tagMask, interfaceInteraction: self.controllerInteraction), cancel: { [weak self] in
+ self.searchDisplayController = SearchDisplayController(presentationData: self.presentationData, mode: .navigation, placeholder: self.presentationData.strings.Common_Search, hasBackground: true, contentNode: ChatHistorySearchContainerNode(context: self.context, peerId: self.context.account.peerId, threadId: nil, tagMask: tagMask, interfaceInteraction: self.controllerInteraction), cancel: { [weak self] in
self?.controller?.deactivateSearch()
- })
+ }, fieldStyle: placeholderNode.fieldStyle)
self.searchDisplayController?.containerLayoutUpdated(layout, navigationBarHeight: navigationBarHeight, transition: .immediate)
self.searchDisplayController?.activate(insertSubnode: { [weak self, weak placeholderNode] subnode, isSearchBar in
@@ -372,7 +375,9 @@ public final class BrowserBookmarksScreen: ViewController {
self.openUrl = openUrl
self.addBookmark = addBookmark
- super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData))
+ super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData, style: .glass))
+
+ self._hasGlassStyle = true
self.navigationPresentation = .modal
self.supportedOrientations = ViewControllerSupportedOrientations(regularSize: .all, compactSize: .portrait)
@@ -429,19 +434,13 @@ public final class BrowserBookmarksScreen: ViewController {
searchContentNode.updateListVisibleContentOffset(offset)
}
}
-//
-// self.node.historyNode.didEndScrolling = { [weak self] _ in
-// if let strongSelf = self, let searchContentNode = strongSelf.searchContentNode {
-// let _ = fixNavigationSearchableListNodeScrolling(strongSelf.node.historyNode, searchNode: searchContentNode)
-// }
-// }
self.displayNodeDidLoad()
}
private func updateThemeAndStrings() {
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style
- self.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationData: self.presentationData))
+ self.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationData: self.presentationData, style: .glass), transition: .immediate)
self.searchContentNode?.updateThemeAndPlaceholder(theme: self.presentationData.theme, placeholder: self.presentationData.strings.Common_Search)
}
@@ -484,10 +483,8 @@ private class BottomPanelNode: ASDisplayNode {
private let strings: PresentationStrings
private let action: () -> Void
- private let separatorNode: ASDisplayNode
- private let button: HighlightTrackingButtonNode
- private let iconNode: ASImageNode
- private let textNode: ImmediateTextNode
+ private let edgeEffectView = EdgeEffectView()
+ private let button = ComponentView()
private var validLayout: (CGFloat, CGFloat, CGFloat)?
@@ -496,49 +493,13 @@ private class BottomPanelNode: ASDisplayNode {
self.strings = strings
self.action = action
- self.separatorNode = ASDisplayNode()
- self.separatorNode.backgroundColor = theme.rootController.navigationBar.separatorColor
-
- self.iconNode = ASImageNode()
- self.iconNode.displaysAsynchronously = false
- self.iconNode.image = generateTintedImage(image: UIImage(bundleImageName: "Chat List/AddIcon"), color: theme.rootController.navigationBar.accentTextColor)
- self.iconNode.isUserInteractionEnabled = false
-
- self.textNode = ImmediateTextNode()
- self.textNode.displaysAsynchronously = false
- self.textNode.attributedText = NSAttributedString(string: strings.WebBrowser_Bookmarks_BookmarkCurrent, font: Font.regular(17.0), textColor: theme.rootController.navigationBar.accentTextColor)
- self.textNode.isUserInteractionEnabled = false
-
- self.button = HighlightTrackingButtonNode()
-
super.init()
+ }
+
+ override func didLoad() {
+ super.didLoad()
- self.backgroundColor = theme.rootController.navigationBar.opaqueBackgroundColor
-
- self.addSubnode(self.button)
- self.addSubnode(self.separatorNode)
- self.addSubnode(self.iconNode)
- self.addSubnode(self.textNode)
- self.addSubnode(self.button)
-
- self.button.highligthedChanged = { [weak self] highlighted in
- if let self {
- if highlighted {
- self.iconNode.layer.removeAnimation(forKey: "opacity")
- self.iconNode.alpha = 0.4
-
- self.textNode.layer.removeAnimation(forKey: "opacity")
- self.textNode.alpha = 0.4
- } else {
- self.iconNode.alpha = 1.0
- self.iconNode.layer.animateAlpha(from: 0.4, to: 1.0, duration: 0.2)
-
- self.textNode.alpha = 1.0
- self.textNode.layer.animateAlpha(from: 0.4, to: 1.0, duration: 0.2)
- }
- }
- }
- self.button.addTarget(self, action: #selector(self.buttonPressed), forControlEvents: .touchUpInside)
+ self.view.addSubview(self.edgeEffectView)
}
@objc private func buttonPressed() {
@@ -551,26 +512,76 @@ private class BottomPanelNode: ASDisplayNode {
var bottomInset = bottomInset
bottomInset += topInset - (bottomInset.isZero ? 0.0 : 4.0)
- let buttonHeight: CGFloat = 40.0
- let textSize = self.textNode.updateLayout(CGSize(width: width, height: 44.0))
+// let buttonHeight: CGFloat = 40.0
+// let textSize = self.textNode.updateLayout(CGSize(width: width, height: 44.0))
+//
+// let spacing: CGFloat = 8.0
+// var contentWidth = textSize.width
+// var contentOriginX = floorToScreenPixels((width - contentWidth) / 2.0)
+// if let icon = self.iconNode.image {
+// contentWidth += icon.size.width + spacing
+// contentOriginX = floorToScreenPixels((width - contentWidth) / 2.0)
+// transition.updateFrame(node: self.iconNode, frame: CGRect(origin: CGPoint(x: contentOriginX, y: 12.0 + UIScreenPixel), size: icon.size))
+// contentOriginX += icon.size.width + spacing
+// }
+// let textFrame = CGRect(origin: CGPoint(x: contentOriginX, y: 17.0), size: textSize)
+// transition.updateFrame(node: self.textNode, frame: textFrame)
+//
+// transition.updateFrame(node: self.button, frame: textFrame.insetBy(dx: -10.0, dy: -10.0))
+//
+// transition.updateFrame(node: self.separatorNode, frame: CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: width, height: UIScreenPixel)))
+//
+
+ let buttonInsets = ContainerViewLayout.concentricInsets(bottomInset: bottomInset, innerDiameter: 52.0, sideInset: 30.0)
+ let height: CGFloat = 52.0 + buttonInsets.bottom
- let spacing: CGFloat = 8.0
- var contentWidth = textSize.width
- var contentOriginX = floorToScreenPixels((width - contentWidth) / 2.0)
- if let icon = self.iconNode.image {
- contentWidth += icon.size.width + spacing
- contentOriginX = floorToScreenPixels((width - contentWidth) / 2.0)
- transition.updateFrame(node: self.iconNode, frame: CGRect(origin: CGPoint(x: contentOriginX, y: 12.0 + UIScreenPixel), size: icon.size))
- contentOriginX += icon.size.width + spacing
+ let edgeEffectHeight: CGFloat = height
+ let edgeEffectFrame = CGRect(origin: CGPoint(x: 0.0, y: height - edgeEffectHeight), size: CGSize(width: width, height: edgeEffectHeight))
+ transition.updateFrame(view: self.edgeEffectView, frame: edgeEffectFrame)
+ self.edgeEffectView.update(
+ content: self.theme.list.plainBackgroundColor,
+ blur: true,
+ rect: edgeEffectFrame,
+ edge: .bottom,
+ edgeSize: edgeEffectFrame.height,
+ transition: ComponentTransition(transition)
+ )
+
+ var buttonItems: [AnyComponentWithIdentity] = []
+ buttonItems.append(AnyComponentWithIdentity(id: "icon", component: AnyComponent(BundleIconComponent(name: "Chat/Context Menu/Fave", tintColor: self.theme.list.itemCheckColors.foregroundColor))))
+ buttonItems.append(AnyComponentWithIdentity(id: "label", component: AnyComponent(Text(text: self.strings.WebBrowser_Bookmarks_BookmarkCurrent, font: Font.semibold(17.0), color: self.theme.list.itemCheckColors.foregroundColor))))
+
+ let buttonSize = self.button.update(
+ transition: .immediate,
+ component: AnyComponent(
+ ButtonComponent(
+ background: ButtonComponent.Background(
+ style: .glass,
+ color: self.theme.list.itemCheckColors.fillColor,
+ foreground: self.theme.list.itemCheckColors.foregroundColor,
+ pressedColor: self.theme.list.itemCheckColors.fillColor.withMultipliedAlpha(0.9)
+ ),
+ content: AnyComponentWithIdentity(
+ id: AnyHashable(0),
+ component: AnyComponent(HStack(buttonItems, spacing: 7.0))
+ ),
+ action: { [weak self] in
+ self?.action()
+ }
+ )
+ ),
+ environment: {},
+ containerSize: CGSize(width: width - sideInset * 2.0 - buttonInsets.left - buttonInsets.right, height: 52.0)
+ )
+ let buttonFrame = CGRect(origin: CGPoint(x: sideInset + buttonInsets.left, y: height - buttonInsets.bottom - buttonSize.height), size: buttonSize)
+ if let buttonView = self.button.view {
+ if buttonView.superview == nil {
+ self.view.addSubview(buttonView)
+ }
+ transition.updateFrame(view: buttonView, frame: buttonFrame)
}
- let textFrame = CGRect(origin: CGPoint(x: contentOriginX, y: 17.0), size: textSize)
- transition.updateFrame(node: self.textNode, frame: textFrame)
- transition.updateFrame(node: self.button, frame: textFrame.insetBy(dx: -10.0, dy: -10.0))
-
- transition.updateFrame(node: self.separatorNode, frame: CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: width, height: UIScreenPixel)))
-
- return topInset + buttonHeight + bottomInset
+ return height
}
}
diff --git a/submodules/BrowserUI/Sources/BrowserInstantPageContent.swift b/submodules/BrowserUI/Sources/BrowserInstantPageContent.swift
index b09b444e..cb03ff6e 100644
--- a/submodules/BrowserUI/Sources/BrowserInstantPageContent.swift
+++ b/submodules/BrowserUI/Sources/BrowserInstantPageContent.swift
@@ -90,12 +90,21 @@ final class BrowserInstantPageContent: UIView, BrowserContent, UIScrollViewDeleg
private let updateLayoutDisposable = MetaDisposable()
private let loadProgress = ValuePromise(1.0, ignoreRepeated: true)
- private let readingProgress = ValuePromise(1.0, ignoreRepeated: true)
+ private let readingProgress = ValuePromise(0.0, ignoreRepeated: true)
private var containerLayout: (size: CGSize, insets: UIEdgeInsets, fullInsets: UIEdgeInsets)?
private var setupScrollOffsetOnLayout = false
- init(context: AccountContext, presentationData: PresentationData, webPage: TelegramMediaWebpage, anchor: String?, url: String, sourceLocation: InstantPageSourceLocation, preloadedResouces: [Any]?, originalContent: BrowserContent? = nil) {
+ init(
+ context: AccountContext,
+ presentationData: PresentationData,
+ webPage: TelegramMediaWebpage,
+ anchor: String?,
+ url: String,
+ sourceLocation: InstantPageSourceLocation,
+ preloadedResouces: [Any]?,
+ originalContent: BrowserContent? = nil
+ ) {
self.context = context
var instantPage: InstantPage?
if case let .Loaded(content) = webPage.content {
@@ -132,6 +141,8 @@ final class BrowserInstantPageContent: UIView, BrowserContent, UIScrollViewDeleg
super.init(frame: .zero)
+ self.backgroundColor = self.theme.pageBackgroundColor
+
self.statePromise.set(.single(self._state)
|> then(
combineLatest(
@@ -193,6 +204,8 @@ final class BrowserInstantPageContent: UIView, BrowserContent, UIScrollViewDeleg
self.presentationData = presentationData
self.theme = instantPageThemeForType(presentationData.theme.overallDarkAppearance ? .dark : .light, settings: self.settings)
+ self.backgroundColor = self.theme.pageBackgroundColor
+
self.updatePageLayout()
self.updateVisibleItems(visibleBounds: self.scrollNode.view.bounds)
}
@@ -415,8 +428,7 @@ final class BrowserInstantPageContent: UIView, BrowserContent, UIScrollViewDeleg
var updateVisibleItems = false
let resetContentOffset = self.scrollNode.bounds.size.width.isZero || self.setupScrollOffsetOnLayout || !(self.initialAnchor ?? "").isEmpty
- var scrollInsets = insets
- scrollInsets.top = 0.0
+ let scrollInsets = fullInsets
if self.scrollNode.view.contentInset != scrollInsets {
self.scrollNode.view.contentInset = scrollInsets
self.scrollNode.view.scrollIndicatorInsets = scrollInsets
@@ -424,7 +436,7 @@ final class BrowserInstantPageContent: UIView, BrowserContent, UIScrollViewDeleg
self.wrapperNode.frame = CGRect(origin: .zero, size: size)
- let scrollFrame = CGRect(origin: CGPoint(x: 0.0, y: insets.top), size: CGSize(width: size.width, height: size.height - insets.top))
+ let scrollFrame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: size.width, height: size.height))
let scrollFrameUpdated = self.scrollNode.bounds.size != scrollFrame.size
if scrollFrameUpdated {
let widthUpdated = self.scrollNode.bounds.size.width != scrollFrame.width
diff --git a/submodules/BrowserUI/Sources/BrowserNavigationBarComponent.swift b/submodules/BrowserUI/Sources/BrowserNavigationBarComponent.swift
index 89e0387e..26cc5ae1 100644
--- a/submodules/BrowserUI/Sources/BrowserNavigationBarComponent.swift
+++ b/submodules/BrowserUI/Sources/BrowserNavigationBarComponent.swift
@@ -2,8 +2,10 @@ import Foundation
import UIKit
import Display
import ComponentFlow
-import BlurredBackgroundComponent
+import TelegramPresentationData
import ContextUI
+import GlassBackgroundComponent
+import EdgeEffect
final class BrowserNavigationBarEnvironment: Equatable {
public let fraction: CGFloat
@@ -20,7 +22,7 @@ final class BrowserNavigationBarEnvironment: Equatable {
}
}
-final class BrowserNavigationBarComponent: CombinedComponent {
+final class BrowserNavigationBarComponent: Component {
public class ExternalState {
public fileprivate(set) var centerItemFrame: CGRect
@@ -29,11 +31,7 @@ final class BrowserNavigationBarComponent: CombinedComponent {
}
}
- let backgroundColor: UIColor
- let separatorColor: UIColor
- let textColor: UIColor
- let progressColor: UIColor
- let accentColor: UIColor
+ let theme: PresentationTheme
let topInset: CGFloat
let height: CGFloat
let sideInset: CGFloat
@@ -42,17 +40,11 @@ final class BrowserNavigationBarComponent: CombinedComponent {
let leftItems: [AnyComponentWithIdentity]
let rightItems: [AnyComponentWithIdentity]
let centerItem: AnyComponentWithIdentity?
- let readingProgress: CGFloat
- let loadingProgress: Double?
let collapseFraction: CGFloat
let activate: () -> Void
init(
- backgroundColor: UIColor,
- separatorColor: UIColor,
- textColor: UIColor,
- progressColor: UIColor,
- accentColor: UIColor,
+ theme: PresentationTheme,
topInset: CGFloat,
height: CGFloat,
sideInset: CGFloat,
@@ -61,16 +53,10 @@ final class BrowserNavigationBarComponent: CombinedComponent {
leftItems: [AnyComponentWithIdentity],
rightItems: [AnyComponentWithIdentity],
centerItem: AnyComponentWithIdentity?,
- readingProgress: CGFloat,
- loadingProgress: Double?,
collapseFraction: CGFloat,
activate: @escaping () -> Void
) {
- self.backgroundColor = backgroundColor
- self.separatorColor = separatorColor
- self.textColor = textColor
- self.progressColor = progressColor
- self.accentColor = accentColor
+ self.theme = theme
self.topInset = topInset
self.height = height
self.sideInset = sideInset
@@ -79,26 +65,12 @@ final class BrowserNavigationBarComponent: CombinedComponent {
self.leftItems = leftItems
self.rightItems = rightItems
self.centerItem = centerItem
- self.readingProgress = readingProgress
- self.loadingProgress = loadingProgress
self.collapseFraction = collapseFraction
self.activate = activate
}
static func ==(lhs: BrowserNavigationBarComponent, rhs: BrowserNavigationBarComponent) -> Bool {
- if lhs.backgroundColor != rhs.backgroundColor {
- return false
- }
- if lhs.separatorColor != rhs.separatorColor {
- return false
- }
- if lhs.textColor != rhs.textColor {
- return false
- }
- if lhs.progressColor != rhs.progressColor {
- return false
- }
- if lhs.accentColor != rhs.accentColor {
+ if lhs.theme !== rhs.theme {
return false
}
if lhs.topInset != rhs.topInset {
@@ -122,203 +94,353 @@ final class BrowserNavigationBarComponent: CombinedComponent {
if lhs.centerItem != rhs.centerItem {
return false
}
- if lhs.readingProgress != rhs.readingProgress {
- return false
- }
- if lhs.loadingProgress != rhs.loadingProgress {
- return false
- }
if lhs.collapseFraction != rhs.collapseFraction {
return false
}
return true
}
- static var body: Body {
- let background = Child(Rectangle.self)
- let readingProgress = Child(Rectangle.self)
- let separator = Child(Rectangle.self)
- let loadingProgress = Child(LoadingProgressComponent.self)
- let leftItems = ChildMap(environment: Empty.self, keyedBy: AnyHashable.self)
- let rightItems = ChildMap(environment: Empty.self, keyedBy: AnyHashable.self)
- let centerItems = ChildMap(environment: BrowserNavigationBarEnvironment.self, keyedBy: AnyHashable.self)
- let activate = Child(Button.self)
+ final class View: UIView {
+ private var edgeEffectView = EdgeEffectView()
+ private let containerView = GlassBackgroundContainerView()
+
+ private var leftItemsBackground: GlassBackgroundView?
+ private var leftItems: [AnyHashable: ComponentView] = [:]
- return { context in
- var availableWidth = context.availableSize.width
- let sideInset: CGFloat = (context.component.metrics.isTablet ? 20.0 : 16.0) + context.component.sideInset
+ private var rightItemsBackground: GlassBackgroundView?
+ private var rightItems: [AnyHashable: ComponentView] = [:]
+
+ private var centerItems: [AnyHashable: ComponentView] = [:]
+
+ private let activateButton = HighlightTrackingButton()
+
+ private var component: BrowserNavigationBarComponent?
+ private weak var state: EmptyComponentState?
+
+ override init(frame: CGRect) {
+ super.init(frame: frame)
- let collapsedHeight: CGFloat = 24.0
- let expandedHeight = context.component.height
- let contentHeight: CGFloat = expandedHeight * (1.0 - context.component.collapseFraction) + collapsedHeight * context.component.collapseFraction
- let size = CGSize(width: context.availableSize.width, height: context.component.topInset + contentHeight)
- let verticalOffset: CGFloat = context.component.metrics.isTablet ? -2.0 : 0.0
- let itemSpacing: CGFloat = context.component.metrics.isTablet ? 26.0 : 8.0
+ self.addSubview(self.edgeEffectView)
- let background = background.update(
- component: Rectangle(color: context.component.backgroundColor.withAlphaComponent(1.0)),
- availableSize: CGSize(width: size.width, height: size.height),
- transition: context.transition
- )
-
- let readingProgress = readingProgress.update(
- component: Rectangle(color: context.component.progressColor),
- availableSize: CGSize(width: size.width * context.component.readingProgress, height: size.height),
- transition: context.transition
- )
-
- let separator = separator.update(
- component: Rectangle(color: context.component.separatorColor, height: UIScreenPixel),
- availableSize: CGSize(width: size.width, height: size.height),
- transition: context.transition
- )
-
- let loadingProgressHeight: CGFloat = 2.0
- let loadingProgress = loadingProgress.update(
- component: LoadingProgressComponent(
- color: context.component.accentColor,
- height: loadingProgressHeight,
- value: context.component.loadingProgress ?? 0.0
- ),
- availableSize: CGSize(width: size.width, height: size.height),
- transition: context.transition
- )
-
- var leftItemList: [_UpdatedChildComponent] = []
- for item in context.component.leftItems {
- let item = leftItems[item.id].update(
- component: item.component,
- availableSize: CGSize(width: availableWidth, height: expandedHeight),
- transition: context.transition
- )
- leftItemList.append(item)
- availableWidth -= item.size.width
- }
-
- var rightItemList: [_UpdatedChildComponent] = []
- for item in context.component.rightItems {
- let item = rightItems[item.id].update(
- component: item.component,
- availableSize: CGSize(width: availableWidth, height: expandedHeight),
- transition: context.transition
- )
- rightItemList.append(item)
- availableWidth -= item.size.width
+ self.addSubview(self.containerView)
+ self.activateButton.addTarget(self, action: #selector(self.activatePressed), for: .touchUpInside)
+ }
+
+ required init?(coder: NSCoder) {
+ preconditionFailure()
+ }
+
+ @objc private func activatePressed() {
+ guard let component = self.component else {
+ return
}
+ component.activate()
+ }
+
+ func update(component: BrowserNavigationBarComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment, transition: ComponentTransition) -> CGSize {
+ self.component = component
+ self.state = state
+
+ var availableWidth = availableSize.width
+ let sideInset: CGFloat = (component.metrics.isTablet ? 20.0 : 16.0) + component.sideInset
+
+ let collapsedHeight: CGFloat = 54.0
+ let expandedHeight = component.height
+ let contentHeight: CGFloat = expandedHeight * (1.0 - component.collapseFraction) + collapsedHeight * component.collapseFraction
+ let size = CGSize(width: availableSize.width, height: component.topInset + contentHeight)
+ let verticalOffset: CGFloat = component.metrics.isTablet ? -2.0 : 0.0
+ let itemSpacing: CGFloat = 0.0 //component.metrics.isTablet ? 26.0 : 8.0
+ let panelHeight: CGFloat = 44.0
+
+ var leftItemsBackground: GlassBackgroundView?
+ var leftItemsBackgroundTransition = transition
+ if !component.leftItems.isEmpty {
+ if let current = self.leftItemsBackground {
+ leftItemsBackground = current
+ } else {
+ leftItemsBackgroundTransition = .immediate
+ leftItemsBackground = GlassBackgroundView()
+ self.containerView.contentView.addSubview(leftItemsBackground!)
+ self.leftItemsBackground = leftItemsBackground
- context.add(background
- .position(CGPoint(x: size.width / 2.0, y: size.height / 2.0))
- )
-
- var readingProgressAlpha = context.component.collapseFraction
- if leftItemList.isEmpty && rightItemList.isEmpty {
- readingProgressAlpha = 0.0
+ transition.animateScale(view: leftItemsBackground!, from: 0.1, to: 1.0)
+ transition.animateAlpha(view: leftItemsBackground!, from: 0.0, to: 1.0)
+ }
}
- context.add(readingProgress
- .position(CGPoint(x: readingProgress.size.width / 2.0, y: size.height / 2.0))
- .opacity(readingProgressAlpha)
- )
- context.add(separator
- .position(CGPoint(x: size.width / 2.0, y: size.height))
- )
-
- context.add(loadingProgress
- .position(CGPoint(x: size.width / 2.0, y: size.height - loadingProgressHeight / 2.0))
- )
+ var rightItemsBackground: GlassBackgroundView?
+ var rightItemsBackgroundTransition = transition
+ if !component.rightItems.isEmpty {
+ if let current = self.rightItemsBackground {
+ rightItemsBackground = current
+ } else {
+ rightItemsBackgroundTransition = .immediate
+ rightItemsBackground = GlassBackgroundView()
+ self.containerView.contentView.addSubview(rightItemsBackground!)
+ self.rightItemsBackground = rightItemsBackground
+
+ transition.animateScale(view: rightItemsBackground!, from: 0.1, to: 1.0)
+ transition.animateAlpha(view: rightItemsBackground!, from: 0.0, to: 1.0)
+ }
+ }
+
+ var validLeftItemIds: Set = Set()
+ var leftItemTransitions: [AnyHashable: (CGSize, ComponentTransition)] = [:]
+ var leftItemsWidth: CGFloat = 0.0
+ for item in component.leftItems {
+ validLeftItemIds.insert(item.id)
+ var itemTransition = transition
+ let itemView: ComponentView
+ if let current = self.leftItems[item.id] {
+ itemView = current
+ } else {
+ itemTransition = .immediate
+ itemView = ComponentView()
+ self.leftItems[item.id] = itemView
+ }
+
+ let itemSize = itemView.update(
+ transition: itemTransition,
+ component: item.component,
+ environment: {},
+ containerSize: CGSize(width: availableWidth, height: expandedHeight)
+ )
+ leftItemTransitions[item.id] = (itemSize, itemTransition)
+ availableWidth -= itemSize.width
+ leftItemsWidth += itemSize.width
+ }
+
+ var validRightItemIds: Set = Set()
+ var rightItemTransitions: [AnyHashable: (CGSize, ComponentTransition)] = [:]
+ var rightItemsWidth: CGFloat = 0.0
+ for item in component.rightItems {
+ validRightItemIds.insert(item.id)
+ var itemTransition = transition
+ let itemView: ComponentView
+ if let current = self.rightItems[item.id] {
+ itemView = current
+ } else {
+ itemTransition = .immediate
+ itemView = ComponentView()
+ self.rightItems[item.id] = itemView
+ }
+
+ let itemSize = itemView.update(
+ transition: itemTransition,
+ component: item.component,
+ environment: {},
+ containerSize: CGSize(width: availableWidth, height: expandedHeight)
+ )
+ rightItemTransitions[item.id] = (itemSize, itemTransition)
+ availableWidth -= itemSize.width
+ rightItemsWidth += itemSize.width
+ }
var centerLeftInset = sideInset
- var leftItemX = sideInset
- for item in leftItemList {
- context.add(item
- .position(CGPoint(x: leftItemX + item.size.width / 2.0 - (item.size.width / 2.0 * 0.35 * context.component.collapseFraction), y: context.component.topInset + contentHeight / 2.0 + verticalOffset))
- .scale(1.0 - 0.35 * context.component.collapseFraction)
- .opacity(1.0 - context.component.collapseFraction)
- .appear(.default(scale: true, alpha: true))
- .disappear(.default(scale: true, alpha: true))
- )
- leftItemX += item.size.width + itemSpacing
- centerLeftInset += item.size.width + itemSpacing
+ var leftItemX = 0.0
+ for item in component.leftItems {
+ guard let (itemSize, itemTransition) = leftItemTransitions[item.id], let itemView = self.leftItems[item.id]?.view else {
+ continue
+ }
+ let itemPosition = CGPoint(x: leftItemX + itemSize.width / 2.0, y: panelHeight * 0.5)
+ let itemFrame = CGRect(origin: CGPoint(x: itemPosition.x - itemSize.width * 0.5, y: itemPosition.y - itemSize.height * 0.5), size: itemSize)
+ if itemView.superview == nil {
+ leftItemsBackground?.contentView.addSubview(itemView)
+ transition.animateAlpha(view: itemView, from: 0.0, to: 1.0)
+ transition.animateScale(view: itemView, from: 0.01, to: 1.0)
+ }
+ itemTransition.setBounds(view: itemView, bounds: CGRect(origin: .zero, size: itemFrame.size))
+ itemTransition.setPosition(view: itemView, position: itemFrame.center)
+
+ leftItemX += itemSize.width + itemSpacing
+ centerLeftInset += itemSize.width + itemSpacing
}
-
- var centerRightInset = sideInset - 5.0
- var rightItemX = context.availableSize.width - (sideInset - 5.0)
- for item in rightItemList.reversed() {
- context.add(item
- .position(CGPoint(x: rightItemX - item.size.width / 2.0 + (item.size.width / 2.0 * 0.35 * context.component.collapseFraction), y: context.component.topInset + contentHeight / 2.0 + verticalOffset))
- .scale(1.0 - 0.35 * context.component.collapseFraction)
- .opacity(1.0 - context.component.collapseFraction)
- .appear(.default(scale: true, alpha: true))
- .disappear(.default(scale: true, alpha: true))
- )
- rightItemX -= item.size.width + itemSpacing
- centerRightInset += item.size.width + itemSpacing
+
+ var centerRightInset = sideInset
+ var rightItemX = rightItemsWidth
+ for item in component.rightItems.reversed() {
+ guard let (itemSize, itemTransition) = rightItemTransitions[item.id], let itemView = self.rightItems[item.id]?.view else {
+ continue
+ }
+ let itemPosition = CGPoint(x: rightItemX - itemSize.width / 2.0, y: panelHeight * 0.5)
+ let itemFrame = CGRect(origin: CGPoint(x: itemPosition.x - itemSize.width * 0.5, y: itemPosition.y - itemSize.height * 0.5), size: itemSize)
+ if itemView.superview == nil {
+ rightItemsBackground?.contentView.addSubview(itemView)
+ transition.animateAlpha(view: itemView, from: 0.0, to: 1.0)
+ transition.animateScale(view: itemView, from: 0.01, to: 1.0)
+ }
+ itemTransition.setBounds(view: itemView, bounds: CGRect(origin: .zero, size: itemFrame.size))
+ itemTransition.setPosition(view: itemView, position: itemFrame.center)
+ itemTransition.setScale(view: itemView, scale: 1.0 - 0.35 * component.collapseFraction)
+ itemTransition.setAlpha(view: itemView, alpha: 1.0 - component.collapseFraction)
+
+ rightItemX -= itemSize.width + itemSpacing
+ centerRightInset += itemSize.width + itemSpacing
+ }
+
+ if let leftItemsBackground {
+ let leftItemsFrame = CGRect(origin: CGPoint(x: sideInset - (leftItemsWidth / 2.0 * 0.35 * component.collapseFraction), y: component.topInset + contentHeight / 2.0 + verticalOffset - panelHeight / 2.0), size: CGSize(width: leftItemsWidth, height: panelHeight))
+ leftItemsBackgroundTransition.setFrame(view: leftItemsBackground, frame: leftItemsFrame)
+ leftItemsBackground.update(size: leftItemsFrame.size, shape: .roundedRect(cornerRadius: leftItemsFrame.height * 0.5), isDark: component.theme.overallDarkAppearance, tintColor: .init(kind: .panel, color: UIColor(white: component.theme.overallDarkAppearance ? 0.0 : 1.0, alpha: 0.6)), isInteractive: true, transition: leftItemsBackgroundTransition)
+
+ leftItemsBackgroundTransition.setScale(view: leftItemsBackground, scale: 1.0 - 0.999 * component.collapseFraction)
+ leftItemsBackgroundTransition.setAlpha(view: leftItemsBackground.contentView, alpha: 1.0 - component.collapseFraction)
+ } else if let leftItemsBackground = self.leftItemsBackground {
+ self.leftItemsBackground = nil
+ leftItemsBackground.removeFromSuperview()
+ }
+
+ if let rightItemsBackground {
+ let rightItemsFrame = CGRect(origin: CGPoint(x: availableSize.width - sideInset - rightItemsWidth * (1.0 - component.collapseFraction) + (rightItemsWidth / 2.0 * 0.35 * component.collapseFraction), y: component.topInset + contentHeight / 2.0 + verticalOffset - panelHeight / 2.0), size: CGSize(width: rightItemsWidth, height: panelHeight))
+ rightItemsBackgroundTransition.setFrame(view: rightItemsBackground, frame: rightItemsFrame)
+ rightItemsBackground.update(size: rightItemsFrame.size, shape: .roundedRect(cornerRadius: rightItemsFrame.height * 0.5), isDark: component.theme.overallDarkAppearance, tintColor: .init(kind: .panel, color: UIColor(white: component.theme.overallDarkAppearance ? 0.0 : 1.0, alpha: 0.6)), isInteractive: true, transition: rightItemsBackgroundTransition)
+
+ rightItemsBackgroundTransition.setScale(view: rightItemsBackground, scale: 1.0 - 0.999 * component.collapseFraction)
+ rightItemsBackgroundTransition.setAlpha(view: rightItemsBackground.contentView, alpha: 1.0 - component.collapseFraction)
+ } else if let rightItemsBackground = self.rightItemsBackground {
+ self.rightItemsBackground = nil
+ rightItemsBackground.removeFromSuperview()
+ }
+
+ var removeLeftItemIds: [AnyHashable] = []
+ for (id, item) in self.leftItems {
+ if !validLeftItemIds.contains(id) {
+ removeLeftItemIds.append(id)
+ if let itemView = item.view {
+ transition.setScale(view: itemView, scale: 0.01)
+ transition.setAlpha(view: itemView, alpha: 0.0, completion: { _ in
+ itemView.removeFromSuperview()
+ })
+ }
+ }
+ }
+ for id in removeLeftItemIds {
+ self.leftItems.removeValue(forKey: id)
+ }
+
+ var removeRightItemIds: [AnyHashable] = []
+ for (id, item) in self.rightItems {
+ if !validRightItemIds.contains(id) {
+ removeRightItemIds.append(id)
+ if let itemView = item.view {
+ transition.setScale(view: itemView, scale: 0.01)
+ transition.setAlpha(view: itemView, alpha: 0.0, completion: { _ in
+ itemView.removeFromSuperview()
+ })
+ }
+ }
+ }
+ for id in removeRightItemIds {
+ self.rightItems.removeValue(forKey: id)
}
let maxCenterInset = max(centerLeftInset, centerRightInset)
- if !leftItemList.isEmpty || !rightItemList.isEmpty {
- availableWidth -= itemSpacing * CGFloat(max(0, leftItemList.count - 1)) + itemSpacing * CGFloat(max(0, rightItemList.count - 1)) + 30.0
+ if !component.leftItems.isEmpty || !component.rightItems.isEmpty {
+ availableWidth -= itemSpacing * CGFloat(max(0, component.leftItems.count - 1)) + itemSpacing * CGFloat(max(0, component.rightItems.count - 1)) + 30.0
}
- availableWidth -= context.component.sideInset * 2.0
+ availableWidth -= component.sideInset * 2.0
- let canCenter = availableWidth > 660.0
- availableWidth = min(660.0, availableWidth)
+ let canCenter = availableWidth > 390.0
+ availableWidth = min(390.0, availableWidth)
- let environment = BrowserNavigationBarEnvironment(fraction: context.component.collapseFraction)
+ let environment = BrowserNavigationBarEnvironment(fraction: component.collapseFraction)
- let centerItem = context.component.centerItem.flatMap { item in
- centerItems[item.id].update(
+ var centerX = maxCenterInset + (availableSize.width - maxCenterInset * 2.0) / 2.0
+ if canCenter {
+ centerX = availableSize.width / 2.0
+ } else {
+ centerX = centerLeftInset + (availableSize.width - centerLeftInset - centerRightInset) / 2.0
+ }
+
+ var validCenterItemIds: Set = Set()
+ if let item = component.centerItem {
+ validCenterItemIds.insert(item.id)
+
+ var itemTransition = transition
+ let itemView: ComponentView
+ if let current = self.centerItems[item.id] {
+ itemView = current
+ } else {
+ itemTransition = .immediate
+ itemView = ComponentView()
+ self.centerItems[item.id] = itemView
+ }
+
+ let itemSize = itemView.update(
+ transition: itemTransition,
component: item.component,
environment: { environment },
- availableSize: CGSize(width: availableWidth, height: expandedHeight),
- transition: context.transition
- )
- }
-
- var centerX = maxCenterInset + (context.availableSize.width - maxCenterInset * 2.0) / 2.0
- if "".isEmpty {
- if canCenter {
- centerX = context.availableSize.width / 2.0
- } else {
- centerX = centerLeftInset + (context.availableSize.width - centerLeftInset - centerRightInset) / 2.0
- }
- }
- if let centerItem = centerItem {
- let centerItemPosition = CGPoint(x: centerX, y: context.component.topInset + contentHeight / 2.0 + verticalOffset)
- context.add(centerItem
- .position(centerItemPosition)
- .scale(1.0 - 0.35 * context.component.collapseFraction)
- .appear(.default(scale: false, alpha: true))
- .disappear(.default(scale: false, alpha: true))
+ containerSize: CGSize(width: availableWidth, height: expandedHeight)
)
- context.component.externalState?.centerItemFrame = centerItem.size.centered(around: centerItemPosition)
+ let itemPosition = CGPoint(x: centerX, y: component.topInset + contentHeight / 2.0 + verticalOffset)
+ let itemFrame = CGRect(origin: CGPoint(x: itemPosition.x - itemSize.width * 0.5, y: itemPosition.y - itemSize.height * 0.5), size: itemSize)
+ if let itemView = itemView.view {
+ if itemView.superview == nil {
+ self.containerView.contentView.addSubview(itemView)
+ transition.animateAlpha(view: itemView, from: 0.0, to: 1.0)
+ }
+ itemTransition.setBounds(view: itemView, bounds: CGRect(origin: .zero, size: itemFrame.size))
+ itemTransition.setPosition(view: itemView, position: itemFrame.center)
+ itemTransition.setScale(view: itemView, scale: 1.0 - 0.25 * component.collapseFraction)
+ }
+ component.externalState?.centerItemFrame = itemFrame
}
- if context.component.collapseFraction == 1.0 {
- let activateAction = context.component.activate
- let activate = activate.update(
- component: Button(
- content: AnyComponent(Rectangle(color: UIColor(rgb: 0x000000, alpha: 0.001))),
- action: {
- activateAction()
- }
- ),
- availableSize: size,
- transition: .immediate
- )
- context.add(activate
- .position(CGPoint(x: size.width / 2.0, y: size.height / 2.0))
- )
+ var removeCenterItemIds: [AnyHashable] = []
+ for (id, item) in self.centerItems {
+ if !validCenterItemIds.contains(id) {
+ removeCenterItemIds.append(id)
+ if let itemView = item.view {
+ transition.setAlpha(view: itemView, alpha: 0.0, completion: { _ in
+ itemView.removeFromSuperview()
+ })
+ }
+ }
}
+ for id in removeCenterItemIds {
+ self.centerItems.removeValue(forKey: id)
+ }
+
+ if component.collapseFraction == 1.0 {
+ if self.activateButton.superview == nil {
+ self.addSubview(self.activateButton)
+ }
+ self.activateButton.frame = CGRect(origin: .zero, size: size)
+ } else {
+ self.activateButton.removeFromSuperview()
+ }
+
+ self.containerView.update(size: size, isDark: component.theme.overallDarkAppearance, transition: transition)
+ transition.setFrame(view: self.containerView, frame: CGRect(origin: .zero, size: size))
+
+ let edgeEffectHeight: CGFloat = 80.0
+ let edgeEffectFrame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: size.width, height: edgeEffectHeight))
+ transition.setFrame(view: self.edgeEffectView, frame: edgeEffectFrame)
+ self.edgeEffectView.update(
+ content: .clear,
+ blur: true,
+ rect: edgeEffectFrame,
+ edge: .top,
+ edgeSize: edgeEffectFrame.height,
+ transition: transition
+ )
return size
}
}
+
+ public func makeView() -> View {
+ return View(frame: CGRect())
+ }
+
+ func update(view: View, availableSize: CGSize, state: EmptyComponentState, environment: Environment, transition: ComponentTransition) -> CGSize {
+ return view.update(component: self, availableSize: availableSize, state: state, environment: environment, transition: transition)
+ }
}
-private final class LoadingProgressComponent: Component {
+final class LoadingProgressComponent: Component {
let color: UIColor
let height: CGFloat
let value: CGFloat
@@ -414,111 +536,3 @@ private final class LoadingProgressComponent: Component {
return view.update(component: self, availableSize: availableSize, transition: transition)
}
}
-
-final class ReferenceButtonComponent: Component {
- let content: AnyComponent
- let tag: AnyObject?
- let action: () -> Void
-
- init(
- content: AnyComponent,
- tag: AnyObject? = nil,
- action: @escaping () -> Void
- ) {
- self.content = content
- self.tag = tag
- self.action = action
- }
-
- static func ==(lhs: ReferenceButtonComponent, rhs: ReferenceButtonComponent) -> Bool {
- if lhs.content != rhs.content {
- return false
- }
- if lhs.tag !== rhs.tag {
- return false
- }
- return true
- }
-
- final class View: HighlightTrackingButton, ComponentTaggedView {
- private let sourceView: ContextControllerSourceView
- let referenceNode: ContextReferenceContentNode
- let componentView: ComponentView
-
- private var component: ReferenceButtonComponent?
-
- public func matches(tag: Any) -> Bool {
- if let component = self.component, let componentTag = component.tag {
- let tag = tag as AnyObject
- if componentTag === tag {
- return true
- }
- }
- return false
- }
-
- init() {
- self.componentView = ComponentView()
- self.sourceView = ContextControllerSourceView()
- self.sourceView.animateScale = false
- self.referenceNode = ContextReferenceContentNode()
-
- super.init(frame: CGRect())
-
- self.sourceView.isUserInteractionEnabled = false
- self.addSubview(self.sourceView)
- self.sourceView.addSubnode(self.referenceNode)
-
- self.highligthedChanged = { [weak self] highlighted in
- if let strongSelf = self, let contentView = strongSelf.componentView.view {
- if highlighted {
- contentView.layer.removeAnimation(forKey: "opacity")
- contentView.alpha = 0.4
- } else {
- contentView.alpha = 1.0
- contentView.layer.animateAlpha(from: 0.4, to: 1.0, duration: 0.2)
- }
- }
- }
- self.addTarget(self, action: #selector(self.pressed), for: .touchUpInside)
- }
-
- required init?(coder aDecoder: NSCoder) {
- preconditionFailure()
- }
-
- @objc private func pressed() {
- self.component?.action()
- }
-
- func update(component: ReferenceButtonComponent, availableSize: CGSize, transition: ComponentTransition) -> CGSize {
- self.component = component
-
- let componentSize = self.componentView.update(
- transition: transition,
- component: component.content,
- environment: {},
- containerSize: availableSize
- )
- if let componentView = self.componentView.view {
- if componentView.superview == nil {
- self.referenceNode.view.addSubview(componentView)
- }
- transition.setFrame(view: componentView, frame: CGRect(origin: .zero, size: componentSize))
- }
-
- transition.setFrame(view: self.sourceView, frame: CGRect(origin: .zero, size: componentSize))
- self.referenceNode.frame = CGRect(origin: .zero, size: componentSize)
-
- return componentSize
- }
- }
-
- func makeView() -> View {
- return View()
- }
-
- func update(view: View, availableSize: CGSize, state: EmptyComponentState, environment: Environment, transition: ComponentTransition) -> CGSize {
- return view.update(component: self, availableSize: availableSize, transition: transition)
- }
-}
diff --git a/submodules/BrowserUI/Sources/BrowserPdfContent.swift b/submodules/BrowserUI/Sources/BrowserPdfContent.swift
index 8cad6151..be32b96e 100644
--- a/submodules/BrowserUI/Sources/BrowserPdfContent.swift
+++ b/submodules/BrowserUI/Sources/BrowserPdfContent.swift
@@ -16,6 +16,7 @@ import ShareController
import UndoUI
import UrlEscaping
import PDFKit
+import GlassBackgroundComponent
final class BrowserPdfContent: UIView, BrowserContent, UIScrollViewDelegate, PDFDocumentDelegate {
private let context: AccountContext
@@ -25,7 +26,7 @@ final class BrowserPdfContent: UIView, BrowserContent, UIScrollViewDelegate, PDF
private let pdfView: PDFView
private let scrollView: UIScrollView!
- private let pageIndicatorBackgorund: UIVisualEffectView
+ private let pageIndicatorBackground = GlassBackgroundView()
private let pageIndicator = ComponentView()
private var pageNumber: (Int, Int)?
private var pageTimer: SwiftSignalKit.Timer?
@@ -61,11 +62,7 @@ final class BrowserPdfContent: UIView, BrowserContent, UIScrollViewDelegate, PDF
self.pdfView = PDFView()
self.pdfView.clipsToBounds = false
-
- self.pageIndicatorBackgorund = UIVisualEffectView(effect: UIBlurEffect(style: .light))
- self.pageIndicatorBackgorund.clipsToBounds = true
- self.pageIndicatorBackgorund.layer.cornerRadius = 10.0
-
+
var scrollView: UIScrollView?
for view in self.pdfView.subviews {
if let view = view as? UIScrollView {
@@ -170,7 +167,7 @@ final class BrowserPdfContent: UIView, BrowserContent, UIScrollViewDelegate, PDF
return
}
let transition = ComponentTransition.easeInOut(duration: 0.25)
- transition.setAlpha(view: self.pageIndicatorBackgorund, alpha: 0.0)
+ transition.setAlpha(view: self.pageIndicatorBackground, alpha: 0.0)
}, queue: Queue.mainQueue())
self.pageTimer?.start()
}
@@ -354,7 +351,7 @@ final class BrowserPdfContent: UIView, BrowserContent, UIScrollViewDelegate, PDF
self.validLayout = (size, insets, fullInsets)
self.previousScrollingOffset = ScrollingOffsetState(value: self.scrollView.contentOffset.y, isDraggingOrDecelerating: self.scrollView.isDragging || self.scrollView.isDecelerating)
-
+
let currentBounds = self.scrollView.bounds
let offsetToBottomEdge = max(0.0, self.scrollView.contentSize.height - currentBounds.maxY)
var bottomInset = insets.bottom
@@ -368,23 +365,24 @@ final class BrowserPdfContent: UIView, BrowserContent, UIScrollViewDelegate, PDF
let pageIndicatorSize = self.pageIndicator.update(
transition: .immediate,
component: AnyComponent(
- Text(text: "\(self.pageNumber?.0 ?? 1) of \(self.pageNumber?.1 ?? 1)", font: Font.with(size: 15.0, weight: .semibold, traits: .monospacedNumbers), color: self.presentationData.theme.list.itemSecondaryTextColor)
+ Text(text: "\(self.pageNumber?.0 ?? 1) of \(self.pageNumber?.1 ?? 1)", font: Font.with(size: 15.0, weight: .regular, traits: .monospacedNumbers), color: self.presentationData.theme.list.itemPrimaryTextColor)
),
environment: {},
containerSize: size
)
if let view = self.pageIndicator.view {
if view.superview == nil {
- self.addSubview(self.pageIndicatorBackgorund)
- self.pageIndicatorBackgorund.contentView.addSubview(view)
+ self.addSubview(self.pageIndicatorBackground)
+ self.pageIndicatorBackground.contentView.addSubview(view)
}
-
+
let horizontalPadding: CGFloat = 10.0
let verticalPadding: CGFloat = 8.0
- let pageBackgroundFrame = CGRect(origin: CGPoint(x: insets.left + 20.0, y: insets.top + 16.0), size: CGSize(width: horizontalPadding * 2.0 + pageIndicatorSize.width, height: verticalPadding * 2.0 + pageIndicatorSize.height))
+ let pageBackgroundFrame = CGRect(origin: CGPoint(x: insets.left + 16.0, y: insets.top + 16.0), size: CGSize(width: horizontalPadding * 2.0 + pageIndicatorSize.width, height: verticalPadding * 2.0 + pageIndicatorSize.height))
- self.pageIndicatorBackgorund.bounds = CGRect(origin: .zero, size: pageBackgroundFrame.size)
- transition.setPosition(view: self.pageIndicatorBackgorund, position: pageBackgroundFrame.center)
+ self.pageIndicatorBackground.update(size: pageBackgroundFrame.size, cornerRadius: pageBackgroundFrame.size.height * 0.5, isDark: self.presentationData.theme.overallDarkAppearance, tintColor: .init(kind: .panel, color: UIColor(white: self.presentationData.theme.overallDarkAppearance ? 0.0 : 1.0, alpha: 0.6)), transition: transition)
+ self.pageIndicatorBackground.bounds = CGRect(origin: .zero, size: pageBackgroundFrame.size)
+ transition.setPosition(view: self.pageIndicatorBackground, position: pageBackgroundFrame.center)
view.frame = CGRect(origin: CGPoint(x: horizontalPadding, y: verticalPadding), size: pageIndicatorSize)
}
@@ -459,7 +457,7 @@ final class BrowserPdfContent: UIView, BrowserContent, UIScrollViewDelegate, PDF
}
let transition = ComponentTransition.easeInOut(duration: 0.1)
- transition.setAlpha(view: self.pageIndicatorBackgorund, alpha: 1.0)
+ transition.setAlpha(view: self.pageIndicatorBackground, alpha: 1.0)
self.pageTimer?.invalidate()
self.pageTimer = nil
diff --git a/submodules/BrowserUI/Sources/BrowserScreen.swift b/submodules/BrowserUI/Sources/BrowserScreen.swift
index aeb2e445..9eac12ee 100644
--- a/submodules/BrowserUI/Sources/BrowserScreen.swift
+++ b/submodules/BrowserUI/Sources/BrowserScreen.swift
@@ -20,6 +20,7 @@ import InstantPageUI
import NavigationStackComponent
import LottieComponent
import WebKit
+import GlassBarButtonComponent
private let settingsTag = GenericComponentViewTag()
@@ -85,6 +86,8 @@ private final class BrowserScreenComponent: CombinedComponent {
let navigationBarExternalState = BrowserNavigationBarComponent.ExternalState()
+ let moreButtonPlayOnce = ActionSlot()
+
return { context in
let environment = context.environment[ViewControllerComponentContainer.Environment.self].value
let performAction = context.component.performAction
@@ -123,6 +126,8 @@ private final class BrowserScreenComponent: CombinedComponent {
url: context.component.contentState?.url ?? "",
isSecure: context.component.contentState?.isSecure ?? false,
isExpanded: context.component.presentationState.addressFocused,
+ readingProgress: context.component.contentState?.readingProgress ?? 0.0,
+ loadingProgress: context.component.contentState?.estimatedProgress,
performAction: performAction
)
)
@@ -134,7 +139,9 @@ private final class BrowserScreenComponent: CombinedComponent {
component: AnyComponent(
TitleBarContentComponent(
theme: environment.theme,
- title: title
+ title: title,
+ readingProgress: context.component.contentState?.readingProgress ?? 0.0,
+ loadingProgress: context.component.contentState?.estimatedProgress
)
)
)
@@ -150,37 +157,40 @@ private final class BrowserScreenComponent: CombinedComponent {
component: AnyComponent(
Button(
content: AnyComponent(
- MultilineTextComponent(text: .plain(NSAttributedString(string: environment.strings.WebBrowser_Done, font: Font.semibold(17.0), textColor: environment.theme.rootController.navigationBar.accentTextColor, paragraphAlignment: .center)), horizontalAlignment: .left, maximumNumberOfLines: 1)
+ BundleIconComponent(
+ name: "Navigation/Close",
+ tintColor: environment.theme.chat.inputPanel.panelControlColor
+ )
),
action: {
performAction.invoke(.close)
}
- )
+ ).minSize(CGSize(width: 44.0, height: 44.0))
)
)
]
if isTablet {
- #if DEBUG
- navigationLeftItems.append(
- AnyComponentWithIdentity(
- id: "minimize",
- component: AnyComponent(
- Button(
- content: AnyComponent(
- BundleIconComponent(
- name: "Media Gallery/PictureInPictureButton",
- tintColor: environment.theme.rootController.navigationBar.accentTextColor
- )
- ),
- action: {
- performAction.invoke(.close)
- }
- )
- )
- )
- )
- #endif
+// #if DEBUG
+// navigationLeftItems.append(
+// AnyComponentWithIdentity(
+// id: "minimize",
+// component: AnyComponent(
+// Button(
+// content: AnyComponent(
+// BundleIconComponent(
+// name: "Media Gallery/PictureInPictureButton",
+// tintColor: environment.theme.rootController.navigationBar.accentTextColor
+// )
+// ),
+// action: {
+// performAction.invoke(.close)
+// }
+// )
+// )
+// )
+// )
+// #endif
let canGoBack = context.component.contentState?.canGoBack ?? false
let canGoForward = context.component.contentState?.canGoForward ?? false
@@ -193,13 +203,13 @@ private final class BrowserScreenComponent: CombinedComponent {
content: AnyComponent(
BundleIconComponent(
name: "Instant View/Back",
- tintColor: environment.theme.rootController.navigationBar.accentTextColor.withAlphaComponent(canGoBack ? 1.0 : 0.4)
+ tintColor: environment.theme.chat.inputPanel.panelControlColor.withAlphaComponent(canGoBack ? 1.0 : 0.4)
)
),
action: {
performAction.invoke(.navigateBack)
}
- )
+ ).minSize(CGSize(width: 44.0, height: 44.0))
)
)
)
@@ -212,13 +222,13 @@ private final class BrowserScreenComponent: CombinedComponent {
content: AnyComponent(
BundleIconComponent(
name: "Instant View/Forward",
- tintColor: environment.theme.rootController.navigationBar.accentTextColor.withAlphaComponent(canGoForward ? 1.0 : 0.4)
+ tintColor: environment.theme.chat.inputPanel.panelControlColor.withAlphaComponent(canGoForward ? 1.0 : 0.4)
)
),
action: {
performAction.invoke(.navigateForward)
}
- )
+ ).minSize(CGSize(width: 44.0, height: 44.0))
)
)
)
@@ -228,21 +238,22 @@ private final class BrowserScreenComponent: CombinedComponent {
AnyComponentWithIdentity(
id: "settings",
component: AnyComponent(
- ReferenceButtonComponent(
+ Button(
content: AnyComponent(
LottieComponent(
content: LottieComponent.AppBundleContent(
- name: "anim_moredots"
+ name: "anim_morewide"
),
- color: environment.theme.rootController.navigationBar.accentTextColor,
- size: CGSize(width: 30.0, height: 30.0)
+ color: environment.theme.chat.inputPanel.panelControlColor,
+ size: CGSize(width: 34.0, height: 34.0),
+ playOnce: moreButtonPlayOnce
)
),
- tag: settingsTag,
action: {
performAction.invoke(.openSettings)
+ moreButtonPlayOnce.invoke(Void())
}
- )
+ ).minSize(CGSize(width: 44.0, height: 44.0)).tagged(settingsTag)
)
)
]
@@ -256,13 +267,13 @@ private final class BrowserScreenComponent: CombinedComponent {
content: AnyComponent(
BundleIconComponent(
name: "Instant View/Bookmark",
- tintColor: environment.theme.rootController.navigationBar.accentTextColor
+ tintColor: environment.theme.chat.inputPanel.panelControlColor
)
),
action: {
performAction.invoke(.openBookmarks)
}
- )
+ ).minSize(CGSize(width: 44.0, height: 44.0))
)
),
at: 0
@@ -275,14 +286,14 @@ private final class BrowserScreenComponent: CombinedComponent {
Button(
content: AnyComponent(
BundleIconComponent(
- name: "Chat List/NavigationShare",
- tintColor: environment.theme.rootController.navigationBar.accentTextColor
+ name: "Instant View/Share",
+ tintColor: environment.theme.chat.inputPanel.panelControlColor
)
),
action: {
performAction.invoke(.share)
}
- )
+ ).minSize(CGSize(width: 44.0, height: 44.0))
)
),
at: 0
@@ -297,13 +308,13 @@ private final class BrowserScreenComponent: CombinedComponent {
content: AnyComponent(
BundleIconComponent(
name: "Instant View/Browser",
- tintColor: environment.theme.rootController.navigationBar.accentTextColor
+ tintColor: environment.theme.chat.inputPanel.panelControlColor
)
),
action: {
performAction.invoke(.openIn)
}
- )
+ ).minSize(CGSize(width: 44.0, height: 44.0))
)
)
)
@@ -316,21 +327,15 @@ private final class BrowserScreenComponent: CombinedComponent {
let navigationBar = navigationBar.update(
component: BrowserNavigationBarComponent(
- backgroundColor: environment.theme.rootController.navigationBar.blurredBackgroundColor,
- separatorColor: environment.theme.rootController.navigationBar.separatorColor,
- textColor: environment.theme.rootController.navigationBar.primaryTextColor,
- progressColor: environment.theme.rootController.navigationBar.segmentedBackgroundColor,
- accentColor: environment.theme.rootController.navigationBar.accentTextColor,
+ theme: environment.theme,
topInset: environment.statusBarHeight,
- height: environment.navigationHeight - environment.statusBarHeight,
+ height: environment.navigationHeight - environment.statusBarHeight + 8.0,
sideInset: environment.safeInsets.left,
metrics: environment.metrics,
externalState: navigationBarExternalState,
leftItems: navigationLeftItems,
rightItems: navigationRightItems,
centerItem: navigationContent,
- readingProgress: context.component.contentState?.readingProgress ?? 0.0,
- loadingProgress: context.component.contentState?.estimatedProgress,
collapseFraction: collapseFraction,
activate: {
performAction.invoke(.expand)
@@ -339,9 +344,6 @@ private final class BrowserScreenComponent: CombinedComponent {
availableSize: context.availableSize,
transition: context.transition
)
- context.add(navigationBar
- .position(CGPoint(x: context.availableSize.width / 2.0, y: navigationBar.size.height / 2.0))
- )
let toolbarContent: AnyComponentWithIdentity?
if context.component.presentationState.isSearching {
@@ -349,8 +351,8 @@ private final class BrowserScreenComponent: CombinedComponent {
id: "search",
component: AnyComponent(
SearchToolbarContentComponent(
+ theme: environment.theme,
strings: environment.strings,
- textColor: environment.theme.rootController.navigationBar.primaryTextColor,
index: context.component.presentationState.searchResultIndex,
count: context.component.presentationState.searchResultCount,
isEmpty: context.component.presentationState.searchQueryIsEmpty,
@@ -363,8 +365,7 @@ private final class BrowserScreenComponent: CombinedComponent {
id: "navigation",
component: AnyComponent(
NavigationToolbarContentComponent(
- accentColor: environment.theme.rootController.navigationBar.accentTextColor,
- textColor: environment.theme.rootController.navigationBar.primaryTextColor,
+ theme: environment.theme,
canGoBack: context.component.contentState?.canGoBack ?? false,
canGoForward: context.component.contentState?.canGoForward ?? false,
canOpenIn: canOpenIn,
@@ -384,15 +385,12 @@ private final class BrowserScreenComponent: CombinedComponent {
toolbarBottomInset = environment.safeInsets.bottom
}
- var toolbarSize: CGFloat = 0.0
if isTablet && !context.component.presentationState.isSearching {
} else {
let toolbar = toolbar.update(
component: BrowserToolbarComponent(
- backgroundColor: environment.theme.rootController.navigationBar.blurredBackgroundColor,
- separatorColor: environment.theme.rootController.navigationBar.separatorColor,
- textColor: environment.theme.rootController.navigationBar.primaryTextColor,
+ theme: environment.theme,
bottomInset: toolbarBottomInset,
sideInset: environment.safeInsets.left,
item: toolbarContent,
@@ -412,16 +410,9 @@ private final class BrowserScreenComponent: CombinedComponent {
})
})
)
- toolbarSize = toolbar.size.height
}
if context.component.presentationState.addressFocused {
- let addressListSize: CGSize
- if isTablet {
- addressListSize = context.availableSize
- } else {
- addressListSize = CGSize(width: context.availableSize.width, height: context.availableSize.height - navigationBar.size.height - toolbarSize)
- }
let controller = environment.controller
let addressList = addressList.update(
component: BrowserAddressListComponent(
@@ -431,12 +422,13 @@ private final class BrowserScreenComponent: CombinedComponent {
insets: UIEdgeInsets(top: 0.0, left: environment.safeInsets.left, bottom: 0.0, right: environment.safeInsets.right),
metrics: environment.metrics,
addressBarFrame: navigationBarExternalState.centerItemFrame,
+ navigationBarHeight: navigationBar.size.height,
performAction: performAction,
presentInGlobalOverlay: { c in
controller()?.presentInGlobalOverlay(c)
}
),
- availableSize: addressListSize,
+ availableSize: context.availableSize,
transition: context.transition
)
@@ -448,7 +440,7 @@ private final class BrowserScreenComponent: CombinedComponent {
)
} else {
context.add(addressList
- .position(CGPoint(x: context.availableSize.width / 2.0, y: navigationBar.size.height + addressList.size.height / 2.0))
+ .position(CGPoint(x: context.availableSize.width / 2.0, y: addressList.size.height / 2.0))
.clipsToBounds(true)
.appear(.default(alpha: true))
.disappear(.default(alpha: true))
@@ -456,6 +448,10 @@ private final class BrowserScreenComponent: CombinedComponent {
}
}
+ context.add(navigationBar
+ .position(CGPoint(x: context.availableSize.width / 2.0, y: navigationBar.size.height / 2.0))
+ )
+
return context.availableSize
}
}
@@ -1075,7 +1071,7 @@ public class BrowserScreen: ViewController, MinimizableController {
}
func openSettings() {
- guard let referenceView = self.componentHost.findTaggedView(tag: settingsTag) as? ReferenceButtonComponent.View else {
+ guard let referenceView = self.componentHost.findTaggedView(tag: settingsTag) else {
return
}
@@ -1083,10 +1079,6 @@ public class BrowserScreen: ViewController, MinimizableController {
return
}
- if let animationComponentView = referenceView.componentView.view as? LottieComponent.View {
- animationComponentView.playOnce()
- }
-
if let webContent = content as? BrowserWebContent {
webContent.requestInstantView()
}
@@ -1103,7 +1095,7 @@ public class BrowserScreen: ViewController, MinimizableController {
}
}
- let source: ContextContentSource = .reference(BrowserReferenceContentSource(controller: controller, sourceView: referenceView.referenceNode.view))
+ let source: ContextContentSource = .reference(BrowserReferenceContentSource(controller: controller, sourceView: referenceView))
let items: Signal = combineLatest(
queue: Queue.mainQueue(),
@@ -1549,6 +1541,8 @@ public class BrowserScreen: ViewController, MinimizableController {
super.init(navigationBarPresentationData: nil)
+ self._hasGlassStyle = true
+
self.navigationPresentation = .modalInCompactLayout
self.supportedOrientations = ViewControllerSupportedOrientations(regularSize: .all, compactSize: .allButUpsideDown)
@@ -1731,7 +1725,7 @@ private final class BrowserContentComponent: Component {
self.addSubview(component.content)
}
- let collapsedHeight: CGFloat = 24.0
+ let collapsedHeight: CGFloat = 54.0
let topInset: CGFloat = component.navigationBarHeight * (1.0 - component.scrollingPanelOffsetFraction) + (component.insets.top + collapsedHeight) * component.scrollingPanelOffsetFraction
let bottomInset = component.hasBottomPanel ? (49.0 + component.insets.bottom) * (1.0 - component.scrollingPanelOffsetFraction) : 0.0
let insets = UIEdgeInsets(top: topInset, left: component.insets.left, bottom: bottomInset, right: component.insets.right)
diff --git a/submodules/BrowserUI/Sources/BrowserSearchBarComponent.swift b/submodules/BrowserUI/Sources/BrowserSearchBarComponent.swift
index 9678ab3b..104ecaaa 100644
--- a/submodules/BrowserUI/Sources/BrowserSearchBarComponent.swift
+++ b/submodules/BrowserUI/Sources/BrowserSearchBarComponent.swift
@@ -7,6 +7,7 @@ import ComponentFlow
import TelegramPresentationData
import AccountContext
import BundleIconComponent
+import SearchInputPanelComponent
final class SearchBarContentComponent: Component {
public typealias EnvironmentType = BrowserNavigationBarEnvironment
@@ -35,112 +36,16 @@ final class SearchBarContentComponent: Component {
return true
}
- final class View: UIView, UITextFieldDelegate {
- private final class SearchTextField: UITextField {
- override func textRect(forBounds bounds: CGRect) -> CGRect {
- return bounds.integral
- }
- }
-
- private struct Params: Equatable {
- var theme: PresentationTheme
- var strings: PresentationStrings
- var size: CGSize
-
- static func ==(lhs: Params, rhs: Params) -> Bool {
- if lhs.theme !== rhs.theme {
- return false
- }
- if lhs.strings !== rhs.strings {
- return false
- }
- if lhs.size != rhs.size {
- return false
- }
- return true
- }
- }
-
+ final class View: UIView {
private let queryPromise = ValuePromise()
private var queryDisposable: Disposable?
- private let backgroundLayer: SimpleLayer
+ private let searchInput = ComponentView()
- private let iconView: UIImageView
-
- private let clearIconView: UIImageView
- private let clearIconButton: HighlightTrackingButton
-
- private let cancelButtonTitle: ComponentView
- private let cancelButton: HighlightTrackingButton
-
- private var placeholderContent = ComponentView()
-
- private var textFrame: CGRect?
- private var textField: SearchTextField?
-
- private var tapRecognizer: UITapGestureRecognizer?
-
- private var params: Params?
private var component: SearchBarContentComponent?
- init() {
- self.backgroundLayer = SimpleLayer()
-
- self.iconView = UIImageView()
-
- self.clearIconView = UIImageView()
- self.clearIconButton = HighlightableButton()
- self.clearIconView.isHidden = true
- self.clearIconButton.isHidden = true
-
- self.cancelButtonTitle = ComponentView()
- self.cancelButton = HighlightTrackingButton()
-
- super.init(frame: CGRect())
-
- self.layer.addSublayer(self.backgroundLayer)
-
- self.addSubview(self.iconView)
- self.addSubview(self.clearIconView)
- self.addSubview(self.clearIconButton)
-
- self.addSubview(self.cancelButton)
- self.clipsToBounds = true
-
- let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(self.tapGesture(_:)))
- self.tapRecognizer = tapRecognizer
- self.addGestureRecognizer(tapRecognizer)
-
- self.cancelButton.highligthedChanged = { [weak self] highlighted in
- if let strongSelf = self {
- if highlighted {
- if let cancelButtonTitleView = strongSelf.cancelButtonTitle.view {
- cancelButtonTitleView.layer.removeAnimation(forKey: "opacity")
- cancelButtonTitleView.alpha = 0.4
- }
- } else {
- if let cancelButtonTitleView = strongSelf.cancelButtonTitle.view {
- cancelButtonTitleView.alpha = 1.0
- cancelButtonTitleView.layer.animateAlpha(from: 0.4, to: 1.0, duration: 0.2)
- }
- }
- }
- }
- self.cancelButton.addTarget(self, action: #selector(self.cancelPressed), for: .touchUpInside)
-
- self.clearIconButton.highligthedChanged = { [weak self] highlighted in
- if let strongSelf = self {
- if highlighted {
- strongSelf.clearIconView.layer.removeAnimation(forKey: "opacity")
- strongSelf.clearIconView.alpha = 0.4
- } else {
- strongSelf.clearIconView.alpha = 1.0
- strongSelf.clearIconView.layer.animateAlpha(from: 0.4, to: 1.0, duration: 0.2)
- }
- }
- }
- self.clearIconButton.addTarget(self, action: #selector(self.clearPressed), for: .touchUpInside)
+ override init(frame: CGRect) {
+ super.init(frame: frame)
let throttledSearchQuery = self.queryPromise.get()
|> mapToSignal { query -> Signal in
@@ -164,194 +69,46 @@ final class SearchBarContentComponent: Component {
fatalError("init(coder:) has not been implemented")
}
- @objc private func tapGesture(_ recognizer: UITapGestureRecognizer) {
- if case .ended = recognizer.state {
- self.activateTextInput()
- }
- }
-
- private func activateTextInput() {
- if self.textField == nil, let textFrame = self.textFrame {
- let backgroundFrame = self.backgroundLayer.frame
- let textFieldFrame = CGRect(origin: CGPoint(x: textFrame.minX, y: backgroundFrame.minY), size: CGSize(width: backgroundFrame.maxX - textFrame.minX - 32.0, height: backgroundFrame.height))
-
- let textField = SearchTextField(frame: textFieldFrame)
- textField.clipsToBounds = true
- textField.autocorrectionType = .no
- textField.returnKeyType = .search
- self.textField = textField
- self.insertSubview(textField, belowSubview: self.clearIconView)
- textField.delegate = self
- textField.addTarget(self, action: #selector(self.textFieldChanged(_:)), for: .editingChanged)
- }
-
- guard !(self.textField?.isFirstResponder ?? false) else {
- return
- }
-
- self.textField?.becomeFirstResponder()
- }
-
- @objc private func cancelPressed() {
- self.clearIconView.isHidden = true
- self.clearIconButton.isHidden = true
-
- let textField = self.textField
- self.textField = nil
-
- self.component?.performAction.invoke(.updateSearchActive(false))
-
- if let textField {
- textField.resignFirstResponder()
- textField.removeFromSuperview()
- }
- }
-
- @objc private func clearPressed() {
- guard let textField = self.textField else {
- return
- }
- textField.text = ""
- self.textFieldChanged(textField)
- }
-
- func deactivate() {
- if let text = self.textField?.text, !text.isEmpty {
- self.textField?.endEditing(true)
- } else {
- self.cancelPressed()
- }
- }
-
- public func textFieldDidBeginEditing(_ textField: UITextField) {
- }
-
- public func textFieldDidEndEditing(_ textField: UITextField) {
- }
-
- public func textFieldShouldReturn(_ textField: UITextField) -> Bool {
- textField.endEditing(true)
- return false
- }
-
- @objc private func textFieldChanged(_ textField: UITextField) {
- let text = textField.text ?? ""
-
- self.clearIconView.isHidden = text.isEmpty
- self.clearIconButton.isHidden = text.isEmpty
- self.placeholderContent.view?.isHidden = !text.isEmpty
-
- self.queryPromise.set(text)
-
- if let params = self.params {
- self.update(theme: params.theme, strings: params.strings, size: params.size, transition: .immediate)
- }
- }
-
func update(component: SearchBarContentComponent, availableSize: CGSize, transition: ComponentTransition) -> CGSize {
self.component = component
- self.update(theme: component.theme, strings: component.strings, size: availableSize, transition: transition)
- self.activateTextInput()
-
- return availableSize
- }
-
- public func update(theme: PresentationTheme, strings: PresentationStrings, size: CGSize, transition: ComponentTransition) {
- let params = Params(
- theme: theme,
- strings: strings,
- size: size
- )
-
- if self.params == params {
- return
- }
-
- let isActiveWithText = true
-
- if self.params?.theme !== theme {
- self.iconView.image = generateTintedImage(image: UIImage(bundleImageName: "Components/Search Bar/Loupe"), color: .white)?.withRenderingMode(.alwaysTemplate)
- self.iconView.tintColor = theme.rootController.navigationSearchBar.inputIconColor
- self.clearIconView.image = generateTintedImage(image: UIImage(bundleImageName: "Components/Search Bar/Clear"), color: .white)?.withRenderingMode(.alwaysTemplate)
- self.clearIconView.tintColor = theme.rootController.navigationSearchBar.inputClearButtonColor
- }
-
- self.params = params
-
- let sideInset: CGFloat = 10.0
- let inputHeight: CGFloat = 36.0
- let topInset: CGFloat = (size.height - inputHeight) / 2.0
-
- let sideTextInset: CGFloat = sideInset + 4.0 + 17.0
-
- self.backgroundLayer.backgroundColor = theme.rootController.navigationSearchBar.inputFillColor.cgColor
- self.backgroundLayer.cornerRadius = 10.5
-
- let cancelTextSize = self.cancelButtonTitle.update(
- transition: .immediate,
- component: AnyComponent(Text(
- text: strings.Common_Cancel,
- font: Font.regular(17.0),
- color: theme.rootController.navigationBar.accentTextColor
- )),
- environment: {},
- containerSize: CGSize(width: size.width - 32.0, height: 100.0)
- )
-
- let cancelButtonSpacing: CGFloat = 8.0
-
- var backgroundFrame = CGRect(origin: CGPoint(x: sideInset, y: topInset), size: CGSize(width: size.width - sideInset * 2.0, height: inputHeight))
- if isActiveWithText {
- backgroundFrame.size.width -= cancelTextSize.width + cancelButtonSpacing
- }
- transition.setFrame(layer: self.backgroundLayer, frame: backgroundFrame)
-
- transition.setFrame(view: self.cancelButton, frame: CGRect(origin: CGPoint(x: backgroundFrame.maxX, y: 0.0), size: CGSize(width: cancelButtonSpacing + cancelTextSize.width, height: size.height)))
-
- let textX: CGFloat = backgroundFrame.minX + sideTextInset
- let textFrame = CGRect(origin: CGPoint(x: textX, y: backgroundFrame.minY), size: CGSize(width: backgroundFrame.maxX - textX, height: backgroundFrame.height))
- self.textFrame = textFrame
-
- if let image = self.iconView.image {
- let iconFrame = CGRect(origin: CGPoint(x: backgroundFrame.minX + 5.0, y: backgroundFrame.minY + floor((backgroundFrame.height - image.size.height) / 2.0)), size: image.size)
- transition.setFrame(view: self.iconView, frame: iconFrame)
- }
-
- let placeholderSize = self.placeholderContent.update(
+ let searchInputSize = self.searchInput.update(
transition: transition,
component: AnyComponent(
- Text(text: strings.Common_Search, font: Font.regular(17.0), color: theme.rootController.navigationSearchBar.inputPlaceholderTextColor)
+ SearchInputPanelComponent(
+ theme: component.theme,
+ strings: component.strings,
+ metrics: .init(widthClass: .compact, heightClass: .compact, orientation: nil),
+ safeInsets: UIEdgeInsets(),
+ placeholder: component.strings.Common_Search,
+ hasEdgeEffect: false,
+ updated: { [weak self] query in
+ guard let self else {
+ return
+ }
+ self.queryPromise.set(query)
+ },
+ cancel: { [weak self] in
+ guard let self else {
+ return
+ }
+ self.component?.performAction.invoke(.updateSearchActive(false))
+ }
+ )
),
environment: {},
- containerSize: size
+ containerSize: availableSize
)
- if let placeholderContentView = self.placeholderContent.view {
- if placeholderContentView.superview == nil {
- self.addSubview(placeholderContentView)
+ if let searchInputView = self.searchInput.view as? SearchInputPanelComponent.View {
+ if searchInputView.superview == nil {
+ self.addSubview(searchInputView)
+
+ searchInputView.activateInput()
}
- let placeholderContentFrame = CGRect(origin: CGPoint(x: textFrame.minX, y: backgroundFrame.midY - placeholderSize.height / 2.0), size: placeholderSize)
- transition.setFrame(view: placeholderContentView, frame: placeholderContentFrame)
- }
-
- if let image = self.clearIconView.image {
- let iconFrame = CGRect(origin: CGPoint(x: backgroundFrame.maxX - image.size.width - 4.0, y: backgroundFrame.minY + floor((backgroundFrame.height - image.size.height) / 2.0)), size: image.size)
- transition.setFrame(view: self.clearIconView, frame: iconFrame)
- transition.setFrame(view: self.clearIconButton, frame: iconFrame.insetBy(dx: -8.0, dy: -10.0))
- }
-
- if let cancelButtonTitleComponentView = self.cancelButtonTitle.view {
- if cancelButtonTitleComponentView.superview == nil {
- self.addSubview(cancelButtonTitleComponentView)
- cancelButtonTitleComponentView.isUserInteractionEnabled = false
- }
- transition.setFrame(view: cancelButtonTitleComponentView, frame: CGRect(origin: CGPoint(x: backgroundFrame.maxX + cancelButtonSpacing, y: floor((size.height - cancelTextSize.height) / 2.0)), size: cancelTextSize))
- }
-
- if let textField = self.textField {
- textField.textColor = theme.rootController.navigationSearchBar.inputTextColor
- transition.setFrame(view: textField, frame: CGRect(origin: CGPoint(x: backgroundFrame.minX + sideTextInset, y: backgroundFrame.minY - UIScreenPixel), size: CGSize(width: backgroundFrame.width - sideTextInset - 32.0, height: backgroundFrame.height)))
+ transition.setFrame(view: searchInputView, frame: CGRect(origin: .zero, size: searchInputSize))
}
+
+ return availableSize
}
}
diff --git a/submodules/BrowserUI/Sources/BrowserTitleBarComponent.swift b/submodules/BrowserUI/Sources/BrowserTitleBarComponent.swift
index a362da7d..d21be0fa 100644
--- a/submodules/BrowserUI/Sources/BrowserTitleBarComponent.swift
+++ b/submodules/BrowserUI/Sources/BrowserTitleBarComponent.swift
@@ -9,19 +9,26 @@ import AccountContext
import BundleIconComponent
import MultilineTextComponent
import UrlEscaping
+import GlassBackgroundComponent
final class TitleBarContentComponent: Component {
public typealias EnvironmentType = BrowserNavigationBarEnvironment
let theme: PresentationTheme
let title: String
+ let readingProgress: CGFloat
+ let loadingProgress: Double?
init(
theme: PresentationTheme,
- title: String
+ title: String,
+ readingProgress: CGFloat,
+ loadingProgress: Double?
) {
self.theme = theme
self.title = title
+ self.readingProgress = readingProgress
+ self.loadingProgress = loadingProgress
}
static func ==(lhs: TitleBarContentComponent, rhs: TitleBarContentComponent) -> Bool {
@@ -31,15 +38,30 @@ final class TitleBarContentComponent: Component {
if lhs.title != rhs.title {
return false
}
+ if lhs.readingProgress != rhs.readingProgress {
+ return false
+ }
+ if lhs.loadingProgress != rhs.loadingProgress {
+ return false
+ }
return true
}
final class View: UIView {
+ private let backgroundView = GlassBackgroundView()
+ private let clippingView = UIView()
+ private let readingProgressView = UIView()
private var titleContent = ComponentView()
private var component: TitleBarContentComponent?
init() {
super.init(frame: CGRect())
+
+ self.clippingView.clipsToBounds = true
+
+ self.addSubview(self.backgroundView)
+ self.backgroundView.contentView.addSubview(self.clippingView)
+ self.clippingView.addSubview(self.readingProgressView)
}
required public init?(coder: NSCoder) {
@@ -48,7 +70,9 @@ final class TitleBarContentComponent: Component {
func update(component: TitleBarContentComponent, availableSize: CGSize, environment: Environment, transition: ComponentTransition) -> CGSize {
self.component = component
-
+
+ let collapseFraction = environment[BrowserNavigationBarEnvironment.self].fraction
+
let titleSize = self.titleContent.update(
transition: transition,
component: AnyComponent(
@@ -60,7 +84,7 @@ final class TitleBarContentComponent: Component {
)
),
environment: {},
- containerSize: CGSize(width: availableSize.width - 36.0, height: availableSize.height)
+ containerSize: CGSize(width: availableSize.width - 42.0, height: availableSize.height)
)
let titleContentFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((availableSize.width - titleSize.width) / 2.0), y: floorToScreenPixels((availableSize.height - titleSize.height) / 2.0)), size: titleSize)
if let titleContentView = self.titleContent.view {
@@ -71,6 +95,18 @@ final class TitleBarContentComponent: Component {
titleContentView.bounds = CGRect(origin: .zero, size: titleContentFrame.size)
}
+ let expandedBackgroundWidth = availableSize.width - 14.0 * 2.0
+ let collapsedBackgroundWidth = titleSize.width + 32.0
+ let backgroundSize = CGSize(width: expandedBackgroundWidth * (1.0 - collapseFraction) + collapsedBackgroundWidth * collapseFraction, height: 44.0)
+ self.backgroundView.update(size: backgroundSize, cornerRadius: backgroundSize.height * 0.5, isDark: component.theme.overallDarkAppearance, tintColor: .init(kind: .panel, color: UIColor(white: component.theme.overallDarkAppearance ? 0.0 : 1.0, alpha: 0.6)), transition: transition)
+ let backgroundFrame = CGRect(origin: CGPoint(x: floor((availableSize.width - backgroundSize.width) / 2.0), y: floor((availableSize.height - backgroundSize.height) / 2.0)), size: backgroundSize)
+ transition.setFrame(view: self.backgroundView, frame: backgroundFrame)
+ transition.setFrame(view: self.clippingView, frame: CGRect(origin: .zero, size: backgroundFrame.size))
+ transition.setCornerRadius(layer: self.clippingView.layer, cornerRadius: backgroundFrame.size.height * 0.5)
+
+ self.readingProgressView.backgroundColor = component.theme.rootController.navigationBar.primaryTextColor.withMultipliedAlpha(0.07)
+ self.readingProgressView.frame = CGRect(origin: .zero, size: CGSize(width: backgroundSize.width * component.readingProgress, height: backgroundSize.height))
+
return availableSize
}
}
diff --git a/submodules/BrowserUI/Sources/BrowserToolbarComponent.swift b/submodules/BrowserUI/Sources/BrowserToolbarComponent.swift
index 10834cdf..8f695ffc 100644
--- a/submodules/BrowserUI/Sources/BrowserToolbarComponent.swift
+++ b/submodules/BrowserUI/Sources/BrowserToolbarComponent.swift
@@ -6,28 +6,24 @@ import BlurredBackgroundComponent
import BundleIconComponent
import TelegramPresentationData
import ContextReferenceButtonComponent
+import GlassBackgroundComponent
+import EdgeEffect
final class BrowserToolbarComponent: CombinedComponent {
- let backgroundColor: UIColor
- let separatorColor: UIColor
- let textColor: UIColor
+ let theme: PresentationTheme
let bottomInset: CGFloat
let sideInset: CGFloat
let item: AnyComponentWithIdentity?
let collapseFraction: CGFloat
init(
- backgroundColor: UIColor,
- separatorColor: UIColor,
- textColor: UIColor,
+ theme: PresentationTheme,
bottomInset: CGFloat,
sideInset: CGFloat,
item: AnyComponentWithIdentity?,
collapseFraction: CGFloat
) {
- self.backgroundColor = backgroundColor
- self.separatorColor = separatorColor
- self.textColor = textColor
+ self.theme = theme
self.bottomInset = bottomInset
self.sideInset = sideInset
self.item = item
@@ -35,13 +31,7 @@ final class BrowserToolbarComponent: CombinedComponent {
}
static func ==(lhs: BrowserToolbarComponent, rhs: BrowserToolbarComponent) -> Bool {
- if lhs.backgroundColor != rhs.backgroundColor {
- return false
- }
- if lhs.separatorColor != rhs.separatorColor {
- return false
- }
- if lhs.textColor != rhs.textColor {
+ if lhs.theme !== rhs.theme {
return false
}
if lhs.bottomInset != rhs.bottomInset {
@@ -60,54 +50,70 @@ final class BrowserToolbarComponent: CombinedComponent {
}
static var body: Body {
- let background = Child(BlurredBackgroundComponent.self)
- let separator = Child(Rectangle.self)
+ let edgeEffect = Child(EdgeEffectComponent.self)
+ let background = Child(GlassBackgroundComponent.self)
let centerItems = ChildMap(environment: Empty.self, keyedBy: AnyHashable.self)
return { context in
- let contentHeight: CGFloat = 49.0
+ let contentHeight: CGFloat = 56.0
let totalHeight = contentHeight + context.component.bottomInset
let offset = context.component.collapseFraction * totalHeight
let size = CGSize(width: context.availableSize.width, height: totalHeight)
- let background = background.update(
- component: BlurredBackgroundComponent(color: context.component.backgroundColor),
- availableSize: CGSize(width: size.width, height: size.height),
+ let backgroundHeight: CGFloat = 48.0
+ let edgeEffectHeight = totalHeight
+ let edgeEffect = edgeEffect.update(
+ component: EdgeEffectComponent(
+ color: .clear,
+ blur: true,
+ alpha: 1.0,
+ size: CGSize(width: size.width, height: edgeEffectHeight),
+ edge: .bottom,
+ edgeSize: edgeEffectHeight
+ ),
+ availableSize: CGSize(width: size.width, height: edgeEffectHeight),
transition: context.transition
)
-
- let separator = separator.update(
- component: Rectangle(color: context.component.separatorColor, height: UIScreenPixel),
- availableSize: CGSize(width: size.width, height: size.height),
- transition: context.transition
+ context.add(edgeEffect
+ .position(CGPoint(x: size.width / 2.0, y: size.height / 2.0 + offset))
)
-
+
let item = context.component.item.flatMap { item in
return centerItems[item.id].update(
component: item.component,
- availableSize: CGSize(width: context.availableSize.width - context.component.sideInset * 2.0, height: contentHeight),
+ availableSize: CGSize(width: context.availableSize.width - context.component.sideInset * 2.0, height: backgroundHeight),
transition: context.transition
)
}
+ let contentWidth = item?.size.width ?? 0.0
+
+ let backgroundSize = CGSize(width: contentWidth, height: backgroundHeight)
+ let background = background.update(
+ component: GlassBackgroundComponent(
+ size: backgroundSize,
+ cornerRadius: backgroundHeight * 0.5,
+ isDark: context.component.theme.overallDarkAppearance,
+ tintColor: .init(kind: .panel, color: UIColor(white: context.component.theme.overallDarkAppearance ? 0.0 : 1.0, alpha: 0.6)),
+ isInteractive: true
+ ),
+ availableSize: backgroundSize,
+ transition: context.transition
+ )
context.add(background
- .position(CGPoint(x: size.width / 2.0, y: size.height / 2.0 + offset))
+ .position(CGPoint(x: size.width / 2.0, y: backgroundSize.height / 2.0 + offset))
)
- context.add(separator
- .position(CGPoint(x: size.width / 2.0, y: 0.0 + offset))
- )
-
if let centerItem = item {
context.add(centerItem
- .position(CGPoint(x: context.availableSize.width / 2.0, y: contentHeight / 2.0 + offset))
+ .position(CGPoint(x: context.availableSize.width / 2.0, y: backgroundSize.height / 2.0 + offset))
.appear(ComponentTransition.Appear({ _, view, transition in
- transition.animatePosition(view: view, from: CGPoint(x: 0.0, y: size.height), to: .zero, additive: true)
+ transition.animateBlur(layer: view.layer, fromRadius: 10.0, toRadius: 0.0)
+ transition.animateAlpha(view: view, from: 0.0, to: 1.0)
}))
.disappear(ComponentTransition.Disappear({ view, transition, completion in
- let from = view.center
- view.center = from.offsetBy(dx: 0.0, dy: size.height)
- transition.animatePosition(view: view, from: from, to: view.center, completion: { _ in
+ transition.animateBlur(layer: view.layer, fromRadius: 0.0, toRadius: 10.0)
+ transition.setAlpha(view: view, alpha: 0.0, completion: { _ in
completion()
})
}))
@@ -120,8 +126,7 @@ final class BrowserToolbarComponent: CombinedComponent {
}
final class NavigationToolbarContentComponent: CombinedComponent {
- let accentColor: UIColor
- let textColor: UIColor
+ let theme: PresentationTheme
let canGoBack: Bool
let canGoForward: Bool
let canOpenIn: Bool
@@ -131,8 +136,7 @@ final class NavigationToolbarContentComponent: CombinedComponent {
let performHoldAction: (UIView, ContextGesture?, BrowserScreen.Action) -> Void
init(
- accentColor: UIColor,
- textColor: UIColor,
+ theme: PresentationTheme,
canGoBack: Bool,
canGoForward: Bool,
canOpenIn: Bool,
@@ -141,8 +145,7 @@ final class NavigationToolbarContentComponent: CombinedComponent {
performAction: ActionSlot,
performHoldAction: @escaping (UIView, ContextGesture?, BrowserScreen.Action) -> Void
) {
- self.accentColor = accentColor
- self.textColor = textColor
+ self.theme = theme
self.canGoBack = canGoBack
self.canGoForward = canGoForward
self.canOpenIn = canOpenIn
@@ -153,10 +156,7 @@ final class NavigationToolbarContentComponent: CombinedComponent {
}
static func ==(lhs: NavigationToolbarContentComponent, rhs: NavigationToolbarContentComponent) -> Bool {
- if lhs.accentColor != rhs.accentColor {
- return false
- }
- if lhs.textColor != rhs.textColor {
+ if lhs.theme !== rhs.theme {
return false
}
if lhs.canGoBack != rhs.canGoBack {
@@ -191,26 +191,20 @@ final class NavigationToolbarContentComponent: CombinedComponent {
let performAction = context.component.performAction
let performHoldAction = context.component.performHoldAction
- let sideInset: CGFloat = 5.0
- let buttonSize = CGSize(width: 50.0, height: availableSize.height)
+ var size = CGSize(width: 0.0, height: 48.0)
+ let buttonSize = CGSize(width: 50.0, height: size.height)
- var buttonCount = 3
- if context.component.canShare {
- buttonCount += 1
- }
- if context.component.canOpenIn {
- buttonCount += 1
- }
-
- let spacing = (availableSize.width - buttonSize.width * CGFloat(buttonCount) - sideInset * 2.0) / CGFloat(buttonCount - 1)
+ let sideInset: CGFloat = 34.0
+ let spacing: CGFloat = 66.0
+ let textColor = context.component.theme.rootController.navigationBar.primaryTextColor
let canShare = context.component.canShare
let share = share.update(
component: Button(
content: AnyComponent(
BundleIconComponent(
- name: "Chat List/NavigationShare",
- tintColor: context.component.accentColor
+ name: "Instant View/Share",
+ tintColor: textColor
)
),
action: {
@@ -224,22 +218,14 @@ final class NavigationToolbarContentComponent: CombinedComponent {
)
if context.component.isDocument {
- if !context.component.canShare {
- context.add(share
- .position(CGPoint(x: availableSize.width / 2.0, y: 10000.0))
- )
- } else {
- context.add(share
- .position(CGPoint(x: availableSize.width / 2.0, y: availableSize.height / 2.0))
- )
- }
-
+ var originX: CGFloat = sideInset
+
let search = search.update(
component: Button(
content: AnyComponent(
BundleIconComponent(
- name: "Chat List/SearchIcon",
- tintColor: context.component.accentColor
+ name: "Instant View/Search",
+ tintColor: textColor
)
),
action: {
@@ -250,15 +236,27 @@ final class NavigationToolbarContentComponent: CombinedComponent {
transition: .easeInOut(duration: 0.2)
)
context.add(search
- .position(CGPoint(x: sideInset + search.size.width / 2.0, y: availableSize.height / 2.0))
+ .position(CGPoint(x: originX, y: availableSize.height / 2.0))
)
+ originX += spacing
+
+ if !context.component.canShare {
+ context.add(share
+ .position(CGPoint(x: availableSize.width / 2.0, y: 10000.0))
+ )
+ } else {
+ context.add(share
+ .position(CGPoint(x: originX, y: availableSize.height / 2.0))
+ )
+ originX += spacing
+ }
let quickLook = quickLook.update(
component: Button(
content: AnyComponent(
BundleIconComponent(
name: "Instant View/OpenDocument",
- tintColor: context.component.accentColor
+ tintColor: textColor
)
),
action: {
@@ -269,16 +267,19 @@ final class NavigationToolbarContentComponent: CombinedComponent {
transition: .easeInOut(duration: 0.2)
)
context.add(quickLook
- .position(CGPoint(x: context.availableSize.width - sideInset - quickLook.size.width / 2.0, y: availableSize.height / 2.0))
+ .position(CGPoint(x: originX, y: availableSize.height / 2.0))
)
+ size.width = originX + sideInset
} else {
+ var originX: CGFloat = sideInset
+
let canGoBack = context.component.canGoBack
let back = back.update(
component: ContextReferenceButtonComponent(
content: AnyComponent(
BundleIconComponent(
name: "Instant View/Back",
- tintColor: canGoBack ? context.component.accentColor : context.component.accentColor.withAlphaComponent(0.4)
+ tintColor: canGoBack ? textColor : textColor.withAlphaComponent(0.4)
)
),
minSize: buttonSize,
@@ -297,8 +298,9 @@ final class NavigationToolbarContentComponent: CombinedComponent {
transition: .easeInOut(duration: 0.2)
)
context.add(back
- .position(CGPoint(x: sideInset + back.size.width / 2.0, y: availableSize.height / 2.0))
+ .position(CGPoint(x: sideInset, y: availableSize.height / 2.0))
)
+ originX += spacing
let canGoForward = context.component.canGoForward
let forward = forward.update(
@@ -306,7 +308,7 @@ final class NavigationToolbarContentComponent: CombinedComponent {
content: AnyComponent(
BundleIconComponent(
name: "Instant View/Forward",
- tintColor: canGoForward ? context.component.accentColor : context.component.accentColor.withAlphaComponent(0.4)
+ tintColor: canGoForward ? textColor : textColor.withAlphaComponent(0.4)
)
),
minSize: buttonSize,
@@ -325,19 +327,21 @@ final class NavigationToolbarContentComponent: CombinedComponent {
transition: .easeInOut(duration: 0.2)
)
context.add(forward
- .position(CGPoint(x: sideInset + back.size.width + spacing + forward.size.width / 2.0, y: availableSize.height / 2.0))
+ .position(CGPoint(x: originX, y: availableSize.height / 2.0))
)
+ originX += spacing
context.add(share
- .position(CGPoint(x: sideInset + back.size.width + spacing + forward.size.width + spacing + share.size.width / 2.0, y: availableSize.height / 2.0))
+ .position(CGPoint(x: originX, y: availableSize.height / 2.0))
)
+ originX += spacing
let bookmark = bookmark.update(
component: Button(
content: AnyComponent(
BundleIconComponent(
name: "Instant View/Bookmark",
- tintColor: context.component.accentColor
+ tintColor: textColor
)
),
action: {
@@ -348,16 +352,18 @@ final class NavigationToolbarContentComponent: CombinedComponent {
transition: .easeInOut(duration: 0.2)
)
context.add(bookmark
- .position(CGPoint(x: sideInset + back.size.width + spacing + forward.size.width + spacing + share.size.width + spacing + bookmark.size.width / 2.0, y: availableSize.height / 2.0))
+ .position(CGPoint(x: originX, y: availableSize.height / 2.0))
)
if context.component.canOpenIn {
+ originX += spacing
+
let openIn = openIn.update(
component: Button(
content: AnyComponent(
BundleIconComponent(
name: "Instant View/Browser",
- tintColor: context.component.accentColor
+ tintColor: textColor
)
),
action: {
@@ -368,34 +374,36 @@ final class NavigationToolbarContentComponent: CombinedComponent {
transition: .easeInOut(duration: 0.2)
)
context.add(openIn
- .position(CGPoint(x: sideInset + back.size.width + spacing + forward.size.width + spacing + share.size.width + spacing + bookmark.size.width + spacing + openIn.size.width / 2.0, y: availableSize.height / 2.0))
+ .position(CGPoint(x: originX, y: availableSize.height / 2.0))
)
}
+
+ size.width = originX + sideInset
}
- return availableSize
+ return size
}
}
}
final class SearchToolbarContentComponent: CombinedComponent {
+ let theme: PresentationTheme
let strings: PresentationStrings
- let textColor: UIColor
let index: Int
let count: Int
let isEmpty: Bool
let performAction: ActionSlot
init(
+ theme: PresentationTheme,
strings: PresentationStrings,
- textColor: UIColor,
index: Int,
count: Int,
isEmpty: Bool,
performAction: ActionSlot
) {
+ self.theme = theme
self.strings = strings
- self.textColor = textColor
self.index = index
self.count = count
self.isEmpty = isEmpty
@@ -403,10 +411,10 @@ final class SearchToolbarContentComponent: CombinedComponent {
}
static func ==(lhs: SearchToolbarContentComponent, rhs: SearchToolbarContentComponent) -> Bool {
- if lhs.strings !== rhs.strings {
+ if lhs.theme !== rhs.theme {
return false
}
- if lhs.textColor != rhs.textColor {
+ if lhs.strings !== rhs.strings {
return false
}
if lhs.index != rhs.index {
@@ -430,15 +438,17 @@ final class SearchToolbarContentComponent: CombinedComponent {
let availableSize = context.availableSize
let performAction = context.component.performAction
- let sideInset: CGFloat = 3.0
+ let sideInset: CGFloat = 60.0
let buttonSize = CGSize(width: 50.0, height: availableSize.height)
+ let textColor = context.component.theme.rootController.navigationBar.primaryTextColor
+
let down = down.update(
component: Button(
content: AnyComponent(
BundleIconComponent(
name: "Chat/Input/Search/DownButton",
- tintColor: context.component.textColor
+ tintColor: textColor
)
),
isEnabled: context.component.count > 0,
@@ -458,7 +468,7 @@ final class SearchToolbarContentComponent: CombinedComponent {
content: AnyComponent(
BundleIconComponent(
name: "Chat/Input/Search/UpButton",
- tintColor: context.component.textColor
+ tintColor: textColor
)
),
isEnabled: context.component.count > 0,
@@ -486,7 +496,7 @@ final class SearchToolbarContentComponent: CombinedComponent {
component: Text(
text: currentText,
font: Font.regular(15.0),
- color: context.component.textColor
+ color: textColor
),
availableSize: availableSize,
transition: .easeInOut(duration: 0.2)
@@ -495,7 +505,7 @@ final class SearchToolbarContentComponent: CombinedComponent {
.position(CGPoint(x: availableSize.width - sideInset - down.size.width - up.size.width - text.size.width / 2.0, y: availableSize.height / 2.0))
)
- return availableSize
+ return CGSize(width: availableSize.width - 60.0, height: 48.0)
}
}
}
diff --git a/submodules/BrowserUI/Sources/BrowserWebContent.swift b/submodules/BrowserUI/Sources/BrowserWebContent.swift
index 20a3dbc5..21107048 100644
--- a/submodules/BrowserUI/Sources/BrowserWebContent.swift
+++ b/submodules/BrowserUI/Sources/BrowserWebContent.swift
@@ -23,6 +23,7 @@ import SaveProgressScreen
import DeviceModel
import LegacyMediaPickerUI
import PassKit
+import AlertComponent
private final class TonSchemeHandler: NSObject, WKURLSchemeHandler {
private final class PendingTask {
@@ -1258,12 +1259,20 @@ final class BrowserWebContent: UIView, BrowserContent, WKNavigationDelegate, WKU
func webView(_ webView: WKWebView, runJavaScriptAlertPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping () -> Void) {
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
var completed = false
- let alertController = textAlertController(context: self.context, updatedPresentationData: nil, title: nil, text: message, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {
- if !completed {
- completed = true
- completionHandler()
- }
- })])
+
+ let alertController = AlertScreen(
+ context: self.context,
+ title: nil,
+ text: message,
+ actions: [
+ .init(title: presentationData.strings.Common_OK, type: .default, action: {
+ if !completed {
+ completed = true
+ completionHandler()
+ }
+ })
+ ]
+ )
alertController.dismissed = { byOutsideTap in
if byOutsideTap {
if !completed {
@@ -1278,17 +1287,26 @@ final class BrowserWebContent: UIView, BrowserContent, WKNavigationDelegate, WKU
func webView(_ webView: WKWebView, runJavaScriptConfirmPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping (Bool) -> Void) {
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
var completed = false
- let alertController = textAlertController(context: self.context, updatedPresentationData: nil, title: nil, text: message, actions: [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {
- if !completed {
- completed = true
- completionHandler(false)
- }
- }), TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {
- if !completed {
- completed = true
- completionHandler(true)
- }
- })])
+
+ let alertController = AlertScreen(
+ context: self.context,
+ title: nil,
+ text: message,
+ actions: [
+ .init(title: presentationData.strings.Common_Cancel, action: {
+ if !completed {
+ completed = true
+ completionHandler(false)
+ }
+ }),
+ .init(title: presentationData.strings.Common_OK, type: .default, action: {
+ if !completed {
+ completed = true
+ completionHandler(true)
+ }
+ })
+ ]
+ )
alertController.dismissed = { byOutsideTap in
if byOutsideTap {
if !completed {
@@ -1302,24 +1320,28 @@ final class BrowserWebContent: UIView, BrowserContent, WKNavigationDelegate, WKU
func webView(_ webView: WKWebView, runJavaScriptTextInputPanelWithPrompt prompt: String, defaultText: String?, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping (String?) -> Void) {
var completed = false
- let promptController = promptController(sharedContext: self.context.sharedContext, updatedPresentationData: nil, text: prompt, value: defaultText, apply: { value in
- if !completed {
- completed = true
- if let value = value {
- completionHandler(value)
- } else {
- completionHandler(nil)
+ let promptController = promptController(
+ context: self.context,
+ updatedPresentationData: nil,
+ text: prompt,
+ value: defaultText,
+ apply: { value in
+ if !completed {
+ completed = true
+ if let value = value {
+ completionHandler(value)
+ } else {
+ completionHandler(nil)
+ }
}
- }
- })
- promptController.dismissed = { byOutsideTap in
- if byOutsideTap {
+ },
+ dismissed: {
if !completed {
completed = true
completionHandler(nil)
}
}
- }
+ )
self.present(promptController, nil)
}
@@ -1356,17 +1378,25 @@ final class BrowserWebContent: UIView, BrowserContent, WKNavigationDelegate, WKU
private func presentDownloadConfirmation(fileName: String, proceed: @escaping (Bool) -> Void) {
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
var completed = false
- let alertController = textAlertController(context: self.context, updatedPresentationData: nil, title: nil, text: presentationData.strings.WebBrowser_Download_Confirmation(fileName).string, actions: [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {
- if !completed {
- completed = true
- proceed(false)
- }
- }), TextAlertAction(type: .defaultAction, title: presentationData.strings.WebBrowser_Download_Download, action: {
- if !completed {
- completed = true
- proceed(true)
- }
- })])
+ let alertController = AlertScreen(
+ context: self.context,
+ title: nil,
+ text: presentationData.strings.WebBrowser_Download_Confirmation(fileName).string,
+ actions: [
+ .init(title: presentationData.strings.Common_Cancel, action: {
+ if !completed {
+ completed = true
+ proceed(false)
+ }
+ }),
+ .init(title: presentationData.strings.WebBrowser_Download_Download, type: .default, action: {
+ if !completed {
+ completed = true
+ proceed(true)
+ }
+ })
+ ]
+ )
alertController.dismissed = { byOutsideTap in
if byOutsideTap {
if !completed {
diff --git a/submodules/CalendarMessageScreen/Sources/CalendarMessageScreen.swift b/submodules/CalendarMessageScreen/Sources/CalendarMessageScreen.swift
index cb97a18d..eb51c84e 100644
--- a/submodules/CalendarMessageScreen/Sources/CalendarMessageScreen.swift
+++ b/submodules/CalendarMessageScreen/Sources/CalendarMessageScreen.swift
@@ -1603,11 +1603,12 @@ public final class CalendarMessageScreen: ViewController {
}
frames[i] = monthFrame
}
+ contentHeight += navigationHeight
self.scrollLayout = (layout.size.width, contentHeight, frames)
- self.contextGestureContainerNode.frame = CGRect(origin: CGPoint(x: 0.0, y: navigationHeight), size: CGSize(width: layout.size.width, height: layout.size.height - navigationHeight))
- self.scrollView.frame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: layout.size.width, height: layout.size.height - navigationHeight))
+ self.contextGestureContainerNode.frame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: layout.size.width, height: layout.size.height))
+ self.scrollView.frame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: layout.size.width, height: layout.size.height))
self.scrollView.contentSize = CGSize(width: layout.size.width, height: contentHeight)
self.scrollView.verticalScrollIndicatorInsets = UIEdgeInsets(top: max(layout.intrinsicInsets.bottom, self.scrollView.contentInset.top), left: 0.0, bottom: 0.0, right: layout.size.width - 3.0 - 6.0)
@@ -1862,8 +1863,9 @@ public final class CalendarMessageScreen: ViewController {
self.presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
- super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData))
+ super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData, style: .glass))
+ self._hasGlassStyle = true
self.navigationPresentation = .modal
self.navigationItem.setLeftBarButton(UIBarButtonItem(title: self.presentationData.strings.Common_Cancel, style: .plain, target: self, action: #selector(dismissPressed)), animated: false)
diff --git a/submodules/CallListUI/BUILD b/submodules/CallListUI/BUILD
index 20d63668..21a966fc 100644
--- a/submodules/CallListUI/BUILD
+++ b/submodules/CallListUI/BUILD
@@ -34,6 +34,9 @@ swift_library(
"//submodules/InviteLinksUI",
"//submodules/UndoUI",
"//submodules/TelegramCallsUI",
+ "//submodules/TelegramUI/Components/EdgeEffect",
+ "//submodules/ComponentFlow",
+ "//submodules/Components/ComponentDisplayAdapters",
],
visibility = [
"//visibility:public",
diff --git a/submodules/CallListUI/Sources/CallListCallItem.swift b/submodules/CallListUI/Sources/CallListCallItem.swift
index 41f076af..507eeb5d 100644
--- a/submodules/CallListUI/Sources/CallListCallItem.swift
+++ b/submodules/CallListUI/Sources/CallListCallItem.swift
@@ -243,7 +243,7 @@ class CallListCallItemNode: ItemListRevealOptionsItemNode {
self.accessibilityArea = AccessibilityAreaNode()
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.addSubnode(self.backgroundNode)
self.addSubnode(self.containerNode)
@@ -769,7 +769,8 @@ class CallListCallItemNode: ItemListRevealOptionsItemNode {
}
transition.updateAlpha(node: strongSelf.infoButtonNode, alpha: item.editing ? 0.0 : 1.0)
- let topHighlightInset: CGFloat = (first || !nodeLayout.insets.top.isZero) ? 0.0 : separatorHeight
+ var topHighlightInset: CGFloat = (first || !nodeLayout.insets.top.isZero) ? 0.0 : separatorHeight
+ topHighlightInset -= nodeLayout.insets.top
strongSelf.backgroundNode.frame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: nodeLayout.contentSize.width, height: nodeLayout.contentSize.height))
strongSelf.containerNode.frame = CGRect(origin: CGPoint(), size: strongSelf.backgroundNode.frame.size)
strongSelf.highlightedBackgroundNode.frame = CGRect(origin: CGPoint(x: 0.0, y: -nodeLayout.insets.top - topHighlightInset), size: CGSize(width: nodeLayout.size.width, height: nodeLayout.size.height + topHighlightInset))
diff --git a/submodules/CallListUI/Sources/CallListController.swift b/submodules/CallListUI/Sources/CallListController.swift
index b8e54aec..17435c66 100644
--- a/submodules/CallListUI/Sources/CallListController.swift
+++ b/submodules/CallListUI/Sources/CallListController.swift
@@ -43,7 +43,7 @@ private final class DeleteAllButtonNode: ASDisplayNode {
self.buttonNode.addSubnode(self.titleNode)
self.contentNode.contentNode.addSubnode(self.buttonNode)
- self.titleNode.attributedText = NSAttributedString(string: presentationData.strings.CallList_DeleteAll, font: Font.regular(17.0), textColor: presentationData.theme.rootController.navigationBar.accentTextColor)
+ self.titleNode.attributedText = NSAttributedString(string: presentationData.strings.CallList_DeleteAll, font: Font.medium(17.0), textColor: presentationData.theme.chat.inputPanel.panelControlColor)
//self.buttonNode.addTarget(self, action: #selector(self.buttonPressed), forControlEvents: .touchUpInside)
}
@@ -54,9 +54,10 @@ private final class DeleteAllButtonNode: ASDisplayNode {
override public func calculateSizeThatFits(_ constrainedSize: CGSize) -> CGSize {
let titleSize = self.titleNode.updateLayout(constrainedSize)
- self.titleNode.frame = CGRect(origin: CGPoint(), size: titleSize)
- self.buttonNode.frame = CGRect(origin: CGPoint(), size: titleSize)
- return titleSize
+ let size = CGSize(width: 10.0 * 2.0 + titleSize.width, height: 44.0)
+ self.titleNode.frame = CGRect(origin: CGPoint(x: 10.0, y: floorToScreenPixels((size.height - titleSize.height) * 0.5)), size: titleSize)
+ self.buttonNode.frame = CGRect(origin: CGPoint(), size: size)
+ return size
}
override public func layout() {
@@ -102,7 +103,7 @@ public final class CallListController: TelegramBaseController {
self.segmentedTitleView = ItemListControllerSegmentedTitleView(theme: self.presentationData.theme, segments: [self.presentationData.strings.Calls_All, self.presentationData.strings.Calls_Missed], selectedIndex: 0)
- super.init(context: context, navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData), mediaAccessoryPanelVisibility: .none, locationBroadcastPanelSource: .none, groupCallPanelSource: .none)
+ super.init(context: context, navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData, style: .glass))
self.tabBarItemContextActionType = .always
@@ -155,6 +156,8 @@ public final class CallListController: TelegramBaseController {
if case .navigation = self.mode {
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Back, style: .plain, target: nil, action: nil)
}
+
+ self.updateTabBarSearchState(ViewController.TabBarSearchState(isActive: false), transition: .immediate)
}
required public init(coder aDecoder: NSCoder) {
@@ -203,7 +206,7 @@ public final class CallListController: TelegramBaseController {
}
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style
- self.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationData: self.presentationData))
+ self.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationData: self.presentationData, style: .glass), transition: .immediate)
if self.isNodeLoaded {
self.controllerNode.updateThemeAndStrings(presentationData: self.presentationData)
@@ -359,10 +362,10 @@ public final class CallListController: TelegramBaseController {
if empty {
switch strongSelf.mode {
case .tab:
- strongSelf.navigationItem.setLeftBarButton(nil, animated: true)
- strongSelf.navigationItem.setRightBarButton(nil, animated: true)
+ strongSelf.navigationItem.setLeftBarButton(nil, animated: strongSelf.controllerNode.didSetReady)
+ strongSelf.navigationItem.setRightBarButton(nil, animated: strongSelf.controllerNode.didSetReady)
case .navigation:
- strongSelf.navigationItem.setRightBarButton(nil, animated: true)
+ strongSelf.navigationItem.setRightBarButton(nil, animated: strongSelf.controllerNode.didSetReady)
}
} else {
var pressedImpl: (() -> Void)?
@@ -379,25 +382,24 @@ public final class CallListController: TelegramBaseController {
switch strongSelf.mode {
case .tab:
if strongSelf.editingMode {
- strongSelf.navigationItem.setLeftBarButton(UIBarButtonItem(title: strongSelf.presentationData.strings.Common_Done, style: .done, target: strongSelf, action: #selector(strongSelf.donePressed)), animated: true)
- strongSelf.navigationItem.setRightBarButton(UIBarButtonItem(customDisplayNode: buttonNode), animated: true)
+ strongSelf.navigationItem.setLeftBarButton(UIBarButtonItem(title: strongSelf.presentationData.strings.Common_Done, style: .done, target: strongSelf, action: #selector(strongSelf.donePressed)), animated: strongSelf.controllerNode.didSetReady)
+ strongSelf.navigationItem.setRightBarButton(UIBarButtonItem(customDisplayNode: buttonNode), animated: strongSelf.controllerNode.didSetReady)
strongSelf.navigationItem.rightBarButtonItem?.setCustomAction({
pressedImpl?()
})
} else {
- strongSelf.navigationItem.setLeftBarButton(UIBarButtonItem(title: strongSelf.presentationData.strings.Common_Edit, style: .plain, target: strongSelf, action: #selector(strongSelf.editPressed)), animated: true)
- //strongSelf.navigationItem.setRightBarButton(UIBarButtonItem(image: PresentationResourcesRootController.navigationCallIcon(strongSelf.presentationData.theme), style: .plain, target: self, action: #selector(strongSelf.callPressed)), animated: true)
- strongSelf.navigationItem.setRightBarButton(nil, animated: true)
+ strongSelf.navigationItem.setLeftBarButton(UIBarButtonItem(title: strongSelf.presentationData.strings.Common_Edit, style: .plain, target: strongSelf, action: #selector(strongSelf.editPressed)), animated: strongSelf.controllerNode.didSetReady)
+ strongSelf.navigationItem.setRightBarButton(nil, animated: strongSelf.controllerNode.didSetReady)
}
case .navigation:
if strongSelf.editingMode {
- strongSelf.navigationItem.setLeftBarButton(UIBarButtonItem(customDisplayNode: buttonNode), animated: true)
+ strongSelf.navigationItem.setLeftBarButton(UIBarButtonItem(customDisplayNode: buttonNode), animated: strongSelf.controllerNode.didSetReady)
strongSelf.navigationItem.leftBarButtonItem?.setCustomAction({
pressedImpl?()
})
- strongSelf.navigationItem.setRightBarButton(UIBarButtonItem(title: strongSelf.presentationData.strings.Common_Done, style: .done, target: strongSelf, action: #selector(strongSelf.donePressed)), animated: true)
+ strongSelf.navigationItem.setRightBarButton(UIBarButtonItem(title: strongSelf.presentationData.strings.Common_Done, style: .done, target: strongSelf, action: #selector(strongSelf.donePressed)), animated: strongSelf.controllerNode.didSetReady)
} else {
- strongSelf.navigationItem.setRightBarButton(UIBarButtonItem(title: strongSelf.presentationData.strings.Common_Edit, style: .plain, target: strongSelf, action: #selector(strongSelf.editPressed)), animated: true)
+ strongSelf.navigationItem.setRightBarButton(UIBarButtonItem(title: strongSelf.presentationData.strings.Common_Edit, style: .plain, target: strongSelf, action: #selector(strongSelf.editPressed)), animated: strongSelf.controllerNode.didSetReady)
}
}
}
@@ -421,10 +423,15 @@ public final class CallListController: TelegramBaseController {
self.displayNodeDidLoad()
}
+ override public var navigationEdgeEffectExtension: CGFloat {
+ return self.controllerNode.navigationEdgeEffectExtension
+ }
+
override public func containerLayoutUpdated(_ layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) {
super.containerLayoutUpdated(layout, transition: transition)
- self.controllerNode.containerLayoutUpdated(layout, navigationBarHeight: self.navigationLayout(layout: layout).navigationFrame.maxY, transition: transition)
+ let navigationLayout = self.navigationLayout(layout: layout)
+ self.controllerNode.containerLayoutUpdated(layout, navigationBarHeight: navigationLayout.navigationFrame.maxY, transition: transition)
}
@objc func callPressed() {
@@ -778,6 +785,10 @@ public final class CallListController: TelegramBaseController {
let controller = ContextController(presentationData: self.presentationData, source: .reference(CallListTabBarContextReferenceContentSource(controller: self, sourceView: sourceView)), items: .single(ContextController.Items(content: .list(items))), recognizer: nil, gesture: gesture)
self.context.sharedContext.mainWindow?.presentInGlobalOverlay(controller)
}
+
+ override public func tabBarActivateSearch() {
+ self.beginCallImpl()
+ }
}
private final class CallListTabBarContextReferenceContentSource: ContextReferenceContentSource {
diff --git a/submodules/CallListUI/Sources/CallListControllerNode.swift b/submodules/CallListUI/Sources/CallListControllerNode.swift
index 9b248b7a..412302fd 100644
--- a/submodules/CallListUI/Sources/CallListControllerNode.swift
+++ b/submodules/CallListUI/Sources/CallListControllerNode.swift
@@ -15,6 +15,9 @@ import AnimatedStickerNode
import TelegramAnimatedStickerNode
import AppBundle
import ItemListPeerActionItem
+import EdgeEffect
+import ComponentFlow
+import ComponentDisplayAdapters
private struct CallListNodeListViewTransition {
let callListView: CallListNodeView
@@ -185,7 +188,7 @@ final class CallListControllerNode: ASDisplayNode {
private var containerLayout: (ContainerViewLayout, CGFloat)?
private let _ready = ValuePromise()
- private var didSetReady = false
+ private(set) var didSetReady = false
var ready: Signal {
return _ready.get()
}
@@ -220,6 +223,8 @@ final class CallListControllerNode: ASDisplayNode {
private let emptyButtonIconNode: ASImageNode
private let emptyButtonTextNode: ImmediateTextNode
+ private let edgeEffectView: EdgeEffectView
+
private let call: (EngineMessage) -> Void
private let joinGroupCall: (EnginePeer.Id, EngineGroupCallDescription) -> Void
private let openNewCall: () -> Void
@@ -230,6 +235,10 @@ final class CallListControllerNode: ASDisplayNode {
private let openGroupCallDisposable = MetaDisposable()
+ var navigationEdgeEffectExtension: CGFloat {
+ return max(0.0, self.listNode.edgeEffectExtension)
+ }
+
private var previousContentOffset: ListViewVisibleContentOffset?
init(controller: CallListController, context: AccountContext, mode: CallListControllerMode, presentationData: PresentationData, call: @escaping (EngineMessage) -> Void, joinGroupCall: @escaping (EnginePeer.Id, EngineGroupCallDescription) -> Void, openInfo: @escaping (EnginePeer.Id, [EngineMessage]) -> Void, emptyStateUpdated: @escaping (Bool) -> Void, openNewCall: @escaping () -> Void) {
@@ -277,6 +286,8 @@ final class CallListControllerNode: ASDisplayNode {
self.emptyButtonIconNode.displaysAsynchronously = false
self.emptyButtonIconNode.isUserInteractionEnabled = false
+ self.edgeEffectView = EdgeEffectView()
+
super.init()
self.setViewBlock({
@@ -289,6 +300,8 @@ final class CallListControllerNode: ASDisplayNode {
self.addSubnode(self.emptyButtonTextNode)
self.addSubnode(self.emptyButtonIconNode)
self.addSubnode(self.emptyButtonNode)
+
+ self.view.addSubview(self.edgeEffectView)
switch self.mode {
case .tab:
@@ -673,6 +686,13 @@ final class CallListControllerNode: ASDisplayNode {
}
}
}
+
+ self.listNode.onEdgeEffectExtensionUpdated = { [weak self] transition in
+ guard let self else {
+ return
+ }
+ self.controller?.updateNavigationEdgeEffectExtension(transition: transition)
+ }
}
deinit {
@@ -945,5 +965,12 @@ final class CallListControllerNode: ASDisplayNode {
self.dequeuedInitialTransitionOnLayout = true
self.dequeueTransition()
}
+
+ let edgeEffectHeight: CGFloat = layout.intrinsicInsets.bottom
+ let edgeEffectFrame = CGRect(origin: CGPoint(x: 0.0, y: layout.size.height - edgeEffectHeight), size: CGSize(width: layout.size.width, height: edgeEffectHeight))
+ transition.updateFrame(view: self.edgeEffectView, frame: edgeEffectFrame)
+ self.edgeEffectView.update(content: self.presentationData.theme.list.plainBackgroundColor, rect: edgeEffectFrame, edge: .bottom, edgeSize: edgeEffectFrame.height, transition: ComponentTransition(transition))
+
+ self.controller?.updateNavigationEdgeEffectExtension(transition: transition)
}
}
diff --git a/submodules/CallListUI/Sources/CallListGroupCallItem.swift b/submodules/CallListUI/Sources/CallListGroupCallItem.swift
index 5875b229..069e6134 100644
--- a/submodules/CallListUI/Sources/CallListGroupCallItem.swift
+++ b/submodules/CallListUI/Sources/CallListGroupCallItem.swift
@@ -208,7 +208,7 @@ class CallListGroupCallItemNode: ItemListRevealOptionsItemNode {
self.accessibilityArea = AccessibilityAreaNode()
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.addSubnode(self.backgroundNode)
self.addSubnode(self.indicatorNode)
@@ -434,7 +434,8 @@ class CallListGroupCallItemNode: ItemListRevealOptionsItemNode {
let _ = joinTitleApply()
transition.updateFrameAdditive(node: strongSelf.joinTitleNode, frame: CGRect(origin: CGPoint(x: floor((joinButtonSize.width - joinTitleLayout.size.width) / 2.0), y: floor((joinButtonSize.height - joinTitleLayout.size.height) / 2.0) + 1.0), size: joinTitleLayout.size))
- let topHighlightInset: CGFloat = (first || !nodeLayout.insets.top.isZero) ? 0.0 : separatorHeight
+ var topHighlightInset: CGFloat = (first || !nodeLayout.insets.top.isZero) ? 0.0 : separatorHeight
+ topHighlightInset -= nodeLayout.insets.top
strongSelf.backgroundNode.frame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: nodeLayout.contentSize.width, height: nodeLayout.contentSize.height))
strongSelf.highlightedBackgroundNode.frame = CGRect(origin: CGPoint(x: 0.0, y: -nodeLayout.insets.top - topHighlightInset), size: CGSize(width: nodeLayout.size.width, height: nodeLayout.size.height + topHighlightInset))
diff --git a/submodules/CallListUI/Sources/CallListHoleItem.swift b/submodules/CallListUI/Sources/CallListHoleItem.swift
index 1dd52fda..bf71192f 100644
--- a/submodules/CallListUI/Sources/CallListHoleItem.swift
+++ b/submodules/CallListUI/Sources/CallListHoleItem.swift
@@ -70,7 +70,7 @@ class CallListHoleItemNode: ListViewItemNode {
self.labelNode = TextNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.separatorNode)
self.addSubnode(self.labelNode)
diff --git a/submodules/ChatListFilterSettingsHeaderItem/Sources/ChatListFilterSettingsHeaderItem.swift b/submodules/ChatListFilterSettingsHeaderItem/Sources/ChatListFilterSettingsHeaderItem.swift
index ebe6c50e..4fc9515c 100644
--- a/submodules/ChatListFilterSettingsHeaderItem/Sources/ChatListFilterSettingsHeaderItem.swift
+++ b/submodules/ChatListFilterSettingsHeaderItem/Sources/ChatListFilterSettingsHeaderItem.swift
@@ -86,7 +86,7 @@ class ChatListFilterSettingsHeaderItemNode: ListViewItemNode {
self.animationNode = DefaultAnimatedStickerNodeImpl()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.titleNode)
self.addSubnode(self.animationNode)
diff --git a/submodules/ChatListSearchItemHeader/BUILD b/submodules/ChatListSearchItemHeader/BUILD
index 8154e629..288c626e 100644
--- a/submodules/ChatListSearchItemHeader/BUILD
+++ b/submodules/ChatListSearchItemHeader/BUILD
@@ -10,9 +10,12 @@ swift_library(
"-warnings-as-errors",
],
deps = [
- "//submodules/Display:Display",
- "//submodules/TelegramPresentationData:TelegramPresentationData",
- "//submodules/ListSectionHeaderNode:ListSectionHeaderNode",
+ "//submodules/Display",
+ "//submodules/TelegramPresentationData",
+ "//submodules/ListSectionHeaderNode",
+ "//submodules/ComponentFlow",
+ "//submodules/Components/ComponentDisplayAdapters",
+ "//submodules/TelegramUI/Components/EdgeEffect",
],
visibility = [
"//visibility:public",
diff --git a/submodules/ChatListSearchItemHeader/Sources/ChatListSearchItemHeader.swift b/submodules/ChatListSearchItemHeader/Sources/ChatListSearchItemHeader.swift
index 71b378f3..202513da 100644
--- a/submodules/ChatListSearchItemHeader/Sources/ChatListSearchItemHeader.swift
+++ b/submodules/ChatListSearchItemHeader/Sources/ChatListSearchItemHeader.swift
@@ -4,6 +4,9 @@ import AsyncDisplayKit
import Display
import TelegramPresentationData
import ListSectionHeaderNode
+import EdgeEffect
+import ComponentFlow
+import ComponentDisplayAdapters
public enum ChatListSearchItemHeaderType {
case localPeers
@@ -214,6 +217,7 @@ public final class ChatListSearchItemHeader: ListViewItemHeader {
public let action: ((ASDisplayNode) -> Void)?
public let height: CGFloat = 28.0
+ public let isSticky: Bool = false
public init(type: ChatListSearchItemHeaderType, theme: PresentationTheme, strings: PresentationStrings, actionTitle: String? = nil, action: ((ASDisplayNode) -> Void)? = nil) {
self.type = type
@@ -250,6 +254,7 @@ public final class ChatListSearchItemHeaderNode: ListViewItemHeaderNode {
private var validLayout: (size: CGSize, leftInset: CGFloat, rightInset: CGFloat)?
+ private var edgeEffectView: EdgeEffectView?
private let sectionHeaderNode: ListSectionHeaderNode
public init(type: ChatListSearchItemHeaderType, theme: PresentationTheme, strings: PresentationStrings, actionTitle: String?, action: ((ASDisplayNode) -> Void)?) {
@@ -263,6 +268,8 @@ public final class ChatListSearchItemHeaderNode: ListViewItemHeaderNode {
super.init()
+ //self.contributesToEdgeEffect = true
+
self.sectionHeaderNode.title = type.title(strings: strings).uppercased()
self.sectionHeaderNode.action = actionTitle
self.sectionHeaderNode.activateAction = action
diff --git a/submodules/ChatListUI/BUILD b/submodules/ChatListUI/BUILD
index a28100bb..87652ea3 100644
--- a/submodules/ChatListUI/BUILD
+++ b/submodules/ChatListUI/BUILD
@@ -29,7 +29,6 @@ swift_library(
"//submodules/ActivityIndicator:ActivityIndicator",
"//submodules/SearchBarNode:SearchBarNode",
"//submodules/ChatListSearchRecentPeersNode:ChatListSearchRecentPeersNode",
- "//submodules/ChatListSearchItemNode:ChatListSearchItemNode",
"//submodules/ChatListSearchItemHeader:ChatListSearchItemHeader",
"//submodules/TemporaryCachedPeerDataManager:TemporaryCachedPeerDataManager",
"//submodules/PeerPresenceStatusManager:PeerPresenceStatusManager",
@@ -118,6 +117,14 @@ swift_library(
"//submodules/TelegramUI/Components/ButtonComponent",
"//submodules/TelegramUI/Components/AnimatedTextComponent",
"//submodules/TelegramUI/Components/EdgeEffect",
+ "//submodules/TelegramUI/Components/ChatList/ChatListFilterTabContainerNode",
+ "//submodules/TelegramUI/Components/HeaderPanelContainerComponent",
+ "//submodules/TelegramUI/Components/HorizontalTabsComponent",
+ "//submodules/TelegramUI/Components/GlobalControlPanelsContext",
+ "//submodules/TelegramUI/Components/MediaPlaybackHeaderPanelComponent",
+ "//submodules/TelegramUI/Components/LiveLocationHeaderPanelComponent",
+ "//submodules/TelegramUI/Components/ChatList/ChatListSearchFiltersContainerNode",
+ "//submodules/TelegramUI/Components/ChatList/ChatListHeaderNoticeComponent",
],
visibility = [
"//visibility:public",
diff --git a/submodules/ChatListUI/Sources/ChatListAdditionalCategoryItem.swift b/submodules/ChatListUI/Sources/ChatListAdditionalCategoryItem.swift
index a1614b28..0dd445b2 100644
--- a/submodules/ChatListUI/Sources/ChatListAdditionalCategoryItem.swift
+++ b/submodules/ChatListUI/Sources/ChatListAdditionalCategoryItem.swift
@@ -169,7 +169,7 @@ public class ChatListAdditionalCategoryItemNode: ItemListRevealOptionsItemNode {
self.titleNode = TextNode()
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.isAccessibilityElement = true
diff --git a/submodules/ChatListUI/Sources/ChatListContainerItemNode.swift b/submodules/ChatListUI/Sources/ChatListContainerItemNode.swift
index 9b6974a7..55f028e0 100644
--- a/submodules/ChatListUI/Sources/ChatListContainerItemNode.swift
+++ b/submodules/ChatListUI/Sources/ChatListContainerItemNode.swift
@@ -450,10 +450,10 @@ final class ChatListContainerItemNode: ASDisplayNode {
self.layoutAdditionalPanels(transition: transition)
- let edgeEffectHeight: CGFloat = insets.bottom
+ let edgeEffectHeight: CGFloat = insets.bottom + 8.0
let edgeEffectFrame = CGRect(origin: CGPoint(x: 0.0, y: size.height - edgeEffectHeight), size: CGSize(width: size.width, height: edgeEffectHeight))
transition.updateFrame(view: self.edgeEffectView, frame: edgeEffectFrame)
- self.edgeEffectView.update(content: self.presentationData.theme.list.plainBackgroundColor, rect: edgeEffectFrame, edge: .bottom, edgeSize: edgeEffectFrame.height, transition: ComponentTransition(transition))
+ self.edgeEffectView.update(content: self.presentationData.theme.list.plainBackgroundColor, rect: edgeEffectFrame, edge: .bottom, edgeSize: min(edgeEffectFrame.height, 40.0), transition: ComponentTransition(transition))
transition.updateAlpha(layer: self.edgeEffectView.layer, alpha: edgeEffectHeight > 21.0 ? 1.0 : 0.0)
}
diff --git a/submodules/ChatListUI/Sources/ChatListController.swift b/submodules/ChatListUI/Sources/ChatListController.swift
index 1dae5215..c020faa7 100644
--- a/submodules/ChatListUI/Sources/ChatListController.swift
+++ b/submodules/ChatListUI/Sources/ChatListController.swift
@@ -55,6 +55,11 @@ import TextFormat
import AvatarUploadToastScreen
import AdsInfoScreen
import AdsReportScreen
+import SearchBarNode
+import ChatListFilterTabContainerNode
+import HeaderPanelContainerComponent
+import HorizontalTabsComponent
+import GlobalControlPanelsContext
private final class ContextControllerContentSourceImpl: ContextControllerContentSource {
let controller: ViewController
@@ -150,9 +155,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
private let isReorderingTabsValue = ValuePromise(false)
- let tabsNode: SparseNode
- private let tabContainerNode: ChatListFilterTabContainerNode
- private var tabContainerData: ([ChatListFilterTabEntry], Bool, Int32?)?
+ private(set) var tabContainerData: ([ChatListFilterTabEntry], Bool, Int32?)?
var hasTabs: Bool {
if let tabContainerData = self.tabContainerData {
let isEmpty = tabContainerData.0.count <= 1 || tabContainerData.1
@@ -162,8 +165,6 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
}
}
- var searchTabsNode: SparseNode?
-
private var hasDownloads: Bool = false
private var activeDownloadsDisposable: Disposable?
private var clearUnseenDownloadsTimer: SwiftSignalKit.Timer?
@@ -221,6 +222,10 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
private var fullScreenEffectView: RippleEffectView?
+ let globalControlPanelsContext: GlobalControlPanelsContext
+ private(set) var globalControlPanelsContextState: GlobalControlPanelsContext.State?
+ private var globalControlPanelsContextStateDisposable: Disposable?
+
public override func updateNavigationCustomData(_ data: Any?, progress: CGFloat, transition: ContainedViewLayoutTransition) {
if self.isNodeLoaded {
self.chatListDisplayNode.effectiveContainerNode.updateSelectedChatLocation(data: data as? ChatLocation, progress: progress, transition: transition)
@@ -241,21 +246,28 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
self.animationCache = context.animationCache
self.animationRenderer = context.animationRenderer
- let groupCallPanelSource: GroupCallPanelSource
+ var groupCallPanelSource: EnginePeer.Id?
+ var chatListNotices = false
switch self.location {
- case .chatList:
- groupCallPanelSource = .all
+ case let .chatList(groupId):
+ if case .root = groupId {
+ chatListNotices = true
+ }
case let .forum(peerId):
- groupCallPanelSource = .peer(peerId)
+ groupCallPanelSource = peerId
case .savedMessagesChats:
- groupCallPanelSource = .none
+ break
}
- self.tabsNode = SparseNode()
- self.tabContainerNode = ChatListFilterTabContainerNode(context: context)
- self.tabsNode.addSubnode(self.tabContainerNode)
+ self.globalControlPanelsContext = GlobalControlPanelsContext(
+ context: context,
+ mediaPlayback: true,
+ liveLocationMode: .all,
+ groupCalls: groupCallPanelSource,
+ chatListNotices: chatListNotices
+ )
- super.init(context: context, navigationBarPresentationData: nil, mediaAccessoryPanelVisibility: .always, locationBroadcastPanelSource: .summary, groupCallPanelSource: groupCallPanelSource)
+ super.init(context: context, navigationBarPresentationData: nil)
self.accessoryPanelContainer = ASDisplayNode()
@@ -437,23 +449,6 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
}).strict()
if !previewing {
- /*
- self.searchContentNode = NavigationBarSearchContentNode(theme: self.presentationData.theme, placeholder: placeholder, compactPlaceholder: compactPlaceholder, activate: { [weak self] in
- self?.chatListDisplayNode.mainContainerNode.currentItemNode.cancelTracking()
- self?.activateSearch(filter: isForum ? .topics : .chats)
- })
- self.searchContentNode?.updateExpansionProgress(0.0)
- self.navigationBar?.setContentNode(self.searchContentNode, animated: false)*/
-
- let tabsIsEmpty: Bool
- if let (resolvedItems, displayTabsAtBottom, _) = self.tabContainerData {
- tabsIsEmpty = resolvedItems.count <= 1 || displayTabsAtBottom
- } else {
- tabsIsEmpty = true
- }
-
- self.navigationBar?.secondaryContentHeight = !tabsIsEmpty ? NavigationBar.defaultSecondaryContentHeight : 0.0
-
enum State: Equatable {
case empty(hasDownloads: Bool)
case downloading(progress: Double)
@@ -736,16 +731,10 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
guard let strongSelf = self else {
return
}
- guard let layout = strongSelf.validLayout else {
- return
+
+ if let navigationBarView = strongSelf.chatListDisplayNode.navigationBarView.view as? ChatListNavigationBar.View, let headerPanelsView = navigationBarView.headerPanels as? HeaderPanelContainerComponent.View, let tabsView = headerPanelsView.tabs as? HorizontalTabsComponent.View {
+ tabsView.updateTabSwitchFraction(fraction: fraction, isDragging: strongSelf.chatListDisplayNode.mainContainerNode.isSwitchingCurrentItemFilterByDragging, transition: ComponentTransition(transition))
}
- guard let tabContainerData = strongSelf.tabContainerData else {
- return
- }
- if force {
- strongSelf.tabContainerNode.cancelAnimations()
- }
- strongSelf.tabContainerNode.update(size: CGSize(width: layout.size.width, height: 46.0), sideInset: layout.safeInsets.left, filters: tabContainerData.0, selectedFilter: filter, isReordering: strongSelf.chatListDisplayNode.isReorderingFilters || (strongSelf.chatListDisplayNode.mainContainerNode.currentItemNode.currentState.editing && !strongSelf.chatListDisplayNode.didBeginSelectingChatsWhileEditing), isEditing: strongSelf.chatListDisplayNode.mainContainerNode.currentItemNode.currentState.editing, canReorderAllChats: strongSelf.isPremium, filtersLimit: tabContainerData.2, transitionFraction: fraction, presentationData: strongSelf.presentationData, transition: transition)
}
self.reloadFilters()
}
@@ -769,6 +758,17 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
})
self.updateNavigationMetadata()
+
+ self.updateTabBarSearchState(ViewController.TabBarSearchState(isActive: false), transition: .immediate)
+
+ self.globalControlPanelsContextStateDisposable = (self.globalControlPanelsContext.state
+ |> deliverOnMainQueue).startStrict(next: { [weak self] state in
+ guard let self else {
+ return
+ }
+ self.globalControlPanelsContextState = state
+ self.requestLayout(transition: .animated(duration: 0.4, curve: .spring))
+ })
}
required public init(coder aDecoder: NSCoder) {
@@ -802,6 +802,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
for (_, disposable) in self.preloadStoryResourceDisposables {
disposable.dispose()
}
+ self.globalControlPanelsContextStateDisposable?.dispose()
}
private func updateNavigationMetadata() {
@@ -934,11 +935,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
}
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style
- self.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationData: self.presentationData))
-
- if let layout = self.validLayout {
- self.tabContainerNode.update(size: CGSize(width: layout.size.width, height: 46.0), sideInset: layout.safeInsets.left, filters: self.tabContainerData?.0 ?? [], selectedFilter: self.chatListDisplayNode.effectiveContainerNode.currentItemFilter, isReordering: self.chatListDisplayNode.isReorderingFilters || (self.chatListDisplayNode.effectiveContainerNode.currentItemNode.currentState.editing && !self.chatListDisplayNode.didBeginSelectingChatsWhileEditing), isEditing: self.chatListDisplayNode.effectiveContainerNode.currentItemNode.currentState.editing, canReorderAllChats: self.isPremium, filtersLimit: self.tabContainerData?.2, transitionFraction: self.chatListDisplayNode.effectiveContainerNode.transitionFraction, presentationData: self.presentationData, transition: .immediate)
- }
+ self.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationData: self.presentationData), transition: .immediate)
if self.isNodeLoaded {
self.chatListDisplayNode.updatePresentationData(self.presentationData)
@@ -947,6 +944,356 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
self.requestLayout(transition: .immediate)
}
+ func tabContextGesture(id: Int32?, sourceNode: ContextExtractedContentContainingNode?, sourceView: ContextExtractedContentContainingView?, gesture: ContextGesture?, keepInPlace: Bool, isDisabled: Bool) {
+ let context = self.context
+ let filterPeersAreMuted: Signal<(areMuted: Bool, peerIds: [EnginePeer.Id])?, NoError> = self.context.engine.peers.currentChatListFilters()
+ |> take(1)
+ |> mapToSignal { filters -> Signal<(areMuted: Bool, peerIds: [EnginePeer.Id])?, NoError> in
+ guard let filter = filters.first(where: { $0.id == id }) else {
+ return .single(nil)
+ }
+ guard case let .filter(_, _, _, data) = filter else {
+ return .single(nil)
+ }
+
+ let filterPredicate: ChatListFilterPredicate = chatListFilterPredicate(filter: data, accountPeerId: context.account.peerId)
+ return context.engine.peers.getChatListPeers(filterPredicate: filterPredicate)
+ |> mapToSignal { peers -> Signal<(areMuted: Bool, peerIds: [EnginePeer.Id])?, NoError> in
+ let peerIds = peers.map(\.id)
+ return context.engine.data.get(
+ EngineDataMap(peerIds.map(TelegramEngine.EngineData.Item.Peer.NotificationSettings.init(id:))),
+ TelegramEngine.EngineData.Item.NotificationSettings.Global()
+ )
+ |> map { list, globalSettings -> (areMuted: Bool, peerIds: [EnginePeer.Id])? in
+ for peer in peers {
+ switch list[peer.id]?.muteState {
+ case .unmuted:
+ return (false, peerIds)
+ case .default:
+ let globalValue: EngineGlobalNotificationSettings.CategorySettings
+ switch peer {
+ case .user, .secretChat:
+ globalValue = globalSettings.privateChats
+ case .legacyGroup:
+ globalValue = globalSettings.groupChats
+ case let .channel(channel):
+ if case .broadcast = channel.info {
+ globalValue = globalSettings.channels
+ } else {
+ globalValue = globalSettings.groupChats
+ }
+ }
+ if globalValue.enabled {
+ return (false, peerIds)
+ }
+ default:
+ break
+ }
+ }
+ return (true, peerIds)
+ }
+ }
+ }
+
+ let _ = combineLatest(
+ queue: Queue.mainQueue(),
+ self.context.engine.peers.currentChatListFilters(),
+ self.context.engine.data.get(
+ TelegramEngine.EngineData.Item.Configuration.UserLimits(isPremium: true)
+ ),
+ filterPeersAreMuted
+ ).startStandalone(next: { [weak self] filters, premiumLimits, filterPeersAreMuted in
+ guard let self else {
+ return
+ }
+ var items: [ContextMenuItem] = []
+ if let id = id {
+ items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.ChatList_EditFolder, icon: { theme in
+ return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Edit"), color: theme.contextMenu.primaryColor)
+ }, action: { c, f in
+ c?.dismiss(completion: { [weak self] in
+ guard let self else {
+ return
+ }
+ if isDisabled {
+ let context = self.context
+ var replaceImpl: ((ViewController) -> Void)?
+ let controller = PremiumLimitScreen(context: context, subject: .folders, count: Int32(self.tabContainerData?.0.count ?? 0), action: {
+ let controller = PremiumIntroScreen(context: context, source: .folders)
+ replaceImpl?(controller)
+ return true
+ })
+ replaceImpl = { [weak controller] c in
+ controller?.replace(with: c)
+ }
+ self.push(controller)
+ } else {
+ let _ = (self.context.engine.peers.currentChatListFilters()
+ |> deliverOnMainQueue).startStandalone(next: { [weak self] presetList in
+ guard let self else {
+ return
+ }
+ var found = false
+ for filter in presetList {
+ if filter.id == id {
+ self.push(chatListFilterPresetController(context: self.context, currentPreset: filter, updated: { _ in }))
+ f(.dismissWithoutContent)
+ found = true
+ break
+ }
+ }
+ if !found {
+ f(.default)
+ }
+ })
+ }
+ })
+ })))
+
+ if let _ = filters.first(where: { $0.id == id }) {
+ items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.ChatList_AddChatsToFolder, icon: { theme in
+ return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Add"), color: theme.contextMenu.primaryColor)
+ }, action: { [weak self] c, f in
+ c?.dismiss(completion: {
+ guard let self else {
+ return
+ }
+
+ if isDisabled {
+ let context = self.context
+ var replaceImpl: ((ViewController) -> Void)?
+ let controller = PremiumLimitScreen(context: context, subject: .folders, count: Int32(self.tabContainerData?.0.count ?? 0), action: {
+ let controller = PremiumIntroScreen(context: context, source: .folders)
+ replaceImpl?(controller)
+ return true
+ })
+ replaceImpl = { [weak controller] c in
+ controller?.replace(with: c)
+ }
+ self.push(controller)
+ } else {
+ let _ = combineLatest(
+ queue: Queue.mainQueue(),
+ self.context.engine.data.get(
+ TelegramEngine.EngineData.Item.Peer.Peer(id: self.context.account.peerId),
+ TelegramEngine.EngineData.Item.Configuration.UserLimits(isPremium: false),
+ TelegramEngine.EngineData.Item.Configuration.UserLimits(isPremium: true)
+ ),
+ self.context.engine.peers.currentChatListFilters()
+ ).startStandalone(next: { [weak self] result, presetList in
+ guard let self else {
+ return
+ }
+ var found = false
+ for filter in presetList {
+ if filter.id == id, case let .filter(_, _, _, data) = filter {
+ let (accountPeer, limits, premiumLimits) = result
+ let isPremium = accountPeer?.isPremium ?? false
+
+ let limit = limits.maxFolderChatsCount
+ let premiumLimit = premiumLimits.maxFolderChatsCount
+
+ if data.includePeers.peers.count >= premiumLimit {
+ let controller = PremiumLimitScreen(context: self.context, subject: .chatsPerFolder, count: Int32(data.includePeers.peers.count), action: {
+ return true
+ })
+ self.push(controller)
+ f(.dismissWithoutContent)
+ return
+ } else if data.includePeers.peers.count >= limit && !isPremium {
+ var replaceImpl: ((ViewController) -> Void)?
+ let controller = PremiumLimitScreen(context: self.context, subject: .chatsPerFolder, count: Int32(data.includePeers.peers.count), action: {
+ let controller = PremiumIntroScreen(context: self.context, source: .chatsPerFolder)
+ replaceImpl?(controller)
+ return true
+ })
+ replaceImpl = { [weak controller] c in
+ controller?.replace(with: c)
+ }
+ self.push(controller)
+ f(.dismissWithoutContent)
+ return
+ }
+
+ let _ = (self.context.engine.peers.currentChatListFilters()
+ |> deliverOnMainQueue).startStandalone(next: { [weak self] filters in
+ guard let self else {
+ return
+ }
+ self.push(chatListFilterAddChatsController(context: self.context, filter: filter, allFilters: filters, limit: limits.maxFolderChatsCount, premiumLimit: premiumLimits.maxFolderChatsCount, isPremium: isPremium, presentUndo: { [weak self] content in
+ guard let self else {
+ return
+ }
+ self.present(UndoOverlayController(presentationData: self.presentationData, content: content, elevatedLayout: true, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
+ }))
+ f(.dismissWithoutContent)
+ })
+ found = true
+ break
+ }
+ }
+ if !found {
+ f(.default)
+ }
+ })
+ }
+ })
+ })))
+
+ if let filterEntries = self.tabContainerData?.0 {
+ for filter in filterEntries {
+ if case let .filter(filterId, _, unread) = filter, filterId == id {
+ if unread.value > 0 {
+ items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.ChatList_ReadAll, textColor: .primary, icon: { theme in
+ return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/ReadAll"), color: theme.contextMenu.primaryColor)
+ }, action: { [weak self] c, f in
+ c?.dismiss(completion: {
+ guard let self else {
+ return
+ }
+ self.readAllInFilter(id: id)
+ })
+ })))
+ }
+
+ for filter in filters {
+ if filter.id == filterId, case let .filter(_, title, _, data) = filter {
+ if let filterPeersAreMuted, filterPeersAreMuted.peerIds.count <= 200 {
+ items.append(.action(ContextMenuActionItem(text: filterPeersAreMuted.areMuted ? self.presentationData.strings.ChatList_ContextUnmuteAll : self.presentationData.strings.ChatList_ContextMuteAll, textColor: .primary, badge: nil, icon: { theme in
+ return generateTintedImage(image: UIImage(bundleImageName: filterPeersAreMuted.areMuted ? "Chat/Context Menu/Unmute" : "Chat/Context Menu/Muted"), color: theme.contextMenu.primaryColor)
+ }, action: { [weak self] c, f in
+ c?.dismiss(completion: {
+ })
+
+ guard let self else {
+ return
+ }
+
+ let _ = (self.context.engine.peers.updateMultiplePeerMuteSettings(peerIds: filterPeersAreMuted.peerIds, muted: !filterPeersAreMuted.areMuted)
+ |> deliverOnMainQueue).startStandalone(completed: { [weak self] in
+ guard let self else {
+ return
+ }
+
+ let iconColor: UIColor = .white
+ let overlayController: UndoOverlayController
+ if !filterPeersAreMuted.areMuted {
+ let text = NSMutableAttributedString(string: self.presentationData.strings.ChatList_ToastFolderMutedV2)
+ let folderNameRange = (text.string as NSString).range(of: "{folder}")
+ if folderNameRange.location != NSNotFound {
+ text.replaceCharacters(in: folderNameRange, with: "")
+ text.insert(title.attributedString(attributes: [
+ ChatTextInputAttributes.bold: true
+ ]), at: folderNameRange.location)
+ }
+
+ overlayController = UndoOverlayController(presentationData: self.presentationData, content: .universalWithEntities(context: self.context, animation: "anim_profilemute", scale: 0.075, colors: [
+ "Middle.Group 1.Fill 1": iconColor,
+ "Top.Group 1.Fill 1": iconColor,
+ "Bottom.Group 1.Fill 1": iconColor,
+ "EXAMPLE.Group 1.Fill 1": iconColor,
+ "Line.Group 1.Stroke 1": iconColor
+ ], title: nil, text: text, animateEntities: title.enableAnimations, customUndoText: nil, timeout: nil), elevatedLayout: false, animateInAsReplacement: true, action: { _ in return false })
+ } else {
+ let text = NSMutableAttributedString(string: self.presentationData.strings.ChatList_ToastFolderUnmutedV2)
+ let folderNameRange = (text.string as NSString).range(of: "{folder}")
+ if folderNameRange.location != NSNotFound {
+ text.replaceCharacters(in: folderNameRange, with: "")
+ text.insert(title.attributedString(attributes: [
+ ChatTextInputAttributes.bold: true
+ ]), at: folderNameRange.location)
+ }
+
+ overlayController = UndoOverlayController(presentationData: self.presentationData, content: .universalWithEntities(context: self.context, animation: "anim_profileunmute", scale: 0.075, colors: [
+ "Middle.Group 1.Fill 1": iconColor,
+ "Top.Group 1.Fill 1": iconColor,
+ "Bottom.Group 1.Fill 1": iconColor,
+ "EXAMPLE.Group 1.Fill 1": iconColor,
+ "Line.Group 1.Stroke 1": iconColor
+ ], title: nil, text: text, animateEntities: title.enableAnimations, customUndoText: nil, timeout: nil), elevatedLayout: false, animateInAsReplacement: true, action: { _ in return false })
+ }
+ self.present(overlayController, in: .current)
+ })
+ })))
+ }
+
+ if !data.includePeers.peers.isEmpty && data.categories.isEmpty && !data.excludeRead && !data.excludeMuted && !data.excludeArchived && data.excludePeers.isEmpty {
+ items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.ChatList_ContextMenuShare, textColor: .primary, badge: nil, icon: { theme in
+ return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Link"), color: theme.contextMenu.primaryColor)
+ }, action: { [weak self] c, f in
+ c?.dismiss(completion: {
+ guard let self else {
+ return
+ }
+ self.shareFolder(filterId: filterId, data: data, title: title)
+ })
+ })))
+ }
+
+ break
+ }
+ }
+
+ break
+ }
+ }
+ }
+
+ items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.ChatList_RemoveFolder, textColor: .destructive, icon: { theme in
+ return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Delete"), color: theme.contextMenu.destructiveColor)
+ }, action: { [weak self] c, f in
+ c?.dismiss(completion: {
+ guard let self else {
+ return
+ }
+ self.askForFilterRemoval(id: id)
+ })
+ })))
+ }
+ } else {
+ items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.ChatList_EditFolders, icon: { theme in
+ return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Edit"), color: theme.contextMenu.primaryColor)
+ }, action: { [weak self] c, f in
+ c?.dismiss(completion: {
+ guard let self else {
+ return
+ }
+ self.openFilterSettings()
+ })
+ })))
+ }
+
+ if filters.count > 1 {
+ items.append(.separator)
+ items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.ChatList_ReorderTabs, icon: { theme in
+ return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/ReorderItems"), color: theme.contextMenu.primaryColor)
+ }, action: { [weak self] c, f in
+ c?.dismiss(completion: {
+ guard let self else {
+ return
+ }
+
+ self.chatListDisplayNode.isReorderingFilters = true
+ self.isReorderingTabsValue.set(true)
+
+ (self.parent as? TabBarController)?.updateIsTabBarEnabled(false, transition: .animated(duration: 0.2, curve: .easeInOut))
+ if let layout = self.validLayout {
+ self.updateLayout(layout: layout, transition: .animated(duration: 0.2, curve: .easeInOut))
+ }
+ })
+ })))
+ }
+
+ if let sourceNode {
+ let controller = ContextController(presentationData: self.presentationData, source: .extracted(ChatListHeaderBarContextExtractedContentSource(controller: self, sourceNode: sourceNode, sourceView: sourceView, keepInPlace: keepInPlace)), items: .single(ContextController.Items(content: .list(items))), recognizer: nil, gesture: gesture)
+ self.context.sharedContext.mainWindow?.presentInGlobalOverlay(controller)
+ } else if let sourceView {
+ let controller = ContextController(presentationData: self.presentationData, source: .reference(ChatListHeaderBarContextReferenceContentSource(controller: self, sourceView: sourceView)), items: .single(ContextController.Items(content: .list(items))), recognizer: nil, gesture: gesture)
+ self.context.sharedContext.mainWindow?.presentInGlobalOverlay(controller)
+ }
+ })
+ }
+
override public func loadDisplayNode() {
self.displayNode = ChatListControllerNode(context: self.context, location: self.location, previewing: self.previewing, controlsHistoryPreload: self.controlsHistoryPreload, presentationData: self.presentationData, animationCache: self.animationCache, animationRenderer: self.animationRenderer, controller: self)
@@ -1653,7 +2000,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
} else {
let contextContentSource: ContextContentSource
if peer.id.namespace == Namespaces.Peer.SecretChat, let node = node.subnodes?.first as? ContextExtractedContentContainingNode {
- contextContentSource = .extracted(ChatListHeaderBarContextExtractedContentSource(controller: strongSelf, sourceNode: node, keepInPlace: false))
+ contextContentSource = .extracted(ChatListHeaderBarContextExtractedContentSource(controller: strongSelf, sourceNode: node, sourceView: nil, keepInPlace: false))
} else {
var subject: ChatControllerSubject?
if case let .search(messageId) = source, let id = messageId {
@@ -1669,406 +2016,6 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
}
}
- self.tabContainerNode.tabSelected = { [weak self] id, isDisabled in
- guard let strongSelf = self else {
- return
- }
- if isDisabled {
- let context = strongSelf.context
- var replaceImpl: ((ViewController) -> Void)?
- let controller = PremiumLimitScreen(context: context, subject: .folders, count: strongSelf.tabContainerNode.filtersCount, action: {
- let controller = PremiumIntroScreen(context: context, source: .folders)
- replaceImpl?(controller)
- return true
- })
- replaceImpl = { [weak controller] c in
- controller?.replace(with: c)
- }
- strongSelf.push(controller)
- } else {
- strongSelf.selectTab(id: id)
- }
- }
-
- self.tabContainerNode.tabRequestedDeletion = { [weak self] id in
- if case let .filter(id) = id {
- self?.askForFilterRemoval(id: id)
- }
- }
- self.tabContainerNode.presentPremiumTip = { [weak self] in
- if let strongSelf = self {
- strongSelf.present(UndoOverlayController(presentationData: strongSelf.presentationData, content: .universal(animation: "anim_reorder", scale: 0.05, colors: [:], title: nil, text: strongSelf.presentationData.strings.ChatListFolderSettings_SubscribeToMoveAll, customUndoText: strongSelf.presentationData.strings.ChatListFolderSettings_SubscribeToMoveAllAction, timeout: nil), elevatedLayout: false, position: .top, animateInAsReplacement: false, action: { action in
- if case .undo = action {
- let context = strongSelf.context
- var replaceImpl: ((ViewController) -> Void)?
- let controller = PremiumDemoScreen(context: context, subject: .advancedChatManagement, action: {
- let controller = PremiumIntroScreen(context: context, source: .folders)
- replaceImpl?(controller)
- })
- replaceImpl = { [weak controller] c in
- controller?.replace(with: c)
- }
- strongSelf.push(controller)
- }
- return false }), in: .current)
- }
- }
-
- let tabContextGesture: (Int32?, ContextExtractedContentContainingNode, ContextGesture, Bool, Bool) -> Void = { [weak self] id, sourceNode, gesture, keepInPlace, isDisabled in
- guard let strongSelf = self else {
- return
- }
-
- let context = strongSelf.context
- let filterPeersAreMuted: Signal<(areMuted: Bool, peerIds: [EnginePeer.Id])?, NoError> = strongSelf.context.engine.peers.currentChatListFilters()
- |> take(1)
- |> mapToSignal { filters -> Signal<(areMuted: Bool, peerIds: [EnginePeer.Id])?, NoError> in
- guard let filter = filters.first(where: { $0.id == id }) else {
- return .single(nil)
- }
- guard case let .filter(_, _, _, data) = filter else {
- return .single(nil)
- }
-
- let filterPredicate: ChatListFilterPredicate = chatListFilterPredicate(filter: data, accountPeerId: context.account.peerId)
- return context.engine.peers.getChatListPeers(filterPredicate: filterPredicate)
- |> mapToSignal { peers -> Signal<(areMuted: Bool, peerIds: [EnginePeer.Id])?, NoError> in
- let peerIds = peers.map(\.id)
- return context.engine.data.get(
- EngineDataMap(peerIds.map(TelegramEngine.EngineData.Item.Peer.NotificationSettings.init(id:))),
- TelegramEngine.EngineData.Item.NotificationSettings.Global()
- )
- |> map { list, globalSettings -> (areMuted: Bool, peerIds: [EnginePeer.Id])? in
- for peer in peers {
- switch list[peer.id]?.muteState {
- case .unmuted:
- return (false, peerIds)
- case .default:
- let globalValue: EngineGlobalNotificationSettings.CategorySettings
- switch peer {
- case .user, .secretChat:
- globalValue = globalSettings.privateChats
- case .legacyGroup:
- globalValue = globalSettings.groupChats
- case let .channel(channel):
- if case .broadcast = channel.info {
- globalValue = globalSettings.channels
- } else {
- globalValue = globalSettings.groupChats
- }
- }
- if globalValue.enabled {
- return (false, peerIds)
- }
- default:
- break
- }
- }
- return (true, peerIds)
- }
- }
- }
-
- let _ = combineLatest(
- queue: Queue.mainQueue(),
- strongSelf.context.engine.peers.currentChatListFilters(),
- strongSelf.context.engine.data.get(
- TelegramEngine.EngineData.Item.Configuration.UserLimits(isPremium: true)
- ),
- filterPeersAreMuted
- ).startStandalone(next: { [weak self] filters, premiumLimits, filterPeersAreMuted in
- guard let strongSelf = self else {
- return
- }
- var items: [ContextMenuItem] = []
- if let id = id {
- items.append(.action(ContextMenuActionItem(text: strongSelf.presentationData.strings.ChatList_EditFolder, icon: { theme in
- return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Edit"), color: theme.contextMenu.primaryColor)
- }, action: { c, f in
- c?.dismiss(completion: {
- guard let strongSelf = self else {
- return
- }
- if isDisabled {
- let context = strongSelf.context
- var replaceImpl: ((ViewController) -> Void)?
- let controller = PremiumLimitScreen(context: context, subject: .folders, count: strongSelf.tabContainerNode.filtersCount, action: {
- let controller = PremiumIntroScreen(context: context, source: .folders)
- replaceImpl?(controller)
- return true
- })
- replaceImpl = { [weak controller] c in
- controller?.replace(with: c)
- }
- strongSelf.push(controller)
- } else {
- let _ = (strongSelf.context.engine.peers.currentChatListFilters()
- |> deliverOnMainQueue).startStandalone(next: { presetList in
- guard let strongSelf = self else {
- return
- }
- var found = false
- for filter in presetList {
- if filter.id == id {
- strongSelf.push(chatListFilterPresetController(context: strongSelf.context, currentPreset: filter, updated: { _ in }))
- f(.dismissWithoutContent)
- found = true
- break
- }
- }
- if !found {
- f(.default)
- }
- })
- }
- })
- })))
-
- if let _ = filters.first(where: { $0.id == id }) {
- items.append(.action(ContextMenuActionItem(text: strongSelf.presentationData.strings.ChatList_AddChatsToFolder, icon: { theme in
- return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Add"), color: theme.contextMenu.primaryColor)
- }, action: { c, f in
- c?.dismiss(completion: {
- guard let strongSelf = self else {
- return
- }
-
- if isDisabled {
- let context = strongSelf.context
- var replaceImpl: ((ViewController) -> Void)?
- let controller = PremiumLimitScreen(context: context, subject: .folders, count: strongSelf.tabContainerNode.filtersCount, action: {
- let controller = PremiumIntroScreen(context: context, source: .folders)
- replaceImpl?(controller)
- return true
- })
- replaceImpl = { [weak controller] c in
- controller?.replace(with: c)
- }
- strongSelf.push(controller)
- } else {
- let _ = combineLatest(
- queue: Queue.mainQueue(),
- strongSelf.context.engine.data.get(
- TelegramEngine.EngineData.Item.Peer.Peer(id: strongSelf.context.account.peerId),
- TelegramEngine.EngineData.Item.Configuration.UserLimits(isPremium: false),
- TelegramEngine.EngineData.Item.Configuration.UserLimits(isPremium: true)
- ),
- strongSelf.context.engine.peers.currentChatListFilters()
- ).startStandalone(next: { result, presetList in
- guard let strongSelf = self else {
- return
- }
- var found = false
- for filter in presetList {
- if filter.id == id, case let .filter(_, _, _, data) = filter {
- let (accountPeer, limits, premiumLimits) = result
- let isPremium = accountPeer?.isPremium ?? false
-
- let limit = limits.maxFolderChatsCount
- let premiumLimit = premiumLimits.maxFolderChatsCount
-
- if data.includePeers.peers.count >= premiumLimit {
- let controller = PremiumLimitScreen(context: strongSelf.context, subject: .chatsPerFolder, count: Int32(data.includePeers.peers.count), action: {
- return true
- })
- strongSelf.push(controller)
- f(.dismissWithoutContent)
- return
- } else if data.includePeers.peers.count >= limit && !isPremium {
- var replaceImpl: ((ViewController) -> Void)?
- let controller = PremiumLimitScreen(context: strongSelf.context, subject: .chatsPerFolder, count: Int32(data.includePeers.peers.count), action: {
- let controller = PremiumIntroScreen(context: strongSelf.context, source: .chatsPerFolder)
- replaceImpl?(controller)
- return true
- })
- replaceImpl = { [weak controller] c in
- controller?.replace(with: c)
- }
- strongSelf.push(controller)
- f(.dismissWithoutContent)
- return
- }
-
- let _ = (strongSelf.context.engine.peers.currentChatListFilters()
- |> deliverOnMainQueue).startStandalone(next: { filters in
- guard let strongSelf = self else {
- return
- }
- strongSelf.push(chatListFilterAddChatsController(context: strongSelf.context, filter: filter, allFilters: filters, limit: limits.maxFolderChatsCount, premiumLimit: premiumLimits.maxFolderChatsCount, isPremium: isPremium, presentUndo: { content in
- guard let strongSelf = self else {
- return
- }
- strongSelf.present(UndoOverlayController(presentationData: strongSelf.presentationData, content: content, elevatedLayout: true, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
- }))
- f(.dismissWithoutContent)
- })
- found = true
- break
- }
- }
- if !found {
- f(.default)
- }
- })
- }
- })
- })))
-
- if let filterEntries = strongSelf.tabContainerData?.0 {
- for filter in filterEntries {
- if case let .filter(filterId, _, unread) = filter, filterId == id {
- if unread.value > 0 {
- items.append(.action(ContextMenuActionItem(text: strongSelf.presentationData.strings.ChatList_ReadAll, textColor: .primary, icon: { theme in
- return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/ReadAll"), color: theme.contextMenu.primaryColor)
- }, action: { c, f in
- c?.dismiss(completion: {
- guard let strongSelf = self else {
- return
- }
- strongSelf.readAllInFilter(id: id)
- })
- })))
- }
-
- for filter in filters {
- if filter.id == filterId, case let .filter(_, title, _, data) = filter {
- if let filterPeersAreMuted, filterPeersAreMuted.peerIds.count <= 200 {
- items.append(.action(ContextMenuActionItem(text: filterPeersAreMuted.areMuted ? strongSelf.presentationData.strings.ChatList_ContextUnmuteAll : strongSelf.presentationData.strings.ChatList_ContextMuteAll, textColor: .primary, badge: nil, icon: { theme in
- return generateTintedImage(image: UIImage(bundleImageName: filterPeersAreMuted.areMuted ? "Chat/Context Menu/Unmute" : "Chat/Context Menu/Muted"), color: theme.contextMenu.primaryColor)
- }, action: { c, f in
- c?.dismiss(completion: {
- })
-
- guard let strongSelf = self else {
- return
- }
-
- let _ = (strongSelf.context.engine.peers.updateMultiplePeerMuteSettings(peerIds: filterPeersAreMuted.peerIds, muted: !filterPeersAreMuted.areMuted)
- |> deliverOnMainQueue).startStandalone(completed: {
- guard let strongSelf = self else {
- return
- }
-
- let iconColor: UIColor = .white
- let overlayController: UndoOverlayController
- if !filterPeersAreMuted.areMuted {
- let text = NSMutableAttributedString(string: strongSelf.presentationData.strings.ChatList_ToastFolderMutedV2)
- let folderNameRange = (text.string as NSString).range(of: "{folder}")
- if folderNameRange.location != NSNotFound {
- text.replaceCharacters(in: folderNameRange, with: "")
- text.insert(title.attributedString(attributes: [
- ChatTextInputAttributes.bold: true
- ]), at: folderNameRange.location)
- }
-
- overlayController = UndoOverlayController(presentationData: strongSelf.presentationData, content: .universalWithEntities(context: strongSelf.context, animation: "anim_profilemute", scale: 0.075, colors: [
- "Middle.Group 1.Fill 1": iconColor,
- "Top.Group 1.Fill 1": iconColor,
- "Bottom.Group 1.Fill 1": iconColor,
- "EXAMPLE.Group 1.Fill 1": iconColor,
- "Line.Group 1.Stroke 1": iconColor
- ], title: nil, text: text, animateEntities: title.enableAnimations, customUndoText: nil, timeout: nil), elevatedLayout: false, animateInAsReplacement: true, action: { _ in return false })
- } else {
- let text = NSMutableAttributedString(string: strongSelf.presentationData.strings.ChatList_ToastFolderUnmutedV2)
- let folderNameRange = (text.string as NSString).range(of: "{folder}")
- if folderNameRange.location != NSNotFound {
- text.replaceCharacters(in: folderNameRange, with: "")
- text.insert(title.attributedString(attributes: [
- ChatTextInputAttributes.bold: true
- ]), at: folderNameRange.location)
- }
-
- overlayController = UndoOverlayController(presentationData: strongSelf.presentationData, content: .universalWithEntities(context: strongSelf.context, animation: "anim_profileunmute", scale: 0.075, colors: [
- "Middle.Group 1.Fill 1": iconColor,
- "Top.Group 1.Fill 1": iconColor,
- "Bottom.Group 1.Fill 1": iconColor,
- "EXAMPLE.Group 1.Fill 1": iconColor,
- "Line.Group 1.Stroke 1": iconColor
- ], title: nil, text: text, animateEntities: title.enableAnimations, customUndoText: nil, timeout: nil), elevatedLayout: false, animateInAsReplacement: true, action: { _ in return false })
- }
- strongSelf.present(overlayController, in: .current)
- })
- })))
- }
-
- if !data.includePeers.peers.isEmpty && data.categories.isEmpty && !data.excludeRead && !data.excludeMuted && !data.excludeArchived && data.excludePeers.isEmpty {
- items.append(.action(ContextMenuActionItem(text: strongSelf.presentationData.strings.ChatList_ContextMenuShare, textColor: .primary, badge: data.hasSharedLinks ? nil : ContextMenuActionBadge(value: strongSelf.presentationData.strings.ChatList_ContextMenuBadgeNew, color: .accent, style: .label), icon: { theme in
- return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Link"), color: theme.contextMenu.primaryColor)
- }, action: { c, f in
- c?.dismiss(completion: {
- guard let strongSelf = self else {
- return
- }
- strongSelf.shareFolder(filterId: filterId, data: data, title: title)
- })
- })))
- }
-
- break
- }
- }
-
- break
- }
- }
- }
-
- items.append(.action(ContextMenuActionItem(text: strongSelf.presentationData.strings.ChatList_RemoveFolder, textColor: .destructive, icon: { theme in
- return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Delete"), color: theme.contextMenu.destructiveColor)
- }, action: { c, f in
- c?.dismiss(completion: {
- guard let strongSelf = self else {
- return
- }
- strongSelf.askForFilterRemoval(id: id)
- })
- })))
- }
- } else {
- items.append(.action(ContextMenuActionItem(text: strongSelf.presentationData.strings.ChatList_EditFolders, icon: { theme in
- return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Edit"), color: theme.contextMenu.primaryColor)
- }, action: { c, f in
- c?.dismiss(completion: {
- guard let strongSelf = self else {
- return
- }
- strongSelf.openFilterSettings()
- })
- })))
- }
-
- if filters.count > 1 {
- items.append(.separator)
- items.append(.action(ContextMenuActionItem(text: strongSelf.presentationData.strings.ChatList_ReorderTabs, icon: { theme in
- return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/ReorderItems"), color: theme.contextMenu.primaryColor)
- }, action: { c, f in
- c?.dismiss(completion: {
- guard let strongSelf = self else {
- return
- }
-
- strongSelf.chatListDisplayNode.isReorderingFilters = true
- strongSelf.isReorderingTabsValue.set(true)
-
- //TODO:update search enabled
- //strongSelf.searchContentNode?.setIsEnabled(false, animated: true)
-
- (strongSelf.parent as? TabBarController)?.updateIsTabBarEnabled(false, transition: .animated(duration: 0.2, curve: .easeInOut))
- if let layout = strongSelf.validLayout {
- strongSelf.updateLayout(layout: layout, transition: .animated(duration: 0.2, curve: .easeInOut))
- }
- })
- })))
- }
-
- let controller = ContextController(presentationData: strongSelf.presentationData, source: .extracted(ChatListHeaderBarContextExtractedContentSource(controller: strongSelf, sourceNode: sourceNode, keepInPlace: keepInPlace)), items: .single(ContextController.Items(content: .list(items))), recognizer: nil, gesture: gesture)
- strongSelf.context.sharedContext.mainWindow?.presentInGlobalOverlay(controller)
- })
- }
- self.tabContainerNode.contextGesture = { id, sourceNode, gesture, isDisabled in
- tabContextGesture(id, sourceNode, gesture, false, isDisabled)
- }
-
if case .chatList(.root) = self.location {
self.ready.set(combineLatest([self.mainReady.get(), self.storiesReady.get()])
|> map { values -> Bool in
@@ -2433,7 +2380,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
}
let context = strongSelf.context
var replaceImpl: ((ViewController) -> Void)?
- let controller = PremiumLimitScreen(context: context, subject: .folders, count: strongSelf.tabContainerNode.filtersCount, action: {
+ let controller = PremiumLimitScreen(context: context, subject: .folders, count: Int32(strongSelf.tabContainerData?.0.count ?? 0), action: {
let controller = PremiumIntroScreen(context: context, source: .folders)
replaceImpl?(controller)
return true
@@ -2598,13 +2545,25 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
guard let strongSelf, currentValues.contains(.setupPasskey) else {
return
}
- if let navigationController = strongSelf.navigationController as? NavigationController {
- let controller = strongSelf.context.sharedContext.makePasskeySetupController(context: strongSelf.context, displaySkip: true, navigationController: navigationController, completion: {
- let _ = context.engine.notices.dismissServerProvidedSuggestion(suggestion: ServerProvidedSuggestion.setupPasskey.id).startStandalone()
- }, dismiss: {
- let _ = context.engine.notices.dismissServerProvidedSuggestion(suggestion: ServerProvidedSuggestion.setupPasskey.id).startStandalone()
- })
- navigationController.pushViewController(controller)
+
+ Task { @MainActor [weak strongSelf] in
+ guard let strongSelf else {
+ return
+ }
+
+ let passkeysData = await strongSelf.context.engine.auth.passkeysData().get()
+ if !passkeysData.isEmpty {
+ return
+ }
+
+ if let navigationController = strongSelf.navigationController as? NavigationController {
+ let controller = strongSelf.context.sharedContext.makePasskeySetupController(context: strongSelf.context, displaySkip: true, navigationController: navigationController, completion: {
+ let _ = context.engine.notices.dismissServerProvidedSuggestion(suggestion: ServerProvidedSuggestion.setupPasskey.id).startStandalone()
+ }, dismiss: {
+ let _ = context.engine.notices.dismissServerProvidedSuggestion(suggestion: ServerProvidedSuggestion.setupPasskey.id).startStandalone()
+ })
+ navigationController.pushViewController(controller)
+ }
}
})
@@ -2618,7 +2577,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
return
}
strongSelf.didSuggestAutoarchive = true
- strongSelf.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: strongSelf.presentationData.strings.ChatList_AutoarchiveSuggestion_Title, text: strongSelf.presentationData.strings.ChatList_AutoarchiveSuggestion_Text, actions: [
+ strongSelf.present(textAlertController(context: strongSelf.context, title: strongSelf.presentationData.strings.ChatList_AutoarchiveSuggestion_Title, text: strongSelf.presentationData.strings.ChatList_AutoarchiveSuggestion_Text, actions: [
TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Common_Cancel, action: {
guard let strongSelf = self else {
return
@@ -2670,7 +2629,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
return true
}
- controller.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: strongSelf.presentationData.strings.ForcedPasswordSetup_Intro_DismissTitle, text: strongSelf.presentationData.strings.ForcedPasswordSetup_Intro_DismissText(value), actions: [
+ controller.present(textAlertController(context: strongSelf.context, title: strongSelf.presentationData.strings.ForcedPasswordSetup_Intro_DismissTitle, text: strongSelf.presentationData.strings.ForcedPasswordSetup_Intro_DismissText(value), actions: [
TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.ForcedPasswordSetup_Intro_DismissActionCancel, action: {
}),
TextAlertAction(type: .destructiveAction, title: strongSelf.presentationData.strings.ForcedPasswordSetup_Intro_DismissActionOK, action: { [weak controller] in
@@ -2863,14 +2822,9 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
func updateHeaderContent() -> (primaryContent: ChatListHeaderComponent.Content?, secondaryContent: ChatListHeaderComponent.Content?) {
var primaryContent: ChatListHeaderComponent.Content?
if let primaryContext = self.primaryContext {
- var backTitle: String?
- if let previousItem = self.previousItem {
- switch previousItem {
- case let .item(item):
- backTitle = item.title ?? self.presentationData.strings.Common_Back
- case .close:
- backTitle = self.presentationData.strings.Common_Close
- }
+ var displayBackButton: Bool = false
+ if self.previousItem != nil {
+ displayBackButton = true
}
var navigationBackTitle: String?
if case .chatList(.archive) = self.location {
@@ -2883,8 +2837,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
chatListTitle: primaryContext.chatListTitle,
leftButton: primaryContext.leftButton,
rightButtons: primaryContext.rightButtons,
- backTitle: backTitle,
- backPressed: backTitle != nil ? { [weak self] in
+ backPressed: displayBackButton ? { [weak self] in
guard let self else {
return
}
@@ -2901,7 +2854,6 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
chatListTitle: secondaryContext.chatListTitle,
leftButton: secondaryContext.leftButton,
rightButtons: secondaryContext.rightButtons,
- backTitle: nil,
backPressed: { [weak self] in
guard let self else {
return
@@ -2934,7 +2886,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
self.push(controller)
return
}
-
+
var reachedCountLimit = false
var premiumNeeded = false
var hasActiveCall = false
@@ -3083,7 +3035,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
}
func displayContinueLiveStream() {
- self.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: self.presentationData.strings.ChatList_AlertResumeLiveStreamTitle, text: self.presentationData.strings.ChatList_AlertResumeLiveStreamText, actions: [
+ self.present(textAlertController(context: self.context, title: self.presentationData.strings.ChatList_AlertResumeLiveStreamTitle, text: self.presentationData.strings.ChatList_AlertResumeLiveStreamText, actions: [
TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {
}),
TextAlertAction(type: .defaultAction, title: presentationData.strings.ChatList_AlertResumeLiveStreamAction, action: { [weak self] in
@@ -3473,7 +3425,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
})))
}
- let controller = ContextController(presentationData: self.presentationData, source: .extracted(ChatListHeaderBarContextExtractedContentSource(controller: self, sourceNode: sourceNode, keepInPlace: false)), items: .single(ContextController.Items(content: .list(items))), recognizer: nil, gesture: gesture)
+ let controller = ContextController(presentationData: self.presentationData, source: .extracted(ChatListHeaderBarContextExtractedContentSource(controller: self, sourceNode: sourceNode, sourceView: nil, keepInPlace: false)), items: .single(ContextController.Items(content: .list(items))), recognizer: nil, gesture: gesture)
self.context.sharedContext.mainWindow?.presentInGlobalOverlay(controller)
})
}
@@ -3550,14 +3502,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
tabContainerOffset += 44.0 + 20.0
}
- let navigationBarHeight: CGFloat = 0.0//self.navigationBar?.frame.maxY ?? 0.0
- //let secondaryContentHeight = self.navigationBar?.secondaryContentHeight ?? 0.0
-
- transition.updateFrame(node: self.tabContainerNode, frame: CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: layout.size.width, height: 46.0)))
-
- if !skipTabContainerUpdate {
- self.tabContainerNode.update(size: CGSize(width: layout.size.width, height: 46.0), sideInset: layout.safeInsets.left, filters: self.tabContainerData?.0 ?? [], selectedFilter: self.chatListDisplayNode.mainContainerNode.currentItemFilter, isReordering: self.chatListDisplayNode.isReorderingFilters || (self.chatListDisplayNode.effectiveContainerNode.currentItemNode.currentState.editing && !self.chatListDisplayNode.didBeginSelectingChatsWhileEditing), isEditing: self.chatListDisplayNode.effectiveContainerNode.currentItemNode.currentState.editing, canReorderAllChats: self.isPremium, filtersLimit: self.tabContainerData?.2, transitionFraction: self.chatListDisplayNode.effectiveContainerNode.transitionFraction, presentationData: self.presentationData, transition: .animated(duration: 0.4, curve: .spring))
- }
+ let navigationBarHeight: CGFloat = 0.0
self.chatListDisplayNode.containerLayoutUpdated(layout, navigationBarHeight: navigationBarHeight, visualNavigationHeight: navigationBarHeight, cleanNavigationBarHeight: navigationBarHeight, storiesInset: 0.0, transition: transition)
}
@@ -3643,10 +3588,35 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
return id
}
}
+ let _ = defaultFilterIds
var reorderedFilterIdsValue: [Int32]?
- if let reorderedFilterIds = self.tabContainerNode.reorderedFilterIds, reorderedFilterIds != defaultFilterIds {
- reorderedFilterIdsValue = reorderedFilterIds
+ if let navigationBarView = self.chatListDisplayNode.navigationBarView.view as? ChatListNavigationBar.View, let headerPanelsView = navigationBarView.headerPanels as? HeaderPanelContainerComponent.View, let tabsView = headerPanelsView.tabs as? HorizontalTabsComponent.View, let reorderedItemIds = tabsView.reorderedItemIds {
+ reorderedFilterIdsValue = reorderedItemIds.compactMap { item -> Int32? in
+ guard let value = item.base as? Int32 else {
+ return nil
+ }
+ if value == Int32.min {
+ return 0
+ }
+ return value
+ }
+ }
+
+ if let reorderedFilterIdsValue, let tabContainerData = self.tabContainerData {
+ var entries: [ChatListFilterTabEntry] = []
+ for id in reorderedFilterIdsValue {
+ let mappedId: ChatListFilterTabEntryId
+ if id == 0 {
+ mappedId = .all
+ } else {
+ mappedId = .filter(id)
+ }
+ if let entry = tabContainerData.0.first(where: { $0.id == mappedId }) {
+ entries.append(entry)
+ }
+ }
+ self.tabContainerData?.0 = entries
}
let completion = { [weak self] in
@@ -4095,11 +4065,8 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
if let layout = strongSelf.validLayout {
if wasEmpty != isEmpty {
let transition: ContainedViewLayoutTransition = animated ? .animated(duration: 0.2, curve: .easeInOut) : .immediate
- transition.updateAlpha(node: strongSelf.tabContainerNode, alpha: isEmpty ? 0.0 : 1.0)
strongSelf.containerLayoutUpdated(layout, transition: transition)
(strongSelf.parent as? TabBarController)?.updateLayout(transition: transition)
- } else {
- strongSelf.tabContainerNode.update(size: CGSize(width: layout.size.width, height: 46.0), sideInset: layout.safeInsets.left, filters: resolvedItems, selectedFilter: selectedEntryId, isReordering: strongSelf.chatListDisplayNode.isReorderingFilters || (strongSelf.chatListDisplayNode.mainContainerNode.currentItemNode.currentState.editing && !strongSelf.chatListDisplayNode.didBeginSelectingChatsWhileEditing), isEditing: strongSelf.chatListDisplayNode.mainContainerNode.currentItemNode.currentState.editing, canReorderAllChats: strongSelf.isPremium, filtersLimit: filtersLimit, transitionFraction: strongSelf.chatListDisplayNode.mainContainerNode.transitionFraction, presentationData: strongSelf.presentationData, transition: .animated(duration: 0.4, curve: .spring))
}
}
@@ -4114,7 +4081,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
}))
}
- private func selectTab(id: ChatListFilterTabEntryId, switchToChatsIfNeeded: Bool = true) {
+ func selectTab(id: ChatListFilterTabEntryId, switchToChatsIfNeeded: Bool = true) {
if self.parent == nil, switchToChatsIfNeeded {
if let navigationController = self.context.sharedContext.mainWindow?.viewController as? NavigationController {
for controller in navigationController.viewControllers {
@@ -4510,7 +4477,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
})
}
- private func askForFilterRemoval(id: Int32) {
+ func askForFilterRemoval(id: Int32) {
let apply: () -> Void = { [weak self] in
guard let strongSelf = self else {
return
@@ -4621,7 +4588,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
}
if hasLinks {
- self.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: presentationData.strings.ChatList_AlertDeleteFolderTitle, text: presentationData.strings.ChatList_AlertDeleteFolderText, actions: [
+ self.present(textAlertController(context: self.context, title: presentationData.strings.ChatList_AlertDeleteFolderTitle, text: presentationData.strings.ChatList_AlertDeleteFolderText, actions: [
TextAlertAction(type: .destructiveAction, title: presentationData.strings.Common_Delete, action: {
confirmDeleteFolder()
}),
@@ -4658,14 +4625,16 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
public private(set) var isSearchActive: Bool = false
public func activateSearch(filter: ChatListSearchFilter, query: String? = nil) {
+ self.activateSearchInternal(isFromTabBar: false, filter: filter, query: query)
+ }
+
+ public func activateSearchInternal(isFromTabBar: Bool, filter: ChatListSearchFilter, query: String? = nil) {
var searchContentNode: NavigationBarSearchContentNode?
- if let navigationBarView = self.chatListDisplayNode.navigationBarView.view as? ChatListNavigationBar.View {
+ if !isFromTabBar, let navigationBarView = self.chatListDisplayNode.navigationBarView.view as? ChatListNavigationBar.View {
searchContentNode = navigationBarView.searchContentNode
}
- if let searchContentNode {
- self.activateSearch(filter: filter, query: query, skipScrolling: false, searchContentNode: searchContentNode)
- }
+ self.activateSearch(filter: filter, query: query, skipScrolling: false, searchContentNode: searchContentNode)
}
public func activateSearch(query: String? = nil) {
@@ -4679,88 +4648,70 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
}
private var previousSearchToggleTimestamp: Double?
- func activateSearch(filter: ChatListSearchFilter = .chats, query: String? = nil, skipScrolling: Bool = false, searchContentNode: NavigationBarSearchContentNode) {
- let currentTimestamp = CACurrentMediaTime()
- if let previousSearchActivationTimestamp = self.previousSearchToggleTimestamp, currentTimestamp < previousSearchActivationTimestamp + 0.6 {
- return
- }
- self.previousSearchToggleTimestamp = currentTimestamp
-
- if let storyTooltip = self.storyTooltip {
- storyTooltip.dismiss()
- }
-
- var filter = filter
- if case .forum = self.chatListDisplayNode.effectiveContainerNode.location {
- filter = .topics
- }
-
- if self.chatListDisplayNode.searchDisplayController == nil {
- /*if !skipScrolling, let searchContentNode = self.searchContentNode, searchContentNode.expansionProgress != 1.0 {
- self.scrollToTop?()
- DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.2, execute: { [weak self] in
- self?.activateSearch(filter: filter, query: query, skipScrolling: true)
- })
+ func activateSearch(filter: ChatListSearchFilter = .chats, query: String? = nil, skipScrolling: Bool = false, searchContentNode: NavigationBarSearchContentNode?) {
+ Task { @MainActor [weak self] in
+ guard let self else {
return
- }*/
- //TODO:scroll to top?
+ }
+
+ let currentTimestamp = CACurrentMediaTime()
+ if let previousSearchActivationTimestamp = self.previousSearchToggleTimestamp, currentTimestamp < previousSearchActivationTimestamp + 0.6 {
+ return
+ }
+ self.previousSearchToggleTimestamp = currentTimestamp
- let _ = (combineLatest(self.chatListDisplayNode.mainContainerNode.currentItemNode.contentsReady |> take(1), self.context.account.postbox.tailChatListView(groupId: .root, count: 16, summaryComponents: ChatListEntrySummaryComponents(components: [:])) |> take(1))
- |> deliverOnMainQueue).startStandalone(next: { [weak self] _, chatListView in
- Task { @MainActor in
- guard let strongSelf = self else {
- return
- }
-
- /*if let scrollToTop = strongSelf.scrollToTop {
- scrollToTop()
- }*/
-
- let tabsIsEmpty: Bool
- if let (resolvedItems, displayTabsAtBottom, _) = strongSelf.tabContainerData {
- tabsIsEmpty = resolvedItems.count <= 1 || displayTabsAtBottom
- } else {
- tabsIsEmpty = true
- }
- let _ = tabsIsEmpty
- //TODO:swap tabs
-
+ if let storyTooltip = self.storyTooltip {
+ storyTooltip.dismiss()
+ }
+
+ var filter = filter
+ if case .forum = self.chatListDisplayNode.effectiveContainerNode.location {
+ filter = .topics
+ }
+
+ if self.chatListDisplayNode.searchDisplayController == nil {
+ let (_, _) = await combineLatest(self.chatListDisplayNode.mainContainerNode.currentItemNode.contentsReady |> take(1), self.context.account.postbox.tailChatListView(groupId: .root, count: 16, summaryComponents: ChatListEntrySummaryComponents(components: [:])) |> take(1)).get()
+
+ do {
let displaySearchFilters = true
- if let filterContainerNodeAndActivate = await strongSelf.chatListDisplayNode.activateSearch(placeholderNode: searchContentNode.placeholderNode, displaySearchFilters: displaySearchFilters, hasDownloads: strongSelf.hasDownloads, initialFilter: filter, navigationController: strongSelf.navigationController as? NavigationController) {
- let (filterContainerNode, activate) = filterContainerNodeAndActivate
- if displaySearchFilters {
- let searchTabsNode = SparseNode()
- strongSelf.searchTabsNode = searchTabsNode
- searchTabsNode.addSubnode(filterContainerNode)
- }
+ if let filterContainerNodeAndActivate = await self.chatListDisplayNode.activateSearch(placeholderNode: searchContentNode?.placeholderNode, displaySearchFilters: displaySearchFilters, hasDownloads: self.hasDownloads, initialFilter: filter, navigationController: self.navigationController as? NavigationController, searchBarIsExternal: searchContentNode == nil) {
+ let activate = filterContainerNodeAndActivate
activate(filter != .downloads)
- if let searchContentNode = strongSelf.chatListDisplayNode.searchDisplayController?.contentNode as? ChatListSearchContainerNode {
+ if let searchContentNode = self.chatListDisplayNode.searchDisplayController?.contentNode as? ChatListSearchContainerNode {
searchContentNode.search(filter: filter, query: query)
}
}
let transition: ContainedViewLayoutTransition = .animated(duration: 0.4, curve: .spring)
- strongSelf.setDisplayNavigationBar(false, transition: transition)
-
- (strongSelf.parent as? TabBarController)?.updateIsTabBarHidden(true, transition: .animated(duration: 0.4, curve: .spring))
- }
- })
-
- self.isSearchActive = true
- if let navigationController = self.navigationController as? NavigationController {
- for controller in navigationController.globalOverlayControllers {
- if let controller = controller as? VoiceChatOverlayController {
- controller.updateVisibility()
- break
+ self.setDisplayNavigationBar(false, transition: transition)
+ if searchContentNode == nil {
+ self.updateTabBarSearchState(ViewController.TabBarSearchState(isActive: true), transition: transition)
+
+ if let searchBarNode = self.currentTabBarSearchNode?() as? SearchBarNode {
+ self.chatListDisplayNode.searchDisplayController?.setSearchBar(searchBarNode)
+ searchBarNode.activate()
+ }
+ } else {
+ (self.parent as? TabBarController)?.updateIsTabBarHidden(true, transition: transition)
+ }
+
+ self.isSearchActive = true
+ if let navigationController = self.navigationController as? NavigationController {
+ for controller in navigationController.globalOverlayControllers {
+ if let controller = controller as? VoiceChatOverlayController {
+ controller.updateVisibility()
+ break
+ }
+ }
}
}
- }
- } else if self.isSearchActive {
- if let searchContentNode = self.chatListDisplayNode.searchDisplayController?.contentNode as? ChatListSearchContainerNode {
- searchContentNode.search(filter: filter, query: query)
+ } else if self.isSearchActive {
+ if let searchContentNode = self.chatListDisplayNode.searchDisplayController?.contentNode as? ChatListSearchContainerNode {
+ searchContentNode.search(filter: filter, query: query)
+ }
}
}
}
@@ -4777,8 +4728,6 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
var completion: (() -> Void)?
- self.searchTabsNode = nil
-
var searchContentNode: NavigationBarSearchContentNode?
if let navigationBarView = self.chatListDisplayNode.navigationBarView.view as? ChatListNavigationBar.View {
searchContentNode = navigationBarView.searchContentNode
@@ -4791,21 +4740,21 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
}
completion = self.chatListDisplayNode.deactivateSearch(placeholderNode: searchContentNode.placeholderNode, animated: animated)
searchContentNode.placeholderNode.frame = previousFrame
+ } else {
+ completion = self.chatListDisplayNode.deactivateSearch(placeholderNode: nil, animated: animated)
}
self.chatListDisplayNode.tempAllowAvatarExpansion = true
self.requestLayout(transition: .animated(duration: 0.5, curve: .spring))
self.chatListDisplayNode.tempAllowAvatarExpansion = false
- //TODO:swap tabs
-
let transition: ContainedViewLayoutTransition = animated ? .animated(duration: 0.4, curve: .spring) : .immediate
- //transition.updateAlpha(node: self.tabContainerNode, alpha: tabsIsEmpty ? 0.0 : 1.0)
self.setDisplayNavigationBar(true, transition: transition)
completion?()
- (self.parent as? TabBarController)?.updateIsTabBarHidden(false, transition: .animated(duration: 0.4, curve: .spring))
+ self.updateTabBarSearchState(ViewController.TabBarSearchState(isActive: false), transition: transition)
+ (self.parent as? TabBarController)?.updateIsTabBarHidden(false, transition: transition)
self.isSearchActive = false
if let navigationController = self.navigationController as? NavigationController {
@@ -5498,7 +5447,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
deleteForAllConfirmation = strongSelf.presentationData.strings.ChannelInfo_DeleteGroupConfirmation
}
- strongSelf.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: strongSelf.presentationData.strings.ChatList_DeleteForEveryoneConfirmationTitle, text: deleteForAllConfirmation, actions: [
+ strongSelf.present(textAlertController(context: strongSelf.context, title: strongSelf.presentationData.strings.ChatList_DeleteForEveryoneConfirmationTitle, text: deleteForAllConfirmation, actions: [
TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Common_Cancel, action: {
}),
TextAlertAction(type: .destructiveAction, title: strongSelf.presentationData.strings.ChatList_DeleteForEveryoneConfirmationAction, action: {
@@ -5613,7 +5562,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
])
strongSelf.present(actionSheet, in: .window(.root))
} else {
- strongSelf.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: strongSelf.presentationData.strings.ChatList_DeleteSavedMessagesConfirmationTitle, text: strongSelf.presentationData.strings.ChatList_DeleteSavedMessagesConfirmationText, actions: [
+ strongSelf.present(textAlertController(context: strongSelf.context, title: strongSelf.presentationData.strings.ChatList_DeleteSavedMessagesConfirmationTitle, text: strongSelf.presentationData.strings.ChatList_DeleteSavedMessagesConfirmationText, actions: [
TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Common_Cancel, action: {
}),
TextAlertAction(type: .destructiveAction, title: strongSelf.presentationData.strings.ChatList_DeleteSavedMessagesConfirmationAction, action: {
@@ -5681,7 +5630,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
deleteForAllConfirmation = strongSelf.presentationData.strings.ChatList_DeleteForAllMembersConfirmationText
}
- strongSelf.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: strongSelf.presentationData.strings.ChatList_DeleteForEveryoneConfirmationTitle, text: deleteForAllConfirmation, actions: [
+ strongSelf.present(textAlertController(context: strongSelf.context, title: strongSelf.presentationData.strings.ChatList_DeleteForEveryoneConfirmationTitle, text: deleteForAllConfirmation, actions: [
TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Common_Cancel, action: {
}),
TextAlertAction(type: .destructiveAction, title: strongSelf.presentationData.strings.ChatList_DeleteForEveryoneConfirmationAction, action: {
@@ -5889,7 +5838,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
guard let strongSelf = self else {
return
}
- strongSelf.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: strongSelf.presentationData.strings.ChatList_DeleteForEveryoneConfirmationTitle, text: strongSelf.presentationData.strings.ChatList_DeleteForEveryoneConfirmationText, actions: [
+ strongSelf.present(textAlertController(context: strongSelf.context, title: strongSelf.presentationData.strings.ChatList_DeleteForEveryoneConfirmationTitle, text: strongSelf.presentationData.strings.ChatList_DeleteForEveryoneConfirmationText, actions: [
TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Common_Cancel, action: {
completion(false)
}),
@@ -5913,7 +5862,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
])
self.present(actionSheet, in: .window(.root))
} else if peer.peerId == self.context.account.peerId {
- self.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: self.presentationData.strings.ChatList_DeleteSavedMessagesConfirmationTitle, text: self.presentationData.strings.ChatList_DeleteSavedMessagesConfirmationText, actions: [
+ self.present(textAlertController(context: self.context, title: self.presentationData.strings.ChatList_DeleteSavedMessagesConfirmationTitle, text: self.presentationData.strings.ChatList_DeleteSavedMessagesConfirmationText, actions: [
TextAlertAction(type: .genericAction, title: self.presentationData.strings.Common_Cancel, action: {
completion(false)
}),
@@ -6237,7 +6186,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
if isDisabled {
let context = strongSelf.context
var replaceImpl: ((ViewController) -> Void)?
- let controller = PremiumLimitScreen(context: context, subject: .folders, count: strongSelf.tabContainerNode.filtersCount, action: {
+ let controller = PremiumLimitScreen(context: context, subject: .folders, count: Int32(strongSelf.tabContainerData?.0.count ?? 0), action: {
let controller = PremiumIntroScreen(context: context, source: .folders)
replaceImpl?(controller)
return true
@@ -6261,6 +6210,14 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
strongSelf.context.sharedContext.mainWindow?.presentInGlobalOverlay(controller)
})
}
+
+ override public func tabBarActivateSearch() {
+ self.activateSearchInternal(isFromTabBar: true, filter: .chats, query: nil)
+ }
+
+ override public func tabBarDeactivateSearch() {
+ self.deactivateSearch(animated: true)
+ }
private var playedSignUpCompletedAnimation = false
public func playSignUpCompletedAnimation() {
@@ -6541,22 +6498,49 @@ private final class ChatListTabBarContextReferenceContentSource: ContextReferenc
}
}
+private final class ChatListHeaderBarContextReferenceContentSource: ContextReferenceContentSource {
+ let keepInPlace: Bool = true
+ let actionsHorizontalAlignment: ContextActionsHorizontalAlignment = .center
+
+ private let controller: ChatListController
+ private let sourceView: ContextExtractedContentContainingView
+
+ init(controller: ChatListController, sourceView: ContextExtractedContentContainingView) {
+ self.controller = controller
+ self.sourceView = sourceView
+ }
+
+ func transitionInfo() -> ContextControllerReferenceViewInfo? {
+ return ContextControllerReferenceViewInfo(
+ referenceView: self.sourceView.contentView,
+ contentAreaInScreenSpace: UIScreen.main.bounds,
+ actionsPosition: .bottom
+ )
+ }
+}
+
private final class ChatListHeaderBarContextExtractedContentSource: ContextExtractedContentSource {
let keepInPlace: Bool
let ignoreContentTouches: Bool = true
let blurBackground: Bool = true
private let controller: ChatListController
- private let sourceNode: ContextExtractedContentContainingNode
+ private let sourceNode: ContextExtractedContentContainingNode?
+ private let sourceView: ContextExtractedContentContainingView?
- init(controller: ChatListController, sourceNode: ContextExtractedContentContainingNode, keepInPlace: Bool) {
+ init(controller: ChatListController, sourceNode: ContextExtractedContentContainingNode?, sourceView: ContextExtractedContentContainingView?, keepInPlace: Bool) {
self.controller = controller
self.sourceNode = sourceNode
+ self.sourceView = sourceView
self.keepInPlace = keepInPlace
}
func takeView() -> ContextControllerTakeViewInfo? {
- return ContextControllerTakeViewInfo(containingItem: .node(self.sourceNode), contentAreaInScreenSpace: UIScreen.main.bounds)
+ if let sourceNode = self.sourceNode {
+ return ContextControllerTakeViewInfo(containingItem: .node(sourceNode), contentAreaInScreenSpace: UIScreen.main.bounds)
+ } else {
+ return ContextControllerTakeViewInfo(containingItem: .view(self.sourceView!), contentAreaInScreenSpace: UIScreen.main.bounds)
+ }
}
func putBack() -> ContextControllerPutBackViewInfo? {
@@ -6954,6 +6938,7 @@ private final class ChatListLocationContext {
}
if strongSelf.toolbar != toolbar {
strongSelf.toolbar = toolbar
+ transition = .animated(duration: 0.4, curve: .spring)
if parentController.effectiveContext === strongSelf {
parentController.setToolbar(toolbar, transition: transition)
}
@@ -7221,7 +7206,10 @@ private final class ChatListLocationContext {
strings: presentationData.strings,
dateTimeFormat: presentationData.dateTimeFormat,
nameDisplayOrder: presentationData.nameDisplayOrder,
- content: .custom(presentationData.strings.ChatList_SelectedTopics(Int32(stateAndFilterId.state.selectedThreadIds.count)), nil, false),
+ displayBackground: false,
+ content: .custom(title: [ChatTitleContent.TitleTextItem(id: AnyHashable(0), content: .text(presentationData.strings.ChatList_SelectedTopics(Int32(stateAndFilterId.state.selectedThreadIds.count))))], subtitle: nil, isEnabled: false),
+ activities: nil,
+ networkState: nil,
tapped: {
},
longTapped: {
@@ -7234,7 +7222,10 @@ private final class ChatListLocationContext {
strings: presentationData.strings,
dateTimeFormat: presentationData.dateTimeFormat,
nameDisplayOrder: presentationData.nameDisplayOrder,
+ displayBackground: false,
content: .peer(peerView: ChatTitleContent.PeerData(peerView: peerView), customTitle: nil, customSubtitle: nil, onlineMemberCount: onlineMemberCount, isScheduledMessages: false, isMuted: nil, customMessageCount: nil, isEnabled: true),
+ activities: nil,
+ networkState: nil,
tapped: { [weak self] in
guard let self else {
return
diff --git a/submodules/ChatListUI/Sources/ChatListControllerNode.swift b/submodules/ChatListUI/Sources/ChatListControllerNode.swift
index 3a835731..9847039d 100644
--- a/submodules/ChatListUI/Sources/ChatListControllerNode.swift
+++ b/submodules/ChatListUI/Sources/ChatListControllerNode.swift
@@ -21,7 +21,13 @@ import ChatFolderLinkPreviewScreen
import ChatListHeaderComponent
import StoryPeerListComponent
import TelegramNotices
-import EdgeEffect
+import HeaderPanelContainerComponent
+import HorizontalTabsComponent
+import PremiumUI
+import MediaPlaybackHeaderPanelComponent
+import LiveLocationHeaderPanelComponent
+import ChatListHeaderNoticeComponent
+import ChatListFilterTabContainerNode
public enum ChatListContainerNodeFilter: Equatable {
case all
@@ -132,6 +138,7 @@ public final class ChatListContainerNode: ASDisplayNode, ASGestureRecognizerDele
}
public var currentItemFilterUpdated: ((ChatListFilterTabEntryId, CGFloat, ContainedViewLayoutTransition, Bool) -> Void)?
+ public private(set) var isSwitchingCurrentItemFilterByDragging: Bool = false
public var currentItemFilter: ChatListFilterTabEntryId {
return self.currentItemNode.chatListFilter.flatMap { .filter($0.id) } ?? .all
}
@@ -575,6 +582,7 @@ public final class ChatListContainerNode: ASDisplayNode, ASGestureRecognizerDele
itemNode.layer.removeAllAnimations()
}
self.update(layout: layout, navigationBarHeight: navigationBarHeight, visualNavigationHeight: visualNavigationHeight, originalNavigationHeight: originalNavigationHeight, cleanNavigationBarHeight: cleanNavigationBarHeight, insets: insets, isReorderingFilters: isReorderingFilters, isEditing: isEditing, inlineNavigationLocation: inlineNavigationLocation, inlineNavigationTransitionFraction: inlineNavigationTransitionFraction, storiesInset: storiesInset, transition: .immediate)
+ self.isSwitchingCurrentItemFilterByDragging = true
self.currentItemFilterUpdated?(self.currentItemFilter, self.transitionFraction, .immediate, true)
}
}
@@ -651,6 +659,7 @@ public final class ChatListContainerNode: ASDisplayNode, ASGestureRecognizerDele
}
}
self.update(layout: layout, navigationBarHeight: navigationBarHeight, visualNavigationHeight: visualNavigationHeight, originalNavigationHeight: originalNavigationHeight, cleanNavigationBarHeight: cleanNavigationBarHeight, insets: insets, isReorderingFilters: isReorderingFilters, isEditing: isEditing, inlineNavigationLocation: inlineNavigationLocation, inlineNavigationTransitionFraction: inlineNavigationTransitionFraction, storiesInset: storiesInset, transition: .immediate)
+ self.isSwitchingCurrentItemFilterByDragging = true
self.currentItemFilterUpdated?(self.currentItemFilter, self.transitionFraction, transition, false)
}
case .cancelled, .ended:
@@ -712,6 +721,7 @@ public final class ChatListContainerNode: ASDisplayNode, ASGestureRecognizerDele
if let switchToId = applyNodeAsCurrent, let itemNode = self.itemNodes[switchToId] {
self.applyItemNodeAsCurrent(id: switchToId, itemNode: itemNode)
}
+ self.isSwitchingCurrentItemFilterByDragging = false
self.currentItemFilterUpdated?(self.currentItemFilter, self.transitionFraction, transition, false)
}
default:
@@ -1091,9 +1101,10 @@ final class ChatListControllerNode: ASDisplayNode, ASGestureRecognizerDelegate {
private var toolbarNode: ToolbarNode?
var toolbarActionSelected: ((ToolbarActionOption) -> Void)?
- private var isSearchDisplayControllerActive: Bool = false
+ private var isSearchDisplayControllerActive: ChatListNavigationBar.ActiveSearch?
private var skipSearchDisplayControllerLayout: Bool = false
private(set) var searchDisplayController: SearchDisplayController?
+ private var disappearingSearchDisplayController: SearchDisplayController?
var isReorderingFilters: Bool = false
var didBeginSelectingChatsWhileEditing: Bool = false
@@ -1353,14 +1364,226 @@ final class ChatListControllerNode: ASDisplayNode, ASGestureRecognizerDelegate {
private func updateNavigationBar(layout: ContainerViewLayout, deferScrollApplication: Bool, transition: ComponentTransition) -> (navigationHeight: CGFloat, storiesInset: CGFloat) {
let headerContent = self.controller?.updateHeaderContent()
- var tabsNode: ASDisplayNode?
- var tabsNodeIsSearch = false
+ var panels: [HeaderPanelContainerComponent.Panel] = []
+ if let chatListNotice = self.controller?.globalControlPanelsContextState?.chatListNotice {
+ panels.append(HeaderPanelContainerComponent.Panel(
+ key: "chatListNotice",
+ orderIndex: 0,
+ component: AnyComponent(ChatListHeaderNoticeComponent(
+ context: self.context,
+ theme: self.presentationData.theme,
+ strings: self.presentationData.strings,
+ data: chatListNotice,
+ activateAction: { [weak self] notice in
+ guard let self else {
+ return
+ }
+ switch notice {
+ case .clearStorage:
+ self.effectiveContainerNode.currentItemNode.interaction?.openStorageManagement()
+ case .setupPassword:
+ self.effectiveContainerNode.currentItemNode.interaction?.openPasswordSetup()
+ case .premiumUpgrade, .premiumAnnualDiscount, .premiumRestore:
+ self.effectiveContainerNode.currentItemNode.interaction?.openPremiumIntro()
+ case .xmasPremiumGift:
+ self.effectiveContainerNode.currentItemNode.interaction?.openPremiumGift([], nil)
+ case .premiumGrace:
+ self.effectiveContainerNode.currentItemNode.interaction?.openPremiumManagement()
+ case .setupBirthday:
+ self.effectiveContainerNode.currentItemNode.interaction?.openBirthdaySetup()
+ case let .birthdayPremiumGift(peers, birthdays):
+ self.effectiveContainerNode.currentItemNode.interaction?.openPremiumGift(peers, birthdays)
+ case .reviewLogin:
+ break
+ case let .starsSubscriptionLowBalance(amount, _):
+ self.effectiveContainerNode.currentItemNode.interaction?.openStarsTopup(amount.value)
+ case .setupPhoto:
+ self.effectiveContainerNode.currentItemNode.interaction?.openPhotoSetup()
+ case .accountFreeze:
+ self.effectiveContainerNode.currentItemNode.interaction?.openAccountFreezeInfo()
+ case let .link(_, url, _, _):
+ self.effectiveContainerNode.currentItemNode.interaction?.openUrl(url)
+ }
+ },
+ dismissAction: { [weak self] notice in
+ guard let self, let controller = self.controller else {
+ return
+ }
+ controller.globalControlPanelsContext.dismissChatListNotice(parentController: controller, notice: notice)
+ },
+ selectAction: { [weak self] notice, isPositive in
+ guard let self else {
+ return
+ }
+ switch notice {
+ case let .reviewLogin(newSessionReview, _):
+ self.effectiveContainerNode.currentItemNode.interaction?.performActiveSessionAction(newSessionReview, isPositive)
+ default:
+ break
+ }
+ }
+ )))
+ )
+ }
+ if let mediaPlayback = self.controller?.globalControlPanelsContextState?.mediaPlayback {
+ panels.append(HeaderPanelContainerComponent.Panel(
+ key: "media",
+ orderIndex: 1,
+ component: AnyComponent(MediaPlaybackHeaderPanelComponent(
+ context: self.context,
+ theme: self.presentationData.theme,
+ strings: self.presentationData.strings,
+ data: mediaPlayback,
+ controller: { [weak self] in
+ return self?.controller
+ }
+ )))
+ )
+ }
+ if let liveLocation = self.controller?.globalControlPanelsContextState?.liveLocation {
+ panels.append(HeaderPanelContainerComponent.Panel(
+ key: "liveLocation",
+ orderIndex: 2,
+ component: AnyComponent(LiveLocationHeaderPanelComponent(
+ context: self.context,
+ theme: self.presentationData.theme,
+ strings: self.presentationData.strings,
+ data: liveLocation,
+ controller: { [weak self] in
+ return self?.controller
+ }
+ )))
+ )
+ }
- if let value = self.controller?.searchTabsNode {
- tabsNode = value
- tabsNodeIsSearch = true
- } else if let value = self.controller?.tabsNode, self.controller?.hasTabs == true {
- tabsNode = value
+ var navigationHeaderPanels: AnyComponent?
+ if self.controller?.tabContainerData != nil || !panels.isEmpty {
+ var tabs: AnyComponent?
+ if let tabContainerData = self.controller?.tabContainerData, tabContainerData.0.count > 1 {
+ let selectedTab: HorizontalTabsComponent.Tab.Id
+ switch self.effectiveContainerNode.currentItemFilter {
+ case .all:
+ selectedTab = AnyHashable(Int32.min)
+ case let .filter(id):
+ selectedTab = AnyHashable(id)
+ }
+
+ let isEditing = self.isReorderingFilters || (self.mainContainerNode.currentItemNode.currentState.editing && !self.didBeginSelectingChatsWhileEditing)
+
+ tabs = AnyComponent(HorizontalTabsComponent(
+ context: self.context,
+ theme: self.presentationData.theme,
+ tabs: tabContainerData.0.map { entry -> HorizontalTabsComponent.Tab in
+ let id: HorizontalTabsComponent.Tab.Id
+ let title: HorizontalTabsComponent.Tab.Title
+ var badge: HorizontalTabsComponent.Tab.Badge?
+ var isMainTab = false
+ switch entry {
+ case .all:
+ id = Int32.min
+ title = HorizontalTabsComponent.Tab.Title(text: self.presentationData.strings.ChatList_Tabs_All, entities: [], enableAnimations: false)
+ isMainTab = true
+ case let .filter(idValue, text, unread):
+ id = AnyHashable(idValue)
+ title = HorizontalTabsComponent.Tab.Title(text: text.text, entities: text.entities, enableAnimations: text.enableAnimations)
+ if unread.value != 0 {
+ badge = HorizontalTabsComponent.Tab.Badge(
+ title: "\(unread.value)",
+ isAccent: unread.hasUnmuted
+ )
+ }
+ }
+
+ return HorizontalTabsComponent.Tab(
+ id: id,
+ content: .title(title),
+ badge: badge,
+ action: { [weak self] in
+ guard let self, let tabContainerData = self.controller?.tabContainerData else {
+ return
+ }
+
+ let isPremium = self.context.isPremium
+
+ let mappedId: ChatListFilterTabEntryId = entry.id
+
+ var isDisabled = false
+ if let filtersLimit = tabContainerData.2 {
+ guard let folderIndex = tabContainerData.0.firstIndex(where: { $0.id == mappedId }) else {
+ return
+ }
+ isDisabled = !isPremium && folderIndex >= filtersLimit
+ }
+
+ if isDisabled {
+ let filtersCount = tabContainerData.0.count(where: { item in
+ if case .all = item {
+ return false
+ } else {
+ return true
+ }
+ })
+ let context = self.context
+ var replaceImpl: ((ViewController) -> Void)?
+ let controller = PremiumLimitScreen(context: context, subject: .folders, count: Int32(filtersCount), action: {
+ let controller = PremiumIntroScreen(context: context, source: .folders)
+ replaceImpl?(controller)
+ return true
+ })
+ replaceImpl = { [weak controller] c in
+ controller?.replace(with: c)
+ }
+ self.controller?.push(controller)
+ } else {
+ self.controller?.selectTab(id: mappedId)
+ }
+ },
+ contextAction: { [weak self] sourceView, gesture in
+ guard let self, let tabContainerData = self.controller?.tabContainerData else {
+ return
+ }
+
+ let isPremium = self.context.isPremium
+
+ let mappedId: Int32?
+ switch entry {
+ case .all:
+ mappedId = nil
+ case let .filter(idValue, _, _):
+ mappedId = idValue
+ }
+
+ var isDisabled = false
+ if let filtersLimit = tabContainerData.2 {
+ guard let folderIndex = tabContainerData.0.firstIndex(where: { $0.id == entry.id }) else {
+ return
+ }
+ isDisabled = !isPremium && folderIndex >= filtersLimit
+ }
+
+ self.controller?.tabContextGesture(id: mappedId, sourceNode: nil, sourceView: sourceView, gesture: gesture, keepInPlace: false, isDisabled: isDisabled)
+ },
+ deleteAction: (!isEditing || isMainTab) ? nil : { [weak self] in
+ guard let self else {
+ return
+ }
+ if case let .filter(id) = entry.id {
+ self.controller?.askForFilterRemoval(id: id)
+ }
+ }
+ )
+ },
+ selectedTab: selectedTab,
+ isEditing: isEditing,
+ liftWhileSwitching: layout.deviceMetrics.type != .tablet
+ ))
+ }
+
+ navigationHeaderPanels = AnyComponent(HeaderPanelContainerComponent(
+ theme: self.presentationData.theme,
+ tabs: tabs,
+ panels: panels
+ ))
}
var effectiveStorySubscriptions: EngineStorySubscriptions?
@@ -1382,16 +1605,17 @@ final class ChatListControllerNode: ASDisplayNode, ASGestureRecognizerDelegate {
strings: self.presentationData.strings,
statusBarHeight: layout.statusBarHeight ?? 0.0,
sideInset: layout.safeInsets.left,
- isSearchActive: self.isSearchDisplayControllerActive,
- isSearchEnabled: true,
+ search: ChatListNavigationBar.Search(isEnabled: true),
+ activeSearch: self.isSearchDisplayControllerActive,
primaryContent: headerContent?.primaryContent,
secondaryContent: headerContent?.secondaryContent,
secondaryTransition: self.inlineStackContainerTransitionFraction,
storySubscriptions: effectiveStorySubscriptions,
storiesIncludeHidden: self.location == .chatList(groupId: .archive),
uploadProgress: self.controller?.storyUploadProgress ?? [:],
- tabsNode: tabsNode,
- tabsNodeIsSearch: tabsNodeIsSearch,
+ headerPanels: navigationHeaderPanels,
+ tabsNode: nil,
+ tabsNodeIsSearch: false,
accessoryPanelContainer: self.controller?.accessoryPanelContainer,
accessoryPanelContainerHeight: self.controller?.accessoryPanelContainerHeight ?? 0.0,
activateSearch: { [weak self] searchContentNode in
@@ -1479,7 +1703,7 @@ final class ChatListControllerNode: ASDisplayNode, ASGestureRecognizerDelegate {
}
var offset = resultingOffset
- if self.isSearchDisplayControllerActive {
+ if self.isSearchDisplayControllerActive != nil {
offset = 0.0
}
@@ -1656,6 +1880,9 @@ final class ChatListControllerNode: ASDisplayNode, ASGestureRecognizerDelegate {
searchDisplayController.containerLayoutUpdated(layout, navigationBarHeight: cleanNavigationBarHeight, transition: transition)
}
}
+ if let disappearingSearchDisplayController = self.disappearingSearchDisplayController {
+ disappearingSearchDisplayController.containerLayoutUpdated(layout, navigationBarHeight: cleanNavigationBarHeight, transition: transition)
+ }
self.updateNavigationScrolling(navigationHeight: navigationBarLayout.navigationHeight, transition: transition)
@@ -1666,7 +1893,7 @@ final class ChatListControllerNode: ASDisplayNode, ASGestureRecognizerDelegate {
}
@MainActor
- func activateSearch(placeholderNode: SearchBarPlaceholderNode, displaySearchFilters: Bool, hasDownloads: Bool, initialFilter: ChatListSearchFilter, navigationController: NavigationController?) async -> (ASDisplayNode, (Bool) -> Void)? {
+ func activateSearch(placeholderNode: SearchBarPlaceholderNode?, displaySearchFilters: Bool, hasDownloads: Bool, initialFilter: ChatListSearchFilter, navigationController: NavigationController?, searchBarIsExternal: Bool) async -> ((Bool) -> Void)? {
guard let (containerLayout, _, _, cleanNavigationBarHeight, _) = self.containerLayout, self.searchDisplayController == nil else {
return nil
}
@@ -1712,16 +1939,16 @@ final class ChatListControllerNode: ASDisplayNode, ASGestureRecognizerDelegate {
if let requestDeactivateSearch = self?.requestDeactivateSearch {
requestDeactivateSearch()
}
- })
+ }, fieldStyle: placeholderNode?.fieldStyle ?? .modern, searchBarIsExternal: searchBarIsExternal)
self.mainContainerNode.accessibilityElementsHidden = true
self.inlineStackContainerNode?.accessibilityElementsHidden = true
- return (contentNode.filterContainerNode, { [weak self] focus in
+ return ({ [weak self] focus in
guard let strongSelf = self else {
return
}
- strongSelf.isSearchDisplayControllerActive = true
+ strongSelf.isSearchDisplayControllerActive = ChatListNavigationBar.ActiveSearch(isExternal: placeholderNode == nil)
strongSelf.searchDisplayController?.containerLayoutUpdated(containerLayout, navigationBarHeight: cleanNavigationBarHeight, transition: .immediate)
strongSelf.searchDisplayController?.activate(insertSubnode: { [weak self] subnode, isSearchBar in
@@ -1731,7 +1958,7 @@ final class ChatListControllerNode: ASDisplayNode, ASGestureRecognizerDelegate {
if isSearchBar {
if let navigationBarComponentView = self.navigationBarView.view as? ChatListNavigationBar.View {
- navigationBarComponentView.addSubnode(subnode)
+ navigationBarComponentView.searchContentNode?.addSubnode(subnode)
}
} else {
self.insertSubnode(subnode, aboveSubnode: self.debugListView)
@@ -1742,21 +1969,31 @@ final class ChatListControllerNode: ASDisplayNode, ASGestureRecognizerDelegate {
})
}
- func deactivateSearch(placeholderNode: SearchBarPlaceholderNode, animated: Bool) -> (() -> Void)? {
+ func deactivateSearch(placeholderNode: SearchBarPlaceholderNode?, animated: Bool) -> (() -> Void)? {
if let searchDisplayController = self.searchDisplayController {
- self.isSearchDisplayControllerActive = false
+ self.isSearchDisplayControllerActive = nil
self.searchDisplayController = nil
+ self.disappearingSearchDisplayController = searchDisplayController
self.mainContainerNode.accessibilityElementsHidden = false
self.inlineStackContainerNode?.accessibilityElementsHidden = false
return { [weak self, weak placeholderNode] in
- if let strongSelf = self, let placeholderNode, let (layout, _, _, cleanNavigationBarHeight, _) = strongSelf.containerLayout {
- searchDisplayController.deactivate(placeholder: placeholderNode, animated: animated)
-
- searchDisplayController.containerLayoutUpdated(layout, navigationBarHeight: cleanNavigationBarHeight, transition: .animated(duration: 0.4, curve: .spring))
-
- strongSelf.controller?.requestLayout(transition: .animated(duration: 0.4, curve: .spring))
+ guard let self, let (layout, _, _, cleanNavigationBarHeight, _) = self.containerLayout else {
+ return
}
+ let placeholderNode = placeholderNode
+ searchDisplayController.deactivate(placeholder: placeholderNode, animated: animated, completion: { [weak self, weak searchDisplayController] in
+ guard let self, let searchDisplayController else {
+ return
+ }
+ if self.disappearingSearchDisplayController === searchDisplayController {
+ self.disappearingSearchDisplayController = nil
+ }
+ })
+
+ searchDisplayController.containerLayoutUpdated(layout, navigationBarHeight: cleanNavigationBarHeight, transition: .animated(duration: 0.4, curve: .spring))
+
+ self.controller?.requestLayout(transition: .animated(duration: 0.4, curve: .spring))
}
} else {
return nil
diff --git a/submodules/ChatListUI/Sources/ChatListFilterPresetCategoryItem.swift b/submodules/ChatListUI/Sources/ChatListFilterPresetCategoryItem.swift
index 24e3612d..6b75d9a1 100644
--- a/submodules/ChatListUI/Sources/ChatListFilterPresetCategoryItem.swift
+++ b/submodules/ChatListUI/Sources/ChatListFilterPresetCategoryItem.swift
@@ -148,7 +148,7 @@ class ChatListFilterPresetCategoryItemNode: ItemListRevealOptionsItemNode, ItemL
self.highlightedBackgroundNode = ASDisplayNode()
self.highlightedBackgroundNode.isLayerBacked = true
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.isAccessibilityElement = true
diff --git a/submodules/ChatListUI/Sources/ChatListFilterPresetController.swift b/submodules/ChatListUI/Sources/ChatListFilterPresetController.swift
index 30ffe647..da255877 100644
--- a/submodules/ChatListUI/Sources/ChatListFilterPresetController.swift
+++ b/submodules/ChatListUI/Sources/ChatListFilterPresetController.swift
@@ -1283,7 +1283,6 @@ private final class ChatListFilterPresetController: ItemListController {
pendingUnpinnedAllMessages: false,
activeGroupCallInfo: nil,
hasActiveGroupCall: false,
- importState: nil,
threadData: nil,
isGeneralThreadClosed: nil,
replyMessage: nil,
@@ -1753,14 +1752,14 @@ func chatListFilterPresetController(context: AccountContext, currentPreset initi
if initialPreset == nil {
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
let text = presentationData.strings.ChatListFilter_AlertCreateFolderBeforeSharingText
- presentControllerImpl?(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), nil)
+ presentControllerImpl?(textAlertController(context: context, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), nil)
} else {
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
let state = stateValue.with({ $0 })
if state.additionallyIncludePeers.isEmpty {
let text = presentationData.strings.ChatListFilter_ErrorShareInvalidFolder
- presentControllerImpl?(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), nil)
+ presentControllerImpl?(textAlertController(context: context, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), nil)
return
}
@@ -1785,7 +1784,7 @@ func chatListFilterPresetController(context: AccountContext, currentPreset initi
statusController?.dismiss()
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
- presentControllerImpl?(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: nil, text: unavailableText, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), nil)
+ presentControllerImpl?(textAlertController(context: context, title: nil, text: unavailableText, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), nil)
return
}
@@ -2360,7 +2359,7 @@ func openCreateChatListFolderLink(context: AccountContext, folderId: Int32, chec
case .someUserTooManyChannels:
text = presentationData.strings.ChatListFilter_CreateLinkErrorSomeoneHasChannelLimit
}
- presentController(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]))
+ presentController(textAlertController(context: context, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]))
})
}
})
diff --git a/submodules/ChatListUI/Sources/ChatListFilterPresetListController.swift b/submodules/ChatListUI/Sources/ChatListFilterPresetListController.swift
index 56c5c9ba..8750c6f8 100644
--- a/submodules/ChatListUI/Sources/ChatListFilterPresetListController.swift
+++ b/submodules/ChatListUI/Sources/ChatListFilterPresetListController.swift
@@ -5,6 +5,7 @@ import SwiftSignalKit
import TelegramCore
import TelegramPresentationData
import TelegramUIPreferences
+import PresentationDataUtils
import ItemListUI
import AccountContext
import ItemListPeerActionItem
@@ -516,13 +517,13 @@ public func chatListFilterPresetListController(context: AccountContext, mode: Ch
}
if hasLinks {
- presentControllerImpl?(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: presentationData.strings.ChatList_AlertDeleteFolderTitle, text: presentationData.strings.ChatList_AlertDeleteFolderText, actions: [
+ presentControllerImpl?(textAlertController(context: context, title: presentationData.strings.ChatList_AlertDeleteFolderTitle, text: presentationData.strings.ChatList_AlertDeleteFolderText, actions: [
TextAlertAction(type: .destructiveAction, title: presentationData.strings.Common_Delete, action: {
confirmDeleteFolder()
}),
- TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_Cancel, action: {
+ TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {
})
- ]))
+ ], actionLayout: .vertical))
} else {
confirmDeleteFolder()
}
diff --git a/submodules/ChatListUI/Sources/ChatListFilterPresetListItem.swift b/submodules/ChatListUI/Sources/ChatListFilterPresetListItem.swift
index 55540442..84e53950 100644
--- a/submodules/ChatListUI/Sources/ChatListFilterPresetListItem.swift
+++ b/submodules/ChatListUI/Sources/ChatListFilterPresetListItem.swift
@@ -201,7 +201,7 @@ final class ChatListFilterPresetListItemNode: ItemListRevealOptionsItemNode {
self.highlightedBackgroundNode = ASDisplayNode()
self.highlightedBackgroundNode.isLayerBacked = true
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.addSubnode(self.containerNode)
self.containerNode.addSubnode(self.titleNode.textNode)
diff --git a/submodules/ChatListUI/Sources/ChatListFilterPresetListSuggestedItem.swift b/submodules/ChatListUI/Sources/ChatListFilterPresetListSuggestedItem.swift
index 34f96f72..4cce378d 100644
--- a/submodules/ChatListUI/Sources/ChatListFilterPresetListSuggestedItem.swift
+++ b/submodules/ChatListUI/Sources/ChatListFilterPresetListSuggestedItem.swift
@@ -132,7 +132,7 @@ public class ChatListFilterPresetListSuggestedItemNode: ListViewItemNode, ItemLi
self.activateArea = AccessibilityAreaNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.titleNode)
self.addSubnode(self.labelNode)
diff --git a/submodules/ChatListUI/Sources/ChatListFilterTagSectionHeaderItem.swift b/submodules/ChatListUI/Sources/ChatListFilterTagSectionHeaderItem.swift
index 93438c9a..3c7fd1fc 100644
--- a/submodules/ChatListUI/Sources/ChatListFilterTagSectionHeaderItem.swift
+++ b/submodules/ChatListUI/Sources/ChatListFilterTagSectionHeaderItem.swift
@@ -113,7 +113,7 @@ public class ChatListFilterTagSectionHeaderItemNode: ListViewItemNode {
self.activateArea = AccessibilityAreaNode()
self.activateArea.accessibilityTraits = [.staticText, .header]
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.titleNode)
self.addSubnode(self.accessoryTextNode)
diff --git a/submodules/ChatListUI/Sources/ChatListRecentPeersListItem.swift b/submodules/ChatListUI/Sources/ChatListRecentPeersListItem.swift
index 52541007..0cac0a1b 100644
--- a/submodules/ChatListUI/Sources/ChatListRecentPeersListItem.swift
+++ b/submodules/ChatListUI/Sources/ChatListRecentPeersListItem.swift
@@ -79,7 +79,7 @@ class ChatListRecentPeersListItemNode: ListViewItemNode {
self.separatorNode = ASDisplayNode()
self.separatorNode.isLayerBacked = true
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.backgroundNode)
self.addSubnode(self.separatorNode)
diff --git a/submodules/ChatListUI/Sources/ChatListSearchContainerNode.swift b/submodules/ChatListUI/Sources/ChatListSearchContainerNode.swift
index aab2bb49..11af4ee9 100644
--- a/submodules/ChatListUI/Sources/ChatListSearchContainerNode.swift
+++ b/submodules/ChatListUI/Sources/ChatListSearchContainerNode.swift
@@ -36,6 +36,10 @@ import MultiAnimationRenderer
import PremiumUI
import AvatarNode
import StoryContainerScreen
+import ChatListSearchFiltersContainerNode
+import EdgeEffect
+import ComponentFlow
+import ComponentDisplayAdapters
private enum ChatListTokenId: Int32 {
case archive
@@ -107,8 +111,9 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
var dismissSearch: (() -> Void)?
var openAdInfo: ((ASDisplayNode, AdPeer) -> Void)?
- private let dimNode: ASDisplayNode
- let filterContainerNode: ChatListSearchFiltersContainerNode
+ private let edgeEffectView: EdgeEffectView
+
+ private let filterContainerNode: ChatListSearchFiltersContainerNode
private let paneContainerNode: ChatListSearchPaneContainerNode
private var selectionPanelNode: ChatListSearchMessageSelectionPanelNode?
@@ -181,9 +186,8 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
self.openMessage = originalOpenMessage
self.present = present
self.presentInGlobalOverlay = presentInGlobalOverlay
-
- self.dimNode = ASDisplayNode()
- self.dimNode.backgroundColor = UIColor.black.withAlphaComponent(0.5)
+
+ self.edgeEffectView = EdgeEffectView()
self.filterContainerNode = ChatListSearchFiltersContainerNode()
self.paneContainerNode = ChatListSearchPaneContainerNode(context: context, animationCache: animationCache, animationRenderer: animationRenderer, updatedPresentationData: updatedPresentationData, peersFilter: self.peersFilter, requestPeerType: self.requestPeerType, location: location, searchQuery: self.searchQuery.get(), searchOptions: self.searchOptions.get(), navigationController: navigationController, parentController: parentController())
@@ -193,7 +197,6 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
self.backgroundColor = filter.contains(.excludeRecent) ? nil : self.presentationData.theme.chatList.backgroundColor
-// self.addSubnode(self.dimNode)
self.addSubnode(self.paneContainerNode)
let interaction = ChatListSearchInteraction(openPeer: { peer, chatPeer, threadId, value in
@@ -325,6 +328,9 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
parentController()?.view.endEditing(true)
}
+ self.view.addSubview(self.edgeEffectView)
+
+ self.addSubnode(self.filterContainerNode)
self.filterContainerNode.filterPressed = { [weak self] filter in
guard let strongSelf = self else {
return
@@ -553,9 +559,6 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
public override func didLoad() {
super.didLoad()
-
-
- self.dimNode.view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.dimTapGesture(_:))))
}
public override var hasDim: Bool {
@@ -705,18 +708,7 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
self.transitionFraction = transitionFraction
if let (layout, _) = self.validLayout {
- let filters: [ChatListSearchFilter]
- if let suggestedFilters = self.suggestedFilters, !suggestedFilters.isEmpty {
- filters = suggestedFilters
- } else {
- var isForum = false
- if case .forum = self.location {
- isForum = true
- }
-
- filters = defaultAvailableSearchPanes(isForum: isForum, hasDownloads: !isForum && self.hasDownloads, hasPublicPosts: self.showPublicPostsTab).map(\.filter)
- }
- self.filterContainerNode.update(size: CGSize(width: layout.size.width - 40.0, height: 38.0), sideInset: layout.safeInsets.left - 20.0, filters: filters.map { .filter($0) }, displayGlobalPostsNewBadge: self.displayGlobalPostsNewBadge, selectedFilter: self.selectedFilter?.id, transitionFraction: self.transitionFraction, presentationData: self.presentationData, transition: transition)
+ self.updateFilterContainerNode(layout: layout, transition: transition)
}
}
@@ -762,18 +754,8 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
self.cancel?()
}
}
-
- override public func containerLayoutUpdated(_ layout: ContainerViewLayout, navigationBarHeight: CGFloat, transition: ContainedViewLayoutTransition) {
- super.containerLayoutUpdated(layout, navigationBarHeight: navigationBarHeight, transition: transition)
-
- let isFirstTime = self.validLayout == nil
- self.validLayout = (layout, navigationBarHeight)
-
- let topInset = navigationBarHeight
-
- transition.updateFrame(node: self.dimNode, frame: CGRect(origin: CGPoint(x: 0.0, y: topInset), size: CGSize(width: layout.size.width, height: layout.size.height - topInset)))
- transition.updateFrame(node: self.filterContainerNode, frame: CGRect(origin: CGPoint(x: 0.0, y: navigationBarHeight + 6.0), size: CGSize(width: layout.size.width, height: 38.0)))
-
+
+ private func updateFilterContainerNode(layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) {
var isForum = false
if case .forum = self.location {
isForum = true
@@ -786,8 +768,46 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
filters = defaultAvailableSearchPanes(isForum: isForum, hasDownloads: self.hasDownloads, hasPublicPosts: self.showPublicPostsTab).map(\.filter)
}
- let overflowInset: CGFloat = 20.0
- self.filterContainerNode.update(size: CGSize(width: layout.size.width - overflowInset * 2.0, height: 38.0), sideInset: layout.safeInsets.left - overflowInset, filters: filters.map { .filter($0) }, displayGlobalPostsNewBadge: self.displayGlobalPostsNewBadge, selectedFilter: self.selectedFilter?.id, transitionFraction: self.transitionFraction, presentationData: self.presentationData, transition: .animated(duration: 0.4, curve: .spring))
+ var filtersInsets = UIEdgeInsets(top: 0.0, left: 12.0, bottom: layout.insets(options: [.input]).bottom + 34.0, right: 12.0)
+ if layout.insets(options: [.input]).bottom <= 30.0 {
+ filtersInsets = ContainerViewLayout.concentricInsets(bottomInset: layout.insets(options: [.input]).bottom, innerDiameter: 40.0, sideInset: 32.0)
+ } else if layout.insets(options: [.input]).bottom <= 84.0 {
+ filtersInsets.left = 20.0
+ filtersInsets.right = filtersInsets.left
+ }
+
+ self.filterContainerNode.update(size: CGSize(width: layout.size.width - (layout.safeInsets.left + filtersInsets.left) * 2.0, height: 40.0), sideInset: 0.0, filters: filters.map { .filter($0) }, displayGlobalPostsNewBadge: self.displayGlobalPostsNewBadge, selectedFilter: self.selectedFilter?.id, transitionFraction: self.transitionFraction, presentationData: self.presentationData, transition: .animated(duration: 0.4, curve: .spring))
+ }
+
+ override public func containerLayoutUpdated(_ layout: ContainerViewLayout, navigationBarHeight: CGFloat, transition: ContainedViewLayoutTransition) {
+ super.containerLayoutUpdated(layout, navigationBarHeight: navigationBarHeight, transition: transition)
+
+ let isFirstTime = self.validLayout == nil
+ self.validLayout = (layout, navigationBarHeight)
+
+ let topInset = navigationBarHeight
+
+ var filtersInsets = UIEdgeInsets(top: 0.0, left: 12.0, bottom: layout.insets(options: [.input]).bottom, right: 12.0)
+ if filtersInsets.bottom == 84.0 {
+ filtersInsets.bottom -= 6.0
+ }
+ if layout.insets(options: [.input]).bottom <= 30.0 {
+ filtersInsets = ContainerViewLayout.concentricInsets(bottomInset: layout.insets(options: [.input]).bottom, innerDiameter: 40.0, sideInset: 32.0)
+ } else if layout.insets(options: [.input]).bottom <= 84.0 {
+ filtersInsets.left = 20.0
+ filtersInsets.right = filtersInsets.left
+ } else {
+ if let inputHeight = layout.inputHeight, filtersInsets.bottom == inputHeight {
+ filtersInsets.bottom += 8.0
+ }
+ filtersInsets.bottom = max(8.0, filtersInsets.bottom)
+ }
+ if self.stateValue.selectedMessageIds != nil {
+ filtersInsets.bottom += 48.0
+ }
+
+ transition.updateFrame(node: self.filterContainerNode, frame: CGRect(origin: CGPoint(x: layout.safeInsets.left + filtersInsets.left, y: layout.size.height - filtersInsets.bottom - 40.0), size: CGSize(width: layout.size.width - (layout.safeInsets.left + filtersInsets.left) * 2.0, height: 40.0)))
+ self.updateFilterContainerNode(layout: layout, transition: transition)
if isFirstTime {
self.filterContainerNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
@@ -795,13 +815,13 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
}
var bottomIntrinsicInset = layout.intrinsicInsets.bottom
- if case .chatList(.root) = self.location {
- if layout.safeInsets.left > overflowInset {
+ /*if case .chatList(.root) = self.location {
+ if layout.safeInsets.left > 20.0 {
bottomIntrinsicInset -= 34.0
} else {
bottomIntrinsicInset -= 49.0
}
- }
+ }*/
if let selectedMessageIds = self.stateValue.selectedMessageIds {
var wasAdded = false
@@ -927,7 +947,7 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
return strongSelf.context.sharedContext.chatAvailableMessageActions(engine: strongSelf.context.engine, accountPeerId: strongSelf.context.account.peerId, messageIds: messageIds, messages: messages, peers: peers)
}
self.selectionPanelNode = selectionPanelNode
- self.addSubnode(selectionPanelNode)
+ self.insertSubnode(selectionPanelNode, aboveSubnode: self.filterContainerNode)
}
selectionPanelNode.selectedMessages = selectedMessageIds
@@ -948,25 +968,36 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
})
}
- transition.updateFrame(node: self.paneContainerNode, frame: CGRect(x: 0.0, y: topInset, width: layout.size.width, height: layout.size.height - topInset))
+ transition.updateFrame(node: self.paneContainerNode, frame: CGRect(x: 0.0, y: 0.0, width: layout.size.width, height: layout.size.height))
var bottomInset = layout.intrinsicInsets.bottom
if let inputHeight = layout.inputHeight {
bottomInset = inputHeight
} else if let _ = self.selectionPanelNode {
bottomInset = bottomIntrinsicInset
- } else if case .chatList(.root) = self.location {
- bottomInset -= bottomIntrinsicInset
}
+ bottomInset += 10.0
let availablePanes: [ChatListSearchPaneKey]
+ var isForum = false
+ if case .forum = self.location {
+ isForum = true
+ }
if self.displaySearchFilters {
availablePanes = defaultAvailableSearchPanes(isForum: isForum, hasDownloads: self.hasDownloads, hasPublicPosts: self.hasPublicPostsTab)
} else {
availablePanes = isForum ? [.topics] : [.chats]
}
+
+ bottomInset += 44.0
+
+ let edgeEffectHeight: CGFloat = bottomInset + 8.0
+ let edgeEffectFrame = CGRect(origin: CGPoint(x: 0.0, y: layout.size.height - edgeEffectHeight), size: CGSize(width: layout.size.width, height: edgeEffectHeight))
+ transition.updateFrame(view: self.edgeEffectView, frame: edgeEffectFrame)
+ self.edgeEffectView.update(content: self.presentationData.theme.list.plainBackgroundColor, rect: edgeEffectFrame, edge: .bottom, edgeSize: min(edgeEffectHeight, 50.0), transition: ComponentTransition(transition))
+ transition.updateAlpha(layer: self.edgeEffectView.layer, alpha: edgeEffectHeight > 21.0 ? 1.0 : 0.0)
- self.paneContainerNode.update(size: CGSize(width: layout.size.width, height: layout.size.height - topInset), sideInset: layout.safeInsets.left, bottomInset: bottomInset, visibleHeight: layout.size.height - topInset, presentationData: self.presentationData, availablePanes: availablePanes, transition: transition)
+ self.paneContainerNode.update(size: CGSize(width: layout.size.width, height: layout.size.height), sideInset: layout.safeInsets.left, topInset: topInset, bottomInset: bottomInset, visibleHeight: layout.size.height, presentationData: self.presentationData, availablePanes: availablePanes, transition: transition)
}
private var currentMessages: ([EnginePeer.Id: EnginePeer], [EngineMessage.Id: EngineMessage]) {
@@ -1325,7 +1356,7 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
title = strongSelf.presentationData.strings.DownloadList_RemoveFileAlertTitle(Int32(messages.count))
text = strongSelf.presentationData.strings.DownloadList_RemoveFileAlertText(Int32(messages.count))
- strongSelf.present?(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: title, text: text, actions: [
+ strongSelf.present?(textAlertController(context: strongSelf.context, title: title, text: text, actions: [
TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Common_Cancel, action: {
}),
TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.DownloadList_RemoveFileAlertRemove, action: {
diff --git a/submodules/ChatListUI/Sources/ChatListSearchListPaneNode.swift b/submodules/ChatListUI/Sources/ChatListSearchListPaneNode.swift
index c3854ee8..88a8cdf0 100644
--- a/submodules/ChatListUI/Sources/ChatListSearchListPaneNode.swift
+++ b/submodules/ChatListUI/Sources/ChatListSearchListPaneNode.swift
@@ -38,6 +38,7 @@ import MultilineTextComponent
import ButtonComponent
import BundleIconComponent
import AnimatedTextComponent
+import TextFormat
private enum ChatListRecentEntryStableId: Hashable {
case topPeers
@@ -1696,7 +1697,7 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
private var emptyRecentAnimationNode: AnimatedStickerNode?
private var emptyRecentAnimationSize = CGSize()
- private var currentParams: (size: CGSize, sideInset: CGFloat, bottomInset: CGFloat, visibleHeight: CGFloat, presentationData: PresentationData)?
+ private var currentParams: (size: CGSize, sideInset: CGFloat, topInset: CGFloat, bottomInset: CGFloat, visibleHeight: CGFloat, presentationData: PresentationData)?
private let ready = Promise()
private var didSetReady: Bool = false
@@ -3495,7 +3496,6 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
self.interaction.openStories?(id, sourceNode.avatarNode)
}
}, openStarsTopup: { _ in
- }, dismissNotice: { _ in
}, editPeer: { _ in
}, openWebApp: { _ in
}, openPhotoSetup: {
@@ -4508,7 +4508,7 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
return
}
dismissImpl?()
- if let value = attributes[NSAttributedString.Key(rawValue: "URL")] as? String {
+ if let value = attributes[NSAttributedString.Key(rawValue: TelegramTextAttributes.URL)] as? String {
if !value.isEmpty {
context.sharedContext.openExternalUrl(context: context, urlContext: .generic, url: value, forceExternal: false, presentationData: context.sharedContext.currentPresentationData.with { $0 }, navigationController: navigationController, dismissInput: {})
} else {
@@ -4536,7 +4536,7 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
)
interaction.present(alertController, nil)
dismissImpl = { [weak alertController] in
- alertController?.dismissAnimated()
+ alertController?.dismiss()
}
},
isChannelsTabExpanded: recentItems.isChannelsTabExpanded,
@@ -4640,8 +4640,8 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
self.playlistStateAndType = nil
}
- if let (size, sideInset, bottomInset, visibleHeight, presentationData) = self.currentParams {
- self.update(size: size, sideInset: sideInset, bottomInset: bottomInset, visibleHeight: visibleHeight, presentationData: presentationData, synchronous: true, transition: .animated(duration: 0.4, curve: .spring))
+ if let (size, sideInset, topInset, bottomInset, visibleHeight, presentationData) = self.currentParams {
+ self.update(size: size, sideInset: sideInset, topInset: topInset, bottomInset: bottomInset, visibleHeight: visibleHeight, presentationData: presentationData, synchronous: true, transition: .animated(duration: 0.4, curve: .spring))
}
}
self.playlistLocation = playlistStateAndType?.1.playlistLocation
@@ -4758,10 +4758,10 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
}
}
- func update(size: CGSize, sideInset: CGFloat, bottomInset: CGFloat, visibleHeight: CGFloat, presentationData: PresentationData, synchronous: Bool, transition: ContainedViewLayoutTransition) {
+ func update(size: CGSize, sideInset: CGFloat, topInset: CGFloat, bottomInset: CGFloat, visibleHeight: CGFloat, presentationData: PresentationData, synchronous: Bool, transition: ContainedViewLayoutTransition) {
let hadValidLayout = self.currentParams != nil
- let layoutChanged = self.currentParams?.size != size || self.currentParams?.sideInset != sideInset || self.currentParams?.bottomInset != bottomInset || self.currentParams?.visibleHeight != visibleHeight
- self.currentParams = (size, sideInset, bottomInset, visibleHeight, presentationData)
+ let layoutChanged = self.currentParams?.size != size || self.currentParams?.sideInset != sideInset || self.currentParams?.topInset != topInset || self.currentParams?.bottomInset != bottomInset || self.currentParams?.visibleHeight != visibleHeight
+ self.currentParams = (size, sideInset, topInset, bottomInset, visibleHeight, presentationData)
var topPanelHeight: CGFloat = 0.0
if let (item, previousItem, nextItem, order, type, _) = self.playlistStateAndType {
@@ -5035,9 +5035,9 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
transition.updateFrame(node: self.mediaAccessoryPanelContainer, frame: CGRect(origin: CGPoint(), size: CGSize(width: size.width, height: MediaNavigationAccessoryHeaderNode.minimizedHeight)))
- let topInset: CGFloat = topPanelHeight
- let overflowInset: CGFloat = 20.0
- let insets = UIEdgeInsets(top: topPanelHeight, left: sideInset, bottom: bottomInset, right: sideInset)
+ let topInset: CGFloat = topInset + topPanelHeight
+ let overflowInset: CGFloat = 0.0
+ let insets = UIEdgeInsets(top: topInset + topPanelHeight, left: sideInset, bottom: bottomInset, right: sideInset)
self.shimmerNode.frame = CGRect(origin: CGPoint(x: overflowInset, y: topInset), size: CGSize(width: size.width - overflowInset * 2.0, height: size.height))
self.shimmerNode.update(context: self.context, size: CGSize(width: size.width - overflowInset * 2.0, height: size.height), presentationData: self.presentationData, animationCache: self.animationCache, animationRenderer: self.animationRenderer, key: !(self.searchQueryValue?.isEmpty ?? true) && self.key == .media ? .chats : self.key, hasSelection: self.selectedMessages != nil, transition: transition)
@@ -5480,8 +5480,8 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
strongSelf.emptyResultsButtonSubtitleText = nil
}
- if let (size, sideInset, bottomInset, visibleHeight, presentationData) = strongSelf.currentParams {
- strongSelf.update(size: size, sideInset: sideInset, bottomInset: bottomInset, visibleHeight: visibleHeight, presentationData: presentationData, synchronous: true, transition: .animated(duration: 0.4, curve: .spring))
+ if let (size, sideInset, topInset, bottomInset, visibleHeight, presentationData) = strongSelf.currentParams {
+ strongSelf.update(size: size, sideInset: sideInset, topInset: topInset, bottomInset: bottomInset, visibleHeight: visibleHeight, presentationData: presentationData, synchronous: true, transition: .animated(duration: 0.4, curve: .spring))
}
if strongSelf.key == .downloads {
@@ -5783,7 +5783,6 @@ public final class ChatListSearchShimmerNode: ASDisplayNode {
}, openChatFolderUpdates: {}, hideChatFolderUpdates: {
}, openStories: { _, _ in
}, openStarsTopup: { _ in
- }, dismissNotice: { _ in
}, editPeer: { _ in
}, openWebApp: { _ in
}, openPhotoSetup: {
diff --git a/submodules/ChatListUI/Sources/ChatListSearchPaneContainerNode.swift b/submodules/ChatListUI/Sources/ChatListSearchPaneContainerNode.swift
index 7d52bddb..054acc95 100644
--- a/submodules/ChatListUI/Sources/ChatListSearchPaneContainerNode.swift
+++ b/submodules/ChatListUI/Sources/ChatListSearchPaneContainerNode.swift
@@ -15,7 +15,7 @@ protocol ChatListSearchPaneNode: ASDisplayNode {
var isReady: Signal { get }
var isCurrent: Bool { get set }
- func update(size: CGSize, sideInset: CGFloat, bottomInset: CGFloat, visibleHeight: CGFloat, presentationData: PresentationData, synchronous: Bool, transition: ContainedViewLayoutTransition)
+ func update(size: CGSize, sideInset: CGFloat, topInset: CGFloat, bottomInset: CGFloat, visibleHeight: CGFloat, presentationData: PresentationData, synchronous: Bool, transition: ContainedViewLayoutTransition)
func scrollToTop() -> Bool
func cancelPreviewGestures()
func transitionNodeForGallery(messageId: EngineMessage.Id, media: EngineMedia) -> (ASDisplayNode, CGRect, () -> (UIView?, UIView?))?
@@ -32,21 +32,21 @@ final class ChatListSearchPaneWrapper {
let key: ChatListSearchPaneKey
let node: ChatListSearchPaneNode
var isAnimatingOut: Bool = false
- private var appliedParams: (CGSize, CGFloat, CGFloat, CGFloat, PresentationData)?
+ private var appliedParams: (CGSize, CGFloat, CGFloat, CGFloat, CGFloat, PresentationData)?
init(key: ChatListSearchPaneKey, node: ChatListSearchPaneNode) {
self.key = key
self.node = node
}
- func update(size: CGSize, sideInset: CGFloat, bottomInset: CGFloat, visibleHeight: CGFloat, presentationData: PresentationData, synchronous: Bool, transition: ContainedViewLayoutTransition) {
- if let (currentSize, currentSideInset, currentBottomInset, _, currentPresentationData) = self.appliedParams {
- if currentSize == size && currentSideInset == sideInset && currentBottomInset == bottomInset && currentPresentationData === presentationData {
+ func update(size: CGSize, sideInset: CGFloat, topInset: CGFloat, bottomInset: CGFloat, visibleHeight: CGFloat, presentationData: PresentationData, synchronous: Bool, transition: ContainedViewLayoutTransition) {
+ if let (currentSize, currentSideInset, currentTopInset, currentBottomInset, _, currentPresentationData) = self.appliedParams {
+ if currentSize == size && currentSideInset == sideInset && currentTopInset == topInset && currentBottomInset == bottomInset && currentPresentationData === presentationData {
return
}
}
- self.appliedParams = (size, sideInset, bottomInset, visibleHeight, presentationData)
- self.node.update(size: size, sideInset: sideInset, bottomInset: bottomInset, visibleHeight: visibleHeight, presentationData: presentationData, synchronous: synchronous, transition: transition)
+ self.appliedParams = (size, sideInset, topInset, bottomInset, visibleHeight, presentationData)
+ self.node.update(size: size, sideInset: sideInset, topInset: topInset, bottomInset: bottomInset, visibleHeight: visibleHeight, presentationData: presentationData, synchronous: synchronous, transition: transition)
}
}
@@ -190,7 +190,7 @@ final class ChatListSearchPaneContainerNode: ASDisplayNode, ASGestureRecognizerD
var isAdjacentLoadingEnabled = false
- private var currentParams: (size: CGSize, sideInset: CGFloat, bottomInset: CGFloat, visibleHeight: CGFloat, presentationData: PresentationData, [ChatListSearchPaneKey])?
+ private var currentParams: (size: CGSize, sideInset: CGFloat, topInset: CGFloat, bottomInset: CGFloat, visibleHeight: CGFloat, presentationData: PresentationData, [ChatListSearchPaneKey])?
private(set) var currentPaneKey: ChatListSearchPaneKey?
var pendingSwitchToPaneKey: ChatListSearchPaneKey?
@@ -251,8 +251,8 @@ final class ChatListSearchPaneContainerNode: ASDisplayNode, ASGestureRecognizerD
if self.currentPanes[key] != nil {
self.currentPaneKey = key
- if let (size, sideInset, bottomInset, visibleHeight, presentationData, availablePanes) = self.currentParams {
- self.update(size: size, sideInset: sideInset, bottomInset: bottomInset, visibleHeight: visibleHeight, presentationData: presentationData, availablePanes: availablePanes, transition: .animated(duration: 0.4, curve: .spring))
+ if let (size, sideInset, topInset, bottomInset, visibleHeight, presentationData, availablePanes) = self.currentParams {
+ self.update(size: size, sideInset: sideInset, topInset: topInset, bottomInset: bottomInset, visibleHeight: visibleHeight, presentationData: presentationData, availablePanes: availablePanes, transition: .animated(duration: 0.4, curve: .spring))
}
if case .apps = key {
@@ -261,8 +261,8 @@ final class ChatListSearchPaneContainerNode: ASDisplayNode, ASGestureRecognizerD
} else if self.pendingSwitchToPaneKey != key {
self.pendingSwitchToPaneKey = key
- if let (size, sideInset, bottomInset, visibleHeight, presentationData, availablePanes) = self.currentParams {
- self.update(size: size, sideInset: sideInset, bottomInset: bottomInset, visibleHeight: visibleHeight, presentationData: presentationData, availablePanes: availablePanes, transition: .animated(duration: 0.4, curve: .spring))
+ if let (size, sideInset, topInset, bottomInset, visibleHeight, presentationData, availablePanes) = self.currentParams {
+ self.update(size: size, sideInset: sideInset, topInset: topInset, bottomInset: bottomInset, visibleHeight: visibleHeight, presentationData: presentationData, availablePanes: availablePanes, transition: .animated(duration: 0.4, curve: .spring))
}
if case .apps = key {
@@ -275,7 +275,7 @@ final class ChatListSearchPaneContainerNode: ASDisplayNode, ASGestureRecognizerD
super.didLoad()
let panRecognizer = InteractiveTransitionGestureRecognizer(target: self, action: #selector(self.panGesture(_:)), allowedDirections: { [weak self] point in
- guard let strongSelf = self, let (_, _, _, _, _, availablePanes) = strongSelf.currentParams, let currentPaneKey = strongSelf.currentPaneKey, let index = availablePanes.firstIndex(of: currentPaneKey) else {
+ guard let strongSelf = self, let (_, _, _, _, _, _, availablePanes) = strongSelf.currentParams, let currentPaneKey = strongSelf.currentPaneKey, let index = availablePanes.firstIndex(of: currentPaneKey) else {
return []
}
if index == 0 {
@@ -321,7 +321,7 @@ final class ChatListSearchPaneContainerNode: ASDisplayNode, ASGestureRecognizerD
cancelContextGestures(view: self.view)
case .changed:
- if let (size, sideInset, bottomInset, visibleHeight, presentationData, availablePanes) = self.currentParams, let currentPaneKey = self.currentPaneKey, let currentIndex = availablePanes.firstIndex(of: currentPaneKey) {
+ if let (size, sideInset, topInset, bottomInset, visibleHeight, presentationData, availablePanes) = self.currentParams, let currentPaneKey = self.currentPaneKey, let currentIndex = availablePanes.firstIndex(of: currentPaneKey) {
self.isAdjacentLoadingEnabled = true
let translation = recognizer.translation(in: self.view)
var transitionFraction = translation.x / size.width
@@ -332,10 +332,10 @@ final class ChatListSearchPaneContainerNode: ASDisplayNode, ASGestureRecognizerD
transitionFraction = max(0.0, transitionFraction)
}
self.transitionFraction = transitionFraction
- self.update(size: size, sideInset: sideInset, bottomInset: bottomInset, visibleHeight: visibleHeight, presentationData: presentationData, availablePanes: availablePanes, transition: .immediate)
+ self.update(size: size, sideInset: sideInset, topInset: topInset, bottomInset: bottomInset, visibleHeight: visibleHeight, presentationData: presentationData, availablePanes: availablePanes, transition: .immediate)
}
case .cancelled, .ended:
- if let (size, sideInset, bottomInset, visibleHeight, presentationData, availablePanes) = self.currentParams, let currentPaneKey = self.currentPaneKey, let currentIndex = availablePanes.firstIndex(of: currentPaneKey) {
+ if let (size, sideInset, topInset, bottomInset, visibleHeight, presentationData, availablePanes) = self.currentParams, let currentPaneKey = self.currentPaneKey, let currentIndex = availablePanes.firstIndex(of: currentPaneKey) {
let translation = recognizer.translation(in: self.view)
let velocity = recognizer.velocity(in: self.view)
var directionIsToRight: Bool?
@@ -364,7 +364,7 @@ final class ChatListSearchPaneContainerNode: ASDisplayNode, ASGestureRecognizerD
}
}
self.transitionFraction = 0.0
- self.update(size: size, sideInset: sideInset, bottomInset: bottomInset, visibleHeight: visibleHeight, presentationData: presentationData, availablePanes: availablePanes, transition: .animated(duration: 0.35, curve: .spring))
+ self.update(size: size, sideInset: sideInset, topInset: topInset, bottomInset: bottomInset, visibleHeight: visibleHeight, presentationData: presentationData, availablePanes: availablePanes, transition: .animated(duration: 0.35, curve: .spring))
}
default:
break
@@ -396,7 +396,7 @@ final class ChatListSearchPaneContainerNode: ASDisplayNode, ASGestureRecognizerD
}
}
- func update(size: CGSize, sideInset: CGFloat, bottomInset: CGFloat, visibleHeight: CGFloat, presentationData: PresentationData, availablePanes: [ChatListSearchPaneKey], transition: ContainedViewLayoutTransition) {
+ func update(size: CGSize, sideInset: CGFloat, topInset: CGFloat, bottomInset: CGFloat, visibleHeight: CGFloat, presentationData: PresentationData, availablePanes: [ChatListSearchPaneKey], transition: ContainedViewLayoutTransition) {
let previousAvailablePanes = self.currentAvailablePanes ?? []
self.currentAvailablePanes = availablePanes
@@ -430,7 +430,7 @@ final class ChatListSearchPaneContainerNode: ASDisplayNode, ASGestureRecognizerD
currentIndex = nil
}
- self.currentParams = (size, sideInset, bottomInset, visibleHeight, presentationData, availablePanes)
+ self.currentParams = (size, sideInset, topInset, bottomInset, visibleHeight, presentationData, availablePanes)
switch self.location {
case .forum, .savedMessagesChats:
@@ -489,12 +489,12 @@ final class ChatListSearchPaneContainerNode: ASDisplayNode, ASGestureRecognizerD
guard let strongSelf = self else {
return
}
- if let (size, sideInset, bottomInset, visibleHeight, presentationData, availablePanes) = strongSelf.currentParams {
+ if let (size, sideInset, topInset, bottomInset, visibleHeight, presentationData, availablePanes) = strongSelf.currentParams {
var transition: ContainedViewLayoutTransition = .immediate
if strongSelf.pendingSwitchToPaneKey == key && strongSelf.currentPaneKey != nil {
transition = .animated(duration: 0.4, curve: .spring)
}
- strongSelf.update(size: size, sideInset: sideInset, bottomInset: bottomInset, visibleHeight: visibleHeight, presentationData: presentationData, availablePanes: availablePanes, transition: transition)
+ strongSelf.update(size: size, sideInset: sideInset, topInset: topInset, bottomInset: bottomInset, visibleHeight: visibleHeight, presentationData: presentationData, availablePanes: availablePanes, transition: transition)
}
}
if leftScope {
@@ -504,14 +504,14 @@ final class ChatListSearchPaneContainerNode: ASDisplayNode, ASGestureRecognizerD
)
self.pendingPanes[key] = pane
pane.pane.node.frame = paneFrame
- pane.pane.update(size: paneFrame.size, sideInset: sideInset, bottomInset: bottomInset, visibleHeight: visibleHeight, presentationData: presentationData, synchronous: true, transition: .immediate)
+ pane.pane.update(size: paneFrame.size, sideInset: sideInset, topInset: topInset, bottomInset: bottomInset, visibleHeight: visibleHeight, presentationData: presentationData, synchronous: true, transition: .immediate)
leftScope = true
}
}
for (key, pane) in self.pendingPanes {
pane.pane.node.frame = paneFrame
- pane.pane.update(size: paneFrame.size, sideInset: sideInset, bottomInset: bottomInset, visibleHeight: visibleHeight, presentationData: presentationData, synchronous: self.currentPaneKey == nil, transition: .immediate)
+ pane.pane.update(size: paneFrame.size, sideInset: sideInset, topInset: topInset, bottomInset: bottomInset, visibleHeight: visibleHeight, presentationData: presentationData, synchronous: self.currentPaneKey == nil, transition: .immediate)
if pane.isReady {
self.pendingPanes.removeValue(forKey: key)
@@ -587,7 +587,7 @@ final class ChatListSearchPaneContainerNode: ASDisplayNode, ASGestureRecognizerD
paneCompletion()
})
}
- pane.update(size: paneFrame.size, sideInset: sideInset, bottomInset: bottomInset, visibleHeight: visibleHeight, presentationData: presentationData, synchronous: paneWasAdded, transition: paneTransition)
+ pane.update(size: paneFrame.size, sideInset: sideInset, topInset: topInset, bottomInset: bottomInset, visibleHeight: visibleHeight, presentationData: presentationData, synchronous: paneWasAdded, transition: paneTransition)
pane.node.isCurrent = key == self.currentPaneKey
if paneWasAdded && key == self.currentPaneKey {
pane.node.didBecomeFocused()
@@ -598,7 +598,7 @@ final class ChatListSearchPaneContainerNode: ASDisplayNode, ASGestureRecognizerD
for (_, pane) in self.pendingPanes {
let paneTransition: ContainedViewLayoutTransition = .immediate
paneTransition.updateFrame(node: pane.pane.node, frame: paneFrame)
- pane.pane.update(size: paneFrame.size, sideInset: sideInset, bottomInset: bottomInset, visibleHeight: visibleHeight, presentationData: presentationData, synchronous: true, transition: paneTransition)
+ pane.pane.update(size: paneFrame.size, sideInset: sideInset, topInset: topInset, bottomInset: bottomInset, visibleHeight: visibleHeight, presentationData: presentationData, synchronous: true, transition: paneTransition)
}
if !self.didSetIsReady {
if let currentPaneKey = self.currentPaneKey, let currentPane = self.currentPanes[currentPaneKey] {
diff --git a/submodules/ChatListUI/Sources/ChatListShimmerNode.swift b/submodules/ChatListUI/Sources/ChatListShimmerNode.swift
index 2cf134e2..6ca1a33b 100644
--- a/submodules/ChatListUI/Sources/ChatListShimmerNode.swift
+++ b/submodules/ChatListUI/Sources/ChatListShimmerNode.swift
@@ -157,7 +157,6 @@ public final class ChatListShimmerNode: ASDisplayNode {
}, messageSelected: { _, _, _, _ in}, groupSelected: { _ in }, addContact: { _ in }, setPeerIdWithRevealedOptions: { _, _ in }, setItemPinned: { _, _ in }, setPeerMuted: { _, _ in }, setPeerThreadMuted: { _, _, _ in }, deletePeer: { _, _ in }, deletePeerThread: { _, _ in }, setPeerThreadStopped: { _, _, _ in }, setPeerThreadPinned: { _, _, _ in }, setPeerThreadHidden: { _, _, _ in }, updatePeerGrouping: { _, _ in }, togglePeerMarkedUnread: { _, _ in}, toggleArchivedFolderHiddenByDefault: {}, toggleThreadsSelection: { _, _ in }, hidePsa: { _ in }, activateChatPreview: { _, _, _, gesture, _ in
gesture?.cancel()
}, present: { _ in }, openForumThread: { _, _ in }, openStorageManagement: {}, openPasswordSetup: {}, openPremiumIntro: {}, openPremiumGift: { _, _ in }, openPremiumManagement: {}, openActiveSessions: {}, openBirthdaySetup: {}, performActiveSessionAction: { _, _ in }, openChatFolderUpdates: {}, hideChatFolderUpdates: {}, openStories: { _, _ in }, openStarsTopup: { _ in
- }, dismissNotice: { _ in
}, editPeer: { _ in
}, openWebApp: { _ in
}, openPhotoSetup: {
diff --git a/submodules/ChatListUI/Sources/ItemListFilterTitleInputItem.swift b/submodules/ChatListUI/Sources/ItemListFilterTitleInputItem.swift
index 127a4ae5..2f5e5b51 100644
--- a/submodules/ChatListUI/Sources/ItemListFilterTitleInputItem.swift
+++ b/submodules/ChatListUI/Sources/ItemListFilterTitleInputItem.swift
@@ -126,7 +126,7 @@ public class ItemListFilterTitleInputItemNode: ListViewItemNode, UITextFieldDele
self.maskNode = ASImageNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
}
override public func didLoad() {
diff --git a/submodules/ChatListUI/Sources/Node/ChatListArchiveInfoItem.swift b/submodules/ChatListUI/Sources/Node/ChatListArchiveInfoItem.swift
index 4dda5fe5..411cd295 100644
--- a/submodules/ChatListUI/Sources/Node/ChatListArchiveInfoItem.swift
+++ b/submodules/ChatListUI/Sources/Node/ChatListArchiveInfoItem.swift
@@ -172,7 +172,7 @@ class ChatListArchiveInfoItemNode: ListViewItemNode, ASScrollViewDelegate {
self.infoPageNodes = (0 ..< 3).map({ _ in InfoPageNode() })
self.pageControlNode.pagesCount = self.infoPageNodes.count
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.scrollNode)
self.infoPageNodes.forEach(self.scrollNode.addSubnode)
diff --git a/submodules/ChatListUI/Sources/Node/ChatListEmptyHeaderItem.swift b/submodules/ChatListUI/Sources/Node/ChatListEmptyHeaderItem.swift
index 9edf523d..a2b5e4ee 100644
--- a/submodules/ChatListUI/Sources/Node/ChatListEmptyHeaderItem.swift
+++ b/submodules/ChatListUI/Sources/Node/ChatListEmptyHeaderItem.swift
@@ -55,7 +55,7 @@ class ChatListEmptyHeaderItemNode: ListViewItemNode {
private var item: ChatListEmptyHeaderItem?
required init() {
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
}
override func layoutForParams(_ params: ListViewItemLayoutParams, item: ListViewItem, previousItem: ListViewItem?, nextItem: ListViewItem?) {
diff --git a/submodules/ChatListUI/Sources/Node/ChatListEmptyInfoItem.swift b/submodules/ChatListUI/Sources/Node/ChatListEmptyInfoItem.swift
index 21363bb4..06615f98 100644
--- a/submodules/ChatListUI/Sources/Node/ChatListEmptyInfoItem.swift
+++ b/submodules/ChatListUI/Sources/Node/ChatListEmptyInfoItem.swift
@@ -92,7 +92,7 @@ class ChatListEmptyInfoItemNode: ListViewItemNode {
self.animationNode = DefaultAnimatedStickerNodeImpl()
self.textNode = TextNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.animationNode)
self.addSubnode(self.textNode)
@@ -207,7 +207,7 @@ class ChatListSectionHeaderNode: ListViewItemNode {
private var headerNode: ListSectionHeaderNode?
required init() {
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.zPosition = 1.0
}
diff --git a/submodules/ChatListUI/Sources/Node/ChatListHoleItem.swift b/submodules/ChatListUI/Sources/Node/ChatListHoleItem.swift
index 1716677a..324f4245 100644
--- a/submodules/ChatListUI/Sources/Node/ChatListHoleItem.swift
+++ b/submodules/ChatListUI/Sources/Node/ChatListHoleItem.swift
@@ -56,7 +56,7 @@ class ChatListHoleItemNode: ListViewItemNode {
var relativePosition: (first: Bool, last: Bool) = (false, false)
required init() {
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
}
override func layoutForParams(_ params: ListViewItemLayoutParams, item: ListViewItem, previousItem: ListViewItem?, nextItem: ListViewItem?) {
@@ -153,7 +153,7 @@ class ChatListSearchEmptyFooterItemNode: ListViewItemNode {
self.searchAllMessagesTitle = TextNode()
self.searchAllMessagesTitle.isUserInteractionEnabled = false
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.contentNode)
self.contentNode.addSubnode(self.titleNode)
diff --git a/submodules/ChatListUI/Sources/Node/ChatListItem.swift b/submodules/ChatListUI/Sources/Node/ChatListItem.swift
index 46974fd9..35b8650c 100644
--- a/submodules/ChatListUI/Sources/Node/ChatListItem.swift
+++ b/submodules/ChatListUI/Sources/Node/ChatListItem.swift
@@ -15,7 +15,6 @@ import PeerOnlineMarkerNode
import LocalizedPeerData
import PeerPresenceStatusManager
import PhotoResources
-import ChatListSearchItemNode
import ContextUI
import ChatInterfaceState
import TextFormat
@@ -219,6 +218,7 @@ public enum ChatListItemContent {
public var message: EngineMessage?
public var unreadCount: Int
public var hiddenByDefault: Bool
+ public var appearsPinned: Bool
public var storyState: StoryState?
public init(
@@ -227,6 +227,7 @@ public enum ChatListItemContent {
message: EngineMessage?,
unreadCount: Int,
hiddenByDefault: Bool,
+ appearsPinned: Bool,
storyState: StoryState?
) {
self.groupId = groupId
@@ -234,6 +235,7 @@ public enum ChatListItemContent {
self.message = message
self.unreadCount = unreadCount
self.hiddenByDefault = hiddenByDefault
+ self.appearsPinned = appearsPinned
self.storyState = storyState
}
}
@@ -454,7 +456,7 @@ private final class ChatListItemTagListComponent: Component {
}
}
-public class ChatListItem: ListViewItem, ChatListSearchItemNeighbour {
+public class ChatListItem: ListViewItem {
public enum EnabledContextActions {
public struct Actions: OptionSet {
public var rawValue: Int32
@@ -1472,7 +1474,7 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
} else {
result += item.presentationData.strings.VoiceOver_ChatList_OutgoingMessage
}
- let (_, initialHideAuthor, messageText, _, _) = chatListItemStrings(strings: item.presentationData.strings, nameDisplayOrder: item.presentationData.nameDisplayOrder, dateTimeFormat: item.presentationData.dateTimeFormat, contentSettings: item.context.currentContentSettings.with { $0 }, messages: messages, chatPeer: peer, accountPeerId: item.context.account.peerId, isPeerGroup: false)
+ let (_, initialHideAuthor, messageText, _, _, _) = chatListItemStrings(strings: item.presentationData.strings, nameDisplayOrder: item.presentationData.nameDisplayOrder, dateTimeFormat: item.presentationData.dateTimeFormat, contentSettings: item.context.currentContentSettings.with { $0 }, messages: messages, chatPeer: peer, accountPeerId: item.context.account.peerId, isPeerGroup: false)
if message.flags.contains(.Incoming), !initialHideAuthor, let author = message.author, case .user = author {
result += "\n\(item.presentationData.strings.VoiceOver_ChatList_MessageFrom(author.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder)).string)"
}
@@ -1506,7 +1508,7 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
} else {
result += item.presentationData.strings.VoiceOver_ChatList_OutgoingMessage
}
- let (_, initialHideAuthor, messageText, _, _) = chatListItemStrings(strings: item.presentationData.strings, nameDisplayOrder: item.presentationData.nameDisplayOrder, dateTimeFormat: item.presentationData.dateTimeFormat, contentSettings: item.context.currentContentSettings.with { $0 }, messages: peerData.messages, chatPeer: peerData.peer, accountPeerId: item.context.account.peerId, isPeerGroup: false)
+ let (_, initialHideAuthor, messageText, _, _, _) = chatListItemStrings(strings: item.presentationData.strings, nameDisplayOrder: item.presentationData.nameDisplayOrder, dateTimeFormat: item.presentationData.dateTimeFormat, contentSettings: item.context.currentContentSettings.with { $0 }, messages: peerData.messages, chatPeer: peerData.peer, accountPeerId: item.context.account.peerId, isPeerGroup: false)
if message.flags.contains(.Incoming), !initialHideAuthor, let author = message.author, case .user = author {
result += "\n\(item.presentationData.strings.VoiceOver_ChatList_MessageFrom(author.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder)).string)"
}
@@ -1656,7 +1658,7 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
self.separatorNode = ASDisplayNode()
self.separatorNode.isLayerBacked = true
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.isAccessibilityElement = true
@@ -2452,7 +2454,7 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
let leftInset: CGFloat = params.leftInset + avatarLeftInset
enum ContentData {
- case chat(itemPeer: EngineRenderedPeer, threadInfo: ChatListItemContent.ThreadInfo?, peer: EnginePeer?, hideAuthor: Bool, messageText: String, spoilers: [NSRange]?, customEmojiRanges: [(NSRange, ChatTextInputTextCustomEmojiAttribute)]?)
+ case chat(itemPeer: EngineRenderedPeer, threadInfo: ChatListItemContent.ThreadInfo?, peer: EnginePeer?, hideAuthor: Bool, messageText: String, messageEntities: [MessageTextEntity], spoilers: [NSRange]?, customEmojiRanges: [(NSRange, ChatTextInputTextCustomEmojiAttribute)]?)
case group(peers: [EngineChatList.GroupItem.Item])
}
@@ -2461,7 +2463,7 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
var hideAuthor = false
switch contentPeer {
case let .chat(itemPeer):
- var (peer, initialHideAuthor, messageText, spoilers, customEmojiRanges) = chatListItemStrings(strings: item.presentationData.strings, nameDisplayOrder: item.presentationData.nameDisplayOrder, dateTimeFormat: item.presentationData.dateTimeFormat, contentSettings: item.context.currentContentSettings.with { $0 }, messages: messages, chatPeer: itemPeer, accountPeerId: item.context.account.peerId, enableMediaEmoji: !enableChatListPhotos, isPeerGroup: isPeerGroup)
+ var (peer, initialHideAuthor, messageText, messageEntities, spoilers, customEmojiRanges) = chatListItemStrings(strings: item.presentationData.strings, nameDisplayOrder: item.presentationData.nameDisplayOrder, dateTimeFormat: item.presentationData.dateTimeFormat, contentSettings: item.context.currentContentSettings.with { $0 }, messages: messages, chatPeer: itemPeer, accountPeerId: item.context.account.peerId, enableMediaEmoji: !enableChatListPhotos, isPeerGroup: isPeerGroup)
if case let .psa(_, maybePsaText) = promoInfo, let psaText = maybePsaText {
initialHideAuthor = true
@@ -2489,7 +2491,7 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
break
}
- contentData = .chat(itemPeer: itemPeer, threadInfo: threadInfo, peer: peer, hideAuthor: hideAuthor, messageText: messageText, spoilers: spoilers, customEmojiRanges: customEmojiRanges)
+ contentData = .chat(itemPeer: itemPeer, threadInfo: threadInfo, peer: peer, hideAuthor: hideAuthor, messageText: messageText, messageEntities: messageEntities, spoilers: spoilers, customEmojiRanges: customEmojiRanges)
hideAuthor = initialHideAuthor
case let .group(groupPeers):
contentData = .group(peers: groupPeers)
@@ -2508,7 +2510,7 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
forumTopicData = nil
topForumTopicItems = []
- if case let .chat(itemPeer, _, _, _, _, _, _) = contentData {
+ if case let .chat(itemPeer, _, _, _, _, _, _, _) = contentData {
if let messagePeer = itemPeer.chatMainPeer {
switch messagePeer {
case let .channel(channel):
@@ -2556,7 +2558,7 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
var ignoreForwardedIcon = false
switch contentData {
- case let .chat(itemPeer, _, _, _, text, spoilers, customEmojiRanges):
+ case let .chat(itemPeer, _, _, _, text, entities, spoilers, customEmojiRanges):
var isUser = false
if case .user = itemPeer.chatMainPeer {
isUser = true
@@ -2639,7 +2641,7 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
}
chatListText = (text, messageText)
}
-
+
if inlineAuthorPrefix == nil, let mediaDraftContentType {
hasDraft = true
authorAttributedString = NSAttributedString(string: item.presentationData.strings.DialogList_Draft, font: textFont, textColor: theme.messageDraftTextColor)
@@ -2671,8 +2673,8 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
if let peerText = peerText {
authorAttributedString = NSAttributedString(string: peerText, font: textFont, textColor: theme.authorNameColor)
}
-
- var entities = (message._asMessage().textEntitiesAttribute?.entities ?? []).filter { entity in
+
+ var entities = entities.filter { entity in
switch entity.type {
case .Spoiler, .CustomEmoji:
return true
@@ -2690,14 +2692,14 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
} else {
regex = loginCodeRegex
}
- if let cached = currentCustomTextEntities, cached.matches(text: message.text) {
+ if let cached = currentCustomTextEntities, cached.matches(text: messageText) {
customTextEntities = cached
- } else if let matches = regex?.matches(in: message.text, options: [], range: NSMakeRange(0, (message.text as NSString).length)) {
+ } else if let matches = regex?.matches(in: messageText, options: [], range: NSMakeRange(0, (messageText as NSString).length)) {
var entities: [MessageTextEntity] = []
if let first = matches.first {
entities.append(MessageTextEntity(range: first.range.location ..< first.range.location + first.range.length, type: .Spoiler))
}
- customTextEntities = CachedCustomTextEntities(text: message.text, textEntities: entities)
+ customTextEntities = CachedCustomTextEntities(text: messageText, textEntities: entities)
}
}
@@ -2706,14 +2708,7 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
}
let messageString: NSAttributedString
- if !message.text.isEmpty && entities.count > 0 {
- var messageText = message.text
- var entities = entities
- if !"".isEmpty, let translation = message.attributes.first(where: { $0 is TranslationMessageAttribute }) as? TranslationMessageAttribute, !translation.text.isEmpty {
- messageText = translation.text
- entities = translation.entities
- }
-
+ if !messageText.isEmpty && entities.count > 0 {
messageString = foldLineBreaks(stringWithAppliedEntities(messageText, entities: entities, baseColor: theme.messageTextColor, linkColor: theme.messageTextColor, baseFont: textFont, linkFont: textFont, boldFont: textFont, italicFont: italicTextFont, boldItalicFont: textFont, fixedFont: textFont, blockQuoteFont: textFont, underlineLinks: false, message: message._asMessage()))
} else if spoilers != nil || customEmojiRanges != nil {
let mutableString = NSMutableAttributedString(string: messageText, font: textFont, textColor: theme.messageTextColor)
@@ -3100,7 +3095,7 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
}
switch contentData {
- case let .chat(itemPeer, threadInfo, _, _, _, _, _):
+ case let .chat(itemPeer, threadInfo, _, _, _, _, _, _):
if case let .peer(peerData) = item.content, let customMessageListData = peerData.customMessageListData {
if customMessageListData.commandPrefix != nil {
titleAttributedString = nil
@@ -3854,6 +3849,9 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
transition = .immediate
}
+ transition.updateAlpha(node: strongSelf, alpha: item.hiddenOffset ? 0.0 : 1.0)
+ ComponentTransition(transition).setBlur(layer: strongSelf.layer, radius: item.hiddenOffset ? 8.0 : 0.0)
+
let contextContainerFrame = CGRect(origin: CGPoint(), size: CGSize(width: layout.contentSize.width, height: itemHeight))
// strongSelf.contextContainer.position = contextContainerFrame.center
transition.updatePosition(node: strongSelf.contextContainer, position: contextContainerFrame.center)
@@ -5031,7 +5029,7 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
if case let .groupReference(groupReferenceData) = item.content, groupReferenceData.hiddenByDefault {
separatorInset = 0.0
} else if (!nextIsPinned && isPinned) || last {
- separatorInset = 0.0
+ separatorInset = 0.0
} else {
separatorInset = editingOffset + leftInset + rawContentRect.origin.x
}
@@ -5057,8 +5055,8 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
highlightedBackgroundColor = theme.itemHighlightedBackgroundColor
} else if isPinned {
if case let .groupReference(groupReferenceData) = item.content, groupReferenceData.hiddenByDefault {
- backgroundColor = theme.itemBackgroundColor
- highlightedBackgroundColor = theme.itemHighlightedBackgroundColor
+ backgroundColor = groupReferenceData.appearsPinned ? theme.pinnedItemBackgroundColor : theme.itemBackgroundColor
+ highlightedBackgroundColor = groupReferenceData.appearsPinned ? theme.pinnedItemHighlightedBackgroundColor : theme.itemHighlightedBackgroundColor
} else {
backgroundColor = theme.pinnedItemBackgroundColor
highlightedBackgroundColor = theme.pinnedItemHighlightedBackgroundColor
diff --git a/submodules/ChatListUI/Sources/Node/ChatListItemStrings.swift b/submodules/ChatListUI/Sources/Node/ChatListItemStrings.swift
index ba82ca6f..a356607d 100644
--- a/submodules/ChatListUI/Sources/Node/ChatListItemStrings.swift
+++ b/submodules/ChatListUI/Sources/Node/ChatListItemStrings.swift
@@ -77,20 +77,21 @@ private func paidContentGroupType(paidContent: TelegramMediaPaidContent) -> Mess
return currentType
}
-public func chatListItemStrings(strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, dateTimeFormat: PresentationDateTimeFormat, contentSettings: ContentSettings, messages: [EngineMessage], chatPeer: EngineRenderedPeer, accountPeerId: EnginePeer.Id, enableMediaEmoji: Bool = true, isPeerGroup: Bool = false) -> (peer: EnginePeer?, hideAuthor: Bool, messageText: String, spoilers: [NSRange]?, customEmojiRanges: [(NSRange, ChatTextInputTextCustomEmojiAttribute)]?) {
+public func chatListItemStrings(strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, dateTimeFormat: PresentationDateTimeFormat, contentSettings: ContentSettings, messages: [EngineMessage], chatPeer: EngineRenderedPeer, accountPeerId: EnginePeer.Id, enableMediaEmoji: Bool = true, isPeerGroup: Bool = false) -> (peer: EnginePeer?, hideAuthor: Bool, messageText: String, messageEntities: [MessageTextEntity], spoilers: [NSRange]?, customEmojiRanges: [(NSRange, ChatTextInputTextCustomEmojiAttribute)]?) {
let peer: EnginePeer?
let message = messages.last
if let restrictionReason = message?._asMessage().restrictionReason(platform: "ios", contentSettings: contentSettings) {
- return (nil, false, restrictionReason, nil, nil)
+ return (nil, false, restrictionReason, [], nil, nil)
}
if let restrictionReason = chatPeer.chatMainPeer?.restrictionText(platform: "ios", contentSettings: contentSettings) {
- return (nil, false, restrictionReason, nil, nil)
+ return (nil, false, restrictionReason, [], nil, nil)
}
var hideAuthor = false
var messageText: String
+ var messageEntities: [MessageTextEntity] = []
var spoilers: [NSRange]?
var customEmojiRanges: [(NSRange, ChatTextInputTextCustomEmojiAttribute)]?
if let message = message {
@@ -104,6 +105,7 @@ public func chatListItemStrings(strings: PresentationStrings, nameDisplayOrder:
for message in messages {
if !message.text.isEmpty {
messageText = message.text
+ messageEntities = message._asMessage().textEntitiesAttribute?.entities ?? []
break
}
}
@@ -469,5 +471,5 @@ public func chatListItemStrings(strings: PresentationStrings, nameDisplayOrder:
}
}
- return (peer, hideAuthor, messageText, spoilers, customEmojiRanges)
+ return (peer, hideAuthor, messageText, messageEntities, spoilers, customEmojiRanges)
}
diff --git a/submodules/ChatListUI/Sources/Node/ChatListNode.swift b/submodules/ChatListUI/Sources/Node/ChatListNode.swift
index ad864f6b..b7df981a 100644
--- a/submodules/ChatListUI/Sources/Node/ChatListNode.swift
+++ b/submodules/ChatListUI/Sources/Node/ChatListNode.swift
@@ -23,6 +23,7 @@ import ChatListHeaderComponent
import UndoUI
import NewSessionInfoScreen
import PresentationDataUtils
+import GlobalControlPanelsContext
public enum ChatListNodeMode {
case chatList(appendContacts: Bool)
@@ -110,7 +111,6 @@ public final class ChatListNodeInteraction {
let hideChatFolderUpdates: () -> Void
let openStories: (ChatListNode.OpenStoriesSubject, ASDisplayNode?) -> Void
let openStarsTopup: (Int64?) -> Void
- let dismissNotice: (ChatListNotice) -> Void
let editPeer: (ChatListItem) -> Void
let openWebApp: (TelegramUser) -> Void
let openPhotoSetup: () -> Void
@@ -171,7 +171,6 @@ public final class ChatListNodeInteraction {
hideChatFolderUpdates: @escaping () -> Void,
openStories: @escaping (ChatListNode.OpenStoriesSubject, ASDisplayNode?) -> Void,
openStarsTopup: @escaping (Int64?) -> Void,
- dismissNotice: @escaping (ChatListNotice) -> Void,
editPeer: @escaping (ChatListItem) -> Void,
openWebApp: @escaping (TelegramUser) -> Void,
openPhotoSetup: @escaping () -> Void,
@@ -219,7 +218,6 @@ public final class ChatListNodeInteraction {
self.hideChatFolderUpdates = hideChatFolderUpdates
self.openStories = openStories
self.openStarsTopup = openStarsTopup
- self.dismissNotice = dismissNotice
self.editPeer = editPeer
self.openWebApp = openWebApp
self.openPhotoSetup = openPhotoSetup
@@ -698,6 +696,7 @@ private func mappedInsertEntries(context: AccountContext, nodeInteraction: ChatL
message: groupReferenceEntry.message,
unreadCount: groupReferenceEntry.unreadCount,
hiddenByDefault: groupReferenceEntry.hiddenByDefault,
+ appearsPinned: groupReferenceEntry.appearsPinned,
storyState: groupReferenceEntry.storyState.flatMap { storyState in
return ChatListItemContent.StoryState(
stats: storyState.stats,
@@ -751,47 +750,6 @@ private func mappedInsertEntries(context: AccountContext, nodeInteraction: ChatL
return ListViewInsertItem(index: entry.index, previousIndex: entry.previousIndex, item: ChatListSectionHeaderItem(theme: presentationData.theme, strings: presentationData.strings, hide: displayHide ? {
hideChatListContacts(context: context)
} : nil), directionHint: entry.directionHint)
- case let .Notice(presentationData, notice):
- return ListViewInsertItem(index: entry.index, previousIndex: entry.previousIndex, item: ChatListNoticeItem(context: context, theme: presentationData.theme, strings: presentationData.strings, notice: notice, action: { [weak nodeInteraction] action in
- switch action {
- case .activate:
- switch notice {
- case .clearStorage:
- nodeInteraction?.openStorageManagement()
- case .setupPassword:
- nodeInteraction?.openPasswordSetup()
- case .premiumUpgrade, .premiumAnnualDiscount, .premiumRestore:
- nodeInteraction?.openPremiumIntro()
- case .xmasPremiumGift:
- nodeInteraction?.openPremiumGift([], nil)
- case .premiumGrace:
- nodeInteraction?.openPremiumManagement()
- case .setupBirthday:
- nodeInteraction?.openBirthdaySetup()
- case let .birthdayPremiumGift(peers, birthdays):
- nodeInteraction?.openPremiumGift(peers, birthdays)
- case .reviewLogin:
- break
- case let .starsSubscriptionLowBalance(amount, _):
- nodeInteraction?.openStarsTopup(amount.value)
- case .setupPhoto:
- nodeInteraction?.openPhotoSetup()
- case .accountFreeze:
- nodeInteraction?.openAccountFreezeInfo()
- case let .link(_, url, _, _):
- nodeInteraction?.openUrl(url)
- }
- case .hide:
- nodeInteraction?.dismissNotice(notice)
- case let .buttonChoice(isPositive):
- switch notice {
- case let .reviewLogin(newSessionReview, _):
- nodeInteraction?.performActiveSessionAction(newSessionReview, isPositive)
- default:
- break
- }
- }
- }), directionHint: entry.directionHint)
}
}
}
@@ -1048,6 +1006,7 @@ private func mappedUpdateEntries(context: AccountContext, nodeInteraction: ChatL
message: groupReferenceEntry.message,
unreadCount: groupReferenceEntry.unreadCount,
hiddenByDefault: groupReferenceEntry.hiddenByDefault,
+ appearsPinned: groupReferenceEntry.appearsPinned,
storyState: groupReferenceEntry.storyState.flatMap { storyState in
return ChatListItemContent.StoryState(
stats: storyState.stats,
@@ -1101,47 +1060,6 @@ private func mappedUpdateEntries(context: AccountContext, nodeInteraction: ChatL
return ListViewUpdateItem(index: entry.index, previousIndex: entry.previousIndex, item: ChatListSectionHeaderItem(theme: presentationData.theme, strings: presentationData.strings, hide: displayHide ? {
hideChatListContacts(context: context)
} : nil), directionHint: entry.directionHint)
- case let .Notice(presentationData, notice):
- return ListViewUpdateItem(index: entry.index, previousIndex: entry.previousIndex, item: ChatListNoticeItem(context: context, theme: presentationData.theme, strings: presentationData.strings, notice: notice, action: { [weak nodeInteraction] action in
- switch action {
- case .activate:
- switch notice {
- case .clearStorage:
- nodeInteraction?.openStorageManagement()
- case .setupPassword:
- nodeInteraction?.openPasswordSetup()
- case .premiumUpgrade, .premiumAnnualDiscount, .premiumRestore:
- nodeInteraction?.openPremiumIntro()
- case .xmasPremiumGift:
- nodeInteraction?.openPremiumGift([], nil)
- case .premiumGrace:
- nodeInteraction?.openPremiumManagement()
- case .setupBirthday:
- nodeInteraction?.openBirthdaySetup()
- case let .birthdayPremiumGift(peers, birthdays):
- nodeInteraction?.openPremiumGift(peers, birthdays)
- case .reviewLogin:
- break
- case let .starsSubscriptionLowBalance(amount, _):
- nodeInteraction?.openStarsTopup(amount.value)
- case .setupPhoto:
- nodeInteraction?.openPhotoSetup()
- case .accountFreeze:
- nodeInteraction?.openAccountFreezeInfo()
- case let .link(_, url, _, _):
- nodeInteraction?.openUrl(url)
- }
- case .hide:
- nodeInteraction?.dismissNotice(notice)
- case let .buttonChoice(isPositive):
- switch notice {
- case let .reviewLogin(newSessionReview, _):
- nodeInteraction?.performActiveSessionAction(newSessionReview, isPositive)
- default:
- break
- }
- }
- }), directionHint: entry.directionHint)
case .HeaderEntry:
return ListViewUpdateItem(index: entry.index, previousIndex: entry.previousIndex, item: ChatListEmptyHeaderItem(), directionHint: entry.directionHint)
case let .AdditionalCategory(index: _, id, title, image, appearance, selected, presentationData):
@@ -1282,7 +1200,7 @@ public final class ChatListNode: ListView {
return []
}
}
- private var interaction: ChatListNodeInteraction?
+ public private(set) var interaction: ChatListNodeInteraction?
private var dequeuedInitialTransitionOnLayout = false
private var enqueuedTransition: (ChatListNodeListViewTransition, () -> Void)?
@@ -1383,7 +1301,6 @@ public final class ChatListNode: ListView {
private let autoSetReady: Bool
public let isMainTab = ValuePromise(false, ignoreRepeated: true)
- private let suggestedChatListNotice = Promise(nil)
public var synchronousDrawingWhenNotAnimated: Bool = false
@@ -1868,38 +1785,6 @@ public final class ChatListNode: ListView {
return
}
self.openStarsTopup?(amount)
- }, dismissNotice: { [weak self] notice in
- guard let self else {
- return
- }
- let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
- switch notice {
- case .xmasPremiumGift:
- let _ = self.context.engine.notices.dismissServerProvidedSuggestion(suggestion: ServerProvidedSuggestion.xmasPremiumGift.id).startStandalone()
- self.present?(UndoOverlayController(presentationData: presentationData, content: .universal(animation: "anim_gift", scale: 0.058, colors: ["__allcolors__": UIColor.white], title: nil, text: presentationData.strings.ChatList_PremiumGiftInSettingsInfo, customUndoText: nil, timeout: 5.0), elevatedLayout: false, action: { _ in
- return true
- }))
- case .setupBirthday:
- let _ = self.context.engine.notices.dismissServerProvidedSuggestion(suggestion: ServerProvidedSuggestion.setupBirthday.id).startStandalone()
- self.present?(UndoOverlayController(presentationData: presentationData, content: .universal(animation: "anim_gift", scale: 0.058, colors: ["__allcolors__": UIColor.white], title: nil, text: presentationData.strings.ChatList_BirthdayInSettingsInfo, customUndoText: nil, timeout: 5.0), elevatedLayout: false, action: { _ in
- return true
- }))
- case .birthdayPremiumGift:
- let _ = self.context.engine.notices.dismissServerProvidedSuggestion(suggestion: ServerProvidedSuggestion.todayBirthdays.id).startStandalone()
- self.present?(UndoOverlayController(presentationData: presentationData, content: .universal(animation: "anim_gift", scale: 0.058, colors: ["__allcolors__": UIColor.white], title: nil, text: presentationData.strings.ChatList_PremiumGiftInSettingsInfo, customUndoText: nil, timeout: 5.0), elevatedLayout: false, action: { _ in
- return true
- }))
- case .premiumGrace:
- let _ = self.context.engine.notices.dismissServerProvidedSuggestion(suggestion: ServerProvidedSuggestion.gracePremium.id).startStandalone()
- case .setupPhoto:
- let _ = self.context.engine.notices.dismissServerProvidedSuggestion(suggestion: ServerProvidedSuggestion.setupPhoto.id).startStandalone()
- case .starsSubscriptionLowBalance:
- let _ = self.context.engine.notices.dismissServerProvidedSuggestion(suggestion: ServerProvidedSuggestion.starsSubscriptionLowBalance.id).startStandalone()
- case let .link(id, _, _, _):
- let _ = self.context.engine.notices.dismissServerProvidedSuggestion(suggestion: id).startStandalone()
- default:
- break
- }
}, editPeer: { _ in
}, openWebApp: { [weak self] user in
guard let self else {
@@ -1992,172 +1877,12 @@ public final class ChatListNode: ListView {
} else {
displayArchiveIntro = .single(false)
}
-
- let starsSubscriptionsContextPromise = Promise(nil)
self.updateIsMainTabDisposable = (self.isMainTab.get()
- |> deliverOnMainQueue).startStrict(next: { [weak self] isMainTab in
- guard let self else {
- return
+ |> deliverOnMainQueue).startStrict(next: { isMainTab in
+ if isMainTab {
+ let _ = context.engine.privacy.cleanupSessionReviews().startStandalone()
}
-
- guard case .chatList(groupId: .root) = location, isMainTab else {
- self.suggestedChatListNotice.set(.single(nil))
- return
- }
-
- let _ = context.engine.privacy.cleanupSessionReviews().startStandalone()
-
- let twoStepData: Signal = .single(nil) |> then(context.engine.auth.twoStepVerificationConfiguration() |> map(Optional.init))
-
- let accountFreezeConfiguration = (context.account.postbox.preferencesView(keys: [PreferencesKeys.appConfiguration])
- |> map { view -> AppConfiguration in
- let appConfiguration: AppConfiguration = view.values[PreferencesKeys.appConfiguration]?.get(AppConfiguration.self) ?? AppConfiguration.defaultValue
- return appConfiguration
- }
- |> distinctUntilChanged
- |> map { appConfiguration -> AccountFreezeConfiguration in
- return AccountFreezeConfiguration.with(appConfiguration: appConfiguration)
- })
-
- let suggestedChatListNoticeSignal: Signal = combineLatest(
- context.engine.notices.getServerProvidedSuggestions(),
- context.engine.notices.getServerDismissedSuggestions(),
- twoStepData,
- newSessionReviews(postbox: context.account.postbox),
- context.engine.data.subscribe(
- TelegramEngine.EngineData.Item.Peer.Peer(id: context.account.peerId),
- TelegramEngine.EngineData.Item.Peer.Birthday(id: context.account.peerId)
- ),
- context.account.stateManager.contactBirthdays,
- starsSubscriptionsContextPromise.get(),
- accountFreezeConfiguration
- )
- |> mapToSignal { suggestions, dismissedSuggestions, configuration, newSessionReviews, data, birthdays, starsSubscriptionsContext, accountFreezeConfiguration -> Signal in
- let (accountPeer, birthday) = data
-
- if let newSessionReview = newSessionReviews.first {
- return .single(.reviewLogin(newSessionReview: newSessionReview, totalCount: newSessionReviews.count))
- }
- if suggestions.contains(.setupPassword), let configuration {
- var notSet = false
- switch configuration {
- case let .notSet(pendingEmail):
- if pendingEmail == nil {
- notSet = true
- }
- case .set:
- break
- }
- if notSet {
- return .single(.setupPassword)
- }
- }
-
- let today = Calendar(identifier: .gregorian).component(.day, from: Date())
- var todayBirthdayPeerIds: [EnginePeer.Id] = []
- for (peerId, birthday) in birthdays {
- if birthday.day == today {
- todayBirthdayPeerIds.append(peerId)
- }
- }
- todayBirthdayPeerIds.sort { lhs, rhs in
- return lhs < rhs
- }
-
- if dismissedSuggestions.contains(ServerProvidedSuggestion.todayBirthdays.id) {
- todayBirthdayPeerIds = []
- }
-
- if let _ = accountFreezeConfiguration.freezeUntilDate {
- return .single(.accountFreeze)
- } else if suggestions.contains(.starsSubscriptionLowBalance) {
- if let starsSubscriptionsContext {
- return starsSubscriptionsContext.state
- |> map { state in
- if state.balance > StarsAmount.zero && !state.subscriptions.isEmpty {
- return .starsSubscriptionLowBalance(
- amount: state.balance,
- peers: state.subscriptions.map { $0.peer }
- )
- } else {
- return nil
- }
- }
- } else {
- starsSubscriptionsContextPromise.set(.single(context.engine.payments.peerStarsSubscriptionsContext(starsContext: nil, missingBalance: true)))
- return .single(nil)
- }
- } else if suggestions.contains(.setupPhoto), let accountPeer, accountPeer.smallProfileImage == nil {
- return .single(.setupPhoto(accountPeer))
- } else if suggestions.contains(.gracePremium) {
- return .single(.premiumGrace)
- } else if suggestions.contains(.xmasPremiumGift) {
- return .single(.xmasPremiumGift)
- } else if suggestions.contains(.annualPremium) || suggestions.contains(.upgradePremium) || suggestions.contains(.restorePremium), let inAppPurchaseManager = context.inAppPurchaseManager {
- return inAppPurchaseManager.availableProducts
- |> map { products -> ChatListNotice? in
- if products.count > 1 {
- let shortestOptionPrice: (Int64, NSDecimalNumber)
- if let product = products.first(where: { $0.id.hasSuffix(".monthly") }) {
- shortestOptionPrice = (Int64(Float(product.priceCurrencyAndAmount.amount)), product.priceValue)
- } else {
- shortestOptionPrice = (1, NSDecimalNumber(decimal: 1))
- }
- for product in products {
- if product.id.hasSuffix(".annual") {
- let fraction = Float(product.priceCurrencyAndAmount.amount) / Float(12) / Float(shortestOptionPrice.0)
- let discount = Int32(round((1.0 - fraction) * 20.0) * 5.0)
- if discount > 0 {
- if suggestions.contains(.restorePremium) {
- return .premiumRestore(discount: discount)
- } else if suggestions.contains(.annualPremium) {
- return .premiumAnnualDiscount(discount: discount)
- } else if suggestions.contains(.upgradePremium) {
- return .premiumUpgrade(discount: discount)
- }
- }
- break
- }
- }
- return nil
- } else {
- if !GlobalExperimentalSettings.isAppStoreBuild {
- if suggestions.contains(.restorePremium) {
- return .premiumRestore(discount: 0)
- } else if suggestions.contains(.annualPremium) {
- return .premiumAnnualDiscount(discount: 0)
- } else if suggestions.contains(.upgradePremium) {
- return .premiumUpgrade(discount: 0)
- }
- }
- return nil
- }
- }
- } else if !todayBirthdayPeerIds.isEmpty {
- return context.engine.data.get(
- EngineDataMap(todayBirthdayPeerIds.map(TelegramEngine.EngineData.Item.Peer.Peer.init(id:)))
- )
- |> map { result -> ChatListNotice? in
- var todayBirthdayPeers: [EnginePeer] = []
- for (peerId, _) in birthdays {
- if let maybePeer = result[peerId], let peer = maybePeer {
- todayBirthdayPeers.append(peer)
- }
- }
- return .birthdayPremiumGift(peers: todayBirthdayPeers, birthdays: birthdays)
- }
- } else if suggestions.contains(.setupBirthday) && birthday == nil {
- return .single(.setupBirthday)
- } else if case let .link(id, url, title, subtitle) = suggestions.first(where: { if case .link = $0 { return true } else { return false} }) {
- return .single(.link(id: id, url: url, title: title, subtitle: subtitle))
- } else {
- return .single(nil)
- }
- }
- |> distinctUntilChanged
-
- self.suggestedChatListNotice.set(suggestedChatListNoticeSignal)
}).strict()
let storageInfo: Signal
@@ -2346,7 +2071,6 @@ public final class ChatListNode: ListView {
hideArchivedFolderByDefault,
displayArchiveIntro,
storageInfo,
- suggestedChatListNotice.get(),
savedMessagesPeer,
chatListViewUpdate,
self.statePromise.get(),
@@ -2354,23 +2078,14 @@ public final class ChatListNode: ListView {
chatListFilters,
accountIsPremium
)
- |> mapToQueue { (hideArchivedFolderByDefault, displayArchiveIntro, storageInfo, suggestedChatListNotice, savedMessagesPeer, updateAndFilter, state, contacts, chatListFilters, accountIsPremium) -> Signal in
+ |> mapToQueue { (hideArchivedFolderByDefault, displayArchiveIntro, storageInfo, savedMessagesPeer, updateAndFilter, state, contacts, chatListFilters, accountIsPremium) -> Signal in
let (update, filter) = updateAndFilter
let previousHideArchivedFolderByDefaultValue = previousHideArchivedFolderByDefault.swap(hideArchivedFolderByDefault)
- let notice: ChatListNotice?
- if let suggestedChatListNotice {
- notice = suggestedChatListNotice
- } else if let storageInfo {
- notice = .clearStorage(sizeFraction: storageInfo)
- } else {
- notice = nil
- }
-
let innerIsMainTab = location == .chatList(groupId: .root) && chatListFilter == nil
- let (rawEntries, isLoading) = chatListNodeEntriesForView(view: update.list, state: state, savedMessagesPeer: savedMessagesPeer, foundPeers: state.foundPeers, hideArchivedFolderByDefault: hideArchivedFolderByDefault, displayArchiveIntro: displayArchiveIntro, notice: notice, mode: mode, chatListLocation: location, contacts: contacts, accountPeerId: accountPeerId, isMainTab: innerIsMainTab)
+ let (rawEntries, isLoading) = chatListNodeEntriesForView(view: update.list, state: state, savedMessagesPeer: savedMessagesPeer, foundPeers: state.foundPeers, hideArchivedFolderByDefault: hideArchivedFolderByDefault, displayArchiveIntro: displayArchiveIntro, mode: mode, chatListLocation: location, contacts: contacts, accountPeerId: accountPeerId, isMainTab: innerIsMainTab)
var isEmpty = true
var entries = rawEntries.filter { entry in
switch entry {
@@ -2697,7 +2412,6 @@ public final class ChatListNode: ListView {
var didIncludeRemovingPeerId = false
var didIncludeHiddenByDefaultArchive = false
var didIncludeHiddenThread = false
- var didIncludeNotice = false
if let previous = previousView {
for entry in previous.filteredEntries {
if case let .PeerEntry(peerEntry) = entry {
@@ -2724,15 +2438,12 @@ public final class ChatListNode: ListView {
}
} else if case let .GroupReferenceEntry(groupReferenceEntry) = entry {
didIncludeHiddenByDefaultArchive = groupReferenceEntry.hiddenByDefault
- } else if case .Notice = entry {
- didIncludeNotice = true
}
}
}
var doesIncludeRemovingPeerId = false
var doesIncludeArchive = false
var doesIncludeHiddenByDefaultArchive = false
- var doesIncludeNotice = false
var doesIncludeHiddenThread = false
for entry in processedView.filteredEntries {
@@ -2761,8 +2472,6 @@ public final class ChatListNode: ListView {
} else if case let .GroupReferenceEntry(groupReferenceEntry) = entry {
doesIncludeArchive = true
doesIncludeHiddenByDefaultArchive = groupReferenceEntry.hiddenByDefault
- } else if case .Notice = entry {
- doesIncludeNotice = true
}
}
if previousPinnedChats != updatedPinnedChats || previousPinnedThreads != updatedPinnedThreads {
@@ -2789,9 +2498,6 @@ public final class ChatListNode: ListView {
if didIncludeHiddenThread != doesIncludeHiddenThread {
disableAnimations = false
}
- if didIncludeNotice != doesIncludeNotice {
- disableAnimations = false
- }
}
if let _ = previousHideArchivedFolderByDefaultValue, previousHideArchivedFolderByDefaultValue != hideArchivedFolderByDefault {
@@ -3547,8 +3253,10 @@ public final class ChatListNode: ListView {
if entryCount - 1 - i < 0 {
continue
}
- if case .PeerEntry = transition.chatListView.filteredEntries[entryCount - 1 - i] {
- } else {
+ switch transition.chatListView.filteredEntries[entryCount - 1 - i] {
+ case .PeerEntry, .GroupReferenceEntry:
+ break
+ default:
continue
}
if case let .index(index) = transition.chatListView.filteredEntries[entryCount - 1 - i].sortIndex, case let .chatList(chatListIndex) = index, chatListIndex.pinningIndex != nil {
@@ -3658,7 +3366,7 @@ public final class ChatListNode: ListView {
} else {
break loop
}
- case .ArchiveIntro, .EmptyIntro, .SectionHeader, .Notice, .HeaderEntry, .AdditionalCategory:
+ case .ArchiveIntro, .EmptyIntro, .SectionHeader, .HeaderEntry, .AdditionalCategory:
break
}
}
diff --git a/submodules/ChatListUI/Sources/Node/ChatListNodeEntries.swift b/submodules/ChatListUI/Sources/Node/ChatListNodeEntries.swift
index dfc33618..cd42c2a4 100644
--- a/submodules/ChatListUI/Sources/Node/ChatListNodeEntries.swift
+++ b/submodules/ChatListUI/Sources/Node/ChatListNodeEntries.swift
@@ -79,23 +79,6 @@ public enum ChatListNodeEntryPromoInfo: Equatable {
case psa(type: String, message: String?)
}
-public enum ChatListNotice: Equatable {
- case clearStorage(sizeFraction: Double)
- case setupPassword
- case premiumUpgrade(discount: Int32)
- case premiumAnnualDiscount(discount: Int32)
- case premiumRestore(discount: Int32)
- case xmasPremiumGift
- case setupBirthday
- case birthdayPremiumGift(peers: [EnginePeer], birthdays: [EnginePeer.Id: TelegramBirthday])
- case reviewLogin(newSessionReview: NewSessionReview, totalCount: Int)
- case premiumGrace
- case starsSubscriptionLowBalance(amount: StarsAmount, peers: [EnginePeer])
- case setupPhoto(EnginePeer)
- case accountFreeze
- case link(id: String, url: String, title: ServerSuggestionInfo.Item.Text, subtitle: ServerSuggestionInfo.Item.Text)
-}
-
enum ChatListNodeEntry: Comparable, Identifiable {
struct PeerEntryData: Equatable {
var index: EngineChatList.Item.Index
@@ -339,6 +322,7 @@ enum ChatListNodeEntry: Comparable, Identifiable {
var unreadCount: Int
var revealed: Bool
var hiddenByDefault: Bool
+ var appearsPinned: Bool
var storyState: ChatListNodeState.StoryState?
init(
@@ -351,6 +335,7 @@ enum ChatListNodeEntry: Comparable, Identifiable {
unreadCount: Int,
revealed: Bool,
hiddenByDefault: Bool,
+ appearsPinned: Bool,
storyState: ChatListNodeState.StoryState?
) {
self.index = index
@@ -362,6 +347,7 @@ enum ChatListNodeEntry: Comparable, Identifiable {
self.unreadCount = unreadCount
self.revealed = revealed
self.hiddenByDefault = hiddenByDefault
+ self.appearsPinned = appearsPinned
self.storyState = storyState
}
@@ -393,6 +379,9 @@ enum ChatListNodeEntry: Comparable, Identifiable {
if lhs.hiddenByDefault != rhs.hiddenByDefault {
return false
}
+ if lhs.appearsPinned != rhs.appearsPinned {
+ return false
+ }
if lhs.storyState != rhs.storyState {
return false
}
@@ -409,7 +398,6 @@ enum ChatListNodeEntry: Comparable, Identifiable {
case ArchiveIntro(presentationData: ChatListPresentationData)
case EmptyIntro(presentationData: ChatListPresentationData)
case SectionHeader(presentationData: ChatListPresentationData, displayHide: Bool)
- case Notice(presentationData: ChatListPresentationData, notice: ChatListNotice)
case AdditionalCategory(index: Int, id: Int, title: String, image: UIImage?, appearance: ChatListNodeAdditionalCategory.Appearance, selected: Bool, presentationData: ChatListPresentationData)
var sortIndex: ChatListNodeEntrySortIndex {
@@ -430,8 +418,6 @@ enum ChatListNodeEntry: Comparable, Identifiable {
return .index(.chatList(EngineChatList.Item.Index.ChatList.absoluteUpperBound.successor))
case .SectionHeader:
return .sectionHeader
- case .Notice:
- return .index(.chatList(EngineChatList.Item.Index.ChatList.absoluteUpperBound.successor.successor))
case let .AdditionalCategory(index, _, _, _, _, _, _):
return .additionalCategory(index)
}
@@ -460,8 +446,6 @@ enum ChatListNodeEntry: Comparable, Identifiable {
return .EmptyIntro
case .SectionHeader:
return .SectionHeader
- case .Notice:
- return .Notice
case let .AdditionalCategory(_, id, _, _, _, _, _):
return .additionalCategory(id)
}
@@ -534,18 +518,6 @@ enum ChatListNodeEntry: Comparable, Identifiable {
} else {
return false
}
- case let .Notice(lhsPresentationData, lhsInfo):
- if case let .Notice(rhsPresentationData, rhsInfo) = rhs {
- if lhsPresentationData !== rhsPresentationData {
- return false
- }
- if lhsInfo != rhsInfo {
- return false
- }
- return true
- } else {
- return false
- }
case let .AdditionalCategory(lhsIndex, lhsId, lhsTitle, lhsImage, lhsAppearance, lhsSelected, lhsPresentationData):
if case let .AdditionalCategory(rhsIndex, rhsId, rhsTitle, rhsImage, rhsAppearance, rhsSelected, rhsPresentationData) = rhs {
if lhsIndex != rhsIndex {
@@ -595,7 +567,7 @@ struct ChatListContactPeer {
}
}
-func chatListNodeEntriesForView(view: EngineChatList, state: ChatListNodeState, savedMessagesPeer: EnginePeer?, foundPeers: [(EnginePeer, EnginePeer?)], hideArchivedFolderByDefault: Bool, displayArchiveIntro: Bool, notice: ChatListNotice?, mode: ChatListNodeMode, chatListLocation: ChatListControllerLocation, contacts: [ChatListContactPeer], accountPeerId: EnginePeer.Id, isMainTab: Bool) -> (entries: [ChatListNodeEntry], loading: Bool) {
+func chatListNodeEntriesForView(view: EngineChatList, state: ChatListNodeState, savedMessagesPeer: EnginePeer?, foundPeers: [(EnginePeer, EnginePeer?)], hideArchivedFolderByDefault: Bool, displayArchiveIntro: Bool, mode: ChatListNodeMode, chatListLocation: ChatListControllerLocation, contacts: [ChatListContactPeer], accountPeerId: EnginePeer.Id, isMainTab: Bool) -> (entries: [ChatListNodeEntry], loading: Bool) {
var groupItems = view.groupItems
if isMainTab && state.archiveStoryState != nil && groupItems.isEmpty {
groupItems.append(EngineChatList.GroupItem(
@@ -656,6 +628,8 @@ func chatListNodeEntriesForView(view: EngineChatList, state: ChatListNodeState,
var hiddenGeneralThread: ChatListNodeEntry?
+ var hasPinned = false
+
loop: for entry in view.items {
var peerId: EnginePeer.Id?
var threadId: Int64?
@@ -707,6 +681,17 @@ func chatListNodeEntriesForView(view: EngineChatList, state: ChatListNodeState,
if let threadData = entry.threadData, let threadId {
threadInfo = ChatListItemContent.ThreadInfo(id: threadId, info: threadData.info, isOwnedByMe: threadData.isOwnedByMe, isClosed: threadData.isClosed, isHidden: threadData.isHidden, threadPeer: nil)
}
+
+ switch entry.index {
+ case let .chatList(chatList):
+ if chatList.pinningIndex != nil {
+ hasPinned = true
+ }
+ case let .forum(pinnedIndex, _, _, _, _):
+ if case .index = pinnedIndex {
+ hasPinned = true
+ }
+ }
let entry: ChatListNodeEntry = .PeerEntry(ChatListNodeEntry.PeerEntryData(
index: offsetPinnedIndex(entry.index, offset: pinnedIndexOffset),
@@ -796,6 +781,7 @@ func chatListNodeEntriesForView(view: EngineChatList, state: ChatListNodeState,
)))
if foundPinningIndex != 0 {
foundPinningIndex -= 1
+ hasPinned = true
}
}
}
@@ -886,6 +872,7 @@ func chatListNodeEntriesForView(view: EngineChatList, state: ChatListNodeState,
)))
if pinningIndex != 0 {
pinningIndex -= 1
+ hasPinned = true
}
}
}
@@ -908,10 +895,12 @@ func chatListNodeEntriesForView(view: EngineChatList, state: ChatListNodeState,
unreadCount: groupReference.unreadCount,
revealed: state.hiddenItemShouldBeTemporaryRevealed,
hiddenByDefault: hideArchivedFolderByDefault,
+ appearsPinned: hasPinned,
storyState: mappedStoryState
)))
if pinningIndex != 0 {
pinningIndex -= 1
+ hasPinned = true
}
}
@@ -927,10 +916,6 @@ func chatListNodeEntriesForView(view: EngineChatList, state: ChatListNodeState,
result.append(.EmptyIntro(presentationData: state.presentationData))
}
- if let notice {
- result.append(.Notice(presentationData: state.presentationData, notice: notice))
- }
-
result.append(.HeaderEntry)
}
diff --git a/submodules/ChatPresentationInterfaceState/Sources/ChatPresentationInterfaceState.swift b/submodules/ChatPresentationInterfaceState/Sources/ChatPresentationInterfaceState.swift
index 6b677831..b6134692 100644
--- a/submodules/ChatPresentationInterfaceState/Sources/ChatPresentationInterfaceState.swift
+++ b/submodules/ChatPresentationInterfaceState/Sources/ChatPresentationInterfaceState.swift
@@ -339,14 +339,6 @@ public struct ChatActiveGroupCallInfo: Equatable {
}
}
-public struct ChatPresentationImportState: Equatable {
- public var progress: Float
-
- public init(progress: Float) {
- self.progress = progress
- }
-}
-
public struct ChatPresentationTranslationState: Equatable {
public var isEnabled: Bool
public var fromLang: String
@@ -526,7 +518,6 @@ public final class ChatPresentationInterfaceState: Equatable {
public let pendingUnpinnedAllMessages: Bool
public let activeGroupCallInfo: ChatActiveGroupCallInfo?
public let hasActiveGroupCall: Bool
- public let importState: ChatPresentationImportState?
public let reportReason: ReportReasonData?
public let showCommands: Bool
public let hasBotCommands: Bool
@@ -568,7 +559,7 @@ public final class ChatPresentationInterfaceState: Equatable {
public let persistentData: PersistentPeerData
public let removePaidMessageFeeData: RemovePaidMessageFeeData?
- public init(chatWallpaper: TelegramWallpaper, theme: PresentationTheme, strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, nameDisplayOrder: PresentationPersonNameOrder, limitsConfiguration: LimitsConfiguration, fontSize: PresentationFontSize, bubbleCorners: PresentationChatBubbleCorners, accountPeerId: PeerId, mode: ChatControllerPresentationMode, chatLocation: ChatLocation, subject: ChatControllerSubject?, peerNearbyData: ChatPeerNearbyData?, greetingData: ChatGreetingData?, pendingUnpinnedAllMessages: Bool, activeGroupCallInfo: ChatActiveGroupCallInfo?, hasActiveGroupCall: Bool, importState: ChatPresentationImportState?, threadData: ThreadData?, isGeneralThreadClosed: Bool?, replyMessage: Message?, accountPeerColor: AccountPeerColor?, businessIntro: TelegramBusinessIntro?) {
+ public init(chatWallpaper: TelegramWallpaper, theme: PresentationTheme, strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, nameDisplayOrder: PresentationPersonNameOrder, limitsConfiguration: LimitsConfiguration, fontSize: PresentationFontSize, bubbleCorners: PresentationChatBubbleCorners, accountPeerId: PeerId, mode: ChatControllerPresentationMode, chatLocation: ChatLocation, subject: ChatControllerSubject?, peerNearbyData: ChatPeerNearbyData?, greetingData: ChatGreetingData?, pendingUnpinnedAllMessages: Bool, activeGroupCallInfo: ChatActiveGroupCallInfo?, hasActiveGroupCall: Bool, threadData: ThreadData?, isGeneralThreadClosed: Bool?, replyMessage: Message?, accountPeerColor: AccountPeerColor?, businessIntro: TelegramBusinessIntro?) {
self.interfaceState = ChatInterfaceState()
self.inputTextPanelState = ChatTextInputPanelState()
self.editMessageState = nil
@@ -619,7 +610,6 @@ public final class ChatPresentationInterfaceState: Equatable {
self.pendingUnpinnedAllMessages = pendingUnpinnedAllMessages
self.activeGroupCallInfo = activeGroupCallInfo
self.hasActiveGroupCall = hasActiveGroupCall
- self.importState = importState
self.reportReason = nil
self.showCommands = false
self.hasBotCommands = false
@@ -664,7 +654,7 @@ public final class ChatPresentationInterfaceState: Equatable {
self.removePaidMessageFeeData = nil
}
- public init(interfaceState: ChatInterfaceState, chatLocation: ChatLocation, renderedPeer: RenderedPeer?, isNotAccessible: Bool, explicitelyCanPinMessages: Bool, contactStatus: ChatContactStatus?, hasBots: Bool, isArchived: Bool, inputTextPanelState: ChatTextInputPanelState, editMessageState: ChatEditInterfaceMessageState?, inputQueryResults: [ChatPresentationInputQueryKind: ChatPresentationInputQueryResult], inputMode: ChatInputMode, titlePanelContexts: [ChatTitlePanelContext], keyboardButtonsMessage: Message?, pinnedMessageId: MessageId?, pinnedMessage: ChatPinnedMessage?, peerIsBlocked: Bool, peerIsMuted: Bool, peerDiscussionId: PeerId?, peerGeoLocation: PeerGeoLocation?, callsAvailable: Bool, callsPrivate: Bool, slowmodeState: ChatSlowmodeState?, chatHistoryState: ChatHistoryNodeHistoryState?, botStartPayload: String?, urlPreview: UrlPreview?, editingUrlPreview: UrlPreview?, search: ChatSearchData?, searchQuerySuggestionResult: ChatPresentationInputQueryResult?, historyFilter: HistoryFilter?, displayHistoryFilterAsList: Bool, presentationReady: Bool, chatWallpaper: TelegramWallpaper, theme: PresentationTheme, strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, nameDisplayOrder: PresentationPersonNameOrder, limitsConfiguration: LimitsConfiguration, fontSize: PresentationFontSize, bubbleCorners: PresentationChatBubbleCorners, accountPeerId: PeerId, mode: ChatControllerPresentationMode, hasScheduledMessages: Bool, autoremoveTimeout: Int32?, subject: ChatControllerSubject?, peerNearbyData: ChatPeerNearbyData?, greetingData: ChatGreetingData?, pendingUnpinnedAllMessages: Bool, activeGroupCallInfo: ChatActiveGroupCallInfo?, hasActiveGroupCall: Bool, importState: ChatPresentationImportState?, reportReason: ReportReasonData?, showCommands: Bool, hasBotCommands: Bool, showSendAsPeers: Bool, sendAsPeers: [SendAsPeer]?, botMenuButton: BotMenuButton, showWebView: Bool, currentSendAsPeerId: PeerId?, copyProtectionEnabled: Bool, hasAtLeast3Messages: Bool, hasPlentyOfMessages: Bool, isPremium: Bool, premiumGiftOptions: [CachedPremiumGiftOption], suggestPremiumGift: Bool, forceInputCommandsHidden: Bool, voiceMessagesAvailable: Bool, customEmojiAvailable: Bool, threadData: ThreadData?, forumTopicData: ThreadData?, isGeneralThreadClosed: Bool?, translationState: ChatPresentationTranslationState?, replyMessage: Message?, accountPeerColor: AccountPeerColor?, savedMessagesTopicPeer: EnginePeer?, hasSearchTags: Bool, isPremiumRequiredForMessaging: Bool, sendPaidMessageStars: StarsAmount?, acknowledgedPaidMessage: Bool, hasSavedChats: Bool, appliedBoosts: Int32?, boostsToUnrestrict: Int32?, businessIntro: TelegramBusinessIntro?, hasBirthdayToday: Bool, adMessage: Message?, peerVerification: PeerVerification?, starGiftsAvailable: Bool, alwaysShowGiftButton: Bool, disallowedGifts: TelegramDisallowedGifts?, persistentData: PersistentPeerData, removePaidMessageFeeData: RemovePaidMessageFeeData?) {
+ public init(interfaceState: ChatInterfaceState, chatLocation: ChatLocation, renderedPeer: RenderedPeer?, isNotAccessible: Bool, explicitelyCanPinMessages: Bool, contactStatus: ChatContactStatus?, hasBots: Bool, isArchived: Bool, inputTextPanelState: ChatTextInputPanelState, editMessageState: ChatEditInterfaceMessageState?, inputQueryResults: [ChatPresentationInputQueryKind: ChatPresentationInputQueryResult], inputMode: ChatInputMode, titlePanelContexts: [ChatTitlePanelContext], keyboardButtonsMessage: Message?, pinnedMessageId: MessageId?, pinnedMessage: ChatPinnedMessage?, peerIsBlocked: Bool, peerIsMuted: Bool, peerDiscussionId: PeerId?, peerGeoLocation: PeerGeoLocation?, callsAvailable: Bool, callsPrivate: Bool, slowmodeState: ChatSlowmodeState?, chatHistoryState: ChatHistoryNodeHistoryState?, botStartPayload: String?, urlPreview: UrlPreview?, editingUrlPreview: UrlPreview?, search: ChatSearchData?, searchQuerySuggestionResult: ChatPresentationInputQueryResult?, historyFilter: HistoryFilter?, displayHistoryFilterAsList: Bool, presentationReady: Bool, chatWallpaper: TelegramWallpaper, theme: PresentationTheme, strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, nameDisplayOrder: PresentationPersonNameOrder, limitsConfiguration: LimitsConfiguration, fontSize: PresentationFontSize, bubbleCorners: PresentationChatBubbleCorners, accountPeerId: PeerId, mode: ChatControllerPresentationMode, hasScheduledMessages: Bool, autoremoveTimeout: Int32?, subject: ChatControllerSubject?, peerNearbyData: ChatPeerNearbyData?, greetingData: ChatGreetingData?, pendingUnpinnedAllMessages: Bool, activeGroupCallInfo: ChatActiveGroupCallInfo?, hasActiveGroupCall: Bool, reportReason: ReportReasonData?, showCommands: Bool, hasBotCommands: Bool, showSendAsPeers: Bool, sendAsPeers: [SendAsPeer]?, botMenuButton: BotMenuButton, showWebView: Bool, currentSendAsPeerId: PeerId?, copyProtectionEnabled: Bool, hasAtLeast3Messages: Bool, hasPlentyOfMessages: Bool, isPremium: Bool, premiumGiftOptions: [CachedPremiumGiftOption], suggestPremiumGift: Bool, forceInputCommandsHidden: Bool, voiceMessagesAvailable: Bool, customEmojiAvailable: Bool, threadData: ThreadData?, forumTopicData: ThreadData?, isGeneralThreadClosed: Bool?, translationState: ChatPresentationTranslationState?, replyMessage: Message?, accountPeerColor: AccountPeerColor?, savedMessagesTopicPeer: EnginePeer?, hasSearchTags: Bool, isPremiumRequiredForMessaging: Bool, sendPaidMessageStars: StarsAmount?, acknowledgedPaidMessage: Bool, hasSavedChats: Bool, appliedBoosts: Int32?, boostsToUnrestrict: Int32?, businessIntro: TelegramBusinessIntro?, hasBirthdayToday: Bool, adMessage: Message?, peerVerification: PeerVerification?, starGiftsAvailable: Bool, alwaysShowGiftButton: Bool, disallowedGifts: TelegramDisallowedGifts?, persistentData: PersistentPeerData, removePaidMessageFeeData: RemovePaidMessageFeeData?) {
self.interfaceState = interfaceState
self.chatLocation = chatLocation
self.renderedPeer = renderedPeer
@@ -715,7 +705,6 @@ public final class ChatPresentationInterfaceState: Equatable {
self.pendingUnpinnedAllMessages = pendingUnpinnedAllMessages
self.activeGroupCallInfo = activeGroupCallInfo
self.hasActiveGroupCall = hasActiveGroupCall
- self.importState = importState
self.reportReason = reportReason
self.showCommands = showCommands
self.hasBotCommands = hasBotCommands
@@ -918,9 +907,6 @@ public final class ChatPresentationInterfaceState: Equatable {
if lhs.hasActiveGroupCall != rhs.hasActiveGroupCall {
return false
}
- if lhs.importState != rhs.importState {
- return false
- }
if lhs.reportReason != rhs.reportReason {
return false
}
@@ -1045,35 +1031,35 @@ public final class ChatPresentationInterfaceState: Equatable {
}
public func updatedInterfaceState(_ f: (ChatInterfaceState) -> ChatInterfaceState) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: f(self.interfaceState), chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: f(self.interfaceState), chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedChatLocation(_ chatLocation: ChatLocation) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedPeer(_ f: (RenderedPeer?) -> RenderedPeer?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: f(self.renderedPeer), isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: f(self.renderedPeer), isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedIsNotAccessible(_ isNotAccessible: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedExplicitelyCanPinMessages(_ explicitelyCanPinMessages: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedContactStatus(_ contactStatus: ChatContactStatus?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedHasBots(_ hasBots: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedIsArchived(_ isArchived: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedInputQueryResult(queryKind: ChatPresentationInputQueryKind, _ f: (ChatPresentationInputQueryResult?) -> ChatPresentationInputQueryResult?) -> ChatPresentationInterfaceState {
@@ -1090,311 +1076,307 @@ public final class ChatPresentationInterfaceState: Equatable {
inputQueryResults.removeValue(forKey: queryKind)
}
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedInputTextPanelState(_ f: (ChatTextInputPanelState) -> ChatTextInputPanelState) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: f(self.inputTextPanelState), editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: f(self.inputTextPanelState), editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedEditMessageState(_ editMessageState: ChatEditInterfaceMessageState?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedInputMode(_ f: (ChatInputMode) -> ChatInputMode) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: f(self.inputMode), titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: f(self.inputMode), titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedTitlePanelContext(_ f: ([ChatTitlePanelContext]) -> [ChatTitlePanelContext]) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: f(self.titlePanelContexts), keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: f(self.titlePanelContexts), keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedKeyboardButtonsMessage(_ message: Message?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: message, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: message, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedPinnedMessageId(_ pinnedMessageId: MessageId?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedPinnedMessage(_ pinnedMessage: ChatPinnedMessage?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedPeerIsBlocked(_ peerIsBlocked: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedPeerIsMuted(_ peerIsMuted: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedPeerDiscussionId(_ peerDiscussionId: PeerId?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedPeerGeoLocation(_ peerGeoLocation: PeerGeoLocation?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedCallsAvailable(_ callsAvailable: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedCallsPrivate(_ callsPrivate: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedSlowmodeState(_ slowmodeState: ChatSlowmodeState?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedBotStartPayload(_ botStartPayload: String?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedChatHistoryState(_ chatHistoryState: ChatHistoryNodeHistoryState?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedUrlPreview(_ urlPreview: UrlPreview?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedEditingUrlPreview(_ editingUrlPreview: UrlPreview?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedSearch(_ search: ChatSearchData?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedSearchQuerySuggestionResult(_ f: (ChatPresentationInputQueryResult?) -> ChatPresentationInputQueryResult?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: f(self.searchQuerySuggestionResult), historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: f(self.searchQuerySuggestionResult), historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedHistoryFilter(_ historyFilter: HistoryFilter?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedDisplayHistoryFilterAsList(_ displayHistoryFilterAsList: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedMode(_ mode: ChatControllerPresentationMode) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedPresentationReady(_ presentationReady: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedTheme(_ theme: PresentationTheme) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedStrings(_ strings: PresentationStrings) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedDateTimeFormat(_ dateTimeFormat: PresentationDateTimeFormat) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedChatWallpaper(_ chatWallpaper: TelegramWallpaper) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedBubbleCorners(_ bubbleCorners: PresentationChatBubbleCorners) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedHasScheduledMessages(_ hasScheduledMessages: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedSubject(_ subject: ChatControllerSubject?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedAutoremoveTimeout(_ autoremoveTimeout: Int32?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedPendingUnpinnedAllMessages(_ pendingUnpinnedAllMessages: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedActiveGroupCallInfo(_ activeGroupCallInfo: ChatActiveGroupCallInfo?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedHasActiveGroupCall(_ hasActiveGroupCall: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
- }
-
- public func updatedImportState(_ importState: ChatPresentationImportState?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedReportReason(_ reportReason: ReportReasonData?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedShowCommands(_ showCommands: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedHasBotCommands(_ hasBotCommands: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedShowSendAsPeers(_ showSendAsPeers: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedSendAsPeers(_ sendAsPeers: [SendAsPeer]?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedCurrentSendAsPeerId(_ currentSendAsPeerId: PeerId?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedBotMenuButton(_ botMenuButton: BotMenuButton) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedShowWebView(_ showWebView: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedCopyProtectionEnabled(_ copyProtectionEnabled: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedHasAtLeast3Messages(_ hasAtLeast3Messages: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedHasPlentyOfMessages(_ hasPlentyOfMessages: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedIsPremium(_ isPremium: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedPremiumGiftOptions(_ premiumGiftOptions: [CachedPremiumGiftOption]) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedSuggestPremiumGift(_ suggestPremiumGift: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedForceInputCommandsHidden(_ forceInputCommandsHidden: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedVoiceMessagesAvailable(_ voiceMessagesAvailable: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedCustomEmojiAvailable(_ customEmojiAvailable: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedThreadData(_ threadData: ThreadData?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedForumTopicData(_ forumTopicData: ThreadData?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedIsGeneralThreadClosed(_ isGeneralThreadClosed: Bool?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedTranslationState(_ translationState: ChatPresentationTranslationState?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedReplyMessage(_ replyMessage: Message?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedAccountPeerColor(_ accountPeerColor: AccountPeerColor?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedSavedMessagesTopicPeer(_ savedMessagesTopicPeer: EnginePeer?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedHasSearchTags(_ hasSearchTags: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedIsPremiumRequiredForMessaging(_ isPremiumRequiredForMessaging: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedSendPaidMessageStars(_ sendPaidMessageStars: StarsAmount?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedAcknowledgedPaidMessage(_ acknowledgedPaidMessage: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedHasSavedChats(_ hasSavedChats: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedAppliedBoosts(_ appliedBoosts: Int32?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedBoostsToUnrestrict(_ boostsToUnrestrict: Int32?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedBusinessIntro(_ businessIntro: TelegramBusinessIntro?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedHasBirthdayToday(_ hasBirthdayToday: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedAdMessage(_ adMessage: Message?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedPeerVerification(_ peerVerification: PeerVerification?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedStarGiftsAvailable(_ starGiftsAvailable: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedAlwaysShowGiftButton(_ alwaysShowGiftButton: Bool) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedDisallowedGifts(_ disallowedGifts: TelegramDisallowedGifts?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedPersistentData(_ persistentData: PersistentPeerData) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: persistentData, removePaidMessageFeeData: self.removePaidMessageFeeData)
}
public func updatedRemovePaidMessageFeeData(_ removePaidMessageFeeData: RemovePaidMessageFeeData?) -> ChatPresentationInterfaceState {
- return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, importState: self.importState, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: removePaidMessageFeeData)
+ return ChatPresentationInterfaceState(interfaceState: self.interfaceState, chatLocation: self.chatLocation, renderedPeer: self.renderedPeer, isNotAccessible: self.isNotAccessible, explicitelyCanPinMessages: self.explicitelyCanPinMessages, contactStatus: self.contactStatus, hasBots: self.hasBots, isArchived: self.isArchived, inputTextPanelState: self.inputTextPanelState, editMessageState: self.editMessageState, inputQueryResults: self.inputQueryResults, inputMode: self.inputMode, titlePanelContexts: self.titlePanelContexts, keyboardButtonsMessage: self.keyboardButtonsMessage, pinnedMessageId: self.pinnedMessageId, pinnedMessage: self.pinnedMessage, peerIsBlocked: self.peerIsBlocked, peerIsMuted: self.peerIsMuted, peerDiscussionId: self.peerDiscussionId, peerGeoLocation: self.peerGeoLocation, callsAvailable: self.callsAvailable, callsPrivate: self.callsPrivate, slowmodeState: self.slowmodeState, chatHistoryState: self.chatHistoryState, botStartPayload: self.botStartPayload, urlPreview: self.urlPreview, editingUrlPreview: self.editingUrlPreview, search: self.search, searchQuerySuggestionResult: self.searchQuerySuggestionResult, historyFilter: self.historyFilter, displayHistoryFilterAsList: self.displayHistoryFilterAsList, presentationReady: self.presentationReady, chatWallpaper: self.chatWallpaper, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, limitsConfiguration: self.limitsConfiguration, fontSize: self.fontSize, bubbleCorners: self.bubbleCorners, accountPeerId: self.accountPeerId, mode: self.mode, hasScheduledMessages: self.hasScheduledMessages, autoremoveTimeout: self.autoremoveTimeout, subject: self.subject, peerNearbyData: self.peerNearbyData, greetingData: self.greetingData, pendingUnpinnedAllMessages: self.pendingUnpinnedAllMessages, activeGroupCallInfo: self.activeGroupCallInfo, hasActiveGroupCall: self.hasActiveGroupCall, reportReason: self.reportReason, showCommands: self.showCommands, hasBotCommands: self.hasBotCommands, showSendAsPeers: self.showSendAsPeers, sendAsPeers: self.sendAsPeers, botMenuButton: self.botMenuButton, showWebView: self.showWebView, currentSendAsPeerId: self.currentSendAsPeerId, copyProtectionEnabled: self.copyProtectionEnabled, hasAtLeast3Messages: self.hasAtLeast3Messages, hasPlentyOfMessages: self.hasPlentyOfMessages, isPremium: self.isPremium, premiumGiftOptions: self.premiumGiftOptions, suggestPremiumGift: self.suggestPremiumGift, forceInputCommandsHidden: self.forceInputCommandsHidden, voiceMessagesAvailable: self.voiceMessagesAvailable, customEmojiAvailable: self.customEmojiAvailable, threadData: self.threadData, forumTopicData: self.forumTopicData, isGeneralThreadClosed: self.isGeneralThreadClosed, translationState: self.translationState, replyMessage: self.replyMessage, accountPeerColor: self.accountPeerColor, savedMessagesTopicPeer: self.savedMessagesTopicPeer, hasSearchTags: self.hasSearchTags, isPremiumRequiredForMessaging: self.isPremiumRequiredForMessaging, sendPaidMessageStars: self.sendPaidMessageStars, acknowledgedPaidMessage: self.acknowledgedPaidMessage, hasSavedChats: self.hasSavedChats, appliedBoosts: self.appliedBoosts, boostsToUnrestrict: self.boostsToUnrestrict, businessIntro: self.businessIntro, hasBirthdayToday: self.hasBirthdayToday, adMessage: self.adMessage, peerVerification: self.peerVerification, starGiftsAvailable: self.starGiftsAvailable, alwaysShowGiftButton: self.alwaysShowGiftButton, disallowedGifts: self.disallowedGifts, persistentData: self.persistentData, removePaidMessageFeeData: removePaidMessageFeeData)
}
}
diff --git a/submodules/ChatTextLinkEditUI/BUILD b/submodules/ChatTextLinkEditUI/BUILD
index e48e5676..39f5f783 100644
--- a/submodules/ChatTextLinkEditUI/BUILD
+++ b/submodules/ChatTextLinkEditUI/BUILD
@@ -10,14 +10,17 @@ swift_library(
"-warnings-as-errors",
],
deps = [
- "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
- "//submodules/AsyncDisplayKit:AsyncDisplayKit",
- "//submodules/Display:Display",
- "//submodules/Postbox:Postbox",
- "//submodules/TelegramCore:TelegramCore",
- "//submodules/AccountContext:AccountContext",
- "//submodules/TelegramPresentationData:TelegramPresentationData",
- "//submodules/UrlEscaping:UrlEscaping",
+ "//submodules/SSignalKit/SwiftSignalKit",
+ "//submodules/AsyncDisplayKit",
+ "//submodules/Display",
+ "//submodules/Postbox",
+ "//submodules/TelegramCore",
+ "//submodules/AccountContext",
+ "//submodules/TelegramPresentationData",
+ "//submodules/UrlEscaping",
+ "//submodules/ComponentFlow",
+ "//submodules/TelegramUI/Components/AlertComponent",
+ "//submodules/TelegramUI/Components/AlertComponent/AlertMultilineInputFieldComponent",
],
visibility = [
"//visibility:public",
diff --git a/submodules/ChatTextLinkEditUI/Sources/ChatTextLinkEditController.swift b/submodules/ChatTextLinkEditUI/Sources/ChatTextLinkEditController.swift
index c802ca39..4229f746 100644
--- a/submodules/ChatTextLinkEditUI/Sources/ChatTextLinkEditController.swift
+++ b/submodules/ChatTextLinkEditUI/Sources/ChatTextLinkEditController.swift
@@ -7,458 +7,90 @@ import TelegramCore
import TelegramPresentationData
import AccountContext
import UrlEscaping
+import ComponentFlow
+import AlertComponent
+import AlertMultilineInputFieldComponent
-private final class ChatTextLinkEditInputFieldNode: ASDisplayNode, ASEditableTextNodeDelegate {
- private var theme: PresentationTheme
- private let backgroundNode: ASImageNode
- fileprivate let textInputNode: EditableTextNode
- private let placeholderNode: ASTextNode
+public func chatTextLinkEditController(
+ context: AccountContext,
+ updatedPresentationData: (initial: PresentationData, signal: Signal)? = nil,
+ text: String,
+ link: String?,
+ apply: @escaping (String?) -> Void
+) -> ViewController {
+ let presentationData = context.sharedContext.currentPresentationData.with { $0 }
+ let strings = presentationData.strings
+
+ let inputState = AlertMultilineInputFieldComponent.ExternalState()
- var updateHeight: (() -> Void)?
- var complete: (() -> Void)?
- var textChanged: ((String) -> Void)?
+ var content: [AnyComponentWithIdentity] = []
+ content.append(AnyComponentWithIdentity(
+ id: "title",
+ component: AnyComponent(
+ AlertTitleComponent(title: link != nil ? strings.TextFormat_EditLinkTitle : strings.TextFormat_AddLinkTitle)
+ )
+ ))
+ content.append(AnyComponentWithIdentity(
+ id: "text",
+ component: AnyComponent(
+ AlertTextComponent(content: .plain(strings.TextFormat_AddLinkText(text).string))
+ )
+ ))
- private let backgroundInsets = UIEdgeInsets(top: 8.0, left: 16.0, bottom: 15.0, right: 16.0)
- private let inputInsets = UIEdgeInsets(top: 5.0, left: 12.0, bottom: 5.0, right: 12.0)
-
- var text: String {
- get {
- return self.textInputNode.attributedText?.string ?? ""
- }
- set {
- self.textInputNode.attributedText = NSAttributedString(string: newValue, font: Font.regular(17.0), textColor: self.theme.actionSheet.inputTextColor)
- self.placeholderNode.isHidden = !newValue.isEmpty
- }
- }
-
- var placeholder: String = "" {
- didSet {
- self.placeholderNode.attributedText = NSAttributedString(string: self.placeholder, font: Font.regular(17.0), textColor: self.theme.actionSheet.inputPlaceholderColor)
- }
- }
-
- init(theme: PresentationTheme, placeholder: String) {
- self.theme = theme
-
- self.backgroundNode = ASImageNode()
- self.backgroundNode.isLayerBacked = true
- self.backgroundNode.displaysAsynchronously = false
- self.backgroundNode.displayWithoutProcessing = true
- self.backgroundNode.image = generateStretchableFilledCircleImage(diameter: 12.0, color: theme.actionSheet.inputHollowBackgroundColor, strokeColor: theme.actionSheet.inputBorderColor, strokeWidth: 1.0)
-
- self.textInputNode = EditableTextNode()
- self.textInputNode.typingAttributes = [NSAttributedString.Key.font.rawValue: Font.regular(17.0), NSAttributedString.Key.foregroundColor.rawValue: theme.actionSheet.inputTextColor]
- self.textInputNode.clipsToBounds = true
- self.textInputNode.hitTestSlop = UIEdgeInsets(top: -5.0, left: -5.0, bottom: -5.0, right: -5.0)
- self.textInputNode.textContainerInset = UIEdgeInsets(top: self.inputInsets.top, left: 0.0, bottom: self.inputInsets.bottom, right: 0.0)
- self.textInputNode.keyboardAppearance = theme.rootController.keyboardColor.keyboardAppearance
- self.textInputNode.keyboardType = .URL
- self.textInputNode.autocapitalizationType = .none
- self.textInputNode.returnKeyType = .done
- self.textInputNode.autocorrectionType = .no
- self.textInputNode.tintColor = theme.actionSheet.controlAccentColor
-
- self.placeholderNode = ASTextNode()
- self.placeholderNode.isUserInteractionEnabled = false
- self.placeholderNode.displaysAsynchronously = false
- self.placeholderNode.attributedText = NSAttributedString(string: placeholder, font: Font.regular(17.0), textColor: self.theme.actionSheet.inputPlaceholderColor)
-
- super.init()
-
- self.textInputNode.delegate = self
-
- self.addSubnode(self.backgroundNode)
- self.addSubnode(self.textInputNode)
- self.addSubnode(self.placeholderNode)
- }
-
- func updateTheme(_ theme: PresentationTheme) {
- self.theme = theme
-
- self.backgroundNode.image = generateStretchableFilledCircleImage(diameter: 12.0, color: self.theme.actionSheet.inputHollowBackgroundColor, strokeColor: self.theme.actionSheet.inputBorderColor, strokeWidth: 1.0)
- self.textInputNode.keyboardAppearance = self.theme.rootController.keyboardColor.keyboardAppearance
- self.placeholderNode.attributedText = NSAttributedString(string: self.placeholderNode.attributedText?.string ?? "", font: Font.regular(17.0), textColor: self.theme.actionSheet.inputPlaceholderColor)
- self.textInputNode.tintColor = self.theme.actionSheet.controlAccentColor
- }
-
- func updateLayout(width: CGFloat, transition: ContainedViewLayoutTransition) -> CGFloat {
- let backgroundInsets = self.backgroundInsets
- let inputInsets = self.inputInsets
-
- let textFieldHeight = self.calculateTextFieldMetrics(width: width)
- let panelHeight = textFieldHeight + backgroundInsets.top + backgroundInsets.bottom
-
- let backgroundFrame = CGRect(origin: CGPoint(x: backgroundInsets.left, y: backgroundInsets.top), size: CGSize(width: width - backgroundInsets.left - backgroundInsets.right, height: panelHeight - backgroundInsets.top - backgroundInsets.bottom))
- transition.updateFrame(node: self.backgroundNode, frame: backgroundFrame)
-
- let placeholderSize = self.placeholderNode.measure(backgroundFrame.size)
- transition.updateFrame(node: self.placeholderNode, frame: CGRect(origin: CGPoint(x: backgroundFrame.minX + inputInsets.left, y: backgroundFrame.minY + floor((backgroundFrame.size.height - placeholderSize.height) / 2.0)), size: placeholderSize))
-
- transition.updateFrame(node: self.textInputNode, frame: CGRect(origin: CGPoint(x: backgroundFrame.minX + inputInsets.left, y: backgroundFrame.minY), size: CGSize(width: backgroundFrame.size.width - inputInsets.left - inputInsets.right, height: backgroundFrame.size.height)))
-
- return panelHeight
- }
-
- func activateInput() {
- self.textInputNode.becomeFirstResponder()
- }
-
- func deactivateInput() {
- self.textInputNode.resignFirstResponder()
- }
-
- @objc func editableTextNodeDidUpdateText(_ editableTextNode: ASEditableTextNode) {
- self.updateTextNodeText(animated: true)
- self.textChanged?(editableTextNode.textView.text)
- self.placeholderNode.isHidden = !(editableTextNode.textView.text ?? "").isEmpty
- }
-
- func editableTextNode(_ editableTextNode: ASEditableTextNode, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
- if text == "\n" {
- self.complete?()
- return false
- }
- return true
- }
-
- private func calculateTextFieldMetrics(width: CGFloat) -> CGFloat {
- let backgroundInsets = self.backgroundInsets
- let inputInsets = self.inputInsets
-
- let unboundTextFieldHeight = max(33.0, ceil(self.textInputNode.measure(CGSize(width: width - backgroundInsets.left - backgroundInsets.right - inputInsets.left - inputInsets.right, height: CGFloat.greatestFiniteMagnitude)).height))
-
- return min(61.0, max(33.0, unboundTextFieldHeight))
- }
-
- private func updateTextNodeText(animated: Bool) {
- let backgroundInsets = self.backgroundInsets
-
- let textFieldHeight = self.calculateTextFieldMetrics(width: self.bounds.size.width)
-
- let panelHeight = textFieldHeight + backgroundInsets.top + backgroundInsets.bottom
- if !self.bounds.size.height.isEqual(to: panelHeight) {
- self.updateHeight?()
- }
- }
-
- @objc func clearPressed() {
- self.textInputNode.attributedText = nil
- self.deactivateInput()
- }
-}
-
-private final class ChatTextLinkEditAlertContentNode: AlertContentNode {
- private let strings: PresentationStrings
- private let text: String
-
- private let titleNode: ASTextNode
- private let textNode: ASTextNode
- let inputFieldNode: ChatTextLinkEditInputFieldNode
-
- private let actionNodesSeparator: ASDisplayNode
- private let actionNodes: [TextAlertContentActionNode]
- private let actionVerticalSeparators: [ASDisplayNode]
-
- private let disposable = MetaDisposable()
-
- private var validLayout: CGSize?
-
- private let hapticFeedback = HapticFeedback()
-
- var complete: (() -> Void)? {
- didSet {
- self.inputFieldNode.complete = self.complete
- }
- }
-
- override var dismissOnOutsideTap: Bool {
- return self.isUserInteractionEnabled
- }
-
- private var isEditing = false
- private let allowEmpty: Bool
-
- init(theme: AlertControllerTheme, ptheme: PresentationTheme, strings: PresentationStrings, actions: [TextAlertAction], text: String, link: String?, allowEmpty: Bool) {
- self.strings = strings
- self.text = text
- self.isEditing = link != nil
- self.allowEmpty = allowEmpty
-
- self.titleNode = ASTextNode()
- self.titleNode.maximumNumberOfLines = 2
- self.textNode = ASTextNode()
- self.textNode.maximumNumberOfLines = 2
-
- self.inputFieldNode = ChatTextLinkEditInputFieldNode(theme: ptheme, placeholder: strings.TextFormat_AddLinkPlaceholder)
- self.inputFieldNode.text = link ?? ""
-
- self.actionNodesSeparator = ASDisplayNode()
- self.actionNodesSeparator.isLayerBacked = true
-
- self.actionNodes = actions.map { action -> TextAlertContentActionNode in
- return TextAlertContentActionNode(theme: theme, action: action)
- }
-
- var actionVerticalSeparators: [ASDisplayNode] = []
- if actions.count > 1 {
- for _ in 0 ..< actions.count - 1 {
- let separatorNode = ASDisplayNode()
- separatorNode.isLayerBacked = true
- actionVerticalSeparators.append(separatorNode)
- }
- }
- self.actionVerticalSeparators = actionVerticalSeparators
-
- super.init()
-
- self.addSubnode(self.titleNode)
- self.addSubnode(self.textNode)
-
- self.addSubnode(self.inputFieldNode)
-
- self.addSubnode(self.actionNodesSeparator)
-
- for actionNode in self.actionNodes {
- self.addSubnode(actionNode)
- }
- self.actionNodes.last?.actionEnabled = !(link ?? "").isEmpty
- if allowEmpty {
- self.actionNodes.last?.actionEnabled = true
- }
-
- for separatorNode in self.actionVerticalSeparators {
- self.addSubnode(separatorNode)
- }
-
- self.inputFieldNode.updateHeight = { [weak self] in
- if let strongSelf = self {
- if let _ = strongSelf.validLayout {
- strongSelf.requestLayout?(.animated(duration: 0.15, curve: .spring))
- }
- }
- }
-
- self.inputFieldNode.textChanged = { [weak self] text in
- if let strongSelf = self, let lastNode = strongSelf.actionNodes.last {
- if strongSelf.allowEmpty {
- lastNode.actionEnabled = true
- } else {
- lastNode.actionEnabled = !text.isEmpty
- }
- }
- }
-
- self.updateTheme(theme)
-
- if (link ?? "").isEmpty {
- Queue.mainQueue().after(0.1, {
- let pasteboard = UIPasteboard.general
- if pasteboard.hasURLs {
- if let url = pasteboard.url?.absoluteString, !url.isEmpty {
- self.inputFieldNode.text = url
- if let lastNode = self.actionNodes.last {
- lastNode.actionEnabled = true
- }
- self.inputFieldNode.textInputNode.textView.selectAll(nil)
- }
- }
- })
- }
- }
-
- deinit {
- self.disposable.dispose()
- }
-
- var link: String {
- return self.inputFieldNode.text
- }
-
- override func updateTheme(_ theme: AlertControllerTheme) {
- self.titleNode.attributedText = NSAttributedString(string: self.isEditing ? self.strings.TextFormat_EditLinkTitle : self.strings.TextFormat_AddLinkTitle, font: Font.bold(17.0), textColor: theme.primaryColor, paragraphAlignment: .center)
- self.textNode.attributedText = NSAttributedString(string: self.strings.TextFormat_AddLinkText(self.text).string, font: Font.regular(13.0), textColor: theme.primaryColor, paragraphAlignment: .center)
-
- self.actionNodesSeparator.backgroundColor = theme.separatorColor
- for actionNode in self.actionNodes {
- actionNode.updateTheme(theme)
- }
- for separatorNode in self.actionVerticalSeparators {
- separatorNode.backgroundColor = theme.separatorColor
- }
-
- if let size = self.validLayout {
- _ = self.updateLayout(size: size, transition: .immediate)
- }
- }
-
- override func updateLayout(size: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
- var size = size
- size.width = min(size.width, 270.0)
- let measureSize = CGSize(width: size.width - 16.0 * 2.0, height: CGFloat.greatestFiniteMagnitude)
-
- let hadValidLayout = self.validLayout != nil
-
- self.validLayout = size
-
- var origin: CGPoint = CGPoint(x: 0.0, y: 20.0)
- let spacing: CGFloat = 5.0
-
- let titleSize = self.titleNode.measure(measureSize)
- transition.updateFrame(node: self.titleNode, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - titleSize.width) / 2.0), y: origin.y), size: titleSize))
- origin.y += titleSize.height + 4.0
-
- let textSize = self.textNode.measure(measureSize)
- transition.updateFrame(node: self.textNode, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - textSize.width) / 2.0), y: origin.y), size: textSize))
- origin.y += textSize.height + 6.0 + spacing
-
- let actionButtonHeight: CGFloat = 44.0
- var minActionsWidth: CGFloat = 0.0
- let maxActionWidth: CGFloat = floor(size.width / CGFloat(self.actionNodes.count))
- let actionTitleInsets: CGFloat = 8.0
-
- var effectiveActionLayout = TextAlertContentActionLayout.horizontal
- for actionNode in self.actionNodes {
- let actionTitleSize = actionNode.titleNode.updateLayout(CGSize(width: maxActionWidth, height: actionButtonHeight))
- if case .horizontal = effectiveActionLayout, actionTitleSize.height > actionButtonHeight * 0.6667 {
- effectiveActionLayout = .vertical
- }
- switch effectiveActionLayout {
- case .horizontal:
- minActionsWidth += actionTitleSize.width + actionTitleInsets
- case .vertical:
- minActionsWidth = max(minActionsWidth, actionTitleSize.width + actionTitleInsets)
- }
- }
-
- let insets = UIEdgeInsets(top: 18.0, left: 18.0, bottom: 9.0, right: 18.0)
-
- var contentWidth = max(titleSize.width, minActionsWidth)
- contentWidth = max(contentWidth, 234.0)
-
- var actionsHeight: CGFloat = 0.0
- switch effectiveActionLayout {
- case .horizontal:
- actionsHeight = actionButtonHeight
- case .vertical:
- actionsHeight = actionButtonHeight * CGFloat(self.actionNodes.count)
- }
-
- let resultWidth = contentWidth + insets.left + insets.right
-
- let inputFieldWidth = resultWidth
- let inputFieldHeight = self.inputFieldNode.updateLayout(width: inputFieldWidth, transition: transition)
- let inputHeight = inputFieldHeight
- transition.updateFrame(node: self.inputFieldNode, frame: CGRect(x: 0.0, y: origin.y, width: resultWidth, height: inputFieldHeight))
- transition.updateAlpha(node: self.inputFieldNode, alpha: inputHeight > 0.0 ? 1.0 : 0.0)
-
- let resultSize = CGSize(width: resultWidth, height: titleSize.height + textSize.height + spacing + inputHeight + actionsHeight + insets.top + insets.bottom)
-
- transition.updateFrame(node: self.actionNodesSeparator, frame: CGRect(origin: CGPoint(x: 0.0, y: resultSize.height - actionsHeight - UIScreenPixel), size: CGSize(width: resultSize.width, height: UIScreenPixel)))
-
- var actionOffset: CGFloat = 0.0
- let actionWidth: CGFloat = floor(resultSize.width / CGFloat(self.actionNodes.count))
- var separatorIndex = -1
- var nodeIndex = 0
- for actionNode in self.actionNodes {
- if separatorIndex >= 0 {
- let separatorNode = self.actionVerticalSeparators[separatorIndex]
- switch effectiveActionLayout {
- case .horizontal:
- transition.updateFrame(node: separatorNode, frame: CGRect(origin: CGPoint(x: actionOffset - UIScreenPixel, y: resultSize.height - actionsHeight), size: CGSize(width: UIScreenPixel, height: actionsHeight - UIScreenPixel)))
- case .vertical:
- transition.updateFrame(node: separatorNode, frame: CGRect(origin: CGPoint(x: 0.0, y: resultSize.height - actionsHeight + actionOffset - UIScreenPixel), size: CGSize(width: resultSize.width, height: UIScreenPixel)))
- }
- }
- separatorIndex += 1
-
- let currentActionWidth: CGFloat
- switch effectiveActionLayout {
- case .horizontal:
- if nodeIndex == self.actionNodes.count - 1 {
- currentActionWidth = resultSize.width - actionOffset
- } else {
- currentActionWidth = actionWidth
- }
- case .vertical:
- currentActionWidth = resultSize.width
- }
-
- let actionNodeFrame: CGRect
- switch effectiveActionLayout {
- case .horizontal:
- actionNodeFrame = CGRect(origin: CGPoint(x: actionOffset, y: resultSize.height - actionsHeight), size: CGSize(width: currentActionWidth, height: actionButtonHeight))
- actionOffset += currentActionWidth
- case .vertical:
- actionNodeFrame = CGRect(origin: CGPoint(x: 0.0, y: resultSize.height - actionsHeight + actionOffset), size: CGSize(width: currentActionWidth, height: actionButtonHeight))
- actionOffset += actionButtonHeight
- }
-
- transition.updateFrame(node: actionNode, frame: actionNodeFrame)
-
- nodeIndex += 1
- }
-
- if !hadValidLayout {
- self.inputFieldNode.activateInput()
- }
-
- return resultSize
- }
-
- func animateError() {
- self.inputFieldNode.layer.addShakeAnimation()
- self.hapticFeedback.error()
- }
-}
-
-public func chatTextLinkEditController(sharedContext: SharedAccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal)? = nil, account: Account, text: String, link: String?, allowEmpty: Bool = false, apply: @escaping (String?) -> Void) -> AlertController {
- let presentationData = updatedPresentationData?.initial ?? sharedContext.currentPresentationData.with { $0 }
-
- var dismissImpl: ((Bool) -> Void)?
var applyImpl: (() -> Void)?
+ content.append(AnyComponentWithIdentity(
+ id: "input",
+ component: AnyComponent(
+ AlertMultilineInputFieldComponent(
+ context: context,
+ initialValue: link.flatMap { NSAttributedString(string: $0) },
+ placeholder: strings.TextFormat_AddLinkPlaceholder,
+ returnKeyType: .done,
+ keyboardType: .URL,
+ autocapitalizationType: .none,
+ autocorrectionType: .no,
+ isInitiallyFocused: true,
+ externalState: inputState,
+ returnKeyAction: {
+ applyImpl?()
+ }
+ )
+ )
+ ))
- let actions: [TextAlertAction] = [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {
- dismissImpl?(true)
- apply(nil)
- }), TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_Done, action: {
- applyImpl?()
- })]
-
- let contentNode = ChatTextLinkEditAlertContentNode(theme: AlertControllerTheme(presentationData: presentationData), ptheme: presentationData.theme, strings: presentationData.strings, actions: actions, text: text, link: link, allowEmpty: allowEmpty)
- contentNode.complete = {
- applyImpl?()
+ var effectiveUpdatedPresentationData: (PresentationData, Signal)
+ if let updatedPresentationData {
+ effectiveUpdatedPresentationData = updatedPresentationData
+ } else {
+ effectiveUpdatedPresentationData = (presentationData, context.sharedContext.presentationData)
}
- applyImpl = { [weak contentNode] in
- guard let contentNode = contentNode else {
- return
- }
- let updatedLink = explicitUrl(contentNode.link)
+
+ var dismissImpl: (() -> Void)?
+ let alertController = AlertScreen(
+ configuration: AlertScreen.Configuration(allowInputInset: true),
+ content: content,
+ actions: [
+ .init(title: strings.Common_Cancel),
+ .init(title: strings.Common_Done, type: .default, action: {
+ applyImpl?()
+ }, autoDismiss: false)
+ ],
+ updatedPresentationData: effectiveUpdatedPresentationData
+ )
+ applyImpl = {
+ let updatedLink = explicitUrl(inputState.value.string)
if !updatedLink.isEmpty && isValidUrl(updatedLink, validSchemes: ["http": true, "https": true, "tg": false, "ton": false, "tonsite": true]) {
- dismissImpl?(true)
+ dismissImpl?()
apply(updatedLink)
- } else if allowEmpty && contentNode.link.isEmpty {
- dismissImpl?(true)
+ } else if inputState.value.string.isEmpty {
+ dismissImpl?()
apply("")
} else {
- contentNode.animateError()
+ inputState.animateError()
}
}
-
- let controller = AlertController(theme: AlertControllerTheme(presentationData: presentationData), contentNode: contentNode)
- let presentationDataDisposable = (updatedPresentationData?.signal ?? sharedContext.presentationData).start(next: { [weak controller, weak contentNode] presentationData in
- controller?.theme = AlertControllerTheme(presentationData: presentationData)
- contentNode?.inputFieldNode.updateTheme(presentationData.theme)
- })
- controller.dismissed = { _ in
- presentationDataDisposable.dispose()
+ dismissImpl = { [weak alertController] in
+ alertController?.dismiss(completion: nil)
}
- dismissImpl = { [weak controller] animated in
- contentNode.inputFieldNode.deactivateInput()
- if animated {
- controller?.dismissAnimated()
- } else {
- controller?.dismiss()
- }
- }
- return controller
+ return alertController
}
diff --git a/submodules/ChatTitleActivityNode/Sources/ChatTitleActivityContentNode.swift b/submodules/ChatTitleActivityNode/Sources/ChatTitleActivityContentNode.swift
index 1944d18b..11a1b756 100644
--- a/submodules/ChatTitleActivityNode/Sources/ChatTitleActivityContentNode.swift
+++ b/submodules/ChatTitleActivityNode/Sources/ChatTitleActivityContentNode.swift
@@ -110,7 +110,7 @@ public class ChatTitleActivityContentNode: ASDisplayNode {
})
if case .slide = style {
- self.layer.animatePosition(from: CGPoint(), to: CGPoint(x: 0.0, y: 14.0), duration: transitionDuration, additive: true)
+ self.layer.animatePosition(from: CGPoint(), to: CGPoint(x: 0.0, y: 4.0), duration: transitionDuration, additive: true)
}
}
@@ -118,7 +118,7 @@ public class ChatTitleActivityContentNode: ASDisplayNode {
self.layer.animateAlpha(from: 0.0, to: 1.0, duration: transitionDuration)
if case .slide = style {
- self.layer.animatePosition(from: CGPoint(x: 0.0, y: -14.0), to: CGPoint(), duration: transitionDuration, additive: true)
+ self.layer.animatePosition(from: CGPoint(x: 0.0, y: -4.0), to: CGPoint(), duration: transitionDuration, additive: true)
}
}
diff --git a/submodules/ChatTitleActivityNode/Sources/ChatTitleActivityNode.swift b/submodules/ChatTitleActivityNode/Sources/ChatTitleActivityNode.swift
index b9013f66..86efa6d0 100644
--- a/submodules/ChatTitleActivityNode/Sources/ChatTitleActivityNode.swift
+++ b/submodules/ChatTitleActivityNode/Sources/ChatTitleActivityNode.swift
@@ -130,6 +130,9 @@ public class ChatTitleActivityNode: ASDisplayNode {
}
public func updateLayout(_ constrainedSize: CGSize, offset: CGFloat = 0.0, alignment: NSTextAlignment) -> CGSize {
- return CGSize(width: 0.0, height: self.contentNode?.updateLayout(constrainedSize, offset: offset, alignment: alignment).height ?? 0.0)
+ guard let contentSize = self.contentNode?.updateLayout(constrainedSize, offset: offset, alignment: alignment) else {
+ return CGSize()
+ }
+ return contentSize
}
}
diff --git a/submodules/ComponentFlow/Source/Base/CombinedComponent.swift b/submodules/ComponentFlow/Source/Base/CombinedComponent.swift
index 5f019bc5..3c818879 100644
--- a/submodules/ComponentFlow/Source/Base/CombinedComponent.swift
+++ b/submodules/ComponentFlow/Source/Base/CombinedComponent.swift
@@ -410,7 +410,7 @@ public final class CombinedComponentContext {
public let component: ComponentType
public let availableSize: CGSize
public let transition: ComponentTransition
- private let addImpl: (_ updatedComponent: _UpdatedChildComponent) -> Void
+ private let addImpl: (_ updatedComponent: _UpdatedChildComponent, _ container: UIView?) -> Void
public var environment: Environment {
return self.context.environment
@@ -425,7 +425,7 @@ public final class CombinedComponentContext {
component: ComponentType,
availableSize: CGSize,
transition: ComponentTransition,
- add: @escaping (_ updatedComponent: _UpdatedChildComponent) -> Void
+ add: @escaping (_ updatedComponent: _UpdatedChildComponent, _ container: UIView?) -> Void
) {
self.context = context
self.view = view
@@ -436,7 +436,11 @@ public final class CombinedComponentContext {
}
public func add(_ updatedComponent: _UpdatedChildComponent) {
- self.addImpl(updatedComponent)
+ self.addImpl(updatedComponent, nil)
+ }
+
+ public func addWithExternalContainer(_ updatedComponent: _UpdatedChildComponent, container: UIView) {
+ self.addImpl(updatedComponent, container)
}
}
@@ -671,7 +675,7 @@ public extension CombinedComponent {
component: self,
availableSize: availableSize,
transition: transition,
- add: { updatedChild in
+ add: { updatedChild, optionalContainer in
if !addedChildIds.insert(updatedChild.id).inserted {
preconditionFailure("Child component can only be added once")
}
@@ -692,7 +696,11 @@ public extension CombinedComponent {
context.childViewIndices.remove(at: previousView.index)
context.childViewIndices.insert(updatedChild.id, at: index)
previousView.index = index
- view.insertSubview(previousView.view, at: index)
+ if let optionalContainer {
+ optionalContainer.addSubview(previousView.view)
+ } else {
+ view.insertSubview(previousView.view, at: index)
+ }
}
previousView.updateGestures(updatedChild.gestures)
@@ -715,7 +723,11 @@ public extension CombinedComponent {
childView.transition = updatedChild.transitionDisappear
childView.transitionWithGuide = updatedChild.transitionDisappearWithGuide
- view.insertSubview(updatedChild.view, at: index)
+ if let optionalContainer {
+ optionalContainer.addSubview(updatedChild.view)
+ } else {
+ view.insertSubview(updatedChild.view, at: index)
+ }
updatedChild.view.layer.anchorPoint = updatedChild._anchorPoint ?? CGPoint(x: 0.5, y: 0.5)
diff --git a/submodules/ComponentFlow/Source/Base/Transition.swift b/submodules/ComponentFlow/Source/Base/Transition.swift
index 4dcd0401..4beba45c 100644
--- a/submodules/ComponentFlow/Source/Base/Transition.swift
+++ b/submodules/ComponentFlow/Source/Base/Transition.swift
@@ -489,7 +489,25 @@ public struct ComponentTransition {
}
public func setAlpha(view: UIView, alpha: CGFloat, delay: Double = 0.0, completion: ((Bool) -> Void)? = nil) {
- self.setAlpha(layer: view.layer, alpha: alpha, delay: delay, completion: completion)
+ if view.alpha == alpha {
+ completion?(true)
+ return
+ }
+ switch self.animation {
+ case .none:
+ view.alpha = alpha
+ view.layer.removeAnimation(forKey: "opacity")
+ completion?(true)
+ case .curve:
+ let previousAlpha: Float
+ if view.layer.animation(forKey: "opacity") != nil {
+ previousAlpha = view.layer.presentation()?.opacity ?? Float(view.alpha)
+ } else {
+ previousAlpha = Float(view.alpha)
+ }
+ view.alpha = alpha
+ self.animateAlpha(layer: view.layer, from: CGFloat(previousAlpha), to: alpha, delay: delay, completion: completion)
+ }
}
public func setAlpha(layer: CALayer, alpha: CGFloat, delay: Double = 0.0, completion: ((Bool) -> Void)? = nil) {
@@ -1335,6 +1353,41 @@ public struct ComponentTransition {
completion: completion
)
}
+
+ public func setBlur(layer: CALayer, radius: CGFloat, completion: ((Bool) -> Void)? = nil) {
+ var currentRadius: CGFloat = 0.0
+ if let currentFilters = layer.filters {
+ for filter in currentFilters {
+ if let filter = filter as? NSObject, filter.description.contains("gaussianBlur") {
+ currentRadius = filter.value(forKey: "inputRadius") as? CGFloat ?? 0.0
+ }
+ }
+ }
+
+ if currentRadius == radius {
+ completion?(true)
+ return
+ }
+
+ if let blurFilter = CALayer.blur() {
+ blurFilter.setValue(radius as NSNumber, forKey: "inputRadius")
+ layer.filters = [blurFilter]
+ switch self.animation {
+ case .none:
+ completion?(true)
+ case let .curve(duration, curve):
+ layer.animate(from: currentRadius as NSNumber, to: radius as NSNumber, keyPath: "filters.gaussianBlur.inputRadius", duration: duration, delay: 0.0, curve: curve, removeOnCompletion: true, additive: false,completion: { [weak layer] flag in
+ if let layer {
+ if radius <= 0.0 {
+ layer.filters = nil
+ }
+ }
+
+ completion?(flag)
+ })
+ }
+ }
+ }
public func animateBlur(layer: CALayer, fromRadius: CGFloat, toRadius: CGFloat, delay: Double = 0.0, removeOnCompletion: Bool = true, completion: ((Bool) -> Void)? = nil) {
let duration: Double
@@ -1359,4 +1412,23 @@ public struct ComponentTransition {
})
}
}
+
+ public func animateMeshTransform(layer: CALayer, from fromValue: NSObject, to toValue: NSObject, delay: Double = 0.0, removeOnCompletion: Bool = true, completion: ((Bool) -> Void)? = nil) {
+ switch self.animation {
+ case .none:
+ completion?(true)
+ case let .curve(duration, curve):
+ layer.animate(
+ from: fromValue,
+ to: toValue,
+ keyPath: "meshTransform",
+ duration: duration,
+ delay: delay,
+ curve: curve,
+ removeOnCompletion: removeOnCompletion,
+ additive: false,
+ completion: completion
+ )
+ }
+ }
}
diff --git a/submodules/ComponentFlow/Source/Components/Button.swift b/submodules/ComponentFlow/Source/Components/Button.swift
index c93ef055..a40aeb0d 100644
--- a/submodules/ComponentFlow/Source/Components/Button.swift
+++ b/submodules/ComponentFlow/Source/Components/Button.swift
@@ -3,6 +3,7 @@ import UIKit
public final class Button: Component {
public let content: AnyComponent
+ public let contentInsets: UIEdgeInsets
public let minSize: CGSize?
public let hitTestEdgeInsets: UIEdgeInsets?
public let tag: AnyObject?
@@ -15,6 +16,7 @@ public final class Button: Component {
convenience public init(
content: AnyComponent,
+ contentInsets: UIEdgeInsets = UIEdgeInsets(),
isEnabled: Bool = true,
automaticHighlight: Bool = true,
action: @escaping () -> Void,
@@ -22,6 +24,7 @@ public final class Button: Component {
) {
self.init(
content: content,
+ contentInsets: contentInsets,
minSize: nil,
hitTestEdgeInsets: nil,
tag: nil,
@@ -35,6 +38,7 @@ public final class Button: Component {
private init(
content: AnyComponent,
+ contentInsets: UIEdgeInsets = UIEdgeInsets(),
minSize: CGSize? = nil,
hitTestEdgeInsets: UIEdgeInsets? = nil,
tag: AnyObject? = nil,
@@ -46,6 +50,7 @@ public final class Button: Component {
highlightedAction: ActionSlot?
) {
self.content = content
+ self.contentInsets = contentInsets
self.minSize = minSize
self.hitTestEdgeInsets = hitTestEdgeInsets
self.tag = tag
@@ -60,6 +65,7 @@ public final class Button: Component {
public func minSize(_ minSize: CGSize?) -> Button {
return Button(
content: self.content,
+ contentInsets: self.contentInsets,
minSize: minSize,
hitTestEdgeInsets: self.hitTestEdgeInsets,
tag: self.tag,
@@ -75,6 +81,7 @@ public final class Button: Component {
public func withHitTestEdgeInsets(_ hitTestEdgeInsets: UIEdgeInsets?) -> Button {
return Button(
content: self.content,
+ contentInsets: self.contentInsets,
minSize: self.minSize,
hitTestEdgeInsets: hitTestEdgeInsets,
tag: self.tag,
@@ -90,6 +97,7 @@ public final class Button: Component {
public func withIsExclusive(_ isExclusive: Bool) -> Button {
return Button(
content: self.content,
+ contentInsets: self.contentInsets,
minSize: self.minSize,
hitTestEdgeInsets: self.hitTestEdgeInsets,
tag: self.tag,
@@ -106,6 +114,7 @@ public final class Button: Component {
public func withHoldAction(_ holdAction: ((UIView) -> Void)?) -> Button {
return Button(
content: self.content,
+ contentInsets: self.contentInsets,
minSize: self.minSize,
hitTestEdgeInsets: self.hitTestEdgeInsets,
tag: self.tag,
@@ -121,6 +130,7 @@ public final class Button: Component {
public func tagged(_ tag: AnyObject) -> Button {
return Button(
content: self.content,
+ contentInsets: self.contentInsets,
minSize: self.minSize,
hitTestEdgeInsets: self.hitTestEdgeInsets,
tag: tag,
@@ -137,6 +147,9 @@ public final class Button: Component {
if lhs.content != rhs.content {
return false
}
+ if lhs.contentInsets != rhs.contentInsets {
+ return false
+ }
if lhs.minSize != rhs.minSize {
return false
}
@@ -318,6 +331,8 @@ public final class Button: Component {
size.width = max(size.width, minSize.width)
size.height = max(size.height, minSize.height)
}
+ size.width += component.contentInsets.left + component.contentInsets.right
+ size.height += component.contentInsets.top + component.contentInsets.bottom
self.component = component
diff --git a/submodules/ComponentFlow/Source/Components/Image.swift b/submodules/ComponentFlow/Source/Components/Image.swift
index 78475c94..f18aba2e 100644
--- a/submodules/ComponentFlow/Source/Components/Image.swift
+++ b/submodules/ComponentFlow/Source/Components/Image.swift
@@ -6,17 +6,20 @@ public final class Image: Component {
public let tintColor: UIColor?
public let size: CGSize?
public let contentMode: UIImageView.ContentMode
+ public let cornerRadius: CGFloat
public init(
image: UIImage?,
tintColor: UIColor? = nil,
size: CGSize? = nil,
- contentMode: UIImageView.ContentMode = .scaleToFill
+ contentMode: UIImageView.ContentMode = .scaleToFill,
+ cornerRadius: CGFloat = 0.0
) {
self.image = image
self.tintColor = tintColor
self.size = size
self.contentMode = contentMode
+ self.cornerRadius = cornerRadius
}
public static func ==(lhs: Image, rhs: Image) -> Bool {
@@ -32,6 +35,9 @@ public final class Image: Component {
if lhs.contentMode != rhs.contentMode {
return false
}
+ if lhs.cornerRadius != rhs.cornerRadius {
+ return false
+ }
return true
}
@@ -47,7 +53,9 @@ public final class Image: Component {
func update(component: Image, availableSize: CGSize, environment: Environment, transition: ComponentTransition) -> CGSize {
self.image = component.image
self.contentMode = component.contentMode
-
+ self.clipsToBounds = component.cornerRadius > 0.0
+
+ transition.setCornerRadius(layer: self.layer, cornerRadius: component.cornerRadius)
transition.setTintColor(view: self, color: component.tintColor ?? .white)
switch component.contentMode {
diff --git a/submodules/Components/MultilineTextWithEntitiesComponent/Sources/MultilineTextWithEntitiesComponent.swift b/submodules/Components/MultilineTextWithEntitiesComponent/Sources/MultilineTextWithEntitiesComponent.swift
index 7766272b..2519f2f6 100644
--- a/submodules/Components/MultilineTextWithEntitiesComponent/Sources/MultilineTextWithEntitiesComponent.swift
+++ b/submodules/Components/MultilineTextWithEntitiesComponent/Sources/MultilineTextWithEntitiesComponent.swift
@@ -43,6 +43,7 @@ public final class MultilineTextWithEntitiesComponent: Component {
public let handleSpoilers: Bool
public let manualVisibilityControl: Bool
public let resetAnimationsOnVisibilityChange: Bool
+ public let enableLooping: Bool
public let displaysAsynchronously: Bool
public let maxWidth: CGFloat?
public let highlightAction: (([NSAttributedString.Key: Any]) -> NSAttributedString.Key?)?
@@ -71,6 +72,7 @@ public final class MultilineTextWithEntitiesComponent: Component {
handleSpoilers: Bool = false,
manualVisibilityControl: Bool = false,
resetAnimationsOnVisibilityChange: Bool = false,
+ enableLooping: Bool = true,
displaysAsynchronously: Bool = true,
maxWidth: CGFloat? = nil,
highlightAction: (([NSAttributedString.Key: Any]) -> NSAttributedString.Key?)? = nil,
@@ -99,6 +101,7 @@ public final class MultilineTextWithEntitiesComponent: Component {
self.handleSpoilers = handleSpoilers
self.manualVisibilityControl = manualVisibilityControl
self.resetAnimationsOnVisibilityChange = resetAnimationsOnVisibilityChange
+ self.enableLooping = enableLooping
self.displaysAsynchronously = displaysAsynchronously
self.maxWidth = maxWidth
self.tapAction = tapAction
@@ -142,6 +145,9 @@ public final class MultilineTextWithEntitiesComponent: Component {
if lhs.resetAnimationsOnVisibilityChange != rhs.resetAnimationsOnVisibilityChange {
return false
}
+ if lhs.enableLooping != rhs.enableLooping {
+ return false
+ }
if lhs.displaysAsynchronously != rhs.displaysAsynchronously {
return false
}
@@ -250,6 +256,7 @@ public final class MultilineTextWithEntitiesComponent: Component {
self.textNode.tapAttributeAction = component.tapAction
self.textNode.longTapAttributeAction = component.longTapAction
self.textNode.spoilerColor = component.spoilerColor
+ self.textNode.enableLooping = component.enableLooping
self.textNode.resetEmojiToFirstFrameAutomatically = component.resetAnimationsOnVisibilityChange
diff --git a/submodules/Components/PagerComponent/Sources/PagerComponent.swift b/submodules/Components/PagerComponent/Sources/PagerComponent.swift
index 42f1c2b0..4b11ff0e 100644
--- a/submodules/Components/PagerComponent/Sources/PagerComponent.swift
+++ b/submodules/Components/PagerComponent/Sources/PagerComponent.swift
@@ -974,8 +974,9 @@ public final class PagerComponent: Component {
public typealias EnvironmentType = (ChildEnvironmentType, SheetComponentEnvironment)
@@ -342,7 +341,7 @@ public final class SheetComponent: C
let contentOffset = (self.scrollView.contentOffset.y + self.scrollView.contentInset.top - self.scrollView.contentSize.height) * -1.0
let dismissalOffset = self.scrollView.contentSize.height + abs(contentView.frame.minY)
let delta = dismissalOffset - contentOffset
- var targetPosition = self.scrollView.center.y + delta
+ var targetPosition = self.scrollView.center.y + delta + 6.0
if self.isCentered {
targetPosition = self.frame.height + self.scrollView.frame.height * 0.5
}
@@ -351,7 +350,7 @@ public final class SheetComponent: C
completion()
})
} else {
- var targetOffset: CGFloat = self.scrollView.contentSize.height + abs(contentView.frame.minY)
+ var targetOffset: CGFloat = self.scrollView.contentSize.height + abs(contentView.frame.minY) + 6.0
if self.isCentered {
targetOffset = self.frame.height + self.scrollView.frame.height * 0.5
}
@@ -468,7 +467,7 @@ public final class SheetComponent: C
switch component.style {
case .glass:
let clipFrame = CGRect(origin: CGPoint(x: glassInset, y: -glassInset), size: CGSize(width: contentSize.width, height: contentSize.height))
- self.clipView.update(size: clipFrame.size, color: .clear, topCornerRadius: topCornerRadius, bottomCornerRadius: bottomCornerRadius, transition: transition)
+ self.clipView.update(size: clipFrame.size, color: .clear, topCornerRadius: topCornerRadius - 1.5, bottomCornerRadius: bottomCornerRadius, transition: transition)
transition.setFrame(view: self.clipView, frame: clipFrame)
transition.setFrame(view: contentView, frame: CGRect(origin: .zero, size: CGSize(width: contentSize.width, height: contentSize.height)), completion: nil)
transition.setFrame(view: self.backgroundView, frame: CGRect(origin: CGPoint(x: glassInset, y: -glassInset), size: CGSize(width: contentSize.width, height: contentSize.height)), completion: nil)
@@ -482,7 +481,7 @@ public final class SheetComponent: C
transition.setFrame(view: effectView, frame: CGRect(origin: .zero, size: CGSize(width: contentSize.width, height: contentSize.height + 1000.0)), completion: nil)
}
}
- self.backgroundView.update(size: contentSize, color: backgroundColor, topCornerRadius: topCornerRadius, bottomCornerRadius: bottomCornerRadius, transition: transition)
+ self.backgroundView.update(size: contentSize, color: backgroundColor, topCornerRadius: topCornerRadius + 1.5, bottomCornerRadius: bottomCornerRadius, transition: transition)
}
}
transition.setFrame(view: self.scrollView, frame: CGRect(origin: CGPoint(), size: availableSize), completion: nil)
diff --git a/submodules/Components/ViewControllerComponent/Sources/ViewControllerComponent.swift b/submodules/Components/ViewControllerComponent/Sources/ViewControllerComponent.swift
index 25d70a78..e017ad64 100644
--- a/submodules/Components/ViewControllerComponent/Sources/ViewControllerComponent.swift
+++ b/submodules/Components/ViewControllerComponent/Sources/ViewControllerComponent.swift
@@ -280,12 +280,14 @@ open class ViewControllerComponentContainer: ViewController {
case .none:
navigationBarPresentationData = nil
case .transparent:
- navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData, hideBackground: true, hideBadge: false, hideSeparator: true)
+ navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData, hideBackground: true, hideBadge: false, hideSeparator: true, style: .glass)
case .default:
- navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData)
+ navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData, style: .glass)
}
super.init(navigationBarPresentationData: navigationBarPresentationData)
+ self._hasGlassStyle = true
+
self.setupPresentationData(effectiveUpdatedPresentationData, navigationBarAppearance: navigationBarAppearance, statusBarStyle: statusBarStyle, presentationMode: presentationMode)
}
@@ -308,9 +310,9 @@ open class ViewControllerComponentContainer: ViewController {
case .none:
navigationBarPresentationData = nil
case .transparent:
- navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData, hideBackground: true, hideBadge: false, hideSeparator: true)
+ navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData, hideBackground: true, hideBadge: false, hideSeparator: true, style: .glass)
case .default:
- navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData)
+ navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData, style: .glass)
}
super.init(navigationBarPresentationData: navigationBarPresentationData)
@@ -356,12 +358,12 @@ open class ViewControllerComponentContainer: ViewController {
case .none:
navigationBarPresentationData = nil
case .transparent:
- navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData, hideBackground: true, hideBadge: false, hideSeparator: true)
+ navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData, hideBackground: true, hideBadge: false, hideSeparator: true, style: .glass)
case .default:
- navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData)
+ navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData, style: .glass)
}
if let navigationBarPresentationData {
- strongSelf.navigationBar?.updatePresentationData(navigationBarPresentationData)
+ strongSelf.navigationBar?.updatePresentationData(navigationBarPresentationData, transition: .immediate)
}
if let layout = strongSelf.validLayout {
diff --git a/submodules/ComposePollUI/BUILD b/submodules/ComposePollUI/BUILD
index 04f0e88a..db6a0ef3 100644
--- a/submodules/ComposePollUI/BUILD
+++ b/submodules/ComposePollUI/BUILD
@@ -42,7 +42,6 @@ swift_library(
"//submodules/ChatPresentationInterfaceState",
"//submodules/TelegramUI/Components/EmojiSuggestionsComponent",
"//submodules/TelegramUI/Components/ListComposePollOptionComponent",
- "//submodules/TelegramUI/Components/EdgeEffect",
"//submodules/TelegramUI/Components/GlassBarButtonComponent",
],
visibility = [
diff --git a/submodules/ComposePollUI/Sources/ComposePollScreen.swift b/submodules/ComposePollUI/Sources/ComposePollScreen.swift
index c00d4021..32b9cdde 100644
--- a/submodules/ComposePollUI/Sources/ComposePollScreen.swift
+++ b/submodules/ComposePollUI/Sources/ComposePollScreen.swift
@@ -27,7 +27,6 @@ import EmojiSuggestionsComponent
import TextFormat
import TextFieldComponent
import ListComposePollOptionComponent
-import EdgeEffect
import GlassBarButtonComponent
public final class ComposedPoll {
@@ -76,6 +75,7 @@ final class ComposePollScreenComponent: Component {
typealias EnvironmentType = ViewControllerComponentContainer.Environment
let context: AccountContext
+ let overNavigationContainer: UIView
let peer: EnginePeer
let isQuiz: Bool?
let initialData: ComposePollScreen.InitialData
@@ -83,12 +83,14 @@ final class ComposePollScreenComponent: Component {
init(
context: AccountContext,
+ overNavigationContainer: UIView,
peer: EnginePeer,
isQuiz: Bool?,
initialData: ComposePollScreen.InitialData,
completion: @escaping (ComposedPoll) -> Void
) {
self.context = context
+ self.overNavigationContainer = overNavigationContainer
self.peer = peer
self.isQuiz = isQuiz
self.initialData = initialData
@@ -112,7 +114,6 @@ final class ComposePollScreenComponent: Component {
final class View: UIView, UIScrollViewDelegate {
private let scrollView: UIScrollView
- private let edgeEffectView: EdgeEffectView
private var reactionInput: ComponentView?
private let pollTextSection = ComponentView()
@@ -184,8 +185,6 @@ final class ComposePollScreenComponent: Component {
self.scrollView.contentInsetAdjustmentBehavior = .never
self.scrollView.alwaysBounceVertical = true
- self.edgeEffectView = EdgeEffectView()
-
self.pollOptionsSectionContainer = ListSectionContentView(frame: CGRect())
super.init(frame: frame)
@@ -193,8 +192,6 @@ final class ComposePollScreenComponent: Component {
self.scrollView.delegate = self
self.addSubview(self.scrollView)
- self.addSubview(self.edgeEffectView)
-
let reorderRecognizer = ReorderGestureRecognizer(
shouldBegin: { [weak self] point in
guard let self, let (id, item) = self.item(at: point) else {
@@ -550,7 +547,6 @@ final class ComposePollScreenComponent: Component {
pendingUnpinnedAllMessages: false,
activeGroupCallInfo: nil,
hasActiveGroupCall: false,
- importState: nil,
threadData: nil,
isGeneralThreadClosed: nil,
replyMessage: nil,
@@ -1624,11 +1620,6 @@ final class ComposePollScreenComponent: Component {
self.scrollView.verticalScrollIndicatorInsets = scrollInsets
}
- let edgeEffectHeight: CGFloat = 80.0
- let edgeEffectFrame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: availableSize.width, height: edgeEffectHeight))
- transition.setFrame(view: self.edgeEffectView, frame: edgeEffectFrame)
- self.edgeEffectView.update(content: theme.list.blocksBackgroundColor, blur: true, alpha: 1.0, rect: edgeEffectFrame, edge: .top, edgeSize: edgeEffectFrame.height, transition: transition)
-
let title = self.isQuiz ? environment.strings.CreatePoll_QuizTitle : environment.strings.CreatePoll_Title
let titleSize = self.title.update(
transition: .immediate,
@@ -1649,23 +1640,23 @@ final class ComposePollScreenComponent: Component {
let titleFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((availableSize.width - titleSize.width) / 2.0), y: floorToScreenPixels((environment.navigationHeight - titleSize.height) / 2.0) + 3.0), size: titleSize)
if let titleView = self.title.view {
if titleView.superview == nil {
- self.addSubview(titleView)
+ component.overNavigationContainer.addSubview(titleView)
}
transition.setFrame(view: titleView, frame: titleFrame)
}
- let barButtonSize = CGSize(width: 40.0, height: 40.0)
+ let barButtonSize = CGSize(width: 44.0, height: 44.0)
let cancelButtonSize = self.cancelButton.update(
transition: transition,
component: AnyComponent(GlassBarButtonComponent(
size: barButtonSize,
- backgroundColor: environment.theme.rootController.navigationBar.glassBarButtonBackgroundColor,
+ backgroundColor: nil,
isDark: environment.theme.overallDarkAppearance,
- state: .generic,
+ state: .glass,
component: AnyComponentWithIdentity(id: "close", component: AnyComponent(
BundleIconComponent(
name: "Navigation/Close",
- tintColor: environment.theme.rootController.navigationBar.glassBarButtonForegroundColor
+ tintColor: environment.theme.chat.inputPanel.panelControlColor
)
)),
action: { [weak self] _ in
@@ -1681,7 +1672,7 @@ final class ComposePollScreenComponent: Component {
let cancelButtonFrame = CGRect(origin: CGPoint(x: environment.safeInsets.left + 16.0, y: 16.0), size: cancelButtonSize)
if let cancelButtonView = self.cancelButton.view {
if cancelButtonView.superview == nil {
- self.addSubview(cancelButtonView)
+ component.overNavigationContainer.addSubview(cancelButtonView)
}
transition.setFrame(view: cancelButtonView, frame: cancelButtonFrame)
}
@@ -1717,7 +1708,7 @@ final class ComposePollScreenComponent: Component {
let doneButtonFrame = CGRect(origin: CGPoint(x: availableSize.width - environment.safeInsets.right - 16.0 - doneButtonSize.width, y: 16.0), size: doneButtonSize)
if let doneButtonView = self.doneButton.view {
if doneButtonView.superview == nil {
- self.addSubview(doneButtonView)
+ component.overNavigationContainer.addSubview(doneButtonView)
}
transition.setFrame(view: doneButtonView, frame: doneButtonFrame)
}
@@ -1798,6 +1789,8 @@ public class ComposePollScreen: ViewControllerComponentContainer, AttachmentCont
fileprivate let completion: (ComposedPoll) -> Void
private var isDismissed: Bool = false
+ private let overNavigationContainer: UIView
+
fileprivate private(set) var sendButtonItem: UIBarButtonItem?
public var isMinimized: Bool = false
@@ -1842,13 +1835,16 @@ public class ComposePollScreen: ViewControllerComponentContainer, AttachmentCont
self.context = context
self.completion = completion
+ self.overNavigationContainer = SparseContainerView()
+
super.init(context: context, component: ComposePollScreenComponent(
context: context,
+ overNavigationContainer: self.overNavigationContainer,
peer: peer,
isQuiz: isQuiz,
initialData: initialData,
completion: completion
- ), navigationBarAppearance: .transparent, theme: .default)
+ ), navigationBarAppearance: .default, theme: .default)
self._hasGlassStyle = true
@@ -1883,6 +1879,10 @@ public class ComposePollScreen: ViewControllerComponentContainer, AttachmentCont
return componentView.attemptNavigation(complete: complete)
}
+
+ if let navigationBar = self.navigationBar {
+ navigationBar.customOverBackgroundContentView.insertSubview(self.overNavigationContainer, at: 0)
+ }
}
required public init(coder aDecoder: NSCoder) {
diff --git a/submodules/ContactListUI/BUILD b/submodules/ContactListUI/BUILD
index 99168662..67211ef0 100644
--- a/submodules/ContactListUI/BUILD
+++ b/submodules/ContactListUI/BUILD
@@ -22,7 +22,6 @@ swift_library(
"//submodules/ChatListSearchItemHeader:ChatListSearchItemHeader",
"//submodules/ItemListPeerItem:ItemListPeerItem",
"//submodules/ContactsPeerItem:ContactsPeerItem",
- "//submodules/ChatListSearchItemNode:ChatListSearchItemNode",
"//submodules/TelegramPermissionsUI:TelegramPermissionsUI",
"//submodules/TelegramNotices:TelegramNotices",
"//submodules/AlertUI:AlertUI",
@@ -48,6 +47,7 @@ swift_library(
"//submodules/ContextUI",
"//submodules/TelegramUI/Components/EdgeEffect",
"//submodules/TelegramUI/Components/SearchInputPanelComponent",
+ "//submodules/SearchBarNode",
],
visibility = [
"//visibility:public",
diff --git a/submodules/ContactListUI/Sources/ContactAddItem.swift b/submodules/ContactListUI/Sources/ContactAddItem.swift
index 22d6856c..550001c4 100644
--- a/submodules/ContactListUI/Sources/ContactAddItem.swift
+++ b/submodules/ContactListUI/Sources/ContactAddItem.swift
@@ -129,7 +129,7 @@ class ContactsAddItemNode: ListViewItemNode {
self.iconNode = ASImageNode()
self.titleNode = TextNode()
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.addSubnode(self.backgroundNode)
self.addSubnode(self.separatorNode)
diff --git a/submodules/ContactListUI/Sources/ContactListActionItem.swift b/submodules/ContactListUI/Sources/ContactListActionItem.swift
index b6dcf22b..3b25b455 100644
--- a/submodules/ContactListUI/Sources/ContactListActionItem.swift
+++ b/submodules/ContactListUI/Sources/ContactListActionItem.swift
@@ -181,7 +181,7 @@ class ContactListActionItemNode: ListViewItemNode {
self.activateArea = AccessibilityAreaNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.iconNode)
self.addSubnode(self.titleNode)
diff --git a/submodules/ContactListUI/Sources/ContactListNameIndexHeader.swift b/submodules/ContactListUI/Sources/ContactListNameIndexHeader.swift
index 9fd3a49d..a693ff97 100644
--- a/submodules/ContactListUI/Sources/ContactListNameIndexHeader.swift
+++ b/submodules/ContactListUI/Sources/ContactListNameIndexHeader.swift
@@ -11,6 +11,7 @@ final class ContactListNameIndexHeader: Equatable, ListViewItemHeader {
let letter: unichar
let stickDirection: ListViewItemHeaderStickDirection = .top
public let stickOverInsets: Bool = true
+ public let isSticky: Bool = false
let height: CGFloat = 29.0
diff --git a/submodules/ContactListUI/Sources/ContactListNode.swift b/submodules/ContactListUI/Sources/ContactListNode.swift
index 9dc1ed23..ed179a82 100644
--- a/submodules/ContactListUI/Sources/ContactListNode.swift
+++ b/submodules/ContactListUI/Sources/ContactListNode.swift
@@ -16,7 +16,6 @@ import AccountContext
import TelegramPermissions
import TelegramNotices
import ContactsPeerItem
-import ChatListSearchItemNode
import ChatListSearchItemHeader
import SearchUI
import TelegramPermissionsUI
@@ -96,7 +95,6 @@ private enum ContactListNodeEntry: Comparable, Identifiable {
var hasUnseenCloseFriends: Bool
}
- case search(PresentationTheme, PresentationStrings)
case sort(PresentationTheme, PresentationStrings, ContactsSortOrder)
case permissionInfo(PresentationTheme, String, String, Bool)
case permissionEnable(PresentationTheme, String)
@@ -107,8 +105,6 @@ private enum ContactListNodeEntry: Comparable, Identifiable {
var stableId: ContactListNodeEntryId {
switch self {
- case .search:
- return .search
case .sort:
return .sort
case .permissionInfo:
@@ -133,10 +129,6 @@ private enum ContactListNodeEntry: Comparable, Identifiable {
func item(context: AccountContext, presentationData: PresentationData, interaction: ContactListNodeInteraction, isSearch: Bool, listStyle: ItemListStyle) -> ListViewItem {
switch self {
- case let .search(theme, strings):
- return ChatListSearchItem(theme: theme, placeholder: strings.Contacts_SearchLabel, activate: {
- interaction.activateSearch()
- })
case let .sort(_, strings, sortOrder):
var text = strings.Contacts_SortedByName
if case .presence = sortOrder {
@@ -270,12 +262,6 @@ private enum ContactListNodeEntry: Comparable, Identifiable {
static func ==(lhs: ContactListNodeEntry, rhs: ContactListNodeEntry) -> Bool {
switch lhs {
- case let .search(lhsTheme, lhsStrings):
- if case let .search(rhsTheme, rhsStrings) = rhs, lhsTheme === rhsTheme, lhsStrings === rhsStrings {
- return true
- } else {
- return false
- }
case let .sort(lhsTheme, lhsStrings, lhsSortOrder):
if case let .sort(rhsTheme, rhsStrings, rhsSortOrder) = rhs, lhsTheme === rhsTheme, lhsStrings === rhsStrings, lhsSortOrder == rhsSortOrder {
return true
@@ -376,39 +362,35 @@ private enum ContactListNodeEntry: Comparable, Identifiable {
static func <(lhs: ContactListNodeEntry, rhs: ContactListNodeEntry) -> Bool {
switch lhs {
- case .search:
- return true
case .sort:
switch rhs {
- case .search:
- return false
default:
return true
}
case .permissionInfo:
switch rhs {
- case .search, .sort:
+ case .sort:
return false
default:
return true
}
case .permissionEnable:
switch rhs {
- case .search, .sort, .permissionInfo:
+ case .sort, .permissionInfo:
return false
default:
return true
}
case .permissionLimited:
switch rhs {
- case .search, .sort, .permissionInfo, .permissionEnable:
+ case .sort, .permissionInfo, .permissionEnable:
return false
default:
return true
}
case let .option(lhsIndex, _, _, _, _):
switch rhs {
- case .search, .sort, .permissionInfo, .permissionEnable, .permissionLimited:
+ case .sort, .permissionInfo, .permissionEnable, .permissionLimited:
return false
case let .option(rhsIndex, _, _, _, _):
return lhsIndex < rhsIndex
@@ -417,14 +399,14 @@ private enum ContactListNodeEntry: Comparable, Identifiable {
}
case let .header(lhsIndex, _):
switch rhs {
- case .search, .sort, .permissionInfo, .permissionEnable, .permissionLimited, .option:
+ case .sort, .permissionInfo, .permissionEnable, .permissionLimited, .option:
return false
case let .header(rhsIndex, _), let .peer(rhsIndex, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _):
return lhsIndex < rhsIndex
}
case let .peer(lhsIndex, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _):
switch rhs {
- case .search, .sort, .permissionInfo, .permissionEnable, .permissionLimited, .option:
+ case .sort, .permissionInfo, .permissionEnable, .permissionLimited, .option:
return false
case let .peer(rhsIndex, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _), let .header(rhsIndex, _):
// if (lhsStoryData == nil) != (rhsStoryData == nil) {
@@ -901,9 +883,6 @@ private func preparedContactListNodeTransition(context: AccountContext, presenta
switch entry {
case .sort:
shouldFixScroll = true
- case .search:
- //indexSections.apend(CollectionIndexNode.searchIndex)
- break
case let .peer(_, _, _, header, _, _, _, _, _, _, _, _, _, _, _, _):
if let header = header as? ContactListNameIndexHeader {
if !existingSections.contains(header.letter) {
@@ -1255,7 +1234,6 @@ public final class ContactListNode: ASDisplayNode {
self.presentationData = presentationData
self.listNode = ListView()
- self.listNode.dynamicBounceEnabled = false
self.listNode.accessibilityPageScrolledString = { row, count in
return presentationData.strings.VoiceOver_ScrollStatus(row, count).string
}
@@ -1419,11 +1397,6 @@ public final class ContactListNode: ASDisplayNode {
var peerIndex = 0
loop: for entry in entries {
switch entry {
- case .search:
- if section == CollectionIndexNode.searchIndex {
- strongSelf.listNode.transaction(deleteIndices: [], insertIndicesAndItems: [], updateIndicesAndItems: [], options: [.PreferSynchronousDrawing, .PreferSynchronousResourceLoading], scrollToItem: ListViewScrollToItem(index: index, position: .top(-navigationBarSearchContentHeight), animated: false, curve: .Default(duration: nil), directionHint: .Down), additionalScrollDistance: 0.0, updateSizeAndInsets: updateSizeAndInsets, stationaryItemRange: nil, updateOpaqueState: nil, completion: { _ in })
- break loop
- }
case let .peer(_, _, _, header, _, _, _, _, _, _, _, _, _, _, _, _):
if let header = header as? ContactListNameIndexHeader {
if let scalar = UnicodeScalar(header.letter) {
@@ -2124,8 +2097,6 @@ public final class ContactListNode: ASDisplayNode {
strongSelf.authorizationNode.isHidden = authorizationPreviousHidden
strongSelf.addSubnode(strongSelf.authorizationNode)
- strongSelf.listNode.dynamicBounceEnabled = false
-
strongSelf.listNode.forEachAccessoryItemNode({ accessoryItemNode in
if let accessoryItemNode = accessoryItemNode as? ContactsSectionHeaderAccessoryItemNode {
accessoryItemNode.updateTheme(theme: presentationData.theme)
diff --git a/submodules/ContactListUI/Sources/ContactsController.swift b/submodules/ContactListUI/Sources/ContactsController.swift
index 425ca2b7..293c10db 100644
--- a/submodules/ContactListUI/Sources/ContactsController.swift
+++ b/submodules/ContactListUI/Sources/ContactsController.swift
@@ -24,6 +24,7 @@ import ChatListHeaderComponent
import TelegramIntents
import UndoUI
import ShareController
+import SearchBarNode
private final class HeaderContextReferenceContentSource: ContextReferenceContentSource {
private let controller: ViewController
@@ -141,7 +142,6 @@ public class ContactsController: ViewController {
self.sortButton = SortHeaderButton(presentationData: self.presentationData)
- //super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData))
super.init(navigationBarPresentationData: nil)
self.tabBarItemContextActionType = .always
@@ -226,6 +226,8 @@ public class ContactsController: ViewController {
}
self.sortButton.addTarget(self, action: #selector(self.sortPressed), forControlEvents: .touchUpInside)
+
+ self.updateTabBarSearchState(ViewController.TabBarSearchState(isActive: false), transition: .immediate)
}
required public init(coder aDecoder: NSCoder) {
@@ -242,7 +244,6 @@ public class ContactsController: ViewController {
private func updateThemeAndStrings() {
self.sortButton.update(theme: self.presentationData.theme, strings: self.presentationData.strings)
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style
- self.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationData: self.presentationData))
self.title = self.presentationData.strings.Contacts_Title
self.tabBarItem.title = self.presentationData.strings.Contacts_Title
@@ -280,8 +281,6 @@ public class ContactsController: ViewController {
|> take(1)
|> map { _ -> Bool in true })
- self.contactsNode.navigationBar = self.navigationBar
-
let openPeer: (ContactListPeer, Bool) -> Void = { [weak self] peer, fromSearch in
if let strongSelf = self {
switch peer {
@@ -343,7 +342,7 @@ public class ContactsController: ViewController {
}
self.contactsNode.contactListNode.activateSearch = { [weak self] in
- self?.activateSearch()
+ self?.activateSearch(isFromTabBar: false)
}
self.contactsNode.contactListNode.openPeer = { [weak self] peer, _, _, _ in
@@ -580,18 +579,26 @@ public class ContactsController: ViewController {
self.sortButton.contextAction?(self.sortButton.containerNode, nil)
}
- private func activateSearch() {
- if let searchContentNode = self.searchContentNode() {
- self.contactsNode.activateSearch(placeholderNode: searchContentNode.placeholderNode)
+ private func activateSearch(isFromTabBar: Bool) {
+ let placeholderNode = isFromTabBar ? nil : self.searchContentNode()?.placeholderNode
+ self.contactsNode.activateSearch(placeholderNode: placeholderNode)
+ if placeholderNode != nil {
+ (self.parent as? TabBarController)?.updateIsTabBarHidden(true, transition: .animated(duration: 0.5, curve: .spring))
+ } else {
+ self.updateTabBarSearchState(ViewController.TabBarSearchState(isActive: true), transition: .animated(duration: 0.5, curve: .spring))
+ if let searchBarNode = self.currentTabBarSearchNode?() as? SearchBarNode {
+ self.contactsNode.searchDisplayController?.setSearchBar(searchBarNode)
+ searchBarNode.activate()
+ }
}
self.requestLayout(transition: .animated(duration: 0.5, curve: .spring))
}
private func deactivateSearch(animated: Bool) {
- if let searchContentNode = self.searchContentNode() {
- self.contactsNode.deactivateSearch(placeholderNode: searchContentNode.placeholderNode, animated: animated)
- self.requestLayout(transition: .animated(duration: 0.5, curve: .spring))
- }
+ self.contactsNode.deactivateSearch(placeholderNode: self.searchContentNode()?.placeholderNode, animated: animated)
+ self.updateTabBarSearchState(ViewController.TabBarSearchState(isActive: false), transition: .animated(duration: 0.5, curve: .spring))
+ (self.parent as? TabBarController)?.updateIsTabBarHidden(false, transition: .animated(duration: 0.5, curve: .spring))
+ self.requestLayout(transition: .animated(duration: 0.5, curve: .spring))
}
func presentSortMenu(sourceView: UIView, gesture: ContextGesture?) {
@@ -796,6 +803,14 @@ public class ContactsController: ViewController {
let controller = ContextController(presentationData: self.presentationData, source: .reference(ContactsTabBarContextReferenceContentSource(controller: self, sourceView: sourceView)), items: .single(ContextController.Items(content: .list(items))), recognizer: nil, gesture: gesture)
self.context.sharedContext.mainWindow?.presentInGlobalOverlay(controller)
}
+
+ override public func tabBarActivateSearch() {
+ self.activateSearch(isFromTabBar: true)
+ }
+
+ override public func tabBarDeactivateSearch() {
+ self.deactivateSearch(animated: true)
+ }
}
private final class ContactsTabBarContextReferenceContentSource: ContextReferenceContentSource {
diff --git a/submodules/ContactListUI/Sources/ContactsControllerNode.swift b/submodules/ContactListUI/Sources/ContactsControllerNode.swift
index 2718f81f..cb9b316c 100644
--- a/submodules/ContactListUI/Sources/ContactsControllerNode.swift
+++ b/submodules/ContactListUI/Sources/ContactsControllerNode.swift
@@ -53,12 +53,11 @@ final class ContactsControllerNode: ASDisplayNode, ASGestureRecognizerDelegate {
private let context: AccountContext
private(set) var searchDisplayController: SearchDisplayController?
- private var isSearchDisplayControllerActive: Bool = false
+ private var isSearchDisplayControllerActive: ChatListNavigationBar.ActiveSearch?
private var storiesUnlocked: Bool = false
private var containerLayout: (ContainerViewLayout, CGFloat)?
- var navigationBar: NavigationBar?
let navigationBarView = ComponentView()
var requestDeactivateSearch: (() -> Void)?
@@ -350,7 +349,6 @@ final class ContactsControllerNode: ASDisplayNode, ASGestureRecognizerDelegate {
chatListTitle: NetworkStatusTitle(text: title, activity: false, hasProxy: false, connectsViaProxy: false, isPasscodeSet: false, isManuallyLocked: false, peerStatus: nil),
leftButton: leftButton,
rightButtons: rightButtons,
- backTitle: nil,
backPressed: nil
)
@@ -362,14 +360,15 @@ final class ContactsControllerNode: ASDisplayNode, ASGestureRecognizerDelegate {
strings: self.presentationData.strings,
statusBarHeight: layout.statusBarHeight ?? 0.0,
sideInset: layout.safeInsets.left,
- isSearchActive: self.isSearchDisplayControllerActive,
- isSearchEnabled: true,
+ search: ChatListNavigationBar.Search(isEnabled: true),
+ activeSearch: self.isSearchDisplayControllerActive,
primaryContent: primaryContent,
secondaryContent: nil,
secondaryTransition: 0.0,
storySubscriptions: nil,
storiesIncludeHidden: true,
uploadProgress: [:],
+ headerPanels: nil,
tabsNode: tabsNode,
tabsNodeIsSearch: tabsNodeIsSearch,
accessoryPanelContainer: nil,
@@ -416,7 +415,7 @@ final class ContactsControllerNode: ASDisplayNode, ASGestureRecognizerDelegate {
private func updateNavigationScrolling(transition: ContainedViewLayoutTransition) {
var offset = self.getEffectiveNavigationScrollingOffset()
- if self.isSearchDisplayControllerActive {
+ if self.isSearchDisplayControllerActive != nil {
offset = 0.0
}
@@ -478,15 +477,15 @@ final class ContactsControllerNode: ASDisplayNode, ASGestureRecognizerDelegate {
}
}
- func activateSearch(placeholderNode: SearchBarPlaceholderNode) {
+ func activateSearch(placeholderNode: SearchBarPlaceholderNode?) {
guard let (containerLayout, navigationBarHeight) = self.containerLayout, self.searchDisplayController == nil else {
return
}
- self.isSearchDisplayControllerActive = true
+ self.isSearchDisplayControllerActive = ChatListNavigationBar.ActiveSearch(isExternal: placeholderNode == nil)
self.storiesUnlocked = false
- self.searchDisplayController = SearchDisplayController(presentationData: self.presentationData, mode: .list, contentNode: ContactsSearchContainerNode(context: self.context, onlyWriteable: false, categories: [.cloudContacts, .global, .deviceContacts], addContact: { [weak self] phoneNumber in
+ self.searchDisplayController = SearchDisplayController(presentationData: self.presentationData, mode: .navigation, contentNode: ContactsSearchContainerNode(context: self.context, glass: true, externalSearchBar: true, onlyWriteable: false, categories: [.cloudContacts, .global, .deviceContacts], addContact: { [weak self] phoneNumber in
if let requestAddContact = self?.requestAddContact {
requestAddContact(phoneNumber)
}
@@ -504,14 +503,14 @@ final class ContactsControllerNode: ASDisplayNode, ASGestureRecognizerDelegate {
if let requestDeactivateSearch = self?.requestDeactivateSearch {
requestDeactivateSearch()
}
- })
+ }, fieldStyle: placeholderNode?.fieldStyle ?? .modern, searchBarIsExternal: placeholderNode == nil)
self.searchDisplayController?.containerLayoutUpdated(containerLayout, navigationBarHeight: navigationBarHeight, transition: .immediate)
self.searchDisplayController?.activate(insertSubnode: { [weak self] subnode, isSearchBar in
if let strongSelf = self {
if isSearchBar {
if let navigationBarComponentView = strongSelf.navigationBarView.view as? ChatListNavigationBar.View {
- navigationBarComponentView.addSubnode(subnode)
+ navigationBarComponentView.searchContentNode?.addSubnode(subnode)
}
} else {
strongSelf.insertSubnode(subnode, aboveSubnode: strongSelf.contactListNode)
@@ -520,16 +519,11 @@ final class ContactsControllerNode: ASDisplayNode, ASGestureRecognizerDelegate {
}, placeholder: placeholderNode)
}
- func deactivateSearch(placeholderNode: SearchBarPlaceholderNode, animated: Bool) {
- self.isSearchDisplayControllerActive = false
+ func deactivateSearch(placeholderNode: SearchBarPlaceholderNode?, animated: Bool) {
+ self.isSearchDisplayControllerActive = nil
if let searchDisplayController = self.searchDisplayController {
- let previousFrame = placeholderNode.frame
- placeholderNode.frame = previousFrame.offsetBy(dx: 0.0, dy: 54.0)
-
searchDisplayController.deactivate(placeholder: placeholderNode, animated: animated)
self.searchDisplayController = nil
-
- placeholderNode.frame = previousFrame
}
}
}
diff --git a/submodules/ContactListUI/Sources/ContactsSearchContainerNode.swift b/submodules/ContactListUI/Sources/ContactsSearchContainerNode.swift
index 67f534a4..c033bca5 100644
--- a/submodules/ContactListUI/Sources/ContactsSearchContainerNode.swift
+++ b/submodules/ContactListUI/Sources/ContactsSearchContainerNode.swift
@@ -232,6 +232,7 @@ public final class ContactsSearchContainerNode: SearchDisplayControllerContentNo
private let context: AccountContext
private let glass: Bool
+ private let externalSearchBar: Bool
private let isPeerEnabled: (ContactListPeer) -> Bool
private let addContact: ((String) -> Void)?
private let openPeer: (ContactListPeer, ContactsSearchContainerNode.OpenPeerAction) -> Void
@@ -265,6 +266,7 @@ public final class ContactsSearchContainerNode: SearchDisplayControllerContentNo
public init(
context: AccountContext,
glass: Bool = false,
+ externalSearchBar: Bool = false,
updatedPresentationData: (initial: PresentationData, signal: Signal)? = nil,
onlyWriteable: Bool,
categories: ContactsSearchCategories,
@@ -278,6 +280,7 @@ public final class ContactsSearchContainerNode: SearchDisplayControllerContentNo
) {
self.context = context
self.glass = glass
+ self.externalSearchBar = externalSearchBar
self.isPeerEnabled = isPeerEnabled
self.addContact = addContact
self.openPeer = openPeer
@@ -290,7 +293,7 @@ public final class ContactsSearchContainerNode: SearchDisplayControllerContentNo
self.themeAndStringsPromise = Promise((self.presentationData.theme, self.presentationData.strings))
self.dimNode = ASDisplayNode()
- self.dimNode.backgroundColor = glass ? .clear : UIColor.black.withAlphaComponent(0.5)
+ self.dimNode.backgroundColor = .clear
self.backgroundNode = ASDisplayNode()
self.backgroundNode.backgroundColor = self.presentationData.theme.list.plainBackgroundColor
@@ -686,12 +689,26 @@ public final class ContactsSearchContainerNode: SearchDisplayControllerContentNo
self.containerViewLayout = (layout, navigationBarHeight)
let topInset = navigationBarHeight
- transition.updateFrame(node: self.dimNode, frame: CGRect(origin: CGPoint(x: 0.0, y: topInset), size: CGSize(width: layout.size.width, height: layout.size.height - topInset)))
+ transition.updateFrame(node: self.dimNode, frame: CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: layout.size.width, height: layout.size.height)))
self.backgroundNode.frame = CGRect(origin: .zero, size: CGSize(width: layout.size.width, height: navigationBarHeight))
- self.listNode.frame = CGRect(origin: CGPoint(x: 0.0, y: navigationBarHeight), size: CGSize(width: layout.size.width, height: layout.size.height - topInset))
- self.listNode.transaction(deleteIndices: [], insertIndicesAndItems: [], updateIndicesAndItems: [], options: [.Synchronous], scrollToItem: nil, updateSizeAndInsets: ListViewUpdateSizeAndInsets(size: layout.size, insets: UIEdgeInsets(top: 0.0, left: layout.safeInsets.left, bottom: layout.intrinsicInsets.bottom, right: layout.safeInsets.right), duration: 0.0, curve: .Default(duration: nil)), stationaryItemRange: nil, updateOpaqueState: nil, completion: { _ in })
+ self.listNode.frame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: layout.size.width, height: layout.size.height))
+ let listDuration: Double
+ let listCurve: ListViewAnimationCurve
+ switch transition {
+ case .immediate:
+ listDuration = 0.0
+ listCurve = .Default(duration: nil)
+ case let .animated(duration, curve):
+ listDuration = duration
+ if case .spring = curve {
+ listCurve = .Spring(duration: duration)
+ } else {
+ listCurve = .Default(duration: nil)
+ }
+ }
+ self.listNode.transaction(deleteIndices: [], insertIndicesAndItems: [], updateIndicesAndItems: [], options: [.Synchronous], scrollToItem: nil, updateSizeAndInsets: ListViewUpdateSizeAndInsets(size: layout.size, insets: UIEdgeInsets(top: topInset, left: layout.safeInsets.left, bottom: layout.intrinsicInsets.bottom, right: layout.safeInsets.right), duration: listDuration, curve: listCurve), stationaryItemRange: nil, updateOpaqueState: nil, completion: { _ in })
let size = layout.size
let sideInset = layout.safeInsets.left
@@ -714,7 +731,7 @@ public final class ContactsSearchContainerNode: SearchDisplayControllerContentNo
textTransition.updateFrame(node: self.emptyResultsTextNode, frame: CGRect(origin: CGPoint(x: sideInset + padding + (size.width - sideInset * 2.0 - padding * 2.0 - emptyTextSize.width) / 2.0, y: emptyAnimationY + emptyAnimationHeight + emptyAnimationSpacing + emptyTitleSize.height + emptyTextSpacing), size: emptyTextSize))
self.emptyResultsAnimationNode.updateLayout(size: self.emptyResultsAnimationSize)
- if self.glass {
+ if self.glass && !self.externalSearchBar {
let searchInputSize = self.searchInput.update(
transition: .immediate,
component: AnyComponent(
@@ -794,14 +811,14 @@ public final class ContactsSearchContainerNode: SearchDisplayControllerContentNo
strongSelf.containerLayoutUpdated(layout, navigationBarHeight: navigationBarHeight, transition: .immediate)
}
- let containerTransition = ContainedViewLayoutTransition.animated(duration: 0.3, curve: .easeInOut)
- containerTransition.updateAlpha(node: strongSelf.listNode, alpha: isSearching ? 1.0 : 0.0)
- containerTransition.updateAlpha(node: strongSelf.backgroundNode, alpha: isSearching ? 1.0 : 0.0)
+ //let containerTransition = ContainedViewLayoutTransition.animated(duration: 0.3, curve: .easeInOut)
+ ContainedViewLayoutTransition.immediate.updateAlpha(node: strongSelf.listNode, alpha: isSearching ? 1.0 : 0.0)
+ ContainedViewLayoutTransition.immediate.updateAlpha(node: strongSelf.backgroundNode, alpha: isSearching ? 1.0 : 0.0)
strongSelf.dimNode.isHidden = isSearching
- containerTransition.updateAlpha(node: strongSelf.emptyResultsAnimationNode, alpha: emptyResults ? 1.0 : 0.0)
- containerTransition.updateAlpha(node: strongSelf.emptyResultsTitleNode, alpha: emptyResults ? 1.0 : 0.0)
- containerTransition.updateAlpha(node: strongSelf.emptyResultsTextNode, alpha: emptyResults ? 1.0 : 0.0)
+ ContainedViewLayoutTransition.immediate.updateAlpha(node: strongSelf.emptyResultsAnimationNode, alpha: emptyResults ? 1.0 : 0.0)
+ ContainedViewLayoutTransition.immediate.updateAlpha(node: strongSelf.emptyResultsTitleNode, alpha: emptyResults ? 1.0 : 0.0)
+ ContainedViewLayoutTransition.immediate.updateAlpha(node: strongSelf.emptyResultsTextNode, alpha: emptyResults ? 1.0 : 0.0)
strongSelf.emptyResultsAnimationNode.visibility = emptyResults
})
}
diff --git a/submodules/ContactListUI/Sources/InviteContactsController.swift b/submodules/ContactListUI/Sources/InviteContactsController.swift
index 00c58c2d..5d42a4a0 100644
--- a/submodules/ContactListUI/Sources/InviteContactsController.swift
+++ b/submodules/ContactListUI/Sources/InviteContactsController.swift
@@ -36,8 +36,9 @@ public class InviteContactsController: ViewController, MFMessageComposeViewContr
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
- super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData))
+ super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData, style: .glass))
+ self._hasGlassStyle = true
self.navigationPresentation = .modal
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style
@@ -86,7 +87,7 @@ public class InviteContactsController: ViewController, MFMessageComposeViewContr
private func updateThemeAndStrings() {
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style
- self.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationData: self.presentationData))
+ self.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationData: self.presentationData, style: .glass), transition: .immediate)
self.searchContentNode?.updateThemeAndPlaceholder(theme: self.presentationData.theme, placeholder: self.presentationData.strings.Common_Search)
self.title = self.presentationData.strings.Contacts_InviteFriends
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Back, style: .plain, target: nil, action: nil)
diff --git a/submodules/ContactListUI/Sources/InviteContactsControllerNode.swift b/submodules/ContactListUI/Sources/InviteContactsControllerNode.swift
index 57124b8f..c75a190a 100644
--- a/submodules/ContactListUI/Sources/InviteContactsControllerNode.swift
+++ b/submodules/ContactListUI/Sources/InviteContactsControllerNode.swift
@@ -518,7 +518,7 @@ final class InviteContactsControllerNode: ASDisplayNode {
if let requestDeactivateSearch = self?.requestDeactivateSearch {
requestDeactivateSearch()
}
- })
+ }, fieldStyle: placeholderNode.fieldStyle)
self.searchDisplayController?.containerLayoutUpdated(containerLayout, navigationBarHeight: navigationBarHeight, transition: .immediate)
self.searchDisplayController?.activate(insertSubnode: { [weak self, weak placeholderNode] subnode, isSearchBar in
diff --git a/submodules/ContactListUI/Sources/LimitedPermissionItem.swift b/submodules/ContactListUI/Sources/LimitedPermissionItem.swift
index c9923da2..0af140e6 100644
--- a/submodules/ContactListUI/Sources/LimitedPermissionItem.swift
+++ b/submodules/ContactListUI/Sources/LimitedPermissionItem.swift
@@ -103,7 +103,7 @@ public class LimitedPermissionItemNode: ListViewItemNode {
self.actionButtonTitleNode = TextNode()
self.actionButtonTitleNode.isUserInteractionEnabled = false
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.textNode)
self.addSubnode(self.activateArea)
diff --git a/submodules/ContactsPeerItem/Sources/ContactsPeerItem.swift b/submodules/ContactsPeerItem/Sources/ContactsPeerItem.swift
index 3e446f63..6b9dded5 100644
--- a/submodules/ContactsPeerItem/Sources/ContactsPeerItem.swift
+++ b/submodules/ContactsPeerItem/Sources/ContactsPeerItem.swift
@@ -199,6 +199,7 @@ public class ContactsPeerItem: ItemListItem, ListViewItemWithHeader {
let searchQuery: String?
let isAd: Bool
let alwaysShowLastSeparator: Bool
+ let hideBackground: Bool
let action: ((ContactsPeerItemPeer) -> Void)?
let disabledAction: ((ContactsPeerItemPeer) -> Void)?
let setPeerIdWithRevealedOptions: ((EnginePeer.Id?, EnginePeer.Id?) -> Void)?
@@ -247,6 +248,7 @@ public class ContactsPeerItem: ItemListItem, ListViewItemWithHeader {
searchQuery: String? = nil,
isAd: Bool = false,
alwaysShowLastSeparator: Bool = false,
+ hideBackground: Bool = false,
action: ((ContactsPeerItemPeer) -> Void)?,
disabledAction: ((ContactsPeerItemPeer) -> Void)? = nil,
setPeerIdWithRevealedOptions: ((EnginePeer.Id?, EnginePeer.Id?) -> Void)? = nil,
@@ -285,6 +287,7 @@ public class ContactsPeerItem: ItemListItem, ListViewItemWithHeader {
self.searchQuery = searchQuery
self.isAd = isAd
self.alwaysShowLastSeparator = alwaysShowLastSeparator
+ self.hideBackground = hideBackground
self.action = action
self.disabledAction = disabledAction
self.setPeerIdWithRevealedOptions = setPeerIdWithRevealedOptions
@@ -584,7 +587,7 @@ public class ContactsPeerItemNode: ItemListRevealOptionsItemNode {
self.titleNode = TextNode()
self.statusNode = TextNodeWithEntities()
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.isAccessibilityElement = true
@@ -1325,9 +1328,13 @@ public class ContactsPeerItemNode: ItemListRevealOptionsItemNode {
case .plain:
strongSelf.topSeparatorNode.backgroundColor = item.presentationData.theme.list.itemPlainSeparatorColor
strongSelf.separatorNode.backgroundColor = item.presentationData.theme.list.itemPlainSeparatorColor
- strongSelf.backgroundNode.backgroundColor = item.presentationData.theme.list.plainBackgroundColor
+ if !item.hideBackground {
+ strongSelf.backgroundNode.backgroundColor = item.presentationData.theme.list.plainBackgroundColor
+ }
case .blocks:
- strongSelf.topSeparatorNode.backgroundColor = item.presentationData.theme.list.itemBlocksSeparatorColor
+ if !item.hideBackground {
+ strongSelf.topSeparatorNode.backgroundColor = item.presentationData.theme.list.itemBlocksSeparatorColor
+ }
strongSelf.separatorNode.backgroundColor = item.presentationData.theme.list.itemBlocksSeparatorColor
strongSelf.backgroundNode.backgroundColor = item.presentationData.theme.list.itemBlocksBackgroundColor
}
@@ -1857,7 +1864,8 @@ public class ContactsPeerItemNode: ItemListRevealOptionsItemNode {
strongSelf.maskNode.image = hasCorners ? PresentationResourcesItemList.cornersImage(item.presentationData.theme, top: hasTopCorners, bottom: hasBottomCorners, glass: item.systemStyle == .glass) : nil
- let topHighlightInset: CGFloat = (first || !nodeLayout.insets.top.isZero) ? 0.0 : separatorHeight
+ var topHighlightInset: CGFloat = (first || !nodeLayout.insets.top.isZero) ? 0.0 : separatorHeight
+ topHighlightInset -= nodeLayout.insets.top
strongSelf.backgroundNode.frame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: nodeLayout.contentSize.width, height: nodeLayout.contentSize.height))
strongSelf.maskNode.frame = strongSelf.backgroundNode.frame.insetBy(dx: params.leftInset, dy: 0.0)
strongSelf.highlightedBackgroundNode.frame = CGRect(origin: CGPoint(x: 0.0, y: -nodeLayout.insets.top - topHighlightInset), size: CGSize(width: nodeLayout.size.width, height: nodeLayout.size.height + topHighlightInset))
diff --git a/submodules/ContextUI/Sources/ContextControllerActionsStackNode.swift b/submodules/ContextUI/Sources/ContextControllerActionsStackNode.swift
index dbf82367..2bb3470f 100644
--- a/submodules/ContextUI/Sources/ContextControllerActionsStackNode.swift
+++ b/submodules/ContextUI/Sources/ContextControllerActionsStackNode.swift
@@ -346,6 +346,7 @@ public final class ContextControllerActionsListActionItemNode: HighlightTracking
}
let titleColor: UIColor
+ let linkColor = presentationData.theme.list.itemAccentColor
switch self.item.textColor {
case .primary:
titleColor = presentationData.theme.contextMenu.primaryColor
@@ -365,6 +366,8 @@ public final class ContextControllerActionsListActionItemNode: HighlightTracking
return ChatTextInputStateTextAttribute(type: .bold, range: entity.range)
} else if case .Italic = entity.type {
return ChatTextInputStateTextAttribute(type: .italic, range: entity.range)
+ } else if case .Url = entity.type {
+ return ChatTextInputStateTextAttribute(type: .textUrl(""), range: entity.range)
}
return nil
})
@@ -375,9 +378,12 @@ public final class ContextControllerActionsListActionItemNode: HighlightTracking
], range: NSRange(location: 0, length: result.length))
for attribute in inputStateText.attributes {
if case .bold = attribute.type {
- result.addAttribute(NSAttributedString.Key.font, value: Font.semibold(presentationData.listsFontSize.baseDisplaySize), range: NSRange(location: attribute.range.lowerBound, length: attribute.range.count))
+ result.addAttribute(NSAttributedString.Key.font, value: titleBoldFont, range: NSRange(location: attribute.range.lowerBound, length: attribute.range.count))
} else if case .italic = attribute.type {
result.addAttribute(NSAttributedString.Key.font, value: Font.semibold(15.0), range: NSRange(location: attribute.range.lowerBound, length: attribute.range.count))
+ } else if case .textUrl = attribute.type {
+ result.addAttribute(NSAttributedString.Key.foregroundColor, value: linkColor, range: NSRange(location: attribute.range.lowerBound, length: attribute.range.count))
+ result.addAttribute(NSAttributedString.Key.font, value: titleBoldFont, range: NSRange(location: attribute.range.lowerBound, length: attribute.range.count))
}
}
attributedText = result
diff --git a/submodules/CountrySelectionUI/Sources/AuthorizationSequenceCountrySelectionController.swift b/submodules/CountrySelectionUI/Sources/AuthorizationSequenceCountrySelectionController.swift
index f2dfd41c..3b3cdc1f 100644
--- a/submodules/CountrySelectionUI/Sources/AuthorizationSequenceCountrySelectionController.swift
+++ b/submodules/CountrySelectionUI/Sources/AuthorizationSequenceCountrySelectionController.swift
@@ -142,7 +142,7 @@ private final class AuthorizationSequenceCountrySelectionNavigationContentNode:
self.cancel = cancel
- self.searchBar = SearchBarNode(theme: SearchBarNodeTheme(theme: theme), strings: strings, fieldStyle: .modern)
+ self.searchBar = SearchBarNode(theme: SearchBarNodeTheme(theme: theme), presentationTheme: theme, strings: strings, fieldStyle: .modern)
let placeholderText = strings.Common_Search
let searchBarFont = Font.regular(17.0)
@@ -169,10 +169,12 @@ private final class AuthorizationSequenceCountrySelectionNavigationContentNode:
return 54.0
}
- override func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, transition: ContainedViewLayoutTransition) {
+ override func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, transition: ContainedViewLayoutTransition) -> CGSize {
let searchBarFrame = CGRect(origin: CGPoint(x: 0.0, y: size.height - self.nominalHeight), size: CGSize(width: size.width, height: 54.0))
self.searchBar.frame = searchBarFrame
self.searchBar.updateLayout(boundingSize: searchBarFrame.size, leftInset: leftInset, rightInset: rightInset, transition: transition)
+
+ return size
}
func activate() {
@@ -332,7 +334,7 @@ public final class AuthorizationSequenceCountrySelectionController: ViewControll
self.displayCodes = displayCodes
self.glass = glass
- super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: NavigationBarTheme(rootControllerTheme: theme, hideBackground: glass, hideSeparator: glass), strings: NavigationBarStrings(presentationStrings: strings)))
+ super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: NavigationBarTheme(rootControllerTheme: theme, hideBackground: glass, hideSeparator: glass, style: glass ? .glass : .legacy), strings: NavigationBarStrings(presentationStrings: strings)))
self._hasGlassStyle = glass
@@ -392,13 +394,13 @@ public final class AuthorizationSequenceCountrySelectionController: ViewControll
id: "close",
component: AnyComponent(GlassBarButtonComponent(
size: barButtonSize,
- backgroundColor: self.theme.rootController.navigationBar.glassBarButtonBackgroundColor,
+ backgroundColor: nil,
isDark: self.theme.overallDarkAppearance,
- state: .generic,
+ state: .glass,
component: AnyComponentWithIdentity(id: "close", component: AnyComponent(
BundleIconComponent(
name: "Navigation/Close",
- tintColor: self.theme.rootController.navigationBar.glassBarButtonForegroundColor
+ tintColor: self.theme.chat.inputPanel.panelControlColor
)
)),
action: { [weak self] _ in
@@ -413,13 +415,13 @@ public final class AuthorizationSequenceCountrySelectionController: ViewControll
id: "search",
component: AnyComponent(GlassBarButtonComponent(
size: barButtonSize,
- backgroundColor: self.theme.rootController.navigationBar.glassBarButtonBackgroundColor,
+ backgroundColor: nil,
isDark: self.theme.overallDarkAppearance,
- state: .generic,
+ state: .glass,
component: AnyComponentWithIdentity(id: "search", component: AnyComponent(
BundleIconComponent(
name: "Navigation/Search",
- tintColor: self.theme.rootController.navigationBar.glassBarButtonForegroundColor
+ tintColor: self.theme.chat.inputPanel.panelControlColor
)
)),
action: { [weak self] _ in
@@ -441,15 +443,17 @@ public final class AuthorizationSequenceCountrySelectionController: ViewControll
self.closeButtonNode = closeButtonNode
self.navigationItem.leftBarButtonItem = UIBarButtonItem(customDisplayNode: closeButtonNode)
}
-
- let searchButtonNode: BarComponentHostNode
- if let current = self.searchButtonNode {
- searchButtonNode = current
- searchButtonNode.component = searchComponent
- } else {
- searchButtonNode = BarComponentHostNode(component: searchComponent, size: barButtonSize)
- self.searchButtonNode = searchButtonNode
- self.navigationItem.rightBarButtonItem = UIBarButtonItem(customDisplayNode: searchButtonNode)
+
+ if !self.glass {
+ let searchButtonNode: BarComponentHostNode
+ if let current = self.searchButtonNode {
+ searchButtonNode = current
+ searchButtonNode.component = searchComponent
+ } else {
+ searchButtonNode = BarComponentHostNode(component: searchComponent, size: barButtonSize)
+ self.searchButtonNode = searchButtonNode
+ self.navigationItem.rightBarButtonItem = UIBarButtonItem(customDisplayNode: searchButtonNode)
+ }
}
}
diff --git a/submodules/Display/Source/ImmediateTextNode.swift b/submodules/Display/Source/ImmediateTextNode.swift
index 8851e6c2..61a6d4e2 100644
--- a/submodules/Display/Source/ImmediateTextNode.swift
+++ b/submodules/Display/Source/ImmediateTextNode.swift
@@ -13,7 +13,7 @@ public struct ImmediateTextNodeLayoutInfo {
}
}
-public class ImmediateTextNode: TextNode {
+open class ImmediateTextNode: TextNode {
public var attributedText: NSAttributedString?
public var textAlignment: NSTextAlignment = .natural
public var verticalAlignment: TextVerticalAlignment = .top
@@ -60,7 +60,7 @@ public class ImmediateTextNode: TextNode {
public var trailingLineWidth: CGFloat?
- var constrainedSize: CGSize?
+ public var constrainedSize: CGSize?
public var highlightAttributeAction: (([NSAttributedString.Key: Any]) -> NSAttributedString.Key?)? {
didSet {
@@ -94,7 +94,7 @@ public class ImmediateTextNode: TextNode {
return node
}
- public func updateLayout(_ constrainedSize: CGSize) -> CGSize {
+ open func updateLayout(_ constrainedSize: CGSize) -> CGSize {
self.constrainedSize = constrainedSize
let makeLayout = TextNode.asyncLayout(self)
diff --git a/submodules/Display/Source/KeyShortcutsController.swift b/submodules/Display/Source/KeyShortcutsController.swift
index c8156afb..e8afab89 100644
--- a/submodules/Display/Source/KeyShortcutsController.swift
+++ b/submodules/Display/Source/KeyShortcutsController.swift
@@ -9,11 +9,7 @@ public class KeyShortcutsController: UIResponder {
private var viewControllerEnumerator: (@escaping (ContainableController) -> Bool) -> Void
public static var isAvailable: Bool {
- if #available(iOSApplicationExtension 8.0, iOS 8.0, *), UIDevice.current.userInterfaceIdiom == .pad {
- return true
- } else {
- return false
- }
+ return true
}
public init(enumerator: @escaping (@escaping (ContainableController) -> Bool) -> Void) {
diff --git a/submodules/Display/Source/LinkHighlightingNode.swift b/submodules/Display/Source/LinkHighlightingNode.swift
index 22e128e0..99fa88c0 100644
--- a/submodules/Display/Source/LinkHighlightingNode.swift
+++ b/submodules/Display/Source/LinkHighlightingNode.swift
@@ -30,6 +30,232 @@ private func drawFullCorner(context: CGContext, color: UIColor, at point: CGPoin
}
}
+private func drawRectsImageContent(size: CGSize, context: CGContext, color: UIColor, rects: [CGRect], inset: CGFloat, outerRadius: CGFloat, innerRadius: CGFloat, stroke: Bool, strokeWidth: CGFloat, useModernPathCalculation: Bool, topLeft: CGPoint) {
+ context.clear(CGRect(origin: CGPoint(), size: size))
+ context.setFillColor(color.cgColor)
+
+ context.setBlendMode(.copy)
+
+ if useModernPathCalculation {
+ if rects.count == 1 {
+ let path = UIBezierPath(roundedRect: rects[0].offsetBy(dx: -topLeft.x, dy: -topLeft.y), cornerRadius: outerRadius).cgPath
+ context.addPath(path)
+
+ if stroke {
+ context.setStrokeColor(color.cgColor)
+ context.setLineWidth(strokeWidth)
+ context.strokePath()
+ } else {
+ context.fillPath()
+ }
+ return
+ }
+
+ var combinedRects: [[CGRect]] = []
+ var currentRects: [CGRect] = []
+ for rect in rects {
+ if rect.width.isZero {
+ if !currentRects.isEmpty {
+ combinedRects.append(currentRects)
+ }
+ currentRects.removeAll()
+ } else {
+ currentRects.append(rect)
+ }
+ }
+ if !currentRects.isEmpty {
+ combinedRects.append(currentRects)
+ }
+
+ for rects in combinedRects {
+ var rects = rects.map { $0.insetBy(dx: -inset, dy: -inset).offsetBy(dx: -topLeft.x, dy: -topLeft.y) }
+
+ let minRadius: CGFloat = 2.0
+
+ for _ in 0 ..< rects.count * rects.count {
+ var hadChanges = false
+ for i in 0 ..< rects.count - 1 {
+ if rects[i].maxY > rects[i + 1].minY {
+ let midY = floor((rects[i].maxY + rects[i + 1].minY) * 0.5)
+ rects[i].size.height = midY - rects[i].minY
+ rects[i + 1].origin.y = midY
+ rects[i + 1].size.height = rects[i + 1].maxY - midY
+ hadChanges = true
+ }
+ if rects[i].maxY >= rects[i + 1].minY && rects[i].insetBy(dx: 0.0, dy: 1.0).intersects(rects[i + 1]) {
+ if abs(rects[i].minX - rects[i + 1].minX) < minRadius {
+ let commonMinX = min(rects[i].origin.x, rects[i + 1].origin.x)
+ if rects[i].origin.x != commonMinX {
+ rects[i].origin.x = commonMinX
+ hadChanges = true
+ }
+ if rects[i + 1].origin.x != commonMinX {
+ rects[i + 1].origin.x = commonMinX
+ hadChanges = true
+ }
+ }
+ if abs(rects[i].maxX - rects[i + 1].maxX) < minRadius {
+ let commonMaxX = max(rects[i].maxX, rects[i + 1].maxX)
+ if rects[i].maxX != commonMaxX {
+ rects[i].size.width = commonMaxX - rects[i].minX
+ hadChanges = true
+ }
+ if rects[i + 1].maxX != commonMaxX {
+ rects[i + 1].size.width = commonMaxX - rects[i + 1].minX
+ hadChanges = true
+ }
+ }
+ }
+ }
+ if !hadChanges {
+ break
+ }
+ }
+
+ context.move(to: CGPoint(x: rects[0].midX, y: rects[0].minY))
+ context.addLine(to: CGPoint(x: rects[0].maxX - outerRadius, y: rects[0].minY))
+ context.addArc(tangent1End: rects[0].topRight, tangent2End: CGPoint(x: rects[0].maxX, y: rects[0].minY + outerRadius), radius: outerRadius)
+ context.addLine(to: CGPoint(x: rects[0].maxX, y: rects[0].midY))
+
+ for i in 0 ..< rects.count - 1 {
+ let rect = rects[i]
+ let next = rects[i + 1]
+
+ if rect.maxX == next.maxX {
+ context.addLine(to: CGPoint(x: next.maxX, y: next.midY))
+ } else {
+ let nextRadius = min(outerRadius, floor(abs(rect.maxX - next.maxX) * 0.5))
+ context.addLine(to: CGPoint(x: rect.maxX, y: rect.maxY - nextRadius))
+ if next.maxX > rect.maxX {
+ context.addArc(tangent1End: CGPoint(x: rect.maxX, y: rect.maxY), tangent2End: CGPoint(x: rect.maxX + nextRadius, y: rect.maxY), radius: nextRadius)
+ context.addLine(to: CGPoint(x: next.maxX - nextRadius, y: next.minY))
+ } else {
+ context.addArc(tangent1End: CGPoint(x: rect.maxX, y: rect.maxY), tangent2End: CGPoint(x: rect.maxX - nextRadius, y: rect.maxY), radius: nextRadius)
+ context.addLine(to: CGPoint(x: next.maxX + nextRadius, y: next.minY))
+ }
+ context.addArc(tangent1End: next.topRight, tangent2End: CGPoint(x: next.maxX, y: next.minY + nextRadius), radius: nextRadius)
+ context.addLine(to: CGPoint(x: next.maxX, y: next.midY))
+ }
+ }
+
+ let last = rects[rects.count - 1]
+ context.addLine(to: CGPoint(x: last.maxX, y: last.maxY - outerRadius))
+ context.addArc(tangent1End: last.bottomRight, tangent2End: CGPoint(x: last.maxX - outerRadius, y: last.maxY), radius: outerRadius)
+ context.addLine(to: CGPoint(x: last.minX + outerRadius, y: last.maxY))
+ context.addArc(tangent1End: last.bottomLeft, tangent2End: CGPoint(x: last.minX, y: last.maxY - outerRadius), radius: outerRadius)
+
+ for i in (1 ..< rects.count).reversed() {
+ let rect = rects[i]
+ let prev = rects[i - 1]
+
+ if rect.minX == prev.minX {
+ context.addLine(to: CGPoint(x: prev.minX, y: prev.midY))
+ } else {
+ let prevRadius = min(outerRadius, floor(abs(rect.minX - prev.minX) * 0.5))
+ context.addLine(to: CGPoint(x: rect.minX, y: rect.minY + prevRadius))
+ if rect.minX < prev.minX {
+ context.addArc(tangent1End: CGPoint(x: rect.minX, y: rect.minY), tangent2End: CGPoint(x: rect.minX + prevRadius, y: rect.minY), radius: prevRadius)
+ context.addLine(to: CGPoint(x: prev.minX - prevRadius, y: prev.maxY))
+ } else {
+ context.addArc(tangent1End: CGPoint(x: rect.minX, y: rect.minY), tangent2End: CGPoint(x: rect.minX - prevRadius, y: rect.minY), radius: prevRadius)
+ context.addLine(to: CGPoint(x: prev.minX + prevRadius, y: prev.maxY))
+ }
+ context.addArc(tangent1End: prev.bottomLeft, tangent2End: CGPoint(x: prev.minX, y: prev.maxY - prevRadius), radius: prevRadius)
+ context.addLine(to: CGPoint(x: prev.minX, y: prev.midY))
+ }
+ }
+
+ context.addLine(to: CGPoint(x: rects[0].minX, y: rects[0].minY + outerRadius))
+ context.addArc(tangent1End: rects[0].topLeft, tangent2End: CGPoint(x: rects[0].minX + outerRadius, y: rects[0].minY), radius: outerRadius)
+ context.addLine(to: CGPoint(x: rects[0].midX, y: rects[0].minY))
+
+ if stroke {
+ context.setStrokeColor(color.cgColor)
+ context.setLineWidth(strokeWidth)
+ context.strokePath()
+ } else {
+ context.fillPath()
+ }
+ }
+ return
+ }
+
+ for i in 0 ..< rects.count {
+ let rect = rects[i].insetBy(dx: -inset, dy: -inset)
+ context.fill(rect.offsetBy(dx: -topLeft.x, dy: -topLeft.y))
+ }
+
+ for i in 0 ..< rects.count {
+ let rect = rects[i].insetBy(dx: -inset, dy: -inset).offsetBy(dx: -topLeft.x, dy: -topLeft.y)
+
+ var previous: CGRect?
+ if i != 0 {
+ previous = rects[i - 1].insetBy(dx: -inset, dy: -inset).offsetBy(dx: -topLeft.x, dy: -topLeft.y)
+ }
+
+ var next: CGRect?
+ if i != rects.count - 1 {
+ next = rects[i + 1].insetBy(dx: -inset, dy: -inset).offsetBy(dx: -topLeft.x, dy: -topLeft.y)
+ }
+
+ if let previous = previous {
+ if previous.contains(rect.topLeft) {
+ if abs(rect.topLeft.x - previous.minX) >= innerRadius {
+ var radius = innerRadius
+ if let next = next {
+ radius = min(radius, floor((next.minY - previous.maxY) / 2.0))
+ }
+ drawConnectingCorner(context: context, color: color, at: CGPoint(x: rect.topLeft.x, y: previous.maxY), type: .topLeft, radius: radius)
+ }
+ } else {
+ drawFullCorner(context: context, color: color, at: rect.topLeft, type: .topLeft, radius: outerRadius)
+ }
+ if previous.contains(rect.topRight.offsetBy(dx: -1.0, dy: 0.0)) {
+ if abs(rect.topRight.x - previous.maxX) >= innerRadius {
+ var radius = innerRadius
+ if let next = next {
+ radius = min(radius, floor((next.minY - previous.maxY) / 2.0))
+ }
+ drawConnectingCorner(context: context, color: color, at: CGPoint(x: rect.topRight.x, y: previous.maxY), type: .topRight, radius: radius)
+ }
+ } else {
+ drawFullCorner(context: context, color: color, at: rect.topRight, type: .topRight, radius: outerRadius)
+ }
+ } else {
+ drawFullCorner(context: context, color: color, at: rect.topLeft, type: .topLeft, radius: outerRadius)
+ drawFullCorner(context: context, color: color, at: rect.topRight, type: .topRight, radius: outerRadius)
+ }
+
+ if let next = next {
+ if next.contains(rect.bottomLeft) {
+ if abs(rect.bottomRight.x - next.maxX) >= innerRadius {
+ var radius = innerRadius
+ if let previous = previous {
+ radius = min(radius, floor((next.minY - previous.maxY) / 2.0))
+ }
+ drawConnectingCorner(context: context, color: color, at: CGPoint(x: rect.bottomLeft.x, y: next.minY), type: .bottomLeft, radius: radius)
+ }
+ } else {
+ drawFullCorner(context: context, color: color, at: rect.bottomLeft, type: .bottomLeft, radius: outerRadius)
+ }
+ if next.contains(rect.bottomRight.offsetBy(dx: -1.0, dy: 0.0)) {
+ if abs(rect.bottomRight.x - next.maxX) >= innerRadius {
+ var radius = innerRadius
+ if let previous = previous {
+ radius = min(radius, floor((next.minY - previous.maxY) / 2.0))
+ }
+ drawConnectingCorner(context: context, color: color, at: CGPoint(x: rect.bottomRight.x, y: next.minY), type: .bottomRight, radius: radius)
+ }
+ } else {
+ drawFullCorner(context: context, color: color, at: rect.bottomRight, type: .bottomRight, radius: outerRadius)
+ }
+ } else {
+ drawFullCorner(context: context, color: color, at: rect.bottomLeft, type: .bottomLeft, radius: outerRadius)
+ drawFullCorner(context: context, color: color, at: rect.bottomRight, type: .bottomRight, radius: outerRadius)
+ }
+ }
+}
+
private func drawConnectingCorner(context: CGContext, color: UIColor, at point: CGPoint, type: CornerType, radius: CGFloat) {
context.setFillColor(color.cgColor)
switch type {
@@ -76,230 +302,9 @@ public func generateRectsImage(color: UIColor, rects: [CGRect], inset: CGFloat,
bottomRight.x += drawingInset * 2.0
bottomRight.y += drawingInset * 2.0
+ let capturedTopLeft = topLeft
return (topLeft, generateImage(CGSize(width: bottomRight.x - topLeft.x, height: bottomRight.y - topLeft.y), rotatedContext: { size, context in
- context.clear(CGRect(origin: CGPoint(), size: size))
- context.setFillColor(color.cgColor)
-
- context.setBlendMode(.copy)
-
- if useModernPathCalculation {
- if rects.count == 1 {
- let path = UIBezierPath(roundedRect: rects[0].offsetBy(dx: -topLeft.x, dy: -topLeft.y), cornerRadius: outerRadius).cgPath
- context.addPath(path)
-
- if stroke {
- context.setStrokeColor(color.cgColor)
- context.setLineWidth(strokeWidth)
- context.strokePath()
- } else {
- context.fillPath()
- }
- return
- }
-
- var combinedRects: [[CGRect]] = []
- var currentRects: [CGRect] = []
- for rect in rects {
- if rect.width.isZero {
- if !currentRects.isEmpty {
- combinedRects.append(currentRects)
- }
- currentRects.removeAll()
- } else {
- currentRects.append(rect)
- }
- }
- if !currentRects.isEmpty {
- combinedRects.append(currentRects)
- }
-
- for rects in combinedRects {
- var rects = rects.map { $0.insetBy(dx: -inset, dy: -inset).offsetBy(dx: -topLeft.x, dy: -topLeft.y) }
-
- let minRadius: CGFloat = 2.0
-
- for _ in 0 ..< rects.count * rects.count {
- var hadChanges = false
- for i in 0 ..< rects.count - 1 {
- if rects[i].maxY > rects[i + 1].minY {
- let midY = floor((rects[i].maxY + rects[i + 1].minY) * 0.5)
- rects[i].size.height = midY - rects[i].minY
- rects[i + 1].origin.y = midY
- rects[i + 1].size.height = rects[i + 1].maxY - midY
- hadChanges = true
- }
- if rects[i].maxY >= rects[i + 1].minY && rects[i].insetBy(dx: 0.0, dy: 1.0).intersects(rects[i + 1]) {
- if abs(rects[i].minX - rects[i + 1].minX) < minRadius {
- let commonMinX = min(rects[i].origin.x, rects[i + 1].origin.x)
- if rects[i].origin.x != commonMinX {
- rects[i].origin.x = commonMinX
- hadChanges = true
- }
- if rects[i + 1].origin.x != commonMinX {
- rects[i + 1].origin.x = commonMinX
- hadChanges = true
- }
- }
- if abs(rects[i].maxX - rects[i + 1].maxX) < minRadius {
- let commonMaxX = max(rects[i].maxX, rects[i + 1].maxX)
- if rects[i].maxX != commonMaxX {
- rects[i].size.width = commonMaxX - rects[i].minX
- hadChanges = true
- }
- if rects[i + 1].maxX != commonMaxX {
- rects[i + 1].size.width = commonMaxX - rects[i + 1].minX
- hadChanges = true
- }
- }
- }
- }
- if !hadChanges {
- break
- }
- }
-
- context.move(to: CGPoint(x: rects[0].midX, y: rects[0].minY))
- context.addLine(to: CGPoint(x: rects[0].maxX - outerRadius, y: rects[0].minY))
- context.addArc(tangent1End: rects[0].topRight, tangent2End: CGPoint(x: rects[0].maxX, y: rects[0].minY + outerRadius), radius: outerRadius)
- context.addLine(to: CGPoint(x: rects[0].maxX, y: rects[0].midY))
-
- for i in 0 ..< rects.count - 1 {
- let rect = rects[i]
- let next = rects[i + 1]
-
- if rect.maxX == next.maxX {
- context.addLine(to: CGPoint(x: next.maxX, y: next.midY))
- } else {
- let nextRadius = min(outerRadius, floor(abs(rect.maxX - next.maxX) * 0.5))
- context.addLine(to: CGPoint(x: rect.maxX, y: rect.maxY - nextRadius))
- if next.maxX > rect.maxX {
- context.addArc(tangent1End: CGPoint(x: rect.maxX, y: rect.maxY), tangent2End: CGPoint(x: rect.maxX + nextRadius, y: rect.maxY), radius: nextRadius)
- context.addLine(to: CGPoint(x: next.maxX - nextRadius, y: next.minY))
- } else {
- context.addArc(tangent1End: CGPoint(x: rect.maxX, y: rect.maxY), tangent2End: CGPoint(x: rect.maxX - nextRadius, y: rect.maxY), radius: nextRadius)
- context.addLine(to: CGPoint(x: next.maxX + nextRadius, y: next.minY))
- }
- context.addArc(tangent1End: next.topRight, tangent2End: CGPoint(x: next.maxX, y: next.minY + nextRadius), radius: nextRadius)
- context.addLine(to: CGPoint(x: next.maxX, y: next.midY))
- }
- }
-
- let last = rects[rects.count - 1]
- context.addLine(to: CGPoint(x: last.maxX, y: last.maxY - outerRadius))
- context.addArc(tangent1End: last.bottomRight, tangent2End: CGPoint(x: last.maxX - outerRadius, y: last.maxY), radius: outerRadius)
- context.addLine(to: CGPoint(x: last.minX + outerRadius, y: last.maxY))
- context.addArc(tangent1End: last.bottomLeft, tangent2End: CGPoint(x: last.minX, y: last.maxY - outerRadius), radius: outerRadius)
-
- for i in (1 ..< rects.count).reversed() {
- let rect = rects[i]
- let prev = rects[i - 1]
-
- if rect.minX == prev.minX {
- context.addLine(to: CGPoint(x: prev.minX, y: prev.midY))
- } else {
- let prevRadius = min(outerRadius, floor(abs(rect.minX - prev.minX) * 0.5))
- context.addLine(to: CGPoint(x: rect.minX, y: rect.minY + prevRadius))
- if rect.minX < prev.minX {
- context.addArc(tangent1End: CGPoint(x: rect.minX, y: rect.minY), tangent2End: CGPoint(x: rect.minX + prevRadius, y: rect.minY), radius: prevRadius)
- context.addLine(to: CGPoint(x: prev.minX - prevRadius, y: prev.maxY))
- } else {
- context.addArc(tangent1End: CGPoint(x: rect.minX, y: rect.minY), tangent2End: CGPoint(x: rect.minX - prevRadius, y: rect.minY), radius: prevRadius)
- context.addLine(to: CGPoint(x: prev.minX + prevRadius, y: prev.maxY))
- }
- context.addArc(tangent1End: prev.bottomLeft, tangent2End: CGPoint(x: prev.minX, y: prev.maxY - prevRadius), radius: prevRadius)
- context.addLine(to: CGPoint(x: prev.minX, y: prev.midY))
- }
- }
-
- context.addLine(to: CGPoint(x: rects[0].minX, y: rects[0].minY + outerRadius))
- context.addArc(tangent1End: rects[0].topLeft, tangent2End: CGPoint(x: rects[0].minX + outerRadius, y: rects[0].minY), radius: outerRadius)
- context.addLine(to: CGPoint(x: rects[0].midX, y: rects[0].minY))
-
- if stroke {
- context.setStrokeColor(color.cgColor)
- context.setLineWidth(strokeWidth)
- context.strokePath()
- } else {
- context.fillPath()
- }
- }
- return
- }
-
- for i in 0 ..< rects.count {
- let rect = rects[i].insetBy(dx: -inset, dy: -inset)
- context.fill(rect.offsetBy(dx: -topLeft.x, dy: -topLeft.y))
- }
-
- for i in 0 ..< rects.count {
- let rect = rects[i].insetBy(dx: -inset, dy: -inset).offsetBy(dx: -topLeft.x, dy: -topLeft.y)
-
- var previous: CGRect?
- if i != 0 {
- previous = rects[i - 1].insetBy(dx: -inset, dy: -inset).offsetBy(dx: -topLeft.x, dy: -topLeft.y)
- }
-
- var next: CGRect?
- if i != rects.count - 1 {
- next = rects[i + 1].insetBy(dx: -inset, dy: -inset).offsetBy(dx: -topLeft.x, dy: -topLeft.y)
- }
-
- if let previous = previous {
- if previous.contains(rect.topLeft) {
- if abs(rect.topLeft.x - previous.minX) >= innerRadius {
- var radius = innerRadius
- if let next = next {
- radius = min(radius, floor((next.minY - previous.maxY) / 2.0))
- }
- drawConnectingCorner(context: context, color: color, at: CGPoint(x: rect.topLeft.x, y: previous.maxY), type: .topLeft, radius: radius)
- }
- } else {
- drawFullCorner(context: context, color: color, at: rect.topLeft, type: .topLeft, radius: outerRadius)
- }
- if previous.contains(rect.topRight.offsetBy(dx: -1.0, dy: 0.0)) {
- if abs(rect.topRight.x - previous.maxX) >= innerRadius {
- var radius = innerRadius
- if let next = next {
- radius = min(radius, floor((next.minY - previous.maxY) / 2.0))
- }
- drawConnectingCorner(context: context, color: color, at: CGPoint(x: rect.topRight.x, y: previous.maxY), type: .topRight, radius: radius)
- }
- } else {
- drawFullCorner(context: context, color: color, at: rect.topRight, type: .topRight, radius: outerRadius)
- }
- } else {
- drawFullCorner(context: context, color: color, at: rect.topLeft, type: .topLeft, radius: outerRadius)
- drawFullCorner(context: context, color: color, at: rect.topRight, type: .topRight, radius: outerRadius)
- }
-
- if let next = next {
- if next.contains(rect.bottomLeft) {
- if abs(rect.bottomRight.x - next.maxX) >= innerRadius {
- var radius = innerRadius
- if let previous = previous {
- radius = min(radius, floor((next.minY - previous.maxY) / 2.0))
- }
- drawConnectingCorner(context: context, color: color, at: CGPoint(x: rect.bottomLeft.x, y: next.minY), type: .bottomLeft, radius: radius)
- }
- } else {
- drawFullCorner(context: context, color: color, at: rect.bottomLeft, type: .bottomLeft, radius: outerRadius)
- }
- if next.contains(rect.bottomRight.offsetBy(dx: -1.0, dy: 0.0)) {
- if abs(rect.bottomRight.x - next.maxX) >= innerRadius {
- var radius = innerRadius
- if let previous = previous {
- radius = min(radius, floor((next.minY - previous.maxY) / 2.0))
- }
- drawConnectingCorner(context: context, color: color, at: CGPoint(x: rect.bottomRight.x, y: next.minY), type: .bottomRight, radius: radius)
- }
- } else {
- drawFullCorner(context: context, color: color, at: rect.bottomRight, type: .bottomRight, radius: outerRadius)
- }
- } else {
- drawFullCorner(context: context, color: color, at: rect.bottomLeft, type: .bottomLeft, radius: outerRadius)
- drawFullCorner(context: context, color: color, at: rect.bottomRight, type: .bottomRight, radius: outerRadius)
- }
- }
+ drawRectsImageContent(size: size, context: context, color: color, rects: rects, inset: inset, outerRadius: outerRadius, innerRadius: innerRadius, stroke: stroke, strokeWidth: strokeWidth, useModernPathCalculation: useModernPathCalculation, topLeft: capturedTopLeft)
}))
}
diff --git a/submodules/Display/Source/ListView.swift b/submodules/Display/Source/ListView.swift
index bf3f593a..a1ab459d 100644
--- a/submodules/Display/Source/ListView.swift
+++ b/submodules/Display/Source/ListView.swift
@@ -210,7 +210,6 @@ open class ListView: ASDisplayNode, ASScrollViewDelegate, ASGestureRecognizerDel
private final var displayLink: CADisplayLink!
private final var needsAnimations = false
- public final var dynamicBounceEnabled = true
public final var rotated = false
public final var experimentalSnapScrollToItem = false
public final var useMainQueueTransactions = false
@@ -265,6 +264,9 @@ open class ListView: ASDisplayNode, ASScrollViewDelegate, ASGestureRecognizerDel
public final var addContentOffset: ((CGFloat, ListViewItemNode?) -> Void)?
public final var shouldStopScrolling: ((CGFloat) -> Bool)?
public final var onContentsUpdated: ((ContainedViewLayoutTransition) -> Void)?
+
+ public private(set) final var edgeEffectExtension: CGFloat = 0.0
+ public final var onEdgeEffectExtensionUpdated: ((ContainedViewLayoutTransition) -> Void)?
public final var updateScrollingIndicator: ((ScrollingIndicatorState?, ContainedViewLayoutTransition) -> Void)?
@@ -1044,41 +1046,10 @@ open class ListView: ASDisplayNode, ASScrollViewDelegate, ASGestureRecognizerDel
self.enqueueUpdateVisibleItems(synchronous: false)
}
- var useScrollDynamics = false
-
- let anchor: CGFloat
- if self.isTracking {
- anchor = self.touchesPosition.y
- } else if deltaY < 0.0 {
- anchor = self.visibleSize.height
- } else {
- anchor = 0.0
- }
-
self.didScrollWithOffset?(deltaY, .immediate, nil, self.isTrackingOrDecelerating)
for itemNode in self.itemNodes {
itemNode.updateFrame(itemNode.frame.offsetBy(dx: 0.0, dy: -deltaY), within: self.visibleSize)
-
- if self.dynamicBounceEnabled && itemNode.wantsScrollDynamics {
- useScrollDynamics = true
-
- var distance: CGFloat
- let itemFrame = itemNode.apparentFrame
- if anchor < itemFrame.origin.y {
- distance = abs(itemFrame.origin.y - anchor)
- } else if anchor > itemFrame.origin.y + itemFrame.size.height {
- distance = abs(anchor - (itemFrame.origin.y + itemFrame.size.height))
- } else {
- distance = 0.0
- }
-
- let factor: CGFloat = max(0.08, abs(distance) / self.visibleSize.height)
-
- let resistance: CGFloat = testSpringFreeResistance
-
- itemNode.addScrollingOffset(deltaY * factor * resistance)
- }
}
if !self.snapToBounds(snapTopItem: false, stackFromBottom: self.stackFromBottom, insetDeltaOffsetFix: 0.0).offset.isZero {
@@ -1088,38 +1059,10 @@ open class ListView: ASDisplayNode, ASScrollViewDelegate, ASGestureRecognizerDel
self.updateItemHeaders(leftInset: self.insets.left, rightInset: self.insets.right, synchronousLoad: false)
- for (_, headerNode) in self.itemHeaderNodes {
- if self.dynamicBounceEnabled && headerNode.wantsScrollDynamics {
- useScrollDynamics = true
-
- var distance: CGFloat
- let itemFrame = headerNode.frame
- if anchor < itemFrame.origin.y {
- distance = abs(itemFrame.origin.y - anchor)
- } else if anchor > itemFrame.origin.y + itemFrame.size.height {
- distance = abs(anchor - (itemFrame.origin.y + itemFrame.size.height))
- } else {
- distance = 0.0
- }
-
- let factor: CGFloat = max(0.08, abs(distance) / self.visibleSize.height)
-
- let resistance: CGFloat = testSpringFreeResistance
-
- headerNode.addScrollingOffset(deltaY * factor * resistance)
- }
- }
-
- if useScrollDynamics {
- self.setNeedsAnimations()
- }
-
self.updateVisibleContentOffset()
self.updateVisibleItemRange()
self.updateItemNodesVisibilities(onlyPositive: false)
self.onContentsUpdated?(.immediate)
-
- //CATransaction.commit()
}
private func calculateAdditionalTopInverseInset() -> CGFloat {
@@ -3914,6 +3857,8 @@ open class ListView: ASDisplayNode, ASScrollViewDelegate, ASGestureRecognizerDel
let flashing = self.headerItemsAreFlashing()
+ var maxEdgeEffectExtension: CGFloat = 0.0
+
func addHeader(id: VisibleHeaderNodeId, upperBound: CGFloat, upperIndex: Int, upperBoundEdge: CGFloat, lowerBound: CGFloat, lowerIndex: Int, item: ListViewItemHeader, hasValidNodes: Bool) {
let itemHeaderHeight: CGFloat = item.height
@@ -3928,7 +3873,11 @@ open class ListView: ASDisplayNode, ASScrollViewDelegate, ASGestureRecognizerDel
switch item.stickDirection {
case .top:
naturalY = lowerBound
- headerFrame = CGRect(origin: CGPoint(x: 0.0, y: min(max(upperDisplayBound, upperBound), lowerBound - itemHeaderHeight)), size: CGSize(width: self.visibleSize.width, height: itemHeaderHeight))
+ if item.isSticky {
+ headerFrame = CGRect(origin: CGPoint(x: 0.0, y: min(max(upperDisplayBound, upperBound), lowerBound - itemHeaderHeight)), size: CGSize(width: self.visibleSize.width, height: itemHeaderHeight))
+ } else {
+ headerFrame = CGRect(origin: CGPoint(x: 0.0, y: min(upperBound, lowerBound - itemHeaderHeight)), size: CGSize(width: self.visibleSize.width, height: itemHeaderHeight))
+ }
stickLocationDistance = headerFrame.minY - upperBound
stickLocationDistanceFactor = max(0.0, min(1.0, stickLocationDistance / itemHeaderHeight))
case .topEdge:
@@ -4096,6 +4045,11 @@ open class ListView: ASDisplayNode, ASScrollViewDelegate, ASGestureRecognizerDel
}
headerNode.updateStickDistanceFactor(stickLocationDistanceFactor, distance: stickLocationDistance, transition: .immediate)
}
+
+ if headerNode.contributesToEdgeEffect && stickLocationDistance > 0.0 {
+ maxEdgeEffectExtension = max(maxEdgeEffectExtension, upperDisplayBound + headerFrame.height + 8.0)
+ }
+
headerNode.offsetByHeaderNodeId = offsetByHeaderNodeId
headerNode.naturalOriginY = naturalY
var maxIntersectionHeight: (CGFloat, Int)?
@@ -4228,6 +4182,11 @@ open class ListView: ASDisplayNode, ASScrollViewDelegate, ASGestureRecognizerDel
}
}
}
+
+ if self.edgeEffectExtension != maxEdgeEffectExtension {
+ self.edgeEffectExtension = maxEdgeEffectExtension
+ self.onEdgeEffectExtensionUpdated?(transition.0)
+ }
}
private func updateItemNodesVisibilities(onlyPositive: Bool) {
diff --git a/submodules/Display/Source/ListViewItemHeader.swift b/submodules/Display/Source/ListViewItemHeader.swift
index 98a43c73..92bb2f08 100644
--- a/submodules/Display/Source/ListViewItemHeader.swift
+++ b/submodules/Display/Source/ListViewItemHeader.swift
@@ -12,6 +12,7 @@ public protocol ListViewItemHeader: AnyObject {
var id: ListViewItemNode.HeaderId { get }
var stackingId: ListViewItemNode.HeaderId? { get }
var stickDirection: ListViewItemHeaderStickDirection { get }
+ var isSticky: Bool { get }
var height: CGFloat { get }
var stickOverInsets: Bool { get }
@@ -21,14 +22,19 @@ public protocol ListViewItemHeader: AnyObject {
func updateNode(_ node: ListViewItemHeaderNode, previous: ListViewItemHeader?, next: ListViewItemHeader?)
}
+public extension ListViewItemHeader {
+ var isSticky: Bool {
+ return true
+ }
+}
+
open class ListViewItemHeaderNode: ASDisplayNode {
- private final var spring: ListViewItemSpring?
- let wantsScrollDynamics: Bool
let isRotated: Bool
final private(set) var internalStickLocationDistanceFactor: CGFloat = 0.0
final var internalStickLocationDistance: CGFloat = 0.0
private var isFlashingOnScrolling = false
weak var attachedToItemNode: ListViewItemNode?
+ public var contributesToEdgeEffect: Bool = false
var offsetByHeaderNodeId: ListViewItemNode.HeaderId?
var naturalOriginY: CGFloat?
@@ -53,12 +59,8 @@ open class ListViewItemHeaderNode: ASDisplayNode {
return self.alpha
}
- public init(layerBacked: Bool = false, dynamicBounce: Bool = false, isRotated: Bool = false, seeThrough: Bool = false) {
- self.wantsScrollDynamics = dynamicBounce
+ public init(layerBacked: Bool = false, isRotated: Bool = false, seeThrough: Bool = false) {
self.isRotated = isRotated
- if dynamicBounce {
- self.spring = ListViewItemSpring(stiffness: -280.0, damping: -24.0, mass: 0.85)
- }
super.init()
@@ -69,54 +71,10 @@ open class ListViewItemHeaderNode: ASDisplayNode {
}
final func addScrollingOffset(_ scrollingOffset: CGFloat) {
- if self.spring != nil && internalStickLocationDistanceFactor.isZero {
- let bounds = self.bounds
- self.bounds = CGRect(origin: CGPoint(x: 0.0, y: bounds.origin.y + scrollingOffset), size: bounds.size)
- }
}
public func animate(_ timestamp: Double) -> Bool {
- var continueAnimations = false
-
- if let _ = self.spring {
- let bounds = self.bounds
- var offset = bounds.origin.y
- let currentOffset = offset
-
- let frictionConstant: CGFloat = testSpringFriction
- let springConstant: CGFloat = testSpringConstant
- let time: CGFloat = 1.0 / 60.0
-
- // friction force = velocity * friction constant
- let frictionForce = self.spring!.velocity * frictionConstant
- // spring force = (target point - current position) * spring constant
- let springForce = -currentOffset * springConstant
- // force = spring force - friction force
- let force = springForce - frictionForce
-
- // velocity = current velocity + force * time / mass
- self.spring!.velocity = self.spring!.velocity + force * time
- // position = current position + velocity * time
- offset = currentOffset + self.spring!.velocity * time
-
- offset = offset.isNaN ? 0.0 : offset
-
- let epsilon: CGFloat = 0.1
- if abs(offset) < epsilon && abs(self.spring!.velocity) < epsilon {
- offset = 0.0
- self.spring!.velocity = 0.0
- } else {
- continueAnimations = true
- }
-
- if abs(offset) > 250.0 {
- offset = offset < 0.0 ? -250.0 : 250.0
- }
-
- self.bounds = CGRect(origin: CGPoint(x: 0.0, y: offset), size: bounds.size)
- }
-
- return continueAnimations
+ return false
}
open func animateRemoved(duration: Double) {
diff --git a/submodules/Display/Source/ListViewItemNode.swift b/submodules/Display/Source/ListViewItemNode.swift
index 42c6a995..360e0791 100644
--- a/submodules/Display/Source/ListViewItemNode.swift
+++ b/submodules/Display/Source/ListViewItemNode.swift
@@ -129,7 +129,6 @@ open class ListViewItemNode: ASDisplayNode, AccessibilityFocusableNode {
return nil
}
- private final var spring: ListViewItemSpring?
private final var animations: [(String, ListViewAnimation)] = []
private final var pendingControlledTransitions: [ControlledTransition] = []
private final var controlledTransitions: [ControlledTransitionContext] = []
@@ -142,8 +141,6 @@ open class ListViewItemNode: ASDisplayNode, AccessibilityFocusableNode {
open func attachedHeaderNodesUpdated() {
}
- final let wantsScrollDynamics: Bool
-
open var preferredAnimationCurve: (CGFloat) -> CGFloat {
return listViewAnimationCurveSystem
}
@@ -236,12 +233,7 @@ open class ListViewItemNode: ASDisplayNode, AccessibilityFocusableNode {
return .complete()
}
- public init(layerBacked: Bool, dynamicBounce: Bool = true, rotated: Bool = false, seeThrough: Bool = false) {
- if dynamicBounce {
- self.spring = ListViewItemSpring(stiffness: -280.0, damping: -24.0, mass: 0.85)
- }
- self.wantsScrollDynamics = dynamicBounce
-
+ public init(layerBacked: Bool, rotated: Bool = false, seeThrough: Bool = false) {
self.rotated = rotated
super.init()
@@ -338,56 +330,14 @@ open class ListViewItemNode: ASDisplayNode, AccessibilityFocusableNode {
}
final func addScrollingOffset(_ scrollingOffset: CGFloat) {
- if self.spring != nil {
- self.contentOffset += scrollingOffset
- }
}
func initializeDynamicsFromSibling(_ itemView: ListViewItemNode, additionalOffset: CGFloat) {
- if let itemViewSpring = itemView.spring {
- self.contentOffset = itemView.contentOffset + additionalOffset
- self.spring?.velocity = itemViewSpring.velocity
- }
}
public func animate(timestamp: Double, invertOffsetDirection: inout Bool) -> Bool {
var continueAnimations = false
- if let _ = self.spring {
- var offset = self.contentOffset
-
- let frictionConstant: CGFloat = testSpringFriction
- let springConstant: CGFloat = testSpringConstant
- let time: CGFloat = 1.0 / 60.0
-
- // friction force = velocity * friction constant
- let frictionForce = self.spring!.velocity * frictionConstant
- // spring force = (target point - current position) * spring constant
- let springForce = -self.contentOffset * springConstant
- // force = spring force - friction force
- let force = springForce - frictionForce
-
- // velocity = current velocity + force * time / mass
- self.spring!.velocity = self.spring!.velocity + force * time
- // position = current position + velocity * time
- offset = self.contentOffset + self.spring!.velocity * time
-
- offset = offset.isNaN ? 0.0 : offset
-
- let epsilon: CGFloat = 0.1
- if abs(offset) < epsilon && abs(self.spring!.velocity) < epsilon {
- offset = 0.0
- self.spring!.velocity = 0.0
- } else {
- continueAnimations = true
- }
-
- if abs(offset) > 250.0 {
- offset = offset < 0.0 ? -250.0 : 250.0
- }
- self.contentOffset = offset
- }
-
var i = 0
var animationCount = self.animations.count
while i < animationCount {
diff --git a/submodules/Display/Source/Navigation/NavigationModalFrame.swift b/submodules/Display/Source/Navigation/NavigationModalFrame.swift
index 2120a419..91c05d66 100644
--- a/submodules/Display/Source/Navigation/NavigationModalFrame.swift
+++ b/submodules/Display/Source/Navigation/NavigationModalFrame.swift
@@ -109,7 +109,7 @@ public final class NavigationModalFrame: ASDisplayNode {
let contentScale = (layout.size.width - sideInset * 2.0) / layout.size.width
let bottomInset: CGFloat = layout.size.height - contentScale * layout.size.height - topInset
- let cornerRadius: CGFloat = 28.0
+ let cornerRadius: CGFloat = 38.0
let initialCornerRadius: CGFloat
if !layout.safeInsets.top.isZero {
initialCornerRadius = layout.deviceMetrics.screenCornerRadius
diff --git a/submodules/Display/Source/NavigationBackgroundView.swift b/submodules/Display/Source/NavigationBackgroundView.swift
new file mode 100644
index 00000000..2fff1fe1
--- /dev/null
+++ b/submodules/Display/Source/NavigationBackgroundView.swift
@@ -0,0 +1,332 @@
+import Foundation
+import UIKit
+import AsyncDisplayKit
+
+private var sharedIsReduceTransparencyEnabled = UIAccessibility.isReduceTransparencyEnabled
+
+public final class NavigationBackgroundNode: ASDisplayNode {
+ private var _color: UIColor
+
+ public var color: UIColor {
+ return self._color
+ }
+
+ private var enableBlur: Bool
+ private var enableSaturation: Bool
+ private var customBlurRadius: CGFloat?
+
+ public var effectView: UIVisualEffectView?
+ private let backgroundNode: ASDisplayNode
+
+ public var backgroundView: UIView {
+ return self.backgroundNode.view
+ }
+
+ private var validLayout: (CGSize, CGFloat)?
+
+ public var backgroundCornerRadius: CGFloat {
+ if let (_, cornerRadius) = self.validLayout {
+ return cornerRadius
+ } else {
+ return 0.0
+ }
+ }
+
+ public init(color: UIColor, enableBlur: Bool = true, enableSaturation: Bool = true, customBlurRadius: CGFloat? = nil) {
+ self._color = .clear
+ self.enableBlur = enableBlur
+ self.enableSaturation = enableSaturation
+ self.customBlurRadius = customBlurRadius
+
+ self.backgroundNode = ASDisplayNode()
+
+ super.init()
+
+ self.addSubnode(self.backgroundNode)
+
+ self.updateColor(color: color, transition: .immediate)
+ }
+
+
+ public override func didLoad() {
+ super.didLoad()
+
+ if self.scheduledUpdate {
+ self.scheduledUpdate = false
+ self.updateBackgroundBlur(forceKeepBlur: false)
+ }
+ }
+
+ private var scheduledUpdate = false
+
+ private func updateBackgroundBlur(forceKeepBlur: Bool) {
+ guard self.isNodeLoaded else {
+ self.scheduledUpdate = true
+ return
+ }
+ if self.enableBlur && !sharedIsReduceTransparencyEnabled && ((self._color.alpha > .ulpOfOne && self._color.alpha < 0.95) || forceKeepBlur) {
+ if self.effectView == nil {
+ let effectView = UIVisualEffectView(effect: UIBlurEffect(style: .light))
+
+ for subview in effectView.subviews {
+ if subview.description.contains("VisualEffectSubview") {
+ subview.isHidden = true
+ }
+ }
+
+ if let sublayer = effectView.layer.sublayers?[0], let filters = sublayer.filters {
+ sublayer.backgroundColor = nil
+ sublayer.isOpaque = false
+ var allowedKeys: [String] = [
+ "gaussianBlur"
+ ]
+ if self.enableSaturation {
+ allowedKeys.append("colorSaturate")
+ }
+ sublayer.filters = filters.filter { filter in
+ guard let filter = filter as? NSObject else {
+ return true
+ }
+ let filterName = String(describing: filter)
+ if !allowedKeys.contains(filterName) {
+ return false
+ }
+ if let customBlurRadius = self.customBlurRadius, filterName == "gaussianBlur" {
+ filter.setValue(customBlurRadius as NSNumber, forKey: "inputRadius")
+ }
+ return true
+ }
+ }
+
+ if let (size, cornerRadius) = self.validLayout {
+ effectView.frame = CGRect(origin: CGPoint(), size: size)
+ ContainedViewLayoutTransition.immediate.updateCornerRadius(layer: effectView.layer, cornerRadius: cornerRadius)
+ effectView.clipsToBounds = !cornerRadius.isZero
+ }
+ self.effectView = effectView
+ self.view.insertSubview(effectView, at: 0)
+ }
+ } else if let effectView = self.effectView {
+ self.effectView = nil
+ effectView.removeFromSuperview()
+ }
+ }
+
+ public func updateColor(color: UIColor, enableBlur: Bool? = nil, enableSaturation: Bool? = nil, forceKeepBlur: Bool = false, transition: ContainedViewLayoutTransition) {
+ let effectiveEnableBlur = enableBlur ?? self.enableBlur
+ let effectiveEnableSaturation = enableSaturation ?? self.enableSaturation
+
+ if self._color.isEqual(color) && self.enableBlur == effectiveEnableBlur && self.enableSaturation == effectiveEnableSaturation {
+ return
+ }
+ self._color = color
+ self.enableBlur = effectiveEnableBlur
+ self.enableSaturation = effectiveEnableSaturation
+
+ if sharedIsReduceTransparencyEnabled {
+ transition.updateBackgroundColor(node: self.backgroundNode, color: self._color.withAlphaComponent(1.0))
+ } else {
+ transition.updateBackgroundColor(node: self.backgroundNode, color: self._color)
+ }
+
+ self.updateBackgroundBlur(forceKeepBlur: forceKeepBlur)
+ }
+
+ public func update(size: CGSize, cornerRadius: CGFloat = 0.0, transition: ContainedViewLayoutTransition, beginWithCurrentState: Bool = true) {
+ self.validLayout = (size, cornerRadius)
+
+ let contentFrame = CGRect(origin: CGPoint(), size: size)
+ transition.updateFrame(node: self.backgroundNode, frame: contentFrame, beginWithCurrentState: true)
+ if let effectView = self.effectView, effectView.frame != contentFrame {
+ transition.updateFrame(layer: effectView.layer, frame: contentFrame, beginWithCurrentState: true)
+ if let sublayers = effectView.layer.sublayers {
+ for sublayer in sublayers {
+ transition.updateFrame(layer: sublayer, frame: contentFrame, beginWithCurrentState: true)
+ }
+ }
+ }
+
+ transition.updateCornerRadius(node: self.backgroundNode, cornerRadius: cornerRadius)
+ if let effectView = self.effectView {
+ transition.updateCornerRadius(layer: effectView.layer, cornerRadius: cornerRadius)
+ effectView.clipsToBounds = !cornerRadius.isZero
+ }
+ }
+
+ public func update(size: CGSize, cornerRadius: CGFloat = 0.0, animator: ControlledTransitionAnimator) {
+ self.validLayout = (size, cornerRadius)
+
+ let contentFrame = CGRect(origin: CGPoint(), size: size)
+ animator.updateFrame(layer: self.backgroundNode.layer, frame: contentFrame, completion: nil)
+ if let effectView = self.effectView, effectView.frame != contentFrame {
+ animator.updateFrame(layer: effectView.layer, frame: contentFrame, completion: nil)
+ if let sublayers = effectView.layer.sublayers {
+ for sublayer in sublayers {
+ animator.updateFrame(layer: sublayer, frame: contentFrame, completion: nil)
+ }
+ }
+ }
+
+ animator.updateCornerRadius(layer: self.backgroundNode.layer, cornerRadius: cornerRadius, completion: nil)
+ if let effectView = self.effectView {
+ animator.updateCornerRadius(layer: effectView.layer, cornerRadius: cornerRadius, completion: nil)
+ effectView.clipsToBounds = !cornerRadius.isZero
+ }
+ }
+}
+
+open class BlurredBackgroundView: UIView {
+ private var _color: UIColor?
+
+ private var enableBlur: Bool
+ private var customBlurRadius: CGFloat?
+
+ public private(set) var effectView: UIVisualEffectView?
+ private let backgroundView: UIView
+
+ private var validLayout: (CGSize, CGFloat)?
+
+ public var backgroundCornerRadius: CGFloat {
+ if let (_, cornerRadius) = self.validLayout {
+ return cornerRadius
+ } else {
+ return 0.0
+ }
+ }
+
+ public init(color: UIColor?, enableBlur: Bool = true, customBlurRadius: CGFloat? = nil) {
+ self._color = nil
+ self.enableBlur = enableBlur
+ self.customBlurRadius = customBlurRadius
+
+ self.backgroundView = UIView()
+
+ super.init(frame: CGRect())
+
+ self.addSubview(self.backgroundView)
+
+ if let color = color {
+ self.updateColor(color: color, transition: .immediate)
+ }
+ }
+
+ required public init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+
+ private func updateBackgroundBlur(forceKeepBlur: Bool) {
+ if let color = self._color, self.enableBlur && !sharedIsReduceTransparencyEnabled && ((color.alpha > .ulpOfOne && color.alpha < 0.95) || forceKeepBlur) {
+ if self.effectView == nil {
+ let effectView = UIVisualEffectView(effect: UIBlurEffect(style: .light))
+
+ for subview in effectView.subviews {
+ if subview.description.contains("VisualEffectSubview") {
+ subview.isHidden = true
+ }
+ }
+
+ if let sublayer = effectView.layer.sublayers?[0], let filters = sublayer.filters {
+ sublayer.backgroundColor = nil
+ sublayer.isOpaque = false
+ //sublayer.setValue(true as NSNumber, forKey: "allowsInPlaceFiltering")
+ let allowedKeys: [String] = [
+ "colorSaturate",
+ "gaussianBlur"
+ ]
+ sublayer.filters = filters.filter { filter in
+ guard let filter = filter as? NSObject else {
+ return true
+ }
+ let filterName = String(describing: filter)
+ if !allowedKeys.contains(filterName) {
+ return false
+ }
+ if let customBlurRadius = self.customBlurRadius, filterName == "gaussianBlur" {
+ filter.setValue(customBlurRadius as NSNumber, forKey: "inputRadius")
+ }
+ return true
+ }
+ }
+
+ if let (size, cornerRadius) = self.validLayout {
+ effectView.frame = CGRect(origin: CGPoint(), size: size)
+ ContainedViewLayoutTransition.immediate.updateCornerRadius(layer: effectView.layer, cornerRadius: cornerRadius)
+ effectView.clipsToBounds = !cornerRadius.isZero
+ }
+ self.effectView = effectView
+ self.insertSubview(effectView, at: 0)
+ }
+ } else if let effectView = self.effectView {
+ self.effectView = nil
+ effectView.removeFromSuperview()
+ }
+ }
+
+ public func updateColor(color: UIColor, enableBlur: Bool? = nil, forceKeepBlur: Bool = false, transition: ContainedViewLayoutTransition) {
+ let effectiveEnableBlur = enableBlur ?? self.enableBlur
+
+ if self._color == color && self.enableBlur == effectiveEnableBlur {
+ return
+ }
+ self._color = color
+ self.enableBlur = effectiveEnableBlur
+
+ if sharedIsReduceTransparencyEnabled {
+ transition.updateBackgroundColor(layer: self.backgroundView.layer, color: color.withAlphaComponent(1.0))
+ } else {
+ transition.updateBackgroundColor(layer: self.backgroundView.layer, color: color)
+ }
+
+ self.updateBackgroundBlur(forceKeepBlur: forceKeepBlur)
+ }
+
+ public func update(size: CGSize, cornerRadius: CGFloat = 0.0, maskedCorners: CACornerMask = [.layerMaxXMaxYCorner, .layerMaxXMinYCorner, .layerMinXMaxYCorner, .layerMinXMinYCorner], transition: ContainedViewLayoutTransition) {
+ self.validLayout = (size, cornerRadius)
+
+ let contentFrame = CGRect(origin: CGPoint(), size: size)
+ transition.updateFrame(view: self.backgroundView, frame: contentFrame, beginWithCurrentState: true)
+ if let effectView = self.effectView, effectView.frame != contentFrame {
+ transition.updateFrame(layer: effectView.layer, frame: contentFrame, beginWithCurrentState: true)
+ if let sublayers = effectView.layer.sublayers {
+ for sublayer in sublayers {
+ transition.updateFrame(layer: sublayer, frame: contentFrame, beginWithCurrentState: true)
+ }
+ }
+ }
+
+ if #available(iOS 11.0, *) {
+ self.backgroundView.layer.maskedCorners = maskedCorners
+ }
+
+ transition.updateCornerRadius(layer: self.backgroundView.layer, cornerRadius: cornerRadius)
+ if let effectView = self.effectView {
+ transition.updateCornerRadius(layer: effectView.layer, cornerRadius: cornerRadius)
+ effectView.clipsToBounds = !cornerRadius.isZero
+
+ if #available(iOS 11.0, *) {
+ effectView.layer.maskedCorners = maskedCorners
+ }
+ }
+ }
+
+ public func update(size: CGSize, cornerRadius: CGFloat = 0.0, animator: ControlledTransitionAnimator) {
+ self.validLayout = (size, cornerRadius)
+
+ let contentFrame = CGRect(origin: CGPoint(), size: size)
+ animator.updateFrame(layer: self.backgroundView.layer, frame: contentFrame, completion: nil)
+ if let effectView = self.effectView, effectView.frame != contentFrame {
+ animator.updateFrame(layer: effectView.layer, frame: contentFrame, completion: nil)
+ if let sublayers = effectView.layer.sublayers {
+ for sublayer in sublayers {
+ animator.updateFrame(layer: sublayer, frame: contentFrame, completion: nil)
+ }
+ }
+ }
+
+ animator.updateCornerRadius(layer: self.backgroundView.layer, cornerRadius: cornerRadius, completion: nil)
+ if let effectView = self.effectView {
+ animator.updateCornerRadius(layer: effectView.layer, cornerRadius: cornerRadius, completion: nil)
+ effectView.clipsToBounds = !cornerRadius.isZero
+ }
+ }
+}
diff --git a/submodules/Display/Source/NavigationBar.swift b/submodules/Display/Source/NavigationBar.swift
index 03f4f718..67ad9cb6 100644
--- a/submodules/Display/Source/NavigationBar.swift
+++ b/submodules/Display/Source/NavigationBar.swift
@@ -4,50 +4,6 @@ import SwiftSignalKit
private var backArrowImageCache: [Int32: UIImage] = [:]
-open class SparseNode: ASDisplayNode {
- override open func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
- if self.alpha.isZero {
- return nil
- }
- for view in self.view.subviews.reversed() {
- if let result = view.hitTest(self.view.convert(point, to: view), with: event), result.isUserInteractionEnabled {
- return result
- }
- }
-
- if !self.bounds.inset(by: self.hitTestSlop).contains(point) {
- return nil
- }
-
- let result = super.hitTest(point, with: event)
- if result != self.view {
- return result
- } else {
- return nil
- }
- }
-}
-
-open class SparseContainerView: UIView {
- override public func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
- if self.alpha.isZero {
- return nil
- }
- for view in self.subviews.reversed() {
- if let result = view.hitTest(self.convert(point, to: view), with: event), result.isUserInteractionEnabled {
- return result
- }
- }
-
- let result = super.hitTest(point, with: event)
- if result != self {
- return result
- } else {
- return nil
- }
- }
-}
-
public final class NavigationBarTheme {
public static func generateBackArrowImage(color: UIColor) -> UIImage? {
return generateImage(CGSize(width: 13.0, height: 22.0), rotatedContext: { size, context in
@@ -60,6 +16,7 @@ public final class NavigationBarTheme {
})
}
+ public let overallDarkAppearance: Bool
public let buttonColor: UIColor
public let disabledButtonColor: UIColor
public let primaryTextColor: UIColor
@@ -70,8 +27,11 @@ public final class NavigationBarTheme {
public let badgeBackgroundColor: UIColor
public let badgeStrokeColor: UIColor
public let badgeTextColor: UIColor
+ public let edgeEffectColor: UIColor?
+ public let style: NavigationBar.Style
- public init(buttonColor: UIColor, disabledButtonColor: UIColor, primaryTextColor: UIColor, backgroundColor: UIColor, opaqueBackgroundColor: UIColor? = nil, enableBackgroundBlur: Bool, separatorColor: UIColor, badgeBackgroundColor: UIColor, badgeStrokeColor: UIColor, badgeTextColor: UIColor) {
+ public init(overallDarkAppearance: Bool, buttonColor: UIColor, disabledButtonColor: UIColor, primaryTextColor: UIColor, backgroundColor: UIColor, opaqueBackgroundColor: UIColor? = nil, enableBackgroundBlur: Bool, separatorColor: UIColor, badgeBackgroundColor: UIColor, badgeStrokeColor: UIColor, badgeTextColor: UIColor, edgeEffectColor: UIColor? = nil, style: NavigationBar.Style = .legacy) {
+ self.overallDarkAppearance = overallDarkAppearance
self.buttonColor = buttonColor
self.disabledButtonColor = disabledButtonColor
self.primaryTextColor = primaryTextColor
@@ -82,14 +42,16 @@ public final class NavigationBarTheme {
self.badgeBackgroundColor = badgeBackgroundColor
self.badgeStrokeColor = badgeStrokeColor
self.badgeTextColor = badgeTextColor
+ self.edgeEffectColor = edgeEffectColor
+ self.style = style
}
public func withUpdatedBackgroundColor(_ color: UIColor) -> NavigationBarTheme {
- return NavigationBarTheme(buttonColor: self.buttonColor, disabledButtonColor: self.disabledButtonColor, primaryTextColor: self.primaryTextColor, backgroundColor: color, opaqueBackgroundColor: self.opaqueBackgroundColor, enableBackgroundBlur: false, separatorColor: self.separatorColor, badgeBackgroundColor: self.badgeBackgroundColor, badgeStrokeColor: self.badgeStrokeColor, badgeTextColor: self.badgeTextColor)
+ return NavigationBarTheme(overallDarkAppearance: self.overallDarkAppearance, buttonColor: self.buttonColor, disabledButtonColor: self.disabledButtonColor, primaryTextColor: self.primaryTextColor, backgroundColor: color, opaqueBackgroundColor: self.opaqueBackgroundColor, enableBackgroundBlur: false, separatorColor: self.separatorColor, badgeBackgroundColor: self.badgeBackgroundColor, badgeStrokeColor: self.badgeStrokeColor, badgeTextColor: self.badgeTextColor, edgeEffectColor: self.edgeEffectColor, style: self.style)
}
public func withUpdatedSeparatorColor(_ color: UIColor) -> NavigationBarTheme {
- return NavigationBarTheme(buttonColor: self.buttonColor, disabledButtonColor: self.disabledButtonColor, primaryTextColor: self.primaryTextColor, backgroundColor: self.backgroundColor, opaqueBackgroundColor: self.opaqueBackgroundColor, enableBackgroundBlur: self.enableBackgroundBlur, separatorColor: color, badgeBackgroundColor: self.badgeBackgroundColor, badgeStrokeColor: self.badgeStrokeColor, badgeTextColor: self.badgeTextColor)
+ return NavigationBarTheme(overallDarkAppearance: self.overallDarkAppearance, buttonColor: self.buttonColor, disabledButtonColor: self.disabledButtonColor, primaryTextColor: self.primaryTextColor, backgroundColor: self.backgroundColor, opaqueBackgroundColor: self.opaqueBackgroundColor, enableBackgroundBlur: self.enableBackgroundBlur, separatorColor: color, badgeBackgroundColor: self.badgeBackgroundColor, badgeStrokeColor: self.badgeStrokeColor, badgeTextColor: self.badgeTextColor, edgeEffectColor: self.edgeEffectColor, style: self.style)
}
}
@@ -135,1700 +97,101 @@ public enum NavigationPreviousAction: Equatable {
}
}
-private var sharedIsReduceTransparencyEnabled = UIAccessibility.isReduceTransparencyEnabled
-
-public final class NavigationBackgroundNode: ASDisplayNode {
- private var _color: UIColor
-
- public var color: UIColor {
- return self._color
- }
-
- private var enableBlur: Bool
- private var enableSaturation: Bool
- private var customBlurRadius: CGFloat?
-
- public var effectView: UIVisualEffectView?
- private let backgroundNode: ASDisplayNode
-
- public var backgroundView: UIView {
- return self.backgroundNode.view
- }
-
- private var validLayout: (CGSize, CGFloat)?
-
- public var backgroundCornerRadius: CGFloat {
- if let (_, cornerRadius) = self.validLayout {
- return cornerRadius
- } else {
- return 0.0
- }
- }
-
- public init(color: UIColor, enableBlur: Bool = true, enableSaturation: Bool = true, customBlurRadius: CGFloat? = nil) {
- self._color = .clear
- self.enableBlur = enableBlur
- self.enableSaturation = enableSaturation
- self.customBlurRadius = customBlurRadius
-
- self.backgroundNode = ASDisplayNode()
-
- super.init()
-
- self.addSubnode(self.backgroundNode)
-
- self.updateColor(color: color, transition: .immediate)
- }
-
-
- public override func didLoad() {
- super.didLoad()
-
- if self.scheduledUpdate {
- self.scheduledUpdate = false
- self.updateBackgroundBlur(forceKeepBlur: false)
- }
- }
-
- private var scheduledUpdate = false
-
- private func updateBackgroundBlur(forceKeepBlur: Bool) {
- guard self.isNodeLoaded else {
- self.scheduledUpdate = true
- return
- }
- if self.enableBlur && !sharedIsReduceTransparencyEnabled && ((self._color.alpha > .ulpOfOne && self._color.alpha < 0.95) || forceKeepBlur) {
- if self.effectView == nil {
- let effectView = UIVisualEffectView(effect: UIBlurEffect(style: .light))
-
- for subview in effectView.subviews {
- if subview.description.contains("VisualEffectSubview") {
- subview.isHidden = true
- }
- }
-
- if let sublayer = effectView.layer.sublayers?[0], let filters = sublayer.filters {
- sublayer.backgroundColor = nil
- sublayer.isOpaque = false
- var allowedKeys: [String] = [
- "gaussianBlur"
- ]
- if self.enableSaturation {
- allowedKeys.append("colorSaturate")
- }
- sublayer.filters = filters.filter { filter in
- guard let filter = filter as? NSObject else {
- return true
- }
- let filterName = String(describing: filter)
- if !allowedKeys.contains(filterName) {
- return false
- }
- if let customBlurRadius = self.customBlurRadius, filterName == "gaussianBlur" {
- filter.setValue(customBlurRadius as NSNumber, forKey: "inputRadius")
- }
- return true
- }
- }
-
- if let (size, cornerRadius) = self.validLayout {
- effectView.frame = CGRect(origin: CGPoint(), size: size)
- ContainedViewLayoutTransition.immediate.updateCornerRadius(layer: effectView.layer, cornerRadius: cornerRadius)
- effectView.clipsToBounds = !cornerRadius.isZero
- }
- self.effectView = effectView
- self.view.insertSubview(effectView, at: 0)
- }
- } else if let effectView = self.effectView {
- self.effectView = nil
- effectView.removeFromSuperview()
- }
- }
-
- public func updateColor(color: UIColor, enableBlur: Bool? = nil, enableSaturation: Bool? = nil, forceKeepBlur: Bool = false, transition: ContainedViewLayoutTransition) {
- let effectiveEnableBlur = enableBlur ?? self.enableBlur
- let effectiveEnableSaturation = enableSaturation ?? self.enableSaturation
-
- if self._color.isEqual(color) && self.enableBlur == effectiveEnableBlur && self.enableSaturation == effectiveEnableSaturation {
- return
- }
- self._color = color
- self.enableBlur = effectiveEnableBlur
- self.enableSaturation = effectiveEnableSaturation
-
- if sharedIsReduceTransparencyEnabled {
- transition.updateBackgroundColor(node: self.backgroundNode, color: self._color.withAlphaComponent(1.0))
- } else {
- transition.updateBackgroundColor(node: self.backgroundNode, color: self._color)
- }
-
- self.updateBackgroundBlur(forceKeepBlur: forceKeepBlur)
- }
-
- public func update(size: CGSize, cornerRadius: CGFloat = 0.0, transition: ContainedViewLayoutTransition, beginWithCurrentState: Bool = true) {
- self.validLayout = (size, cornerRadius)
-
- let contentFrame = CGRect(origin: CGPoint(), size: size)
- transition.updateFrame(node: self.backgroundNode, frame: contentFrame, beginWithCurrentState: true)
- if let effectView = self.effectView, effectView.frame != contentFrame {
- transition.updateFrame(layer: effectView.layer, frame: contentFrame, beginWithCurrentState: true)
- if let sublayers = effectView.layer.sublayers {
- for sublayer in sublayers {
- transition.updateFrame(layer: sublayer, frame: contentFrame, beginWithCurrentState: true)
- }
- }
- }
-
- transition.updateCornerRadius(node: self.backgroundNode, cornerRadius: cornerRadius)
- if let effectView = self.effectView {
- transition.updateCornerRadius(layer: effectView.layer, cornerRadius: cornerRadius)
- effectView.clipsToBounds = !cornerRadius.isZero
- }
- }
-
- public func update(size: CGSize, cornerRadius: CGFloat = 0.0, animator: ControlledTransitionAnimator) {
- self.validLayout = (size, cornerRadius)
-
- let contentFrame = CGRect(origin: CGPoint(), size: size)
- animator.updateFrame(layer: self.backgroundNode.layer, frame: contentFrame, completion: nil)
- if let effectView = self.effectView, effectView.frame != contentFrame {
- animator.updateFrame(layer: effectView.layer, frame: contentFrame, completion: nil)
- if let sublayers = effectView.layer.sublayers {
- for sublayer in sublayers {
- animator.updateFrame(layer: sublayer, frame: contentFrame, completion: nil)
- }
- }
- }
-
- animator.updateCornerRadius(layer: self.backgroundNode.layer, cornerRadius: cornerRadius, completion: nil)
- if let effectView = self.effectView {
- animator.updateCornerRadius(layer: effectView.layer, cornerRadius: cornerRadius, completion: nil)
- effectView.clipsToBounds = !cornerRadius.isZero
- }
- }
+public enum NavigationBarStyle {
+ case legacy
+ case glass
}
-open class BlurredBackgroundView: UIView {
- private var _color: UIColor?
-
- private var enableBlur: Bool
- private var customBlurRadius: CGFloat?
-
- public private(set) var effectView: UIVisualEffectView?
- private let backgroundView: UIView
-
- private var validLayout: (CGSize, CGFloat)?
+public func navigationBarBackArrowImage(color: UIColor) -> UIImage? {
+ var red: CGFloat = 0.0
+ var green: CGFloat = 0.0
+ var blue: CGFloat = 0.0
+ var alpha: CGFloat = 0.0
+ color.getRed(&red, green: &green, blue: &blue, alpha: &alpha)
- public var backgroundCornerRadius: CGFloat {
- if let (_, cornerRadius) = self.validLayout {
- return cornerRadius
- } else {
- return 0.0
- }
- }
-
- public init(color: UIColor?, enableBlur: Bool = true, customBlurRadius: CGFloat? = nil) {
- self._color = nil
- self.enableBlur = enableBlur
- self.customBlurRadius = customBlurRadius
-
- self.backgroundView = UIView()
-
- super.init(frame: CGRect())
-
- self.addSubview(self.backgroundView)
-
- if let color = color {
- self.updateColor(color: color, transition: .immediate)
- }
- }
-
- required public init?(coder: NSCoder) {
- fatalError("init(coder:) has not been implemented")
- }
-
- private func updateBackgroundBlur(forceKeepBlur: Bool) {
- if let color = self._color, self.enableBlur && !sharedIsReduceTransparencyEnabled && ((color.alpha > .ulpOfOne && color.alpha < 0.95) || forceKeepBlur) {
- if self.effectView == nil {
- let effectView = UIVisualEffectView(effect: UIBlurEffect(style: .light))
-
- for subview in effectView.subviews {
- if subview.description.contains("VisualEffectSubview") {
- subview.isHidden = true
- }
- }
-
- if let sublayer = effectView.layer.sublayers?[0], let filters = sublayer.filters {
- sublayer.backgroundColor = nil
- sublayer.isOpaque = false
- //sublayer.setValue(true as NSNumber, forKey: "allowsInPlaceFiltering")
- let allowedKeys: [String] = [
- "colorSaturate",
- "gaussianBlur"
- ]
- sublayer.filters = filters.filter { filter in
- guard let filter = filter as? NSObject else {
- return true
- }
- let filterName = String(describing: filter)
- if !allowedKeys.contains(filterName) {
- return false
- }
- if let customBlurRadius = self.customBlurRadius, filterName == "gaussianBlur" {
- filter.setValue(customBlurRadius as NSNumber, forKey: "inputRadius")
- }
- return true
- }
- }
-
- if let (size, cornerRadius) = self.validLayout {
- effectView.frame = CGRect(origin: CGPoint(), size: size)
- ContainedViewLayoutTransition.immediate.updateCornerRadius(layer: effectView.layer, cornerRadius: cornerRadius)
- effectView.clipsToBounds = !cornerRadius.isZero
- }
- self.effectView = effectView
- self.insertSubview(effectView, at: 0)
- }
- } else if let effectView = self.effectView {
- self.effectView = nil
- effectView.removeFromSuperview()
- }
- }
-
- public func updateColor(color: UIColor, enableBlur: Bool? = nil, forceKeepBlur: Bool = false, transition: ContainedViewLayoutTransition) {
- let effectiveEnableBlur = enableBlur ?? self.enableBlur
-
- if self._color == color && self.enableBlur == effectiveEnableBlur {
- return
- }
- self._color = color
- self.enableBlur = effectiveEnableBlur
-
- if sharedIsReduceTransparencyEnabled {
- transition.updateBackgroundColor(layer: self.backgroundView.layer, color: color.withAlphaComponent(1.0))
- } else {
- transition.updateBackgroundColor(layer: self.backgroundView.layer, color: color)
- }
-
- self.updateBackgroundBlur(forceKeepBlur: forceKeepBlur)
- }
-
- public func update(size: CGSize, cornerRadius: CGFloat = 0.0, maskedCorners: CACornerMask = [.layerMaxXMaxYCorner, .layerMaxXMinYCorner, .layerMinXMaxYCorner, .layerMinXMinYCorner], transition: ContainedViewLayoutTransition) {
- self.validLayout = (size, cornerRadius)
-
- let contentFrame = CGRect(origin: CGPoint(), size: size)
- transition.updateFrame(view: self.backgroundView, frame: contentFrame, beginWithCurrentState: true)
- if let effectView = self.effectView, effectView.frame != contentFrame {
- transition.updateFrame(layer: effectView.layer, frame: contentFrame, beginWithCurrentState: true)
- if let sublayers = effectView.layer.sublayers {
- for sublayer in sublayers {
- transition.updateFrame(layer: sublayer, frame: contentFrame, beginWithCurrentState: true)
- }
- }
- }
-
- if #available(iOS 11.0, *) {
- self.backgroundView.layer.maskedCorners = maskedCorners
- }
-
- transition.updateCornerRadius(layer: self.backgroundView.layer, cornerRadius: cornerRadius)
- if let effectView = self.effectView {
- transition.updateCornerRadius(layer: effectView.layer, cornerRadius: cornerRadius)
- effectView.clipsToBounds = !cornerRadius.isZero
-
- if #available(iOS 11.0, *) {
- effectView.layer.maskedCorners = maskedCorners
- }
- }
- }
-
- public func update(size: CGSize, cornerRadius: CGFloat = 0.0, animator: ControlledTransitionAnimator) {
- self.validLayout = (size, cornerRadius)
-
- let contentFrame = CGRect(origin: CGPoint(), size: size)
- animator.updateFrame(layer: self.backgroundView.layer, frame: contentFrame, completion: nil)
- if let effectView = self.effectView, effectView.frame != contentFrame {
- animator.updateFrame(layer: effectView.layer, frame: contentFrame, completion: nil)
- if let sublayers = effectView.layer.sublayers {
- for sublayer in sublayers {
- animator.updateFrame(layer: sublayer, frame: contentFrame, completion: nil)
- }
- }
- }
-
- animator.updateCornerRadius(layer: self.backgroundView.layer, cornerRadius: cornerRadius, completion: nil)
- if let effectView = self.effectView {
- animator.updateCornerRadius(layer: effectView.layer, cornerRadius: cornerRadius, completion: nil)
- effectView.clipsToBounds = !cornerRadius.isZero
- }
- }
-}
-
-public protocol NavigationBarHeaderView: UIView {
-}
-
-private final class NavigationBackgroundCutoutView: UIView {
- private let topLayer: SimpleLayer
- private let rightLayer: SimpleLayer
-
- weak var targetNode: ASDisplayNode?
-
- override init(frame: CGRect) {
- self.topLayer = SimpleLayer()
- self.topLayer.backgroundColor = UIColor.white.cgColor
-
- self.rightLayer = SimpleLayer()
- self.rightLayer.backgroundColor = UIColor.white.cgColor
-
- super.init(frame: frame)
-
- self.layer.addSublayer(self.topLayer)
- self.layer.addSublayer(self.rightLayer)
- }
-
- required init?(coder: NSCoder) {
- fatalError("init(coder:) has not been implemented")
- }
-
- func update(size: CGSize, cutout: CGSize?, transition: ContainedViewLayoutTransition) {
- let cutout = cutout ?? CGSize()
-
- let topFrame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: size.width, height: cutout.height))
- let rightFrame = CGRect(origin: CGPoint(x: cutout.width, y: 0.0), size: CGSize(width: max(0.0, size.width - cutout.width), height: size.height))
-
- if self.topLayer.frame != topFrame || self.rightLayer.frame != rightFrame {
- if cutout.width != 0.0 && cutout.height != 0.0 {
- self.targetNode?.view.mask = self
- //self.targetNode?.view.addSubview(self)
- }
-
- transition.updateFrame(layer: self.topLayer, frame: topFrame)
- transition.updateFrame(layer: self.rightLayer, frame: rightFrame, completion: { [weak self] completed in
- guard let self, completed else {
- return
- }
-
- if !(cutout.width != 0.0 && cutout.height != 0.0) {
- self.targetNode?.view.mask = nil
- //self.removeFromSuperview()
- }
- })
- }
- }
-}
-
-open class NavigationBar: ASDisplayNode {
- public static var defaultSecondaryContentHeight: CGFloat {
- return 38.0
- }
-
- public static func backArrowImage(color: UIColor) -> UIImage? {
- var red: CGFloat = 0.0
- var green: CGFloat = 0.0
- var blue: CGFloat = 0.0
- var alpha: CGFloat = 0.0
- color.getRed(&red, green: &green, blue: &blue, alpha: &alpha)
-
- let key = (Int32(alpha * 255.0) << 24) | (Int32(red * 255.0) << 16) | (Int32(green * 255.0) << 8) | Int32(blue * 255.0)
- if let image = backArrowImageCache[key] {
+ let key = (Int32(alpha * 255.0) << 24) | (Int32(red * 255.0) << 16) | (Int32(green * 255.0) << 8) | Int32(blue * 255.0)
+ if let image = backArrowImageCache[key] {
+ return image
+ } else {
+ if let image = NavigationBarTheme.generateBackArrowImage(color: color) {
+ backArrowImageCache[key] = image
return image
- } else {
- if let image = NavigationBarTheme.generateBackArrowImage(color: color) {
- backArrowImageCache[key] = image
- return image
- } else {
- return nil
- }
- }
- }
-
- public static let thinBackArrowImage = generateTintedImage(image: UIImage(bundleImageName: "Navigation/BackArrow"), color: .white)?.withRenderingMode(.alwaysTemplate)
-
- public static let titleFont = Font.with(size: 17.0, design: .regular, weight: .semibold, traits: [.monospacedNumbers])
-
- var presentationData: NavigationBarPresentationData
-
- private var validLayout: (size: CGSize, defaultHeight: CGFloat, additionalTopHeight: CGFloat, additionalContentHeight: CGFloat, additionalBackgroundHeight: CGFloat, additionalCutout: CGSize?, leftInset: CGFloat, rightInset: CGFloat, appearsHidden: Bool, isLandscape: Bool)?
- private var requestedLayout: Bool = false
- var requestContainerLayout: (ContainedViewLayoutTransition) -> Void = { _ in }
-
- public var backPressed: () -> () = { }
-
- public var userInfo: Any?
- public var makeCustomTransitionNode: ((NavigationBar, Bool) -> CustomNavigationTransitionNode?)?
- public var allowsCustomTransition: (() -> Bool)?
-
- public var customSetContentNode: ((NavigationBarContentNode?, Bool) -> Void)?
-
- private var collapsed: Bool {
- get {
- return self.frame.size.height.isLess(than: 44.0)
- }
- }
-
- public let stripeNode: ASDisplayNode
- public let clippingNode: SparseNode
- private let buttonsContainerNode: ASDisplayNode
-
- public private(set) var contentNode: NavigationBarContentNode?
- public private(set) var secondaryContentNode: ASDisplayNode?
- public var secondaryContentNodeDisplayFraction: CGFloat = 1.0
-
- private var itemTitleListenerKey: Int?
- private var itemTitleViewListenerKey: Int?
-
- private var itemLeftButtonListenerKey: Int?
- private var itemLeftButtonSetEnabledListenerKey: Int?
-
- private var itemRightButtonListenerKey: Int?
- private var itemRightButtonsListenerKey: Int?
-
- private var itemBadgeListenerKey: Int?
-
- private var hintAnimateTitleNodeOnNextLayout: Bool = false
-
- private var _item: UINavigationItem?
- public var item: UINavigationItem? {
- get {
- return self._item
- } set(value) {
- if let previousValue = self._item {
- if let itemTitleListenerKey = self.itemTitleListenerKey {
- previousValue.removeSetTitleListener(itemTitleListenerKey)
- self.itemTitleListenerKey = nil
- }
-
- if let itemLeftButtonListenerKey = self.itemLeftButtonListenerKey {
- previousValue.removeSetLeftBarButtonItemListener(itemLeftButtonListenerKey)
- self.itemLeftButtonListenerKey = nil
- }
-
- if let itemLeftButtonSetEnabledListenerKey = self.itemLeftButtonSetEnabledListenerKey {
- previousValue.leftBarButtonItem?.removeSetEnabledListener(itemLeftButtonSetEnabledListenerKey)
- self.itemLeftButtonSetEnabledListenerKey = nil
- }
-
- if let itemRightButtonListenerKey = self.itemRightButtonListenerKey {
- previousValue.removeSetRightBarButtonItemListener(itemRightButtonListenerKey)
- self.itemRightButtonListenerKey = nil
- }
-
- if let itemRightButtonsListenerKey = self.itemRightButtonsListenerKey {
- previousValue.removeSetMultipleRightBarButtonItemsListener(itemRightButtonsListenerKey)
- self.itemRightButtonsListenerKey = nil
- }
-
- if let itemBadgeListenerKey = self.itemBadgeListenerKey {
- previousValue.removeSetBadgeListener(itemBadgeListenerKey)
- self.itemBadgeListenerKey = nil
- }
- }
- self._item = value
-
- self.leftButtonNode.removeFromSupernode()
- self.rightButtonNode.removeFromSupernode()
-
- if let item = value {
- self.title = item.title
- self.itemTitleListenerKey = item.addSetTitleListener { [weak self] text, animated in
- if let strongSelf = self {
- let animateIn = animated && (strongSelf.title?.isEmpty ?? true)
- strongSelf.title = text
- if animateIn {
- strongSelf.titleNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.25)
- }
- }
- }
-
- self.titleView = item.titleView
- self.itemTitleViewListenerKey = item.addSetTitleViewListener { [weak self] titleView in
- if let strongSelf = self {
- strongSelf.titleView = titleView
- }
- }
-
- self.itemLeftButtonListenerKey = item.addSetLeftBarButtonItemListener { [weak self] previousItem, _, animated in
- if let strongSelf = self {
- if let itemLeftButtonSetEnabledListenerKey = strongSelf.itemLeftButtonSetEnabledListenerKey {
- previousItem?.removeSetEnabledListener(itemLeftButtonSetEnabledListenerKey)
- strongSelf.itemLeftButtonSetEnabledListenerKey = nil
- }
-
- strongSelf.updateLeftButton(animated: animated)
- strongSelf.invalidateCalculatedLayout()
- strongSelf.requestLayout()
- }
- }
-
- self.itemRightButtonListenerKey = item.addSetRightBarButtonItemListener { [weak self] previousItem, currentItem, animated in
- if let strongSelf = self {
- strongSelf.updateRightButton(animated: animated)
- strongSelf.invalidateCalculatedLayout()
- strongSelf.requestLayout()
- }
- }
-
- self.itemRightButtonsListenerKey = item.addSetMultipleRightBarButtonItemsListener { [weak self] items, animated in
- if let strongSelf = self {
- strongSelf.updateRightButton(animated: animated)
- strongSelf.invalidateCalculatedLayout()
- strongSelf.requestLayout()
- }
- }
-
- self.itemBadgeListenerKey = item.addSetBadgeListener { [weak self] text in
- if let strongSelf = self {
- strongSelf.updateBadgeText(text: text)
- }
- }
- self.updateBadgeText(text: item.badge)
-
- self.updateLeftButton(animated: false)
- self.updateRightButton(animated: false)
- } else {
- self.title = nil
- self.updateLeftButton(animated: false)
- self.updateRightButton(animated: false)
- }
- self.invalidateCalculatedLayout()
- self.requestLayout()
- }
- }
-
- public var customBackButtonText: String?
-
- private var title: String? {
- didSet {
- if let title = self.title {
- self.titleNode.attributedText = NSAttributedString(string: title, font: NavigationBar.titleFont, textColor: self.presentationData.theme.primaryTextColor)
- self.titleNode.accessibilityLabel = title
- if self.titleNode.supernode == nil {
- self.buttonsContainerNode.addSubnode(self.titleNode)
- }
- } else {
- self.titleNode.removeFromSupernode()
- }
-
- self.updateAccessibilityElements()
- self.invalidateCalculatedLayout()
- self.requestLayout()
- }
- }
-
- public private(set) var titleView: UIView? {
- didSet {
- if let oldValue = oldValue {
- oldValue.removeFromSuperview()
- }
-
- if let titleView = self.titleView {
- self.buttonsContainerNode.view.addSubview(titleView)
- }
-
- self.invalidateCalculatedLayout()
- self.requestLayout()
- }
- }
-
- public var customHeaderContentView: NavigationBarHeaderView? {
- didSet {
- if self.customHeaderContentView !== oldValue {
- self.customHeaderContentView?.removeFromSuperview()
-
- if let customHeaderContentView = self.customHeaderContentView {
- self.buttonsContainerNode.view.addSubview(customHeaderContentView)
- self.backButtonNode.isHidden = true
- self.backButtonArrow.isHidden = true
- } else {
- self.backButtonNode.isHidden = false
- self.backButtonArrow.isHidden = false
- }
- }
- }
- }
-
- public var layoutSuspended: Bool = false
-
- private let titleNode: ImmediateTextNode
-
- var previousItemListenerKey: Int?
- var previousItemBackListenerKey: Int?
-
- private func updateAccessibilityElements() {
- }
-
- override open var accessibilityElements: [Any]? {
- get {
- var accessibilityElements: [Any] = []
- if self.backButtonNode.supernode != nil {
- addAccessibilityChildren(of: self.backButtonNode, container: self, to: &accessibilityElements)
- }
- if self.leftButtonNode.supernode != nil {
- addAccessibilityChildren(of: self.leftButtonNode, container: self, to: &accessibilityElements)
- }
- if self.titleNode.supernode != nil {
- addAccessibilityChildren(of: self.titleNode, container: self, to: &accessibilityElements)
- accessibilityElements.append(self.titleNode)
- }
- if let titleView = self.titleView, titleView.superview != nil {
- titleView.accessibilityFrame = UIAccessibility.convertToScreenCoordinates(titleView.bounds, in: titleView)
- accessibilityElements.append(titleView)
- }
- if self.rightButtonNode.supernode != nil {
- addAccessibilityChildren(of: self.rightButtonNode, container: self, to: &accessibilityElements)
- }
- if let customHeaderContentView = self.customHeaderContentView, customHeaderContentView.superview != nil {
- customHeaderContentView.accessibilityFrame = UIAccessibility.convertToScreenCoordinates(customHeaderContentView.bounds, in: customHeaderContentView)
- accessibilityElements.append(customHeaderContentView)
- }
- if let contentNode = self.contentNode {
- addAccessibilityChildren(of: contentNode, container: self, to: &accessibilityElements)
- }
- if let secondaryContentNode = self.secondaryContentNode {
- addAccessibilityChildren(of: secondaryContentNode, container: self, to: &accessibilityElements)
- }
- return accessibilityElements
- } set(value) {
- }
- }
-
- override open func didLoad() {
- super.didLoad()
-
- self.updateAccessibilityElements()
- }
-
- public var enableAutomaticBackButton: Bool = true
-
- var _previousItem: NavigationPreviousAction?
- public internal(set) var previousItem: NavigationPreviousAction? {
- get {
- if !self.enableAutomaticBackButton {
- return nil
- }
- return self._previousItem
- } set(value) {
- if !self.enableAutomaticBackButton {
- self._previousItem = nil
- return
- }
- if self._previousItem != value {
- if let previousValue = self._previousItem, case let .item(itemValue) = previousValue {
- if let previousItemListenerKey = self.previousItemListenerKey {
- itemValue.removeSetTitleListener(previousItemListenerKey)
- self.previousItemListenerKey = nil
- }
- if let previousItemBackListenerKey = self.previousItemBackListenerKey {
- itemValue.removeSetBackBarButtonItemListener(previousItemBackListenerKey)
- self.previousItemBackListenerKey = nil
- }
- }
- self._previousItem = value
-
- if let previousItem = value {
- switch previousItem {
- case let .item(itemValue):
- self.previousItemListenerKey = itemValue.addSetTitleListener { [weak self] _, _ in
- if let strongSelf = self, let previousItem = strongSelf.previousItem, case let .item(itemValue) = previousItem {
- if let customBackButtonText = strongSelf.customBackButtonText {
- strongSelf.backButtonNode.updateManualText(customBackButtonText, isBack: true)
- } else if let backBarButtonItem = itemValue.backBarButtonItem {
- strongSelf.backButtonNode.updateManualText(backBarButtonItem.title ?? "", isBack: true)
- } else {
- strongSelf.backButtonNode.updateManualText(itemValue.title ?? "", isBack: true)
- }
- strongSelf.invalidateCalculatedLayout()
- strongSelf.requestLayout()
- }
- }
-
- self.previousItemBackListenerKey = itemValue.addSetBackBarButtonItemListener { [weak self] _, _, _ in
- if let strongSelf = self, let previousItem = strongSelf.previousItem, case let .item(itemValue) = previousItem {
- if let customBackButtonText = strongSelf.customBackButtonText {
- strongSelf.backButtonNode.updateManualText(customBackButtonText, isBack: true)
- } else if let backBarButtonItem = itemValue.backBarButtonItem {
- strongSelf.backButtonNode.updateManualText(backBarButtonItem.title ?? "", isBack: true)
- } else {
- strongSelf.backButtonNode.updateManualText(itemValue.title ?? "", isBack: true)
- }
- strongSelf.invalidateCalculatedLayout()
- strongSelf.requestLayout()
- }
- }
- case .close:
- break
- }
- }
- self.updateLeftButton(animated: false)
-
- self.invalidateCalculatedLayout()
- self.requestLayout()
- }
- }
- }
-
- private func updateBadgeText(text: String?) {
- let actualText = text ?? ""
- if self.badgeNode.text != actualText {
- self.badgeNode.text = actualText
- self.badgeNode.isHidden = actualText.isEmpty
- self.backButtonNode.manualAlpha = self.badgeNode.isHidden ? 1.0 : 0.0
-
- self.invalidateCalculatedLayout()
- self.requestLayout()
- }
- }
-
- private func updateLeftButton(animated: Bool) {
- if let item = self.item {
- var needsLeftButton = false
- if let leftBarButtonItem = item.leftBarButtonItem, !leftBarButtonItem.backButtonAppearance {
- needsLeftButton = true
- } else if let previousItem = self.previousItem, case .close = previousItem {
- needsLeftButton = true
- }
-
- if needsLeftButton {
- if animated {
- if self.backButtonNode.view.superview != nil {
- if let snapshotView = self.backButtonNode.view.snapshotContentTree() {
- snapshotView.frame = self.backButtonNode.frame
- self.backButtonNode.view.superview?.insertSubview(snapshotView, aboveSubview: self.backButtonNode.view)
- snapshotView.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.15, removeOnCompletion: false, completion: { [weak snapshotView] _ in
- snapshotView?.removeFromSuperview()
- })
- }
- }
-
- if self.backButtonArrow.view.superview != nil {
- if let snapshotView = self.backButtonArrow.view.snapshotContentTree() {
- snapshotView.frame = self.backButtonArrow.frame
- self.backButtonArrow.view.superview?.insertSubview(snapshotView, aboveSubview: self.backButtonArrow.view)
- snapshotView.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.15, removeOnCompletion: false, completion: { [weak snapshotView] _ in
- snapshotView?.removeFromSuperview()
- })
- }
- }
-
- if self.badgeNode.view.superview != nil {
- if let snapshotView = self.badgeNode.view.snapshotContentTree() {
- snapshotView.frame = self.badgeNode.frame
- self.badgeNode.view.superview?.insertSubview(snapshotView, aboveSubview: self.badgeNode.view)
- snapshotView.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.15, removeOnCompletion: false, completion: { [weak snapshotView] _ in
- snapshotView?.removeFromSuperview()
- })
- }
- }
- }
-
- self.backButtonNode.removeFromSupernode()
- self.backButtonArrow.removeFromSupernode()
- self.badgeNode.removeFromSupernode()
-
- if let leftBarButtonItem = item.leftBarButtonItem {
- self.leftButtonNode.updateItems([], animated: animated)
- self.leftButtonNode.updateItems([leftBarButtonItem], animated: animated)
- } else {
- self.leftButtonNode.updateItems([], animated: animated)
- self.leftButtonNode.updateItems([UIBarButtonItem(title: self.presentationData.strings.close, style: .plain, target: nil, action: nil)], animated: animated)
- }
-
- if self.leftButtonNode.supernode == nil {
- self.buttonsContainerNode.addSubnode(self.leftButtonNode)
- }
-
- if animated {
- self.leftButtonNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.25)
- }
- } else {
- if animated, self.leftButtonNode.view.superview != nil {
- if let snapshotView = self.leftButtonNode.view.snapshotContentTree() {
- snapshotView.frame = self.leftButtonNode.frame
- self.leftButtonNode.view.superview?.insertSubview(snapshotView, aboveSubview: self.leftButtonNode.view)
- snapshotView.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.15, removeOnCompletion: false, completion: { [weak snapshotView] _ in
- snapshotView?.removeFromSuperview()
- })
- }
- }
- self.leftButtonNode.removeFromSupernode()
-
- var backTitle: String?
- if let customBackButtonText = self.customBackButtonText {
- backTitle = customBackButtonText
- } else if let leftBarButtonItem = item.leftBarButtonItem, leftBarButtonItem.backButtonAppearance {
- backTitle = leftBarButtonItem.title
- } else if let previousItem = self.previousItem {
- switch previousItem {
- case let .item(itemValue):
- if let backBarButtonItem = itemValue.backBarButtonItem {
- backTitle = backBarButtonItem.title ?? self.presentationData.strings.back
- } else {
- backTitle = itemValue.title ?? self.presentationData.strings.back
- }
- case .close:
- backTitle = nil
- }
- }
-
- if let backTitle = backTitle {
- self.backButtonNode.updateManualText(backTitle, isBack: true)
- if self.backButtonNode.supernode == nil {
- self.buttonsContainerNode.addSubnode(self.backButtonNode)
- self.buttonsContainerNode.addSubnode(self.backButtonArrow)
- self.buttonsContainerNode.addSubnode(self.badgeNode)
- }
-
- if animated {
- self.backButtonNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.25)
- self.backButtonArrow.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.25)
- self.badgeNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.25)
- }
- } else {
- self.backButtonNode.removeFromSupernode()
- }
- }
- } else {
- self.leftButtonNode.removeFromSupernode()
- self.backButtonNode.removeFromSupernode()
- self.backButtonArrow.removeFromSupernode()
- self.badgeNode.removeFromSupernode()
- }
-
- self.updateAccessibilityElements()
- }
-
- private func updateRightButton(animated: Bool) {
- if let item = self.item {
- var items: [UIBarButtonItem] = []
- if let rightBarButtonItems = item.rightBarButtonItems, !rightBarButtonItems.isEmpty {
- items = rightBarButtonItems
- } else if let rightBarButtonItem = item.rightBarButtonItem {
- items = [rightBarButtonItem]
- }
-
- self.rightButtonNodeUpdated = true
-
- if !items.isEmpty {
- self.rightButtonNode.updateItems([], animated: animated)
- self.rightButtonNode.updateItems(items, animated: animated)
- if self.rightButtonNode.supernode == nil {
- self.buttonsContainerNode.addSubnode(self.rightButtonNode)
- }
- } else {
- if animated, self.rightButtonNode.view.superview != nil {
- if let snapshotView = self.rightButtonNode.view.snapshotContentTree() {
- snapshotView.frame = self.rightButtonNode.frame
- self.rightButtonNode.view.superview?.insertSubview(snapshotView, aboveSubview: self.rightButtonNode.view)
- snapshotView.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.15, removeOnCompletion: false, completion: { [weak snapshotView] _ in
- snapshotView?.removeFromSuperview()
- })
- }
- }
- self.rightButtonNode.removeFromSupernode()
- }
- } else {
- if animated, self.rightButtonNode.view.superview != nil {
- if let snapshotView = self.rightButtonNode.view.snapshotContentTree() {
- snapshotView.frame = self.rightButtonNode.frame
- self.rightButtonNode.view.superview?.insertSubview(snapshotView, aboveSubview: self.rightButtonNode.view)
- snapshotView.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.15, removeOnCompletion: false, completion: { [weak snapshotView] _ in
- snapshotView?.removeFromSuperview()
- })
- }
- }
- self.rightButtonNode.removeFromSupernode()
- }
-
- self.updateAccessibilityElements()
- }
-
- public let backgroundNode: NavigationBackgroundNode
- public let backButtonNode: NavigationButtonNode
- public let badgeNode: NavigationBarBadgeNode
- public let backButtonArrow: ASImageNode
- public let leftButtonNode: NavigationButtonNode
- public let rightButtonNode: NavigationButtonNode
- private var rightButtonNodeUpdated: Bool = false
- public let additionalContentNode: SparseNode
-
- private let navigationBackgroundCutoutView: NavigationBackgroundCutoutView
-
- public func reattachAdditionalContentNode() {
- if self.additionalContentNode.supernode !== self {
- self.insertSubnode(self.additionalContentNode, aboveSubnode: self.clippingNode)
- }
- }
-
- private var _transitionState: NavigationBarTransitionState?
- var transitionState: NavigationBarTransitionState? {
- get {
- return self._transitionState
- } set(value) {
- let updateNodes = self._transitionState?.navigationBar !== value?.navigationBar
-
- self._transitionState = value
-
- if updateNodes {
- if let transitionTitleNode = self.transitionTitleNode {
- transitionTitleNode.removeFromSupernode()
- self.transitionTitleNode = nil
- }
-
- if let transitionBackButtonNode = self.transitionBackButtonNode {
- transitionBackButtonNode.removeFromSupernode()
- self.transitionBackButtonNode = nil
- }
-
- if let transitionBackArrowNode = self.transitionBackArrowNode {
- transitionBackArrowNode.removeFromSupernode()
- self.transitionBackArrowNode = nil
- }
-
- if let transitionBadgeNode = self.transitionBadgeNode {
- transitionBadgeNode.removeFromSupernode()
- self.transitionBadgeNode = nil
- }
-
- if let value = value {
- switch value.role {
- case .top:
- if let transitionTitleNode = value.navigationBar?.makeTransitionTitleNode(foregroundColor: self.presentationData.theme.primaryTextColor) {
- self.transitionTitleNode = transitionTitleNode
- if self.leftButtonNode.supernode != nil {
- self.buttonsContainerNode.insertSubnode(transitionTitleNode, belowSubnode: self.leftButtonNode)
- } else if self.backButtonNode.supernode != nil {
- self.buttonsContainerNode.insertSubnode(transitionTitleNode, belowSubnode: self.backButtonNode)
- } else {
- self.buttonsContainerNode.addSubnode(transitionTitleNode)
- }
- }
- case .bottom:
- if let transitionBackButtonNode = value.navigationBar?.makeTransitionBackButtonNode(accentColor: self.presentationData.theme.buttonColor) {
- self.transitionBackButtonNode = transitionBackButtonNode
- self.buttonsContainerNode.addSubnode(transitionBackButtonNode)
- }
- if let transitionBackArrowNode = value.navigationBar?.makeTransitionBackArrowNode(accentColor: self.presentationData.theme.buttonColor) {
- self.transitionBackArrowNode = transitionBackArrowNode
- self.buttonsContainerNode.addSubnode(transitionBackArrowNode)
- }
- if let transitionBadgeNode = value.navigationBar?.makeTransitionBadgeNode() {
- self.transitionBadgeNode = transitionBadgeNode
- self.buttonsContainerNode.addSubnode(transitionBadgeNode)
- }
- }
- }
- }
-
- self.requestedLayout = true
- self.layout()
- }
- }
-
- private var transitionTitleNode: ASDisplayNode?
- private var transitionBackButtonNode: NavigationButtonNode?
- private var transitionBackArrowNode: ASDisplayNode?
- private var transitionBadgeNode: ASDisplayNode?
-
- public var secondaryContentHeight: CGFloat
-
- public init(presentationData: NavigationBarPresentationData) {
- self.presentationData = presentationData
- self.stripeNode = ASDisplayNode()
-
- self.titleNode = ImmediateTextNode()
- self.titleNode.isAccessibilityElement = true
- self.titleNode.accessibilityTraits = .header
-
- self.backButtonNode = NavigationButtonNode()
- self.backButtonNode.hitTestSlop = UIEdgeInsets(top: 0.0, left: -20.0, bottom: 0.0, right: 0.0)
-
- self.badgeNode = NavigationBarBadgeNode(fillColor: self.presentationData.theme.buttonColor, strokeColor: self.presentationData.theme.buttonColor, textColor: self.presentationData.theme.badgeTextColor)
- self.badgeNode.isUserInteractionEnabled = false
- self.badgeNode.isHidden = true
- self.backButtonArrow = ASImageNode()
- self.backButtonArrow.displayWithoutProcessing = true
- self.backButtonArrow.displaysAsynchronously = false
- self.backButtonArrow.isUserInteractionEnabled = false
- self.leftButtonNode = NavigationButtonNode()
- self.rightButtonNode = NavigationButtonNode()
- self.rightButtonNode.hitTestSlop = UIEdgeInsets(top: -4.0, left: -4.0, bottom: -4.0, right: -10.0)
-
- self.clippingNode = SparseNode()
- self.clippingNode.clipsToBounds = true
-
- self.buttonsContainerNode = ASDisplayNode()
- self.buttonsContainerNode.clipsToBounds = true
-
- self.backButtonNode.color = self.presentationData.theme.buttonColor
- self.backButtonNode.disabledColor = self.presentationData.theme.disabledButtonColor
- self.leftButtonNode.color = self.presentationData.theme.buttonColor
- self.leftButtonNode.disabledColor = self.presentationData.theme.disabledButtonColor
- self.rightButtonNode.color = self.presentationData.theme.buttonColor
- self.rightButtonNode.disabledColor = self.presentationData.theme.disabledButtonColor
- self.rightButtonNode.rippleColor = self.presentationData.theme.primaryTextColor.withAlphaComponent(0.05)
- self.backButtonArrow.image = NavigationBar.backArrowImage(color: self.presentationData.theme.buttonColor)
- if let title = self.title {
- self.titleNode.attributedText = NSAttributedString(string: title, font: NavigationBar.titleFont, textColor: self.presentationData.theme.primaryTextColor)
- self.titleNode.accessibilityLabel = title
- }
- self.stripeNode.backgroundColor = self.presentationData.theme.separatorColor
-
- self.backgroundNode = NavigationBackgroundNode(color: self.presentationData.theme.backgroundColor, enableBlur: self.presentationData.theme.enableBackgroundBlur)
- self.additionalContentNode = SparseNode()
-
- self.secondaryContentHeight = NavigationBar.defaultSecondaryContentHeight
-
- self.navigationBackgroundCutoutView = NavigationBackgroundCutoutView(frame: CGRect())
- self.navigationBackgroundCutoutView.targetNode = self.backgroundNode
-
- super.init()
-
- self.addSubnode(self.backgroundNode)
- self.addSubnode(self.buttonsContainerNode)
- self.addSubnode(self.clippingNode)
- self.addSubnode(self.additionalContentNode)
-
- self.backgroundColor = nil
- self.isOpaque = false
-
- self.stripeNode.isLayerBacked = true
- self.stripeNode.displaysAsynchronously = false
- self.addSubnode(self.stripeNode)
-
- self.titleNode.displaysAsynchronously = false
- self.titleNode.maximumNumberOfLines = 1
- self.titleNode.truncationType = .end
- self.titleNode.isOpaque = false
-
- self.backButtonNode.highlightChanged = { [weak self] index, highlighted in
- if let strongSelf = self, index == 0 {
- strongSelf.backButtonArrow.alpha = (highlighted ? 0.4 : 1.0)
- strongSelf.badgeNode.alpha = (highlighted ? 0.4 : 1.0)
- }
- }
- self.backButtonNode.pressed = { [weak self] index in
- if let strongSelf = self, index == 0 {
- if let leftBarButtonItem = strongSelf.item?.leftBarButtonItem, leftBarButtonItem.backButtonAppearance {
- leftBarButtonItem.performActionOnTarget()
- } else {
- strongSelf.backPressed()
- }
- }
- }
-
- self.leftButtonNode.pressed = { [weak self] index in
- if let item = self?.item {
- if index == 0 {
- if let leftBarButtonItem = item.leftBarButtonItem {
- leftBarButtonItem.performActionOnTarget()
- } else if let previousItem = self?.previousItem, case .close = previousItem {
- self?.backPressed()
- }
- }
- }
- }
-
- self.rightButtonNode.pressed = { [weak self] index in
- if let item = self?.item {
- if let rightBarButtonItems = item.rightBarButtonItems, !rightBarButtonItems.isEmpty {
- if index < rightBarButtonItems.count {
- rightBarButtonItems[index].performActionOnTarget()
- }
- } else if let rightBarButtonItem = item.rightBarButtonItem {
- rightBarButtonItem.performActionOnTarget()
- }
- }
- }
- }
-
- public var isBackgroundVisible: Bool {
- return self.backgroundNode.alpha == 1.0
- }
-
- public func updateBackgroundAlpha(_ alpha: CGFloat, transition: ContainedViewLayoutTransition) {
- let alpha = max(0.0, min(1.0, alpha))
- transition.updateAlpha(node: self.backgroundNode, alpha: alpha, delay: 0.15)
- transition.updateAlpha(node: self.stripeNode, alpha: alpha, delay: 0.15)
- }
-
- public func updatePresentationData(_ presentationData: NavigationBarPresentationData, transition: ContainedViewLayoutTransition = .immediate) {
- if presentationData.theme !== self.presentationData.theme || presentationData.strings !== self.presentationData.strings {
- self.presentationData = presentationData
-
- self.backgroundNode.updateColor(color: self.presentationData.theme.backgroundColor, transition: transition)
-
- self.backButtonNode.color = self.presentationData.theme.buttonColor
- self.backButtonNode.disabledColor = self.presentationData.theme.disabledButtonColor
- self.leftButtonNode.color = self.presentationData.theme.buttonColor
- self.leftButtonNode.disabledColor = self.presentationData.theme.disabledButtonColor
- self.rightButtonNode.color = self.presentationData.theme.buttonColor
- self.rightButtonNode.disabledColor = self.presentationData.theme.disabledButtonColor
- self.rightButtonNode.rippleColor = self.presentationData.theme.primaryTextColor.withAlphaComponent(0.05)
- self.backButtonArrow.image = NavigationBar.backArrowImage(color: self.presentationData.theme.buttonColor)
- if let title = self.title {
- self.titleNode.attributedText = NSAttributedString(string: title, font: NavigationBar.titleFont, textColor: self.presentationData.theme.primaryTextColor)
- self.titleNode.accessibilityLabel = title
- }
- self.stripeNode.backgroundColor = self.presentationData.theme.separatorColor
-
- self.badgeNode.updateTheme(fillColor: self.presentationData.theme.buttonColor, strokeColor: self.presentationData.theme.buttonColor, textColor: self.presentationData.theme.badgeTextColor)
-
- self.updateLeftButton(animated: false)
- self.requestLayout()
- }
- }
-
- private func requestLayout() {
- self.requestedLayout = true
- self.setNeedsLayout()
- }
-
- override open func layout() {
- super.layout()
-
- if let validLayout = self.validLayout, self.requestedLayout {
- self.requestedLayout = false
- self.updateLayout(size: validLayout.size, defaultHeight: validLayout.defaultHeight, additionalTopHeight: validLayout.additionalTopHeight, additionalContentHeight: validLayout.additionalContentHeight, additionalBackgroundHeight: validLayout.additionalBackgroundHeight, additionalCutout: validLayout.additionalCutout, leftInset: validLayout.leftInset, rightInset: validLayout.rightInset, appearsHidden: validLayout.appearsHidden, isLandscape: validLayout.isLandscape, transition: .immediate)
- }
- }
-
- func updateLayout(size: CGSize, defaultHeight: CGFloat, additionalTopHeight: CGFloat, additionalContentHeight: CGFloat, additionalBackgroundHeight: CGFloat, additionalCutout: CGSize?, leftInset: CGFloat, rightInset: CGFloat, appearsHidden: Bool, isLandscape: Bool, transition: ContainedViewLayoutTransition) {
- if self.layoutSuspended {
- return
- }
-
- self.validLayout = (size, defaultHeight, additionalTopHeight, additionalContentHeight, additionalBackgroundHeight, additionalCutout, leftInset, rightInset, appearsHidden, isLandscape)
-
- let backgroundFrame = CGRect(origin: CGPoint(), size: CGSize(width: size.width, height: size.height + additionalBackgroundHeight))
- if self.backgroundNode.frame != backgroundFrame {
- transition.updateFrame(node: self.backgroundNode, frame: backgroundFrame)
- self.backgroundNode.update(size: backgroundFrame.size, transition: transition)
-
- transition.updateFrame(view: self.navigationBackgroundCutoutView, frame: CGRect(origin: CGPoint(), size: backgroundFrame.size))
- }
- self.navigationBackgroundCutoutView.update(size: backgroundFrame.size, cutout: additionalCutout, transition: transition)
-
- let apparentAdditionalHeight: CGFloat = self.secondaryContentNode != nil ? (self.secondaryContentHeight * self.secondaryContentNodeDisplayFraction) : 0.0
-
- let leftButtonInset: CGFloat = leftInset + 16.0
- let backButtonInset: CGFloat = leftInset + 27.0
-
- transition.updateFrame(node: self.clippingNode, frame: CGRect(origin: CGPoint(), size: size))
- transition.updateFrame(node: self.additionalContentNode, frame: CGRect(origin: CGPoint(), size: CGSize(width: size.width, height: size.height + additionalBackgroundHeight)))
- transition.updateFrame(node: self.buttonsContainerNode, frame: CGRect(origin: CGPoint(), size: size))
- var expansionHeight: CGFloat = 0.0
- if let contentNode = self.contentNode {
- var contentNodeFrame: CGRect
- switch contentNode.mode {
- case .replacement:
- expansionHeight = contentNode.height - defaultHeight
- contentNodeFrame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: size.width, height: size.height - additionalContentHeight))
- case .expansion:
- expansionHeight = contentNode.height
-
- let additionalExpansionHeight: CGFloat = self.secondaryContentNode != nil && appearsHidden ? (self.secondaryContentHeight * self.secondaryContentNodeDisplayFraction) : 0.0
- contentNodeFrame = CGRect(origin: CGPoint(x: 0.0, y: size.height - (appearsHidden ? 0.0 : additionalContentHeight) - expansionHeight - apparentAdditionalHeight - additionalExpansionHeight), size: CGSize(width: size.width, height: expansionHeight))
- if appearsHidden {
- if self.secondaryContentNode != nil {
- contentNodeFrame.origin.y += self.secondaryContentHeight * self.secondaryContentNodeDisplayFraction
- }
- }
- }
- transition.updateFrame(node: contentNode, frame: contentNodeFrame)
- contentNode.updateLayout(size: contentNodeFrame.size, leftInset: leftInset, rightInset: rightInset, transition: transition)
- }
-
- transition.updateFrame(node: self.stripeNode, frame: CGRect(x: (additionalCutout?.width ?? 0.0), y: size.height + additionalBackgroundHeight, width: size.width - (additionalCutout?.width ?? 0.0), height: UIScreenPixel))
-
- let nominalHeight: CGFloat = defaultHeight
- let contentVerticalOrigin = additionalTopHeight
-
- var leftTitleInset: CGFloat = leftInset + 1.0
- var rightTitleInset: CGFloat = rightInset + 1.0
- if self.backButtonNode.supernode != nil {
- let backButtonSize = self.backButtonNode.updateLayout(constrainedSize: CGSize(width: size.width, height: nominalHeight), isLandscape: isLandscape, isLeftAligned: true)
- leftTitleInset = backButtonSize.width + backButtonInset + 1.0
-
- let topHitTestSlop = (nominalHeight - backButtonSize.height) * 0.5
- self.backButtonNode.hitTestSlop = UIEdgeInsets(top: -topHitTestSlop, left: -27.0, bottom: -topHitTestSlop, right: -8.0)
-
- if let transitionState = self.transitionState {
- let progress = transitionState.progress
-
- switch transitionState.role {
- case .top:
- let initialX: CGFloat = backButtonInset
- let finalX: CGFloat = floor((size.width - backButtonSize.width) / 2.0) - size.width
-
- let backButtonFrame = CGRect(origin: CGPoint(x: initialX * (1.0 - progress) + finalX * progress, y: contentVerticalOrigin + floor((nominalHeight - backButtonSize.height) / 2.0)), size: backButtonSize)
- if self.backButtonNode.frame != backButtonFrame {
- self.backButtonNode.frame = backButtonFrame
- }
- let backButtonAlpha = self.backButtonNode.alpha
- if self.backButtonNode.alpha != backButtonAlpha {
- self.backButtonNode.alpha = backButtonAlpha
- }
-
- if let transitionTitleNode = self.transitionTitleNode {
- let transitionTitleSize = transitionTitleNode.measure(CGSize(width: size.width, height: nominalHeight))
-
- let initialX: CGFloat = backButtonInset + floor((backButtonSize.width - transitionTitleSize.width) / 2.0)
- let finalX: CGFloat = floor((size.width - transitionTitleSize.width) / 2.0) - size.width
-
- transitionTitleNode.frame = CGRect(origin: CGPoint(x: initialX * (1.0 - progress) + finalX * progress, y: contentVerticalOrigin + floor((nominalHeight - transitionTitleSize.height) / 2.0)), size: transitionTitleSize)
- transitionTitleNode.alpha = progress * progress
- }
-
- self.backButtonArrow.frame = CGRect(origin: CGPoint(x: leftInset + 8.0 - progress * size.width, y: contentVerticalOrigin + floor((nominalHeight - 22.0) / 2.0)), size: CGSize(width: 13.0, height: 22.0))
- self.backButtonArrow.alpha = max(0.0, 1.0 - progress * 1.3)
- self.badgeNode.alpha = max(0.0, 1.0 - progress * 1.3)
- case .bottom:
- self.backButtonNode.alpha = 1.0
- self.backButtonNode.frame = CGRect(origin: CGPoint(x: backButtonInset, y: contentVerticalOrigin + floor((nominalHeight - backButtonSize.height) / 2.0)), size: backButtonSize)
- self.backButtonArrow.alpha = 1.0
- self.backButtonArrow.frame = CGRect(origin: CGPoint(x: leftInset + 8.0, y: contentVerticalOrigin + floor((nominalHeight - 22.0) / 2.0)), size: CGSize(width: 13.0, height: 22.0))
- self.badgeNode.alpha = 1.0
- }
- } else {
- self.backButtonNode.alpha = 1.0
- transition.updateFrame(node: self.backButtonNode, frame: CGRect(origin: CGPoint(x: backButtonInset, y: contentVerticalOrigin + floor((nominalHeight - backButtonSize.height) / 2.0)), size: backButtonSize))
-
- self.backButtonArrow.alpha = 1.0
- transition.updateFrame(node: self.backButtonArrow, frame: CGRect(origin: CGPoint(x: leftInset + 8.0, y: contentVerticalOrigin + floor((nominalHeight - 22.0) / 2.0)), size: CGSize(width: 13.0, height: 22.0)))
- self.badgeNode.alpha = 1.0
- }
- } else if self.leftButtonNode.supernode != nil {
- let leftButtonSize = self.leftButtonNode.updateLayout(constrainedSize: CGSize(width: size.width, height: nominalHeight), isLandscape: isLandscape, isLeftAligned: true)
- leftTitleInset = leftButtonSize.width + leftButtonInset + 1.0
-
- var transition = transition
- if self.leftButtonNode.frame.width.isZero {
- transition = .immediate
- }
-
- self.leftButtonNode.alpha = 1.0
- transition.updateFrame(node: self.leftButtonNode, frame: CGRect(origin: CGPoint(x: leftButtonInset, y: contentVerticalOrigin + floor((nominalHeight - leftButtonSize.height) / 2.0)), size: leftButtonSize))
- }
-
- let badgeSize = self.badgeNode.measure(CGSize(width: 200.0, height: 100.0))
- let backButtonArrowFrame = self.backButtonArrow.frame
- transition.updateFrame(node: self.badgeNode, frame: CGRect(origin: backButtonArrowFrame.origin.offsetBy(dx: 16.0, dy: 2.0), size: badgeSize))
-
- if self.rightButtonNode.supernode != nil {
- let rightButtonSize = self.rightButtonNode.updateLayout(constrainedSize: (CGSize(width: size.width, height: nominalHeight)), isLandscape: isLandscape, isLeftAligned: false)
- rightTitleInset = rightButtonSize.width + leftButtonInset + 1.0
- self.rightButtonNode.alpha = 1.0
-
- var transition = transition
- if self.rightButtonNode.frame.width.isZero || self.rightButtonNodeUpdated {
- transition = .immediate
- }
-
- transition.updateFrame(node: self.rightButtonNode, frame: CGRect(origin: CGPoint(x: size.width - leftButtonInset - rightButtonSize.width, y: contentVerticalOrigin + floor((nominalHeight - rightButtonSize.height) / 2.0)), size: rightButtonSize))
- }
- self.rightButtonNodeUpdated = false
-
- if let transitionState = self.transitionState {
- let progress = transitionState.progress
-
- switch transitionState.role {
- case .top:
- break
- case .bottom:
- if let transitionBackButtonNode = self.transitionBackButtonNode {
- let transitionBackButtonSize = transitionBackButtonNode.updateLayout(constrainedSize: CGSize(width: size.width, height: nominalHeight), isLandscape: isLandscape, isLeftAligned: true)
- let initialX: CGFloat = backButtonInset + size.width * 0.3
- let finalX: CGFloat = floor((size.width - transitionBackButtonSize.width) / 2.0)
-
- transitionBackButtonNode.frame = CGRect(origin: CGPoint(x: initialX * (1.0 - progress) + finalX * progress, y: contentVerticalOrigin + floor((nominalHeight - transitionBackButtonSize.height) / 2.0)), size: transitionBackButtonSize)
- transitionBackButtonNode.alpha = (1.0 - progress) * (1.0 - progress)
- }
-
- if let transitionBackArrowNode = self.transitionBackArrowNode {
- let initialX: CGFloat = leftInset + 8.0 + size.width * 0.3
- let finalX: CGFloat = leftInset + 8.0
-
- transitionBackArrowNode.frame = CGRect(origin: CGPoint(x: initialX * (1.0 - progress) + finalX * progress, y: contentVerticalOrigin + floor((nominalHeight - 22.0) / 2.0)), size: CGSize(width: 13.0, height: 22.0))
- transitionBackArrowNode.alpha = max(0.0, 1.0 - progress * 1.3)
-
- if let transitionBadgeNode = self.transitionBadgeNode {
- transitionBadgeNode.frame = CGRect(origin: transitionBackArrowNode.frame.origin.offsetBy(dx: 16.0, dy: 2.0), size: transitionBadgeNode.bounds.size)
- transitionBadgeNode.alpha = transitionBackArrowNode.alpha
- }
- }
- }
- }
-
- leftTitleInset = floor(leftTitleInset)
- if Int(leftTitleInset) % 2 != 0 {
- leftTitleInset -= 1.0
- }
-
- if let customHeaderContentView = self.customHeaderContentView {
- let headerSize = CGSize(width: size.width, height: nominalHeight)
- var customHeaderFrame = CGRect(origin: CGPoint(x: 0.0, y: contentVerticalOrigin), size: headerSize)
- if appearsHidden {
- customHeaderFrame.origin.y = -customHeaderFrame.height
- }
- transition.updateFrame(view: customHeaderContentView, frame: customHeaderFrame)
- }
-
- if self.titleNode.supernode != nil {
- let titleSize = self.titleNode.updateLayout(CGSize(width: max(1.0, size.width - max(leftTitleInset, rightTitleInset) * 2.0), height: nominalHeight))
-
- if let transitionState = self.transitionState, let otherNavigationBar = transitionState.navigationBar {
- let progress = transitionState.progress
-
- switch transitionState.role {
- case .top:
- let initialX = floor((size.width - titleSize.width) / 2.0)
- let finalX: CGFloat = leftButtonInset
-
- self.titleNode.frame = CGRect(origin: CGPoint(x: initialX * (1.0 - progress) + finalX * progress, y: contentVerticalOrigin + floorToScreenPixels((nominalHeight - titleSize.height) / 2.0)), size: titleSize)
- self.titleNode.alpha = (1.0 - progress) * (1.0 - progress)
- case .bottom:
- var initialX: CGFloat = backButtonInset
- if otherNavigationBar.backButtonNode.supernode != nil {
- initialX += floor((otherNavigationBar.backButtonNode.frame.size.width - titleSize.width) / 2.0)
- }
- initialX += size.width * 0.3
- let finalX: CGFloat = floor((size.width - titleSize.width) / 2.0)
-
- self.titleNode.frame = CGRect(origin: CGPoint(x: initialX * (1.0 - progress) + finalX * progress, y: contentVerticalOrigin + floorToScreenPixels((nominalHeight - titleSize.height) / 2.0)), size: titleSize)
- self.titleNode.alpha = progress * progress
- }
- } else {
- var transition = transition
- if self.titleNode.frame.width.isZero {
- transition = .immediate
- }
- self.titleNode.alpha = 1.0
-
- var titleOffset: CGFloat = 0.0
- if self.presentationData.theme.backgroundColor == .clear && self.presentationData.theme.separatorColor == .clear {
- titleOffset += 3.0
- }
- transition.updateFrame(node: self.titleNode, frame: CGRect(origin: CGPoint(x: floor((size.width - titleSize.width) / 2.0), y: contentVerticalOrigin + titleOffset + floorToScreenPixels((nominalHeight - titleSize.height) / 2.0)), size: titleSize))
- }
- }
-
- if let titleView = self.titleView {
- let titleSize = CGSize(width: max(1.0, size.width - max(leftTitleInset, rightTitleInset) * 2.0), height: nominalHeight)
- let titleFrame = CGRect(origin: CGPoint(x: floor((size.width - titleSize.width) / 2.0), y: contentVerticalOrigin + floorToScreenPixels((nominalHeight - titleSize.height) / 2.0)), size: titleSize)
- var titleViewTransition = transition
- if titleView.frame.isEmpty {
- titleViewTransition = .immediate
- titleView.frame = titleFrame
- }
-
- titleViewTransition.updateFrame(view: titleView, frame: titleFrame)
-
- if let titleView = titleView as? NavigationBarTitleView {
- let titleWidth = size.width - (leftTitleInset > 0.0 ? leftTitleInset : rightTitleInset) - (rightTitleInset > 0.0 ? rightTitleInset : leftTitleInset)
-
- let _ = titleView.updateLayout(size: titleFrame.size, clearBounds: CGRect(origin: CGPoint(x: leftTitleInset - titleFrame.minX, y: 0.0), size: CGSize(width: titleWidth, height: titleFrame.height)), transition: titleViewTransition)
- }
-
- if let transitionState = self.transitionState, let otherNavigationBar = transitionState.navigationBar {
- let progress = transitionState.progress
-
- switch transitionState.role {
- case .top:
- let initialX = floor((size.width - titleSize.width) / 2.0)
- let finalX: CGFloat = leftButtonInset
-
- titleView.frame = CGRect(origin: CGPoint(x: initialX * (1.0 - progress) + finalX * progress, y: contentVerticalOrigin + floorToScreenPixels((nominalHeight - titleSize.height) / 2.0)), size: titleSize)
- titleView.alpha = (1.0 - progress) * (1.0 - progress)
- case .bottom:
- var initialX: CGFloat = backButtonInset
- if otherNavigationBar.backButtonNode.supernode != nil {
- initialX += floor((otherNavigationBar.backButtonNode.frame.size.width - titleSize.width) / 2.0)
- }
- initialX += size.width * 0.3
- let finalX: CGFloat = floor((size.width - titleSize.width) / 2.0)
-
- titleView.frame = CGRect(origin: CGPoint(x: initialX * (1.0 - progress) + finalX * progress, y: contentVerticalOrigin + floorToScreenPixels((nominalHeight - titleSize.height) / 2.0)), size: titleSize)
- titleView.alpha = progress * progress
- }
- } else {
- if self.hintAnimateTitleNodeOnNextLayout {
- self.hintAnimateTitleNodeOnNextLayout = false
- if let titleView = titleView as? NavigationBarTitleView {
- titleView.animateLayoutTransition()
- }
- }
- titleView.alpha = 1.0
- transition.updateFrame(view: titleView, frame: titleFrame)
- }
- }
- }
-
- public func makeTransitionTitleNode(foregroundColor: UIColor) -> ASDisplayNode? {
- if let titleView = self.titleView {
- if let transitionView = titleView as? NavigationBarTitleTransitionNode {
- return transitionView.makeTransitionMirrorNode()
- } else {
- return nil
- }
- } else if let title = self.title {
- let node = ImmediateTextNode()
- node.attributedText = NSAttributedString(string: title, font: NavigationBar.titleFont, textColor: foregroundColor)
- return node
} else {
return nil
}
}
-
- public func makeTransitionBackButtonNode(accentColor: UIColor) -> NavigationButtonNode? {
- if self.backButtonNode.supernode != nil {
- let node = NavigationButtonNode()
- node.manualAlpha = self.backButtonNode.manualAlpha
- node.updateManualText(self.backButtonNode.manualText)
- node.color = accentColor
- if let validLayout = self.validLayout {
- let _ = node.updateLayout(constrainedSize: CGSize(width: validLayout.size.width, height: validLayout.defaultHeight), isLandscape: validLayout.isLandscape, isLeftAligned: true)
- node.frame = self.backButtonNode.frame
- }
- return node
- } else {
- return nil
- }
- }
-
- public func makeTransitionBackButtonView(accentColor: UIColor) -> UIView? {
- if self.backButtonNode.supernode != nil {
- let node = NavigationButtonNode()
- node.manualAlpha = self.backButtonNode.manualAlpha
- node.updateManualText(self.backButtonNode.manualText)
- node.color = accentColor
- if let validLayout = self.validLayout {
- let _ = node.updateLayout(constrainedSize: CGSize(width: validLayout.size.width, height: validLayout.defaultHeight), isLandscape: validLayout.isLandscape, isLeftAligned: true)
- node.frame = self.backButtonNode.frame
- }
- return node.view
- } else {
- return nil
- }
- }
-
- public func makeTransitionRightButtonNode(accentColor: UIColor) -> NavigationButtonNode? {
- if self.rightButtonNode.supernode != nil {
- let node = NavigationButtonNode()
- var items: [UIBarButtonItem] = []
- if let item = self.item {
- if let rightBarButtonItems = item.rightBarButtonItems, !rightBarButtonItems.isEmpty {
- items = rightBarButtonItems
- } else if let rightBarButtonItem = item.rightBarButtonItem {
- items = [rightBarButtonItem]
- }
- }
- node.updateItems(items, animated: false)
- node.color = accentColor
- if let validLayout = self.validLayout {
- let _ = node.updateLayout(constrainedSize: CGSize(width: validLayout.size.width, height: validLayout.defaultHeight), isLandscape: validLayout.isLandscape, isLeftAligned: false)
- node.frame = self.backButtonNode.frame
- }
- return node
- } else {
- return nil
- }
- }
-
- public func makeTransitionBackArrowNode(accentColor: UIColor) -> ASDisplayNode? {
- if self.backButtonArrow.supernode != nil {
- let node = ASImageNode()
- node.image = NavigationBar.backArrowImage(color: accentColor)
- node.frame = self.backButtonArrow.frame
- node.displayWithoutProcessing = true
- node.displaysAsynchronously = false
- return node
- } else {
- return nil
- }
- }
-
- public func makeTransitionBackArrowView(accentColor: UIColor) -> UIView? {
- if self.backButtonArrow.supernode != nil {
- let view = UIImageView()
- view.image = NavigationBar.backArrowImage(color: accentColor)
- view.frame = self.backButtonArrow.frame
- return view
- } else {
- return nil
- }
- }
-
- public func makeTransitionBadgeNode() -> ASDisplayNode? {
- if self.badgeNode.supernode != nil && !self.badgeNode.isHidden {
- let node = NavigationBarBadgeNode(fillColor: self.presentationData.theme.buttonColor, strokeColor: self.presentationData.theme.buttonColor, textColor: self.presentationData.theme.badgeTextColor)
- node.text = self.badgeNode.text
- let nodeSize = node.measure(CGSize(width: 200.0, height: 100.0))
- node.frame = CGRect(origin: CGPoint(), size: nodeSize)
- return node
- } else {
- return nil
- }
- }
-
- public var intrinsicCanTransitionInline: Bool = true
- public var shouldTransitionInline: (() -> Bool)?
-
- public var passthroughTouches = true
-
- public var canTransitionInline: Bool {
- if let contentNode = self.contentNode, case .replacement = contentNode.mode {
- return false
- } else {
- if let shouldTransitionInline = self.shouldTransitionInline {
- if !shouldTransitionInline() {
- return false
- }
- }
- return self.intrinsicCanTransitionInline
- }
- }
-
- public func contentHeight(defaultHeight: CGFloat) -> CGFloat {
- var result: CGFloat = 0.0
- if let contentNode = self.contentNode {
- switch contentNode.mode {
- case .expansion:
- result += defaultHeight + contentNode.height
- case .replacement:
- result += contentNode.height
- }
- } else {
- result += defaultHeight
- }
-
- if let _ = self.secondaryContentNode {
- result += self.secondaryContentHeight * self.secondaryContentNodeDisplayFraction
- }
-
- return result
- }
-
- public func setContentNode(_ contentNode: NavigationBarContentNode?, animated: Bool) {
- if let customSetContentNode = self.customSetContentNode {
- customSetContentNode(contentNode, animated)
- return
- }
-
- if self.contentNode !== contentNode {
- if let previous = self.contentNode {
- if animated {
- previous.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false, completion: { [weak self, weak previous] _ in
- if let strongSelf = self, let previous = previous {
- if previous !== strongSelf.contentNode {
- previous.removeFromSupernode()
- }
- }
- })
- } else {
- previous.removeFromSupernode()
- }
- }
- self.contentNode = contentNode
- self.contentNode?.requestContainerLayout = { [weak self] transition in
- self?.requestContainerLayout(transition)
- }
- if let contentNode = contentNode {
- contentNode.clipsToBounds = true
- contentNode.layer.removeAnimation(forKey: "opacity")
- self.insertSubnode(contentNode, belowSubnode: self.stripeNode)
- if animated {
- contentNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
- }
-
- if case .replacement = contentNode.mode, !self.buttonsContainerNode.alpha.isZero {
- self.buttonsContainerNode.alpha = 0.0
- if animated {
- self.buttonsContainerNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2)
- }
- }
-
- if !self.bounds.size.width.isZero {
- self.requestedLayout = true
- self.layout()
- } else {
- self.requestLayout()
- }
- } else if self.buttonsContainerNode.alpha.isZero {
- self.buttonsContainerNode.alpha = 1.0
- if animated {
- self.buttonsContainerNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
- }
- }
- }
- }
-
- public func setSecondaryContentNode(_ secondaryContentNode: ASDisplayNode?, animated: Bool = false) {
- if self.secondaryContentNode !== secondaryContentNode {
- if let previous = self.secondaryContentNode, previous.supernode === self.clippingNode {
- if animated {
- previous.layer.animateAlpha(from: previous.alpha, to: 0.0, duration: 0.2, removeOnCompletion: false, completion: { [weak previous] finished in
- if finished {
- previous?.removeFromSupernode()
- previous?.layer.removeAllAnimations()
- }
- })
- } else {
- previous.removeFromSupernode()
- }
- }
- self.secondaryContentNode = secondaryContentNode
- if let secondaryContentNode = secondaryContentNode {
- self.clippingNode.addSubnode(secondaryContentNode)
-
- if animated {
- secondaryContentNode.layer.animateAlpha(from: 0.0, to: secondaryContentNode.alpha, duration: 0.3)
- }
- }
- }
- }
-
- public func executeBack() -> Bool {
- if self.backButtonNode.isInHierarchy {
- self.backButtonNode.pressed(0)
- } else if self.leftButtonNode.isInHierarchy {
- self.leftButtonNode.pressed(0)
- } else {
- self.backButtonNode.pressed(0)
- }
- return true
- }
-
- public func setHidden(_ hidden: Bool, animated: Bool) {
- if let contentNode = self.contentNode, case .replacement = contentNode.mode {
- } else {
- let targetAlpha: CGFloat = hidden ? 0.0 : 1.0
- let previousAlpha = self.buttonsContainerNode.alpha
- if previousAlpha != targetAlpha {
- self.buttonsContainerNode.alpha = targetAlpha
- if animated {
- self.buttonsContainerNode.layer.animateAlpha(from: previousAlpha, to: targetAlpha, duration: 0.2)
- }
- }
- }
- }
-
- override open func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
- if let result = self.additionalContentNode.view.hitTest(self.view.convert(point, to: self.additionalContentNode.view), with: event) {
- return result
- }
-
- if self.frame.minY > -10.0, let customHeaderContentView = self.customHeaderContentView, let result = customHeaderContentView.hitTest(self.view.convert(point, to: customHeaderContentView), with: event) {
- return result
- }
-
- guard let result = super.hitTest(point, with: event) else {
- return nil
- }
-
- if self.passthroughTouches && (result == self.view || result == self.buttonsContainerNode.view) {
- return nil
- }
-
- return result
- }
}
+
+public protocol NavigationButtonCustomDisplayNode {
+ var isHighlightable: Bool { get }
+}
+
+public protocol NavigationButtonNode: ASDisplayNode {
+ func updateManualAlpha(alpha: CGFloat, transition: ContainedViewLayoutTransition)
+ var mainContentNode: ASDisplayNode? { get }
+ var contentsColor: UIColor? { get set }
+}
+
+public protocol NavigationBar: ASDisplayNode {
+ typealias Style = NavigationBarStyle
+
+ var backPressed: () -> Void { get set }
+
+ var userInfo: Any? { get set }
+ var makeCustomTransitionNode: ((NavigationBar, Bool) -> CustomNavigationTransitionNode?)? { get set }
+ var allowsCustomTransition: (() -> Bool)? { get set }
+
+ var stripeNode: ASDisplayNode { get }
+ var clippingNode: SparseNode { get }
+
+ var backgroundView: UIView { get }
+ var customOverBackgroundContentView: UIView { get }
+ var contentNode: NavigationBarContentNode? { get }
+ var secondaryContentNode: ASDisplayNode? { get }
+ var secondaryContentNodeDisplayFraction: CGFloat { get set }
+
+ var item: UINavigationItem? { get set }
+ var customBackButtonText: String? { get }
+ var titleView: UIView? { get }
+ var layoutSuspended: Bool { get set }
+
+ var enableAutomaticBackButton: Bool { get set }
+ var previousItem: NavigationPreviousAction? { get set }
+
+ var backgroundNode: NavigationBackgroundNode { get }
+ var backButtonNode: NavigationButtonNode { get }
+ var badgeNode: NavigationBarBadgeNode { get }
+ var backButtonArrow: ASImageNode { get }
+ var leftButtonNode: NavigationButtonNode { get }
+ var rightButtonNode: NavigationButtonNode { get }
+ var additionalContentNode: SparseNode { get }
+
+ func reattachAdditionalContentNode()
+
+ var secondaryContentHeight: CGFloat { get set }
+
+ var isBackgroundVisible: Bool { get }
+
+ func updateBackgroundAlpha(_ alpha: CGFloat, transition: ContainedViewLayoutTransition)
+ func updatePresentationData(_ presentationData: NavigationBarPresentationData, transition: ContainedViewLayoutTransition)
+
+ var intrinsicCanTransitionInline: Bool { get set }
+
+ var passthroughTouches: Bool { get set }
+
+ var canTransitionInline: Bool { get }
+
+ func contentHeight(defaultHeight: CGFloat) -> CGFloat
+ func setContentNode(_ contentNode: NavigationBarContentNode?, animated: Bool)
+ func setSecondaryContentNode(_ secondaryContentNode: ASDisplayNode?, animated: Bool)
+ func executeBack() -> Bool
+ func setHidden(_ hidden: Bool, animated: Bool)
+
+ var requestContainerLayout: ((ContainedViewLayoutTransition) -> Void)? { get set }
+
+ func updateLayout(size: CGSize, defaultHeight: CGFloat, additionalTopHeight: CGFloat, additionalContentHeight: CGFloat, additionalBackgroundHeight: CGFloat, additionalCutout: CGSize?, leftInset: CGFloat, rightInset: CGFloat, appearsHidden: Bool, isLandscape: Bool, transition: ContainedViewLayoutTransition)
+
+ func updateEdgeEffectExtension(value: CGFloat, transition: ContainedViewLayoutTransition)
+}
+
+public var defaultNavigationBarImpl: ((NavigationBarPresentationData) -> NavigationBar)?
diff --git a/submodules/Display/Source/NavigationBarBadge.swift b/submodules/Display/Source/NavigationBarBadge.swift
index f1236dcc..734eda03 100644
--- a/submodules/Display/Source/NavigationBarBadge.swift
+++ b/submodules/Display/Source/NavigationBarBadge.swift
@@ -12,7 +12,7 @@ public final class NavigationBarBadgeNode: ASDisplayNode {
private let font: UIFont = Font.regular(13.0)
- var text: String = "" {
+ public var text: String = "" {
didSet {
self.textNode.attributedText = NSAttributedString(string: self.text, font: self.font, textColor: self.textColor)
self.invalidateCalculatedLayout()
@@ -39,7 +39,7 @@ public final class NavigationBarBadgeNode: ASDisplayNode {
self.addSubnode(self.textNode)
}
- func updateTheme(fillColor: UIColor, strokeColor: UIColor, textColor: UIColor) {
+ public func updateTheme(fillColor: UIColor, strokeColor: UIColor, textColor: UIColor) {
self.fillColor = fillColor
self.strokeColor = strokeColor
self.textColor = textColor
diff --git a/submodules/Display/Source/NavigationBarContentNode.swift b/submodules/Display/Source/NavigationBarContentNode.swift
index 76862873..6a165a64 100644
--- a/submodules/Display/Source/NavigationBarContentNode.swift
+++ b/submodules/Display/Source/NavigationBarContentNode.swift
@@ -26,6 +26,7 @@ open class NavigationBarContentNode: ASDisplayNode {
return .replacement
}
- open func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, transition: ContainedViewLayoutTransition) {
+ open func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, transition: ContainedViewLayoutTransition) -> CGSize {
+ return size
}
}
diff --git a/submodules/Display/Source/NavigationBarTitleView.swift b/submodules/Display/Source/NavigationBarTitleView.swift
index 408cfb2f..c843151d 100644
--- a/submodules/Display/Source/NavigationBarTitleView.swift
+++ b/submodules/Display/Source/NavigationBarTitleView.swift
@@ -1,8 +1,10 @@
import Foundation
import UIKit
-public protocol NavigationBarTitleView {
+public protocol NavigationBarTitleView: UIView {
+ var requestUpdate: ((ContainedViewLayoutTransition) -> Void)? { get set }
+
func animateLayoutTransition()
- func updateLayout(size: CGSize, clearBounds: CGRect, transition: ContainedViewLayoutTransition) -> CGRect
+ func updateLayout(availableSize: CGSize, transition: ContainedViewLayoutTransition) -> CGSize
}
diff --git a/submodules/Display/Source/NavigationTransitionCoordinator.swift b/submodules/Display/Source/NavigationTransitionCoordinator.swift
index c6167746..707bd537 100644
--- a/submodules/Display/Source/NavigationTransitionCoordinator.swift
+++ b/submodules/Display/Source/NavigationTransitionCoordinator.swift
@@ -201,10 +201,9 @@ final class NavigationTransitionCoordinator {
position = progress
}
- transition.animateView {
- topNavigationBar.transitionState = NavigationBarTransitionState(navigationBar: bottomNavigationBar, transition: self.transition, role: .top, progress: position)
- bottomNavigationBar.transitionState = NavigationBarTransitionState(navigationBar: topNavigationBar, transition: self.transition, role: .bottom, progress: position)
- }
+ let _ = position
+ let _ = topNavigationBar
+ let _ = bottomNavigationBar
}
}
@@ -218,15 +217,16 @@ final class NavigationTransitionCoordinator {
position = progress
}
- topNavigationBar.transitionState = NavigationBarTransitionState(navigationBar: bottomNavigationBar, transition: self.transition, role: .top, progress: position)
- bottomNavigationBar.transitionState = NavigationBarTransitionState(navigationBar: topNavigationBar, transition: self.transition, role: .bottom, progress: position)
+ let _ = position
+ let _ = topNavigationBar
+ let _ = bottomNavigationBar
}
}
func endNavigationBarTransition() {
if let topNavigationBar = self.topNavigationBar, let bottomNavigationBar = self.bottomNavigationBar, self.inlineNavigationBarTransition {
- topNavigationBar.transitionState = nil
- bottomNavigationBar.transitionState = nil
+ let _ = topNavigationBar
+ let _ = bottomNavigationBar
}
}
diff --git a/submodules/Display/Source/SparseContainerView.swift b/submodules/Display/Source/SparseContainerView.swift
new file mode 100644
index 00000000..e9f29977
--- /dev/null
+++ b/submodules/Display/Source/SparseContainerView.swift
@@ -0,0 +1,47 @@
+import Foundation
+import UIKit
+import AsyncDisplayKit
+
+open class SparseNode: ASDisplayNode {
+ override open func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
+ if self.alpha.isZero {
+ return nil
+ }
+ for view in self.view.subviews.reversed() {
+ if let result = view.hitTest(self.view.convert(point, to: view), with: event), result.isUserInteractionEnabled {
+ return result
+ }
+ }
+
+ if !self.bounds.inset(by: self.hitTestSlop).contains(point) {
+ return nil
+ }
+
+ let result = super.hitTest(point, with: event)
+ if result != self.view {
+ return result
+ } else {
+ return nil
+ }
+ }
+}
+
+open class SparseContainerView: UIView {
+ override public func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
+ if self.alpha.isZero {
+ return nil
+ }
+ for view in self.subviews.reversed() {
+ if let result = view.hitTest(self.convert(point, to: view), with: event), result.isUserInteractionEnabled {
+ return result
+ }
+ }
+
+ let result = super.hitTest(point, with: event)
+ if result != self {
+ return result
+ } else {
+ return nil
+ }
+ }
+}
diff --git a/submodules/Display/Source/UIKitUtils.swift b/submodules/Display/Source/UIKitUtils.swift
index 130accaf..23a90c4c 100644
--- a/submodules/Display/Source/UIKitUtils.swift
+++ b/submodules/Display/Source/UIKitUtils.swift
@@ -108,9 +108,13 @@ public extension UIColor {
var green: CGFloat = 0.0
var blue: CGFloat = 0.0
if self.getRed(&red, green: &green, blue: &blue, alpha: nil) {
- return (UInt32(max(0.0, red) * 255.0) << 16) | (UInt32(max(0.0, green) * 255.0) << 8) | (UInt32(max(0.0, blue) * 255.0))
+ let r: UInt32 = UInt32(max(0.0, red) * 255.0)
+ let g: UInt32 = UInt32(max(0.0, green) * 255.0)
+ let b: UInt32 = UInt32(max(0.0, blue) * 255.0)
+ return (r << 16) | (g << 8) | b
} else if self.getWhite(&red, alpha: nil) {
- return (UInt32(max(0.0, red) * 255.0) << 16) | (UInt32(max(0.0, red) * 255.0) << 8) | (UInt32(max(0.0, red) * 255.0))
+ let w: UInt32 = UInt32(max(0.0, red) * 255.0)
+ return (w << 16) | (w << 8) | w
} else {
return 0
}
@@ -122,9 +126,15 @@ public extension UIColor {
var blue: CGFloat = 0.0
var alpha: CGFloat = 0.0
if self.getRed(&red, green: &green, blue: &blue, alpha: &alpha) {
- return (UInt32(alpha * 255.0) << 24) | (UInt32(max(0.0, red) * 255.0) << 16) | (UInt32(max(0.0, green) * 255.0) << 8) | (UInt32(max(0.0, blue) * 255.0))
+ let a: UInt32 = UInt32(alpha * 255.0)
+ let r: UInt32 = UInt32(max(0.0, red) * 255.0)
+ let g: UInt32 = UInt32(max(0.0, green) * 255.0)
+ let b: UInt32 = UInt32(max(0.0, blue) * 255.0)
+ return (a << 24) | (r << 16) | (g << 8) | b
} else if self.getWhite(&red, alpha: &alpha) {
- return (UInt32(max(0.0, alpha) * 255.0) << 24) | (UInt32(max(0.0, red) * 255.0) << 16) | (UInt32(max(0.0, red) * 255.0) << 8) | (UInt32(max(0.0, red) * 255.0))
+ let a: UInt32 = UInt32(max(0.0, alpha) * 255.0)
+ let w: UInt32 = UInt32(max(0.0, red) * 255.0)
+ return (a << 24) | (w << 16) | (w << 8) | w
} else {
return 0
}
diff --git a/submodules/Display/Source/ViewController.swift b/submodules/Display/Source/ViewController.swift
index 593005a7..a1ca2547 100644
--- a/submodules/Display/Source/ViewController.swift
+++ b/submodules/Display/Source/ViewController.swift
@@ -217,6 +217,18 @@ public protocol CustomViewControllerNavigationDataSummary: AnyObject {
open var navigationBarRequiresEntireLayoutUpdate: Bool {
return true
}
+
+ public struct TabBarSearchState: Equatable {
+ public var isActive: Bool
+
+ public init(isActive: Bool) {
+ self.isActive = isActive
+ }
+ }
+
+ public private(set) var tabBarSearchState: TabBarSearchState?
+ public var tabBarSearchStateUpdated: ((ContainedViewLayoutTransition) -> Void)?
+ public var currentTabBarSearchNode: (() -> ASDisplayNode?)?
private weak var activeInputViewCandidate: UIResponder?
private weak var activeInputView: UIResponder?
@@ -237,16 +249,24 @@ public protocol CustomViewControllerNavigationDataSummary: AnyObject {
open var interactiveNavivationGestureEdgeWidth: InteractiveTransitionGestureRecognizerEdgeWidth? {
return nil
}
+
+ open var navigationEdgeEffectExtension: CGFloat {
+ return 0.0
+ }
+
+ public func updateNavigationEdgeEffectExtension(transition: ContainedViewLayoutTransition) {
+ if let navigationBar = self.navigationBar {
+ navigationBar.updateEdgeEffectExtension(value: max(0.0, self.navigationEdgeEffectExtension - navigationBar.frame.maxY), transition: transition)
+ }
+ }
open func navigationLayout(layout: ContainerViewLayout) -> NavigationLayout {
let statusBarHeight: CGFloat = layout.statusBarHeight ?? 0.0
var defaultNavigationBarHeight: CGFloat
if self._presentedInModal && self._hasGlassStyle {
- defaultNavigationBarHeight = 66.0
- } else if self._presentedInModal && layout.orientation == .portrait {
- defaultNavigationBarHeight = 56.0
+ defaultNavigationBarHeight = 68.0
} else {
- defaultNavigationBarHeight = 44.0
+ defaultNavigationBarHeight = 60.0
}
let navigationBarHeight: CGFloat = statusBarHeight + (self.navigationBar?.contentHeight(defaultHeight: defaultNavigationBarHeight) ?? defaultNavigationBarHeight)
@@ -375,7 +395,7 @@ public protocol CustomViewControllerNavigationDataSummary: AnyObject {
public init(navigationBarPresentationData: NavigationBarPresentationData?) {
self.statusBar = StatusBar()
if let navigationBarPresentationData = navigationBarPresentationData {
- self.navigationBar = NavigationBar(presentationData: navigationBarPresentationData)
+ self.navigationBar = defaultNavigationBarImpl!(navigationBarPresentationData)
} else {
self.navigationBar = nil
}
@@ -447,14 +467,29 @@ public protocol CustomViewControllerNavigationDataSummary: AnyObject {
}
if let navigationBar = self.navigationBar {
if let contentNode = navigationBar.contentNode, case .expansion = contentNode.mode, !self.displayNavigationBar {
- navigationBarFrame.origin.y -= navigationLayout.defaultContentHeight
- navigationBarFrame.size.height += contentNode.height + navigationLayout.defaultContentHeight + statusBarHeight
+ navigationBarFrame.origin.y -= navigationLayout.defaultContentHeight + statusBarHeight
+ navigationBarFrame.size.height += contentNode.height + navigationLayout.defaultContentHeight + statusBarHeight * 2.0
+ if self._presentedInModal && self._hasGlassStyle {
+ navigationBarFrame.size.height += 8.0
+ }
}
+ //navigationBar.backgroundColor = .blue
if let _ = navigationBar.contentNode, let _ = navigationBar.secondaryContentNode, !self.displayNavigationBar {
navigationBarFrame.size.height += navigationBar.secondaryContentHeight
}
- navigationBar.updateLayout(size: navigationBarFrame.size, defaultHeight: navigationLayout.defaultContentHeight, additionalTopHeight: statusBarHeight, additionalContentHeight: self.additionalNavigationBarHeight, additionalBackgroundHeight: additionalBackgroundHeight, additionalCutout: additionalCutout, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, appearsHidden: !self.displayNavigationBar, isLandscape: isLandscape, transition: transition)
+ var additionalTopHeight = statusBarHeight
+ if !self.displayNavigationBar {
+ additionalTopHeight -= statusBarHeight
+ if statusBarHeight != 0.0 {
+ additionalTopHeight += 6.0
+ }
+ }
+ if self._presentedInModal && self._hasGlassStyle {
+ additionalTopHeight += 8.0
+ }
+
+ navigationBar.updateLayout(size: navigationBarFrame.size, defaultHeight: navigationLayout.defaultContentHeight, additionalTopHeight: additionalTopHeight, additionalContentHeight: self.additionalNavigationBarHeight, additionalBackgroundHeight: additionalBackgroundHeight, additionalCutout: additionalCutout, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, appearsHidden: !self.displayNavigationBar, isLandscape: isLandscape, transition: transition)
if !transition.isAnimated {
navigationBar.layer.removeAnimation(forKey: "bounds")
navigationBar.layer.removeAnimation(forKey: "position")
@@ -542,14 +577,14 @@ public protocol CustomViewControllerNavigationDataSummary: AnyObject {
UIView.transition(with: navigationBar.view, duration: 0.3, options: [.transitionCrossDissolve], animations: {
}, completion: nil)
}
- self.navigationBar?.updatePresentationData(presentationData)
+ self.navigationBar?.updatePresentationData(presentationData, transition: .immediate)
if let parent = self.parent as? TabBarController {
if parent.currentController === self {
if animated, let navigationBar = parent.navigationBar {
UIView.transition(with: navigationBar.view, duration: 0.3, options: [.transitionCrossDissolve], animations: {
}, completion: nil)
}
- parent.navigationBar?.updatePresentationData(presentationData)
+ parent.navigationBar?.updatePresentationData(presentationData, transition: .immediate)
}
}
}
@@ -705,9 +740,22 @@ public protocol CustomViewControllerNavigationDataSummary: AnyObject {
open func tabBarDisabledAction() {
}
+
+ open func tabBarActivateSearch() {
+ }
+
+ open func tabBarDeactivateSearch() {
+ }
open func tabBarItemSwipeAction(direction: TabBarItemSwipeDirection) {
}
+
+ public func updateTabBarSearchState(_ tabBarSearchState: TabBarSearchState?, transition: ContainedViewLayoutTransition) {
+ if self.tabBarSearchState != tabBarSearchState {
+ self.tabBarSearchState = tabBarSearchState
+ self.tabBarSearchStateUpdated?(transition)
+ }
+ }
open func updatePossibleControllerDropContent(content: NavigationControllerDropContent?) {
}
diff --git a/submodules/FeaturedStickersScreen/Sources/FeaturedStickersScreen.swift b/submodules/FeaturedStickersScreen/Sources/FeaturedStickersScreen.swift
index 25d2f27a..9ed63103 100644
--- a/submodules/FeaturedStickersScreen/Sources/FeaturedStickersScreen.swift
+++ b/submodules/FeaturedStickersScreen/Sources/FeaturedStickersScreen.swift
@@ -919,7 +919,7 @@ public final class FeaturedStickersScreen: ViewController {
private func updatePresentationData() {
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style
- self.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationData: self.presentationData))
+ self.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationData: self.presentationData), transition: .immediate)
self.searchNavigationNode?.updatePresentationData(theme: self.presentationData.theme, strings: self.presentationData.strings)
@@ -980,7 +980,7 @@ private final class SearchNavigationContentNode: NavigationBarContentNode {
self.cancel = cancel
- self.searchBar = SearchBarNode(theme: SearchBarNodeTheme(theme: theme), strings: strings, fieldStyle: .modern, cancelText: strings.Common_Done)
+ self.searchBar = SearchBarNode(theme: SearchBarNodeTheme(theme: theme), presentationTheme: theme, strings: strings, fieldStyle: .modern, cancelText: strings.Common_Done)
let placeholderText = placeholder?(strings) ?? strings.Common_Search
let searchBarFont = Font.regular(17.0)
@@ -1004,7 +1004,7 @@ private final class SearchNavigationContentNode: NavigationBarContentNode {
self.theme = theme
self.strings = strings
- self.searchBar.updateThemeAndStrings(theme: SearchBarNodeTheme(theme: theme), strings: strings)
+ self.searchBar.updateThemeAndStrings(theme: SearchBarNodeTheme(theme: theme), presentationTheme: theme, strings: strings)
}
func setQueryUpdated(_ f: @escaping (String, String?) -> Void) {
@@ -1019,10 +1019,12 @@ private final class SearchNavigationContentNode: NavigationBarContentNode {
return 54.0
}
- override func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, transition: ContainedViewLayoutTransition) {
+ override func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, transition: ContainedViewLayoutTransition) -> CGSize {
let searchBarFrame = CGRect(origin: CGPoint(x: 0.0, y: 1.0 + size.height - self.nominalHeight), size: CGSize(width: size.width, height: 54.0))
self.searchBar.frame = searchBarFrame
self.searchBar.updateLayout(boundingSize: searchBarFrame.size, leftInset: leftInset, rightInset: rightInset, transition: transition)
+
+ return size
}
func activate() {
diff --git a/submodules/GalleryUI/Sources/GalleryController.swift b/submodules/GalleryUI/Sources/GalleryController.swift
index d8af3d8f..e36181f6 100644
--- a/submodules/GalleryUI/Sources/GalleryController.swift
+++ b/submodules/GalleryUI/Sources/GalleryController.swift
@@ -576,8 +576,8 @@ private func galleryEntriesForMessageHistoryEntries(_ entries: [MessageHistoryEn
}
public class GalleryController: ViewController, StandalonePresentableController, KeyShortcutResponder, GalleryControllerProtocol {
- public static let darkNavigationTheme = NavigationBarTheme(buttonColor: .white, disabledButtonColor: UIColor(rgb: 0x525252), primaryTextColor: .white, backgroundColor: UIColor(white: 0.0, alpha: 0.6), enableBackgroundBlur: false, separatorColor: UIColor(white: 0.0, alpha: 0.8), badgeBackgroundColor: .clear, badgeStrokeColor: .clear, badgeTextColor: .clear)
- public static let lightNavigationTheme = NavigationBarTheme(buttonColor: UIColor(rgb: 0x0088ff), disabledButtonColor: UIColor(rgb: 0xd0d0d0), primaryTextColor: .black, backgroundColor: UIColor(red: 0.968626451, green: 0.968626451, blue: 0.968626451, alpha: 1.0), enableBackgroundBlur: false, separatorColor: UIColor(red: 0.6953125, green: 0.6953125, blue: 0.6953125, alpha: 1.0), badgeBackgroundColor: .clear, badgeStrokeColor: .clear, badgeTextColor: .clear)
+ public static let darkNavigationTheme = NavigationBarTheme(overallDarkAppearance: true, buttonColor: .white, disabledButtonColor: UIColor(rgb: 0x525252), primaryTextColor: .white, backgroundColor: UIColor(white: 0.0, alpha: 0.6), enableBackgroundBlur: false, separatorColor: UIColor(white: 0.0, alpha: 0.8), badgeBackgroundColor: .clear, badgeStrokeColor: .clear, badgeTextColor: .clear)
+ public static let lightNavigationTheme = NavigationBarTheme(overallDarkAppearance: false, buttonColor: UIColor(rgb: 0x0088ff), disabledButtonColor: UIColor(rgb: 0xd0d0d0), primaryTextColor: .black, backgroundColor: UIColor(red: 0.968626451, green: 0.968626451, blue: 0.968626451, alpha: 1.0), enableBackgroundBlur: false, separatorColor: UIColor(red: 0.6953125, green: 0.6953125, blue: 0.6953125, alpha: 1.0), badgeBackgroundColor: .clear, badgeStrokeColor: .clear, badgeTextColor: .clear)
private var galleryNode: GalleryControllerNode {
return self.displayNode as! GalleryControllerNode
@@ -942,12 +942,12 @@ public class GalleryController: ViewController, StandalonePresentableController,
switch style {
case .dark:
strongSelf.statusBar.statusBarStyle = .White
- strongSelf.navigationBar?.updatePresentationData(NavigationBarPresentationData(theme: GalleryController.darkNavigationTheme, strings: NavigationBarStrings(presentationStrings: strongSelf.presentationData.strings)))
+ strongSelf.navigationBar?.updatePresentationData(NavigationBarPresentationData(theme: GalleryController.darkNavigationTheme, strings: NavigationBarStrings(presentationStrings: strongSelf.presentationData.strings)), transition: .immediate)
strongSelf.galleryNode.backgroundNode.backgroundColor = UIColor.black
strongSelf.galleryNode.isBackgroundExtendedOverNavigationBar = true
case .light:
strongSelf.statusBar.statusBarStyle = .Black
- strongSelf.navigationBar?.updatePresentationData(NavigationBarPresentationData(theme: GalleryController.darkNavigationTheme, strings: NavigationBarStrings(presentationStrings: strongSelf.presentationData.strings)))
+ strongSelf.navigationBar?.updatePresentationData(NavigationBarPresentationData(theme: GalleryController.darkNavigationTheme, strings: NavigationBarStrings(presentationStrings: strongSelf.presentationData.strings)), transition: .immediate)
strongSelf.galleryNode.backgroundNode.backgroundColor = UIColor(rgb: 0xbdbdc2)
strongSelf.galleryNode.isBackgroundExtendedOverNavigationBar = false
}
diff --git a/submodules/GalleryUI/Sources/GalleryTitleView.swift b/submodules/GalleryUI/Sources/GalleryTitleView.swift
index 8fd42e7c..bfae2810 100644
--- a/submodules/GalleryUI/Sources/GalleryTitleView.swift
+++ b/submodules/GalleryUI/Sources/GalleryTitleView.swift
@@ -14,6 +14,8 @@ final class GalleryTitleView: UIView, NavigationBarTitleView {
private let authorNameNode: ASTextNode
private let dateNode: ASTextNode
+ var requestUpdate: ((ContainedViewLayoutTransition) -> Void)?
+
override init(frame: CGRect) {
self.authorNameNode = ASTextNode()
self.authorNameNode.displaysAsynchronously = false
@@ -41,7 +43,9 @@ final class GalleryTitleView: UIView, NavigationBarTitleView {
self.dateNode.attributedText = NSAttributedString(string: dateText, font: dateFont, textColor: .white)
}
- func updateLayout(size: CGSize, clearBounds: CGRect, transition: ContainedViewLayoutTransition) -> CGRect {
+ func updateLayout(availableSize: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
+ let size = availableSize
+
let leftInset: CGFloat = 0.0
let rightInset: CGFloat = 0.0
@@ -56,7 +60,7 @@ final class GalleryTitleView: UIView, NavigationBarTitleView {
self.dateNode.frame = CGRect(origin: CGPoint(x: floor((size.width - dateSize.width) / 2.0), y: floor((size.height - dateSize.height - authorNameSize.height - labelsSpacing) / 2.0) + authorNameSize.height + labelsSpacing), size: dateSize)
}
- return CGRect()
+ return availableSize
}
func animateLayoutTransition() {
diff --git a/submodules/GalleryUI/Sources/Items/ChatImageGalleryItem.swift b/submodules/GalleryUI/Sources/Items/ChatImageGalleryItem.swift
index 43b4fc92..48fea8c8 100644
--- a/submodules/GalleryUI/Sources/Items/ChatImageGalleryItem.swift
+++ b/submodules/GalleryUI/Sources/Items/ChatImageGalleryItem.swift
@@ -1651,7 +1651,7 @@ private class ImageRecognitionOverlayContentNode: GalleryOverlayContentNode {
if isHidden && !self.buttonNode.isSelected {
buttonPosition = CGPoint(x: size.width - insets.right - buttonSize.width - 59.0, y: -50.0)
} else {
- buttonPosition = CGPoint(x: size.width - insets.right - buttonSize.width - (self.buttonNode.isSelected ? 24.0 : 59.0), y: insets.top - 50.0)
+ buttonPosition = CGPoint(x: size.width - insets.right - buttonSize.width - (self.buttonNode.isSelected ? 24.0 : 59.0), y: insets.top - 58.0)
}
transition.updateFrame(node: self.buttonNode, frame: CGRect(origin: buttonPosition, size: CGSize(width: buttonSize.width + 24.0, height: buttonSize.height + 24.0)))
diff --git a/submodules/HashtagSearchUI/BUILD b/submodules/HashtagSearchUI/BUILD
index eecdc4a8..a7010192 100644
--- a/submodules/HashtagSearchUI/BUILD
+++ b/submodules/HashtagSearchUI/BUILD
@@ -32,6 +32,8 @@ swift_library(
"//submodules/TelegramUI/Components/AnimatedTextComponent",
"//submodules/Components/BlurredBackgroundComponent",
"//submodules/UIKitRuntimeUtils",
+ "//submodules/TelegramUI/Components/HorizontalTabsComponent",
+ "//submodules/TelegramUI/Components/GlassBackgroundComponent",
],
visibility = [
"//visibility:public",
diff --git a/submodules/HashtagSearchUI/Sources/HashtagSearchController.swift b/submodules/HashtagSearchUI/Sources/HashtagSearchController.swift
index 81195028..bc86c96b 100644
--- a/submodules/HashtagSearchUI/Sources/HashtagSearchController.swift
+++ b/submodules/HashtagSearchUI/Sources/HashtagSearchController.swift
@@ -59,7 +59,7 @@ public final class HashtagSearchController: TelegramBaseController {
}
self.presentationData = presentationData
- super.init(context: context, navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData), mediaAccessoryPanelVisibility: .specific(size: .compact), locationBroadcastPanelSource: .none, groupCallPanelSource: .none)
+ super.init(context: context, navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData, style: .glass))
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style
@@ -87,7 +87,7 @@ public final class HashtagSearchController: TelegramBaseController {
if previousTheme !== presentationData.theme || previousStrings !== presentationData.strings {
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style
- self.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationData: self.presentationData))
+ self.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationData: self.presentationData, style: .glass), transition: .immediate)
self.controllerNode.updatePresentationData(self.presentationData)
}
}
diff --git a/submodules/HashtagSearchUI/Sources/HashtagSearchNavigationContentNode.swift b/submodules/HashtagSearchUI/Sources/HashtagSearchNavigationContentNode.swift
index 1a7d6f3e..8390c824 100644
--- a/submodules/HashtagSearchUI/Sources/HashtagSearchNavigationContentNode.swift
+++ b/submodules/HashtagSearchUI/Sources/HashtagSearchNavigationContentNode.swift
@@ -8,7 +8,8 @@ import TelegramPresentationData
import SearchBarNode
import ComponentFlow
import ComponentDisplayAdapters
-import TabSelectorComponent
+import HorizontalTabsComponent
+import GlassBackgroundComponent
private let searchBarFont = Font.regular(17.0)
@@ -23,6 +24,9 @@ final class HashtagSearchNavigationContentNode: NavigationBarContentNode {
var onReturn: (String) -> Void = { _ in }
private let searchBar: SearchBarNode
+
+ private let tabsBackgroundContainer: GlassBackgroundContainerView
+ private let tabsBackgroundView: GlassBackgroundView
private let tabSelector = ComponentView()
private var queryUpdated: ((String) -> Void)?
@@ -31,7 +35,7 @@ final class HashtagSearchNavigationContentNode: NavigationBarContentNode {
var selectedIndex: Int = 0 {
didSet {
if let (size, leftInset, rightInset) = self.validLayout {
- self.updateLayout(size: size, leftInset: leftInset, rightInset: rightInset, transition: .animated(duration: 0.35, curve: .spring))
+ let _ = self.updateLayout(size: size, leftInset: leftInset, rightInset: rightInset, transition: .animated(duration: 0.35, curve: .spring))
}
}
}
@@ -40,7 +44,7 @@ final class HashtagSearchNavigationContentNode: NavigationBarContentNode {
didSet {
if self.transitionFraction != oldValue {
if let (size, leftInset, rightInset) = self.validLayout {
- self.updateLayout(size: size, leftInset: leftInset, rightInset: rightInset, transition: self.transitionFraction == nil ? .animated(duration: 0.35, curve: .spring) : .immediate)
+ let _ = self.updateLayout(size: size, leftInset: leftInset, rightInset: rightInset, transition: self.transitionFraction == nil ? .animated(duration: 0.35, curve: .spring) : .immediate)
}
}
}
@@ -79,12 +83,18 @@ final class HashtagSearchNavigationContentNode: NavigationBarContentNode {
var initialQuery = initialQuery
initialQuery.removeFirst()
- self.searchBar = SearchBarNode(theme: SearchBarNodeTheme(theme: theme, hasSeparator: false), strings: strings, fieldStyle: .modern, icon: icon, displayBackground: false)
+ self.searchBar = SearchBarNode(theme: SearchBarNodeTheme(theme: theme, hasSeparator: false), presentationTheme: theme, strings: strings, fieldStyle: .glass, icon: icon, displayBackground: false)
self.searchBar.text = initialQuery
self.searchBar.placeholderString = NSAttributedString(string: strings.HashtagSearch_SearchPlaceholder, font: searchBarFont, textColor: theme.rootController.navigationSearchBar.inputPlaceholderTextColor)
+ self.tabsBackgroundContainer = GlassBackgroundContainerView()
+ self.tabsBackgroundView = GlassBackgroundView()
+
super.init()
+ self.tabsBackgroundContainer.contentView.addSubview(self.tabsBackgroundView)
+ self.view.addSubview(self.tabsBackgroundContainer)
+
self.searchBar.autocapitalization = .none
if hasCurrentChat {
@@ -111,7 +121,7 @@ final class HashtagSearchNavigationContentNode: NavigationBarContentNode {
func updateTheme(_ theme: PresentationTheme) {
self.theme = theme
- self.searchBar.updateThemeAndStrings(theme: SearchBarNodeTheme(theme: theme, hasSeparator: false), strings: self.strings)
+ self.searchBar.updateThemeAndStrings(theme: SearchBarNodeTheme(theme: theme, hasSeparator: false), presentationTheme: theme, strings: self.strings)
}
func setQueryUpdated(_ f: @escaping (String) -> Void) {
@@ -120,7 +130,7 @@ final class HashtagSearchNavigationContentNode: NavigationBarContentNode {
override var nominalHeight: CGFloat {
if self.hasCurrentChat {
- return 54.0 + 44.0
+ return 64.0 + 44.0
} else {
return 45.0
}
@@ -128,58 +138,98 @@ final class HashtagSearchNavigationContentNode: NavigationBarContentNode {
private var validLayout: (CGSize, CGFloat, CGFloat)?
- override func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, transition: ContainedViewLayoutTransition) {
+ override func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, transition: ContainedViewLayoutTransition) -> CGSize {
self.validLayout = (size, leftInset, rightInset)
let sideInset: CGFloat = 6.0
- let searchBarFrame = CGRect(origin: CGPoint(x: 0.0, y: size.height - self.nominalHeight + 5.0), size: CGSize(width: size.width, height: 54.0))
+ let searchBarFrame = CGRect(origin: CGPoint(x: 0.0, y: 6.0), size: CGSize(width: size.width, height: 44.0))
self.searchBar.frame = searchBarFrame
self.searchBar.updateLayout(boundingSize: searchBarFrame.size, leftInset: leftInset + sideInset, rightInset: rightInset + sideInset, transition: transition)
if self.hasTabs {
- var items: [TabSelectorComponent.Item] = []
+ var items: [HorizontalTabsComponent.Tab] = []
if self.hasCurrentChat {
- items.append(TabSelectorComponent.Item(id: AnyHashable(0), title: self.strings.HashtagSearch_ThisChat))
+ items.append(HorizontalTabsComponent.Tab(
+ id: AnyHashable(0),
+ content: .title(HorizontalTabsComponent.Tab.Title(text: self.strings.HashtagSearch_ThisChat, entities: [], enableAnimations: false)),
+ badge: nil,
+ action: { [weak self] in
+ guard let self else {
+ return
+ }
+ self.indexUpdated?(0)
+ },
+ contextAction: nil,
+ deleteAction: nil
+ ))
}
- items.append(TabSelectorComponent.Item(id: AnyHashable(1), title: self.strings.HashtagSearch_MyMessages))
- items.append(TabSelectorComponent.Item(id: AnyHashable(2), title: self.strings.HashtagSearch_PublicPosts))
+
+ items.append(HorizontalTabsComponent.Tab(
+ id: AnyHashable(1),
+ content: .title(HorizontalTabsComponent.Tab.Title(text: self.strings.HashtagSearch_MyMessages, entities: [], enableAnimations: false)),
+ badge: nil,
+ action: { [weak self] in
+ guard let self else {
+ return
+ }
+ self.indexUpdated?(1)
+ },
+ contextAction: nil,
+ deleteAction: nil
+ ))
+
+ items.append(HorizontalTabsComponent.Tab(
+ id: AnyHashable(2),
+ content: .title(HorizontalTabsComponent.Tab.Title(text: self.strings.HashtagSearch_PublicPosts, entities: [], enableAnimations: false)),
+ badge: nil,
+ action: { [weak self] in
+ guard let self else {
+ return
+ }
+ self.indexUpdated?(2)
+ },
+ contextAction: nil,
+ deleteAction: nil
+ ))
let tabSelectorSize = self.tabSelector.update(
transition: ComponentTransition(transition),
- component: AnyComponent(TabSelectorComponent(
- colors: TabSelectorComponent.Colors(
- foreground: self.theme.list.itemSecondaryTextColor,
- selection: self.theme.list.itemAccentColor
- ),
+ component: AnyComponent(HorizontalTabsComponent(
+ context: nil,
theme: self.theme,
- customLayout: TabSelectorComponent.CustomLayout(
- font: Font.medium(14.0),
- spacing: self.hasCurrentChat ? 24.0 : 8.0,
- lineSelection: true
- ),
- items: items,
- selectedId: AnyHashable(self.selectedIndex),
- setSelectedId: { [weak self] id in
- guard let self, let index = id.base as? Int else {
- return
- }
- self.indexUpdated?(index)
- },
- transitionFraction: self.transitionFraction
+ tabs: items,
+ selectedTab: AnyHashable(self.selectedIndex),
+ isEditing: false
)),
environment: {},
- containerSize: CGSize(width: size.width, height: 44.0)
+ containerSize: CGSize(width: size.width - (leftInset + 16.0) * 2.0, height: 44.0)
)
let tabSelectorFrameOriginX = floorToScreenPixels((size.width - tabSelectorSize.width) / 2.0)
- let tabSelectorFrame = CGRect(origin: CGPoint(x: tabSelectorFrameOriginX, y: size.height - tabSelectorSize.height - 10.0), size: tabSelectorSize)
- if let tabSelectorView = self.tabSelector.view {
+ let tabSelectorFrame = CGRect(origin: CGPoint(x: tabSelectorFrameOriginX, y: searchBarFrame.maxY + 10.0), size: tabSelectorSize)
+
+ transition.updateFrame(view: self.tabsBackgroundContainer, frame: tabSelectorFrame)
+ self.tabsBackgroundContainer.update(size: tabSelectorFrame.size, isDark: self.theme.overallDarkAppearance, transition: ComponentTransition(transition))
+
+ transition.updateFrame(view: self.tabsBackgroundView, frame: CGRect(origin: CGPoint(), size: tabSelectorFrame.size))
+ self.tabsBackgroundView.update(size: tabSelectorFrame.size, cornerRadius: tabSelectorFrame.height * 0.5, isDark: self.theme.overallDarkAppearance, tintColor: .init(kind: .panel, color: UIColor(white: self.theme.overallDarkAppearance ? 0.0 : 1.0, alpha: 0.6)), transition: ComponentTransition(transition))
+
+ if let tabSelectorView = self.tabSelector.view as? HorizontalTabsComponent.View {
if tabSelectorView.superview == nil {
- self.view.addSubview(tabSelectorView)
+ self.tabsBackgroundView.contentView.addSubview(tabSelectorView)
+ tabSelectorView.setOverlayContainerView(overlayContainerView: self.view)
}
- transition.updateFrame(view: tabSelectorView, frame: tabSelectorFrame)
+ transition.updateFrame(view: tabSelectorView, frame: CGRect(origin: CGPoint(), size: tabSelectorFrame.size))
+
+ var transitionFraction: CGFloat = 0.0
+ if let transitionFractionValue = self.transitionFraction {
+ transitionFraction = -transitionFractionValue
+ }
+ tabSelectorView.updateTabSwitchFraction(fraction: transitionFraction, isDragging: false, transition: ComponentTransition(transition))
}
}
+
+ return size
}
func activate() {
diff --git a/submodules/HashtagSearchUI/Sources/HashtagSearchRecentListNode.swift b/submodules/HashtagSearchUI/Sources/HashtagSearchRecentListNode.swift
index b6238082..d2d29fda 100644
--- a/submodules/HashtagSearchUI/Sources/HashtagSearchRecentListNode.swift
+++ b/submodules/HashtagSearchUI/Sources/HashtagSearchRecentListNode.swift
@@ -200,7 +200,7 @@ final class HashtagSearchRecentQueryItemNode: ItemListRevealOptionsItemNode {
self.iconNode = ASImageNode()
self.iconNode.displaysAsynchronously = false
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.addSubnode(self.backgroundNode)
self.addSubnode(self.separatorNode)
diff --git a/submodules/HorizontalPeerItem/Sources/HorizontalPeerItem.swift b/submodules/HorizontalPeerItem/Sources/HorizontalPeerItem.swift
index 0fb1d85b..d7c20dfd 100644
--- a/submodules/HorizontalPeerItem/Sources/HorizontalPeerItem.swift
+++ b/submodules/HorizontalPeerItem/Sources/HorizontalPeerItem.swift
@@ -138,7 +138,7 @@ public final class HorizontalPeerItemNode: ListViewItemNode {
self.onlineNode = PeerOnlineMarkerNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.peerNode)
self.addSubnode(self.badgeBackgroundNode)
diff --git a/submodules/InviteLinksUI/Sources/AdditionalLinkItem.swift b/submodules/InviteLinksUI/Sources/AdditionalLinkItem.swift
index c66e876f..474cded4 100644
--- a/submodules/InviteLinksUI/Sources/AdditionalLinkItem.swift
+++ b/submodules/InviteLinksUI/Sources/AdditionalLinkItem.swift
@@ -170,7 +170,7 @@ public class AdditionalLinkItemNode: ListViewItemNode, ItemListItemNode {
self.highlightedBackgroundNode = ASDisplayNode()
self.highlightedBackgroundNode.isLayerBacked = true
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.isAccessibilityElement = true
diff --git a/submodules/InviteLinksUI/Sources/FolderInviteLinkListController.swift b/submodules/InviteLinksUI/Sources/FolderInviteLinkListController.swift
index 2dd9b16a..3c39e1cd 100644
--- a/submodules/InviteLinksUI/Sources/FolderInviteLinkListController.swift
+++ b/submodules/InviteLinksUI/Sources/FolderInviteLinkListController.swift
@@ -451,7 +451,7 @@ public func folderInviteLinkListController(context: AccountContext, updatedPrese
let state = stateValue.with({ $0 })
- let promptController = promptController(sharedContext: context.sharedContext, updatedPresentationData: updatedPresentationData, text: presentationData.strings.FolderLinkScreen_NameLink_Title, titleFont: .bold, value: state.title ?? "", characterLimit: 32, apply: { value in
+ let promptController = promptController(context: context, updatedPresentationData: updatedPresentationData, text: presentationData.strings.FolderLinkScreen_NameLink_Title, titleFont: .bold, value: state.title ?? "", characterLimit: 32, apply: { value in
if let value {
updateState { state in
var state = state
@@ -763,15 +763,21 @@ public func folderInviteLinkListController(context: AccountContext, updatedPrese
if hasChanges {
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
- presentControllerImpl?(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: presentationData.strings.FolderLinkScreen_SaveAlertTitle, text: presentationData.strings.FolderLinkScreen_SaveAlertText, actions: [
- TextAlertAction(type: .genericAction, title: presentationData.strings.FolderLinkScreen_SaveAlertActionDiscard, action: {
- f()
- dismissImpl?()
- }),
- TextAlertAction(type: .defaultAction, title: state.selectedPeerIds.isEmpty ? presentationData.strings.FolderLinkScreen_SaveAlertActionApply : presentationData.strings.FolderLinkScreen_SaveAlertActionContinue, action: {
- applyChangesImpl?()
- })
- ]), nil)
+ let alertController = textAlertController(
+ context: context,
+ title: presentationData.strings.FolderLinkScreen_SaveAlertTitle,
+ text: presentationData.strings.FolderLinkScreen_SaveAlertText,
+ actions: [
+ TextAlertAction(type: .genericAction, title: presentationData.strings.FolderLinkScreen_SaveAlertActionDiscard, action: {
+ f()
+ dismissImpl?()
+ }),
+ TextAlertAction(type: .defaultAction, title: state.selectedPeerIds.isEmpty ? presentationData.strings.FolderLinkScreen_SaveAlertActionApply : presentationData.strings.FolderLinkScreen_SaveAlertActionContinue, action: {
+ applyChangesImpl?()
+ })
+ ]
+ )
+ presentControllerImpl?(alertController, nil)
return false
} else {
f()
diff --git a/submodules/InviteLinksUI/Sources/InviteLinkHeaderItem.swift b/submodules/InviteLinksUI/Sources/InviteLinkHeaderItem.swift
index d51c7950..6cf26088 100644
--- a/submodules/InviteLinksUI/Sources/InviteLinkHeaderItem.swift
+++ b/submodules/InviteLinksUI/Sources/InviteLinkHeaderItem.swift
@@ -94,7 +94,7 @@ class InviteLinkHeaderItemNode: ListViewItemNode {
self.animationNode = DefaultAnimatedStickerNodeImpl()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.titleNode)
self.addSubnode(self.textNode.textNode)
diff --git a/submodules/InviteLinksUI/Sources/InviteLinkInviteHeaderItem.swift b/submodules/InviteLinksUI/Sources/InviteLinkInviteHeaderItem.swift
index 22ec3233..733ee8b9 100644
--- a/submodules/InviteLinksUI/Sources/InviteLinkInviteHeaderItem.swift
+++ b/submodules/InviteLinksUI/Sources/InviteLinkInviteHeaderItem.swift
@@ -86,7 +86,7 @@ class InviteLinkInviteHeaderItemNode: ListViewItemNode {
self.iconNode.displaysAsynchronously = false
self.iconNode.displayWithoutProcessing = true
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.titleNode)
self.addSubnode(self.textNode)
diff --git a/submodules/InviteLinksUI/Sources/InviteLinkInviteManageItem.swift b/submodules/InviteLinksUI/Sources/InviteLinkInviteManageItem.swift
index 64b7f3b3..925c6454 100644
--- a/submodules/InviteLinksUI/Sources/InviteLinkInviteManageItem.swift
+++ b/submodules/InviteLinksUI/Sources/InviteLinkInviteManageItem.swift
@@ -74,7 +74,7 @@ class InviteLinkInviteManageItemNode: ListViewItemNode {
self.backgroundNode = ASDisplayNode()
self.buttonNode = HighlightableButtonNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.backgroundNode)
self.addSubnode(self.buttonNode)
diff --git a/submodules/InviteLinksUI/Sources/InviteRequestsSearchItem.swift b/submodules/InviteLinksUI/Sources/InviteRequestsSearchItem.swift
index 60dd4a8a..28f3932f 100644
--- a/submodules/InviteLinksUI/Sources/InviteRequestsSearchItem.swift
+++ b/submodules/InviteLinksUI/Sources/InviteRequestsSearchItem.swift
@@ -38,7 +38,7 @@ final class SearchNavigationContentNode: NavigationBarContentNode, ItemListContr
self.cancel = cancel
- self.searchBar = SearchBarNode(theme: SearchBarNodeTheme(theme: theme, hasSeparator: false), strings: strings, fieldStyle: .modern, displayBackground: false)
+ self.searchBar = SearchBarNode(theme: SearchBarNodeTheme(theme: theme, hasSeparator: false), presentationTheme: theme, strings: strings, fieldStyle: .modern, displayBackground: false)
super.init()
@@ -66,7 +66,7 @@ final class SearchNavigationContentNode: NavigationBarContentNode, ItemListContr
func updateTheme(_ theme: PresentationTheme) {
self.theme = theme
- self.searchBar.updateThemeAndStrings(theme: SearchBarNodeTheme(theme: self.theme), strings: self.strings)
+ self.searchBar.updateThemeAndStrings(theme: SearchBarNodeTheme(theme: self.theme), presentationTheme: self.theme, strings: self.strings)
self.updatePlaceholder()
}
@@ -78,10 +78,12 @@ final class SearchNavigationContentNode: NavigationBarContentNode, ItemListContr
return 56.0
}
- override func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, transition: ContainedViewLayoutTransition) {
+ override func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, transition: ContainedViewLayoutTransition) -> CGSize {
let searchBarFrame = CGRect(origin: CGPoint(x: 0.0, y: size.height - self.nominalHeight), size: CGSize(width: size.width, height: 56.0))
self.searchBar.frame = searchBarFrame
self.searchBar.updateLayout(boundingSize: searchBarFrame.size, leftInset: leftInset, rightInset: rightInset, transition: transition)
+
+ return size
}
func activate() {
diff --git a/submodules/InviteLinksUI/Sources/ItemListFolderInviteLinkItem.swift b/submodules/InviteLinksUI/Sources/ItemListFolderInviteLinkItem.swift
index 70cdea58..5382dfed 100644
--- a/submodules/InviteLinksUI/Sources/ItemListFolderInviteLinkItem.swift
+++ b/submodules/InviteLinksUI/Sources/ItemListFolderInviteLinkItem.swift
@@ -203,7 +203,7 @@ public class ItemListFolderInviteLinkItemNode: ListViewItemNode, ItemListItemNod
self.activateArea = AccessibilityAreaNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.fieldNode)
self.addSubnode(self.addressNode)
diff --git a/submodules/InviteLinksUI/Sources/ItemListFolderInviteLinkListItem.swift b/submodules/InviteLinksUI/Sources/ItemListFolderInviteLinkListItem.swift
index d34dab06..6ccdd7c2 100644
--- a/submodules/InviteLinksUI/Sources/ItemListFolderInviteLinkListItem.swift
+++ b/submodules/InviteLinksUI/Sources/ItemListFolderInviteLinkListItem.swift
@@ -210,7 +210,7 @@ public class ItemListFolderInviteLinkListItemNode: ItemListRevealOptionsItemNode
self.highlightedBackgroundNode = ASDisplayNode()
self.highlightedBackgroundNode.isLayerBacked = true
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.isAccessibilityElement = true
diff --git a/submodules/InviteLinksUI/Sources/ItemListInviteLinkDateLimitItem.swift b/submodules/InviteLinksUI/Sources/ItemListInviteLinkDateLimitItem.swift
index f329c40b..3555521e 100644
--- a/submodules/InviteLinksUI/Sources/ItemListInviteLinkDateLimitItem.swift
+++ b/submodules/InviteLinksUI/Sources/ItemListInviteLinkDateLimitItem.swift
@@ -170,7 +170,7 @@ private final class ItemListInviteLinkTimeLimitItemNode: ListViewItemNode {
self.customTextNode.isUserInteractionEnabled = false
self.customTextNode.displaysAsynchronously = false
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.lowTextNode)
self.addSubnode(self.mediumTextNode)
diff --git a/submodules/InviteLinksUI/Sources/ItemListInviteLinkItem.swift b/submodules/InviteLinksUI/Sources/ItemListInviteLinkItem.swift
index d4846030..a00ee4df 100644
--- a/submodules/InviteLinksUI/Sources/ItemListInviteLinkItem.swift
+++ b/submodules/InviteLinksUI/Sources/ItemListInviteLinkItem.swift
@@ -235,7 +235,7 @@ public class ItemListInviteLinkItemNode: ListViewItemNode, ItemListItemNode {
self.highlightedBackgroundNode = ASDisplayNode()
self.highlightedBackgroundNode.isLayerBacked = true
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.isAccessibilityElement = true
diff --git a/submodules/InviteLinksUI/Sources/ItemListInviteLinkUsageLimitItem.swift b/submodules/InviteLinksUI/Sources/ItemListInviteLinkUsageLimitItem.swift
index db379ed7..3bc59945 100644
--- a/submodules/InviteLinksUI/Sources/ItemListInviteLinkUsageLimitItem.swift
+++ b/submodules/InviteLinksUI/Sources/ItemListInviteLinkUsageLimitItem.swift
@@ -186,7 +186,7 @@ private final class ItemListInviteLinkUsageLimitItemNode: ListViewItemNode {
self.customTextNode.isUserInteractionEnabled = false
self.customTextNode.displaysAsynchronously = false
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.lowTextNode)
self.addSubnode(self.mediumTextNode)
diff --git a/submodules/InviteLinksUI/Sources/ItemListInviteRequestItem.swift b/submodules/InviteLinksUI/Sources/ItemListInviteRequestItem.swift
index 5a66bf6e..a233c6cd 100644
--- a/submodules/InviteLinksUI/Sources/ItemListInviteRequestItem.swift
+++ b/submodules/InviteLinksUI/Sources/ItemListInviteRequestItem.swift
@@ -223,7 +223,7 @@ public class ItemListInviteRequestItemNode: ListViewItemNode, ItemListItemNode {
self.contentWrapperNode = ASDisplayNode()
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.isAccessibilityElement = true
diff --git a/submodules/InviteLinksUI/Sources/ItemListPermanentInviteLinkItem.swift b/submodules/InviteLinksUI/Sources/ItemListPermanentInviteLinkItem.swift
index 7ff09939..1761e1f6 100644
--- a/submodules/InviteLinksUI/Sources/ItemListPermanentInviteLinkItem.swift
+++ b/submodules/InviteLinksUI/Sources/ItemListPermanentInviteLinkItem.swift
@@ -210,7 +210,7 @@ public class ItemListPermanentInviteLinkItemNode: ListViewItemNode, ItemListItem
self.activateArea = AccessibilityAreaNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.fieldNode)
self.addSubnode(self.addressNode)
@@ -403,8 +403,8 @@ public class ItemListPermanentInviteLinkItemNode: ListViewItemNode, ItemListItem
}
let fieldHeight: CGFloat = 52.0
- let fieldSpacing: CGFloat = 16.0
- let buttonHeight: CGFloat = 50.0
+ let fieldSpacing: CGFloat = 10.0
+ let buttonHeight: CGFloat = 52.0
let justCreatedCallSeparatorSpacing: CGFloat = 16.0
let justCreatedCallTextSpacing: CGFloat = 45.0
diff --git a/submodules/ItemListAddressItem/Sources/ItemListAddressItem.swift b/submodules/ItemListAddressItem/Sources/ItemListAddressItem.swift
index 595695b6..b4d71c20 100644
--- a/submodules/ItemListAddressItem/Sources/ItemListAddressItem.swift
+++ b/submodules/ItemListAddressItem/Sources/ItemListAddressItem.swift
@@ -142,7 +142,7 @@ public class ItemListAddressItemNode: ListViewItemNode {
self.iconNode = ASImageNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.labelNode)
self.addSubnode(self.textNode)
diff --git a/submodules/ItemListAvatarAndNameInfoItem/Sources/ItemListAvatarAndNameItem.swift b/submodules/ItemListAvatarAndNameInfoItem/Sources/ItemListAvatarAndNameItem.swift
index 3e4bece6..b2843f1b 100644
--- a/submodules/ItemListAvatarAndNameInfoItem/Sources/ItemListAvatarAndNameItem.swift
+++ b/submodules/ItemListAvatarAndNameInfoItem/Sources/ItemListAvatarAndNameItem.swift
@@ -327,7 +327,7 @@ public class ItemListAvatarAndNameInfoItemNode: ListViewItemNode, ItemListItemNo
self.callButton = HighlightableButtonNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.isAccessibilityElement = true
diff --git a/submodules/ItemListPeerActionItem/Sources/ItemListPeerActionItem.swift b/submodules/ItemListPeerActionItem/Sources/ItemListPeerActionItem.swift
index 49b9f75a..3f877671 100644
--- a/submodules/ItemListPeerActionItem/Sources/ItemListPeerActionItem.swift
+++ b/submodules/ItemListPeerActionItem/Sources/ItemListPeerActionItem.swift
@@ -160,7 +160,7 @@ public final class ItemListPeerActionItemNode: ListViewItemNode {
self.activateArea = AccessibilityAreaNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.iconNode)
self.addSubnode(self.titleNode)
@@ -257,12 +257,16 @@ public final class ItemListPeerActionItemNode: ListViewItemNode {
case .blocks:
strongSelf.topStripeNode.backgroundColor = item.presentationData.theme.list.itemBlocksSeparatorColor
strongSelf.bottomStripeNode.backgroundColor = item.presentationData.theme.list.itemBlocksSeparatorColor
- strongSelf.backgroundNode.backgroundColor = item.presentationData.theme.list.itemBlocksBackgroundColor
+ if !item.alwaysPlain {
+ strongSelf.backgroundNode.backgroundColor = item.presentationData.theme.list.itemBlocksBackgroundColor
+ }
strongSelf.highlightedBackgroundNode.backgroundColor = item.presentationData.theme.list.itemHighlightedBackgroundColor
case .plain:
strongSelf.topStripeNode.backgroundColor = item.presentationData.theme.list.itemPlainSeparatorColor
strongSelf.bottomStripeNode.backgroundColor = item.presentationData.theme.list.itemPlainSeparatorColor
- strongSelf.backgroundNode.backgroundColor = item.presentationData.theme.list.plainBackgroundColor
+ if !item.alwaysPlain {
+ strongSelf.backgroundNode.backgroundColor = item.presentationData.theme.list.plainBackgroundColor
+ }
strongSelf.highlightedBackgroundNode.backgroundColor = item.presentationData.theme.list.itemHighlightedBackgroundColor
}
}
diff --git a/submodules/ItemListPeerItem/Sources/ItemListPeerItem.swift b/submodules/ItemListPeerItem/Sources/ItemListPeerItem.swift
index d9517501..036b86ab 100644
--- a/submodules/ItemListPeerItem/Sources/ItemListPeerItem.swift
+++ b/submodules/ItemListPeerItem/Sources/ItemListPeerItem.swift
@@ -855,7 +855,7 @@ public class ItemListPeerItemNode: ItemListRevealOptionsItemNode, ItemListItemNo
self.highlightedBackgroundNode = ASDisplayNode()
self.highlightedBackgroundNode.isLayerBacked = true
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.isAccessibilityElement = true
diff --git a/submodules/ItemListStickerPackItem/Sources/ItemListStickerPackItem.swift b/submodules/ItemListStickerPackItem/Sources/ItemListStickerPackItem.swift
index 81f65a8c..149742ff 100644
--- a/submodules/ItemListStickerPackItem/Sources/ItemListStickerPackItem.swift
+++ b/submodules/ItemListStickerPackItem/Sources/ItemListStickerPackItem.swift
@@ -263,7 +263,7 @@ class ItemListStickerPackItemNode: ItemListRevealOptionsItemNode {
self.activateArea = AccessibilityAreaNode()
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.addSubnode(self.containerNode)
diff --git a/submodules/ItemListUI/BUILD b/submodules/ItemListUI/BUILD
index 71afc199..cbd9e076 100644
--- a/submodules/ItemListUI/BUILD
+++ b/submodules/ItemListUI/BUILD
@@ -34,6 +34,8 @@ swift_library(
"//submodules/Components/ComponentDisplayAdapters",
"//submodules/TelegramUI/Components/TextNodeWithEntities",
"//submodules/TelegramUI/Components/ListItemComponentAdaptor",
+ "//submodules/TelegramUI/Components/GlassBackgroundComponent",
+ "//submodules/TelegramUI/Components/HorizontalTabsComponent",
],
visibility = [
"//visibility:public",
diff --git a/submodules/ItemListUI/Sources/ItemListController.swift b/submodules/ItemListUI/Sources/ItemListController.swift
index 9149f3f6..8eda7718 100644
--- a/submodules/ItemListUI/Sources/ItemListController.swift
+++ b/submodules/ItemListUI/Sources/ItemListController.swift
@@ -281,11 +281,12 @@ open class ItemListController: ViewController, KeyShortcutResponder, Presentable
self.presentationData = presentationData
self.hideNavigationBarBackground = hideNavigationBarBackground
- super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: NavigationBarTheme(rootControllerTheme: presentationData.theme, hideBackground: hideNavigationBarBackground, hideSeparator: hideNavigationBarBackground), strings: NavigationBarStrings(presentationStrings: presentationData.strings)))
+ super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: NavigationBarTheme(rootControllerTheme: presentationData.theme, hideBackground: hideNavigationBarBackground, hideSeparator: hideNavigationBarBackground, style: .glass), strings: NavigationBarStrings(presentationStrings: presentationData.strings)))
self.isOpaqueWhenInOverlay = true
self.blocksBackgroundWhenInOverlay = true
self.automaticallyControlPresentationContextLayout = false
+ self._hasGlassStyle = true
self.statusBar.statusBarStyle = presentationData.theme.rootController.statusBarStyle.style
@@ -326,13 +327,23 @@ open class ItemListController: ViewController, KeyShortcutResponder, Presentable
Queue.mainQueue().async {
if let strongSelf = self {
let previousState = previousControllerState.swap(controllerState)
+ let isFirstTime = previousState == nil
if previousState?.title != controllerState.title {
+ var previousHadContentNode = false
+ switch previousState?.title {
+ case .textWithTabs:
+ previousHadContentNode = true
+ default:
+ break
+ }
switch controllerState.title {
case let .text(text):
strongSelf.title = text
strongSelf.navigationItem.titleView = nil
strongSelf.segmentedTitleView = nil
- strongSelf.navigationBar?.setContentNode(nil, animated: false)
+ if previousHadContentNode {
+ strongSelf.navigationBar?.setContentNode(nil, animated: false)
+ }
if strongSelf.isNodeLoaded {
strongSelf.controllerNode.panRecognizer?.isEnabled = false
}
@@ -340,7 +351,9 @@ open class ItemListController: ViewController, KeyShortcutResponder, Presentable
strongSelf.title = ""
strongSelf.navigationItem.titleView = ItemListTextWithSubtitleTitleView(theme: controllerState.presentationData.theme, title: title, subtitle: subtitle)
strongSelf.segmentedTitleView = nil
- strongSelf.navigationBar?.setContentNode(nil, animated: false)
+ if previousHadContentNode {
+ strongSelf.navigationBar?.setContentNode(nil, animated: false)
+ }
if strongSelf.isNodeLoaded {
strongSelf.controllerNode.panRecognizer?.isEnabled = false
}
@@ -358,7 +371,9 @@ open class ItemListController: ViewController, KeyShortcutResponder, Presentable
}
}
}
- strongSelf.navigationBar?.setContentNode(nil, animated: false)
+ if previousHadContentNode {
+ strongSelf.navigationBar?.setContentNode(nil, animated: false)
+ }
if strongSelf.isNodeLoaded {
strongSelf.controllerNode.panRecognizer?.isEnabled = false
}
@@ -515,10 +530,10 @@ open class ItemListController: ViewController, KeyShortcutResponder, Presentable
}
}
- if strongSelf.presentationData != controllerState.presentationData {
+ if strongSelf.presentationData != controllerState.presentationData || isFirstTime {
strongSelf.presentationData = controllerState.presentationData
- strongSelf.navigationBar?.updatePresentationData(NavigationBarPresentationData(theme: NavigationBarTheme(rootControllerTheme: strongSelf.presentationData.theme, hideBackground: strongSelf.hideNavigationBarBackground, hideSeparator: strongSelf.hideNavigationBarBackground), strings: NavigationBarStrings(presentationStrings: strongSelf.presentationData.strings)))
+ strongSelf.navigationBar?.updatePresentationData(NavigationBarPresentationData(theme: NavigationBarTheme(rootControllerTheme: strongSelf.presentationData.theme, hideBackground: strongSelf.hideNavigationBarBackground, hideSeparator: strongSelf.hideNavigationBarBackground, edgeEffectColor: state.0.style == .blocks ? strongSelf.presentationData.theme.list.blocksBackgroundColor : strongSelf.presentationData.theme.list.plainBackgroundColor, style: .glass), strings: NavigationBarStrings(presentationStrings: strongSelf.presentationData.strings)), transition: .immediate)
strongSelf.statusBar.updateStatusBarStyle(strongSelf.presentationData.theme.rootController.statusBarStyle.style, animated: true)
strongSelf.segmentedTitleView?.theme = controllerState.presentationData.theme
@@ -675,7 +690,8 @@ private final class ItemListTextWithSubtitleTitleView: UIView, NavigationBarTitl
private let titleNode: ImmediateTextNode
private let subtitleNode: ImmediateTextNode
- private var validLayout: (CGSize, CGRect)?
+ private var validLayout: CGSize?
+ var requestUpdate: ((ContainedViewLayoutTransition) -> Void)?
init(theme: PresentationTheme, title: String, subtitle: String) {
self.titleNode = ImmediateTextNode()
@@ -705,21 +721,23 @@ private final class ItemListTextWithSubtitleTitleView: UIView, NavigationBarTitl
func updateTheme(theme: PresentationTheme) {
self.titleNode.attributedText = NSAttributedString(string: self.titleNode.attributedText?.string ?? "", font: Font.medium(17.0), textColor: theme.rootController.navigationBar.primaryTextColor)
self.subtitleNode.attributedText = NSAttributedString(string: self.subtitleNode.attributedText?.string ?? "", font: Font.regular(13.0), textColor: theme.rootController.navigationBar.secondaryTextColor)
- if let (size, clearBounds) = self.validLayout {
- let _ = self.updateLayout(size: size, clearBounds: clearBounds, transition: .immediate)
+ if let size = self.validLayout {
+ let _ = self.updateLayout(availableSize: size, transition: .immediate)
}
}
override func layoutSubviews() {
super.layoutSubviews()
- if let (size, clearBounds) = self.validLayout {
- let _ = self.updateLayout(size: size, clearBounds: clearBounds, transition: .immediate)
+ if let size = self.validLayout {
+ let _ = self.updateLayout(availableSize: size, transition: .immediate)
}
}
- func updateLayout(size: CGSize, clearBounds: CGRect, transition: ContainedViewLayoutTransition) -> CGRect {
- self.validLayout = (size, clearBounds)
+ func updateLayout(availableSize: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
+ let size = availableSize
+
+ self.validLayout = size
let titleSize = self.titleNode.updateLayout(size)
let subtitleSize = self.subtitleNode.updateLayout(size)
@@ -731,7 +749,7 @@ private final class ItemListTextWithSubtitleTitleView: UIView, NavigationBarTitl
self.titleNode.frame = titleFrame
self.subtitleNode.frame = subtitleFrame
- return titleFrame
+ return availableSize
}
func animateLayoutTransition() {
diff --git a/submodules/ItemListUI/Sources/ItemListControllerNode.swift b/submodules/ItemListUI/Sources/ItemListControllerNode.swift
index 46657a20..1babb422 100644
--- a/submodules/ItemListUI/Sources/ItemListControllerNode.swift
+++ b/submodules/ItemListUI/Sources/ItemListControllerNode.swift
@@ -910,11 +910,7 @@ open class ItemListControllerNode: ASDisplayNode, ASGestureRecognizerDelegate {
if let validLayout = self.validLayout {
updatedNode.updateLayout(layout: validLayout.0, navigationBarHeight: validLayout.1, transition: .immediate)
}
- if updatedNode.addedUnderNavigationBar {
- self.insertSubnode(updatedNode, belowSubnode: self.navigationBar)
- } else {
- self.addSubnode(updatedNode)
- }
+ self.insertSubnode(updatedNode, belowSubnode: self.navigationBar)
updatedNode.activate()
}
} else {
diff --git a/submodules/ItemListUI/Sources/ItemListControllerSegmentedTitleView.swift b/submodules/ItemListUI/Sources/ItemListControllerSegmentedTitleView.swift
index f2d0b36f..bce38315 100644
--- a/submodules/ItemListUI/Sources/ItemListControllerSegmentedTitleView.swift
+++ b/submodules/ItemListUI/Sources/ItemListControllerSegmentedTitleView.swift
@@ -3,9 +3,12 @@ import UIKit
import Display
import TelegramPresentationData
import ComponentFlow
-import TabSelectorComponent
+import GlassBackgroundComponent
+import HorizontalTabsComponent
public final class ItemListControllerSegmentedTitleView: UIView {
+ private let backgroundContainer: GlassBackgroundContainerView
+ private let backgroundView: GlassBackgroundView
private let tabSelector = ComponentView()
public var theme: PresentationTheme {
@@ -42,7 +45,13 @@ public final class ItemListControllerSegmentedTitleView: UIView {
self.segments = segments
self.index = selectedIndex
+ self.backgroundContainer = GlassBackgroundContainerView()
+ self.backgroundView = GlassBackgroundView()
+
super.init(frame: CGRect())
+
+ self.addSubview(self.backgroundContainer)
+ self.backgroundContainer.contentView.addSubview(self.backgroundView)
}
required public init?(coder aDecoder: NSCoder) {
@@ -62,10 +71,19 @@ public final class ItemListControllerSegmentedTitleView: UIView {
return
}
- let mappedItems = zip(0 ..< self.segments.count, self.segments).map { index, segment in
- return TabSelectorComponent.Item(
+ let mappedItems: [HorizontalTabsComponent.Tab] = zip(0 ..< self.segments.count, self.segments).map { index, segment in
+ return HorizontalTabsComponent.Tab(
id: AnyHashable(index),
- title: segment
+ content: .title(HorizontalTabsComponent.Tab.Title(text: segment, entities: [], enableAnimations: false)),
+ badge: nil,
+ action: { [weak self] in
+ guard let self else {
+ return
+ }
+ self.indexUpdated?(index)
+ },
+ contextAction: nil,
+ deleteAction: nil
)
}
@@ -77,34 +95,32 @@ public final class ItemListControllerSegmentedTitleView: UIView {
let tabSelectorSize = self.tabSelector.update(
transition: transition,
- component: AnyComponent(TabSelectorComponent(
- colors: TabSelectorComponent.Colors(
- foreground: self.theme.list.itemPrimaryTextColor.withMultipliedAlpha(0.8),
- selection: self.theme.list.itemPrimaryTextColor.withMultipliedAlpha(0.05)
- ),
+ component: AnyComponent(HorizontalTabsComponent(
+ context: nil,
theme: self.theme,
- customLayout: TabSelectorComponent.CustomLayout(
- font: Font.medium(15.0),
- spacing: 8.0
- ),
- items: mappedItems,
- selectedId: AnyHashable(self.index),
- setSelectedId: { [weak self] id in
- guard let self, let index = id.base as? Int else {
- return
- }
- self.indexUpdated?(index)
- }
+ tabs: mappedItems,
+ selectedTab: AnyHashable(self.index),
+ isEditing: false,
+ layout: .fit
)),
environment: {},
containerSize: CGSize(width: size.width, height: 44.0)
)
+
let tabSelectorFrame = CGRect(origin: CGPoint(x: floor((size.width - tabSelectorSize.width) / 2.0), y: floor((size.height - tabSelectorSize.height) / 2.0)), size: tabSelectorSize)
- if let tabSelectorView = self.tabSelector.view {
+
+ transition.setFrame(view: self.backgroundContainer, frame: tabSelectorFrame)
+ self.backgroundContainer.update(size: tabSelectorFrame.size, isDark: self.theme.overallDarkAppearance, transition: transition)
+
+ transition.setFrame(view: self.backgroundView, frame: CGRect(origin: CGPoint(), size: tabSelectorFrame.size))
+ self.backgroundView.update(size: tabSelectorFrame.size, cornerRadius: tabSelectorFrame.height * 0.5, isDark: theme.overallDarkAppearance, tintColor: .init(kind: .panel, color: UIColor(white: self.theme.overallDarkAppearance ? 0.0 : 1.0, alpha: 0.6)), transition: transition)
+
+ if let tabSelectorView = self.tabSelector.view as? HorizontalTabsComponent.View {
if tabSelectorView.superview == nil {
- self.addSubview(tabSelectorView)
+ self.backgroundView.contentView.addSubview(tabSelectorView)
+ tabSelectorView.setOverlayContainerView(overlayContainerView: self)
}
- transition.setFrame(view: tabSelectorView, frame: tabSelectorFrame)
+ transition.setFrame(view: tabSelectorView, frame: CGRect(origin: CGPoint(), size: tabSelectorFrame.size))
}
}
}
diff --git a/submodules/ItemListUI/Sources/ItemListControllerTabsContentNode.swift b/submodules/ItemListUI/Sources/ItemListControllerTabsContentNode.swift
index 0e2526e2..71f3c5fa 100644
--- a/submodules/ItemListUI/Sources/ItemListControllerTabsContentNode.swift
+++ b/submodules/ItemListUI/Sources/ItemListControllerTabsContentNode.swift
@@ -63,10 +63,10 @@ final class ItemListControllerTabsContentNode: NavigationBarContentNode {
guard let (size, leftInset, rightInset) = self.validLayout else {
return
}
- self.updateLayout(size: size, leftInset: leftInset, rightInset: rightInset, transition: transition)
+ let _ = self.updateLayout(size: size, leftInset: leftInset, rightInset: rightInset, transition: transition)
}
- override func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, transition: ContainedViewLayoutTransition) {
+ override func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, transition: ContainedViewLayoutTransition) -> CGSize {
let isFirstTime = self.validLayout == nil
self.validLayout = (size, leftInset, rightInset)
@@ -116,6 +116,8 @@ final class ItemListControllerTabsContentNode: NavigationBarContentNode {
if isFirstTime {
self.requestContainerLayout(.immediate)
}
+
+ return size
}
override var height: CGFloat {
diff --git a/submodules/ItemListUI/Sources/Items/ItemListActionItem.swift b/submodules/ItemListUI/Sources/Items/ItemListActionItem.swift
index a9e6d0dd..c60eccae 100644
--- a/submodules/ItemListUI/Sources/Items/ItemListActionItem.swift
+++ b/submodules/ItemListUI/Sources/Items/ItemListActionItem.swift
@@ -125,7 +125,7 @@ public class ItemListActionItemNode: ListViewItemNode, ItemListItemNode {
self.activateArea = AccessibilityAreaNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.titleNode)
diff --git a/submodules/ItemListUI/Sources/Items/ItemListActivityTextItem.swift b/submodules/ItemListUI/Sources/Items/ItemListActivityTextItem.swift
index 434b524c..9a0a5eff 100644
--- a/submodules/ItemListUI/Sources/Items/ItemListActivityTextItem.swift
+++ b/submodules/ItemListUI/Sources/Items/ItemListActivityTextItem.swift
@@ -85,7 +85,7 @@ public class ItemListActivityTextItemNode: ListViewItemNode {
self.activityIndicator = ActivityIndicator(type: ActivityIndicatorType.custom(.black, 16.0, 2.0, false))
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.titleNode)
self.addSubnode(self.activityIndicator)
diff --git a/submodules/ItemListUI/Sources/Items/ItemListCheckboxItem.swift b/submodules/ItemListUI/Sources/Items/ItemListCheckboxItem.swift
index 667a471d..8743226e 100644
--- a/submodules/ItemListUI/Sources/Items/ItemListCheckboxItem.swift
+++ b/submodules/ItemListUI/Sources/Items/ItemListCheckboxItem.swift
@@ -168,7 +168,7 @@ public class ItemListCheckboxItemNode: ItemListRevealOptionsItemNode {
self.activateArea = AccessibilityAreaNode()
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.addSubnode(self.contentParentNode)
self.contentParentNode.addSubnode(self.contentContainerNode)
diff --git a/submodules/ItemListUI/Sources/Items/ItemListDisclosureItem.swift b/submodules/ItemListUI/Sources/Items/ItemListDisclosureItem.swift
index 7b03132a..5d518b5f 100644
--- a/submodules/ItemListUI/Sources/Items/ItemListDisclosureItem.swift
+++ b/submodules/ItemListUI/Sources/Items/ItemListDisclosureItem.swift
@@ -254,7 +254,7 @@ public class ItemListDisclosureItemNode: ListViewItemNode, ItemListItemNode {
self.activateArea = AccessibilityAreaNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.titleNode.textNode)
self.addSubnode(self.labelNode)
diff --git a/submodules/ItemListUI/Sources/Items/ItemListEditableItem.swift b/submodules/ItemListUI/Sources/Items/ItemListEditableItem.swift
index 3ba05e2b..df2372c1 100644
--- a/submodules/ItemListUI/Sources/Items/ItemListEditableItem.swift
+++ b/submodules/ItemListUI/Sources/Items/ItemListEditableItem.swift
@@ -83,8 +83,8 @@ open class ItemListRevealOptionsItemNode: ListViewItemNode, ASGestureRecognizerD
return !self.isDisplayingRevealedOptions
}
- override public init(layerBacked: Bool, dynamicBounce: Bool, rotated: Bool, seeThrough: Bool) {
- super.init(layerBacked: layerBacked, dynamicBounce: dynamicBounce, rotated: rotated, seeThrough: seeThrough)
+ override public init(layerBacked: Bool, rotated: Bool, seeThrough: Bool) {
+ super.init(layerBacked: layerBacked, rotated: rotated, seeThrough: seeThrough)
}
open var controlsContainer: ASDisplayNode {
diff --git a/submodules/ItemListUI/Sources/Items/ItemListExpandableSwitchItem.swift b/submodules/ItemListUI/Sources/Items/ItemListExpandableSwitchItem.swift
index a7f52e9e..6f95c58d 100644
--- a/submodules/ItemListUI/Sources/Items/ItemListExpandableSwitchItem.swift
+++ b/submodules/ItemListUI/Sources/Items/ItemListExpandableSwitchItem.swift
@@ -267,7 +267,7 @@ public class ItemListExpandableSwitchItemNode: ListViewItemNode, ItemListItemNod
self.subItemContainer = ASDisplayNode()
self.subItemContainer.clipsToBounds = true
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.titleNode)
self.addSubnode(self.titleValueNode)
diff --git a/submodules/ItemListUI/Sources/Items/ItemListInfoItem.swift b/submodules/ItemListUI/Sources/Items/ItemListInfoItem.swift
index f39f8b3f..bf113249 100644
--- a/submodules/ItemListUI/Sources/Items/ItemListInfoItem.swift
+++ b/submodules/ItemListUI/Sources/Items/ItemListInfoItem.swift
@@ -181,7 +181,7 @@ public class InfoItemNode: ListViewItemNode {
self.closeButton.hitTestSlop = UIEdgeInsets(top: -8.0, left: -8.0, bottom: -8.0, right: -8.0)
self.closeButton.displaysAsynchronously = false
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.badgeNode)
self.addSubnode(self.labelNode)
diff --git a/submodules/ItemListUI/Sources/Items/ItemListMultilineInputItem.swift b/submodules/ItemListUI/Sources/Items/ItemListMultilineInputItem.swift
index c2465dec..e0e98a5c 100644
--- a/submodules/ItemListUI/Sources/Items/ItemListMultilineInputItem.swift
+++ b/submodules/ItemListUI/Sources/Items/ItemListMultilineInputItem.swift
@@ -152,7 +152,7 @@ public class ItemListMultilineInputItemNode: ListViewItemNode, ASEditableTextNod
self.limitTextNode = TextNode()
self.limitTextNode.displaysAsynchronously = false
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.textClippingNode.addSubnode(self.textNode)
self.addSubnode(self.textClippingNode)
diff --git a/submodules/ItemListUI/Sources/Items/ItemListMultilineTextItem.swift b/submodules/ItemListUI/Sources/Items/ItemListMultilineTextItem.swift
index fc92b444..98865359 100644
--- a/submodules/ItemListUI/Sources/Items/ItemListMultilineTextItem.swift
+++ b/submodules/ItemListUI/Sources/Items/ItemListMultilineTextItem.swift
@@ -127,7 +127,7 @@ public class ItemListMultilineTextItemNode: ListViewItemNode {
self.activateArea = AccessibilityAreaNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.textNode)
self.addSubnode(self.activateArea)
diff --git a/submodules/ItemListUI/Sources/Items/ItemListPlaceholderItem.swift b/submodules/ItemListUI/Sources/Items/ItemListPlaceholderItem.swift
index 4a87d011..4bbd49de 100644
--- a/submodules/ItemListUI/Sources/Items/ItemListPlaceholderItem.swift
+++ b/submodules/ItemListUI/Sources/Items/ItemListPlaceholderItem.swift
@@ -93,7 +93,7 @@ public class ItemListPlaceholderItemNode: ListViewItemNode, ItemListItemNode {
self.textNode = TextNode()
self.textNode.isUserInteractionEnabled = false
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.textNode)
}
diff --git a/submodules/ItemListUI/Sources/Items/ItemListSectionHeaderItem.swift b/submodules/ItemListUI/Sources/Items/ItemListSectionHeaderItem.swift
index 61c141fd..f19047c2 100644
--- a/submodules/ItemListUI/Sources/Items/ItemListSectionHeaderItem.swift
+++ b/submodules/ItemListUI/Sources/Items/ItemListSectionHeaderItem.swift
@@ -139,7 +139,7 @@ public class ItemListSectionHeaderItemNode: ListViewItemNode {
self.activateArea = AccessibilityAreaNode()
self.activateArea.accessibilityTraits = [.staticText, .header]
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.titleNode)
self.addSubnode(self.accessoryTextNode)
diff --git a/submodules/ItemListUI/Sources/Items/ItemListSingleLineInputItem.swift b/submodules/ItemListUI/Sources/Items/ItemListSingleLineInputItem.swift
index f2bdd08d..0b012154 100644
--- a/submodules/ItemListUI/Sources/Items/ItemListSingleLineInputItem.swift
+++ b/submodules/ItemListUI/Sources/Items/ItemListSingleLineInputItem.swift
@@ -177,7 +177,7 @@ public class ItemListSingleLineInputItemNode: ListViewItemNode, UITextFieldDeleg
self.labelNode = TextNode()
self.labelNode.isUserInteractionEnabled = false
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.titleNode.textNode)
self.addSubnode(self.textNode)
diff --git a/submodules/ItemListUI/Sources/Items/ItemListSwitchItem.swift b/submodules/ItemListUI/Sources/Items/ItemListSwitchItem.swift
index 18a0027c..b9d897c1 100644
--- a/submodules/ItemListUI/Sources/Items/ItemListSwitchItem.swift
+++ b/submodules/ItemListUI/Sources/Items/ItemListSwitchItem.swift
@@ -207,7 +207,7 @@ public class ItemListSwitchItemNode: ListViewItemNode, ItemListItemNode {
self.activateArea = AccessibilityAreaNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.titleNode)
self.addSubnode(self.switchNode)
diff --git a/submodules/ItemListUI/Sources/Items/ItemListTextItem.swift b/submodules/ItemListUI/Sources/Items/ItemListTextItem.swift
index ad988d97..5c5c50a2 100644
--- a/submodules/ItemListUI/Sources/Items/ItemListTextItem.swift
+++ b/submodules/ItemListUI/Sources/Items/ItemListTextItem.swift
@@ -132,7 +132,7 @@ public class ItemListTextItemNode: ListViewItemNode, ItemListItemNode {
self.activateArea = AccessibilityAreaNode()
self.activateArea.accessibilityTraits = .staticText
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.textNode.textNode)
self.addSubnode(self.activateArea)
diff --git a/submodules/ItemListUI/Sources/Items/ItemListTextWithLabelItem.swift b/submodules/ItemListUI/Sources/Items/ItemListTextWithLabelItem.swift
index 2b27d407..9e3232df 100644
--- a/submodules/ItemListUI/Sources/Items/ItemListTextWithLabelItem.swift
+++ b/submodules/ItemListUI/Sources/Items/ItemListTextWithLabelItem.swift
@@ -134,7 +134,7 @@ public class ItemListTextWithLabelItemNode: ListViewItemNode {
self.textNode.contentMode = .left
self.textNode.contentsScale = UIScreen.main.scale
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.isAccessibilityElement = true
diff --git a/submodules/ItemListVenueItem/Sources/ItemListVenueItem.swift b/submodules/ItemListVenueItem/Sources/ItemListVenueItem.swift
index 0cff7f0a..b8492924 100644
--- a/submodules/ItemListVenueItem/Sources/ItemListVenueItem.swift
+++ b/submodules/ItemListVenueItem/Sources/ItemListVenueItem.swift
@@ -171,7 +171,7 @@ public class ItemListVenueItemNode: ListViewItemNode, ItemListItemNode {
self.highlightedBackgroundNode = ASDisplayNode()
self.highlightedBackgroundNode.isLayerBacked = true
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.isAccessibilityElement = true
diff --git a/submodules/ListMessageItem/Sources/ListMessageHoleItem.swift b/submodules/ListMessageItem/Sources/ListMessageHoleItem.swift
index d712fed0..f4960900 100644
--- a/submodules/ListMessageItem/Sources/ListMessageHoleItem.swift
+++ b/submodules/ListMessageItem/Sources/ListMessageHoleItem.swift
@@ -66,7 +66,7 @@ final class ListMessageHoleItemNode: ListViewItemNode {
private var activityIndicator: UIActivityIndicatorView?
init() {
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
}
override func didLoad() {
diff --git a/submodules/ListMessageItem/Sources/ListMessageNode.swift b/submodules/ListMessageItem/Sources/ListMessageNode.swift
index af9ba2c7..19d1b2ee 100644
--- a/submodules/ListMessageItem/Sources/ListMessageNode.swift
+++ b/submodules/ListMessageItem/Sources/ListMessageNode.swift
@@ -10,7 +10,7 @@ public class ListMessageNode: ListViewItemNode {
var interaction: ListMessageItemInteraction?
required init() {
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
}
func setupItem(_ item: ListMessageItem) {
diff --git a/submodules/ListMessageItem/Sources/ListMessageSnippetItemNode.swift b/submodules/ListMessageItem/Sources/ListMessageSnippetItemNode.swift
index de538291..fd7134aa 100644
--- a/submodules/ListMessageItem/Sources/ListMessageSnippetItemNode.swift
+++ b/submodules/ListMessageItem/Sources/ListMessageSnippetItemNode.swift
@@ -18,9 +18,17 @@ import TelegramStringFormatting
import WallpaperResources
import UrlEscaping
-private let iconFont = Font.with(size: 30.0, design: .round, weight: .bold)
+private let iconFont = Font.with(size: 28.0, design: .round, weight: .bold)
private let iconTextBackgroundImage = generateStretchableFilledCircleImage(radius: 6.0, color: UIColor(rgb: 0xFF9500))
+private let iconTextGlassBackgroundImage = generateImage(CGSize(width: 40.0, height: 40.0), contextGenerator: { size, context in
+ context.clear(CGRect(origin: CGPoint(), size: size))
+ context.setFillColor(UIColor(rgb: 0xFF9500).cgColor)
+
+ let path = UIBezierPath(roundedRect: CGRect(origin: .zero, size: size), cornerRadius: 12.0)
+ context.addPath(path.cgPath)
+ context.fillPath()
+})
public final class ListMessageSnippetItemNode: ListMessageNode {
private let contextSourceNode: ContextExtractedContentContainingNode
@@ -273,7 +281,7 @@ public final class ListMessageSnippetItemNode: ListMessageNode {
var iconImageReferenceAndRepresentation: (AnyMediaReference, TelegramMediaImageRepresentation)?
var updateIconImageSignal: Signal<(TransformImageArguments) -> DrawingContext?, NoError>?
- let applyIconTextBackgroundImage = iconTextBackgroundImage
+ let applyIconTextBackgroundImage = item.systemStyle == .glass ? iconTextGlassBackgroundImage : iconTextBackgroundImage
var primaryUrl: String?
@@ -637,7 +645,7 @@ public final class ListMessageSnippetItemNode: ListMessageNode {
var iconImageApply: (() -> Void)?
if let iconImageReferenceAndRepresentation = iconImageReferenceAndRepresentation {
let iconSize = CGSize(width: 40.0, height: 40.0)
- let imageCorners = ImageCorners(radius: 6.0)
+ let imageCorners = ImageCorners(radius: item.systemStyle == .glass ? 12.0 : 6.0, curve: item.systemStyle == .glass ? .continuous : .circular)
let arguments = TransformImageArguments(corners: imageCorners, imageSize: iconImageReferenceAndRepresentation.1.dimensions.cgSize.aspectFilled(iconSize), boundingSize: iconSize, intrinsicInsets: UIEdgeInsets(), emptyColor: item.presentationData.theme.theme.list.mediaPlaceholderColor)
iconImageApply = iconImageLayout(arguments)
}
@@ -754,7 +762,7 @@ public final class ListMessageSnippetItemNode: ListMessageNode {
}
let iconFrame = CGRect(origin: CGPoint(x: params.leftInset + leftOffset + 12.0, y: 12.0), size: CGSize(width: 40.0, height: 40.0))
- transition.updateFrame(node: strongSelf.iconTextNode, frame: CGRect(origin: CGPoint(x: iconFrame.minX + floorToScreenPixels((iconFrame.width - iconTextLayout.size.width) / 2.0), y: iconFrame.minY + floorToScreenPixels((iconFrame.height - iconTextLayout.size.height) / 2.0) + 2.0), size: iconTextLayout.size))
+ transition.updateFrame(node: strongSelf.iconTextNode, frame: CGRect(origin: CGPoint(x: iconFrame.minX + floorToScreenPixels((iconFrame.width - iconTextLayout.size.width) / 2.0) + 1.0 - UIScreenPixel, y: iconFrame.minY + floorToScreenPixels((iconFrame.height - iconTextLayout.size.height) / 2.0) + 2.0), size: iconTextLayout.size))
let _ = iconTextApply()
diff --git a/submodules/ListSectionHeaderNode/BUILD b/submodules/ListSectionHeaderNode/BUILD
index 38262bee..11c8ff2c 100644
--- a/submodules/ListSectionHeaderNode/BUILD
+++ b/submodules/ListSectionHeaderNode/BUILD
@@ -10,9 +10,10 @@ swift_library(
"-warnings-as-errors",
],
deps = [
- "//submodules/AsyncDisplayKit:AsyncDisplayKit",
- "//submodules/Display:Display",
- "//submodules/TelegramPresentationData:TelegramPresentationData",
+ "//submodules/AsyncDisplayKit",
+ "//submodules/Display",
+ "//submodules/TelegramPresentationData",
+ "//submodules/ImageBlur",
],
visibility = [
"//visibility:public",
diff --git a/submodules/ListSectionHeaderNode/Sources/ListSectionHeaderNode.swift b/submodules/ListSectionHeaderNode/Sources/ListSectionHeaderNode.swift
index c781d07f..e933bbd6 100644
--- a/submodules/ListSectionHeaderNode/Sources/ListSectionHeaderNode.swift
+++ b/submodules/ListSectionHeaderNode/Sources/ListSectionHeaderNode.swift
@@ -3,6 +3,7 @@ import UIKit
import AsyncDisplayKit
import Display
import TelegramPresentationData
+import ImageBlur
private let titleFont = Font.regular(13.0)
private let actionFont = Font.regular(13.0)
@@ -15,6 +16,7 @@ public enum ListSectionHeaderActionType {
public final class ListSectionHeaderNode: ASDisplayNode {
private let backgroundLayer: SimpleLayer
private let label: ImmediateTextNode
+ private let labelBackgroundView: UIImageView
private var actionButtonLabel: ImmediateTextNode?
private var actionButton: HighlightableButtonNode?
private var theme: PresentationTheme
@@ -89,13 +91,16 @@ public final class ListSectionHeaderNode: ASDisplayNode {
self.label.isAccessibilityElement = true
self.label.displaysAsynchronously = false
+ self.labelBackgroundView = UIImageView()
+
super.init()
self.layer.addSublayer(self.backgroundLayer)
+ //self.view.addSubview(self.labelBackgroundView)
self.addSubnode(self.label)
- self.backgroundLayer.backgroundColor = theme.chatList.sectionHeaderFillColor.cgColor
+ //self.backgroundLayer.backgroundColor = theme.chatList.sectionHeaderFillColor.cgColor
}
override public func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
@@ -135,7 +140,7 @@ public final class ListSectionHeaderNode: ASDisplayNode {
if self.theme !== theme {
self.theme = theme
- self.backgroundLayer.backgroundColor = theme.chatList.sectionHeaderFillColor.cgColor
+ //self.backgroundLayer.backgroundColor = theme.chatList.sectionHeaderFillColor.cgColor
self.label.attributedText = NSAttributedString(string: self.title ?? "", font: titleFont, textColor: self.theme.chatList.sectionHeaderTextColor)
@@ -150,7 +155,22 @@ public final class ListSectionHeaderNode: ASDisplayNode {
public func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, showBackground: Bool = true) {
self.validLayout = (size, leftInset, rightInset)
let labelSize = self.label.updateLayout(CGSize(width: max(0.0, size.width - leftInset - rightInset - 18.0), height: size.height))
- self.label.frame = CGRect(origin: CGPoint(x: leftInset + 16.0, y: 6.0 + UIScreenPixel), size: CGSize(width: labelSize.width, height: size.height))
+ let labelFrame = CGRect(origin: CGPoint(x: leftInset + 16.0, y: 6.0 + UIScreenPixel), size: CGSize(width: labelSize.width, height: labelSize.height))
+ self.label.frame = labelFrame
+
+ let labelBackgroundSize: CGFloat = labelSize.height
+ let labelBackgroundInnerInset: CGFloat = 2.0
+ let labelBackgroundInset: CGFloat = 10.0 + labelBackgroundInnerInset
+ if self.labelBackgroundView.image?.size.width != labelBackgroundSize + labelBackgroundInset * 2.0 {
+ self.labelBackgroundView.image = blurredImage(generateImage(CGSize(width: labelBackgroundSize + labelBackgroundInset * 2.0, height: labelBackgroundSize + labelBackgroundInset * 2.0), rotatedContext: { size, context in
+ context.clear(CGRect(origin: CGPoint(), size: size))
+ context.setFillColor(UIColor.white.cgColor)
+ context.fillEllipse(in: CGRect(origin: CGPoint(x: labelBackgroundInset - labelBackgroundInnerInset, y: labelBackgroundInset - labelBackgroundInnerInset), size: CGSize(width: labelBackgroundSize + labelBackgroundInnerInset * 2.0, height: labelBackgroundSize + labelBackgroundInnerInset * 2.0)))
+ })!, radius: 17, iterations: 3)?.stretchableImage(withLeftCapWidth: Int(labelBackgroundInset + labelBackgroundSize * 0.5), topCapHeight: Int(labelBackgroundInset + labelBackgroundSize * 0.5)).withRenderingMode(.alwaysTemplate)
+ }
+ self.labelBackgroundView.tintColor = self.theme.list.plainBackgroundColor.withAlphaComponent(self.theme.overallDarkAppearance ? 0.5 : 0.7)
+
+ self.labelBackgroundView.frame = labelFrame.insetBy(dx: -labelBackgroundInset - 4.0, dy: -labelBackgroundInset)
if let actionButton = self.actionButton, let actionButtonLabel = self.actionButtonLabel {
let buttonSize = actionButtonLabel.updateLayout(CGSize(width: size.width, height: size.height))
diff --git a/submodules/LocationUI/Sources/LocationActionListItem.swift b/submodules/LocationUI/Sources/LocationActionListItem.swift
index e84192d1..ea37651e 100644
--- a/submodules/LocationUI/Sources/LocationActionListItem.swift
+++ b/submodules/LocationUI/Sources/LocationActionListItem.swift
@@ -224,7 +224,7 @@ final class LocationActionListItemNode: ListViewItemNode {
self.venueIconNode = TransformImageNode()
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.addSubnode(self.backgroundNode)
self.addSubnode(self.separatorNode)
diff --git a/submodules/LocationUI/Sources/LocationAttributionItem.swift b/submodules/LocationUI/Sources/LocationAttributionItem.swift
index d090c91b..b38b7e90 100644
--- a/submodules/LocationUI/Sources/LocationAttributionItem.swift
+++ b/submodules/LocationUI/Sources/LocationAttributionItem.swift
@@ -65,7 +65,7 @@ private class LocationAttributionItemNode: ListViewItemNode {
self.imageNode.displaysAsynchronously = false
self.imageNode.displayWithoutProcessing = true
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.addSubnode(self.imageNode)
}
diff --git a/submodules/LocationUI/Sources/LocationInfoListItem.swift b/submodules/LocationUI/Sources/LocationInfoListItem.swift
index 4c3bca6e..fda4a00e 100644
--- a/submodules/LocationUI/Sources/LocationInfoListItem.swift
+++ b/submodules/LocationUI/Sources/LocationInfoListItem.swift
@@ -98,7 +98,7 @@ public final class LocationInfoListItemNode: ListViewItemNode {
self.venueIconNode = TransformImageNode()
self.venueIconNode.isUserInteractionEnabled = false
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.addSubnode(self.backgroundNode)
self.addSubnode(self.buttonNode)
diff --git a/submodules/LocationUI/Sources/LocationLiveListItem.swift b/submodules/LocationUI/Sources/LocationLiveListItem.swift
index 7df33503..5aaaf511 100644
--- a/submodules/LocationUI/Sources/LocationLiveListItem.swift
+++ b/submodules/LocationUI/Sources/LocationLiveListItem.swift
@@ -119,7 +119,7 @@ final class LocationLiveListItemNode: ListViewItemNode {
self.avatarNode = AvatarNode(font: avatarFont)
self.avatarNode.isLayerBacked = !smartInvertColorsEnabled()
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.addSubnode(self.backgroundNode)
self.addSubnode(self.separatorNode)
diff --git a/submodules/LocationUI/Sources/LocationPickerController.swift b/submodules/LocationUI/Sources/LocationPickerController.swift
index 9942427e..571b440f 100644
--- a/submodules/LocationUI/Sources/LocationPickerController.swift
+++ b/submodules/LocationUI/Sources/LocationPickerController.swift
@@ -129,7 +129,7 @@ public final class LocationPickerController: ViewController, AttachmentContainab
let navigationBarPresentationData = NavigationBarPresentationData(theme: NavigationBarTheme(rootControllerTheme: strongSelf.presentationData.theme, hideBackground: style == .glass, hideSeparator: true), strings: NavigationBarStrings(presentationStrings: strongSelf.presentationData.strings))
- strongSelf.navigationBar?.updatePresentationData(navigationBarPresentationData)
+ strongSelf.navigationBar?.updatePresentationData(navigationBarPresentationData, transition: .immediate)
strongSelf.searchNavigationContentNode?.updatePresentationData(strongSelf.presentationData)
strongSelf.updateBarButtons()
diff --git a/submodules/LocationUI/Sources/LocationPickerControllerNode.swift b/submodules/LocationUI/Sources/LocationPickerControllerNode.swift
index fef407f8..1cab3b16 100644
--- a/submodules/LocationUI/Sources/LocationPickerControllerNode.swift
+++ b/submodules/LocationUI/Sources/LocationPickerControllerNode.swift
@@ -1382,7 +1382,7 @@ final class LocationPickerControllerNode: ViewControllerTracingNode, CLLocationM
transition.updateFrame(view: titleView, frame: titleFrame)
}
- let barButtonSize = CGSize(width: 40.0, height: 40.0)
+ let barButtonSize = CGSize(width: 44.0, height: 44.0)
let cancelButtonSize = self.cancelButton.update(
transition: ComponentTransition(transition),
component: AnyComponent(GlassBarButtonComponent(
@@ -1393,7 +1393,7 @@ final class LocationPickerControllerNode: ViewControllerTracingNode, CLLocationM
component: AnyComponentWithIdentity(id: isPickingLocation ? "back" : "close", component: AnyComponent(
BundleIconComponent(
name: isPickingLocation ? "Navigation/Back" : "Navigation/Close",
- tintColor: self.presentationData.theme.rootController.navigationBar.glassBarButtonForegroundColor
+ tintColor: self.presentationData.theme.chat.inputPanel.panelControlColor
)
)),
action: { [weak self] _ in
@@ -1428,7 +1428,7 @@ final class LocationPickerControllerNode: ViewControllerTracingNode, CLLocationM
component: AnyComponentWithIdentity(id: "search", component: AnyComponent(
BundleIconComponent(
name: "Navigation/Search",
- tintColor: self.presentationData.theme.rootController.navigationBar.glassBarButtonForegroundColor
+ tintColor: self.presentationData.theme.chat.inputPanel.panelControlColor
)
)),
action: { [weak self] _ in
diff --git a/submodules/LocationUI/Sources/LocationSearchNavigationContentNode.swift b/submodules/LocationUI/Sources/LocationSearchNavigationContentNode.swift
index 8d2baf3c..2ece25f6 100644
--- a/submodules/LocationUI/Sources/LocationSearchNavigationContentNode.swift
+++ b/submodules/LocationUI/Sources/LocationSearchNavigationContentNode.swift
@@ -18,7 +18,7 @@ final class LocationSearchNavigationContentNode: NavigationBarContentNode {
self.presentationData = presentationData
self.interaction = interaction
- self.searchBar = SearchBarNode(theme: SearchBarNodeTheme(theme: presentationData.theme, hasSeparator: false), strings: presentationData.strings, fieldStyle: .modern)
+ self.searchBar = SearchBarNode(theme: SearchBarNodeTheme(theme: presentationData.theme, hasSeparator: false), presentationTheme: presentationData.theme, strings: presentationData.strings, fieldStyle: .modern)
self.searchBar.placeholderString = NSAttributedString(string: presentationData.strings.Map_Search, font: searchBarFont, textColor: presentationData.theme.rootController.navigationSearchBar.inputPlaceholderTextColor)
super.init()
@@ -38,10 +38,12 @@ final class LocationSearchNavigationContentNode: NavigationBarContentNode {
return 56.0
}
- override func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, transition: ContainedViewLayoutTransition) {
+ override func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, transition: ContainedViewLayoutTransition) -> CGSize {
let searchBarFrame = CGRect(origin: CGPoint(x: 0.0, y: size.height - self.nominalHeight), size: CGSize(width: size.width, height: 56.0))
self.searchBar.frame = searchBarFrame
self.searchBar.updateLayout(boundingSize: searchBarFrame.size, leftInset: leftInset, rightInset: rightInset, transition: transition)
+
+ return size
}
func activate() {
@@ -58,6 +60,6 @@ final class LocationSearchNavigationContentNode: NavigationBarContentNode {
func updatePresentationData(_ presentationData: PresentationData) {
self.presentationData = presentationData
- self.searchBar.updateThemeAndStrings(theme: SearchBarNodeTheme(theme: presentationData.theme, hasSeparator: false), strings: presentationData.strings)
+ self.searchBar.updateThemeAndStrings(theme: SearchBarNodeTheme(theme: presentationData.theme, hasSeparator: false), presentationTheme: presentationData.theme, strings: presentationData.strings)
}
}
diff --git a/submodules/LocationUI/Sources/LocationSectionHeaderItem.swift b/submodules/LocationUI/Sources/LocationSectionHeaderItem.swift
index 42f8bd29..3aeae080 100644
--- a/submodules/LocationUI/Sources/LocationSectionHeaderItem.swift
+++ b/submodules/LocationUI/Sources/LocationSectionHeaderItem.swift
@@ -58,7 +58,7 @@ private class LocationSectionHeaderItemNode: ListViewItemNode {
private var layoutParams: ListViewItemLayoutParams?
required init() {
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
}
override func layoutForParams(_ params: ListViewItemLayoutParams, item: ListViewItem, previousItem: ListViewItem?, nextItem: ListViewItem?) {
diff --git a/submodules/LocationUI/Sources/LocationViewController.swift b/submodules/LocationUI/Sources/LocationViewController.swift
index 173b9356..1a19c949 100644
--- a/submodules/LocationUI/Sources/LocationViewController.swift
+++ b/submodules/LocationUI/Sources/LocationViewController.swift
@@ -109,7 +109,7 @@ public final class LocationViewController: ViewController {
}
strongSelf.presentationData = presentationData
- strongSelf.navigationBar?.updatePresentationData(NavigationBarPresentationData(theme: NavigationBarTheme(rootControllerTheme: strongSelf.presentationData.theme).withUpdatedSeparatorColor(.clear), strings: NavigationBarStrings(presentationStrings: strongSelf.presentationData.strings)))
+ strongSelf.navigationBar?.updatePresentationData(NavigationBarPresentationData(theme: NavigationBarTheme(rootControllerTheme: strongSelf.presentationData.theme).withUpdatedSeparatorColor(.clear), strings: NavigationBarStrings(presentationStrings: strongSelf.presentationData.strings)), transition: .immediate)
strongSelf.updateRightBarButton()
diff --git a/submodules/MediaPickerUI/BUILD b/submodules/MediaPickerUI/BUILD
index 3a979c45..046b14d0 100644
--- a/submodules/MediaPickerUI/BUILD
+++ b/submodules/MediaPickerUI/BUILD
@@ -57,6 +57,7 @@ swift_library(
"//submodules/TelegramUI/Components/EdgeEffect",
"//submodules/TelegramUI/Components/GlassBarButtonComponent",
"//submodules/TelegramUI/Components/LottieComponent",
+ "//submodules/TelegramUI/Components/AlertComponent",
],
visibility = [
"//visibility:public",
diff --git a/submodules/MediaPickerUI/Sources/MediaGroupsAlbumGridItem.swift b/submodules/MediaPickerUI/Sources/MediaGroupsAlbumGridItem.swift
index 0f9a4763..dfeba384 100644
--- a/submodules/MediaPickerUI/Sources/MediaGroupsAlbumGridItem.swift
+++ b/submodules/MediaPickerUI/Sources/MediaGroupsAlbumGridItem.swift
@@ -130,7 +130,7 @@ private final class MediaGroupsGridAlbumItemNode : ListViewItemNode {
self.countNode = TextNode()
self.countNode.isUserInteractionEnabled = false
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.addSubnode(self.containerNode)
self.containerNode.addSubnode(self.imageNode)
@@ -283,7 +283,7 @@ private class MediaGroupsAlbumGridItemNode: ListViewItemNode {
self.listNode = ListView()
self.listNode.transform = CATransform3DMakeRotation(-CGFloat.pi / 2.0, 0.0, 0.0, 1.0)
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.addSubnode(self.listNode)
}
diff --git a/submodules/MediaPickerUI/Sources/MediaGroupsAlbumItem.swift b/submodules/MediaPickerUI/Sources/MediaGroupsAlbumItem.swift
index 7cc61779..d086a038 100644
--- a/submodules/MediaPickerUI/Sources/MediaGroupsAlbumItem.swift
+++ b/submodules/MediaPickerUI/Sources/MediaGroupsAlbumItem.swift
@@ -172,7 +172,7 @@ class MediaGroupsAlbumItemNode: ListViewItemNode {
self.activateArea = AccessibilityAreaNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.iconNode)
self.addSubnode(self.titleNode)
diff --git a/submodules/MediaPickerUI/Sources/MediaGroupsHeaderItem.swift b/submodules/MediaPickerUI/Sources/MediaGroupsHeaderItem.swift
index b934d07d..409f895d 100644
--- a/submodules/MediaPickerUI/Sources/MediaGroupsHeaderItem.swift
+++ b/submodules/MediaPickerUI/Sources/MediaGroupsHeaderItem.swift
@@ -59,7 +59,7 @@ private class MediaGroupsHeaderItemNode: ListViewItemNode {
init() {
self.titleNode = TextNode()
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.addSubnode(self.titleNode)
}
diff --git a/submodules/MediaPickerUI/Sources/MediaPickerScreen.swift b/submodules/MediaPickerUI/Sources/MediaPickerScreen.swift
index b59c8fe0..a561b2df 100644
--- a/submodules/MediaPickerUI/Sources/MediaPickerScreen.swift
+++ b/submodules/MediaPickerUI/Sources/MediaPickerScreen.swift
@@ -33,6 +33,7 @@ import ComponentFlow
import BundleIconComponent
import LottieComponent
import GlassBarButtonComponent
+import AlertComponent
final class MediaPickerInteraction {
let downloadManager: AssetDownloadManager
@@ -1436,7 +1437,7 @@ public final class MediaPickerScreenImpl: ViewController, MediaPickerScreen, Att
}
if asFile && hasHeic {
- controller.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: nil, text: self.presentationData.strings.MediaPicker_JpegConversionText, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.MediaPicker_KeepHeic, action: {
+ controller.present(textAlertController(context: controller.context, updatedPresentationData: self.controller?.updatedPresentationData, title: nil, text: self.presentationData.strings.MediaPicker_JpegConversionText, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.MediaPicker_KeepHeic, action: {
proceed(false)
}), TextAlertAction(type: .genericAction, title: self.presentationData.strings.MediaPicker_ConvertToJpeg, action: {
proceed(true)
@@ -2042,26 +2043,26 @@ public final class MediaPickerScreenImpl: ViewController, MediaPickerScreen, Att
if let _ = item as? TGMediaPickerGalleryPhotoItem {
if self.bannedSendPhotos != nil {
- self.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: nil, text: self.presentationData.strings.Chat_SendNotAllowedPhoto, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ self.present(textAlertController(context: self.context, updatedPresentationData: self.updatedPresentationData, title: nil, text: self.presentationData.strings.Chat_SendNotAllowedPhoto, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
return false
}
} else if let _ = item as? TGMediaPickerGalleryVideoItem {
if self.bannedSendVideos != nil {
- self.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: nil, text: self.presentationData.strings.Chat_SendNotAllowedVideo, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ self.present(textAlertController(context: self.context, updatedPresentationData: self.updatedPresentationData, title: nil, text: self.presentationData.strings.Chat_SendNotAllowedVideo, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
return false
}
} else if let asset = item as? TGMediaAsset {
if asset.isVideo {
if self.bannedSendVideos != nil {
- self.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: nil, text: self.presentationData.strings.Chat_SendNotAllowedVideo, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ self.present(textAlertController(context: self.context, updatedPresentationData: self.updatedPresentationData, title: nil, text: self.presentationData.strings.Chat_SendNotAllowedVideo, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
return false
}
} else {
if self.bannedSendPhotos != nil {
- self.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: nil, text: self.presentationData.strings.Chat_SendNotAllowedPhoto, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ self.present(textAlertController(context: self.context, updatedPresentationData: self.updatedPresentationData, title: nil, text: self.presentationData.strings.Chat_SendNotAllowedPhoto, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
return false
}
@@ -2112,6 +2113,10 @@ public final class MediaPickerScreenImpl: ViewController, MediaPickerScreen, Att
}
}
+ self.selectedButtonNode.action = { [weak self] in
+ self?.selectedPressed()
+ }
+
self.navigationItem.titleView = self.titleView
if case let .assets(collection, mode) = self.subject, mode != .default {
@@ -2184,8 +2189,6 @@ public final class MediaPickerScreenImpl: ViewController, MediaPickerScreen, Att
// }
// }
- self.selectedButtonNode.addTarget(self, action: #selector(self.selectedPressed), forControlEvents: .touchUpInside)
-
self.scrollToTop = { [weak self] in
if let strongSelf = self {
if let webSearchController = strongSelf.webSearchController {
@@ -2220,26 +2223,26 @@ public final class MediaPickerScreenImpl: ViewController, MediaPickerScreen, Att
if let self = self, let selectionState = self.interaction?.selectionState {
if let _ = item as? TGMediaPickerGalleryPhotoItem {
if self.bannedSendPhotos != nil {
- self.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: nil, text: self.presentationData.strings.Chat_SendNotAllowedPhoto, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ self.present(textAlertController(context: self.context, updatedPresentationData: self.updatedPresentationData, title: nil, text: self.presentationData.strings.Chat_SendNotAllowedPhoto, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
return false
}
} else if let _ = item as? TGMediaPickerGalleryVideoItem {
if self.bannedSendVideos != nil {
- self.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: nil, text: self.presentationData.strings.Chat_SendNotAllowedVideo, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ self.present(textAlertController(context: self.context, updatedPresentationData: self.updatedPresentationData, title: nil, text: self.presentationData.strings.Chat_SendNotAllowedVideo, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
return false
}
} else if let asset = item as? TGMediaAsset {
if asset.isVideo {
if self.bannedSendVideos != nil {
- self.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: nil, text: self.presentationData.strings.Chat_SendNotAllowedVideo, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ self.present(textAlertController(context: self.context, updatedPresentationData: self.updatedPresentationData, title: nil, text: self.presentationData.strings.Chat_SendNotAllowedVideo, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
return false
}
} else {
if self.bannedSendPhotos != nil {
- self.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: nil, text: self.presentationData.strings.Chat_SendNotAllowedPhoto, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ self.present(textAlertController(context: self.context, updatedPresentationData: self.updatedPresentationData, title: nil, text: self.presentationData.strings.Chat_SendNotAllowedPhoto, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
return false
}
@@ -2548,7 +2551,7 @@ public final class MediaPickerScreenImpl: ViewController, MediaPickerScreen, Att
let useGlassButtons = (isBack || !self.controllerNode.scrolledToTop) && !self.controllerNode.isSwitchingAssetGroup
let barButtonSideInset: CGFloat = 16.0
- let barButtonSize = CGSize(width: 40.0, height: 40.0)
+ let barButtonSize = CGSize(width: 44.0, height: 44.0)
var buttonTransition = ComponentTransition.easeInOut(duration: 0.25)
if case let .animated(duration, _) = transition, duration > 0.25 {
@@ -2580,13 +2583,13 @@ public final class MediaPickerScreenImpl: ViewController, MediaPickerScreen, Att
transition: buttonTransition,
component: AnyComponent(GlassBarButtonComponent(
size: barButtonSize,
- backgroundColor: self.presentationData.theme.rootController.navigationBar.glassBarButtonBackgroundColor,
+ backgroundColor: nil,
isDark: self.presentationData.theme.overallDarkAppearance,
- state: useGlassButtons ? .glass : .generic,
+ state: .glass,
component: AnyComponentWithIdentity(id: isBack ? "back" : "close", component: AnyComponent(
BundleIconComponent(
name: isBack ? "Navigation/Back" : "Navigation/Close",
- tintColor: self.presentationData.theme.rootController.navigationBar.glassBarButtonForegroundColor
+ tintColor: self.presentationData.theme.chat.inputPanel.panelControlColor
)
)),
action: { [weak self] _ in
@@ -2611,15 +2614,15 @@ public final class MediaPickerScreenImpl: ViewController, MediaPickerScreen, Att
transition: buttonTransition,
component: AnyComponent(GlassBarButtonComponent(
size: barButtonSize,
- backgroundColor: self.presentationData.theme.rootController.navigationBar.glassBarButtonBackgroundColor,
+ backgroundColor: nil,
isDark: self.presentationData.theme.overallDarkAppearance,
- state: useGlassButtons ? .glass : .generic,
+ state: .glass,
component: AnyComponentWithIdentity(id: "more", component: AnyComponent(
LottieComponent(
content: LottieComponent.AppBundleContent(
name: "anim_morewide"
),
- color: self.presentationData.theme.rootController.navigationBar.glassBarButtonForegroundColor,
+ color: self.presentationData.theme.chat.inputPanel.panelControlColor,
size: CGSize(width: 34.0, height: 34.0),
playOnce: self.moreButtonPlayOnce
)
@@ -2673,7 +2676,7 @@ public final class MediaPickerScreenImpl: ViewController, MediaPickerScreen, Att
} else {
navigationBarPresentationData = NavigationBarPresentationData(presentationData: self.presentationData)
}
- self.navigationBar?.updatePresentationData(navigationBarPresentationData)
+ self.navigationBar?.updatePresentationData(navigationBarPresentationData, transition: .immediate)
self.titleView.theme = self.presentationData.theme
self.cancelButtonNode.theme = self.presentationData.theme
self.moreButtonNode.theme = self.presentationData.theme
@@ -2717,16 +2720,22 @@ public final class MediaPickerScreenImpl: ViewController, MediaPickerScreen, Att
} else {
text = self.presentationData.strings.Attachment_CancelSelectionAlertText
}
-
- let controller = textAlertController(context: self.context, title: nil, text: text, actions: [TextAlertAction(type: .genericAction, title: self.presentationData.strings.Attachment_CancelSelectionAlertNo, action: {
- }), TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Attachment_CancelSelectionAlertYes, action: { [weak self] in
- self?.dismissAllTooltips()
- completion()
- })])
- controller.dismissed = { [weak self] _ in
+ let alertController = AlertScreen(
+ context: self.context,
+ title: nil,
+ text: text,
+ actions: [
+ .init(title: self.presentationData.strings.Attachment_CancelSelectionAlertNo),
+ .init(title: self.presentationData.strings.Attachment_CancelSelectionAlertYes, type: .default, action: { [weak self] in
+ self?.dismissAllTooltips()
+ completion()
+ }),
+ ]
+ )
+ alertController.dismissed = { [weak self] _ in
self?.isDismissing = false
}
- self.present(controller, in: .window(.root))
+ self.present(alertController, in: .window(.root))
} else {
completion()
}
@@ -3777,126 +3786,188 @@ public func avatarMediaPickerController(
performDelete: @escaping () -> Void,
completion: @escaping (Any?, UIView?, CGRect, UIImage?, Bool, @escaping (Bool?) -> (UIView, CGRect)?, @escaping () -> Void) -> Void,
dismissed: @escaping () -> Void
-) -> ViewController {
- let presentationData = context.sharedContext.currentPresentationData.with({ $0 })
- let updatedPresentationData: (PresentationData, Signal) = (presentationData, .single(presentationData))
- let controller = AttachmentController(
- context: context,
- updatedPresentationData: updatedPresentationData,
- style: .glass,
- chatLocation: nil,
- buttons: [.standalone],
- initialButton: .standalone,
- fromMenu: false,
- hasTextInput: false,
- makeEntityInputView: {
- return nil
- })
- controller.forceSourceRect = true
- controller.getSourceRect = getSourceRect
- controller.requestController = { [weak controller] _, present in
- var mainButtonState: AttachmentMainButtonState?
-
- if canDelete {
- mainButtonState = AttachmentMainButtonState(text: presentationData.strings.MediaPicker_RemovePhoto, font: .regular, background: .color(.clear), textColor: presentationData.theme.actionSheet.destructiveActionTextColor, isVisible: true, progress: .none, isEnabled: true, hasShimmer: false)
+) -> (controller: ViewController?, holder: Any?) {
+ if #available(iOS 14.0, *), PHPhotoLibrary.authorizationStatus(for: .readWrite) != .authorized {
+ final class PickerDelegate: NSObject, PHPickerViewControllerDelegate {
+ var completion: ((Any?, UIView?, CGRect, UIImage?, Bool, @escaping (Bool?) -> (UIView, CGRect)?, @escaping () -> Void) -> Void)?
+
+ func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) {
+ picker.dismiss(animated: true)
+
+ for item in results {
+ if item.itemProvider.canLoadObject(ofClass: UIImage.self) {
+ item.itemProvider.loadObject(ofClass: UIImage.self) { image, error in
+ if let uiImage = image as? UIImage {
+ Queue.mainQueue().async {
+ self.completion?(uiImage, nil, CGRect(), nil, false, { _ in return nil }, {})
+ }
+ }
+ }
+ }
+ }
+ }
}
- let mediaPickerController = MediaPickerScreenImpl(
+ let holder = PickerDelegate()
+ holder.completion = completion
+
+ let openMediaPicker = {
+ var configuration = PHPickerConfiguration(photoLibrary: .shared())
+ configuration.filter = .images
+ configuration.selectionLimit = 1
+
+ let picker = PHPickerViewController(configuration: configuration)
+ picker.delegate = holder
+ (context.sharedContext.mainWindow?.viewController as? NavigationController)?.topViewController?.present(picker, animated: true, completion: nil)
+ }
+ let presentationData = context.sharedContext.currentPresentationData.with { $0 }
+ let controller = ActionSheetController(presentationData: presentationData)
+ let dismissAction: () -> Void = { [weak controller] in
+ controller?.dismissAnimated()
+ }
+
+ var items: [ActionSheetButtonItem] = [
+ ActionSheetButtonItem(title: presentationData.strings.Settings_SetNewProfilePhotoOrVideo, color: .accent, action: {
+ dismissAction()
+ openMediaPicker()
+ }),
+ ActionSheetButtonItem(title: presentationData.strings.ProfilePhoto_SetEmoji, color: .accent, action: {
+ dismissAction()
+ completion(nil, nil, CGRect(), nil, false, { _ in return nil }, {})
+ })
+ ]
+ if canDelete {
+ items.append(ActionSheetButtonItem(title: presentationData.strings.MediaPicker_RemovePhoto, color: .destructive, action: {
+ dismissAction()
+ performDelete()
+ }))
+ }
+ controller.setItemGroups([
+ ActionSheetItemGroup(items: items),
+ ActionSheetItemGroup(items: [ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, action: { dismissAction() })])
+ ])
+ return (controller, holder)
+ } else {
+ let presentationData = context.sharedContext.currentPresentationData.with({ $0 })
+ let updatedPresentationData: (PresentationData, Signal) = (presentationData, .single(presentationData))
+ let controller = AttachmentController(
context: context,
updatedPresentationData: updatedPresentationData,
style: .glass,
- peer: nil,
- threadTitle: nil,
chatLocation: nil,
- bannedSendPhotos: nil,
- bannedSendVideos: nil,
- subject: .assets(nil, .createAvatar),
- mainButtonState: mainButtonState,
- mainButtonAction: { [weak controller] in
- controller?.dismiss(animated: true)
- performDelete()
- }
- )
- mediaPickerController.customSelection = { controller, result in
- if let result = result as? PHAsset {
- controller.updateHiddenMediaId(result.localIdentifier)
- if let transitionView = controller.transitionView(for: result.localIdentifier, snapshot: false) {
- let transitionOut: (Bool?) -> (UIView, CGRect)? = { isNew in
- if let isNew {
- if isNew {
- controller.updateHiddenMediaId(nil)
- if let transitionView = controller.defaultTransitionView() {
- return (transitionView, transitionView.bounds)
- }
- } else if let transitionView = controller.transitionView(for: result.localIdentifier, snapshot: false) {
- return (transitionView, transitionView.bounds)
- }
- }
- return nil
- }
- completion(result, transitionView, transitionView.bounds, controller.transitionImage(for: result.localIdentifier), false, transitionOut, { [weak controller] in
- controller?.updateHiddenMediaId(nil)
- })
- }
- }
- }
- mediaPickerController.openAvatarEditor = { [weak controller] in
- completion(nil, nil, .zero, nil, false, { _ in return nil }, {
+ buttons: [.standalone],
+ initialButton: .standalone,
+ fromMenu: false,
+ hasTextInput: false,
+ makeEntityInputView: {
+ return nil
})
- controller?.dismiss(animated: true)
- }
- mediaPickerController.openCamera = { [weak controller] cameraHolder in
- let _ = controller
- guard let cameraHolder = cameraHolder as? CameraHolder else {
- return
+ controller.forceSourceRect = true
+ controller.getSourceRect = getSourceRect
+ controller.requestController = { [weak controller] _, present in
+ var mainButtonState: AttachmentMainButtonState?
+
+ if canDelete {
+ mainButtonState = AttachmentMainButtonState(text: presentationData.strings.MediaPicker_RemovePhoto, font: .regular, background: .color(.clear), textColor: presentationData.theme.actionSheet.destructiveActionTextColor, isVisible: true, progress: .none, isEnabled: true, hasShimmer: false)
}
- var returnToCameraImpl: (() -> Void)?
-
- let cameraScreen = context.sharedContext.makeCameraScreen(
+ let mediaPickerController = MediaPickerScreenImpl(
context: context,
- mode: .avatar,
- cameraHolder: cameraHolder,
- transitionIn: CameraScreenTransitionIn(
- sourceView: cameraHolder.parentView,
- sourceRect: cameraHolder.parentView.bounds,
- sourceCornerRadius: 0.0,
- useFillAnimation: false
- ),
- transitionOut: { _ in
- return CameraScreenTransitionOut(
- destinationView: cameraHolder.parentView,
- destinationRect: cameraHolder.parentView.bounds,
- destinationCornerRadius: 0.0
- )
- },
- completion: { result, commit in
- completion(result, nil, .zero, nil, true, { _ in return nil }, {
- returnToCameraImpl?()
- })
- },
- transitionedOut: { [weak cameraHolder] in
- if let cameraHolder {
- cameraHolder.restore()
- }
+ updatedPresentationData: updatedPresentationData,
+ style: .glass,
+ peer: nil,
+ threadTitle: nil,
+ chatLocation: nil,
+ bannedSendPhotos: nil,
+ bannedSendVideos: nil,
+ subject: .assets(nil, .createAvatar),
+ mainButtonState: mainButtonState,
+ mainButtonAction: { [weak controller] in
+ controller?.dismiss(animated: true)
+ performDelete()
}
)
- controller?.push(cameraScreen)
-
- returnToCameraImpl = { [weak cameraScreen] in
- if let cameraScreen = cameraScreen as? CameraScreen {
- cameraScreen.returnFromEditor()
+ mediaPickerController.customSelection = { controller, result in
+ if let result = result as? PHAsset {
+ controller.updateHiddenMediaId(result.localIdentifier)
+ if let transitionView = controller.transitionView(for: result.localIdentifier, snapshot: false) {
+ let transitionOut: (Bool?) -> (UIView, CGRect)? = { isNew in
+ if let isNew {
+ if isNew {
+ controller.updateHiddenMediaId(nil)
+ if let transitionView = controller.defaultTransitionView() {
+ return (transitionView, transitionView.bounds)
+ }
+ } else if let transitionView = controller.transitionView(for: result.localIdentifier, snapshot: false) {
+ return (transitionView, transitionView.bounds)
+ }
+ }
+ return nil
+ }
+ completion(result, transitionView, transitionView.bounds, controller.transitionImage(for: result.localIdentifier), false, transitionOut, { [weak controller] in
+ controller?.updateHiddenMediaId(nil)
+ })
+ }
}
}
+ mediaPickerController.openAvatarEditor = { [weak controller] in
+ completion(nil, nil, .zero, nil, false, { _ in return nil }, {
+ })
+ controller?.dismiss(animated: true)
+ }
+ mediaPickerController.openCamera = { [weak controller] cameraHolder in
+ let _ = controller
+ guard let cameraHolder = cameraHolder as? CameraHolder else {
+ return
+ }
+
+ var returnToCameraImpl: (() -> Void)?
+
+ let cameraScreen = context.sharedContext.makeCameraScreen(
+ context: context,
+ mode: .avatar,
+ cameraHolder: cameraHolder,
+ transitionIn: CameraScreenTransitionIn(
+ sourceView: cameraHolder.parentView,
+ sourceRect: cameraHolder.parentView.bounds,
+ sourceCornerRadius: 0.0,
+ useFillAnimation: false
+ ),
+ transitionOut: { _ in
+ return CameraScreenTransitionOut(
+ destinationView: cameraHolder.parentView,
+ destinationRect: cameraHolder.parentView.bounds,
+ destinationCornerRadius: 0.0
+ )
+ },
+ completion: { result, commit in
+ completion(result, nil, .zero, nil, true, { _ in return nil }, {
+ returnToCameraImpl?()
+ })
+ },
+ transitionedOut: { [weak cameraHolder] in
+ if let cameraHolder {
+ cameraHolder.restore()
+ }
+ }
+ )
+ controller?.push(cameraScreen)
+
+ returnToCameraImpl = { [weak cameraScreen] in
+ if let cameraScreen = cameraScreen as? CameraScreen {
+ cameraScreen.returnFromEditor()
+ }
+ }
+ }
+ present(mediaPickerController, mediaPickerController.mediaPickerContext)
}
- present(mediaPickerController, mediaPickerController.mediaPickerContext)
+ controller.willDismiss = {
+ dismissed()
+ }
+ controller.navigationPresentation = .flatModal
+ controller.supportedOrientations = ViewControllerSupportedOrientations(regularSize: .all, compactSize: .portrait)
+ return (controller, nil)
}
- controller.willDismiss = {
- dismissed()
- }
- controller.navigationPresentation = .flatModal
- controller.supportedOrientations = ViewControllerSupportedOrientations(regularSize: .all, compactSize: .portrait)
- return controller
}
@@ -3961,12 +4032,13 @@ public func coverMediaPickerController(
return controller
}
-private class SelectedButtonNode: HighlightTrackingButtonNode {
+private class SelectedButtonNode: ASDisplayNode {
private let containerView: UIView
private let backgroundView: GlassBackgroundView?
private let background: ASImageNode?
private let icon = ASImageNode()
private let label = ImmediateAnimatedCountLabelNode()
+ private let button = HighlightTrackingButton()
private let glass: Bool
@@ -3982,6 +4054,8 @@ private class SelectedButtonNode: HighlightTrackingButtonNode {
private var count: Int32 = 0
+ var action: () -> Void = {}
+
init(theme: PresentationTheme, glass: Bool) {
self.theme = theme
self.glass = glass
@@ -4007,6 +4081,9 @@ private class SelectedButtonNode: HighlightTrackingButtonNode {
self.view.addSubview(self.containerView)
if let backgroundView = self.backgroundView {
+ backgroundView.contentView.addSubnode(self.icon)
+ backgroundView.contentView.addSubnode(self.label)
+ backgroundView.contentView.addSubview(self.button)
self.containerView.addSubview(backgroundView)
}
if let background = self.background {
@@ -4014,35 +4091,19 @@ private class SelectedButtonNode: HighlightTrackingButtonNode {
self.containerView.addSubnode(background)
}
- self.containerView.addSubnode(self.icon)
- self.containerView.addSubnode(self.label)
+
- self.highligthedChanged = { [weak self] highlighted in
- if let self {
- if glass {
- let transition = ComponentTransition(animation: .curve(duration: highlighted ? 0.25 : 0.35, curve: .spring))
- if highlighted {
- transition.setScale(view: self.containerView, scale: 1.2)
- } else {
- transition.setScale(view: self.containerView, scale: 1.0)
- }
- } else {
- if highlighted {
- self.containerView.layer.removeAnimation(forKey: "opacity")
- self.containerView.alpha = 0.4
- } else {
- self.containerView.alpha = 1.0
- self.containerView.layer.animateAlpha(from: 0.4, to: 1.0, duration: 0.2)
- }
- }
- }
- }
+ self.button.addTarget(self, action: #selector(self.tapped), for: .touchUpInside)
+ }
+
+ @objc private func tapped() {
+ self.action()
}
func update(count: Int32) -> CGSize {
self.count = count
- let diameter: CGFloat = self.glass ? 40.0 : 21.0
+ let diameter: CGFloat = self.glass ? 44.0 : 21.0
let font = self.glass ? Font.with(size: 17.0, weight: .medium, traits: [.monospacedNumbers]) : Font.with(size: 15.0, design: .round, weight: .semibold, traits: [.monospacedNumbers])
let stringValue = "\(max(1, count))"
@@ -4078,11 +4139,13 @@ private class SelectedButtonNode: HighlightTrackingButtonNode {
self.containerView.frame = backgroundFrame
if let backgroundView = self.backgroundView {
backgroundView.frame = backgroundFrame
- backgroundView.update(size: backgroundFrame.size, cornerRadius: backgroundFrame.size.height * 0.5, isDark: false, tintColor: .init(kind: .custom, color: self.theme.list.itemCheckColors.fillColor), transition: .immediate)
+ backgroundView.update(size: backgroundFrame.size, cornerRadius: backgroundFrame.size.height * 0.5, isDark: false, tintColor: .init(kind: .custom, color: self.theme.list.itemCheckColors.fillColor), isInteractive: true, transition: .immediate)
}
if let background = self.background {
background.frame = backgroundFrame
}
+
+ self.button.frame = CGRect(origin: .zero, size: size)
return size
}
diff --git a/submodules/MediaPickerUI/Sources/MediaPickerTitleView.swift b/submodules/MediaPickerUI/Sources/MediaPickerTitleView.swift
index aaaba5dc..cbb89912 100644
--- a/submodules/MediaPickerUI/Sources/MediaPickerTitleView.swift
+++ b/submodules/MediaPickerUI/Sources/MediaPickerTitleView.swift
@@ -18,7 +18,7 @@ final class MediaPickerTitleView: UIView {
public var theme: PresentationTheme {
didSet {
- self.titleNode.attributedText = NSAttributedString(string: self.title, font: NavigationBar.titleFont, textColor: self.isDark ? .white : self.theme.rootController.navigationBar.primaryTextColor)
+ self.titleNode.attributedText = NSAttributedString(string: self.title, font: Font.with(size: 17.0, design: .regular, weight: .semibold, traits: [.monospacedNumbers]), textColor: self.isDark ? .white : self.theme.rootController.navigationBar.primaryTextColor)
self.subtitleNode.attributedText = NSAttributedString(string: self.subtitle, font: Font.regular(12.0), textColor: self.isDark ? .white.withAlphaComponent(0.5) : self.theme.rootController.navigationBar.secondaryTextColor)
self.segmentedControlNode.updateTheme(SegmentedControlTheme(theme: self.theme))
if self.glass {
@@ -31,7 +31,7 @@ final class MediaPickerTitleView: UIView {
public var isDark: Bool = false {
didSet {
if self.isDark != oldValue {
- self.titleNode.attributedText = NSAttributedString(string: self.title, font: NavigationBar.titleFont, textColor: self.isDark ? .white : self.theme.rootController.navigationBar.primaryTextColor)
+ self.titleNode.attributedText = NSAttributedString(string: self.title, font: Font.with(size: 17.0, design: .regular, weight: .semibold, traits: [.monospacedNumbers]), textColor: self.isDark ? .white : self.theme.rootController.navigationBar.primaryTextColor)
self.subtitleNode.attributedText = NSAttributedString(string: self.subtitle, font: Font.regular(12.0), textColor: self.isDark ? .white.withAlphaComponent(0.5) : self.theme.rootController.navigationBar.secondaryTextColor)
if self.glass {
self.arrowNode.image = generateTintedImage(image: UIImage(bundleImageName: "Navigation/TitleExpand"), color: self.isDark ? UIColor.white.withAlphaComponent(0.5) : self.theme.rootController.navigationBar.primaryTextColor.withAlphaComponent(0.4))
@@ -44,7 +44,7 @@ final class MediaPickerTitleView: UIView {
public var title: String = "" {
didSet {
if self.title != oldValue {
- self.titleNode.attributedText = NSAttributedString(string: self.title, font: NavigationBar.titleFont, textColor: self.isDark ? .white : self.theme.rootController.navigationBar.primaryTextColor)
+ self.titleNode.attributedText = NSAttributedString(string: self.title, font: Font.with(size: 17.0, design: .regular, weight: .semibold, traits: [.monospacedNumbers]), textColor: self.isDark ? .white : self.theme.rootController.navigationBar.primaryTextColor)
self.setNeedsLayout()
}
}
@@ -260,7 +260,7 @@ final class MediaPickerTitleView: UIView {
totalHeight += subtitleSize.height
}
- let verticalOffset: CGFloat = self.glass ? 3.0 : 0.0
+ let verticalOffset: CGFloat = self.glass ? -1.0 : 0.0
let arrowOffset: CGFloat = self.glass ? 1.0 : 5.0
var totalWidth = titleSize.width
diff --git a/submodules/MtProtoKit/Sources/MTApiEnvironment.m b/submodules/MtProtoKit/Sources/MTApiEnvironment.m
index e4d60104..14197ec5 100644
--- a/submodules/MtProtoKit/Sources/MTApiEnvironment.m
+++ b/submodules/MtProtoKit/Sources/MTApiEnvironment.m
@@ -1,7 +1,7 @@
#import
#if TARGET_OS_IPHONE
-# import
+#import
#else
#endif
@@ -10,888 +10,996 @@
#import
-static NSData * _Nullable parseHexString(NSString * _Nonnull hex) {
- if ([hex length] % 2 != 0) {
- return nil;
+static NSData *_Nullable parseHexString(NSString *_Nonnull hex) {
+ if ([hex length] % 2 != 0) {
+ return nil;
+ }
+ char buf[3];
+ buf[2] = '\0';
+ uint8_t *bytes = (uint8_t *)malloc(hex.length / 2);
+ uint8_t *bp = bytes;
+ for (CFIndex i = 0; i < [hex length]; i += 2) {
+ buf[0] = [hex characterAtIndex:i];
+ buf[1] = [hex characterAtIndex:i + 1];
+ char *b2 = NULL;
+ *bp++ = strtol(buf, &b2, 16);
+ if (b2 != buf + 2) {
+ return nil;
}
- char buf[3];
- buf[2] = '\0';
- uint8_t *bytes = (uint8_t *)malloc(hex.length / 2);
- uint8_t *bp = bytes;
- for (CFIndex i = 0; i < [hex length]; i += 2) {
- buf[0] = [hex characterAtIndex:i];
- buf[1] = [hex characterAtIndex:i+1];
- char *b2 = NULL;
- *bp++ = strtol(buf, &b2, 16);
- if (b2 != buf + 2) {
- return nil;
- }
- }
-
- return [NSData dataWithBytesNoCopy:bytes length:[hex length]/2 freeWhenDone:YES];
+ }
+
+ return [NSData dataWithBytesNoCopy:bytes
+ length:[hex length] / 2
+ freeWhenDone:YES];
}
-static NSString * _Nonnull dataToHexString(NSData * _Nonnull data) {
- const unsigned char *dataBuffer = (const unsigned char *)[data bytes];
- if (dataBuffer == NULL) {
- return @"";
- }
-
- NSUInteger dataLength = [data length];
- NSMutableString *hexString = [NSMutableString stringWithCapacity:(dataLength * 2)];
-
- for (int i = 0; i < (int)dataLength; ++i) {
- [hexString appendString:[NSString stringWithFormat:@"%02lx", (unsigned long)dataBuffer[i]]];
- }
-
- return hexString;
+static NSString *_Nonnull dataToHexString(NSData *_Nonnull data) {
+ const unsigned char *dataBuffer = (const unsigned char *)[data bytes];
+ if (dataBuffer == NULL) {
+ return @"";
+ }
+
+ NSUInteger dataLength = [data length];
+ NSMutableString *hexString =
+ [NSMutableString stringWithCapacity:(dataLength * 2)];
+
+ for (int i = 0; i < (int)dataLength; ++i) {
+ [hexString
+ appendString:[NSString stringWithFormat:@"%02lx",
+ (unsigned long)dataBuffer[i]]];
+ }
+
+ return hexString;
}
static NSData *base64_decode(NSString *str) {
- if ([NSData instancesRespondToSelector:@selector(initWithBase64EncodedString:options:)]) {
- NSData *data = [[NSData alloc] initWithBase64EncodedString:str options:NSDataBase64DecodingIgnoreUnknownCharacters];
- return data;
- } else {
+ if ([NSData instancesRespondToSelector:@selector
+ (initWithBase64EncodedString:options:)]) {
+ NSData *data = [[NSData alloc]
+ initWithBase64EncodedString:str
+ options:
+ NSDataBase64DecodingIgnoreUnknownCharacters];
+ return data;
+ } else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- return [[NSData alloc] initWithBase64Encoding:[str stringByReplacingOccurrencesOfString:@"[^A-Za-z0-9+/=]" withString:@"" options:NSRegularExpressionSearch range:NSMakeRange(0, [str length])]];
+ return [[NSData alloc]
+ initWithBase64Encoding:
+ [str stringByReplacingOccurrencesOfString:@"[^A-Za-z0-9+/=]"
+ withString:@""
+ options:NSRegularExpressionSearch
+ range:NSMakeRange(
+ 0, [str length])]];
#pragma clang diagnostic pop
- }
+ }
}
@implementation MTProxySecret
-- (instancetype _Nullable)initWithSecret:(NSData * _Nonnull)secret {
- self = [super init];
- if (self != nil) {
- _secret = secret;
- }
- return self;
+- (instancetype _Nullable)initWithSecret:(NSData *_Nonnull)secret {
+ self = [super init];
+ if (self != nil) {
+ _secret = secret;
+ }
+ return self;
}
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
- self = [super init];
- if (self != nil) {
- _secret = [aDecoder decodeObjectForKey:@"secret"];
- }
- return self;
+ self = [super init];
+ if (self != nil) {
+ _secret = [aDecoder decodeObjectForKey:@"secret"];
+ }
+ return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder {
- [aCoder encodeObject:_secret forKey:@"secret"];
+ [aCoder encodeObject:_secret forKey:@"secret"];
}
-+ (MTProxySecret * _Nullable)parse:(NSString * _Nonnull)string {
- NSData *hexData = parseHexString(string);
- if (hexData == nil) {
- NSString *finalString = @"";
- finalString = [finalString stringByAppendingString:[string stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"="]]];
- finalString = [finalString stringByReplacingOccurrencesOfString:@"-" withString:@"+"];
- finalString = [finalString stringByReplacingOccurrencesOfString:@"_" withString:@"/"];
- while (finalString.length % 4 != 0) {
- finalString = [finalString stringByAppendingString:@"="];
- }
-
- hexData = base64_decode(finalString);
++ (MTProxySecret *_Nullable)parse:(NSString *_Nonnull)string {
+ NSData *hexData = parseHexString(string);
+ if (hexData == nil) {
+ NSString *finalString = @"";
+ finalString = [finalString
+ stringByAppendingString:
+ [string
+ stringByTrimmingCharactersInSet:
+ [NSCharacterSet characterSetWithCharactersInString:@"="]]];
+ finalString = [finalString stringByReplacingOccurrencesOfString:@"-"
+ withString:@"+"];
+ finalString = [finalString stringByReplacingOccurrencesOfString:@"_"
+ withString:@"/"];
+ while (finalString.length % 4 != 0) {
+ finalString = [finalString stringByAppendingString:@"="];
}
- if (hexData != nil) {
- return [self parseData:hexData];
- } else {
- return nil;
- }
-}
-+ (MTProxySecret * _Nullable)parseData:(NSData * _Nonnull)data {
- if (data == nil || data.length < 16) {
- return nil;
- }
-
- uint8_t firstByte = 0;
- [data getBytes:&firstByte length:1];
-
- if (data.length == 16) {
- return [[MTProxySecretType0 alloc] initWithSecret:data];
- } else if (data.length == 17) {
- if (firstByte == 0xdd) {
- return [[MTProxySecretType1 alloc] initWithSecret:[data subdataWithRange:NSMakeRange(1, 16)]];
- } else {
- return nil;
- }
- } else if (data.length >= 18 && firstByte == 0xee) {
- NSString *domain = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(1 + 16, data.length - (1 + 16))] encoding:NSUTF8StringEncoding];
- if (domain == nil) {
- return nil;
- }
- return [[MTProxySecretType2 alloc] initWithSecret:[data subdataWithRange:NSMakeRange(1, 16)] domain:domain];
- } else {
- return nil;
- }
-}
-
-- (NSData * _Nonnull)serialize {
- assert(false);
+ hexData = base64_decode(finalString);
+ }
+ if (hexData != nil) {
+ return [self parseData:hexData];
+ } else {
return nil;
+ }
}
-- (NSString * _Nonnull)serializeToString {
- assert(false);
++ (MTProxySecret *_Nullable)parseData:(NSData *_Nonnull)data {
+ if (data == nil || data.length < 16) {
return nil;
+ }
+
+ uint8_t firstByte = 0;
+ [data getBytes:&firstByte length:1];
+
+ if (data.length == 16) {
+ return [[MTProxySecretType0 alloc] initWithSecret:data];
+ } else if (data.length == 17) {
+ if (firstByte == 0xdd) {
+ return [[MTProxySecretType1 alloc]
+ initWithSecret:[data subdataWithRange:NSMakeRange(1, 16)]];
+ } else {
+ return nil;
+ }
+ } else if (data.length >= 18 && firstByte == 0xee) {
+ NSString *domain = [[NSString alloc]
+ initWithData:[data subdataWithRange:NSMakeRange(1 + 16,
+ data.length - (1 + 16))]
+ encoding:NSUTF8StringEncoding];
+ if (domain == nil) {
+ return nil;
+ }
+ return [[MTProxySecretType2 alloc]
+ initWithSecret:[data subdataWithRange:NSMakeRange(1, 16)]
+ domain:domain];
+ } else {
+ return nil;
+ }
+}
+
+- (NSData *_Nonnull)serialize {
+ assert(false);
+ return nil;
+}
+
+- (NSString *_Nonnull)serializeToString {
+ assert(false);
+ return nil;
}
- (NSString *)description {
- return dataToHexString([self serialize]);
+ return dataToHexString([self serialize]);
}
@end
@implementation MTProxySecretType0
-- (instancetype _Nullable)initWithSecret:(NSData * _Nonnull)secret {
- self = [super initWithSecret:secret];
- if (self != nil) {
- }
- return self;
+- (instancetype _Nullable)initWithSecret:(NSData *_Nonnull)secret {
+ self = [super initWithSecret:secret];
+ if (self != nil) {
+ }
+ return self;
}
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
- self = [super initWithCoder:aDecoder];
- if (self != nil) {
- }
- return self;
+ self = [super initWithCoder:aDecoder];
+ if (self != nil) {
+ }
+ return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder {
- [super encodeWithCoder:aCoder];
+ [super encodeWithCoder:aCoder];
}
-- (NSData * _Nonnull)serialize {
- return self.secret;
+- (NSData *_Nonnull)serialize {
+ return self.secret;
}
-- (NSString * _Nonnull)serializeToString {
- return dataToHexString(self.serialize);
+- (NSString *_Nonnull)serializeToString {
+ return dataToHexString(self.serialize);
}
- (BOOL)isEqual:(id)object {
- if (![object isKindOfClass:[MTProxySecretType0 class]]) {
- return false;
- }
- MTProxySecretType0 *other = object;
- if (![self.secret isEqual:other.secret]) {
- return false;
- }
- return true;
+ if (![object isKindOfClass:[MTProxySecretType0 class]]) {
+ return false;
+ }
+ MTProxySecretType0 *other = object;
+ if (![self.secret isEqual:other.secret]) {
+ return false;
+ }
+ return true;
}
@end
@implementation MTProxySecretType1
-- (instancetype _Nullable)initWithSecret:(NSData * _Nonnull)secret {
- self = [super initWithSecret:secret];
- if (self != nil) {
- }
- return self;
+- (instancetype _Nullable)initWithSecret:(NSData *_Nonnull)secret {
+ self = [super initWithSecret:secret];
+ if (self != nil) {
+ }
+ return self;
}
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
- self = [super initWithCoder:aDecoder];
- if (self != nil) {
- }
- return self;
+ self = [super initWithCoder:aDecoder];
+ if (self != nil) {
+ }
+ return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder {
- [super encodeWithCoder:aCoder];
+ [super encodeWithCoder:aCoder];
}
-- (NSData * _Nonnull)serialize {
- NSMutableData *data = [[NSMutableData alloc] init];
- uint8_t marker = 0xdd;
- [data appendBytes:&marker length:1];
- [data appendData:self.secret];
- return data;
+- (NSData *_Nonnull)serialize {
+ NSMutableData *data = [[NSMutableData alloc] init];
+ uint8_t marker = 0xdd;
+ [data appendBytes:&marker length:1];
+ [data appendData:self.secret];
+ return data;
}
-- (NSString * _Nonnull)serializeToString {
- return dataToHexString(self.serialize);
+- (NSString *_Nonnull)serializeToString {
+ return dataToHexString(self.serialize);
}
- (BOOL)isEqual:(id)object {
- if (![object isKindOfClass:[MTProxySecretType1 class]]) {
- return false;
- }
- MTProxySecretType1 *other = object;
- if (![self.secret isEqual:other.secret]) {
- return false;
- }
- return true;
+ if (![object isKindOfClass:[MTProxySecretType1 class]]) {
+ return false;
+ }
+ MTProxySecretType1 *other = object;
+ if (![self.secret isEqual:other.secret]) {
+ return false;
+ }
+ return true;
}
@end
@implementation MTProxySecretType2
-- (instancetype _Nullable)initWithSecret:(NSData * _Nonnull)secret domain:(NSString * _Nonnull)domain {
- self = [super initWithSecret:secret];
- if (self != nil) {
- _domain = domain;
- }
- return self;
+- (instancetype _Nullable)initWithSecret:(NSData *_Nonnull)secret
+ domain:(NSString *_Nonnull)domain {
+ self = [super initWithSecret:secret];
+ if (self != nil) {
+ _domain = domain;
+ }
+ return self;
}
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
- self = [super initWithCoder:aDecoder];
- if (self != nil) {
- _domain = [aDecoder decodeObjectForKey:@"domain"];
- }
- return self;
+ self = [super initWithCoder:aDecoder];
+ if (self != nil) {
+ _domain = [aDecoder decodeObjectForKey:@"domain"];
+ }
+ return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder {
- [super encodeWithCoder:aCoder];
- [aCoder encodeObject:_domain forKey:@"domain"];
+ [super encodeWithCoder:aCoder];
+ [aCoder encodeObject:_domain forKey:@"domain"];
}
-- (NSData * _Nonnull)serialize {
- NSMutableData *data = [[NSMutableData alloc] init];
- uint8_t marker = 0xee;
- [data appendBytes:&marker length:1];
- [data appendData:self.secret];
- [data appendData:[_domain dataUsingEncoding:NSUTF8StringEncoding]];
- return data;
+- (NSData *_Nonnull)serialize {
+ NSMutableData *data = [[NSMutableData alloc] init];
+ uint8_t marker = 0xee;
+ [data appendBytes:&marker length:1];
+ [data appendData:self.secret];
+ [data appendData:[_domain dataUsingEncoding:NSUTF8StringEncoding]];
+ return data;
}
-- (NSString * _Nonnull)serializeToString {
- NSData *data = [self serialize];
- if ([data respondsToSelector:@selector(base64EncodedDataWithOptions:)]) {
- return [[data base64EncodedStringWithOptions:kNilOptions] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"="]];
- } else {
+- (NSString *_Nonnull)serializeToString {
+ NSData *data = [self serialize];
+ if ([data respondsToSelector:@selector(base64EncodedDataWithOptions:)]) {
+ return [[data base64EncodedStringWithOptions:kNilOptions]
+ stringByTrimmingCharactersInSet:
+ [NSCharacterSet characterSetWithCharactersInString:@"="]];
+ } else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
return [self.serialize base64Encoding];
#pragma clang diagnostic pop
- }
+ }
}
- (BOOL)isEqual:(id)object {
- if (![object isKindOfClass:[MTProxySecretType2 class]]) {
- return false;
- }
- MTProxySecretType2 *other = object;
- if (![self.secret isEqual:other.secret]) {
- return false;
- }
- if (![self.domain isEqual:other.domain]) {
- return false;
- }
- return true;
+ if (![object isKindOfClass:[MTProxySecretType2 class]]) {
+ return false;
+ }
+ MTProxySecretType2 *other = object;
+ if (![self.secret isEqual:other.secret]) {
+ return false;
+ }
+ if (![self.domain isEqual:other.domain]) {
+ return false;
+ }
+ return true;
}
@end
@implementation MTSocksProxySettings
-- (instancetype)initWithIp:(NSString *)ip port:(uint16_t)port username:(NSString *)username password:(NSString *)password secret:(NSData *)secret {
- self = [super init];
- if (self != nil) {
- _ip = ip;
- _port = port;
- _username = username;
- _password = password;
- _secret = secret;
- }
- return self;
+- (instancetype)initWithIp:(NSString *)ip
+ port:(uint16_t)port
+ username:(NSString *)username
+ password:(NSString *)password
+ secret:(NSData *)secret {
+ self = [super init];
+ if (self != nil) {
+ _ip = ip;
+ _port = port;
+ _username = username;
+ _password = password;
+ _secret = secret;
+ }
+ return self;
}
- (BOOL)isEqual:(id)object {
- if (![object isKindOfClass:[MTSocksProxySettings class]]) {
- return false;
- }
- MTSocksProxySettings *other = object;
- if ((other->_ip != nil) != (_ip != nil) || (_ip != nil && ![_ip isEqual:other->_ip])) {
- return false;
- }
- if (other->_port != _port) {
- return false;
- }
- if ((other->_username != nil) != (_username != nil) || (_username != nil && ![_username isEqual:other->_username])) {
- return false;
- }
- if ((other->_password != nil) != (_password != nil) || (_password != nil && ![_password isEqual:other->_password])) {
- return false;
- }
- if ((other->_secret != nil) != (_secret != nil) || (_secret != nil && ![_secret isEqual:other->_secret])) {
- return false;
- }
- return true;
+ if (![object isKindOfClass:[MTSocksProxySettings class]]) {
+ return false;
+ }
+ MTSocksProxySettings *other = object;
+ if ((other->_ip != nil) != (_ip != nil) ||
+ (_ip != nil && ![_ip isEqual:other->_ip])) {
+ return false;
+ }
+ if (other->_port != _port) {
+ return false;
+ }
+ if ((other->_username != nil) != (_username != nil) ||
+ (_username != nil && ![_username isEqual:other->_username])) {
+ return false;
+ }
+ if ((other->_password != nil) != (_password != nil) ||
+ (_password != nil && ![_password isEqual:other->_password])) {
+ return false;
+ }
+ if ((other->_secret != nil) != (_secret != nil) ||
+ (_secret != nil && ![_secret isEqual:other->_secret])) {
+ return false;
+ }
+ return true;
}
- (NSString *)description {
- return [NSString stringWithFormat:@"%@:%d+%@+%@+%@", _ip, (int)_port, _username, _password, [_secret description]];
+ return
+ [NSString stringWithFormat:@"%@:%d+%@+%@+%@", _ip, (int)_port, _username,
+ _password, [_secret description]];
}
@end
@implementation MTNetworkSettings
-- (instancetype)initWithReducedBackupDiscoveryTimeout:(bool)reducedBackupDiscoveryTimeout {
- self = [super init];
- if (self != nil) {
- _reducedBackupDiscoveryTimeout = reducedBackupDiscoveryTimeout;
- }
- return self;
+- (instancetype)initWithReducedBackupDiscoveryTimeout:
+ (bool)reducedBackupDiscoveryTimeout {
+ self = [super init];
+ if (self != nil) {
+ _reducedBackupDiscoveryTimeout = reducedBackupDiscoveryTimeout;
+ }
+ return self;
}
- (BOOL)isEqual:(id)object {
- if (![object isKindOfClass:[MTNetworkSettings class]]) {
- return false;
- }
- MTNetworkSettings *other = object;
- if (_reducedBackupDiscoveryTimeout != other->_reducedBackupDiscoveryTimeout) {
- return false;
- }
- return true;
+ if (![object isKindOfClass:[MTNetworkSettings class]]) {
+ return false;
+ }
+ MTNetworkSettings *other = object;
+ if (_reducedBackupDiscoveryTimeout != other->_reducedBackupDiscoveryTimeout) {
+ return false;
+ }
+ return true;
}
@end
@implementation MTApiEnvironment
--(instancetype)init {
- self = [self initWithDeviceModelName:nil];
- if (self != nil)
- {
-
- }
- return self;
+- (instancetype)init {
+ self = [self initWithDeviceModelName:nil];
+ if (self != nil) {
+ }
+ return self;
}
--(id _Nonnull)initWithDeviceModelName:(NSString * _Nullable)deviceModelName {
- self = [super init];
- if (self != nil)
- {
- if (deviceModelName != nil) {
- _deviceModel = deviceModelName;
- } else {
- _deviceModel = [self platformString];
- }
- _deviceModelName = deviceModelName;
-#if TARGET_OS_IPHONE
- _systemVersion = [[UIDevice currentDevice] systemVersion];
-#else
- NSProcessInfo *pInfo = [NSProcessInfo processInfo];
- _systemVersion = [[[pInfo operatingSystemVersionString] componentsSeparatedByString:@" "] objectAtIndex:1];
-#endif
-
-NSString *suffix = @"";
-#if TARGET_OS_OSX
- NSString *value = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"SOURCE"];
- if (value != nil) {
- suffix = [NSString stringWithFormat:@"%@", value];
- }
-#endif
-
- //SOURCE
- NSString *versionString = [[NSString alloc] initWithFormat:@"%@ (%@) %@", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"], [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"], suffix];
- _appVersion = versionString;
-
- _systemLangCode = [[NSLocale preferredLanguages] objectAtIndex:0];
- #if TARGET_OS_OSX
- _langPack = @"macos";
- #else
- _langPack = @"ios";
- #endif
- _langPackCode = @"";
-
- [self _updateApiInitializationHash];
+- (id _Nonnull)initWithDeviceModelName:(NSString *_Nullable)deviceModelName {
+ self = [super init];
+ if (self != nil) {
+ // GHOSTGRAM: Check for device spoofing from UserDefaults
+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+ BOOL spoofEnabled = [defaults boolForKey:@"DeviceSpoof.isEnabled"];
+ NSInteger profileId =
+ [defaults integerForKey:@"DeviceSpoof.selectedProfileId"];
+
+ NSString *spoofedModel = nil;
+ NSString *spoofedVersion = nil;
+
+ if (spoofEnabled && profileId != 0) {
+ if (profileId == 100) {
+ // Custom profile
+ spoofedModel = [defaults stringForKey:@"DeviceSpoof.customDeviceModel"];
+ spoofedVersion =
+ [defaults stringForKey:@"DeviceSpoof.customSystemVersion"];
+ } else {
+ // Preset profiles
+ NSDictionary *models = @{
+ @1 : @"iPhone 14 Pro",
+ @2 : @"iPhone 15 Pro Max",
+ @3 : @"Samsung SM-S918B",
+ @4 : @"Google Pixel 8 Pro",
+ @5 : @"PC 64bit",
+ @6 : @"MacBook Pro",
+ @7 : @"Web",
+ @8 : @"HUAWEI MNA-LX9",
+ @9 : @"Xiaomi 2311DRK48G"
+ };
+ NSDictionary *versions = @{
+ @1 : @"iOS 17.2",
+ @2 : @"iOS 17.4",
+ @3 : @"Android 14",
+ @4 : @"Android 14",
+ @5 : @"Windows 11",
+ @6 : @"macOS 14.3",
+ @7 : @"Chrome 121",
+ @8 : @"HarmonyOS 4.0",
+ @9 : @"Android 14"
+ };
+ spoofedModel = models[@(profileId)];
+ spoofedVersion = versions[@(profileId)];
+ }
}
- return self;
+
+ if (spoofedModel.length > 0) {
+ _deviceModel = spoofedModel;
+ } else if (deviceModelName != nil) {
+ _deviceModel = deviceModelName;
+ } else {
+ _deviceModel = [self platformString];
+ }
+ _deviceModelName = deviceModelName;
+
+ if (spoofedVersion.length > 0) {
+ _systemVersion = spoofedVersion;
+ } else {
+#if TARGET_OS_IPHONE
+ _systemVersion = [[UIDevice currentDevice] systemVersion];
+#else
+ NSProcessInfo *pInfo = [NSProcessInfo processInfo];
+ _systemVersion = [[[pInfo operatingSystemVersionString]
+ componentsSeparatedByString:@" "] objectAtIndex:1];
+#endif
+ }
+
+ NSString *suffix = @"";
+#if TARGET_OS_OSX
+ NSString *value =
+ [[[NSBundle mainBundle] infoDictionary] objectForKey:@"SOURCE"];
+ if (value != nil) {
+ suffix = [NSString stringWithFormat:@"%@", value];
+ }
+#endif
+
+ // SOURCE
+ NSString *versionString = [[NSString alloc]
+ initWithFormat:@"%@ (%@) %@",
+ [[[NSBundle mainBundle] infoDictionary]
+ objectForKey:@"CFBundleShortVersionString"],
+ [[[NSBundle mainBundle] infoDictionary]
+ objectForKey:@"CFBundleVersion"],
+ suffix];
+ _appVersion = versionString;
+
+ _systemLangCode = [[NSLocale preferredLanguages] objectAtIndex:0];
+#if TARGET_OS_OSX
+ _langPack = @"macos";
+#else
+ _langPack = @"ios";
+#endif
+ _langPackCode = @"";
+
+ [self _updateApiInitializationHash];
+ }
+ return self;
}
- (void)_updateApiInitializationHash {
- _apiInitializationHash = [[NSString alloc] initWithFormat:@"apiId=%" PRId32 "&deviceModel=%@&systemVersion=%@&appVersion=%@&langCode=%@&layer=%@&langPack=%@&langPackCode=%@&proxy=%@&systemCode=%@", _apiId, _deviceModel, _systemVersion, _appVersion, _systemLangCode, _layer, _langPack, _langPackCode, _socksProxySettings, _systemCode];
+ _apiInitializationHash = [[NSString alloc]
+ initWithFormat:
+ @"apiId=%" PRId32
+ "&deviceModel=%@&systemVersion=%@&appVersion=%@&langCode=%@&layer=%@"
+ "&langPack=%@&langPackCode=%@&proxy=%@&systemCode=%@",
+ _apiId, _deviceModel, _systemVersion, _appVersion, _systemLangCode,
+ _layer, _langPack, _langPackCode, _socksProxySettings, _systemCode];
}
- (void)setLayer:(NSNumber *)layer {
- _layer = layer;
-
- [self _updateApiInitializationHash];
+ _layer = layer;
+
+ [self _updateApiInitializationHash];
}
- (void)setAppVersion:(NSString *)appVersion {
- _appVersion = appVersion;
-
- [self _updateApiInitializationHash];
+ _appVersion = appVersion;
+
+ [self _updateApiInitializationHash];
}
- (void)setLangPack:(NSString *)langPack {
- _langPack = langPack;
-
- [self _updateApiInitializationHash];
+ _langPack = langPack;
+
+ [self _updateApiInitializationHash];
}
- (void)setLangPackCode:(NSString *)langPackCode {
- _langPackCode = langPackCode;
-
- [self _updateApiInitializationHash];
+ _langPackCode = langPackCode;
+
+ [self _updateApiInitializationHash];
}
-- (NSString *)platformString
-{
+- (NSString *)platformString {
#if TARGET_OS_IPHONE
- NSString *platform = [self platform];
-
- if ([platform isEqualToString:@"iPhone1,1"])
- return @"iPhone";
- if ([platform isEqualToString:@"iPhone1,2"])
- return @"iPhone 3G";
- if ([platform isEqualToString:@"iPhone2,1"])
- return @"iPhone 3GS";
- if ([platform hasPrefix:@"iPhone3"])
- return @"iPhone 4";
- if ([platform hasPrefix:@"iPhone4"])
- return @"iPhone 4S";
- if ([platform isEqualToString:@"iPhone5,1"] ||
- [platform isEqualToString:@"iPhone5,2"])
- return @"iPhone 5";
- if ([platform isEqualToString:@"iPhone5,3"] ||
- [platform isEqualToString:@"iPhone5,4"])
- return @"iPhone 5C";
- if ([platform hasPrefix:@"iPhone6"])
- return @"iPhone 5S";
- if ([platform isEqualToString:@"iPhone7,1"])
- return @"iPhone 6 Plus";
- if ([platform isEqualToString:@"iPhone7,2"])
- return @"iPhone 6";
- if ([platform isEqualToString:@"iPhone8,1"])
- return @"iPhone 6S";
- if ([platform isEqualToString:@"iPhone8,2"])
- return @"iPhone 6S Plus";
- if ([platform isEqualToString:@"iPhone8,4"])
- return @"iPhone SE";
- if ([platform isEqualToString:@"iPhone9,1"] ||
- [platform isEqualToString:@"iPhone9,3"])
- return @"iPhone 7";
- if ([platform isEqualToString:@"iPhone9,2"] ||
- [platform isEqualToString:@"iPhone9,4"])
- return @"iPhone 7 Plus";
- if ([platform isEqualToString:@"iPhone10,1"] ||
- [platform isEqualToString:@"iPhone10,4"])
- return @"iPhone 8";
- if ([platform isEqualToString:@"iPhone10,2"] ||
- [platform isEqualToString:@"iPhone10,5"])
- return @"iPhone 8 Plus";
- if ([platform isEqualToString:@"iPhone10,3"] ||
- [platform isEqualToString:@"iPhone10,6"])
- return @"iPhone X";
- if ([platform isEqualToString:@"iPhone11,2"])
- return @"iPhone XS";
- if ([platform isEqualToString:@"iPhone11,4"] ||
- [platform isEqualToString:@"iPhone11,6"])
- return @"iPhone XS Max";
- if ([platform isEqualToString:@"iPhone11,8"])
- return @"iPhone XR";
- if ([platform isEqualToString:@"iPhone12,1"])
- return @"iPhone 11";
- if ([platform isEqualToString:@"iPhone12,3"])
- return @"iPhone 11 Pro";
- if ([platform isEqualToString:@"iPhone12,5"])
- return @"iPhone 11 Pro Max";
- if ([platform isEqualToString:@"iPhone12,8"])
- return @"iPhone SE (2nd gen)";
- if ([platform isEqualToString:@"iPhone13,1"])
- return @"iPhone 12 mini";
- if ([platform isEqualToString:@"iPhone13,2"])
- return @"iPhone 12";
- if ([platform isEqualToString:@"iPhone13,3"])
- return @"iPhone 12 Pro";
- if ([platform isEqualToString:@"iPhone13,4"])
- return @"iPhone 12 Pro Max";
- if ([platform isEqualToString:@"iPhone14,2"])
- return @"iPhone 13 Pro";
- if ([platform isEqualToString:@"iPhone14,3"])
- return @"iPhone 13 Pro Max";
- if ([platform isEqualToString:@"iPhone14,4"])
- return @"iPhone 13 Mini";
- if ([platform isEqualToString:@"iPhone14,5"])
- return @"iPhone 13";
- if ([platform isEqualToString:@"iPhone14,6"])
- return @"iPhone SE (3rd gen)";
- if ([platform isEqualToString:@"iPhone14,7"])
- return @"iPhone 14";
- if ([platform isEqualToString:@"iPhone14,8"])
- return @"iPhone 14 Plus";
- if ([platform isEqualToString:@"iPhone15,2"])
- return @"iPhone 14 Pro";
- if ([platform isEqualToString:@"iPhone15,3"])
- return @"iPhone 14 Pro Max";
- if ([platform isEqualToString:@"iPhone15,4"])
- return @"iPhone 15";
- if ([platform isEqualToString:@"iPhone15,5"])
- return @"iPhone 15 Plus";
- if ([platform isEqualToString:@"iPhone16,1"])
- return @"iPhone 15 Pro";
- if ([platform isEqualToString:@"iPhone16,2"])
- return @"iPhone 15 Pro Max";
- if ([platform isEqualToString:@"iPhone17,3"])
- return @"iPhone 16";
- if ([platform isEqualToString:@"iPhone17,4"])
- return @"iPhone 16 Plus";
- if ([platform isEqualToString:@"iPhone17,1"])
- return @"iPhone 16 Pro";
- if ([platform isEqualToString:@"iPhone17,2"])
- return @"iPhone 16 Pro Max";
- if ([platform isEqualToString:@"iPhone17,5"])
- return @"iPhone 16e";
- if ([platform isEqualToString:@"iPhone18,3"])
- return @"iPhone 17";
- if ([platform isEqualToString:@"iPhone18,1"])
- return @"iPhone 17 Pro";
- if ([platform isEqualToString:@"iPhone18,2"])
- return @"iPhone 17 Pro Max";
- if ([platform isEqualToString:@"iPhone18,4"])
- return @"iPhone Air";
-
- if ([platform hasPrefix:@"iPod1"])
- return @"iPod touch 1G";
- if ([platform hasPrefix:@"iPod2"])
- return @"iPod touch 2G";
- if ([platform hasPrefix:@"iPod3"])
- return @"iPod touch 3G";
- if ([platform hasPrefix:@"iPod4"])
- return @"iPod touch 4G";
- if ([platform hasPrefix:@"iPod5"])
- return @"iPod touch 5G";
- if ([platform hasPrefix:@"iPod7"])
- return @"iPod touch 6G";
- if ([platform hasPrefix:@"iPod9"])
- return @"iPod touch 7G";
-
- if ([platform isEqualToString:@"iPad2,5"] ||
- [platform isEqualToString:@"iPad2,6"] ||
- [platform isEqualToString:@"iPad2,7"])
- return @"iPad mini";
-
- if ([platform hasPrefix:@"iPad2"])
- return @"iPad 2G";
-
- if ([platform isEqualToString:@"iPad3,1"] ||
- [platform isEqualToString:@"iPad3,2"] ||
- [platform isEqualToString:@"iPad3,3"])
- return @"iPad 3G";
-
- if ([platform isEqualToString:@"iPad3,4"] ||
- [platform isEqualToString:@"iPad3,5"] ||
- [platform isEqualToString:@"iPad3,6"])
- return @"iPad 3G";
-
- if ([platform isEqualToString:@"iPad4,1"] ||
- [platform isEqualToString:@"iPad4,2"])
- return @"iPad Air";
-
- if ([platform isEqualToString:@"iPad4,4"] ||
- [platform isEqualToString:@"iPad4,5"] ||
- [platform isEqualToString:@"iPad4,6"])
- return @"iPad mini Retina";
-
- if ([platform isEqualToString:@"iPad4,7"] ||
- [platform isEqualToString:@"iPad4,8"] ||
- [platform isEqualToString:@"iPad4,9"])
- return @"iPad mini 3";
-
- if ([platform isEqualToString:@"iPad5,1"] ||
- [platform isEqualToString:@"iPad5,2"])
- return @"iPad mini 4";
-
- if ([platform isEqualToString:@"iPad5,3"] ||
- [platform isEqualToString:@"iPad5,4"])
- return @"iPad Air 2";
-
- if ([platform isEqualToString:@"iPad6,3"] ||
- [platform isEqualToString:@"iPad6,4"])
- return @"iPad Pro 9.7 inch";
-
- if ([platform isEqualToString:@"iPad6,7"] ||
- [platform isEqualToString:@"iPad6,8"])
- return @"iPad Pro 12.9 inch";
-
- if ([platform isEqualToString:@"iPad6,11"] ||
- [platform isEqualToString:@"iPad6,12"])
- return @"iPad (2017)";
-
- if ([platform isEqualToString:@"iPad7,1"] ||
- [platform isEqualToString:@"iPad7,2"])
- return @"iPad Pro (2nd gen)";
-
- if ([platform isEqualToString:@"iPad7,3"] ||
- [platform isEqualToString:@"iPad7,4"])
- return @"iPad Pro 10.5 inch";
-
- if ([platform isEqualToString:@"iPad7,5"] ||
- [platform isEqualToString:@"iPad7,6"])
- return @"iPad (6th gen)";
-
- if ([platform isEqualToString:@"iPad7,11"] ||
- [platform isEqualToString:@"iPad7,12"])
- return @"iPad 10.2 inch (7th gen)";
-
- if ([platform isEqualToString:@"iPad8,1"] ||
- [platform isEqualToString:@"iPad8,2"] ||
- [platform isEqualToString:@"iPad8,3"] ||
- [platform isEqualToString:@"iPad8,4"])
- return @"iPad Pro 11 inch";
-
- if ([platform isEqualToString:@"iPad8,5"] ||
- [platform isEqualToString:@"iPad8,6"] ||
- [platform isEqualToString:@"iPad8,7"] ||
- [platform isEqualToString:@"iPad8,8"])
- return @"iPad Pro 12.9 inch (3rd gen)";
-
- if ([platform isEqualToString:@"iPad8,9"] ||
- [platform isEqualToString:@"iPad8,10"])
- return @"iPad Pro 11 inch (2th gen)";
-
- if ([platform isEqualToString:@"iPad8,11"] ||
- [platform isEqualToString:@"iPad8,12"])
- return @"iPad Pro 12.9 inch (4th gen)";
-
- if ([platform isEqualToString:@"iPad11,1"] ||
- [platform isEqualToString:@"iPad11,2"])
- return @"iPad mini (5th gen)";
-
- if ([platform isEqualToString:@"iPad11,3"] ||
- [platform isEqualToString:@"iPad11,4"])
- return @"iPad Air (3rd gen)";
-
- if ([platform isEqualToString:@"iPad11,6"] ||
- [platform isEqualToString:@"iPad11,7"])
- return @"iPad (8th gen)";
-
- if ([platform isEqualToString:@"iPad12,1"] ||
- [platform isEqualToString:@"iPad12,2"])
- return @"iPad (9th gen)";
-
- if ([platform isEqualToString:@"iPad13,1"] ||
- [platform isEqualToString:@"iPad13,2"])
- return @"iPad Air (4th gen)";
-
- if ([platform isEqualToString:@"iPad13,4"] ||
- [platform isEqualToString:@"iPad13,5"] ||
- [platform isEqualToString:@"iPad13,6"] ||
- [platform isEqualToString:@"iPad13,7"])
- return @"iPad Pro 11 inch (3th gen)";
-
- if ([platform isEqualToString:@"iPad13,8"] ||
- [platform isEqualToString:@"iPad13,9"] ||
- [platform isEqualToString:@"iPad13,10"] ||
- [platform isEqualToString:@"iPad13,11"])
- return @"iPad Pro 12.9 inch (5th gen)";
-
- if ([platform isEqualToString:@"iPad13,16"] ||
- [platform isEqualToString:@"iPad13,17"])
- return @"iPad Air (5th gen)";
-
- if ([platform isEqualToString:@"iPad13,18"] ||
- [platform isEqualToString:@"iPad13,19"])
- return @"iPad (10th gen)";
-
- if ([platform isEqualToString:@"iPad14,1"] ||
- [platform isEqualToString:@"iPad14,2"])
- return @"iPad mini (6th gen)";
-
- if ([platform isEqualToString:@"iPad14,3"] ||
- [platform isEqualToString:@"iPad14,4"])
- return @"iPad Pro 11 inch (4th gen)";
-
- if ([platform isEqualToString:@"iPad14,5"] ||
- [platform isEqualToString:@"iPad14,6"])
- return @"iPad Pro 12.9 inch (6th gen)";
-
- if ([platform isEqualToString:@"iPad14,8"] ||
- [platform isEqualToString:@"iPad14,9"])
- return @"iPad Air (6th gen)";
-
- if ([platform isEqualToString:@"iPad14,10"] ||
- [platform isEqualToString:@"iPad14,11"])
- return @"iPad Air (7th gen)";
-
- if ([platform isEqualToString:@"iPad16,3"] ||
- [platform isEqualToString:@"iPad16,4"])
- return @"iPad Pro 11 inch (5th gen)";
-
- if ([platform isEqualToString:@"iPad16,5"] ||
- [platform isEqualToString:@"iPad16,6"])
- return @"iPad Pro 12.9 inch (7th gen)";
-
- if ([platform hasPrefix:@"iPhone"])
- return @"Unknown iPhone";
- if ([platform hasPrefix:@"iPod"])
- return @"Unknown iPod";
- if ([platform hasPrefix:@"iPad"])
- return @"Unknown iPad";
-
- if ([platform hasSuffix:@"86"] || [platform isEqual:@"x86_64"] || [platform isEqual:@"arm64"]) {
- return @"iPhone Simulator";
- }
+ NSString *platform = [self platform];
+
+ if ([platform isEqualToString:@"iPhone1,1"])
+ return @"iPhone";
+ if ([platform isEqualToString:@"iPhone1,2"])
+ return @"iPhone 3G";
+ if ([platform isEqualToString:@"iPhone2,1"])
+ return @"iPhone 3GS";
+ if ([platform hasPrefix:@"iPhone3"])
+ return @"iPhone 4";
+ if ([platform hasPrefix:@"iPhone4"])
+ return @"iPhone 4S";
+ if ([platform isEqualToString:@"iPhone5,1"] ||
+ [platform isEqualToString:@"iPhone5,2"])
+ return @"iPhone 5";
+ if ([platform isEqualToString:@"iPhone5,3"] ||
+ [platform isEqualToString:@"iPhone5,4"])
+ return @"iPhone 5C";
+ if ([platform hasPrefix:@"iPhone6"])
+ return @"iPhone 5S";
+ if ([platform isEqualToString:@"iPhone7,1"])
+ return @"iPhone 6 Plus";
+ if ([platform isEqualToString:@"iPhone7,2"])
+ return @"iPhone 6";
+ if ([platform isEqualToString:@"iPhone8,1"])
+ return @"iPhone 6S";
+ if ([platform isEqualToString:@"iPhone8,2"])
+ return @"iPhone 6S Plus";
+ if ([platform isEqualToString:@"iPhone8,4"])
+ return @"iPhone SE";
+ if ([platform isEqualToString:@"iPhone9,1"] ||
+ [platform isEqualToString:@"iPhone9,3"])
+ return @"iPhone 7";
+ if ([platform isEqualToString:@"iPhone9,2"] ||
+ [platform isEqualToString:@"iPhone9,4"])
+ return @"iPhone 7 Plus";
+ if ([platform isEqualToString:@"iPhone10,1"] ||
+ [platform isEqualToString:@"iPhone10,4"])
+ return @"iPhone 8";
+ if ([platform isEqualToString:@"iPhone10,2"] ||
+ [platform isEqualToString:@"iPhone10,5"])
+ return @"iPhone 8 Plus";
+ if ([platform isEqualToString:@"iPhone10,3"] ||
+ [platform isEqualToString:@"iPhone10,6"])
+ return @"iPhone X";
+ if ([platform isEqualToString:@"iPhone11,2"])
+ return @"iPhone XS";
+ if ([platform isEqualToString:@"iPhone11,4"] ||
+ [platform isEqualToString:@"iPhone11,6"])
+ return @"iPhone XS Max";
+ if ([platform isEqualToString:@"iPhone11,8"])
+ return @"iPhone XR";
+ if ([platform isEqualToString:@"iPhone12,1"])
+ return @"iPhone 11";
+ if ([platform isEqualToString:@"iPhone12,3"])
+ return @"iPhone 11 Pro";
+ if ([platform isEqualToString:@"iPhone12,5"])
+ return @"iPhone 11 Pro Max";
+ if ([platform isEqualToString:@"iPhone12,8"])
+ return @"iPhone SE (2nd gen)";
+ if ([platform isEqualToString:@"iPhone13,1"])
+ return @"iPhone 12 mini";
+ if ([platform isEqualToString:@"iPhone13,2"])
+ return @"iPhone 12";
+ if ([platform isEqualToString:@"iPhone13,3"])
+ return @"iPhone 12 Pro";
+ if ([platform isEqualToString:@"iPhone13,4"])
+ return @"iPhone 12 Pro Max";
+ if ([platform isEqualToString:@"iPhone14,2"])
+ return @"iPhone 13 Pro";
+ if ([platform isEqualToString:@"iPhone14,3"])
+ return @"iPhone 13 Pro Max";
+ if ([platform isEqualToString:@"iPhone14,4"])
+ return @"iPhone 13 Mini";
+ if ([platform isEqualToString:@"iPhone14,5"])
+ return @"iPhone 13";
+ if ([platform isEqualToString:@"iPhone14,6"])
+ return @"iPhone SE (3rd gen)";
+ if ([platform isEqualToString:@"iPhone14,7"])
+ return @"iPhone 14";
+ if ([platform isEqualToString:@"iPhone14,8"])
+ return @"iPhone 14 Plus";
+ if ([platform isEqualToString:@"iPhone15,2"])
+ return @"iPhone 14 Pro";
+ if ([platform isEqualToString:@"iPhone15,3"])
+ return @"iPhone 14 Pro Max";
+ if ([platform isEqualToString:@"iPhone15,4"])
+ return @"iPhone 15";
+ if ([platform isEqualToString:@"iPhone15,5"])
+ return @"iPhone 15 Plus";
+ if ([platform isEqualToString:@"iPhone16,1"])
+ return @"iPhone 15 Pro";
+ if ([platform isEqualToString:@"iPhone16,2"])
+ return @"iPhone 15 Pro Max";
+ if ([platform isEqualToString:@"iPhone17,3"])
+ return @"iPhone 16";
+ if ([platform isEqualToString:@"iPhone17,4"])
+ return @"iPhone 16 Plus";
+ if ([platform isEqualToString:@"iPhone17,1"])
+ return @"iPhone 16 Pro";
+ if ([platform isEqualToString:@"iPhone17,2"])
+ return @"iPhone 16 Pro Max";
+ if ([platform isEqualToString:@"iPhone17,5"])
+ return @"iPhone 16e";
+ if ([platform isEqualToString:@"iPhone18,3"])
+ return @"iPhone 17";
+ if ([platform isEqualToString:@"iPhone18,1"])
+ return @"iPhone 17 Pro";
+ if ([platform isEqualToString:@"iPhone18,2"])
+ return @"iPhone 17 Pro Max";
+ if ([platform isEqualToString:@"iPhone18,4"])
+ return @"iPhone Air";
+
+ if ([platform hasPrefix:@"iPod1"])
+ return @"iPod touch 1G";
+ if ([platform hasPrefix:@"iPod2"])
+ return @"iPod touch 2G";
+ if ([platform hasPrefix:@"iPod3"])
+ return @"iPod touch 3G";
+ if ([platform hasPrefix:@"iPod4"])
+ return @"iPod touch 4G";
+ if ([platform hasPrefix:@"iPod5"])
+ return @"iPod touch 5G";
+ if ([platform hasPrefix:@"iPod7"])
+ return @"iPod touch 6G";
+ if ([platform hasPrefix:@"iPod9"])
+ return @"iPod touch 7G";
+
+ if ([platform isEqualToString:@"iPad2,5"] ||
+ [platform isEqualToString:@"iPad2,6"] ||
+ [platform isEqualToString:@"iPad2,7"])
+ return @"iPad mini";
+
+ if ([platform hasPrefix:@"iPad2"])
+ return @"iPad 2G";
+
+ if ([platform isEqualToString:@"iPad3,1"] ||
+ [platform isEqualToString:@"iPad3,2"] ||
+ [platform isEqualToString:@"iPad3,3"])
+ return @"iPad 3G";
+
+ if ([platform isEqualToString:@"iPad3,4"] ||
+ [platform isEqualToString:@"iPad3,5"] ||
+ [platform isEqualToString:@"iPad3,6"])
+ return @"iPad 3G";
+
+ if ([platform isEqualToString:@"iPad4,1"] ||
+ [platform isEqualToString:@"iPad4,2"])
+ return @"iPad Air";
+
+ if ([platform isEqualToString:@"iPad4,4"] ||
+ [platform isEqualToString:@"iPad4,5"] ||
+ [platform isEqualToString:@"iPad4,6"])
+ return @"iPad mini Retina";
+
+ if ([platform isEqualToString:@"iPad4,7"] ||
+ [platform isEqualToString:@"iPad4,8"] ||
+ [platform isEqualToString:@"iPad4,9"])
+ return @"iPad mini 3";
+
+ if ([platform isEqualToString:@"iPad5,1"] ||
+ [platform isEqualToString:@"iPad5,2"])
+ return @"iPad mini 4";
+
+ if ([platform isEqualToString:@"iPad5,3"] ||
+ [platform isEqualToString:@"iPad5,4"])
+ return @"iPad Air 2";
+
+ if ([platform isEqualToString:@"iPad6,3"] ||
+ [platform isEqualToString:@"iPad6,4"])
+ return @"iPad Pro 9.7 inch";
+
+ if ([platform isEqualToString:@"iPad6,7"] ||
+ [platform isEqualToString:@"iPad6,8"])
+ return @"iPad Pro 12.9 inch";
+
+ if ([platform isEqualToString:@"iPad6,11"] ||
+ [platform isEqualToString:@"iPad6,12"])
+ return @"iPad (2017)";
+
+ if ([platform isEqualToString:@"iPad7,1"] ||
+ [platform isEqualToString:@"iPad7,2"])
+ return @"iPad Pro (2nd gen)";
+
+ if ([platform isEqualToString:@"iPad7,3"] ||
+ [platform isEqualToString:@"iPad7,4"])
+ return @"iPad Pro 10.5 inch";
+
+ if ([platform isEqualToString:@"iPad7,5"] ||
+ [platform isEqualToString:@"iPad7,6"])
+ return @"iPad (6th gen)";
+
+ if ([platform isEqualToString:@"iPad7,11"] ||
+ [platform isEqualToString:@"iPad7,12"])
+ return @"iPad 10.2 inch (7th gen)";
+
+ if ([platform isEqualToString:@"iPad8,1"] ||
+ [platform isEqualToString:@"iPad8,2"] ||
+ [platform isEqualToString:@"iPad8,3"] ||
+ [platform isEqualToString:@"iPad8,4"])
+ return @"iPad Pro 11 inch";
+
+ if ([platform isEqualToString:@"iPad8,5"] ||
+ [platform isEqualToString:@"iPad8,6"] ||
+ [platform isEqualToString:@"iPad8,7"] ||
+ [platform isEqualToString:@"iPad8,8"])
+ return @"iPad Pro 12.9 inch (3rd gen)";
+
+ if ([platform isEqualToString:@"iPad8,9"] ||
+ [platform isEqualToString:@"iPad8,10"])
+ return @"iPad Pro 11 inch (2th gen)";
+
+ if ([platform isEqualToString:@"iPad8,11"] ||
+ [platform isEqualToString:@"iPad8,12"])
+ return @"iPad Pro 12.9 inch (4th gen)";
+
+ if ([platform isEqualToString:@"iPad11,1"] ||
+ [platform isEqualToString:@"iPad11,2"])
+ return @"iPad mini (5th gen)";
+
+ if ([platform isEqualToString:@"iPad11,3"] ||
+ [platform isEqualToString:@"iPad11,4"])
+ return @"iPad Air (3rd gen)";
+
+ if ([platform isEqualToString:@"iPad11,6"] ||
+ [platform isEqualToString:@"iPad11,7"])
+ return @"iPad (8th gen)";
+
+ if ([platform isEqualToString:@"iPad12,1"] ||
+ [platform isEqualToString:@"iPad12,2"])
+ return @"iPad (9th gen)";
+
+ if ([platform isEqualToString:@"iPad13,1"] ||
+ [platform isEqualToString:@"iPad13,2"])
+ return @"iPad Air (4th gen)";
+
+ if ([platform isEqualToString:@"iPad13,4"] ||
+ [platform isEqualToString:@"iPad13,5"] ||
+ [platform isEqualToString:@"iPad13,6"] ||
+ [platform isEqualToString:@"iPad13,7"])
+ return @"iPad Pro 11 inch (3th gen)";
+
+ if ([platform isEqualToString:@"iPad13,8"] ||
+ [platform isEqualToString:@"iPad13,9"] ||
+ [platform isEqualToString:@"iPad13,10"] ||
+ [platform isEqualToString:@"iPad13,11"])
+ return @"iPad Pro 12.9 inch (5th gen)";
+
+ if ([platform isEqualToString:@"iPad13,16"] ||
+ [platform isEqualToString:@"iPad13,17"])
+ return @"iPad Air (5th gen)";
+
+ if ([platform isEqualToString:@"iPad13,18"] ||
+ [platform isEqualToString:@"iPad13,19"])
+ return @"iPad (10th gen)";
+
+ if ([platform isEqualToString:@"iPad14,1"] ||
+ [platform isEqualToString:@"iPad14,2"])
+ return @"iPad mini (6th gen)";
+
+ if ([platform isEqualToString:@"iPad14,3"] ||
+ [platform isEqualToString:@"iPad14,4"])
+ return @"iPad Pro 11 inch (4th gen)";
+
+ if ([platform isEqualToString:@"iPad14,5"] ||
+ [platform isEqualToString:@"iPad14,6"])
+ return @"iPad Pro 12.9 inch (6th gen)";
+
+ if ([platform isEqualToString:@"iPad14,8"] ||
+ [platform isEqualToString:@"iPad14,9"])
+ return @"iPad Air (6th gen)";
+
+ if ([platform isEqualToString:@"iPad14,10"] ||
+ [platform isEqualToString:@"iPad14,11"])
+ return @"iPad Air (7th gen)";
+
+ if ([platform isEqualToString:@"iPad16,3"] ||
+ [platform isEqualToString:@"iPad16,4"])
+ return @"iPad Pro 11 inch (5th gen)";
+
+ if ([platform isEqualToString:@"iPad16,5"] ||
+ [platform isEqualToString:@"iPad16,6"])
+ return @"iPad Pro 12.9 inch (7th gen)";
+
+ if ([platform hasPrefix:@"iPhone"])
+ return @"Unknown iPhone";
+ if ([platform hasPrefix:@"iPod"])
+ return @"Unknown iPod";
+ if ([platform hasPrefix:@"iPad"])
+ return @"Unknown iPad";
+
+ if ([platform hasSuffix:@"86"] || [platform isEqual:@"x86_64"] ||
+ [platform isEqual:@"arm64"]) {
+ return @"iPhone Simulator";
+ }
#else
- return [self macHWName];
+ return [self macHWName];
#endif
-
- return @"Unknown iOS device";
+
+ return @"Unknown iOS device";
}
-
+
- (NSString *)macHWName {
- size_t len = 0;
- sysctlbyname("hw.model", NULL, &len, NULL, 0);
- if (len) {
- char *model = malloc(len*sizeof(char));
- sysctlbyname("hw.model", model, &len, NULL, 0);
- NSString *name = [[NSString alloc] initWithUTF8String:model];
- free(model);
- return name;
- };
- return @"macOS";
+ size_t len = 0;
+ sysctlbyname("hw.model", NULL, &len, NULL, 0);
+ if (len) {
+ char *model = malloc(len * sizeof(char));
+ sysctlbyname("hw.model", model, &len, NULL, 0);
+ NSString *name = [[NSString alloc] initWithUTF8String:model];
+ free(model);
+ return name;
+ };
+ return @"macOS";
}
-- (NSString *)getSysInfoByName:(char *)typeSpecifier
-{
- size_t size;
- sysctlbyname(typeSpecifier, NULL, &size, NULL, 0);
-
- char *answer = malloc(size);
- sysctlbyname(typeSpecifier, answer, &size, NULL, 0);
-
- NSString *results = [NSString stringWithCString:answer encoding: NSUTF8StringEncoding];
-
- free(answer);
- return results;
+- (NSString *)getSysInfoByName:(char *)typeSpecifier {
+ size_t size;
+ sysctlbyname(typeSpecifier, NULL, &size, NULL, 0);
+
+ char *answer = malloc(size);
+ sysctlbyname(typeSpecifier, answer, &size, NULL, 0);
+
+ NSString *results = [NSString stringWithCString:answer
+ encoding:NSUTF8StringEncoding];
+
+ free(answer);
+ return results;
}
-- (NSString *)platform
-{
- return [self getSysInfoByName:"hw.machine"];
+- (NSString *)platform {
+ return [self getSysInfoByName:"hw.machine"];
}
- (MTApiEnvironment *)withUpdatedLangPackCode:(NSString *)langPackCode {
- MTApiEnvironment *result = [[MTApiEnvironment alloc] initWithDeviceModelName:_deviceModelName];
-
- result.apiId = self.apiId;
- result.appVersion = self.appVersion;
- result.layer = self.layer;
-
- result.langPack = self.langPack;
-
- result->_langPackCode = langPackCode;
-
- result.disableUpdates = self.disableUpdates;
- result.tcpPayloadPrefix = self.tcpPayloadPrefix;
- result.datacenterAddressOverrides = self.datacenterAddressOverrides;
- result.accessHostOverride = self.accessHostOverride;
- result->_socksProxySettings = self.socksProxySettings;
- result->_networkSettings = self.networkSettings;
- result->_systemCode = self.systemCode;
-
- [result _updateApiInitializationHash];
-
- return result;
+ MTApiEnvironment *result =
+ [[MTApiEnvironment alloc] initWithDeviceModelName:_deviceModelName];
+
+ result.apiId = self.apiId;
+ result.appVersion = self.appVersion;
+ result.layer = self.layer;
+
+ result.langPack = self.langPack;
+
+ result->_langPackCode = langPackCode;
+
+ result.disableUpdates = self.disableUpdates;
+ result.tcpPayloadPrefix = self.tcpPayloadPrefix;
+ result.datacenterAddressOverrides = self.datacenterAddressOverrides;
+ result.accessHostOverride = self.accessHostOverride;
+ result->_socksProxySettings = self.socksProxySettings;
+ result->_networkSettings = self.networkSettings;
+ result->_systemCode = self.systemCode;
+
+ [result _updateApiInitializationHash];
+
+ return result;
}
- (instancetype)copyWithZone:(NSZone *)__unused zone {
- MTApiEnvironment *result = [[MTApiEnvironment alloc] initWithDeviceModelName:_deviceModelName];
-
- result.apiId = self.apiId;
- result.appVersion = self.appVersion;
- result.layer = self.layer;
-
- result.langPack = self.langPack;
-
- result->_langPackCode = self.langPackCode;
- result->_socksProxySettings = self.socksProxySettings;
- result->_networkSettings = self.networkSettings;
- result->_systemCode = self.systemCode;
-
- result.disableUpdates = self.disableUpdates;
- result.tcpPayloadPrefix = self.tcpPayloadPrefix;
- result.datacenterAddressOverrides = self.datacenterAddressOverrides;
- result.accessHostOverride = self.accessHostOverride;
-
- [result _updateApiInitializationHash];
-
- return result;
+ MTApiEnvironment *result =
+ [[MTApiEnvironment alloc] initWithDeviceModelName:_deviceModelName];
+
+ result.apiId = self.apiId;
+ result.appVersion = self.appVersion;
+ result.layer = self.layer;
+
+ result.langPack = self.langPack;
+
+ result->_langPackCode = self.langPackCode;
+ result->_socksProxySettings = self.socksProxySettings;
+ result->_networkSettings = self.networkSettings;
+ result->_systemCode = self.systemCode;
+
+ result.disableUpdates = self.disableUpdates;
+ result.tcpPayloadPrefix = self.tcpPayloadPrefix;
+ result.datacenterAddressOverrides = self.datacenterAddressOverrides;
+ result.accessHostOverride = self.accessHostOverride;
+
+ [result _updateApiInitializationHash];
+
+ return result;
}
-- (MTApiEnvironment *)withUpdatedSocksProxySettings:(MTSocksProxySettings *)socksProxySettings {
- MTApiEnvironment *result = [[MTApiEnvironment alloc] initWithDeviceModelName:_deviceModelName];
-
- result.apiId = self.apiId;
- result.appVersion = self.appVersion;
- result.layer = self.layer;
-
- result.langPack = self.langPack;
-
- result->_langPackCode = self.langPackCode;
- result->_socksProxySettings = socksProxySettings;
- result->_networkSettings = self.networkSettings;
- result->_systemCode = self.systemCode;
-
- result.disableUpdates = self.disableUpdates;
- result.tcpPayloadPrefix = self.tcpPayloadPrefix;
- result.datacenterAddressOverrides = self.datacenterAddressOverrides;
- result.accessHostOverride = self.accessHostOverride;
-
- [result _updateApiInitializationHash];
-
- return result;
+- (MTApiEnvironment *)withUpdatedSocksProxySettings:
+ (MTSocksProxySettings *)socksProxySettings {
+ MTApiEnvironment *result =
+ [[MTApiEnvironment alloc] initWithDeviceModelName:_deviceModelName];
+
+ result.apiId = self.apiId;
+ result.appVersion = self.appVersion;
+ result.layer = self.layer;
+
+ result.langPack = self.langPack;
+
+ result->_langPackCode = self.langPackCode;
+ result->_socksProxySettings = socksProxySettings;
+ result->_networkSettings = self.networkSettings;
+ result->_systemCode = self.systemCode;
+
+ result.disableUpdates = self.disableUpdates;
+ result.tcpPayloadPrefix = self.tcpPayloadPrefix;
+ result.datacenterAddressOverrides = self.datacenterAddressOverrides;
+ result.accessHostOverride = self.accessHostOverride;
+
+ [result _updateApiInitializationHash];
+
+ return result;
}
-- (MTApiEnvironment *)withUpdatedNetworkSettings:(MTNetworkSettings *)networkSettings {
- MTApiEnvironment *result = [[MTApiEnvironment alloc] initWithDeviceModelName:_deviceModelName];
-
- result.apiId = self.apiId;
- result.appVersion = self.appVersion;
- result.layer = self.layer;
-
- result.langPack = self.langPack;
-
- result->_langPackCode = self.langPackCode;
- result->_socksProxySettings = self.socksProxySettings;
- result->_networkSettings = networkSettings;
- result->_systemCode = self.systemCode;
-
- result.disableUpdates = self.disableUpdates;
- result.tcpPayloadPrefix = self.tcpPayloadPrefix;
- result.datacenterAddressOverrides = self.datacenterAddressOverrides;
- result.accessHostOverride = self.accessHostOverride;
-
- [result _updateApiInitializationHash];
-
- return result;
+- (MTApiEnvironment *)withUpdatedNetworkSettings:
+ (MTNetworkSettings *)networkSettings {
+ MTApiEnvironment *result =
+ [[MTApiEnvironment alloc] initWithDeviceModelName:_deviceModelName];
+
+ result.apiId = self.apiId;
+ result.appVersion = self.appVersion;
+ result.layer = self.layer;
+
+ result.langPack = self.langPack;
+
+ result->_langPackCode = self.langPackCode;
+ result->_socksProxySettings = self.socksProxySettings;
+ result->_networkSettings = networkSettings;
+ result->_systemCode = self.systemCode;
+
+ result.disableUpdates = self.disableUpdates;
+ result.tcpPayloadPrefix = self.tcpPayloadPrefix;
+ result.datacenterAddressOverrides = self.datacenterAddressOverrides;
+ result.accessHostOverride = self.accessHostOverride;
+
+ [result _updateApiInitializationHash];
+
+ return result;
}
- (MTApiEnvironment *)withUpdatedSystemCode:(NSData *)systemCode {
- MTApiEnvironment *result = [[MTApiEnvironment alloc] initWithDeviceModelName:_deviceModelName];
-
- result.apiId = self.apiId;
- result.appVersion = self.appVersion;
- result.layer = self.layer;
-
- result.langPack = self.langPack;
-
- result->_langPackCode = self.langPackCode;
- result->_socksProxySettings = self.socksProxySettings;
- result->_networkSettings = self.networkSettings;
- result->_systemCode = systemCode;
-
- result.disableUpdates = self.disableUpdates;
- result.tcpPayloadPrefix = self.tcpPayloadPrefix;
- result.datacenterAddressOverrides = self.datacenterAddressOverrides;
- result.accessHostOverride = self.accessHostOverride;
-
- [result _updateApiInitializationHash];
-
- return result;
+ MTApiEnvironment *result =
+ [[MTApiEnvironment alloc] initWithDeviceModelName:_deviceModelName];
+
+ result.apiId = self.apiId;
+ result.appVersion = self.appVersion;
+ result.layer = self.layer;
+
+ result.langPack = self.langPack;
+
+ result->_langPackCode = self.langPackCode;
+ result->_socksProxySettings = self.socksProxySettings;
+ result->_networkSettings = self.networkSettings;
+ result->_systemCode = systemCode;
+
+ result.disableUpdates = self.disableUpdates;
+ result.tcpPayloadPrefix = self.tcpPayloadPrefix;
+ result.datacenterAddressOverrides = self.datacenterAddressOverrides;
+ result.accessHostOverride = self.accessHostOverride;
+
+ [result _updateApiInitializationHash];
+
+ return result;
}
@end
-
diff --git a/submodules/MtProtoKit/Sources/MTNetworkAvailability.m b/submodules/MtProtoKit/Sources/MTNetworkAvailability.m
index 47f45844..3cdbfc6b 100644
--- a/submodules/MtProtoKit/Sources/MTNetworkAvailability.m
+++ b/submodules/MtProtoKit/Sources/MTNetworkAvailability.m
@@ -62,6 +62,8 @@ static void MTNetworkAvailabilityContextRelease(const void *info)
zeroAddress.sin_len = sizeof(zeroAddress);
zeroAddress.sin_family = AF_INET;
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
_reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr *)&zeroAddress);
if (_reachability != NULL)
{
@@ -84,6 +86,7 @@ static void MTNetworkAvailabilityContextRelease(const void *info)
if (SCNetworkReachabilitySetCallback(_reachability, &MTAvailabilityCallback, &context))
SCNetworkReachabilitySetDispatchQueue(_reachability, [MTNetworkAvailability networkAvailabilityQueue].nativeQueue);
+#pragma clang diagnostic pop
}
}];
}
@@ -101,8 +104,11 @@ static void MTNetworkAvailabilityContextRelease(const void *info)
[[MTNetworkAvailability networkAvailabilityQueue] dispatchOnQueue:^{
[timer invalidate];
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
SCNetworkReachabilitySetCallback(reachability, NULL, NULL);
SCNetworkReachabilitySetDispatchQueue(reachability, NULL);
+#pragma clang diagnostic pop
CFRelease(reachability);
}];
}
@@ -126,7 +132,10 @@ static void MTNetworkAvailabilityContextRelease(const void *info)
if (_reachability != nil)
{
SCNetworkReachabilityFlags currentFlags = 0;
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
if (SCNetworkReachabilityGetFlags(_reachability, ¤tFlags))
+#pragma clang diagnostic pop
[self updateReachability:currentFlags notify:notify];
}
}];
diff --git a/submodules/NotificationSoundSelectionUI/Sources/NotificationSoundSelection.swift b/submodules/NotificationSoundSelectionUI/Sources/NotificationSoundSelection.swift
index 4e9432cc..a744c229 100644
--- a/submodules/NotificationSoundSelectionUI/Sources/NotificationSoundSelection.swift
+++ b/submodules/NotificationSoundSelectionUI/Sources/NotificationSoundSelection.swift
@@ -455,7 +455,7 @@ public func notificationSoundSelectionController(context: AccountContext, update
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
- controller.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: presentationData.strings.PeerInfo_DeleteToneTitle, text: presentationData.strings.PeerInfo_DeleteToneText(title).string, actions: [
+ controller.present(textAlertController(context: context, title: presentationData.strings.PeerInfo_DeleteToneTitle, text: presentationData.strings.PeerInfo_DeleteToneText(title).string, actions: [
TextAlertAction(type: .destructiveAction, title: presentationData.strings.Common_Delete, action: {
updateState { state in
var state = state
diff --git a/submodules/OpusBinding/BUILD b/submodules/OpusBinding/BUILD
index f65be5a8..78d27acd 100644
--- a/submodules/OpusBinding/BUILD
+++ b/submodules/OpusBinding/BUILD
@@ -24,6 +24,8 @@ objc_library(
],
sdk_frameworks = [
"Foundation",
+ "AVFoundation",
+ "AudioToolbox",
],
visibility = [
"//visibility:public",
diff --git a/submodules/OpusBinding/PublicHeaders/OpusBinding/OpusBinding.h b/submodules/OpusBinding/PublicHeaders/OpusBinding/OpusBinding.h
index 30524dbc..88139968 100644
--- a/submodules/OpusBinding/PublicHeaders/OpusBinding/OpusBinding.h
+++ b/submodules/OpusBinding/PublicHeaders/OpusBinding/OpusBinding.h
@@ -2,4 +2,5 @@
#import
#import
-#import
\ No newline at end of file
+#import
+#import
\ No newline at end of file
diff --git a/submodules/PasscodeUI/Sources/PasscodeSetupController.swift b/submodules/PasscodeUI/Sources/PasscodeSetupController.swift
index a4592b80..0c62555e 100644
--- a/submodules/PasscodeUI/Sources/PasscodeSetupController.swift
+++ b/submodules/PasscodeUI/Sources/PasscodeSetupController.swift
@@ -34,7 +34,7 @@ public final class PasscodeSetupController: ViewController {
self.mode = mode
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
- super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData))
+ super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData, style: .glass))
self.supportedOrientations = ViewControllerSupportedOrientations(regularSize: .all, compactSize: .portrait)
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style
diff --git a/submodules/PasswordSetupUI/Sources/SetupTwoStepVerificationController.swift b/submodules/PasswordSetupUI/Sources/SetupTwoStepVerificationController.swift
index 9427aa0c..e6c93894 100644
--- a/submodules/PasswordSetupUI/Sources/SetupTwoStepVerificationController.swift
+++ b/submodules/PasswordSetupUI/Sources/SetupTwoStepVerificationController.swift
@@ -39,7 +39,7 @@ public class SetupTwoStepVerificationController: ViewController {
self.presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
- super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: NavigationBarTheme(buttonColor: self.presentationData.theme.rootController.navigationBar.accentTextColor, disabledButtonColor: self.presentationData.theme.rootController.navigationBar.disabledButtonColor, primaryTextColor: self.presentationData.theme.rootController.navigationBar.primaryTextColor, backgroundColor: .clear, enableBackgroundBlur: false, separatorColor: .clear, badgeBackgroundColor: .clear, badgeStrokeColor: .clear, badgeTextColor: .clear), strings: NavigationBarStrings(presentationStrings: self.presentationData.strings)))
+ super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: NavigationBarTheme(overallDarkAppearance: self.presentationData.theme.overallDarkAppearance, buttonColor: self.presentationData.theme.rootController.navigationBar.accentTextColor, disabledButtonColor: self.presentationData.theme.rootController.navigationBar.disabledButtonColor, primaryTextColor: self.presentationData.theme.rootController.navigationBar.primaryTextColor, backgroundColor: .clear, enableBackgroundBlur: false, separatorColor: .clear, badgeBackgroundColor: .clear, badgeStrokeColor: .clear, badgeTextColor: .clear), strings: NavigationBarStrings(presentationStrings: self.presentationData.strings)))
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style
@@ -89,7 +89,7 @@ public class SetupTwoStepVerificationController: ViewController {
private func updateThemeAndStrings() {
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style
- self.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationData: self.presentationData))
+ self.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationData: self.presentationData), transition: .immediate)
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Back, style: .plain, target: nil, action: nil)
self.controllerNode.updatePresentationData(self.presentationData)
}
diff --git a/submodules/PasswordSetupUI/Sources/TwoFactorAuthDataInputScreen.swift b/submodules/PasswordSetupUI/Sources/TwoFactorAuthDataInputScreen.swift
index eaa84497..54843c67 100644
--- a/submodules/PasswordSetupUI/Sources/TwoFactorAuthDataInputScreen.swift
+++ b/submodules/PasswordSetupUI/Sources/TwoFactorAuthDataInputScreen.swift
@@ -71,7 +71,7 @@ public final class TwoFactorDataInputScreen: ViewController {
self.presentationData = self.sharedContext.currentPresentationData.with { $0 }
let defaultTheme = NavigationBarTheme(rootControllerTheme: self.presentationData.theme)
- let navigationBarTheme = NavigationBarTheme(buttonColor: defaultTheme.buttonColor, disabledButtonColor: defaultTheme.disabledButtonColor, primaryTextColor: defaultTheme.primaryTextColor, backgroundColor: .clear, enableBackgroundBlur: false, separatorColor: .clear, badgeBackgroundColor: defaultTheme.badgeBackgroundColor, badgeStrokeColor: defaultTheme.badgeStrokeColor, badgeTextColor: defaultTheme.badgeTextColor)
+ let navigationBarTheme = NavigationBarTheme(overallDarkAppearance: defaultTheme.overallDarkAppearance, buttonColor: defaultTheme.buttonColor, disabledButtonColor: defaultTheme.disabledButtonColor, primaryTextColor: defaultTheme.primaryTextColor, backgroundColor: .clear, enableBackgroundBlur: false, separatorColor: .clear, badgeBackgroundColor: defaultTheme.badgeBackgroundColor, badgeStrokeColor: defaultTheme.badgeStrokeColor, badgeTextColor: defaultTheme.badgeTextColor)
super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: navigationBarTheme, strings: NavigationBarStrings(back: self.presentationData.strings.Common_Back, close: self.presentationData.strings.Common_Close)))
@@ -119,7 +119,7 @@ public final class TwoFactorDataInputScreen: ViewController {
return
}
if values[0] != values[1] {
- strongSelf.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: nil, text: strongSelf.presentationData.strings.TwoStepAuth_SetupPasswordConfirmFailed, actions: [
+ strongSelf.present(textAlertController(sharedContext: strongSelf.sharedContext, title: nil, text: strongSelf.presentationData.strings.TwoStepAuth_SetupPasswordConfirmFailed, actions: [
TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})
]), in: .window(.root))
return
@@ -167,7 +167,7 @@ public final class TwoFactorDataInputScreen: ViewController {
text = strongSelf.presentationData.strings.Login_UnknownError
}
- strongSelf.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ strongSelf.present(textAlertController(sharedContext: strongSelf.sharedContext, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
}, completed: { [weak statusController] in
statusController?.dismiss()
@@ -196,7 +196,7 @@ public final class TwoFactorDataInputScreen: ViewController {
return
}
if values[0] != values[1] {
- strongSelf.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: nil, text: strongSelf.presentationData.strings.TwoStepAuth_SetupPasswordConfirmFailed, actions: [
+ strongSelf.present(textAlertController(sharedContext: strongSelf.sharedContext, title: nil, text: strongSelf.presentationData.strings.TwoStepAuth_SetupPasswordConfirmFailed, actions: [
TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})
]), in: .window(.root))
return
@@ -481,7 +481,7 @@ public final class TwoFactorDataInputScreen: ViewController {
}
switch strongSelf.mode {
case let .emailAddress(password, hint, doneText):
- strongSelf.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: strongSelf.presentationData.strings.TwoFactorSetup_Email_SkipConfirmationTitle, text: strongSelf.presentationData.strings.TwoFactorSetup_Email_SkipConfirmationText, actions: [
+ strongSelf.present(textAlertController(sharedContext: strongSelf.sharedContext, title: strongSelf.presentationData.strings.TwoFactorSetup_Email_SkipConfirmationTitle, text: strongSelf.presentationData.strings.TwoFactorSetup_Email_SkipConfirmationText, actions: [
TextAlertAction(type: .destructiveAction, title: strongSelf.presentationData.strings.TwoFactorSetup_Email_SkipConfirmationSkip, action: {
guard let strongSelf = self else {
return
@@ -543,7 +543,7 @@ public final class TwoFactorDataInputScreen: ViewController {
strongSelf.push(TwoFactorDataInputScreen(sharedContext: strongSelf.sharedContext, engine: strongSelf.engine, mode: .emailAddress(password: password, hint: "", doneText: doneText), stateUpdated: strongSelf.stateUpdated, presentation: strongSelf.navigationPresentation))
}
case let .passwordRecovery(recovery, _):
- strongSelf.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: strongSelf.presentationData.strings.TwoFactorSetup_PasswordRecovery_SkipAlertTitle, text: strongSelf.presentationData.strings.TwoFactorSetup_PasswordRecovery_SkipAlertText, actions: [
+ strongSelf.present(textAlertController(sharedContext: strongSelf.sharedContext, title: strongSelf.presentationData.strings.TwoFactorSetup_PasswordRecovery_SkipAlertTitle, text: strongSelf.presentationData.strings.TwoFactorSetup_PasswordRecovery_SkipAlertText, actions: [
TextAlertAction(type: .destructiveAction, title: strongSelf.presentationData.strings.TwoFactorSetup_PasswordRecovery_SkipAlertAction, action: {
guard let strongSelf = self else {
return
diff --git a/submodules/PasswordSetupUI/Sources/TwoFactorAuthSplashScreen.swift b/submodules/PasswordSetupUI/Sources/TwoFactorAuthSplashScreen.swift
index 66e73dba..6b0209ed 100644
--- a/submodules/PasswordSetupUI/Sources/TwoFactorAuthSplashScreen.swift
+++ b/submodules/PasswordSetupUI/Sources/TwoFactorAuthSplashScreen.swift
@@ -57,7 +57,7 @@ public final class TwoFactorAuthSplashScreen: ViewController {
self.presentationData = self.sharedContext.currentPresentationData.with { $0 }
let defaultTheme = NavigationBarTheme(rootControllerTheme: self.presentationData.theme)
- let navigationBarTheme = NavigationBarTheme(buttonColor: defaultTheme.buttonColor, disabledButtonColor: defaultTheme.disabledButtonColor, primaryTextColor: defaultTheme.primaryTextColor, backgroundColor: .clear, enableBackgroundBlur: false, separatorColor: .clear, badgeBackgroundColor: defaultTheme.badgeBackgroundColor, badgeStrokeColor: defaultTheme.badgeStrokeColor, badgeTextColor: defaultTheme.badgeTextColor)
+ let navigationBarTheme = NavigationBarTheme(overallDarkAppearance: defaultTheme.overallDarkAppearance, buttonColor: defaultTheme.buttonColor, disabledButtonColor: defaultTheme.disabledButtonColor, primaryTextColor: defaultTheme.primaryTextColor, backgroundColor: .clear, enableBackgroundBlur: false, separatorColor: .clear, badgeBackgroundColor: defaultTheme.badgeBackgroundColor, badgeStrokeColor: defaultTheme.badgeStrokeColor, badgeTextColor: defaultTheme.badgeTextColor)
super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: navigationBarTheme, strings: NavigationBarStrings(back: self.presentationData.strings.Common_Back, close: self.presentationData.strings.Common_Close)))
diff --git a/submodules/PeerAvatarGalleryUI/Sources/AvatarGalleryController.swift b/submodules/PeerAvatarGalleryUI/Sources/AvatarGalleryController.swift
index 9cf2bfb8..72931c65 100644
--- a/submodules/PeerAvatarGalleryUI/Sources/AvatarGalleryController.swift
+++ b/submodules/PeerAvatarGalleryUI/Sources/AvatarGalleryController.swift
@@ -754,7 +754,7 @@ public class AvatarGalleryController: ViewController, StandalonePresentableContr
self.galleryNode.setControlsHidden(true, animated: false)
if let centralItemNode = self.galleryNode.pager.centralItemNode(), let itemSize = centralItemNode.contentSize() {
self.preferredContentSize = itemSize.aspectFitted(self.view.bounds.size)
- self.containerLayoutUpdated(ContainerViewLayout(size: self.preferredContentSize, metrics: LayoutMetrics(), deviceMetrics: layout.deviceMetrics, intrinsicInsets: UIEdgeInsets(), safeInsets: UIEdgeInsets(), additionalInsets: UIEdgeInsets(), statusBarHeight: nil, inputHeight: nil, inputHeightIsInteractivellyChanging: false, inVoiceOver: false), transition: .immediate)
+ self.containerLayoutUpdated(ContainerViewLayout(size: self.preferredContentSize, metrics: LayoutMetrics(), deviceMetrics: layout.deviceMetrics, intrinsicInsets: UIEdgeInsets(), safeInsets: UIEdgeInsets(), additionalInsets: UIEdgeInsets(), statusBarHeight: nil, inputHeight: nil, inputHeightIsInteractivellyChanging: false, inVoiceOver: false), transition: .immediate)
centralItemNode.activateAsInitial()
}
}
diff --git a/submodules/PeerInfoUI/BUILD b/submodules/PeerInfoUI/BUILD
index 7c57b565..756a3d95 100644
--- a/submodules/PeerInfoUI/BUILD
+++ b/submodules/PeerInfoUI/BUILD
@@ -80,6 +80,9 @@ swift_library(
"//submodules/TelegramUI/Components/PeerManagement/OwnershipTransferController",
"//submodules/TelegramUI/Components/PeerManagement/OldChannelsController",
"//submodules/TelegramUI/Components/PeerInfo/MessagePriceItem",
+ "//submodules/TelegramUI/Components/GlassBackgroundComponent",
+ "//submodules/ComponentFlow",
+ "//submodules/Components/ComponentDisplayAdapters",
],
visibility = [
"//visibility:public",
diff --git a/submodules/PeerInfoUI/CreateExternalMediaStreamScreen/Sources/CreateExternalMediaStreamScreen.swift b/submodules/PeerInfoUI/CreateExternalMediaStreamScreen/Sources/CreateExternalMediaStreamScreen.swift
index 999385a0..10bf5156 100644
--- a/submodules/PeerInfoUI/CreateExternalMediaStreamScreen/Sources/CreateExternalMediaStreamScreen.swift
+++ b/submodules/PeerInfoUI/CreateExternalMediaStreamScreen/Sources/CreateExternalMediaStreamScreen.swift
@@ -242,7 +242,7 @@ private final class CreateExternalMediaStreamScreenComponent: CombinedComponent
component: AnyComponentWithIdentity(id: "close", component: AnyComponent(
BundleIconComponent(
name: "Navigation/Close",
- tintColor: theme.rootController.navigationBar.glassBarButtonForegroundColor
+ tintColor: theme.chat.inputPanel.panelControlColor
)
)),
action: { _ in
diff --git a/submodules/PeerInfoUI/Sources/ChannelAdminController.swift b/submodules/PeerInfoUI/Sources/ChannelAdminController.swift
index deb1d436..57a6e9a3 100644
--- a/submodules/PeerInfoUI/Sources/ChannelAdminController.swift
+++ b/submodules/PeerInfoUI/Sources/ChannelAdminController.swift
@@ -1091,7 +1091,7 @@ public func channelAdminController(context: AccountContext, updatedPresentationD
text = presentationData.strings.Channel_EditAdmin_CannotEdit
}
- presentControllerImpl?(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), nil)
+ presentControllerImpl?(textAlertController(context: context, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), nil)
})
}, transferOwnership: {
let _ = (context.engine.data.get(
@@ -1104,19 +1104,30 @@ public func channelAdminController(context: AccountContext, updatedPresentationD
}
transferOwnershipDisposable.set((context.engine.peers.checkOwnershipTranfserAvailability(memberId: adminId) |> deliverOnMainQueue).start(error: { error in
- let controller = channelOwnershipTransferController(context: context, updatedPresentationData: updatedPresentationData, peer: peer, member: member, initialError: error, present: { c, a in
- presentControllerImpl?(c, a)
- }, completion: { upgradedPeerId in
- if let upgradedPeerId = upgradedPeerId {
- upgradedToSupergroupImpl(upgradedPeerId, {
+ let controller = channelOwnershipTransferController(
+ context: context,
+ updatedPresentationData: updatedPresentationData,
+ peer: peer,
+ member: member,
+ initialError: error,
+ present: { c, a in
+ presentControllerImpl?(c, a)
+ },
+ push: { c in
+ pushControllerImpl?(c)
+ },
+ completion: { upgradedPeerId in
+ if let upgradedPeerId = upgradedPeerId {
+ upgradedToSupergroupImpl(upgradedPeerId, {
+ dismissImpl?()
+ transferedOwnership(member.id)
+ })
+ } else {
dismissImpl?()
transferedOwnership(member.id)
- })
- } else {
- dismissImpl?()
- transferedOwnership(member.id)
+ }
}
- })
+ )
presentControllerImpl?(controller, nil)
}))
})
@@ -1617,20 +1628,21 @@ public func channelAdminController(context: AccountContext, updatedPresentationD
rightNavigationButton = nil
footerItem = ChannelAdminAddBotFooterItem(theme: presentationData.theme, title: state.adminRights ? presentationData.strings.Bot_AddToChat_Add_AddAsAdmin : presentationData.strings.Bot_AddToChat_Add_AddAsMember, action: {
if state.adminRights {
- let theme = AlertControllerTheme(presentationData: presentationData)
- let attributedTitle = NSAttributedString(string: presentationData.strings.Bot_AddToChat_Add_AdminAlertTitle, font: Font.semibold(presentationData.listsFontSize.baseDisplaySize), textColor: theme.primaryColor, paragraphAlignment: .center)
-
let text = isGroup ? presentationData.strings.Bot_AddToChat_Add_AdminAlertTextGroup(peerTitle).string : presentationData.strings.Bot_AddToChat_Add_AdminAlertTextChannel(peerTitle).string
-
- let body = MarkdownAttributeSet(font: Font.regular(presentationData.listsFontSize.baseDisplaySize * 13.0 / 17.0), textColor: theme.primaryColor)
- let bold = MarkdownAttributeSet(font: Font.semibold(presentationData.listsFontSize.baseDisplaySize * 13.0 / 17.0), textColor: theme.primaryColor)
- let attributedText = parseMarkdownIntoAttributedString(text, attributes: MarkdownAttributes(body: body, bold: bold, link: body, linkAttribute: { _ in return nil }), textAlignment: .center)
-
- let controller = richTextAlertController(context: context, title: attributedTitle, text: attributedText, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Bot_AddToChat_Add_AdminAlertAdd, action: {
- rightButtonActionImpl()
- }), TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {
- })], actionLayout: .vertical)
- presentControllerImpl?(controller, nil)
+
+ let alertController = textAlertController(
+ context: context,
+ updatedPresentationData: updatedPresentationData,
+ title: presentationData.strings.Bot_AddToChat_Add_AdminAlertTitle,
+ text: text,
+ actions: [
+ TextAlertAction(type: .defaultAction, title: presentationData.strings.Bot_AddToChat_Add_AdminAlertAdd, action: { rightButtonActionImpl()
+ }),
+ TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {}),
+ ],
+ actionLayout: .vertical
+ )
+ presentControllerImpl?(alertController, nil)
} else {
rightButtonActionImpl()
}
diff --git a/submodules/PeerInfoUI/Sources/ChannelDiscussionGroupSearchContainerNode.swift b/submodules/PeerInfoUI/Sources/ChannelDiscussionGroupSearchContainerNode.swift
index 52ff8fb0..c661eab9 100644
--- a/submodules/PeerInfoUI/Sources/ChannelDiscussionGroupSearchContainerNode.swift
+++ b/submodules/PeerInfoUI/Sources/ChannelDiscussionGroupSearchContainerNode.swift
@@ -135,7 +135,7 @@ final class ChannelDiscussionGroupSearchContainerNode: SearchDisplayControllerCo
super.init()
- self.dimNode.backgroundColor = UIColor(white: 0.0, alpha: 0.5)
+ self.dimNode.backgroundColor = .clear
self.listNode.backgroundColor = self.presentationData.theme.chatList.backgroundColor
self.listNode.isHidden = true
diff --git a/submodules/PeerInfoUI/Sources/ChannelDiscussionGroupSetupHeaderItem.swift b/submodules/PeerInfoUI/Sources/ChannelDiscussionGroupSetupHeaderItem.swift
index 9a87b600..e98240c8 100644
--- a/submodules/PeerInfoUI/Sources/ChannelDiscussionGroupSetupHeaderItem.swift
+++ b/submodules/PeerInfoUI/Sources/ChannelDiscussionGroupSetupHeaderItem.swift
@@ -90,7 +90,7 @@ class ChannelDiscussionGroupSetupHeaderItemNode: ListViewItemNode {
self.labelNode.contentMode = .left
self.labelNode.contentsScale = UIScreen.main.scale
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.imageNode)
self.addSubnode(self.titleNode)
diff --git a/submodules/PeerInfoUI/Sources/ChannelDiscussionGroupSetupSearchItem.swift b/submodules/PeerInfoUI/Sources/ChannelDiscussionGroupSetupSearchItem.swift
index d0e05756..b95ba046 100644
--- a/submodules/PeerInfoUI/Sources/ChannelDiscussionGroupSetupSearchItem.swift
+++ b/submodules/PeerInfoUI/Sources/ChannelDiscussionGroupSetupSearchItem.swift
@@ -9,6 +9,11 @@ import ItemListUI
import PresentationDataUtils
import AccountContext
import SearchBarNode
+import GlassBackgroundComponent
+import ComponentFlow
+import ComponentDisplayAdapters
+import AppBundle
+import ActivityIndicator
final class ChannelDiscussionGroupSetupSearchItem: ItemListControllerSearch {
let context: AccountContext
@@ -84,8 +89,8 @@ private final class ChannelDiscussionGroupSetupSearchItemNode: ItemListControlle
}
override func updateLayout(layout: ContainerViewLayout, navigationBarHeight: CGFloat, transition: ContainedViewLayoutTransition) {
- transition.updateFrame(node: self.containerNode, frame: CGRect(origin: CGPoint(x: 0.0, y: navigationBarHeight), size: CGSize(width: layout.size.width, height: layout.size.height - navigationBarHeight)))
- self.containerNode.containerLayoutUpdated(layout.withUpdatedSize(CGSize(width: layout.size.width, height: layout.size.height - navigationBarHeight)), navigationBarHeight: 0.0, transition: transition)
+ transition.updateFrame(node: self.containerNode, frame: CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: layout.size.width, height: layout.size.height)))
+ self.containerNode.containerLayoutUpdated(layout.withUpdatedSize(CGSize(width: layout.size.width, height: layout.size.height)), navigationBarHeight: navigationBarHeight, transition: transition)
}
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
@@ -100,17 +105,40 @@ private final class ChannelDiscussionGroupSetupSearchItemNode: ItemListControlle
private let searchBarFont = Font.regular(17.0)
private final class ChannelDiscussionSearchNavigationContentNode: NavigationBarContentNode, ItemListControllerSearchNavigationContentNode {
+ private struct Params: Equatable {
+ let size: CGSize
+ let leftInset: CGFloat
+ let rightInset: CGFloat
+
+ init(size: CGSize, leftInset: CGFloat, rightInset: CGFloat) {
+ self.size = size
+ self.leftInset = leftInset
+ self.rightInset = rightInset
+ }
+ }
+
private var theme: PresentationTheme
private let strings: PresentationStrings
private let cancel: () -> Void
+ private let backgroundContainer: GlassBackgroundContainerView
+ private let backgroundView: GlassBackgroundView
+ private let iconView: UIImageView
+ private var activityIndicator: ActivityIndicator?
private let searchBar: SearchBarNode
+ private let close: (background: GlassBackgroundView, icon: UIImageView)
+
+ private var params: Params?
private var queryUpdated: ((String) -> Void)?
var activity: Bool = false {
didSet {
- searchBar.activity = activity
+ if self.activity != oldValue {
+ if let params = self.params {
+ let _ = self.updateLayout(size: params.size, leftInset: params.leftInset, rightInset: params.rightInset, transition: .immediate)
+ }
+ }
}
}
init(theme: PresentationTheme, strings: PresentationStrings, cancel: @escaping () -> Void, updateActivity: @escaping(@escaping(Bool)->Void) -> Void) {
@@ -119,11 +147,42 @@ private final class ChannelDiscussionSearchNavigationContentNode: NavigationBarC
self.cancel = cancel
- self.searchBar = SearchBarNode(theme: SearchBarNodeTheme(theme: theme, hasSeparator: false), strings: strings, fieldStyle: .modern)
+ self.backgroundContainer = GlassBackgroundContainerView()
+ self.backgroundView = GlassBackgroundView()
+ self.backgroundContainer.contentView.addSubview(self.backgroundView)
+ self.iconView = UIImageView()
+ self.backgroundView.contentView.addSubview(self.iconView)
+
+ self.close = (GlassBackgroundView(), UIImageView())
+ self.close.background.contentView.addSubview(self.close.icon)
+
+ self.searchBar = SearchBarNode(
+ theme: SearchBarNodeTheme(
+ background: .clear,
+ separator: .clear,
+ inputFill: .clear,
+ primaryText: theme.chat.inputPanel.panelControlColor,
+ placeholder: theme.chat.inputPanel.inputPlaceholderColor,
+ inputIcon: theme.chat.inputPanel.inputControlColor,
+ inputClear: theme.chat.inputPanel.panelControlColor,
+ accent: theme.chat.inputPanel.panelControlAccentColor,
+ keyboard: theme.rootController.keyboardColor
+ ),
+ presentationTheme: theme,
+ strings: strings,
+ fieldStyle: .inlineNavigation,
+ forceSeparator: false,
+ displayBackground: false,
+ cancelText: nil
+ )
super.init()
- self.addSubnode(self.searchBar)
+ self.view.addSubview(self.backgroundContainer)
+ self.backgroundView.contentView.addSubview(self.searchBar.view)
+
+ self.backgroundContainer.contentView.addSubview(self.close.background)
+ self.close.background.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.onCloseTapGesture(_:))))
self.searchBar.cancel = { [weak self] in
self?.searchBar.deactivate(clear: false)
@@ -141,13 +200,21 @@ private final class ChannelDiscussionSearchNavigationContentNode: NavigationBarC
self.updatePlaceholder()
}
+ @objc private func onCloseTapGesture(_ recognizer: UITapGestureRecognizer) {
+ if case .ended = recognizer.state {
+ self.searchBar.cancel?()
+ }
+ }
+
func setQueryUpdated(_ f: @escaping (String) -> Void) {
self.queryUpdated = f
}
func updateTheme(_ theme: PresentationTheme) {
self.theme = theme
- self.searchBar.updateThemeAndStrings(theme: SearchBarNodeTheme(theme: self.theme), strings: self.strings)
+ if let params = self.params {
+ let _ = self.updateLayout(size: params.size, leftInset: params.leftInset, rightInset: params.rightInset, transition: .immediate)
+ }
self.updatePlaceholder()
}
@@ -158,13 +225,87 @@ private final class ChannelDiscussionSearchNavigationContentNode: NavigationBarC
}
override var nominalHeight: CGFloat {
- return 54.0
+ return 60.0
}
- override func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, transition: ContainedViewLayoutTransition) {
- let searchBarFrame = CGRect(origin: CGPoint(x: 0.0, y: size.height - self.nominalHeight), size: CGSize(width: size.width, height: 54.0))
- self.searchBar.frame = searchBarFrame
- self.searchBar.updateLayout(boundingSize: searchBarFrame.size, leftInset: leftInset, rightInset: rightInset, transition: transition)
+ override func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, transition: ContainedViewLayoutTransition) -> CGSize {
+ self.params = Params(size: size, leftInset: leftInset, rightInset: rightInset)
+
+ let transition = ComponentTransition(transition)
+
+ let backgroundFrame = CGRect(origin: CGPoint(x: leftInset + 16.0, y: 6.0), size: CGSize(width: size.width - 16.0 * 2.0 - leftInset - rightInset - 44.0 - 8.0, height: 44.0))
+ let closeFrame = CGRect(origin: CGPoint(x: size.width - 16.0 - rightInset - 44.0, y: backgroundFrame.minY), size: CGSize(width: 44.0, height: 44.0))
+
+ transition.setFrame(view: self.backgroundContainer, frame: CGRect(origin: CGPoint(), size: size))
+ self.backgroundContainer.update(size: size, isDark: self.theme.overallDarkAppearance, transition: transition)
+
+ transition.setFrame(view: self.backgroundView, frame: backgroundFrame)
+ self.backgroundView.update(size: backgroundFrame.size, cornerRadius: backgroundFrame.height * 0.5, isDark: self.theme.overallDarkAppearance, tintColor: .init(kind: .panel, color: UIColor(white: self.theme.overallDarkAppearance ? 0.0 : 1.0, alpha: 0.6)), isInteractive: true, transition: transition)
+
+ if self.iconView.image == nil {
+ self.iconView.image = UIImage(bundleImageName: "Navigation/Search")?.withRenderingMode(.alwaysTemplate)
+ }
+ transition.setTintColor(view: self.iconView, color: self.theme.rootController.navigationSearchBar.inputIconColor)
+
+ if let image = self.iconView.image {
+ let imageSize: CGSize
+ let iconFrame: CGRect
+ let iconFraction: CGFloat = 0.8
+ imageSize = CGSize(width: image.size.width * iconFraction, height: image.size.height * iconFraction)
+ iconFrame = CGRect(origin: CGPoint(x: 12.0, y: floor((backgroundFrame.height - imageSize.height) * 0.5)), size: imageSize)
+ transition.setPosition(view: self.iconView, position: iconFrame.center)
+ transition.setBounds(view: self.iconView, bounds: CGRect(origin: CGPoint(), size: iconFrame.size))
+ }
+
+ if self.activity {
+ let activityIndicator: ActivityIndicator
+ if let current = self.activityIndicator {
+ activityIndicator = current
+ } else {
+ activityIndicator = ActivityIndicator(type: .custom(self.theme.chat.inputPanel.inputControlColor, 14.0, 14.0, false))
+ self.activityIndicator = activityIndicator
+ self.backgroundView.contentView.addSubview(activityIndicator.view)
+ }
+ let indicatorSize = activityIndicator.measure(CGSize(width: 32.0, height: 32.0))
+ let indicatorFrame = CGRect(origin: CGPoint(x: 15.0, y: floorToScreenPixels((backgroundFrame.height - indicatorSize.height) * 0.5)), size: indicatorSize)
+ transition.setPosition(view: activityIndicator.view, position: indicatorFrame.center)
+ transition.setBounds(view: activityIndicator.view, bounds: CGRect(origin: CGPoint(), size: indicatorFrame.size))
+ } else if let activityIndicator = self.activityIndicator {
+ self.activityIndicator = nil
+ activityIndicator.view.removeFromSuperview()
+ }
+ self.iconView.isHidden = self.activity
+
+ let searchBarFrame = CGRect(origin: CGPoint(x: 36.0, y: 0.0), size: CGSize(width: backgroundFrame.width - 36.0 - 4.0, height: 44.0))
+ transition.setFrame(view: self.searchBar.view, frame: searchBarFrame)
+ self.searchBar.updateLayout(boundingSize: searchBarFrame.size, leftInset: 0.0, rightInset: 0.0, transition: transition.containedViewLayoutTransition)
+
+ if self.close.icon.image == nil {
+ self.close.icon.image = generateImage(CGSize(width: 40.0, height: 40.0), contextGenerator: { size, context in
+ context.clear(CGRect(origin: CGPoint(), size: size))
+
+ context.setLineWidth(2.0)
+ context.setLineCap(.round)
+ context.setStrokeColor(UIColor.white.cgColor)
+
+ context.beginPath()
+ context.move(to: CGPoint(x: 12.0, y: 12.0))
+ context.addLine(to: CGPoint(x: size.width - 12.0, y: size.height - 12.0))
+ context.move(to: CGPoint(x: size.width - 12.0, y: 12.0))
+ context.addLine(to: CGPoint(x: 12.0, y: size.height - 12.0))
+ context.strokePath()
+ })?.withRenderingMode(.alwaysTemplate)
+ }
+
+ if let image = close.icon.image {
+ self.close.icon.frame = image.size.centered(in: CGRect(origin: CGPoint(), size: closeFrame.size))
+ }
+ self.close.icon.tintColor = self.theme.chat.inputPanel.panelControlColor
+
+ transition.setFrame(view: self.close.background, frame: closeFrame)
+ self.close.background.update(size: closeFrame.size, cornerRadius: closeFrame.height * 0.5, isDark: self.theme.overallDarkAppearance, tintColor: .init(kind: .panel, color: UIColor(white: self.theme.overallDarkAppearance ? 0.0 : 1.0, alpha: 0.6)), isInteractive: true, transition: transition)
+
+ return size
}
func activate() {
diff --git a/submodules/PeerInfoUI/Sources/ChannelMembersSearchContainerNode.swift b/submodules/PeerInfoUI/Sources/ChannelMembersSearchContainerNode.swift
index 0116746e..1aec3ba6 100644
--- a/submodules/PeerInfoUI/Sources/ChannelMembersSearchContainerNode.swift
+++ b/submodules/PeerInfoUI/Sources/ChannelMembersSearchContainerNode.swift
@@ -1203,7 +1203,7 @@ public final class ChannelMembersSearchContainerNode: SearchDisplayControllerCon
strongSelf.enqueueEmptyQueryTransition(transition, firstTime: firstTime)
if entries == nil {
- strongSelf.emptyQueryListNode.backgroundColor = UIColor(white: 0.0, alpha: 0.5)
+ strongSelf.emptyQueryListNode.backgroundColor = .clear
} else {
strongSelf.emptyQueryListNode.backgroundColor = presentationData.theme.chatList.backgroundColor
}
diff --git a/submodules/PeerInfoUI/Sources/ChannelMembersSearchController.swift b/submodules/PeerInfoUI/Sources/ChannelMembersSearchController.swift
index bd022fb7..d0135110 100644
--- a/submodules/PeerInfoUI/Sources/ChannelMembersSearchController.swift
+++ b/submodules/PeerInfoUI/Sources/ChannelMembersSearchController.swift
@@ -42,8 +42,9 @@ public final class ChannelMembersSearchControllerImpl: ViewController, ChannelMe
self.presentationData = self.presentationData.withUpdated(theme: forceTheme)
}
- super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData))
+ super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData, style: .glass))
+ self._hasGlassStyle = true
self.navigationPresentation = .modal
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style
diff --git a/submodules/PeerInfoUI/Sources/ChannelMembersSearchControllerNode.swift b/submodules/PeerInfoUI/Sources/ChannelMembersSearchControllerNode.swift
index b9f3bf04..af8f4190 100644
--- a/submodules/PeerInfoUI/Sources/ChannelMembersSearchControllerNode.swift
+++ b/submodules/PeerInfoUI/Sources/ChannelMembersSearchControllerNode.swift
@@ -685,7 +685,7 @@ class ChannelMembersSearchControllerNode: ASDisplayNode {
if let requestDeactivateSearch = self?.requestDeactivateSearch {
requestDeactivateSearch()
}
- })
+ }, fieldStyle: placeholderNode.fieldStyle)
self.searchDisplayController?.containerLayoutUpdated(containerLayout, navigationBarHeight: navigationBarHeight, transition: .immediate)
self.searchDisplayController?.activate(insertSubnode: { [weak self, weak placeholderNode] subnode, isSearchBar in
diff --git a/submodules/PeerInfoUI/Sources/ChannelPermissionsController.swift b/submodules/PeerInfoUI/Sources/ChannelPermissionsController.swift
index 5e130739..701e1c79 100644
--- a/submodules/PeerInfoUI/Sources/ChannelPermissionsController.swift
+++ b/submodules/PeerInfoUI/Sources/ChannelPermissionsController.swift
@@ -1132,22 +1132,26 @@ public func channelPermissionsController(context: AccountContext, updatedPresent
controller.navigationPresentation = .modal
controller.setState(.custom(icon: .animation("BroadcastGroup"), title: presentationData.strings.BroadcastGroups_IntroTitle, subtitle: nil, text: presentationData.strings.BroadcastGroups_IntroText, buttonTitle: presentationData.strings.BroadcastGroups_Convert, secondaryButtonTitle: presentationData.strings.BroadcastGroups_Cancel, footerText: nil), animated: false)
controller.proceed = { [weak controller] result in
- let attributedTitle = NSAttributedString(string: presentationData.strings.BroadcastGroups_ConfirmationAlert_Title, font: Font.semibold(presentationData.listsFontSize.baseDisplaySize), textColor: presentationData.theme.actionSheet.primaryTextColor, paragraphAlignment: .center)
- let body = MarkdownAttributeSet(font: Font.regular(presentationData.listsFontSize.baseDisplaySize * 13.0 / 17.0), textColor: presentationData.theme.actionSheet.primaryTextColor)
- let bold = MarkdownAttributeSet(font: Font.semibold(presentationData.listsFontSize.baseDisplaySize * 13.0 / 17.0), textColor: presentationData.theme.actionSheet.primaryTextColor)
- let attributedText = parseMarkdownIntoAttributedString(presentationData.strings.BroadcastGroups_ConfirmationAlert_Text, attributes: MarkdownAttributes(body: body, bold: bold, link: body, linkAttribute: { _ in return nil }), textAlignment: .center)
-
- let alertController = richTextAlertController(context: context, title: attributedTitle, text: attributedText, actions: [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {}), TextAlertAction(type: .defaultAction, title: presentationData.strings.BroadcastGroups_ConfirmationAlert_Convert, action: { [weak controller] in
- controller?.dismiss()
-
- let _ = (convertGroupToGigagroup(account: context.account, peerId: originalPeerId)
- |> deliverOnMainQueue).start(completed: {
- let participantsLimit = context.currentLimitsConfiguration.with { $0 }.maxSupergroupMemberCount
- presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .gigagroupConversion(text: presentationData.strings.BroadcastGroups_Success(presentationStringsFormattedNumber(participantsLimit, presentationData.dateTimeFormat.decimalSeparator)).string), elevatedLayout: true, action: { _ in return false }), nil)
-
- dismissToChatController?()
- })
- })])
+ let alertController = textAlertController(
+ context: context,
+ updatedPresentationData: updatedPresentationData,
+ title: presentationData.strings.BroadcastGroups_ConfirmationAlert_Title,
+ text: presentationData.strings.BroadcastGroups_ConfirmationAlert_Text,
+ actions: [
+ TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {}),
+ TextAlertAction(type: .defaultAction, title: presentationData.strings.BroadcastGroups_ConfirmationAlert_Convert, action: { [weak controller] in
+ controller?.dismiss()
+
+ let _ = (convertGroupToGigagroup(account: context.account, peerId: originalPeerId)
+ |> deliverOnMainQueue).start(completed: {
+ let participantsLimit = context.currentLimitsConfiguration.with { $0 }.maxSupergroupMemberCount
+ presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .gigagroupConversion(text: presentationData.strings.BroadcastGroups_Success(presentationStringsFormattedNumber(participantsLimit, presentationData.dateTimeFormat.decimalSeparator)).string), elevatedLayout: true, action: { _ in return false }), nil)
+
+ dismissToChatController?()
+ })
+ })
+ ]
+ )
controller?.present(alertController, in: .window(.root))
}
pushControllerImpl?(controller)
diff --git a/submodules/PeerInfoUI/Sources/ChatSlowmodeItem.swift b/submodules/PeerInfoUI/Sources/ChatSlowmodeItem.swift
index 781c3eec..f87a8316 100644
--- a/submodules/PeerInfoUI/Sources/ChatSlowmodeItem.swift
+++ b/submodules/PeerInfoUI/Sources/ChatSlowmodeItem.swift
@@ -95,7 +95,7 @@ class ChatSlowmodeItemNode: ListViewItemNode {
return textNode
}
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.textNodes.forEach(self.addSubnode)
}
diff --git a/submodules/PeerInfoUI/Sources/ChatUnrestrictBoostersItem.swift b/submodules/PeerInfoUI/Sources/ChatUnrestrictBoostersItem.swift
index baa545c7..4817be5e 100644
--- a/submodules/PeerInfoUI/Sources/ChatUnrestrictBoostersItem.swift
+++ b/submodules/PeerInfoUI/Sources/ChatUnrestrictBoostersItem.swift
@@ -103,7 +103,7 @@ class ChatUnrestrictBoostersItemNode: ListViewItemNode {
return textNode
}
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.iconNodes.forEach(self.addSubnode)
self.textNodes.forEach(self.addSubnode)
diff --git a/submodules/PeerInfoUI/Sources/GroupInfoSearchItem.swift b/submodules/PeerInfoUI/Sources/GroupInfoSearchItem.swift
index 6f636531..46469ec4 100644
--- a/submodules/PeerInfoUI/Sources/GroupInfoSearchItem.swift
+++ b/submodules/PeerInfoUI/Sources/GroupInfoSearchItem.swift
@@ -110,8 +110,8 @@ private final class ChannelMembersSearchItemNode: ItemListControllerSearchNode {
}
override func updateLayout(layout: ContainerViewLayout, navigationBarHeight: CGFloat, transition: ContainedViewLayoutTransition) {
- transition.updateFrame(node: self.containerNode, frame: CGRect(origin: CGPoint(x: 0.0, y: navigationBarHeight), size: CGSize(width: layout.size.width, height: layout.size.height - navigationBarHeight)))
- self.containerNode.containerLayoutUpdated(layout.withUpdatedSize(CGSize(width: layout.size.width, height: layout.size.height - navigationBarHeight)), navigationBarHeight: 0.0, transition: transition)
+ transition.updateFrame(node: self.containerNode, frame: CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: layout.size.width, height: layout.size.height)))
+ self.containerNode.containerLayoutUpdated(layout.withUpdatedSize(CGSize(width: layout.size.width, height: layout.size.height)), navigationBarHeight: navigationBarHeight, transition: transition)
}
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
diff --git a/submodules/PeerInfoUI/Sources/GroupInfoSearchNavigationContentNode.swift b/submodules/PeerInfoUI/Sources/GroupInfoSearchNavigationContentNode.swift
index 16c072a3..a298a6ab 100644
--- a/submodules/PeerInfoUI/Sources/GroupInfoSearchNavigationContentNode.swift
+++ b/submodules/PeerInfoUI/Sources/GroupInfoSearchNavigationContentNode.swift
@@ -8,24 +8,53 @@ import TelegramPresentationData
import ItemListUI
import PresentationDataUtils
import SearchBarNode
+import GlassBackgroundComponent
+import ComponentFlow
+import ComponentDisplayAdapters
+import AppBundle
+import ActivityIndicator
private let searchBarFont = Font.regular(17.0)
final class GroupInfoSearchNavigationContentNode: NavigationBarContentNode, ItemListControllerSearchNavigationContentNode {
+ private struct Params: Equatable {
+ let size: CGSize
+ let leftInset: CGFloat
+ let rightInset: CGFloat
+
+ init(size: CGSize, leftInset: CGFloat, rightInset: CGFloat) {
+ self.size = size
+ self.leftInset = leftInset
+ self.rightInset = rightInset
+ }
+ }
+
private var theme: PresentationTheme
private let strings: PresentationStrings
private let searchMode: ChannelMembersSearchMode
private let cancel: () -> Void
+ private let backgroundContainer: GlassBackgroundContainerView
+ private let backgroundView: GlassBackgroundView
+ private let iconView: UIImageView
+ private var activityIndicator: ActivityIndicator?
private let searchBar: SearchBarNode
+ private let close: (background: GlassBackgroundView, icon: UIImageView)
+
+ private var params: Params?
private var queryUpdated: ((String) -> Void)?
var activity: Bool = false {
didSet {
- searchBar.activity = activity
+ if self.activity != oldValue {
+ if let params = self.params {
+ let _ = self.updateLayout(size: params.size, leftInset: params.leftInset, rightInset: params.rightInset, transition: .immediate)
+ }
+ }
}
}
+
init(theme: PresentationTheme, strings: PresentationStrings, mode: ChannelMembersSearchMode, cancel: @escaping () -> Void, updateActivity: @escaping(@escaping(Bool)->Void) -> Void) {
self.theme = theme
self.strings = strings
@@ -33,11 +62,42 @@ final class GroupInfoSearchNavigationContentNode: NavigationBarContentNode, Item
self.cancel = cancel
- self.searchBar = SearchBarNode(theme: SearchBarNodeTheme(theme: theme, hasSeparator: false), strings: strings, fieldStyle: .modern, displayBackground: false)
+ self.backgroundContainer = GlassBackgroundContainerView()
+ self.backgroundView = GlassBackgroundView()
+ self.backgroundContainer.contentView.addSubview(self.backgroundView)
+ self.iconView = UIImageView()
+ self.backgroundView.contentView.addSubview(self.iconView)
+
+ self.close = (GlassBackgroundView(), UIImageView())
+ self.close.background.contentView.addSubview(self.close.icon)
+
+ self.searchBar = SearchBarNode(
+ theme: SearchBarNodeTheme(
+ background: .clear,
+ separator: .clear,
+ inputFill: .clear,
+ primaryText: theme.chat.inputPanel.panelControlColor,
+ placeholder: theme.chat.inputPanel.inputPlaceholderColor,
+ inputIcon: theme.chat.inputPanel.inputControlColor,
+ inputClear: theme.chat.inputPanel.panelControlColor,
+ accent: theme.chat.inputPanel.panelControlAccentColor,
+ keyboard: theme.rootController.keyboardColor
+ ),
+ presentationTheme: theme,
+ strings: strings,
+ fieldStyle: .inlineNavigation,
+ forceSeparator: false,
+ displayBackground: false,
+ cancelText: nil
+ )
super.init()
- self.addSubnode(self.searchBar)
+ self.view.addSubview(self.backgroundContainer)
+ self.backgroundView.contentView.addSubview(self.searchBar.view)
+
+ self.backgroundContainer.contentView.addSubview(self.close.background)
+ self.close.background.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.onCloseTapGesture(_:))))
self.searchBar.cancel = { [weak self] in
self?.searchBar.deactivate(clear: false)
@@ -55,13 +115,21 @@ final class GroupInfoSearchNavigationContentNode: NavigationBarContentNode, Item
self.updatePlaceholder()
}
+ @objc private func onCloseTapGesture(_ recognizer: UITapGestureRecognizer) {
+ if case .ended = recognizer.state {
+ self.searchBar.cancel?()
+ }
+ }
+
func setQueryUpdated(_ f: @escaping (String) -> Void) {
self.queryUpdated = f
}
func updateTheme(_ theme: PresentationTheme) {
self.theme = theme
- self.searchBar.updateThemeAndStrings(theme: SearchBarNodeTheme(theme: self.theme), strings: self.strings)
+ if let params = self.params {
+ let _ = self.updateLayout(size: params.size, leftInset: params.leftInset, rightInset: params.rightInset, transition: .immediate)
+ }
self.updatePlaceholder()
}
@@ -77,13 +145,87 @@ final class GroupInfoSearchNavigationContentNode: NavigationBarContentNode, Item
}
override var nominalHeight: CGFloat {
- return 54.0
+ return 60.0
}
- override func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, transition: ContainedViewLayoutTransition) {
- let searchBarFrame = CGRect(origin: CGPoint(x: 0.0, y: size.height - self.nominalHeight), size: CGSize(width: size.width, height: 54.0))
- self.searchBar.frame = searchBarFrame
- self.searchBar.updateLayout(boundingSize: searchBarFrame.size, leftInset: leftInset, rightInset: rightInset, transition: transition)
+ override func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, transition: ContainedViewLayoutTransition) -> CGSize {
+ self.params = Params(size: size, leftInset: leftInset, rightInset: rightInset)
+
+ let transition = ComponentTransition(transition)
+
+ let backgroundFrame = CGRect(origin: CGPoint(x: leftInset + 16.0, y: 6.0), size: CGSize(width: size.width - 16.0 * 2.0 - leftInset - rightInset - 44.0 - 8.0, height: 44.0))
+ let closeFrame = CGRect(origin: CGPoint(x: size.width - 16.0 - rightInset - 44.0, y: backgroundFrame.minY), size: CGSize(width: 44.0, height: 44.0))
+
+ transition.setFrame(view: self.backgroundContainer, frame: CGRect(origin: CGPoint(), size: size))
+ self.backgroundContainer.update(size: size, isDark: self.theme.overallDarkAppearance, transition: transition)
+
+ transition.setFrame(view: self.backgroundView, frame: backgroundFrame)
+ self.backgroundView.update(size: backgroundFrame.size, cornerRadius: backgroundFrame.height * 0.5, isDark: self.theme.overallDarkAppearance, tintColor: .init(kind: .panel, color: UIColor(white: self.theme.overallDarkAppearance ? 0.0 : 1.0, alpha: 0.6)), isInteractive: true, transition: transition)
+
+ if self.iconView.image == nil {
+ self.iconView.image = UIImage(bundleImageName: "Navigation/Search")?.withRenderingMode(.alwaysTemplate)
+ }
+ transition.setTintColor(view: self.iconView, color: self.theme.rootController.navigationSearchBar.inputIconColor)
+
+ if let image = self.iconView.image {
+ let imageSize: CGSize
+ let iconFrame: CGRect
+ let iconFraction: CGFloat = 0.8
+ imageSize = CGSize(width: image.size.width * iconFraction, height: image.size.height * iconFraction)
+ iconFrame = CGRect(origin: CGPoint(x: 12.0, y: floor((backgroundFrame.height - imageSize.height) * 0.5)), size: imageSize)
+ transition.setPosition(view: self.iconView, position: iconFrame.center)
+ transition.setBounds(view: self.iconView, bounds: CGRect(origin: CGPoint(), size: iconFrame.size))
+ }
+
+ if self.activity {
+ let activityIndicator: ActivityIndicator
+ if let current = self.activityIndicator {
+ activityIndicator = current
+ } else {
+ activityIndicator = ActivityIndicator(type: .custom(self.theme.chat.inputPanel.inputControlColor, 14.0, 14.0, false))
+ self.activityIndicator = activityIndicator
+ self.backgroundView.contentView.addSubview(activityIndicator.view)
+ }
+ let indicatorSize = activityIndicator.measure(CGSize(width: 32.0, height: 32.0))
+ let indicatorFrame = CGRect(origin: CGPoint(x: 15.0, y: floorToScreenPixels((backgroundFrame.height - indicatorSize.height) * 0.5)), size: indicatorSize)
+ transition.setPosition(view: activityIndicator.view, position: indicatorFrame.center)
+ transition.setBounds(view: activityIndicator.view, bounds: CGRect(origin: CGPoint(), size: indicatorFrame.size))
+ } else if let activityIndicator = self.activityIndicator {
+ self.activityIndicator = nil
+ activityIndicator.view.removeFromSuperview()
+ }
+ self.iconView.isHidden = self.activity
+
+ let searchBarFrame = CGRect(origin: CGPoint(x: 36.0, y: 0.0), size: CGSize(width: backgroundFrame.width - 36.0 - 4.0, height: 44.0))
+ transition.setFrame(view: self.searchBar.view, frame: searchBarFrame)
+ self.searchBar.updateLayout(boundingSize: searchBarFrame.size, leftInset: 0.0, rightInset: 0.0, transition: transition.containedViewLayoutTransition)
+
+ if self.close.icon.image == nil {
+ self.close.icon.image = generateImage(CGSize(width: 40.0, height: 40.0), contextGenerator: { size, context in
+ context.clear(CGRect(origin: CGPoint(), size: size))
+
+ context.setLineWidth(2.0)
+ context.setLineCap(.round)
+ context.setStrokeColor(UIColor.white.cgColor)
+
+ context.beginPath()
+ context.move(to: CGPoint(x: 12.0, y: 12.0))
+ context.addLine(to: CGPoint(x: size.width - 12.0, y: size.height - 12.0))
+ context.move(to: CGPoint(x: size.width - 12.0, y: 12.0))
+ context.addLine(to: CGPoint(x: 12.0, y: size.height - 12.0))
+ context.strokePath()
+ })?.withRenderingMode(.alwaysTemplate)
+ }
+
+ if let image = close.icon.image {
+ self.close.icon.frame = image.size.centered(in: CGRect(origin: CGPoint(), size: closeFrame.size))
+ }
+ self.close.icon.tintColor = self.theme.chat.inputPanel.panelControlColor
+
+ transition.setFrame(view: self.close.background, frame: closeFrame)
+ self.close.background.update(size: closeFrame.size, cornerRadius: closeFrame.height * 0.5, isDark: self.theme.overallDarkAppearance, tintColor: .init(kind: .panel, color: UIColor(white: self.theme.overallDarkAppearance ? 0.0 : 1.0, alpha: 0.6)), isInteractive: true, transition: transition)
+
+ return size
}
func activate() {
@@ -94,4 +236,3 @@ final class GroupInfoSearchNavigationContentNode: NavigationBarContentNode, Item
self.searchBar.deactivate(clear: false)
}
}
-
diff --git a/submodules/PeerInfoUI/Sources/ItemListCallListItem.swift b/submodules/PeerInfoUI/Sources/ItemListCallListItem.swift
index 23bb4f30..cfd32b4a 100644
--- a/submodules/PeerInfoUI/Sources/ItemListCallListItem.swift
+++ b/submodules/PeerInfoUI/Sources/ItemListCallListItem.swift
@@ -174,7 +174,7 @@ public class ItemListCallListItemNode: ListViewItemNode {
self.accessibilityArea = AccessibilityAreaNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.titleNode)
self.addSubnode(self.accessibilityArea)
diff --git a/submodules/PeerInfoUI/Sources/ItemListReactionItem.swift b/submodules/PeerInfoUI/Sources/ItemListReactionItem.swift
index e1e2d04c..64133463 100644
--- a/submodules/PeerInfoUI/Sources/ItemListReactionItem.swift
+++ b/submodules/PeerInfoUI/Sources/ItemListReactionItem.swift
@@ -168,7 +168,7 @@ public class ItemListReactionItemNode: ListViewItemNode, ItemListItemNode {
self.activateArea = AccessibilityAreaNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.titleNode)
self.addSubnode(self.switchNode)
diff --git a/submodules/PeerInfoUI/Sources/ItemListSecretChatKeyItem.swift b/submodules/PeerInfoUI/Sources/ItemListSecretChatKeyItem.swift
index a9824f78..4d3b3634 100644
--- a/submodules/PeerInfoUI/Sources/ItemListSecretChatKeyItem.swift
+++ b/submodules/PeerInfoUI/Sources/ItemListSecretChatKeyItem.swift
@@ -123,7 +123,7 @@ class ItemListSecretChatKeyItemNode: ListViewItemNode {
self.highlightedBackgroundNode = ASDisplayNode()
self.highlightedBackgroundNode.isLayerBacked = true
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.titleNode)
self.addSubnode(self.keyNode)
diff --git a/submodules/PeerInfoUI/Sources/PeerAutoremoveTimeoutItem.swift b/submodules/PeerInfoUI/Sources/PeerAutoremoveTimeoutItem.swift
index f45479be..b0a2827b 100644
--- a/submodules/PeerInfoUI/Sources/PeerAutoremoveTimeoutItem.swift
+++ b/submodules/PeerInfoUI/Sources/PeerAutoremoveTimeoutItem.swift
@@ -125,7 +125,7 @@ class PeerRemoveTimeoutItemNode: ListViewItemNode, ItemListItemNode {
return TextNode()
}
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.titleNodes.forEach(self.addSubnode)
diff --git a/submodules/PeerInfoUI/Sources/UserInfoEditingPhoneActionItem.swift b/submodules/PeerInfoUI/Sources/UserInfoEditingPhoneActionItem.swift
index 4fe64adb..ba292243 100644
--- a/submodules/PeerInfoUI/Sources/UserInfoEditingPhoneActionItem.swift
+++ b/submodules/PeerInfoUI/Sources/UserInfoEditingPhoneActionItem.swift
@@ -100,7 +100,7 @@ class UserInfoEditingPhoneActionItemNode: ListViewItemNode {
self.highlightedBackgroundNode = ASDisplayNode()
self.highlightedBackgroundNode.isLayerBacked = true
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.iconNode)
self.addSubnode(self.titleNode)
diff --git a/submodules/PeerInfoUI/Sources/UserInfoEditingPhoneItem.swift b/submodules/PeerInfoUI/Sources/UserInfoEditingPhoneItem.swift
index 409db1eb..c3ff6f4c 100644
--- a/submodules/PeerInfoUI/Sources/UserInfoEditingPhoneItem.swift
+++ b/submodules/PeerInfoUI/Sources/UserInfoEditingPhoneItem.swift
@@ -131,7 +131,7 @@ class UserInfoEditingPhoneItemNode: ItemListRevealOptionsItemNode, ItemListItemN
self.clearButton.displaysAsynchronously = false
self.clearButton.isHidden = true
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.addSubnode(self.editableControlNode)
self.addSubnode(self.labelNode)
diff --git a/submodules/PeersNearbyUI/Sources/PeersNearbyHeaderItem.swift b/submodules/PeersNearbyUI/Sources/PeersNearbyHeaderItem.swift
index 57f756bf..e1b70cb3 100644
--- a/submodules/PeersNearbyUI/Sources/PeersNearbyHeaderItem.swift
+++ b/submodules/PeersNearbyUI/Sources/PeersNearbyHeaderItem.swift
@@ -76,7 +76,7 @@ class PeersNearbyHeaderItemNode: ListViewItemNode {
self.animationNode = DefaultAnimatedStickerNodeImpl()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.titleNode)
self.addSubnode(self.animationNode)
diff --git a/submodules/Postbox/Sources/DeletedMessagesView.swift b/submodules/Postbox/Sources/DeletedMessagesView.swift
index 7f3b4eda..b1ab425f 100644
--- a/submodules/Postbox/Sources/DeletedMessagesView.swift
+++ b/submodules/Postbox/Sources/DeletedMessagesView.swift
@@ -15,7 +15,7 @@ final class MutableDeletedMessagesView: MutablePostboxView {
for operation in operations {
switch operation {
case let .Remove(indices):
- for (index, _) in indices {
+ for (index, _, _) in indices {
testMessageIds.append(index.id)
}
default:
diff --git a/submodules/Postbox/Sources/HistoryTagInfoView.swift b/submodules/Postbox/Sources/HistoryTagInfoView.swift
index 912b4a86..9b9e0adc 100644
--- a/submodules/Postbox/Sources/HistoryTagInfoView.swift
+++ b/submodules/Postbox/Sources/HistoryTagInfoView.swift
@@ -32,7 +32,7 @@ final class MutableHistoryTagInfoView: MutablePostboxView {
}
case let .Remove(indicesAndTags):
if self.currentIndex != nil {
- for (index, tags) in indicesAndTags {
+ for (index, tags, _) in indicesAndTags {
if tags.contains(self.tag) {
if index == self.currentIndex {
self.currentIndex = nil
diff --git a/submodules/Postbox/Sources/MessageHistoryOperation.swift b/submodules/Postbox/Sources/MessageHistoryOperation.swift
index 71e7e84d..c4537b58 100644
--- a/submodules/Postbox/Sources/MessageHistoryOperation.swift
+++ b/submodules/Postbox/Sources/MessageHistoryOperation.swift
@@ -2,7 +2,7 @@ import Foundation
enum MessageHistoryOperation {
case InsertMessage(IntermediateMessage)
- case Remove([(MessageIndex, MessageTags)])
+ case Remove([(MessageIndex, MessageTags, Int64?)])
case UpdateReadState(PeerId, CombinedPeerReadState)
case UpdateEmbeddedMedia(MessageIndex, ReadBuffer)
case UpdateTimestamp(MessageIndex, Int32)
diff --git a/submodules/Postbox/Sources/MessageHistoryTable.swift b/submodules/Postbox/Sources/MessageHistoryTable.swift
index 2d290a75..cd004d82 100644
--- a/submodules/Postbox/Sources/MessageHistoryTable.swift
+++ b/submodules/Postbox/Sources/MessageHistoryTable.swift
@@ -197,19 +197,19 @@ final class MessageHistoryTable: Table {
let buckets = self.continuousIndexIntervalsForRemoving(accumulatedRemoveIndices)
for bucket in buckets {
- var indicesWithMetadata: [(MessageIndex, MessageTags)] = []
+ var indicesWithMetadata: [(MessageIndex, MessageTags, Int64?)] = []
var globalIndicesWithMetadata: [(GlobalMessageTags, MessageIndex)] = []
for index in bucket {
let tagsAndGlobalTags = self.justRemove(index, unsentMessageOperations: &unsentMessageOperations, pendingActionsOperations: &pendingActionsOperations, updatedMessageActionsSummaries: &updatedMessageActionsSummaries, updatedMessageTagSummaries: &updatedMessageTagSummaries, invalidateMessageTagSummaries: &invalidateMessageTagSummaries, localTagsOperations: &localTagsOperations, timestampBasedMessageAttributesOperations: ×tampBasedMessageAttributesOperations)
- if let (tags, globalTags) = tagsAndGlobalTags {
- indicesWithMetadata.append((index, tags))
+ if let (tags, globalTags, threadId) = tagsAndGlobalTags {
+ indicesWithMetadata.append((index, tags, threadId))
if !globalTags.isEmpty {
globalIndicesWithMetadata.append((globalTags, index))
}
} else {
- indicesWithMetadata.append((index, MessageTags()))
+ indicesWithMetadata.append((index, MessageTags(), nil))
}
}
assert(bucket.count == indicesWithMetadata.count)
@@ -352,8 +352,8 @@ final class MessageHistoryTable: Table {
processIndexOperationsCommitAccumulatedRemoveIndices(peerId: peerId, accumulatedRemoveIndices: &accumulatedRemoveIndices, updatedCombinedState: &updatedCombinedState, invalidateReadState: &invalidateReadState, unsentMessageOperations: &unsentMessageOperations, outputOperations: &outputOperations, globalTagsOperations: &globalTagsOperations, pendingActionsOperations: &pendingActionsOperations, updatedMessageActionsSummaries: &updatedMessageActionsSummaries, updatedMessageTagSummaries: &updatedMessageTagSummaries, invalidateMessageTagSummaries: &invalidateMessageTagSummaries, localTagsOperations: &localTagsOperations, timestampBasedMessageAttributesOperations: ×tampBasedMessageAttributesOperations)
var updatedGroupInfos: [MessageId: MessageGroupInfo] = [:]
- if let (message, previousTags) = self.justUpdate(storeMessage.index, message: storeMessage, keepLocalTags: true, sharedKey: sharedKey, sharedBuffer: sharedBuffer, sharedEncoder: sharedEncoder, unsentMessageOperations: &unsentMessageOperations, updatedMessageTagSummaries: &updatedMessageTagSummaries, invalidateMessageTagSummaries: &invalidateMessageTagSummaries, updatedGroupInfos: &updatedGroupInfos, localTagsOperations: &localTagsOperations, timestampBasedMessageAttributesOperations: ×tampBasedMessageAttributesOperations, updatedMedia: &updatedMedia) {
- outputOperations.append(.Remove([(storeMessage.index, previousTags)]))
+ if let (message, previousTags, previousThreadId) = self.justUpdate(storeMessage.index, message: storeMessage, keepLocalTags: true, sharedKey: sharedKey, sharedBuffer: sharedBuffer, sharedEncoder: sharedEncoder, unsentMessageOperations: &unsentMessageOperations, updatedMessageTagSummaries: &updatedMessageTagSummaries, invalidateMessageTagSummaries: &invalidateMessageTagSummaries, updatedGroupInfos: &updatedGroupInfos, localTagsOperations: &localTagsOperations, timestampBasedMessageAttributesOperations: ×tampBasedMessageAttributesOperations, updatedMedia: &updatedMedia) {
+ outputOperations.append(.Remove([(storeMessage.index, previousTags, previousThreadId)]))
outputOperations.append(.InsertMessage(message))
if !updatedGroupInfos.isEmpty {
outputOperations.append(.UpdateGroupInfos(updatedGroupInfos))
@@ -367,8 +367,8 @@ final class MessageHistoryTable: Table {
processIndexOperationsCommitAccumulatedRemoveIndices(peerId: peerId, accumulatedRemoveIndices: &accumulatedRemoveIndices, updatedCombinedState: &updatedCombinedState, invalidateReadState: &invalidateReadState, unsentMessageOperations: &unsentMessageOperations, outputOperations: &outputOperations, globalTagsOperations: &globalTagsOperations, pendingActionsOperations: &pendingActionsOperations, updatedMessageActionsSummaries: &updatedMessageActionsSummaries, updatedMessageTagSummaries: &updatedMessageTagSummaries, invalidateMessageTagSummaries: &invalidateMessageTagSummaries, localTagsOperations: &localTagsOperations, timestampBasedMessageAttributesOperations: ×tampBasedMessageAttributesOperations)
var updatedGroupInfos: [MessageId: MessageGroupInfo] = [:]
- if let (message, previousTags) = self.justUpdate(index, message: storeMessage, keepLocalTags: false, sharedKey: sharedKey, sharedBuffer: sharedBuffer, sharedEncoder: sharedEncoder, unsentMessageOperations: &unsentMessageOperations, updatedMessageTagSummaries: &updatedMessageTagSummaries, invalidateMessageTagSummaries: &invalidateMessageTagSummaries, updatedGroupInfos: &updatedGroupInfos, localTagsOperations: &localTagsOperations, timestampBasedMessageAttributesOperations: ×tampBasedMessageAttributesOperations, updatedMedia: &updatedMedia) {
- outputOperations.append(.Remove([(index, previousTags)]))
+ if let (message, previousTags, previousThreadId) = self.justUpdate(index, message: storeMessage, keepLocalTags: false, sharedKey: sharedKey, sharedBuffer: sharedBuffer, sharedEncoder: sharedEncoder, unsentMessageOperations: &unsentMessageOperations, updatedMessageTagSummaries: &updatedMessageTagSummaries, invalidateMessageTagSummaries: &invalidateMessageTagSummaries, updatedGroupInfos: &updatedGroupInfos, localTagsOperations: &localTagsOperations, timestampBasedMessageAttributesOperations: ×tampBasedMessageAttributesOperations, updatedMedia: &updatedMedia) {
+ outputOperations.append(.Remove([(index, previousTags, previousThreadId)]))
outputOperations.append(.InsertMessage(message))
if !updatedGroupInfos.isEmpty {
outputOperations.append(.UpdateGroupInfos(updatedGroupInfos))
@@ -944,7 +944,7 @@ final class MessageHistoryTable: Table {
self.storeIntermediateMessage(updatedMessage, sharedKey: self.key(MessageIndex.absoluteLowerBound()))
let operations: [MessageHistoryOperation] = [
- .Remove([(index, message.tags)]),
+ .Remove([(index, message.tags, message.threadId)]),
.InsertMessage(updatedMessage)
]
if operationsByPeerId[message.id.peerId] == nil {
@@ -1352,7 +1352,7 @@ final class MessageHistoryTable: Table {
return result
}
- private func justRemove(_ index: MessageIndex, unsentMessageOperations: inout [IntermediateMessageHistoryUnsentOperation], pendingActionsOperations: inout [PendingMessageActionsOperation], updatedMessageActionsSummaries: inout [PendingMessageActionsSummaryKey: Int32], updatedMessageTagSummaries: inout [MessageHistoryTagsSummaryKey: MessageHistoryTagNamespaceSummary], invalidateMessageTagSummaries: inout [InvalidatedMessageHistoryTagsSummaryEntryOperation], localTagsOperations: inout [IntermediateMessageHistoryLocalTagsOperation], timestampBasedMessageAttributesOperations: inout [TimestampBasedMessageAttributesOperation]) -> (MessageTags, GlobalMessageTags)? {
+ private func justRemove(_ index: MessageIndex, unsentMessageOperations: inout [IntermediateMessageHistoryUnsentOperation], pendingActionsOperations: inout [PendingMessageActionsOperation], updatedMessageActionsSummaries: inout [PendingMessageActionsSummaryKey: Int32], updatedMessageTagSummaries: inout [MessageHistoryTagsSummaryKey: MessageHistoryTagNamespaceSummary], invalidateMessageTagSummaries: inout [InvalidatedMessageHistoryTagsSummaryEntryOperation], localTagsOperations: inout [IntermediateMessageHistoryLocalTagsOperation], timestampBasedMessageAttributesOperations: inout [TimestampBasedMessageAttributesOperation]) -> (MessageTags, GlobalMessageTags, Int64?)? {
let key = self.key(index)
if let value = self.valueBox.get(self.table, key: key) {
let resultTags: MessageTags
@@ -1440,7 +1440,7 @@ final class MessageHistoryTable: Table {
resultGlobalTags = message.globalTags
self.valueBox.remove(self.table, key: key, secure: true)
- return (resultTags, resultGlobalTags)
+ return (resultTags, resultGlobalTags, message.threadId)
} else {
return nil
}
@@ -1544,7 +1544,7 @@ final class MessageHistoryTable: Table {
})
}
- private func justUpdate(_ index: MessageIndex, message: InternalStoreMessage, keepLocalTags: Bool, sharedKey: ValueBoxKey, sharedBuffer: WriteBuffer, sharedEncoder: PostboxEncoder, unsentMessageOperations: inout [IntermediateMessageHistoryUnsentOperation], updatedMessageTagSummaries: inout [MessageHistoryTagsSummaryKey: MessageHistoryTagNamespaceSummary], invalidateMessageTagSummaries: inout [InvalidatedMessageHistoryTagsSummaryEntryOperation], updatedGroupInfos: inout [MessageId: MessageGroupInfo], localTagsOperations: inout [IntermediateMessageHistoryLocalTagsOperation], timestampBasedMessageAttributesOperations: inout [TimestampBasedMessageAttributesOperation], updatedMedia: inout [MediaId: Media?]) -> (IntermediateMessage, MessageTags)? {
+ private func justUpdate(_ index: MessageIndex, message: InternalStoreMessage, keepLocalTags: Bool, sharedKey: ValueBoxKey, sharedBuffer: WriteBuffer, sharedEncoder: PostboxEncoder, unsentMessageOperations: inout [IntermediateMessageHistoryUnsentOperation], updatedMessageTagSummaries: inout [MessageHistoryTagsSummaryKey: MessageHistoryTagNamespaceSummary], invalidateMessageTagSummaries: inout [InvalidatedMessageHistoryTagsSummaryEntryOperation], updatedGroupInfos: inout [MessageId: MessageGroupInfo], localTagsOperations: inout [IntermediateMessageHistoryLocalTagsOperation], timestampBasedMessageAttributesOperations: inout [TimestampBasedMessageAttributesOperation], updatedMedia: inout [MediaId: Media?]) -> (IntermediateMessage, MessageTags, Int64?)? {
if let previousMessage = self.getMessage(index) {
var mediaToUpdate: [Media] = []
@@ -2037,7 +2037,7 @@ final class MessageHistoryTable: Table {
self.valueBox.set(self.table, key: self.key(message.index, key: sharedKey), value: sharedBuffer)
- let result = (IntermediateMessage(stableId: stableId, stableVersion: stableVersion, id: message.id, globallyUniqueId: message.globallyUniqueId, groupingKey: message.groupingKey, groupInfo: groupInfo, threadId: message.threadId, timestamp: message.timestamp, flags: flags, tags: tags, globalTags: message.globalTags, localTags: updatedLocalTags, customTags: message.customTags, forwardInfo: intermediateForwardInfo, authorId: message.authorId, text: message.text, attributesData: attributesBuffer.makeReadBufferAndReset(), embeddedMediaData: embeddedMediaBuffer.makeReadBufferAndReset(), referencedMedia: referencedMedia), previousMessage.tags)
+ let result = (IntermediateMessage(stableId: stableId, stableVersion: stableVersion, id: message.id, globallyUniqueId: message.globallyUniqueId, groupingKey: message.groupingKey, groupInfo: groupInfo, threadId: message.threadId, timestamp: message.timestamp, flags: flags, tags: tags, globalTags: message.globalTags, localTags: updatedLocalTags, customTags: message.customTags, forwardInfo: intermediateForwardInfo, authorId: message.authorId, text: message.text, attributesData: attributesBuffer.makeReadBufferAndReset(), embeddedMediaData: embeddedMediaBuffer.makeReadBufferAndReset(), referencedMedia: referencedMedia), previousMessage.tags, previousMessage.threadId)
for media in mediaToUpdate {
if let id = media.id {
diff --git a/submodules/Postbox/Sources/MessageHistoryView.swift b/submodules/Postbox/Sources/MessageHistoryView.swift
index a8b000f9..eb259183 100644
--- a/submodules/Postbox/Sources/MessageHistoryView.swift
+++ b/submodules/Postbox/Sources/MessageHistoryView.swift
@@ -676,7 +676,7 @@ final class MutableMessageHistoryView: MutablePostboxView {
}
}
case let .Remove(indicesAndTags):
- for (index, _) in indicesAndTags {
+ for (index, _, _) in indicesAndTags {
if self.namespaces.contains(index.id.namespace) {
if loadedState.remove(index: index) {
hasChanges = true
@@ -821,7 +821,7 @@ final class MutableMessageHistoryView: MutablePostboxView {
}
case let .Remove(indices):
if !self.topTaggedMessages.isEmpty {
- for (index, _) in indices {
+ for (index, _, _) in indices {
if let maybeCurrentTopMessage = self.topTaggedMessages[index.id.namespace], let currentTopMessage = maybeCurrentTopMessage, index.id == currentTopMessage.id {
let item: MessageHistoryTopTaggedMessage? = nil
self.topTaggedMessages[index.id.namespace] = item
@@ -873,7 +873,7 @@ final class MutableMessageHistoryView: MutablePostboxView {
break findOperation
}
case let .Remove(indices):
- for (index, _) in indices {
+ for (index, _, _) in indices {
if currentIds.contains(index.id) {
updateMessage = true
break findOperation
@@ -956,7 +956,7 @@ final class MutableMessageHistoryView: MutablePostboxView {
break outer
}
case let .Remove(indicesWithTags):
- for (index, _) in indicesWithTags {
+ for (index, _, _) in indicesWithTags {
if cachedData.messageIds.contains(index.id) {
updatedCachedPeerDataMessages = true
break outer
diff --git a/submodules/Postbox/Sources/MessageView.swift b/submodules/Postbox/Sources/MessageView.swift
index 1ae3ed29..48312584 100644
--- a/submodules/Postbox/Sources/MessageView.swift
+++ b/submodules/Postbox/Sources/MessageView.swift
@@ -18,7 +18,7 @@ final class MutableMessageView {
case let .Remove(indices):
if let message = self.message {
let messageIndex = message.index
- for (index, _) in indices {
+ for (index, _, _) in indices {
if index == messageIndex {
self.message = nil
updated = true
diff --git a/submodules/Postbox/Sources/PeerChatTopIndexableMessageIds.swift b/submodules/Postbox/Sources/PeerChatTopIndexableMessageIds.swift
index ed898666..84e6c996 100644
--- a/submodules/Postbox/Sources/PeerChatTopIndexableMessageIds.swift
+++ b/submodules/Postbox/Sources/PeerChatTopIndexableMessageIds.swift
@@ -1,7 +1,7 @@
import Foundation
private struct PeerChatTopTaggedUpdateRecord: Equatable, Hashable {
- let peerId: PeerId
+ let peerAndThreadId: PeerAndThreadId
let namespace: MessageId.Namespace
}
@@ -10,71 +10,85 @@ final class PeerChatTopTaggedMessageIdsTable: Table {
return ValueBoxTable(id: id, keyType: .binary, compactValuesOnCreation: true)
}
- private var cachedTopIds: [PeerId: [MessageId.Namespace: MessageId?]] = [:]
+ private var cachedTopIds: [PeerAndThreadId: [MessageId.Namespace: MessageId?]] = [:]
private var updatedPeerIds = Set()
- private let sharedKey = ValueBoxKey(length: 8 + 4)
+ private let sharedKeyNoThreadId = ValueBoxKey(length: 8 + 4)
+ private let sharedKeyWithThreadId = ValueBoxKey(length: 8 + 4 + 8)
- private func key(peerId: PeerId, namespace: MessageId.Namespace) -> ValueBoxKey {
- self.sharedKey.setInt64(0, value: peerId.toInt64())
- self.sharedKey.setInt32(8, value: namespace)
- return self.sharedKey
+ private func key(combinedId: PeerAndThreadId, namespace: MessageId.Namespace) -> ValueBoxKey {
+ if let threadId = combinedId.threadId {
+ self.sharedKeyWithThreadId.setInt64(0, value: combinedId.peerId.toInt64())
+ self.sharedKeyWithThreadId.setInt32(8, value: namespace)
+ self.sharedKeyWithThreadId.setInt64(8 + 4, value: threadId)
+
+ return self.sharedKeyWithThreadId
+ } else {
+ self.sharedKeyNoThreadId.setInt64(0, value: combinedId.peerId.toInt64())
+ self.sharedKeyNoThreadId.setInt32(8, value: namespace)
+
+ return self.sharedKeyNoThreadId
+ }
}
- func get(peerId: PeerId, namespace: MessageId.Namespace) -> MessageId? {
- if let cachedDict = self.cachedTopIds[peerId] {
+ func get(peerId: PeerId, threadId: Int64?, namespace: MessageId.Namespace) -> MessageId? {
+ let combinedId = PeerAndThreadId(peerId: peerId, threadId: threadId)
+
+ if let cachedDict = self.cachedTopIds[combinedId] {
if let maybeCachedId = cachedDict[namespace] {
return maybeCachedId
} else {
- if let value = self.valueBox.get(self.table, key: self.key(peerId: peerId, namespace: namespace)) {
+ if let value = self.valueBox.get(self.table, key: self.key(combinedId: combinedId, namespace: namespace)) {
var messageIdId: Int32 = 0
value.read(&messageIdId, offset: 0, length: 4)
- self.cachedTopIds[peerId]![namespace] = MessageId(peerId: peerId, namespace: namespace, id: messageIdId)
+ self.cachedTopIds[combinedId]![namespace] = MessageId(peerId: peerId, namespace: namespace, id: messageIdId)
return MessageId(peerId: peerId, namespace: namespace, id: messageIdId)
} else {
let item: MessageId? = nil
- self.cachedTopIds[peerId]![namespace] = item
+ self.cachedTopIds[combinedId]![namespace] = item
return nil
}
}
} else {
- if let value = self.valueBox.get(self.table, key: self.key(peerId: peerId, namespace: namespace)) {
+ if let value = self.valueBox.get(self.table, key: self.key(combinedId: combinedId, namespace: namespace)) {
var messageIdId: Int32 = 0
value.read(&messageIdId, offset: 0, length: 4)
- self.cachedTopIds[peerId] = [namespace: MessageId(peerId: peerId, namespace: namespace, id: messageIdId)]
+ self.cachedTopIds[combinedId] = [namespace: MessageId(peerId: peerId, namespace: namespace, id: messageIdId)]
return MessageId(peerId: peerId, namespace: namespace, id: messageIdId)
} else {
let item: MessageId? = nil
- self.cachedTopIds[peerId] = [namespace: item]
+ self.cachedTopIds[combinedId] = [namespace: item]
return nil
}
}
}
- private func set(peerId: PeerId, namespace: MessageId.Namespace, id: MessageId?) {
- if let _ = self.cachedTopIds[peerId] {
- self.cachedTopIds[peerId]![namespace] = id
+ private func set(peerId: PeerId, threadId: Int64?, namespace: MessageId.Namespace, id: MessageId?) {
+ let combinedId = PeerAndThreadId(peerId: peerId, threadId: threadId)
+
+ if let _ = self.cachedTopIds[combinedId] {
+ self.cachedTopIds[combinedId]![namespace] = id
} else {
- self.cachedTopIds[peerId] = [namespace: id]
+ self.cachedTopIds[combinedId] = [namespace: id]
}
- self.updatedPeerIds.insert(PeerChatTopTaggedUpdateRecord(peerId: peerId, namespace: namespace))
+ self.updatedPeerIds.insert(PeerChatTopTaggedUpdateRecord(peerAndThreadId: combinedId, namespace: namespace))
}
- func replay(historyOperationsByPeerId: [PeerId : [MessageHistoryOperation]]) {
+ func replay(historyOperationsByPeerId: [PeerId: [MessageHistoryOperation]]) {
for (_, operations) in historyOperationsByPeerId {
for operation in operations {
switch operation {
case let .InsertMessage(message):
if message.flags.contains(.TopIndexable) {
- let currentTopMessageId = self.get(peerId: message.id.peerId, namespace: message.id.namespace)
+ let currentTopMessageId = self.get(peerId: message.id.peerId, threadId: message.threadId, namespace: message.id.namespace)
if currentTopMessageId == nil || currentTopMessageId! < message.id {
- self.set(peerId: message.id.peerId, namespace: message.id.namespace, id: message.id)
+ self.set(peerId: message.id.peerId, threadId: message.threadId, namespace: message.id.namespace, id: message.id)
}
}
case let .Remove(indices):
- for (index, _) in indices {
- if let messageId = self.get(peerId: index.id.peerId, namespace: index.id.namespace), index.id == messageId {
- self.set(peerId: index.id.peerId, namespace: index.id.namespace, id: nil)
+ for (index, _, threadId) in indices {
+ if let messageId = self.get(peerId: index.id.peerId, threadId: threadId, namespace: index.id.namespace), index.id == messageId {
+ self.set(peerId: index.id.peerId, threadId: threadId, namespace: index.id.namespace, id: nil)
}
}
default:
@@ -92,12 +106,12 @@ final class PeerChatTopTaggedMessageIdsTable: Table {
override func beforeCommit() {
if !self.updatedPeerIds.isEmpty {
for record in self.updatedPeerIds {
- if let cachedDict = self.cachedTopIds[record.peerId], let maybeMessageId = cachedDict[record.namespace] {
+ if let cachedDict = self.cachedTopIds[record.peerAndThreadId], let maybeMessageId = cachedDict[record.namespace] {
if let maybeMessageId = maybeMessageId {
var messageIdId: Int32 = maybeMessageId.id
- self.valueBox.set(self.table, key: self.key(peerId: record.peerId, namespace: record.namespace), value: MemoryBuffer(memory: &messageIdId, capacity: 4, length: 4, freeWhenDone: false))
+ self.valueBox.set(self.table, key: self.key(combinedId: record.peerAndThreadId, namespace: record.namespace), value: MemoryBuffer(memory: &messageIdId, capacity: 4, length: 4, freeWhenDone: false))
} else {
- self.valueBox.remove(self.table, key: self.key(peerId: record.peerId, namespace: record.namespace), secure: false)
+ self.valueBox.remove(self.table, key: self.key(combinedId: record.peerAndThreadId, namespace: record.namespace), secure: false)
}
}
}
diff --git a/submodules/Postbox/Sources/PeerView.swift b/submodules/Postbox/Sources/PeerView.swift
index f7ff4c11..d0fa0b4f 100644
--- a/submodules/Postbox/Sources/PeerView.swift
+++ b/submodules/Postbox/Sources/PeerView.swift
@@ -247,7 +247,7 @@ final class MutablePeerView: MutablePostboxView {
break outer
}
case let .Remove(indicesWithTags):
- for (index, _) in indicesWithTags {
+ for (index, _, _) in indicesWithTags {
if cachedData.messageIds.contains(index.id) {
updateMessages = true
break outer
diff --git a/submodules/Postbox/Sources/Postbox.swift b/submodules/Postbox/Sources/Postbox.swift
index 7f8e92ac..396fe12a 100644
--- a/submodules/Postbox/Sources/Postbox.swift
+++ b/submodules/Postbox/Sources/Postbox.swift
@@ -3494,20 +3494,20 @@ final class PostboxImpl {
useRootInterfaceStateForThread: Bool
) -> Disposable {
var topTaggedMessages: [MessageId.Namespace: MessageHistoryTopTaggedMessage?] = [:]
- var mainPeerIdForTopTaggedMessages: PeerId?
- switch peerIds {
+ var mainPeerIdForTopTaggedMessages: (peerId: PeerId, threadId: Int64?)?
+ if tag == nil {
+ switch peerIds {
case let .single(id, threadId):
- if threadId == nil {
- mainPeerIdForTopTaggedMessages = id
- }
+ mainPeerIdForTopTaggedMessages = (id, threadId)
case let .associated(id, _):
- mainPeerIdForTopTaggedMessages = id
+ mainPeerIdForTopTaggedMessages = (id, nil)
case .external:
mainPeerIdForTopTaggedMessages = nil
+ }
}
if let peerId = mainPeerIdForTopTaggedMessages {
for namespace in topTaggedMessageIdNamespaces {
- if let messageId = self.peerChatTopTaggedMessageIdsTable.get(peerId: peerId, namespace: namespace) {
+ if let messageId = self.peerChatTopTaggedMessageIdsTable.get(peerId: peerId.peerId, threadId: peerId.threadId, namespace: namespace) {
if let index = self.messageHistoryIndexTable.getIndex(messageId) {
if let message = self.messageHistoryTable.getMessage(index) {
topTaggedMessages[namespace] = MessageHistoryTopTaggedMessage.intermediate(message)
diff --git a/submodules/PremiumUI/BUILD b/submodules/PremiumUI/BUILD
index ac8046b6..f2a16847 100644
--- a/submodules/PremiumUI/BUILD
+++ b/submodules/PremiumUI/BUILD
@@ -123,6 +123,9 @@ swift_library(
"//submodules/TelegramUI/Components/Premium/PremiumCoinComponent",
"//submodules/TelegramUI/Components/GlassBarButtonComponent",
"//submodules/TelegramUI/Components/EdgeEffect",
+ "//submodules/TelegramUI/Components/Gifts/TableComponent",
+ "//submodules/TelegramUI/Components/Gifts/PeerTableCellComponent",
+ "//submodules/TelegramUI/Components/AlertComponent",
],
visibility = [
"//visibility:public",
diff --git a/submodules/PremiumUI/Sources/CreateGiveawayController.swift b/submodules/PremiumUI/Sources/CreateGiveawayController.swift
index 52330915..810c269d 100644
--- a/submodules/PremiumUI/Sources/CreateGiveawayController.swift
+++ b/submodules/PremiumUI/Sources/CreateGiveawayController.swift
@@ -493,7 +493,7 @@ private enum CreateGiveawayEntry: ItemListNodeEntry {
}
})
case let .starsMore(theme, title):
- return ItemListPeerActionItem(presentationData: presentationData, icon: PresentationResourcesItemList.downArrowImage(theme), title: title, sectionId: self.section, editing: false, action: {
+ return ItemListPeerActionItem(presentationData: presentationData, systemStyle: .glass, icon: PresentationResourcesItemList.downArrowImage(theme), title: title, sectionId: self.section, editing: false, action: {
arguments.expandStars()
})
case let .starsInfo(_, text):
@@ -521,14 +521,14 @@ private enum CreateGiveawayEntry: ItemListNodeEntry {
if case let .channel(channel) = peer, case .group = channel.info {
isGroup = true
}
- return ItemListPeerItem(presentationData: presentationData, dateTimeFormat: PresentationDateTimeFormat(), nameDisplayOrder: presentationData.nameDisplayOrder, context: arguments.context, peer: peer, presence: nil, text: boosts.flatMap { .text(isGroup ? presentationData.strings.BoostGift_GroupBoosts($0) : presentationData.strings.BoostGift_ChannelsBoosts($0), .secondary) } ?? .none, label: .none, editing: ItemListPeerItemEditing(editable: boosts == nil, editing: false, revealed: isRevealed), switchValue: nil, enabled: true, selectable: peer.id != arguments.context.account.peerId, sectionId: self.section, action: {
+ return ItemListPeerItem(presentationData: presentationData, systemStyle: .glass, dateTimeFormat: PresentationDateTimeFormat(), nameDisplayOrder: presentationData.nameDisplayOrder, context: arguments.context, peer: peer, presence: nil, text: boosts.flatMap { .text(isGroup ? presentationData.strings.BoostGift_GroupBoosts($0) : presentationData.strings.BoostGift_ChannelsBoosts($0), .secondary) } ?? .none, label: .none, editing: ItemListPeerItemEditing(editable: boosts == nil, editing: false, revealed: isRevealed), switchValue: nil, enabled: true, selectable: peer.id != arguments.context.account.peerId, sectionId: self.section, action: {
}, setPeerIdWithRevealedOptions: { lhs, rhs in
arguments.setItemIdWithRevealedOptions(lhs, rhs)
}, removePeer: { id in
arguments.removeChannel(id)
})
case let .channelAdd(theme, text):
- return ItemListPeerActionItem(presentationData: presentationData, icon: PresentationResourcesItemList.roundPlusIconImage(theme), title: text, alwaysPlain: false, hasSeparator: true, sectionId: self.section, height: .compactPeerList, color: .accent, editing: false, action: {
+ return ItemListPeerActionItem(presentationData: presentationData, systemStyle: .glass, icon: PresentationResourcesItemList.roundPlusIconImage(theme), title: text, alwaysPlain: false, hasSeparator: true, sectionId: self.section, height: .compactPeerList, color: .accent, editing: false, action: {
arguments.openChannelsSelection()
})
case let .channelsInfo(_, text):
@@ -582,7 +582,7 @@ private enum CreateGiveawayEntry: ItemListNodeEntry {
arguments.openPremiumIntro()
})
case let .prizeDescription(_, text, value):
- return ItemListSwitchItem(presentationData: presentationData, title: text, value: value, sectionId: self.section, style: .blocks, updated: { value in
+ return ItemListSwitchItem(presentationData: presentationData, systemStyle: .glass, title: text, value: value, sectionId: self.section, style: .blocks, updated: { value in
arguments.updateState { state in
var updatedState = state
updatedState.showPrizeDescription = value
@@ -590,7 +590,7 @@ private enum CreateGiveawayEntry: ItemListNodeEntry {
}
})
case let .prizeDescriptionText(_, placeholder, value, count):
- return ItemListSingleLineInputItem(presentationData: presentationData, title: NSAttributedString(string: "\(count)"), text: value, placeholder: placeholder, returnKeyType: .done, spacing: 24.0, maxLength: 128, tag: CreateGiveawayEntryTag.description, sectionId: self.section, textUpdated: { value in
+ return ItemListSingleLineInputItem(presentationData: presentationData, systemStyle: .glass, title: NSAttributedString(string: "\(count)"), text: value, placeholder: placeholder, returnKeyType: .done, spacing: 24.0, maxLength: 128, tag: CreateGiveawayEntryTag.description, sectionId: self.section, textUpdated: { value in
arguments.updateState { state in
var updatedState = state
updatedState.prizeDescription = value
@@ -616,7 +616,7 @@ private enum CreateGiveawayEntry: ItemListNodeEntry {
} else {
text = presentationData.strings.InviteLink_Create_TimeLimitExpiryDateNever
}
- return ItemListDisclosureItem(presentationData: presentationData, title: presentationData.strings.BoostGift_DateEnds, label: text, labelStyle: active ? .coloredText(theme.list.itemAccentColor) : .text, sectionId: self.section, style: .blocks, disclosureStyle: .none, action: {
+ return ItemListDisclosureItem(presentationData: presentationData, systemStyle: .glass, title: presentationData.strings.BoostGift_DateEnds, label: text, labelStyle: active ? .coloredText(theme.list.itemAccentColor) : .text, sectionId: self.section, style: .blocks, disclosureStyle: .none, action: {
arguments.dismissInput()
var focus = false
arguments.updateState { state in
@@ -677,7 +677,7 @@ private enum CreateGiveawayEntry: ItemListNodeEntry {
case let .timeInfo(_, text):
return ItemListTextItem(presentationData: presentationData, text: .plain(text), sectionId: self.section)
case let .winners(_, text, value):
- return ItemListSwitchItem(presentationData: presentationData, title: text, value: value, sectionId: self.section, style: .blocks, updated: { value in
+ return ItemListSwitchItem(presentationData: presentationData, systemStyle: .glass, title: text, value: value, sectionId: self.section, style: .blocks, updated: { value in
arguments.updateState { state in
var updatedState = state
updatedState.showWinners = value
diff --git a/submodules/PremiumUI/Sources/GiftOptionItem.swift b/submodules/PremiumUI/Sources/GiftOptionItem.swift
index 12166ff4..eac888a1 100644
--- a/submodules/PremiumUI/Sources/GiftOptionItem.swift
+++ b/submodules/PremiumUI/Sources/GiftOptionItem.swift
@@ -212,7 +212,7 @@ class GiftOptionItemNode: ItemListRevealOptionsItemNode {
self.activateArea = AccessibilityAreaNode()
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.addSubnode(self.containerNode)
diff --git a/submodules/PremiumUI/Sources/GiveawayInfoController.swift b/submodules/PremiumUI/Sources/GiveawayInfoController.swift
index b50ada30..2db71bc9 100644
--- a/submodules/PremiumUI/Sources/GiveawayInfoController.swift
+++ b/submodules/PremiumUI/Sources/GiveawayInfoController.swift
@@ -7,8 +7,8 @@ import TelegramCore
import AccountContext
import TelegramStringFormatting
import TelegramPresentationData
-import Markdown
-import AlertUI
+import ComponentFlow
+import AlertComponent
public func presentGiveawayInfoController(
context: AccountContext,
@@ -23,6 +23,8 @@ public func presentGiveawayInfoController(
peerIds.append(adminId)
}
+ let presentationData = context.sharedContext.currentPresentationData.with { $0 }
+
let _ = (context.engine.data.get(
TelegramEngine.EngineData.Item.Messages.Message(id: messageId),
EngineDataMap(peerIds.map(TelegramEngine.EngineData.Item.Peer.Peer.init))
@@ -121,22 +123,16 @@ public func presentGiveawayInfoController(
channelsCount = 1 + giveawayResults.additionalChannelsCount
}
- let presentationData = context.sharedContext.currentPresentationData.with { $0 }
-
-
-
let timeZone = TimeZone.current
let untilDate = stringForDate(timestamp: untilDateValue, timeZone: timeZone, strings: presentationData.strings)
let title: String
- let text: String
+ var text: String
var warning: String?
-
- var dismissImpl: (() -> Void)?
-
- var actions: [TextAlertAction] = [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {
- dismissImpl?()
- })]
+
+ var actions: [AlertScreen.Action] = [
+ .init(title: presentationData.strings.Common_OK, type: .default)
+ ]
var additionalPrizes = ""
if let prizeDescription, !prizeDescription.isEmpty {
@@ -322,278 +318,65 @@ public func presentGiveawayInfoController(
case .refunded:
result = ""
warning = presentationData.strings.Chat_Giveaway_Info_Refunded
- actions = [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_Close, action: {
- dismissImpl?()
- })]
case .notWon:
result = "**\(presentationData.strings.Chat_Giveaway_Info_DidntWin)**\n\n"
case let .wonPremium(slug):
result = "**\(presentationData.strings.Chat_Giveaway_Info_Won("").string)**\n\n"
- actions = [TextAlertAction(type: .defaultAction, title: presentationData.strings.Chat_Giveaway_Info_ViewPrize, action: {
- dismissImpl?()
- openLink(slug)
- }), TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {
- dismissImpl?()
- })]
+ actions = [
+ .init(title: presentationData.strings.Chat_Giveaway_Info_ViewPrize, type: .default, action: {
+ openLink(slug)
+ }),
+ .init(title: presentationData.strings.Common_Cancel)
+ ]
case let .wonStars(stars):
let _ = stars
result = "**\(presentationData.strings.Chat_Giveaway_Info_Won("").string)**\n\n"
- actions = [TextAlertAction(type: .defaultAction, title: presentationData.strings.Chat_Giveaway_Info_ViewPrize, action: {
- dismissImpl?()
- openLink("")
- }), TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {
- dismissImpl?()
- })]
+ actions = [
+ .init(title: presentationData.strings.Chat_Giveaway_Info_ViewPrize, type: .default, action: {
+ openLink("")
+ }),
+ .init(title: presentationData.strings.Common_Cancel)
+ ]
}
text = "\(result)\(intro)\(additionalPrizes)\n\n\(ending)"
}
- let alertController = giveawayInfoAlertController(
- context: context,
- updatedPresentationData: updatedPresentationData,
- title: title,
- text: text,
- warning: warning,
- actions: actions
- )
- dismissImpl = { [weak alertController] in
- alertController?.dismissAnimated()
+ var content: [AnyComponentWithIdentity] = []
+ content.append(AnyComponentWithIdentity(
+ id: "title",
+ component: AnyComponent(
+ AlertTitleComponent(title: title)
+ )
+ ))
+ content.append(AnyComponentWithIdentity(
+ id: "text",
+ component: AnyComponent(
+ AlertTextComponent(content: .plain(text))
+ )
+ ))
+ if let warning {
+ content.append(AnyComponentWithIdentity(
+ id: "warning",
+ component: AnyComponent(
+ AlertTextComponent(content: .plain(warning), color: .destructive, style: .background(.bold))
+ )
+ ))
}
+
+ var effectiveUpdatedPresentationData: (PresentationData, Signal)
+ if let updatedPresentationData {
+ effectiveUpdatedPresentationData = updatedPresentationData
+ } else {
+ effectiveUpdatedPresentationData = (presentationData, context.sharedContext.presentationData)
+ }
+
+ let alertController = AlertScreen(
+ configuration: AlertScreen.Configuration(actionAlignment: .vertical),
+ content: content,
+ actions: actions,
+ updatedPresentationData: effectiveUpdatedPresentationData
+ )
present(alertController)
})
}
-
-private final class GiveawayInfoAlertContentNode: AlertContentNode {
- private let title: String
- private let text: String
- private let warning: String?
-
- private let titleNode: ASTextNode
- private let textNode: ASTextNode
- fileprivate let warningBackgroundNode: ASImageNode
- fileprivate let warningTextNode: ImmediateTextNode
-
- private let actionNodesSeparator: ASDisplayNode
- private let actionNodes: [TextAlertContentActionNode]
- private let actionVerticalSeparators: [ASDisplayNode]
-
- private var validLayout: CGSize?
-
- public var theme: PresentationTheme
-
- public override var dismissOnOutsideTap: Bool {
- return self.isUserInteractionEnabled
- }
-
- public init(theme: AlertControllerTheme, ptheme: PresentationTheme, title: String, text: String, warning: String?, actions: [TextAlertAction]) {
- self.theme = ptheme
- self.title = title
- self.text = text
- self.warning = warning
-
- self.titleNode = ASTextNode()
- self.titleNode.maximumNumberOfLines = 0
- self.textNode = ASTextNode()
- self.textNode.maximumNumberOfLines = 0
-
- self.warningBackgroundNode = ASImageNode()
- self.warningBackgroundNode.displaysAsynchronously = false
-
- self.warningTextNode = ImmediateTextNode()
- self.warningTextNode.maximumNumberOfLines = 0
- self.warningTextNode.lineSpacing = 0.1
-
- self.actionNodesSeparator = ASDisplayNode()
- self.actionNodesSeparator.isLayerBacked = true
-
- self.actionNodes = actions.map { action -> TextAlertContentActionNode in
- return TextAlertContentActionNode(theme: theme, action: action)
- }
-
- var actionVerticalSeparators: [ASDisplayNode] = []
- if actions.count > 1 {
- for _ in 0 ..< actions.count - 1 {
- let separatorNode = ASDisplayNode()
- separatorNode.isLayerBacked = true
- actionVerticalSeparators.append(separatorNode)
- }
- }
- self.actionVerticalSeparators = actionVerticalSeparators
-
- super.init()
-
- self.addSubnode(self.titleNode)
- self.addSubnode(self.textNode)
-
- self.addSubnode(self.warningBackgroundNode)
- self.addSubnode(self.warningTextNode)
-
- self.addSubnode(self.actionNodesSeparator)
-
- for actionNode in self.actionNodes {
- self.addSubnode(actionNode)
- }
-
- for separatorNode in self.actionVerticalSeparators {
- self.addSubnode(separatorNode)
- }
-
- self.updateTheme(theme)
- }
-
- public override func updateTheme(_ theme: AlertControllerTheme) {
- self.titleNode.attributedText = NSAttributedString(string: self.title, font: Font.bold(17.0), textColor: theme.primaryColor, paragraphAlignment: .center)
-
- let body = MarkdownAttributeSet(font: Font.regular(13.0), textColor: theme.primaryColor)
- let bold = MarkdownAttributeSet(font: Font.semibold(13.0), textColor: theme.primaryColor)
- let attributedText = parseMarkdownIntoAttributedString(self.text, attributes: MarkdownAttributes(body: body, bold: bold, link: body, linkAttribute: { _ in return nil }), textAlignment: .center)
-
- self.textNode.attributedText = attributedText
-
- self.warningTextNode.attributedText = NSAttributedString(string: self.warning ?? "", font: Font.semibold(13.0), textColor: theme.destructiveColor, paragraphAlignment: .center)
- self.warningBackgroundNode.image = generateStretchableFilledCircleImage(radius: 5.0, color: theme.destructiveColor.withAlphaComponent(0.1))
-
- self.actionNodesSeparator.backgroundColor = theme.separatorColor
- for actionNode in self.actionNodes {
- actionNode.updateTheme(theme)
- }
- for separatorNode in self.actionVerticalSeparators {
- separatorNode.backgroundColor = theme.separatorColor
- }
-
- if let size = self.validLayout {
- _ = self.updateLayout(size: size, transition: .immediate)
- }
- }
-
- public override func updateLayout(size: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
- var size = size
- size.width = min(size.width, 270.0)
- let measureSize = CGSize(width: size.width - 16.0 * 2.0, height: CGFloat.greatestFiniteMagnitude)
-
- self.validLayout = size
-
- var origin: CGPoint = CGPoint(x: 0.0, y: 20.0)
-
- let titleSize = self.titleNode.measure(measureSize)
- transition.updateFrame(node: self.titleNode, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - titleSize.width) / 2.0), y: origin.y), size: titleSize))
- origin.y += titleSize.height + 4.0
-
- let textSize = self.textNode.measure(measureSize)
- transition.updateFrame(node: self.textNode, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - textSize.width) / 2.0), y: origin.y), size: textSize))
- origin.y += textSize.height + 6.0
-
- let actionButtonHeight: CGFloat = 44.0
- var minActionsWidth: CGFloat = 0.0
- let maxActionWidth: CGFloat = floor(size.width / CGFloat(self.actionNodes.count))
- let actionTitleInsets: CGFloat = 8.0
-
- var effectiveActionLayout = TextAlertContentActionLayout.horizontal
- for actionNode in self.actionNodes {
- let actionTitleSize = actionNode.titleNode.updateLayout(CGSize(width: maxActionWidth, height: actionButtonHeight))
- if case .horizontal = effectiveActionLayout, actionTitleSize.height > actionButtonHeight * 0.6667 {
- effectiveActionLayout = .vertical
- }
- switch effectiveActionLayout {
- case .horizontal:
- minActionsWidth += actionTitleSize.width + actionTitleInsets
- case .vertical:
- minActionsWidth = max(minActionsWidth, actionTitleSize.width + actionTitleInsets)
- }
- }
- if "".isEmpty {
- effectiveActionLayout = .vertical
- }
- let insets = UIEdgeInsets(top: 18.0, left: 18.0, bottom: 18.0, right: 18.0)
-
- var contentWidth = max(titleSize.width, minActionsWidth)
- contentWidth = max(contentWidth, 234.0)
-
- var actionsHeight: CGFloat = 0.0
- switch effectiveActionLayout {
- case .horizontal:
- actionsHeight = actionButtonHeight
- case .vertical:
- actionsHeight = actionButtonHeight * CGFloat(self.actionNodes.count)
- }
-
- let resultWidth = contentWidth + insets.left + insets.right
-
- var warningHeight: CGFloat = 0.0
- if let _ = self.warning {
- let warningSize = self.warningTextNode.updateLayout(measureSize)
- let warningFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - warningSize.width) / 2.0), y: origin.y + 20.0), size: warningSize)
- transition.updateFrame(node: self.warningTextNode, frame: warningFrame)
-
- transition.updateFrame(node: self.warningBackgroundNode, frame: warningFrame.insetBy(dx: -8.0, dy: -8.0))
-
- warningHeight += warningSize.height + 26.0
- }
-
- let resultSize = CGSize(width: resultWidth, height: titleSize.height + textSize.height + 8.0 + actionsHeight + warningHeight + insets.top + insets.bottom)
-
- transition.updateFrame(node: self.actionNodesSeparator, frame: CGRect(origin: CGPoint(x: 0.0, y: resultSize.height - actionsHeight - UIScreenPixel), size: CGSize(width: resultSize.width, height: UIScreenPixel)))
-
- var actionOffset: CGFloat = 0.0
- let actionWidth: CGFloat = floor(resultSize.width / CGFloat(self.actionNodes.count))
- var separatorIndex = -1
- var nodeIndex = 0
- for actionNode in self.actionNodes {
- if separatorIndex >= 0 {
- let separatorNode = self.actionVerticalSeparators[separatorIndex]
- switch effectiveActionLayout {
- case .horizontal:
- transition.updateFrame(node: separatorNode, frame: CGRect(origin: CGPoint(x: actionOffset - UIScreenPixel, y: resultSize.height - actionsHeight), size: CGSize(width: UIScreenPixel, height: actionsHeight - UIScreenPixel)))
- case .vertical:
- transition.updateFrame(node: separatorNode, frame: CGRect(origin: CGPoint(x: 0.0, y: resultSize.height - actionsHeight + actionOffset - UIScreenPixel), size: CGSize(width: resultSize.width, height: UIScreenPixel)))
- }
- }
- separatorIndex += 1
-
- let currentActionWidth: CGFloat
- switch effectiveActionLayout {
- case .horizontal:
- if nodeIndex == self.actionNodes.count - 1 {
- currentActionWidth = resultSize.width - actionOffset
- } else {
- currentActionWidth = actionWidth
- }
- case .vertical:
- currentActionWidth = resultSize.width
- }
-
- let actionNodeFrame: CGRect
- switch effectiveActionLayout {
- case .horizontal:
- actionNodeFrame = CGRect(origin: CGPoint(x: actionOffset, y: resultSize.height - actionsHeight), size: CGSize(width: currentActionWidth, height: actionButtonHeight))
- actionOffset += currentActionWidth
- case .vertical:
- actionNodeFrame = CGRect(origin: CGPoint(x: 0.0, y: resultSize.height - actionsHeight + actionOffset), size: CGSize(width: currentActionWidth, height: actionButtonHeight))
- actionOffset += actionButtonHeight
- }
-
- transition.updateFrame(node: actionNode, frame: actionNodeFrame)
-
- nodeIndex += 1
- }
-
- return resultSize
- }
-}
-
-private func giveawayInfoAlertController(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal)? = nil, title: String, text: String, warning: String?, actions: [TextAlertAction]) -> AlertController {
- let presentationData = updatedPresentationData?.initial ?? context.sharedContext.currentPresentationData.with { $0 }
-
- let contentNode = GiveawayInfoAlertContentNode(theme: AlertControllerTheme(presentationData: presentationData), ptheme: presentationData.theme, title: title, text: text, warning: warning, actions: actions)
-
- let controller = AlertController(theme: AlertControllerTheme(presentationData: presentationData), contentNode: contentNode)
- let presentationDataDisposable = (updatedPresentationData?.signal ?? context.sharedContext.presentationData).start(next: { [weak controller] presentationData in
- controller?.theme = AlertControllerTheme(presentationData: presentationData)
- })
- controller.dismissed = { _ in
- presentationDataDisposable.dispose()
- }
-
- return controller
-}
diff --git a/submodules/PremiumUI/Sources/IncreaseLimitHeaderItem.swift b/submodules/PremiumUI/Sources/IncreaseLimitHeaderItem.swift
index f203973b..14600adf 100644
--- a/submodules/PremiumUI/Sources/IncreaseLimitHeaderItem.swift
+++ b/submodules/PremiumUI/Sources/IncreaseLimitHeaderItem.swift
@@ -99,7 +99,7 @@ class IncreaseLimitHeaderItemNode: ListViewItemNode {
self.textNode.contentMode = .left
self.textNode.contentsScale = UIScreen.main.scale
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.titleNode)
self.addSubnode(self.textNode)
diff --git a/submodules/PremiumUI/Sources/PremiumDemoScreen.swift b/submodules/PremiumUI/Sources/PremiumDemoScreen.swift
index e531a8b1..2decd5b6 100644
--- a/submodules/PremiumUI/Sources/PremiumDemoScreen.swift
+++ b/submodules/PremiumUI/Sources/PremiumDemoScreen.swift
@@ -1133,7 +1133,7 @@ private final class DemoSheetContent: CombinedComponent {
let closeButton = closeButton.update(
component: GlassBarButtonComponent(
- size: CGSize(width: 40.0, height: 40.0),
+ size: CGSize(width: 44.0, height: 44.0),
backgroundColor: UIColor(rgb: 0x7f76f4),
isDark: false,
state: .tintedGlass,
@@ -1147,7 +1147,7 @@ private final class DemoSheetContent: CombinedComponent {
component.dismiss()
}
),
- availableSize: CGSize(width: 40.0, height: 40.0),
+ availableSize: CGSize(width: 44.0, height: 44.0),
transition: .immediate
)
context.add(closeButton
diff --git a/submodules/PremiumUI/Sources/PremiumGiftCodeScreen.swift b/submodules/PremiumUI/Sources/PremiumGiftCodeScreen.swift
index be059544..a17a1396 100644
--- a/submodules/PremiumUI/Sources/PremiumGiftCodeScreen.swift
+++ b/submodules/PremiumUI/Sources/PremiumGiftCodeScreen.swift
@@ -23,6 +23,8 @@ import InvisibleInkDustNode
import PremiumStarComponent
import GlassBarButtonComponent
import ButtonComponent
+import TableComponent
+import PeerTableCellComponent
private final class PremiumGiftCodeSheetContent: CombinedComponent {
typealias EnvironmentType = ViewControllerComponentContainer.Environment
@@ -163,7 +165,7 @@ private final class PremiumGiftCodeSheetContent: CombinedComponent {
component: AnyComponentWithIdentity(id: "close", component: AnyComponent(
BundleIconComponent(
name: "Navigation/Close",
- tintColor: theme.rootController.navigationBar.glassBarButtonForegroundColor
+ tintColor: theme.chat.inputPanel.panelControlColor
)
)),
action: { _ in
@@ -326,7 +328,7 @@ private final class PremiumGiftCodeSheetContent: CombinedComponent {
title: strings.GiftLink_From,
component: AnyComponent(
Button(
- content: AnyComponent(PeerCellComponent(context: context.component.context, textColor: tableLinkColor, peer: fromPeer)),
+ content: AnyComponent(PeerTableCellComponent(context: context.component.context, theme: theme, strings: strings, peer: fromPeer)),
action: {
if let peer = fromPeer, peer.id != accountContext.account.peerId {
component.openPeer(peer)
@@ -344,7 +346,7 @@ private final class PremiumGiftCodeSheetContent: CombinedComponent {
title: strings.GiftLink_To,
component: AnyComponent(
Button(
- content: AnyComponent(PeerCellComponent(context: context.component.context, textColor: tableLinkColor, peer: toPeer)),
+ content: AnyComponent(PeerTableCellComponent(context: context.component.context, theme: theme, strings: strings, peer: toPeer)),
action: {
if toPeer.id != accountContext.account.peerId {
component.openPeer(toPeer)
@@ -857,306 +859,6 @@ final class GiftLinkButtonContentComponent: CombinedComponent {
}
}
-private final class TableComponent: CombinedComponent {
- class Item: Equatable {
- public let id: AnyHashable
- public let title: String
- public let component: AnyComponent
-
- public init(id: IdType, title: String, component: AnyComponent) {
- self.id = AnyHashable(id)
- self.title = title
- self.component = component
- }
-
- public static func == (lhs: Item, rhs: Item) -> Bool {
- if lhs.id != rhs.id {
- return false
- }
- if lhs.title != rhs.title {
- return false
- }
- if lhs.component != rhs.component {
- return false
- }
- return true
- }
- }
-
- private let theme: PresentationTheme
- private let items: [Item]
-
- public init(theme: PresentationTheme, items: [Item]) {
- self.theme = theme
- self.items = items
- }
-
- public static func ==(lhs: TableComponent, rhs: TableComponent) -> Bool {
- if lhs.theme !== rhs.theme {
- return false
- }
- if lhs.items != rhs.items {
- return false
- }
- return true
- }
-
- final class State: ComponentState {
- var cachedBorderImage: (UIImage, PresentationTheme)?
- }
-
- func makeState() -> State {
- return State()
- }
-
- public static var body: Body {
- let leftColumnBackground = Child(Rectangle.self)
- let verticalBorder = Child(Rectangle.self)
- let titleChildren = ChildMap(environment: Empty.self, keyedBy: AnyHashable.self)
- let valueChildren = ChildMap(environment: Empty.self, keyedBy: AnyHashable.self)
- let borderChildren = ChildMap(environment: Empty.self, keyedBy: AnyHashable.self)
- let outerBorder = Child(Image.self)
-
- return { context in
- let verticalPadding: CGFloat = 11.0
- let horizontalPadding: CGFloat = 12.0
- let borderWidth: CGFloat = 1.0
-
- let backgroundColor = context.component.theme.actionSheet.opaqueItemBackgroundColor
- let borderColor = backgroundColor.mixedWith(context.component.theme.list.itemBlocksSeparatorColor, alpha: 0.6)
-
- var leftColumnWidth: CGFloat = 0.0
-
- var updatedTitleChildren: [_UpdatedChildComponent] = []
- var updatedValueChildren: [_UpdatedChildComponent] = []
- var updatedBorderChildren: [_UpdatedChildComponent] = []
-
- for item in context.component.items {
- let titleChild = titleChildren[item.id].update(
- component: AnyComponent(MultilineTextComponent(
- text: .plain(NSAttributedString(string: item.title, font: Font.regular(15.0), textColor: context.component.theme.list.itemPrimaryTextColor))
- )),
- availableSize: context.availableSize,
- transition: context.transition
- )
- updatedTitleChildren.append(titleChild)
-
- if titleChild.size.width > leftColumnWidth {
- leftColumnWidth = titleChild.size.width
- }
- }
-
- leftColumnWidth = max(100.0, leftColumnWidth + horizontalPadding * 2.0)
- let rightColumnWidth = context.availableSize.width - leftColumnWidth
-
- var i = 0
- var rowHeights: [Int: CGFloat] = [:]
- var totalHeight: CGFloat = 0.0
-
- for item in context.component.items {
- let titleChild = updatedTitleChildren[i]
- let valueChild = valueChildren[item.id].update(
- component: item.component,
- availableSize: CGSize(width: rightColumnWidth - horizontalPadding * 2.0, height: context.availableSize.height),
- transition: context.transition
- )
- updatedValueChildren.append(valueChild)
-
- let rowHeight = max(40.0, max(titleChild.size.height, valueChild.size.height) + verticalPadding * 2.0)
- rowHeights[i] = rowHeight
- totalHeight += rowHeight
-
- if i < context.component.items.count - 1 {
- let borderChild = borderChildren[item.id].update(
- component: AnyComponent(Rectangle(color: borderColor)),
- availableSize: CGSize(width: context.availableSize.width, height: borderWidth),
- transition: context.transition
- )
- updatedBorderChildren.append(borderChild)
- }
-
- i += 1
- }
-
- let leftColumnBackground = leftColumnBackground.update(
- component: Rectangle(color: context.component.theme.list.itemInputField.backgroundColor),
- availableSize: CGSize(width: leftColumnWidth, height: totalHeight),
- transition: context.transition
- )
- context.add(
- leftColumnBackground
- .position(CGPoint(x: leftColumnWidth / 2.0, y: totalHeight / 2.0))
- )
-
- let borderImage: UIImage
- if let (currentImage, theme) = context.state.cachedBorderImage, theme === context.component.theme {
- borderImage = currentImage
- } else {
- let borderRadius: CGFloat = 14.0
- borderImage = generateImage(CGSize(width: borderRadius * 2.0 + 6.0, height: borderRadius * 2.0 + 6.0), rotatedContext: { size, context in
- let bounds = CGRect(origin: .zero, size: size)
- context.setFillColor(backgroundColor.cgColor)
- context.fill(bounds)
-
- let path = CGPath(roundedRect: bounds.insetBy(dx: borderWidth / 2.0, dy: borderWidth / 2.0), cornerWidth: borderRadius, cornerHeight: borderRadius, transform: nil)
- context.setBlendMode(.clear)
- context.addPath(path)
- context.fillPath()
-
- context.setBlendMode(.normal)
- context.setStrokeColor(borderColor.cgColor)
- context.setLineWidth(borderWidth)
- context.addPath(path)
- context.strokePath()
- })!.stretchableImage(withLeftCapWidth: Int(borderRadius), topCapHeight: Int(borderRadius))
- context.state.cachedBorderImage = (borderImage, context.component.theme)
- }
-
- let outerBorder = outerBorder.update(
- component: Image(image: borderImage),
- availableSize: CGSize(width: context.availableSize.width, height: totalHeight),
- transition: context.transition
- )
- context.add(outerBorder
- .position(CGPoint(x: context.availableSize.width / 2.0, y: totalHeight / 2.0))
- )
-
- let verticalBorder = verticalBorder.update(
- component: Rectangle(color: borderColor),
- availableSize: CGSize(width: borderWidth, height: totalHeight),
- transition: context.transition
- )
- context.add(
- verticalBorder
- .position(CGPoint(x: leftColumnWidth - borderWidth / 2.0, y: totalHeight / 2.0))
- )
-
- i = 0
- var originY: CGFloat = 0.0
- for (titleChild, valueChild) in zip(updatedTitleChildren, updatedValueChildren) {
- let rowHeight = rowHeights[i] ?? 0.0
-
- let titleFrame = CGRect(origin: CGPoint(x: horizontalPadding, y: originY + verticalPadding), size: titleChild.size)
- let valueFrame = CGRect(origin: CGPoint(x: leftColumnWidth + horizontalPadding, y: originY + verticalPadding), size: valueChild.size)
-
- context.add(titleChild
- .position(titleFrame.center)
- )
-
- context.add(valueChild
- .position(valueFrame.center)
- )
-
- if i < updatedBorderChildren.count {
- let borderChild = updatedBorderChildren[i]
- context.add(borderChild
- .position(CGPoint(x: context.availableSize.width / 2.0, y: originY + rowHeight - borderWidth / 2.0))
- )
- }
-
- originY += rowHeight
- i += 1
- }
-
- return CGSize(width: context.availableSize.width, height: totalHeight)
- }
- }
-}
-
-private final class PeerCellComponent: Component {
- let context: AccountContext
- let textColor: UIColor
- let peer: EnginePeer?
-
- init(context: AccountContext, textColor: UIColor, peer: EnginePeer?) {
- self.context = context
- self.textColor = textColor
- self.peer = peer
- }
-
- static func ==(lhs: PeerCellComponent, rhs: PeerCellComponent) -> Bool {
- if lhs.context !== rhs.context {
- return false
- }
- if lhs.textColor !== rhs.textColor {
- return false
- }
- if lhs.peer != rhs.peer {
- return false
- }
- return true
- }
-
- final class View: UIView {
- private let avatarNode: AvatarNode
- private let text = ComponentView()
-
- private var component: PeerCellComponent?
- private weak var state: EmptyComponentState?
-
- override init(frame: CGRect) {
- self.avatarNode = AvatarNode(font: avatarPlaceholderFont(size: 13.0))
-
- super.init(frame: frame)
-
- self.addSubnode(self.avatarNode)
- }
-
- required init?(coder: NSCoder) {
- fatalError("init(coder:) has not been implemented")
- }
-
- func update(component: PeerCellComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment, transition: ComponentTransition) -> CGSize {
- self.component = component
- self.state = state
-
- self.avatarNode.setPeer(
- context: component.context,
- theme: component.context.sharedContext.currentPresentationData.with({ $0 }).theme,
- peer: component.peer,
- synchronousLoad: true
- )
-
- let avatarSize = CGSize(width: 22.0, height: 22.0)
- let spacing: CGFloat = 6.0
-
- let textSize = self.text.update(
- transition: .immediate,
- component: AnyComponent(
- MultilineTextComponent(
- text: .plain(NSAttributedString(string: component.peer?.compactDisplayTitle ?? "", font: Font.regular(15.0), textColor: component.textColor, paragraphAlignment: .left))
- )
- ),
- environment: {},
- containerSize: CGSize(width: availableSize.width - avatarSize.width - spacing, height: availableSize.height)
- )
-
- let size = CGSize(width: avatarSize.width + textSize.width + spacing, height: textSize.height)
-
- let avatarFrame = CGRect(origin: CGPoint(x: 0.0, y: floorToScreenPixels((size.height - avatarSize.height) / 2.0)), size: avatarSize)
- self.avatarNode.frame = avatarFrame
-
- if let view = self.text.view {
- if view.superview == nil {
- self.addSubview(view)
- }
- let textFrame = CGRect(origin: CGPoint(x: avatarSize.width + spacing, y: floorToScreenPixels((size.height - textSize.height) / 2.0)), size: textSize)
- transition.setFrame(view: view, frame: textFrame)
- }
-
- return size
- }
- }
-
- func makeView() -> View {
- return View(frame: CGRect())
- }
-
- func update(view: View, availableSize: CGSize, state: EmptyComponentState, environment: Environment, transition: ComponentTransition) -> CGSize {
- return view.update(component: self, availableSize: availableSize, state: state, environment: environment, transition: transition)
- }
-}
-
private final class DustComponent: Component {
let color: UIColor
diff --git a/submodules/PremiumUI/Sources/PremiumIntroScreen.swift b/submodules/PremiumUI/Sources/PremiumIntroScreen.swift
index 71f3a6e4..b8f679fe 100644
--- a/submodules/PremiumUI/Sources/PremiumIntroScreen.swift
+++ b/submodules/PremiumUI/Sources/PremiumIntroScreen.swift
@@ -1679,34 +1679,7 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
}
}
})
-
- self.newPerksDisposable = combineLatest(
- queue: Queue.mainQueue(),
- ApplicationSpecificNotice.dismissedBusinessBadge(accountManager: context.sharedContext.accountManager),
- ApplicationSpecificNotice.dismissedBusinessLinksBadge(accountManager: context.sharedContext.accountManager),
- ApplicationSpecificNotice.dismissedBusinessIntroBadge(accountManager: context.sharedContext.accountManager),
- ApplicationSpecificNotice.dismissedBusinessChatbotsBadge(accountManager: context.sharedContext.accountManager)
- ).startStrict(next: { [weak self] dismissedBusinessBadge, dismissedBusinessLinksBadge, dismissedBusinessIntroBadge, dismissedBusinessChatbotsBadge in
- guard let self else {
- return
- }
- var newPerks: [String] = []
- if !dismissedBusinessBadge {
- newPerks.append(PremiumPerk.business.identifier)
- }
- if !dismissedBusinessLinksBadge {
- newPerks.append(PremiumPerk.businessLinks.identifier)
- }
- if !dismissedBusinessIntroBadge {
- newPerks.append(PremiumPerk.businessIntro.identifier)
- }
- if !dismissedBusinessChatbotsBadge {
- newPerks.append(PremiumPerk.businessChatBots.identifier)
- }
- self.newPerks = newPerks
- self.updated()
- })
-
+
self.adsEnabledDisposable = (context.engine.data.subscribe(TelegramEngine.EngineData.Item.Peer.AdsEnabled(id: context.account.peerId))
|> deliverOnMainQueue).start(next: { [weak self] adsEnabled in
guard let self else {
@@ -2219,7 +2192,6 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
demoSubject = .todo
case .business:
demoSubject = .business
- let _ = ApplicationSpecificNotice.setDismissedBusinessBadge(accountManager: accountContext.sharedContext.accountManager).startStandalone()
default:
demoSubject = .doubleLimits
}
@@ -2418,7 +2390,6 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
}
push(accountContext.sharedContext.makeChatbotSetupScreen(context: accountContext, initialData: initialData))
})
- let _ = ApplicationSpecificNotice.setDismissedBusinessChatbotsBadge(accountManager: accountContext.sharedContext.accountManager).startStandalone()
case .businessIntro:
let _ = (accountContext.sharedContext.makeBusinessIntroSetupScreenInitialData(context: accountContext)
|> take(1)
@@ -2428,7 +2399,6 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
}
push(accountContext.sharedContext.makeBusinessIntroSetupScreen(context: accountContext, initialData: initialData))
})
- let _ = ApplicationSpecificNotice.setDismissedBusinessIntroBadge(accountManager: accountContext.sharedContext.accountManager).startStandalone()
case .businessLinks:
let _ = (accountContext.sharedContext.makeBusinessLinksSetupScreenInitialData(context: accountContext)
|> take(1)
@@ -2438,7 +2408,6 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
}
push(accountContext.sharedContext.makeBusinessLinksSetupScreen(context: accountContext, initialData: initialData))
})
- let _ = ApplicationSpecificNotice.setDismissedBusinessLinksBadge(accountManager: accountContext.sharedContext.accountManager).startStandalone()
default:
fatalError()
}
@@ -2457,13 +2426,10 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
demoSubject = .businessAwayMessage
case .businessChatBots:
demoSubject = .businessChatBots
- let _ = ApplicationSpecificNotice.setDismissedBusinessChatbotsBadge(accountManager: accountContext.sharedContext.accountManager).startStandalone()
case .businessIntro:
demoSubject = .businessIntro
- let _ = ApplicationSpecificNotice.setDismissedBusinessIntroBadge(accountManager: accountContext.sharedContext.accountManager).startStandalone()
case .businessLinks:
demoSubject = .businessLinks
- let _ = ApplicationSpecificNotice.setDismissedBusinessLinksBadge(accountManager: accountContext.sharedContext.accountManager).startStandalone()
default:
fatalError()
}
@@ -2960,6 +2926,7 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
private final class PremiumIntroScreenComponent: CombinedComponent {
typealias EnvironmentType = ViewControllerComponentContainer.Environment
+ let overNavigationContainer: UIView
let screenContext: PremiumIntroScreen.ScreenContext
let mode: PremiumIntroScreen.Mode
let source: PremiumSource
@@ -2972,7 +2939,8 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
let copyLink: (String) -> Void
let shareLink: (String) -> Void
- init(screenContext: PremiumIntroScreen.ScreenContext, mode: PremiumIntroScreen.Mode, source: PremiumSource, forceDark: Bool, forceHasPremium: Bool, updateInProgress: @escaping (Bool) -> Void, present: @escaping (ViewController) -> Void, push: @escaping (ViewController) -> Void, completion: @escaping () -> Void, copyLink: @escaping (String) -> Void, shareLink: @escaping (String) -> Void) {
+ init(overNavigationContainer: UIView, screenContext: PremiumIntroScreen.ScreenContext, mode: PremiumIntroScreen.Mode, source: PremiumSource, forceDark: Bool, forceHasPremium: Bool, updateInProgress: @escaping (Bool) -> Void, present: @escaping (ViewController) -> Void, push: @escaping (ViewController) -> Void, completion: @escaping () -> Void, copyLink: @escaping (String) -> Void, shareLink: @escaping (String) -> Void) {
+ self.overNavigationContainer = overNavigationContainer
self.screenContext = screenContext
self.mode = mode
self.source = source
@@ -3415,8 +3383,6 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
let star = Child(PremiumStarComponent.self)
let emoji = Child(EmojiHeaderComponent.self)
let coin = Child(PremiumCoinComponent.self)
- let topPanel = Child(BlurredBackgroundComponent.self)
- let topSeparator = Child(Rectangle.self)
let title = Child(MultilineTextComponent.self)
let secondaryTitle = Child(MultilineTextWithEntitiesComponent.self)
let bottomEdgeEffect = Child(EdgeEffectComponent.self)
@@ -3504,22 +3470,6 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
)
}
- let topPanel = topPanel.update(
- component: BlurredBackgroundComponent(
- color: environment.theme.rootController.navigationBar.blurredBackgroundColor
- ),
- availableSize: CGSize(width: context.availableSize.width, height: environment.navigationHeight),
- transition: context.transition
- )
-
- let topSeparator = topSeparator.update(
- component: Rectangle(
- color: environment.theme.rootController.navigationBar.separatorColor
- ),
- availableSize: CGSize(width: context.availableSize.width, height: UIScreenPixel),
- transition: context.transition
- )
-
let titleString: String
if case .premiumGift = context.component.source {
titleString = environment.strings.Premium_PremiumGift_Title
@@ -3743,14 +3693,12 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
.position(CGPoint(x: context.availableSize.width / 2.0, y: context.availableSize.height / 2.0))
)
- let topPanelAlpha: CGFloat
let titleOffset: CGFloat
let titleScale: CGFloat
let titleOffsetDelta = (topInset + 160.0) - (environment.statusBarHeight + (environment.navigationHeight - environment.statusBarHeight) / 2.0)
let titleAlpha: CGFloat
if let topContentOffset = state.topContentOffset {
- topPanelAlpha = min(20.0, max(0.0, topContentOffset - 95.0)) / 20.0
let topContentOffset = topContentOffset + max(0.0, min(1.0, topContentOffset / titleOffsetDelta)) * 10.0
titleOffset = topContentOffset
let fraction = max(0.0, min(1.0, titleOffset / titleOffsetDelta))
@@ -3762,36 +3710,29 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
titleAlpha = 1.0
}
} else {
- topPanelAlpha = 0.0
titleScale = 1.0
titleOffset = 0.0
titleAlpha = state.otherPeerName != nil ? 0.0 : 1.0
}
- context.add(header
+ context.addWithExternalContainer(header
.position(CGPoint(x: context.availableSize.width / 2.0, y: topInset + header.size.height / 2.0 - 30.0 - titleOffset * titleScale))
- .scale(titleScale)
+ .scale(titleScale),
+ container: context.component.overNavigationContainer
)
- context.add(topPanel
- .position(CGPoint(x: context.availableSize.width / 2.0, y: topPanel.size.height / 2.0))
- .opacity(topPanelAlpha)
- )
- context.add(topSeparator
- .position(CGPoint(x: context.availableSize.width / 2.0, y: topPanel.size.height))
- .opacity(topPanelAlpha)
- )
-
- context.add(title
+ context.addWithExternalContainer(title
.position(CGPoint(x: context.availableSize.width / 2.0, y: max(topInset + 160.0 - titleOffset, environment.statusBarHeight + (environment.navigationHeight - environment.statusBarHeight) / 2.0)))
.scale(titleScale)
- .opacity(titleAlpha)
+ .opacity(titleAlpha),
+ container: context.component.overNavigationContainer
)
- context.add(secondaryTitle
+ context.addWithExternalContainer(secondaryTitle
.position(CGPoint(x: context.availableSize.width / 2.0, y: max(topInset + 160.0 - titleOffset, environment.statusBarHeight + (environment.navigationHeight - environment.statusBarHeight) / 2.0)))
.scale(titleScale)
- .opacity(max(0.0, 1.0 - titleAlpha * 1.8))
+ .opacity(max(0.0, 1.0 - titleAlpha * 1.8)),
+ container: context.component.overNavigationContainer
)
var isUnusedGift = false
@@ -3989,6 +3930,8 @@ public final class PremiumIntroScreen: ViewControllerComponentContainer {
public weak var containerView: UIView?
public var animationColor: UIColor?
+ private let overNavigationContainer: UIView
+
public convenience init(context: AccountContext, mode: Mode = .premium, source: PremiumSource, modal: Bool = true, forceDark: Bool = false, forceHasPremium: Bool = false) {
self.init(screenContext: .accountContext(context), mode: mode, source: source, modal: modal, forceDark: forceDark, forceHasPremium: forceHasPremium)
}
@@ -4005,7 +3948,11 @@ public final class PremiumIntroScreen: ViewControllerComponentContainer {
var completionImpl: (() -> Void)?
var copyLinkImpl: ((String) -> Void)?
var shareLinkImpl: ((String) -> Void)?
+
+ self.overNavigationContainer = UIView()
+
super.init(component: PremiumIntroScreenComponent(
+ overNavigationContainer: self.overNavigationContainer,
screenContext: screenContext,
mode: mode,
source: source,
@@ -4029,11 +3976,11 @@ public final class PremiumIntroScreen: ViewControllerComponentContainer {
shareLink: { link in
shareLinkImpl?(link)
}
- ), navigationBarAppearance: .transparent, presentationMode: modal ? .modal : .default, theme: forceDark ? .dark : .default, updatedPresentationData: screenContext.updatedPresentationData)
+ ), navigationBarAppearance: .default, presentationMode: modal ? .modal : .default, theme: forceDark ? .dark : .default, updatedPresentationData: screenContext.updatedPresentationData)
+
+ self._hasGlassStyle = true
if modal {
- let cancelItem = UIBarButtonItem(title: presentationData.strings.Common_Close, style: .plain, target: self, action: #selector(self.cancelPressed))
- self.navigationItem.setLeftBarButton(cancelItem, animated: false)
self.navigationPresentation = .modal
} else {
self.navigationPresentation = .modalInLargeLayout
@@ -4107,12 +4054,20 @@ public final class PremiumIntroScreen: ViewControllerComponentContainer {
context.account.viewTracker.keepQuickRepliesApproximatelyUpdated()
context.account.viewTracker.keepBusinessLinksApproximatelyUpdated()
}
+
+ if let navigationBar = self.navigationBar {
+ navigationBar.view.insertSubview(self.overNavigationContainer, aboveSubview: navigationBar.backgroundView)
+ }
}
required public init(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
+ override public func viewDidLoad() {
+ super.viewDidLoad()
+ }
+
public override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
self.dismissAllTooltips()
@@ -4145,10 +4100,10 @@ public final class PremiumIntroScreen: ViewControllerComponentContainer {
super.containerLayoutUpdated(layout, transition: transition)
if !self.didSetReady {
- if let view = self.node.hostView.findTaggedView(tag: PremiumCoinComponent.View.Tag()) as? PremiumCoinComponent.View {
+ if let view = findTaggedComponentViewImpl(view: self.view, tag: PremiumCoinComponent.View.Tag()) as? PremiumCoinComponent.View {
self.didSetReady = true
self._ready.set(view.ready)
- } else if let view = self.node.hostView.findTaggedView(tag: PremiumStarComponent.View.Tag()) as? PremiumStarComponent.View {
+ } else if let view = findTaggedComponentViewImpl(view: self.view, tag: PremiumStarComponent.View.Tag()) as? PremiumStarComponent.View {
self.didSetReady = true
self._ready.set(view.ready)
@@ -4161,7 +4116,7 @@ public final class PremiumIntroScreen: ViewControllerComponentContainer {
self.containerView = nil
self.animationColor = nil
}
- } else if let view = self.node.hostView.findTaggedView(tag: EmojiHeaderComponent.View.Tag()) as? EmojiHeaderComponent.View {
+ } else if let view = findTaggedComponentViewImpl(view: self.view, tag: EmojiHeaderComponent.View.Tag()) as? EmojiHeaderComponent.View {
self.didSetReady = true
self._ready.set(view.ready)
diff --git a/submodules/PremiumUI/Sources/PremiumLimitScreen.swift b/submodules/PremiumUI/Sources/PremiumLimitScreen.swift
index e3ff83a2..447f9b2f 100644
--- a/submodules/PremiumUI/Sources/PremiumLimitScreen.swift
+++ b/submodules/PremiumUI/Sources/PremiumLimitScreen.swift
@@ -864,7 +864,7 @@ private final class LimitSheetContent: CombinedComponent {
component: AnyComponentWithIdentity(id: "close", component: AnyComponent(
BundleIconComponent(
name: "Navigation/Close",
- tintColor: theme.rootController.navigationBar.glassBarButtonForegroundColor
+ tintColor: theme.chat.inputPanel.panelControlColor
)
)),
action: { _ in
diff --git a/submodules/PremiumUI/Sources/PremiumPrivacyScreen.swift b/submodules/PremiumUI/Sources/PremiumPrivacyScreen.swift
index c04daa16..7b357651 100644
--- a/submodules/PremiumUI/Sources/PremiumPrivacyScreen.swift
+++ b/submodules/PremiumUI/Sources/PremiumPrivacyScreen.swift
@@ -170,7 +170,7 @@ private final class SheetContent: CombinedComponent {
component: AnyComponentWithIdentity(id: "close", component: AnyComponent(
BundleIconComponent(
name: "Navigation/Close",
- tintColor: theme.rootController.navigationBar.glassBarButtonForegroundColor
+ tintColor: theme.chat.inputPanel.panelControlColor
)
)),
action: { _ in
diff --git a/submodules/PremiumUI/Sources/SubscriptionsCountItem.swift b/submodules/PremiumUI/Sources/SubscriptionsCountItem.swift
index 6fecfbfb..861c43d7 100644
--- a/submodules/PremiumUI/Sources/SubscriptionsCountItem.swift
+++ b/submodules/PremiumUI/Sources/SubscriptionsCountItem.swift
@@ -91,7 +91,7 @@ private final class SubscriptionsCountItemNode: ListViewItemNode {
return textNode
}
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.textNodes.forEach(self.addSubnode)
}
diff --git a/submodules/PresentationDataUtils/BUILD b/submodules/PresentationDataUtils/BUILD
index 66b10496..28dcd03d 100644
--- a/submodules/PresentationDataUtils/BUILD
+++ b/submodules/PresentationDataUtils/BUILD
@@ -19,6 +19,7 @@ swift_library(
"//submodules/SolidRoundedButtonNode:SolidRoundedButtonNode",
"//submodules/OverlayStatusController:OverlayStatusController",
"//submodules/UrlWhitelist:UrlWhitelist",
+ "//submodules/TelegramUI/Components/AlertComponent",
],
visibility = [
"//visibility:public",
diff --git a/submodules/PresentationDataUtils/Sources/AlertTheme.swift b/submodules/PresentationDataUtils/Sources/AlertTheme.swift
index 1fa7f48d..8353b3d4 100644
--- a/submodules/PresentationDataUtils/Sources/AlertTheme.swift
+++ b/submodules/PresentationDataUtils/Sources/AlertTheme.swift
@@ -4,35 +4,107 @@ import AlertUI
import AccountContext
import SwiftSignalKit
import TelegramPresentationData
+import AlertComponent
-public func textAlertController(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal)? = nil, forceTheme: PresentationTheme? = nil, title: String?, text: String, actions: [TextAlertAction], actionLayout: TextAlertContentActionLayout = .horizontal, allowInputInset: Bool = true, parseMarkdown: Bool = false, dismissOnOutsideTap: Bool = true, linkAction: (([NSAttributedString.Key: Any], Int) -> Void)? = nil) -> AlertController {
+public func textAlertController(
+ context: AccountContext,
+ updatedPresentationData: (initial: PresentationData, signal: Signal)? = nil,
+ forceTheme: PresentationTheme? = nil,
+ title: String?,
+ text: String,
+ actions: [TextAlertAction],
+ actionLayout: TextAlertContentActionLayout = .horizontal,
+ allowInputInset: Bool = true,
+ parseMarkdown: Bool = false,
+ dismissOnOutsideTap: Bool = true,
+ linkAction: (([NSAttributedString.Key: Any], Int) -> Void)? = nil
+) -> ViewController {
return textAlertController(sharedContext: context.sharedContext, updatedPresentationData: updatedPresentationData, forceTheme: forceTheme, title: title, text: text, actions: actions, actionLayout: actionLayout, allowInputInset: allowInputInset, parseMarkdown: parseMarkdown, dismissOnOutsideTap: dismissOnOutsideTap, linkAction: linkAction)
}
-public func textAlertController(sharedContext: SharedAccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal)? = nil, forceTheme: PresentationTheme? = nil, title: String?, text: String, actions: [TextAlertAction], actionLayout: TextAlertContentActionLayout = .horizontal, allowInputInset: Bool = true, parseMarkdown: Bool = false, dismissOnOutsideTap: Bool = true, linkAction: (([NSAttributedString.Key: Any], Int) -> Void)? = nil) -> AlertController {
+public func textAlertController(
+ sharedContext: SharedAccountContext,
+ updatedPresentationData: (initial: PresentationData, signal: Signal)? = nil,
+ forceTheme: PresentationTheme? = nil,
+ title: String?,
+ text: String,
+ actions: [TextAlertAction],
+ actionLayout: TextAlertContentActionLayout = .horizontal,
+ allowInputInset: Bool = true,
+ parseMarkdown: Bool = false,
+ dismissOnOutsideTap: Bool = true,
+ linkAction: (([NSAttributedString.Key: Any], Int) -> Void)? = nil
+) -> ViewController {
var presentationData = updatedPresentationData?.initial ?? sharedContext.currentPresentationData.with { $0 }
- if let forceTheme = forceTheme {
+ if let forceTheme {
presentationData = presentationData.withUpdated(theme: forceTheme)
}
- return textAlertController(alertContext: AlertControllerContext(theme: AlertControllerTheme(presentationData: presentationData), themeSignal: (updatedPresentationData?.signal ?? sharedContext.presentationData) |> map {
+ let updatedPresentationDataSignal = (updatedPresentationData?.signal ?? sharedContext.presentationData) |> map {
presentationData in
var presentationData = presentationData
if let forceTheme = forceTheme {
presentationData = presentationData.withUpdated(theme: forceTheme)
}
- return AlertControllerTheme(presentationData: presentationData)
- }), title: title, text: text, actions: actions, actionLayout: actionLayout, allowInputInset: allowInputInset, parseMarkdown: parseMarkdown, dismissOnOutsideTap: dismissOnOutsideTap, linkAction: linkAction)
+ return presentationData
+ }
+
+ let mappedActions: [AlertScreen.Action] = actions.map { action in
+ let mappedType: AlertScreen.Action.ActionType
+ switch action.type {
+ case .genericAction:
+ mappedType = .generic
+ case .defaultAction:
+ mappedType = .default
+ case .destructiveAction:
+ mappedType = .destructive
+ case .defaultDestructiveAction:
+ mappedType = .defaultDestructive
+ }
+ return AlertScreen.Action(
+ title: action.title,
+ type: mappedType,
+ action: action.action
+ )
+ }
+
+ let controller = AlertScreen(
+ configuration: AlertScreen.Configuration(
+ actionAlignment: actionLayout == .vertical ? .vertical : .default,
+ dismissOnOutsideTap: dismissOnOutsideTap,
+ allowInputInset: allowInputInset
+ ),
+ title: title,
+ text: text,
+ textAction: { attributes in
+ linkAction?(attributes, 0)
+ },
+ actions: mappedActions,
+ updatedPresentationData: (initial: presentationData, signal: updatedPresentationDataSignal)
+ )
+ return controller
}
-public func textAlertController(sharedContext: SharedAccountContext, title: String?, text: String, actions: [TextAlertAction], actionLayout: TextAlertContentActionLayout = .horizontal, allowInputInset: Bool = true, dismissOnOutsideTap: Bool = true) -> AlertController {
- return textAlertController(alertContext: AlertControllerContext(theme: AlertControllerTheme(presentationData: sharedContext.currentPresentationData.with { $0 }), themeSignal: sharedContext.presentationData |> map { presentationData in AlertControllerTheme(presentationData: presentationData) }), title: title, text: text, actions: actions, actionLayout: actionLayout, allowInputInset: allowInputInset, dismissOnOutsideTap: dismissOnOutsideTap)
-}
-
-public func richTextAlertController(context: AccountContext, title: NSAttributedString?, text: NSAttributedString, actions: [TextAlertAction], actionLayout: TextAlertContentActionLayout = .horizontal, allowInputInset: Bool = true, dismissAutomatically: Bool = true) -> AlertController {
+public func richTextAlertController(
+ context: AccountContext,
+ title: NSAttributedString?,
+ text: NSAttributedString,
+ actions: [TextAlertAction],
+ actionLayout: TextAlertContentActionLayout = .horizontal,
+ allowInputInset: Bool = true,
+ dismissAutomatically: Bool = true
+) -> AlertController {
return richTextAlertController(alertContext: AlertControllerContext(theme: AlertControllerTheme(presentationData: context.sharedContext.currentPresentationData.with { $0 }), themeSignal: context.sharedContext.presentationData |> map { presentationData in AlertControllerTheme(presentationData: presentationData) }), title: title, text: text, actions: actions, actionLayout: actionLayout, allowInputInset: allowInputInset, dismissAutomatically: dismissAutomatically)
}
-public func textWithEntitiesAlertController(context: AccountContext, title: NSAttributedString?, text: NSAttributedString, actions: [TextAlertAction], actionLayout: TextAlertContentActionLayout = .horizontal, allowInputInset: Bool = true, dismissAutomatically: Bool = true) -> AlertController {
+public func textWithEntitiesAlertController(
+ context: AccountContext,
+ title: NSAttributedString?,
+ text: NSAttributedString,
+ actions: [TextAlertAction],
+ actionLayout: TextAlertContentActionLayout = .horizontal,
+ allowInputInset: Bool = true,
+ dismissAutomatically: Bool = true
+) -> AlertController {
return textWithEntitiesAlertController(
alertContext: AlertControllerContext(
theme: AlertControllerTheme(presentationData: context.sharedContext.currentPresentationData.with { $0 }),
diff --git a/submodules/PresentationDataUtils/Sources/OpenUrl.swift b/submodules/PresentationDataUtils/Sources/OpenUrl.swift
index 31f70d75..1bb12626 100644
--- a/submodules/PresentationDataUtils/Sources/OpenUrl.swift
+++ b/submodules/PresentationDataUtils/Sources/OpenUrl.swift
@@ -6,6 +6,7 @@ import AccountContext
import OverlayStatusController
import UrlWhitelist
import TelegramPresentationData
+import AlertComponent
public func openUserGeneratedUrl(context: AccountContext, peerId: PeerId?, url: String, concealed: Bool, skipUrlAuth: Bool = false, skipConcealedAlert: Bool = false, forceDark: Bool = false, present: @escaping (ViewController) -> Void, openResolved: @escaping (ResolvedUrl) -> Void, progress: Promise? = nil, alertDisplayUpdated: ((ViewController?) -> Void)? = nil) -> Disposable {
var concealed = concealed
@@ -95,8 +96,10 @@ public func openUserGeneratedUrl(context: AccountContext, peerId: PeerId?, url:
let alertController = textAlertController(context: context, forceTheme: forceDark ? presentationData.theme : nil, title: nil, text: presentationData.strings.Generic_OpenHiddenLinkAlert(displayUrl).string, actions: [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_No, action: {}), TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_Yes, action: {
disposable.set(openImpl())
})])
- alertController.dismissed = { _ in
- alertDisplayUpdated?(nil)
+ if let alertController = alertController as? AlertScreen {
+ alertController.dismissed = { _ in
+ alertDisplayUpdated?(nil)
+ }
}
present(alertController)
alertDisplayUpdated?(alertController)
diff --git a/submodules/PromptUI/BUILD b/submodules/PromptUI/BUILD
index ae10576e..80d83f29 100644
--- a/submodules/PromptUI/BUILD
+++ b/submodules/PromptUI/BUILD
@@ -10,14 +10,17 @@ swift_library(
"-warnings-as-errors",
],
deps = [
- "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
- "//submodules/AsyncDisplayKit:AsyncDisplayKit",
- "//submodules/Display:Display",
- "//submodules/Postbox:Postbox",
- "//submodules/TelegramCore:TelegramCore",
- "//submodules/AccountContext:AccountContext",
- "//submodules/TelegramPresentationData:TelegramPresentationData",
+ "//submodules/SSignalKit/SwiftSignalKit",
+ "//submodules/AsyncDisplayKit",
+ "//submodules/Display",
+ "//submodules/Postbox",
+ "//submodules/TelegramCore",
+ "//submodules/AccountContext",
+ "//submodules/TelegramPresentationData",
"//submodules/TelegramStringFormatting",
+ "//submodules/ComponentFlow",
+ "//submodules/TelegramUI/Components/AlertComponent",
+ "//submodules/TelegramUI/Components/AlertComponent/AlertMultilineInputFieldComponent",
],
visibility = [
"//visibility:public",
diff --git a/submodules/PromptUI/Sources/PromptController.swift b/submodules/PromptUI/Sources/PromptController.swift
index 2581f538..d359be83 100644
--- a/submodules/PromptUI/Sources/PromptController.swift
+++ b/submodules/PromptUI/Sources/PromptController.swift
@@ -8,6 +8,9 @@ import TelegramCore
import TelegramPresentationData
import AccountContext
import TelegramStringFormatting
+import ComponentFlow
+import AlertComponent
+import AlertMultilineInputFieldComponent
private final class PromptInputFieldNode: ASDisplayNode, ASEditableTextNodeDelegate {
private var theme: PresentationTheme
@@ -194,327 +197,95 @@ private final class PromptInputFieldNode: ASDisplayNode, ASEditableTextNodeDeleg
}
}
-private final class PromptAlertContentNode: AlertContentNode {
- private let strings: PresentationStrings
- private let text: String
- private let titleFont: PromptControllerTitleFont
- private let subtitle: String?
-
- private let textNode: ASTextNode
- private let subtitleNode: ASTextNode?
- let inputFieldNode: PromptInputFieldNode
-
- private let actionNodesSeparator: ASDisplayNode
- private let actionNodes: [TextAlertContentActionNode]
- private let actionVerticalSeparators: [ASDisplayNode]
-
- private let disposable = MetaDisposable()
-
- private var validLayout: CGSize?
-
- private let hapticFeedback = HapticFeedback()
-
- var complete: (() -> Void)? {
- didSet {
- self.inputFieldNode.complete = self.complete
- }
- }
-
- override var dismissOnOutsideTap: Bool {
- return self.isUserInteractionEnabled
- }
-
- init(theme: AlertControllerTheme, ptheme: PresentationTheme, strings: PresentationStrings, actions: [TextAlertAction], text: String, titleFont: PromptControllerTitleFont, subtitle: String?, value: String?, placeholder: String?, characterLimit: Int, displayCharacterLimit: Bool) {
- self.strings = strings
- self.text = text
- self.titleFont = titleFont
- self.subtitle = subtitle
-
- self.textNode = ASTextNode()
- self.textNode.maximumNumberOfLines = 2
-
- if subtitle != nil {
- let subtitleNode = ASTextNode()
- subtitleNode.maximumNumberOfLines = 0
- self.subtitleNode = subtitleNode
- } else {
- self.subtitleNode = nil
- }
-
- self.inputFieldNode = PromptInputFieldNode(theme: ptheme, placeholder: placeholder ?? "", characterLimit: characterLimit, displayCharacterLimit: displayCharacterLimit)
- self.inputFieldNode.text = value ?? ""
-
- self.actionNodesSeparator = ASDisplayNode()
- self.actionNodesSeparator.isLayerBacked = true
-
- self.actionNodes = actions.map { action -> TextAlertContentActionNode in
- return TextAlertContentActionNode(theme: theme, action: action)
- }
-
- var actionVerticalSeparators: [ASDisplayNode] = []
- if actions.count > 1 {
- for _ in 0 ..< actions.count - 1 {
- let separatorNode = ASDisplayNode()
- separatorNode.isLayerBacked = true
- actionVerticalSeparators.append(separatorNode)
- }
- }
- self.actionVerticalSeparators = actionVerticalSeparators
-
- super.init()
-
- self.addSubnode(self.textNode)
- if let subtitleNode = self.subtitleNode {
- self.addSubnode(subtitleNode)
- }
-
- self.addSubnode(self.inputFieldNode)
-
- self.addSubnode(self.actionNodesSeparator)
-
- for actionNode in self.actionNodes {
- self.addSubnode(actionNode)
- }
- self.actionNodes.last?.actionEnabled = true
-
- for separatorNode in self.actionVerticalSeparators {
- self.addSubnode(separatorNode)
- }
-
- self.inputFieldNode.updateHeight = { [weak self] in
- if let strongSelf = self {
- if let _ = strongSelf.validLayout {
- strongSelf.requestLayout?(.animated(duration: 0.15, curve: .spring))
- }
- }
- }
-
-// self.inputFieldNode.textChanged = { [weak self] text in
-// if let strongSelf = self, let lastNode = strongSelf.actionNodes.last {
-// lastNode.actionEnabled = !text.isEmpty
-// }
-// }
-
- self.updateTheme(theme)
- }
-
- deinit {
- self.disposable.dispose()
- }
-
- var value: String {
- return self.inputFieldNode.text
- }
-
- override func updateTheme(_ theme: AlertControllerTheme) {
- let titleFontValue: UIFont
- switch self.titleFont {
- case .regular:
- titleFontValue = Font.regular(13.0)
- case .bold:
- titleFontValue = Font.semibold(17.0)
- }
- self.textNode.attributedText = NSAttributedString(string: self.text, font: titleFontValue, textColor: theme.primaryColor, paragraphAlignment: .center)
-
- if let subtitle = self.subtitle, let subtitleNode = self.subtitleNode {
- subtitleNode.attributedText = NSAttributedString(string: subtitle, font: Font.regular(13.0), textColor: theme.primaryColor, paragraphAlignment: .center)
- }
-
- self.actionNodesSeparator.backgroundColor = theme.separatorColor
- for actionNode in self.actionNodes {
- actionNode.updateTheme(theme)
- }
- for separatorNode in self.actionVerticalSeparators {
- separatorNode.backgroundColor = theme.separatorColor
- }
-
- if let size = self.validLayout {
- _ = self.updateLayout(size: size, transition: .immediate)
- }
- }
-
- override func updateLayout(size: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
- var size = size
- size.width = min(size.width, 270.0)
- let measureSize = CGSize(width: size.width - 16.0 * 2.0, height: CGFloat.greatestFiniteMagnitude)
-
- let hadValidLayout = self.validLayout != nil
-
- self.validLayout = size
-
- var origin: CGPoint = CGPoint(x: 0.0, y: 20.0)
- let spacing: CGFloat = 5.0
-
- let titleSize = CGSize()
-// transition.updateFrame(node: self.titleNode, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - titleSize.width) / 2.0), y: origin.y), size: titleSize))
-// origin.y += titleSize.height + 4.0
-
- let textSize = self.textNode.measure(measureSize)
- transition.updateFrame(node: self.textNode, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - textSize.width) / 2.0), y: origin.y), size: textSize))
- origin.y += textSize.height + 6.0 + spacing
-
- var subtitleSize: CGSize?
- if let subtitleNode {
- let subtitleSizeValue = subtitleNode.measure(measureSize)
- subtitleSize = subtitleSizeValue
- transition.updateFrame(node: subtitleNode, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - subtitleSizeValue.width) / 2.0), y: origin.y), size: subtitleSizeValue))
- origin.y += subtitleSizeValue.height + 6.0 + spacing
- }
-
- let actionButtonHeight: CGFloat = 44.0
- var minActionsWidth: CGFloat = 0.0
- let maxActionWidth: CGFloat = floor(size.width / CGFloat(self.actionNodes.count))
- let actionTitleInsets: CGFloat = 8.0
-
- var effectiveActionLayout = TextAlertContentActionLayout.horizontal
- for actionNode in self.actionNodes {
- let actionTitleSize = actionNode.titleNode.updateLayout(CGSize(width: maxActionWidth, height: actionButtonHeight))
- if case .horizontal = effectiveActionLayout, actionTitleSize.height > actionButtonHeight * 0.6667 {
- effectiveActionLayout = .vertical
- }
- switch effectiveActionLayout {
- case .horizontal:
- minActionsWidth += actionTitleSize.width + actionTitleInsets
- case .vertical:
- minActionsWidth = max(minActionsWidth, actionTitleSize.width + actionTitleInsets)
- }
- }
-
- let insets = UIEdgeInsets(top: 18.0, left: 18.0, bottom: 9.0, right: 18.0)
-
- var contentWidth = max(titleSize.width, minActionsWidth)
- if let subtitleSize {
- contentWidth = max(contentWidth, subtitleSize.width)
- }
- contentWidth = max(contentWidth, 234.0)
-
- var actionsHeight: CGFloat = 0.0
- switch effectiveActionLayout {
- case .horizontal:
- actionsHeight = actionButtonHeight
- case .vertical:
- actionsHeight = actionButtonHeight * CGFloat(self.actionNodes.count)
- }
-
- let resultWidth = contentWidth + insets.left + insets.right
-
- let inputFieldWidth = resultWidth
- let inputFieldHeight = self.inputFieldNode.updateLayout(width: inputFieldWidth, transition: transition)
- let inputHeight = inputFieldHeight
- transition.updateFrame(node: self.inputFieldNode, frame: CGRect(x: 0.0, y: origin.y, width: resultWidth, height: inputFieldHeight))
- transition.updateAlpha(node: self.inputFieldNode, alpha: inputHeight > 0.0 ? 1.0 : 0.0)
-
- var resultSize = CGSize(width: resultWidth, height: titleSize.height + textSize.height + spacing + inputHeight + actionsHeight + insets.top + insets.bottom)
- if let subtitleSize {
- resultSize.height += subtitleSize.height + spacing
- }
-
- transition.updateFrame(node: self.actionNodesSeparator, frame: CGRect(origin: CGPoint(x: 0.0, y: resultSize.height - actionsHeight - UIScreenPixel), size: CGSize(width: resultSize.width, height: UIScreenPixel)))
-
- var actionOffset: CGFloat = 0.0
- let actionWidth: CGFloat = floor(resultSize.width / CGFloat(self.actionNodes.count))
- var separatorIndex = -1
- var nodeIndex = 0
- for actionNode in self.actionNodes {
- if separatorIndex >= 0 {
- let separatorNode = self.actionVerticalSeparators[separatorIndex]
- switch effectiveActionLayout {
- case .horizontal:
- transition.updateFrame(node: separatorNode, frame: CGRect(origin: CGPoint(x: actionOffset - UIScreenPixel, y: resultSize.height - actionsHeight), size: CGSize(width: UIScreenPixel, height: actionsHeight - UIScreenPixel)))
- case .vertical:
- transition.updateFrame(node: separatorNode, frame: CGRect(origin: CGPoint(x: 0.0, y: resultSize.height - actionsHeight + actionOffset - UIScreenPixel), size: CGSize(width: resultSize.width, height: UIScreenPixel)))
- }
- }
- separatorIndex += 1
-
- let currentActionWidth: CGFloat
- switch effectiveActionLayout {
- case .horizontal:
- if nodeIndex == self.actionNodes.count - 1 {
- currentActionWidth = resultSize.width - actionOffset
- } else {
- currentActionWidth = actionWidth
- }
- case .vertical:
- currentActionWidth = resultSize.width
- }
-
- let actionNodeFrame: CGRect
- switch effectiveActionLayout {
- case .horizontal:
- actionNodeFrame = CGRect(origin: CGPoint(x: actionOffset, y: resultSize.height - actionsHeight), size: CGSize(width: currentActionWidth, height: actionButtonHeight))
- actionOffset += currentActionWidth
- case .vertical:
- actionNodeFrame = CGRect(origin: CGPoint(x: 0.0, y: resultSize.height - actionsHeight + actionOffset), size: CGSize(width: currentActionWidth, height: actionButtonHeight))
- actionOffset += actionButtonHeight
- }
-
- transition.updateFrame(node: actionNode, frame: actionNodeFrame)
-
- nodeIndex += 1
- }
-
- if !hadValidLayout {
- self.inputFieldNode.activateInput()
- }
-
- return resultSize
- }
-
- func animateError() {
- self.inputFieldNode.layer.addShakeAnimation()
- self.hapticFeedback.error()
- }
-}
-
public enum PromptControllerTitleFont {
case regular
case bold
}
-public func promptController(sharedContext: SharedAccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal)? = nil, text: String, titleFont: PromptControllerTitleFont = .regular, subtitle: String? = nil, value: String?, placeholder: String? = nil, characterLimit: Int = 1000, displayCharacterLimit: Bool = false, apply: @escaping (String?) -> Void) -> AlertController {
- let presentationData = updatedPresentationData?.initial ?? sharedContext.currentPresentationData.with { $0 }
+public func promptController(
+ context: AccountContext,
+ updatedPresentationData: (initial: PresentationData, signal: Signal)? = nil,
+ text: String,
+ titleFont: PromptControllerTitleFont = .regular,
+ subtitle: String? = nil,
+ value: String?,
+ placeholder: String? = nil,
+ characterLimit: Int = 1000,
+ displayCharacterLimit: Bool = false,
+ apply: @escaping (String?) -> Void,
+ dismissed: @escaping () -> Void = {}
+) -> ViewController {
+ let presentationData = context.sharedContext.currentPresentationData.with { $0 }
+ let strings = presentationData.strings
- var dismissImpl: ((Bool) -> Void)?
- var applyImpl: (() -> Void)?
-
- let actions: [TextAlertAction] = [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {
- dismissImpl?(true)
- apply(nil)
- }), TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_Done, action: {
- dismissImpl?(true)
- applyImpl?()
- })]
-
- let contentNode = PromptAlertContentNode(theme: AlertControllerTheme(presentationData: presentationData), ptheme: presentationData.theme, strings: presentationData.strings, actions: actions, text: text, titleFont: titleFont, subtitle: subtitle, value: value, placeholder: placeholder, characterLimit: characterLimit, displayCharacterLimit: displayCharacterLimit)
- contentNode.complete = {
- dismissImpl?(true)
- applyImpl?()
+ let inputState = AlertMultilineInputFieldComponent.ExternalState()
+
+ var content: [AnyComponentWithIdentity] = []
+ if subtitle == nil && titleFont == .regular {
+ content.append(AnyComponentWithIdentity(
+ id: "title",
+ component: AnyComponent(
+ AlertTextComponent(content: .plain(text))
+ )
+ ))
+ } else {
+ content.append(AnyComponentWithIdentity(
+ id: "title",
+ component: AnyComponent(
+ AlertTitleComponent(title: text)
+ )
+ ))
}
- applyImpl = { [weak contentNode] in
- guard let contentNode = contentNode else {
- return
- }
- apply(contentNode.value)
+ if let subtitle {
+ content.append(AnyComponentWithIdentity(
+ id: "text",
+ component: AnyComponent(
+ AlertTextComponent(content: .plain(subtitle))
+ )
+ ))
+ }
+ content.append(AnyComponentWithIdentity(
+ id: "input",
+ component: AnyComponent(
+ AlertMultilineInputFieldComponent(
+ context: context,
+ initialValue: value.flatMap { NSAttributedString(string: $0) },
+ placeholder: placeholder ?? "",
+ characterLimit: characterLimit,
+ formatMenuAvailability: .none,
+ emptyLineHandling: .notAllowed,
+ isInitiallyFocused: true,
+ externalState: inputState
+ )
+ )
+ ))
+
+ var effectiveUpdatedPresentationData: (PresentationData, Signal)
+ if let updatedPresentationData {
+ effectiveUpdatedPresentationData = updatedPresentationData
+ } else {
+ effectiveUpdatedPresentationData = (presentationData, context.sharedContext.presentationData)
}
- let controller = AlertController(theme: AlertControllerTheme(presentationData: presentationData), contentNode: contentNode)
- let presentationDataDisposable = (updatedPresentationData?.signal ?? sharedContext.presentationData).start(next: { [weak controller, weak contentNode] presentationData in
- controller?.theme = AlertControllerTheme(presentationData: presentationData)
- contentNode?.inputFieldNode.updateTheme(presentationData.theme)
- })
- controller.dismissed = { _ in
- presentationDataDisposable.dispose()
- }
- dismissImpl = { [weak controller] animated in
- contentNode.inputFieldNode.deactivateInput()
- if animated {
- controller?.dismissAnimated()
- } else {
- controller?.dismiss()
+ let alertController = AlertScreen(
+ configuration: AlertScreen.Configuration(allowInputInset: true),
+ content: content,
+ actions: [
+ .init(title: strings.Common_Cancel, action: {
+ apply(nil)
+ }),
+ .init(title: strings.Common_Done, type: .default, action: {
+ apply(inputState.value.string)
+ })
+ ],
+ updatedPresentationData: effectiveUpdatedPresentationData
+ )
+ alertController.dismissed = { byOutsideTap in
+ if byOutsideTap {
+ dismissed()
}
}
- return controller
+ return alertController
}
private final class AuthAlertContentNode: AlertContentNode {
diff --git a/submodules/QrCodeUI/BUILD b/submodules/QrCodeUI/BUILD
index 0308b422..e7eb7e22 100644
--- a/submodules/QrCodeUI/BUILD
+++ b/submodules/QrCodeUI/BUILD
@@ -31,6 +31,15 @@ swift_library(
"//submodules/LegacyComponents:LegacyComponents",
"//submodules/LegacyMediaPickerUI:LegacyMediaPickerUI",
"//submodules/ImageContentAnalysis:ImageContentAnalysis",
+ "//submodules/ComponentFlow",
+ "//submodules/Components/SheetComponent",
+ "//submodules/TelegramUI/Components/ButtonComponent",
+ "//submodules/TelegramUI/Components/GlassBarButtonComponent",
+ "//submodules/Components/BundleIconComponent",
+ "//submodules/Components/BalancedTextComponent",
+ "//submodules/Components/MultilineTextComponent",
+ "//submodules/TelegramUI/Components/LottieComponent",
+ "//submodules/TelegramUI/Components/PlainButtonComponent",
],
visibility = [
"//visibility:public",
diff --git a/submodules/QrCodeUI/Sources/QrCodeScanScreen.swift b/submodules/QrCodeUI/Sources/QrCodeScanScreen.swift
index 3649da5e..ceab808e 100644
--- a/submodules/QrCodeUI/Sources/QrCodeScanScreen.swift
+++ b/submodules/QrCodeUI/Sources/QrCodeScanScreen.swift
@@ -77,7 +77,7 @@ public final class QrCodeScanScreen: ViewController {
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
- let navigationBarTheme = NavigationBarTheme(buttonColor: .white, disabledButtonColor: .white, primaryTextColor: .white, backgroundColor: .clear, enableBackgroundBlur: false, separatorColor: .clear, badgeBackgroundColor: .clear, badgeStrokeColor: .clear, badgeTextColor: .clear)
+ let navigationBarTheme = NavigationBarTheme(overallDarkAppearance: self.presentationData.theme.overallDarkAppearance, buttonColor: .white, disabledButtonColor: .white, primaryTextColor: .white, backgroundColor: .clear, enableBackgroundBlur: false, separatorColor: .clear, badgeBackgroundColor: .clear, badgeStrokeColor: .clear, badgeTextColor: .clear)
super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: navigationBarTheme, strings: NavigationBarStrings(back: self.presentationData.strings.Common_Back, close: self.presentationData.strings.Common_Close)))
diff --git a/submodules/QrCodeUI/Sources/QrCodeScreen.swift b/submodules/QrCodeUI/Sources/QrCodeScreen.swift
index 94a293a0..9c975cc2 100644
--- a/submodules/QrCodeUI/Sources/QrCodeScreen.swift
+++ b/submodules/QrCodeUI/Sources/QrCodeScreen.swift
@@ -1,17 +1,23 @@
import Foundation
import UIKit
-import AsyncDisplayKit
import Display
+import ComponentFlow
import SwiftSignalKit
import TelegramCore
import TelegramPresentationData
-import AppBundle
-import QrCode
+import ViewControllerComponent
+import SheetComponent
+import BalancedTextComponent
+import MultilineTextComponent
+import BundleIconComponent
+import ButtonComponent
+import GlassBarButtonComponent
+import PlainButtonComponent
import AccountContext
-import SolidRoundedButtonNode
-import AnimatedStickerNode
-import TelegramAnimatedStickerNode
-import PresentationDataUtils
+import Markdown
+import TextFormat
+import QrCode
+import LottieComponent
private func shareQrCode(context: AccountContext, link: String, ecl: String, view: UIView) {
let _ = (qrCode(string: link, color: .black, backgroundColor: .white, icon: .custom(UIImage(bundleImageName: "Chat/Links/QrLogo")), ecl: ecl)
@@ -24,7 +30,7 @@ private func shareQrCode(context: AccountContext, link: String, ecl: String, vie
guard let image = image else {
return
}
-
+
let activityController = UIActivityViewController(activityItems: [image], applicationActivities: nil)
if let window = view.window {
activityController.popoverPresentationController?.sourceView = window
@@ -34,13 +40,336 @@ private func shareQrCode(context: AccountContext, link: String, ecl: String, vie
})
}
-public final class QrCodeScreen: ViewController {
+private final class SheetContent: CombinedComponent {
+ typealias EnvironmentType = ViewControllerComponentContainer.Environment
+
+ let context: AccountContext
+ let subject: QrCodeScreen.Subject
+ let dismiss: () -> Void
+
+ init(
+ context: AccountContext,
+ subject: QrCodeScreen.Subject,
+ dismiss: @escaping () -> Void
+ ) {
+ self.context = context
+ self.subject = subject
+ self.dismiss = dismiss
+ }
+
+ static func ==(lhs: SheetContent, rhs: SheetContent) -> Bool {
+ if lhs.context !== rhs.context {
+ return false
+ }
+ return true
+ }
+
+ final class State: ComponentState {
+ private let idleTimerExtensionDisposable = MetaDisposable()
+
+ private var initialBrightness: CGFloat?
+ private var brightnessArguments: (Double, Double, CGFloat, CGFloat)?
+ private var animator: ConstantDisplayLinkAnimator?
+
+ init(context: AccountContext) {
+ super.init()
+
+ self.idleTimerExtensionDisposable.set(context.sharedContext.applicationBindings.pushIdleTimerExtension())
+
+ self.animator = ConstantDisplayLinkAnimator(update: { [weak self] in
+ self?.updateBrightness()
+ })
+ self.animator?.isPaused = true
+
+ self.initialBrightness = UIScreen.main.brightness
+ self.brightnessArguments = (CACurrentMediaTime(), 0.3, UIScreen.main.brightness, 1.0)
+ self.updateBrightness()
+ }
+
+ deinit {
+ self.idleTimerExtensionDisposable.dispose()
+ self.animator?.invalidate()
+
+ if UIScreen.main.brightness > 0.99, let initialBrightness = self.initialBrightness {
+ self.brightnessArguments = (CACurrentMediaTime(), 0.3, UIScreen.main.brightness, initialBrightness)
+ self.updateBrightness()
+ }
+ }
+
+ private func updateBrightness() {
+ if let (startTime, duration, initial, target) = self.brightnessArguments {
+ self.animator?.isPaused = false
+
+ let t = CGFloat(max(0.0, min(1.0, (CACurrentMediaTime() - startTime) / duration)))
+ let value = initial + (target - initial) * t
+
+ UIScreen.main.brightness = value
+
+ if t >= 1.0 {
+ self.brightnessArguments = nil
+ self.animator?.isPaused = true
+ }
+ } else {
+ self.animator?.isPaused = true
+ }
+ }
+ }
+
+ func makeState() -> State {
+ return State(context: self.context)
+ }
+
+ static var body: Body {
+ let qrCode = Child(PlainButtonComponent.self)
+ let closeButton = Child(GlassBarButtonComponent.self)
+ let title = Child(Text.self)
+ let text = Child(BalancedTextComponent.self)
+
+ let button = Child(ButtonComponent.self)
+
+ return { context in
+ let environment = context.environment[EnvironmentType.self]
+ let component = context.component
+ let controller = environment.controller()
+
+ let theme = environment.theme
+ let strings = environment.strings
+
+ let link = component.subject.link
+ let ecl = component.subject.ecl
+
+ let titleString: String
+ let textString: String
+ switch component.subject {
+ case let .invite(_, type):
+ titleString = strings.InviteLink_QRCode_Title
+ switch type {
+ case .group:
+ textString = strings.InviteLink_QRCode_Info
+ case .channel:
+ textString = strings.InviteLink_QRCode_InfoChannel
+ case .groupCall:
+ textString = strings.InviteLink_QRCode_InfoGroupCall
+ }
+ case .chatFolder:
+ titleString = strings.InviteLink_QRCodeFolder_Title
+ textString = strings.InviteLink_QRCodeFolder_Text
+ default:
+ titleString = ""
+ textString = ""
+ }
+
+ var contentSize = CGSize(width: context.availableSize.width, height: 36.0)
+
+ let closeButton = closeButton.update(
+ component: GlassBarButtonComponent(
+ size: CGSize(width: 40.0, height: 40.0),
+ backgroundColor: theme.rootController.navigationBar.glassBarButtonBackgroundColor,
+ isDark: theme.overallDarkAppearance,
+ state: .generic,
+ component: AnyComponentWithIdentity(id: "close", component: AnyComponent(
+ BundleIconComponent(
+ name: "Navigation/Close",
+ tintColor: theme.rootController.navigationBar.glassBarButtonForegroundColor
+ )
+ )),
+ action: { _ in
+ component.dismiss()
+ }
+ ),
+ availableSize: CGSize(width: 40.0, height: 40.0),
+ transition: .immediate
+ )
+ context.add(closeButton
+ .position(CGPoint(x: 16.0 + closeButton.size.width / 2.0, y: 16.0 + closeButton.size.height / 2.0))
+ )
+
+ let constrainedTitleWidth = context.availableSize.width - 16.0 * 2.0
+
+ let title = title.update(
+ component: Text(text: titleString, font: Font.semibold(17.0), color: theme.list.itemPrimaryTextColor),
+ availableSize: CGSize(width: constrainedTitleWidth, height: context.availableSize.height),
+ transition: .immediate
+ )
+ context.add(title
+ .position(CGPoint(x: context.availableSize.width / 2.0, y: contentSize.height))
+ )
+ contentSize.height += title.size.height
+ contentSize.height += 13.0
+
+ let qrCode = qrCode.update(
+ component: PlainButtonComponent(
+ content: AnyComponent(QrCodeComponent(context: component.context, link: link, ecl: ecl)),
+ action: { [weak controller] in
+ if let view = controller?.view {
+ shareQrCode(context: component.context, link: link, ecl: ecl, view: view)
+ }
+ },
+ animateScale: false
+ ),
+ availableSize: CGSize(width: 260.0, height: 260.0),
+ transition: .immediate
+ )
+ context.add(qrCode
+ .position(CGPoint(x: context.availableSize.width / 2.0, y: contentSize.height + qrCode.size.height / 2.0))
+ )
+ contentSize.height += qrCode.size.height
+ contentSize.height += 17.0
+
+ let textFont = Font.regular(15.0)
+ let boldTextFont = Font.semibold(15.0)
+ let textColor = theme.actionSheet.primaryTextColor
+ let linkColor = theme.actionSheet.controlAccentColor
+ let markdownAttributes = MarkdownAttributes(body: MarkdownAttributeSet(font: textFont, textColor: textColor), bold: MarkdownAttributeSet(font: boldTextFont, textColor: textColor), link: MarkdownAttributeSet(font: textFont, textColor: linkColor), linkAttribute: { contents in
+ return (TelegramTextAttributes.URL, contents)
+ })
+
+ let text = text.update(
+ component: BalancedTextComponent(
+ text: .markdown(
+ text: textString,
+ attributes: markdownAttributes
+ ),
+ horizontalAlignment: .center,
+ maximumNumberOfLines: 0,
+ lineSpacing: 0.2
+ ),
+ availableSize: CGSize(width: constrainedTitleWidth, height: context.availableSize.height),
+ transition: .immediate
+ )
+ context.add(text
+ .position(CGPoint(x: context.availableSize.width / 2.0, y: contentSize.height + text.size.height / 2.0))
+ )
+ contentSize.height += text.size.height
+ contentSize.height += 23.0
+
+ let buttonInsets = ContainerViewLayout.concentricInsets(bottomInset: environment.safeInsets.bottom, innerDiameter: 52.0, sideInset: 30.0)
+ let button = button.update(
+ component: ButtonComponent(
+ background: ButtonComponent.Background(
+ style: .glass,
+ color: theme.list.itemCheckColors.fillColor,
+ foreground: theme.list.itemCheckColors.foregroundColor,
+ pressedColor: theme.list.itemCheckColors.fillColor.withMultipliedAlpha(0.9),
+ cornerRadius: 10.0,
+ ),
+ content: AnyComponentWithIdentity(
+ id: AnyHashable(0),
+ component: AnyComponent(MultilineTextComponent(text: .plain(NSMutableAttributedString(string: strings.InviteLink_QRCode_Share, font: Font.semibold(17.0), textColor: theme.list.itemCheckColors.foregroundColor, paragraphAlignment: .center))))
+ ),
+ isEnabled: true,
+ displaysProgress: false,
+ action: { [weak controller] in
+ if let view = controller?.view {
+ shareQrCode(context: component.context, link: link, ecl: ecl, view: view)
+ }
+ }
+ ),
+ availableSize: CGSize(width: context.availableSize.width - buttonInsets.left - buttonInsets.right, height: 52.0),
+ transition: .immediate
+ )
+ context.add(button
+ .position(CGPoint(x: context.availableSize.width / 2.0, y: contentSize.height + button.size.height / 2.0))
+ )
+ contentSize.height += button.size.height
+ contentSize.height += buttonInsets.bottom
+
+ return contentSize
+ }
+ }
+}
+
+private final class QrCodeSheetComponent: CombinedComponent {
+ typealias EnvironmentType = ViewControllerComponentContainer.Environment
+
+ private let context: AccountContext
+ private let subject: QrCodeScreen.Subject
+
+ init(
+ context: AccountContext,
+ subject: QrCodeScreen.Subject
+ ) {
+ self.context = context
+ self.subject = subject
+ }
+
+ static func ==(lhs: QrCodeSheetComponent, rhs: QrCodeSheetComponent) -> Bool {
+ if lhs.context !== rhs.context {
+ return false
+ }
+ return true
+ }
+
+ static var body: Body {
+ let sheet = Child(SheetComponent<(EnvironmentType)>.self)
+ let animateOut = StoredActionSlot(Action.self)
+
+ return { context in
+ let environment = context.environment[EnvironmentType.self]
+
+ let controller = environment.controller
+
+ let sheet = sheet.update(
+ component: SheetComponent(
+ content: AnyComponent(SheetContent(
+ context: context.component.context,
+ subject: context.component.subject,
+ dismiss: {
+ animateOut.invoke(Action { _ in
+ if let controller = controller() as? QrCodeScreen {
+ controller.dismiss(completion: nil)
+ }
+ })
+ }
+ )),
+ style: .glass,
+ backgroundColor: .color(environment.theme.actionSheet.opaqueItemBackgroundColor),
+ followContentSizeChanges: true,
+ clipsContent: true,
+ animateOut: animateOut
+ ),
+ environment: {
+ environment
+ SheetComponentEnvironment(
+ isDisplaying: environment.value.isVisible,
+ isCentered: environment.metrics.widthClass == .regular,
+ hasInputHeight: !environment.inputHeight.isZero,
+ regularMetricsSize: CGSize(width: 430.0, height: 900.0),
+ dismiss: { animated in
+ if animated {
+ animateOut.invoke(Action { _ in
+ if let controller = controller() as? QrCodeScreen {
+ controller.dismiss(completion: nil)
+ }
+ })
+ } else {
+ if let controller = controller() as? QrCodeScreen {
+ controller.dismiss(completion: nil)
+ }
+ }
+ }
+ )
+ },
+ availableSize: context.availableSize,
+ transition: context.transition
+ )
+
+ context.add(sheet
+ .position(CGPoint(x: context.availableSize.width / 2.0, y: context.availableSize.height / 2.0))
+ )
+
+ return context.availableSize
+ }
+ }
+}
+
+public final class QrCodeScreen: ViewControllerComponentContainer {
public enum SubjectType {
case group
case channel
case groupCall
}
-
+
public enum Subject {
case peer(peer: EnginePeer)
case invite(invite: ExportedInvitation, type: SubjectType)
@@ -48,471 +377,181 @@ public final class QrCodeScreen: ViewController {
var link: String {
switch self {
- case let .peer(peer):
- return "https://t.me/\(peer.addressName ?? "")"
- case let .invite(invite, _):
- return invite.link ?? ""
- case let .chatFolder(slug):
- if slug.hasPrefix("https://") {
- return slug
- } else {
- return "https://t.me/addlist/\(slug)"
- }
+ case let .peer(peer):
+ return "https://t.me/\(peer.addressName ?? "")"
+ case let .invite(invite, _):
+ return invite.link ?? ""
+ case let .chatFolder(slug):
+ if slug.hasPrefix("https://") {
+ return slug
+ } else {
+ return "https://t.me/addlist/\(slug)"
+ }
}
}
var ecl: String {
switch self {
- case .peer:
- return "Q"
- case .invite:
- return "Q"
- case .chatFolder:
- return "Q"
+ case .peer:
+ return "Q"
+ case .invite:
+ return "Q"
+ case .chatFolder:
+ return "Q"
}
}
}
- private var controllerNode: Node {
- return self.displayNode as! Node
- }
-
- private var animatedIn = false
-
private let context: AccountContext
- private let subject: QrCodeScreen.Subject
- private var presentationData: PresentationData
- private var presentationDataDisposable: Disposable?
-
- private var initialBrightness: CGFloat?
- private var brightnessArguments: (Double, Double, CGFloat, CGFloat)?
-
- private var animator: ConstantDisplayLinkAnimator?
-
- private let idleTimerExtensionDisposable = MetaDisposable()
-
- public init(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal)? = nil, subject: QrCodeScreen.Subject) {
+ public init(
+ context: AccountContext,
+ updatedPresentationData: (initial: PresentationData, signal: Signal)? = nil,
+ subject: QrCodeScreen.Subject
+ ) {
self.context = context
- self.subject = subject
- self.presentationData = updatedPresentationData?.initial ?? context.sharedContext.currentPresentationData.with { $0 }
+ super.init(
+ context: context,
+ component: QrCodeSheetComponent(
+ context: context,
+ subject: subject
+ ),
+ navigationBarAppearance: .none,
+ statusBarStyle: .ignore,
+ theme: .default //
+ )
- super.init(navigationBarPresentationData: nil)
-
- self.statusBar.statusBarStyle = .Ignore
-
- self.blocksBackgroundWhenInOverlay = true
-
- self.presentationDataDisposable = ((updatedPresentationData?.signal ?? context.sharedContext.presentationData)
- |> deliverOnMainQueue).start(next: { [weak self] presentationData in
- if let strongSelf = self {
- strongSelf.presentationData = presentationData
- strongSelf.controllerNode.updatePresentationData(presentationData)
- }
- })
-
- self.idleTimerExtensionDisposable.set(self.context.sharedContext.applicationBindings.pushIdleTimerExtension())
-
- self.statusBar.statusBarStyle = .Ignore
-
- self.animator = ConstantDisplayLinkAnimator(update: { [weak self] in
- self?.updateBrightness()
- })
- self.animator?.isPaused = true
+ self.navigationPresentation = .flatModal
}
-
- required init(coder aDecoder: NSCoder) {
+
+ required public init(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
- deinit {
- self.presentationDataDisposable?.dispose()
- self.idleTimerExtensionDisposable.dispose()
- self.animator?.invalidate()
- }
-
- override public func loadDisplayNode() {
- self.displayNode = Node(context: self.context, presentationData: self.presentationData, subject: self.subject)
- self.controllerNode.dismiss = { [weak self] in
- self?.presentingViewController?.dismiss(animated: false, completion: nil)
- }
- self.controllerNode.cancel = { [weak self] in
- self?.dismiss()
- }
- }
-
- override public func viewDidAppear(_ animated: Bool) {
- super.viewDidAppear(animated)
-
- if !self.animatedIn {
- self.animatedIn = true
- self.controllerNode.animateIn()
-
- self.initialBrightness = UIScreen.main.brightness
- self.brightnessArguments = (CACurrentMediaTime(), 0.3, UIScreen.main.brightness, 1.0)
- self.updateBrightness()
- }
- }
-
- private func updateBrightness() {
- if let (startTime, duration, initial, target) = self.brightnessArguments {
- self.animator?.isPaused = false
-
- let t = CGFloat(max(0.0, min(1.0, (CACurrentMediaTime() - startTime) / duration)))
- let value = initial + (target - initial) * t
-
- UIScreen.main.brightness = value
-
- if t >= 1.0 {
- self.brightnessArguments = nil
- self.animator?.isPaused = true
- }
- } else {
- self.animator?.isPaused = true
- }
- }
-
- override public func dismiss(completion: (() -> Void)? = nil) {
- if UIScreen.main.brightness > 0.99, let initialBrightness = self.initialBrightness {
- self.brightnessArguments = (CACurrentMediaTime(), 0.3, UIScreen.main.brightness, initialBrightness)
- self.updateBrightness()
- }
-
- self.controllerNode.animateOut(completion: completion)
- }
-
- override public func containerLayoutUpdated(_ layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) {
- super.containerLayoutUpdated(layout, transition: transition)
-
- self.controllerNode.containerLayoutUpdated(layout, navigationBarHeight: self.navigationLayout(layout: layout).navigationFrame.maxY, transition: transition)
- }
-
- class Node: ViewControllerTracingNode, ASScrollViewDelegate {
- private let context: AccountContext
- private let subject: QrCodeScreen.Subject
- private var presentationData: PresentationData
-
- private let dimNode: ASDisplayNode
- private let wrappingScrollNode: ASScrollNode
- private let contentContainerNode: ASDisplayNode
- private let backgroundNode: ASDisplayNode
- private let contentBackgroundNode: ASDisplayNode
- private let titleNode: ASTextNode
- private let cancelButton: HighlightableButtonNode
-
- private let textNode: ImmediateTextNode
- private let qrButtonNode: HighlightTrackingButtonNode
- private let qrImageNode: TransformImageNode
- private let qrIconNode: AnimatedStickerNode
- private var qrCodeSize: Int?
- private let buttonNode: SolidRoundedButtonNode
-
- private var containerLayout: (ContainerViewLayout, CGFloat)?
-
- var completion: ((Int32) -> Void)?
- var dismiss: (() -> Void)?
- var cancel: (() -> Void)?
-
- init(context: AccountContext, presentationData: PresentationData, subject: QrCodeScreen.Subject) {
- self.context = context
- self.subject = subject
- self.presentationData = presentationData
-
- self.wrappingScrollNode = ASScrollNode()
- self.wrappingScrollNode.view.alwaysBounceVertical = true
- self.wrappingScrollNode.view.delaysContentTouches = false
- self.wrappingScrollNode.view.canCancelContentTouches = true
-
- self.dimNode = ASDisplayNode()
- self.dimNode.backgroundColor = UIColor(white: 0.0, alpha: 0.5)
-
- self.contentContainerNode = ASDisplayNode()
- self.contentContainerNode.isOpaque = false
-
- self.backgroundNode = ASDisplayNode()
- self.backgroundNode.clipsToBounds = true
- self.backgroundNode.cornerRadius = 16.0
-
- let backgroundColor = self.presentationData.theme.actionSheet.opaqueItemBackgroundColor
- let textColor = self.presentationData.theme.actionSheet.primaryTextColor
- let secondaryTextColor = self.presentationData.theme.actionSheet.secondaryTextColor
- let accentColor = self.presentationData.theme.actionSheet.controlAccentColor
-
- self.contentBackgroundNode = ASDisplayNode()
- self.contentBackgroundNode.backgroundColor = backgroundColor
-
- let title: String
- let text: String
- switch subject {
- case let .invite(_, type):
- title = self.presentationData.strings.InviteLink_QRCode_Title
- switch type {
- case .group:
- text = self.presentationData.strings.InviteLink_QRCode_Info
- case .channel:
- text = self.presentationData.strings.InviteLink_QRCode_InfoChannel
- case .groupCall:
- text = self.presentationData.strings.InviteLink_QRCode_InfoGroupCall
- }
- case .chatFolder:
- title = self.presentationData.strings.InviteLink_QRCodeFolder_Title
- text = self.presentationData.strings.InviteLink_QRCodeFolder_Text
- default:
- title = ""
- text = ""
- }
-
- self.titleNode = ASTextNode()
- self.titleNode.attributedText = NSAttributedString(string: title, font: Font.bold(17.0), textColor: textColor)
-
- self.cancelButton = HighlightableButtonNode()
- self.cancelButton.setTitle(self.presentationData.strings.Common_Done, with: Font.bold(17.0), with: accentColor, for: .normal)
-
- self.buttonNode = SolidRoundedButtonNode(theme: SolidRoundedButtonTheme(theme: self.presentationData.theme), height: 52.0, cornerRadius: 11.0, isShimmering: false)
-
- self.textNode = ImmediateTextNode()
- self.textNode.maximumNumberOfLines = 3
- self.textNode.textAlignment = .center
-
- self.qrButtonNode = HighlightTrackingButtonNode()
- self.qrImageNode = TransformImageNode()
- self.qrImageNode.clipsToBounds = true
- self.qrImageNode.cornerRadius = 16.0
-
- self.qrIconNode = DefaultAnimatedStickerNodeImpl()
- self.qrIconNode.setup(source: AnimatedStickerNodeLocalFileSource(name: "PlaneLogo"), width: 240, height: 240, playbackMode: .loop, mode: .direct(cachePathPrefix: nil))
- self.qrIconNode.visibility = true
-
- super.init()
-
- self.backgroundColor = nil
- self.isOpaque = false
-
- self.dimNode.view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.dimTapGesture(_:))))
- self.addSubnode(self.dimNode)
-
- self.wrappingScrollNode.view.delegate = self.wrappedScrollViewDelegate
- self.addSubnode(self.wrappingScrollNode)
-
- self.wrappingScrollNode.addSubnode(self.backgroundNode)
- self.wrappingScrollNode.addSubnode(self.contentContainerNode)
-
- self.backgroundNode.addSubnode(self.contentBackgroundNode)
- self.contentContainerNode.addSubnode(self.titleNode)
- self.contentContainerNode.addSubnode(self.cancelButton)
- self.contentContainerNode.addSubnode(self.buttonNode)
-
- self.contentContainerNode.addSubnode(self.textNode)
- self.contentContainerNode.addSubnode(self.qrImageNode)
- self.contentContainerNode.addSubnode(self.qrIconNode)
- self.contentContainerNode.addSubnode(self.qrButtonNode)
-
- self.textNode.attributedText = NSAttributedString(string: text, font: Font.regular(14.0), textColor: secondaryTextColor)
- self.buttonNode.title = self.presentationData.strings.InviteLink_QRCode_Share
-
- self.cancelButton.addTarget(self, action: #selector(self.cancelButtonPressed), forControlEvents: .touchUpInside)
- self.buttonNode.pressed = { [weak self] in
- if let strongSelf = self{
- shareQrCode(context: strongSelf.context, link: subject.link, ecl: subject.ecl, view: strongSelf.view)
- }
- }
-
- self.qrImageNode.setSignal(qrCode(string: subject.link, color: .black, backgroundColor: .white, icon: .cutout, ecl: subject.ecl) |> beforeNext { [weak self] size, _ in
- guard let strongSelf = self else {
- return
- }
- strongSelf.qrCodeSize = size
- if let (layout, navigationHeight) = strongSelf.containerLayout {
- strongSelf.containerLayoutUpdated(layout, navigationBarHeight: navigationHeight, transition: .immediate)
- }
- } |> map { $0.1 }, attemptSynchronously: true)
-
- self.qrButtonNode.addTarget(self, action: #selector(self.qrPressed), forControlEvents: .touchUpInside)
- self.qrButtonNode.highligthedChanged = { [weak self] highlighted in
- guard let strongSelf = self else {
- return
- }
- if highlighted {
- strongSelf.qrImageNode.alpha = 0.4
- strongSelf.qrIconNode.alpha = 0.4
- } else {
- strongSelf.qrImageNode.layer.animateAlpha(from: strongSelf.qrImageNode.alpha, to: 1.0, duration: 0.2)
- strongSelf.qrImageNode.alpha = 1.0
- strongSelf.qrIconNode.layer.animateAlpha(from: strongSelf.qrIconNode.alpha, to: 1.0, duration: 0.2)
- strongSelf.qrIconNode.alpha = 1.0
- }
- }
- }
-
- @objc private func qrPressed() {
- self.buttonNode.pressed?()
- }
-
- func updatePresentationData(_ presentationData: PresentationData) {
- let previousTheme = self.presentationData.theme
- self.presentationData = presentationData
-
- self.contentBackgroundNode.backgroundColor = self.presentationData.theme.actionSheet.opaqueItemBackgroundColor
- self.titleNode.attributedText = NSAttributedString(string: self.titleNode.attributedText?.string ?? "", font: Font.bold(17.0), textColor: self.presentationData.theme.actionSheet.primaryTextColor)
- self.textNode.attributedText = NSAttributedString(string: self.textNode.attributedText?.string ?? "", font: Font.regular(13.0), textColor: self.presentationData.theme.actionSheet.secondaryTextColor)
-
- if previousTheme !== presentationData.theme, let (layout, navigationBarHeight) = self.containerLayout {
- self.containerLayoutUpdated(layout, navigationBarHeight: navigationBarHeight, transition: .immediate)
- }
-
- self.cancelButton.setTitle(self.presentationData.strings.Common_Done, with: Font.bold(17.0), with: self.presentationData.theme.actionSheet.controlAccentColor, for: .normal)
- self.buttonNode.updateTheme(SolidRoundedButtonTheme(theme: self.presentationData.theme))
- }
-
- override func didLoad() {
- super.didLoad()
-
- if #available(iOSApplicationExtension 11.0, iOS 11.0, *) {
- self.wrappingScrollNode.view.contentInsetAdjustmentBehavior = .never
- }
- }
-
- @objc func cancelButtonPressed() {
- self.cancel?()
- }
-
- @objc func dimTapGesture(_ recognizer: UITapGestureRecognizer) {
- if case .ended = recognizer.state {
- self.cancelButtonPressed()
- }
- }
-
- func animateIn() {
- self.dimNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.4)
-
- let offset = self.bounds.size.height - self.contentBackgroundNode.frame.minY
-
- let dimPosition = self.dimNode.layer.position
- self.dimNode.layer.animatePosition(from: CGPoint(x: dimPosition.x, y: dimPosition.y - offset), to: dimPosition, duration: 0.3, timingFunction: kCAMediaTimingFunctionSpring)
- self.layer.animateBoundsOriginYAdditive(from: -offset, to: 0.0, duration: 0.3, timingFunction: kCAMediaTimingFunctionSpring)
- }
-
- func animateOut(completion: (() -> Void)? = nil) {
- var dimCompleted = false
- var offsetCompleted = false
-
- let internalCompletion: () -> Void = { [weak self] in
- if let strongSelf = self, dimCompleted && offsetCompleted {
- strongSelf.dismiss?()
- }
- completion?()
- }
-
- self.dimNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.3, removeOnCompletion: false, completion: { _ in
- dimCompleted = true
- internalCompletion()
- })
-
- let offset = self.bounds.size.height - self.contentBackgroundNode.frame.minY
- let dimPosition = self.dimNode.layer.position
- self.dimNode.layer.animatePosition(from: dimPosition, to: CGPoint(x: dimPosition.x, y: dimPosition.y - offset), duration: 0.3, timingFunction: kCAMediaTimingFunctionSpring, removeOnCompletion: false)
- self.layer.animateBoundsOriginYAdditive(from: 0.0, to: -offset, duration: 0.3, timingFunction: kCAMediaTimingFunctionSpring, removeOnCompletion: false, completion: { _ in
- offsetCompleted = true
- internalCompletion()
- })
- }
-
- override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
- if self.bounds.contains(point) {
- if !self.contentBackgroundNode.bounds.contains(self.convert(point, to: self.contentBackgroundNode)) {
- return self.dimNode.view
- }
- }
- return super.hitTest(point, with: event)
- }
-
- func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
- let contentOffset = scrollView.contentOffset
- let additionalTopHeight = max(0.0, -contentOffset.y)
-
- if additionalTopHeight >= 30.0 {
- self.cancelButtonPressed()
- }
- }
-
- func containerLayoutUpdated(_ layout: ContainerViewLayout, navigationBarHeight: CGFloat, transition: ContainedViewLayoutTransition) {
- self.containerLayout = (layout, navigationBarHeight)
-
- var insets = layout.insets(options: [.statusBar, .input])
- insets.top = 32.0
-
- let makeImageLayout = self.qrImageNode.asyncLayout()
- let imageSide: CGFloat = 240.0
- let imageSize = CGSize(width: imageSide, height: imageSide)
- let imageApply = makeImageLayout(TransformImageArguments(corners: ImageCorners(), imageSize: imageSize, boundingSize: imageSize, intrinsicInsets: UIEdgeInsets(), emptyColor: nil))
- let _ = imageApply()
-
- let width = horizontalContainerFillingSizeForLayout(layout: layout, sideInset: 0.0)
-
- let imageFrame = CGRect(origin: CGPoint(x: floor((width - imageSize.width) / 2.0), y: insets.top + 16.0), size: imageSize)
- transition.updateFrame(node: self.qrImageNode, frame: imageFrame)
- transition.updateFrame(node: self.qrButtonNode, frame: imageFrame)
-
- if let qrCodeSize = self.qrCodeSize {
- let (_, cutoutFrame, _) = qrCodeCutout(size: qrCodeSize, dimensions: imageSize, scale: nil)
- self.qrIconNode.updateLayout(size: cutoutFrame.size)
- transition.updateBounds(node: self.qrIconNode, bounds: CGRect(origin: CGPoint(), size: cutoutFrame.size))
- transition.updatePosition(node: self.qrIconNode, position: imageFrame.center.offsetBy(dx: 0.0, dy: -1.0))
- }
-
- let inset: CGFloat = 32.0
- var textSize = self.textNode.updateLayout(CGSize(width: width - inset * 3.0, height: CGFloat.greatestFiniteMagnitude))
- let textFrame = CGRect(origin: CGPoint(x: floor((width - textSize.width) / 2.0), y: imageFrame.maxY + 20.0), size: textSize)
- transition.updateFrame(node: self.textNode, frame: textFrame)
-
- var textSpacing: CGFloat = 111.0
- if case .compact = layout.metrics.widthClass, layout.size.width > layout.size.height {
- textSize = CGSize()
- self.textNode.isHidden = true
- textSpacing = 52.0
- } else {
- self.textNode.isHidden = false
- }
-
- let buttonSideInset: CGFloat = 16.0
- let bottomInset = insets.bottom + 10.0
- let buttonWidth = layout.size.width - buttonSideInset * 2.0
- let buttonHeight: CGFloat = 50.0
-
- let buttonFrame = CGRect(origin: CGPoint(x: floor((width - buttonWidth) / 2.0), y: layout.size.height - bottomInset - buttonHeight), size: CGSize(width: buttonWidth, height: buttonHeight))
- transition.updateFrame(node: self.buttonNode, frame: buttonFrame)
- let _ = self.buttonNode.updateLayout(width: buttonFrame.width, transition: transition)
-
- let titleHeight: CGFloat = 54.0
- let contentHeight = titleHeight + textSize.height + imageSize.height + bottomInset + textSpacing
-
- let sideInset = floor((layout.size.width - width) / 2.0)
- let contentContainerFrame = CGRect(origin: CGPoint(x: sideInset, y: layout.size.height - contentHeight), size: CGSize(width: width, height: contentHeight))
- let contentFrame = contentContainerFrame
-
- var backgroundFrame = CGRect(origin: CGPoint(x: contentFrame.minX, y: contentFrame.minY), size: CGSize(width: contentFrame.width, height: contentFrame.height + 2000.0))
- if backgroundFrame.minY < contentFrame.minY {
- backgroundFrame.origin.y = contentFrame.minY
- }
- transition.updateFrame(node: self.backgroundNode, frame: backgroundFrame)
- transition.updateFrame(node: self.contentBackgroundNode, frame: CGRect(origin: CGPoint(), size: backgroundFrame.size))
- transition.updateFrame(node: self.wrappingScrollNode, frame: CGRect(origin: CGPoint(), size: layout.size))
- transition.updateFrame(node: self.dimNode, frame: CGRect(origin: CGPoint(), size: layout.size))
-
- let titleSize = self.titleNode.measure(CGSize(width: width, height: titleHeight))
- let titleFrame = CGRect(origin: CGPoint(x: floor((contentFrame.width - titleSize.width) / 2.0), y: 16.0), size: titleSize)
- transition.updateFrame(node: self.titleNode, frame: titleFrame)
-
- let cancelSize = self.cancelButton.measure(CGSize(width: width, height: titleHeight))
- let cancelFrame = CGRect(origin: CGPoint(x: width - cancelSize.width - 16.0, y: 16.0), size: cancelSize)
- transition.updateFrame(node: self.cancelButton, frame: cancelFrame)
-
- let buttonInset: CGFloat = 16.0
- let doneButtonHeight = self.buttonNode.updateLayout(width: contentFrame.width - buttonInset * 2.0, transition: transition)
- transition.updateFrame(node: self.buttonNode, frame: CGRect(x: buttonInset, y: contentHeight - doneButtonHeight - insets.bottom - 16.0, width: contentFrame.width, height: doneButtonHeight))
-
- transition.updateFrame(node: self.contentContainerNode, frame: contentContainerFrame)
+ public func dismissAnimated() {
+ if let view = self.node.hostView.findTaggedView(tag: SheetComponent.View.Tag()) as? SheetComponent.View {
+ view.dismissAnimated()
}
}
}
+
+private final class QrCodeComponent: Component {
+ let context: AccountContext
+ let link: String
+ let ecl: String
+
+ init(
+ context: AccountContext,
+ link: String,
+ ecl: String
+ ) {
+ self.context = context
+ self.link = link
+ self.ecl = ecl
+ }
+
+ static func ==(lhs: QrCodeComponent, rhs: QrCodeComponent) -> Bool {
+ if lhs.context !== rhs.context {
+ return false
+ }
+ if lhs.link != rhs.link {
+ return false
+ }
+ if lhs.ecl != rhs.ecl {
+ return false
+ }
+ return true
+ }
+
+ final class View: UIView {
+ private var component: QrCodeComponent?
+ private var state: EmptyComponentState?
+
+ private let imageNode: TransformImageNode
+ private let icon = ComponentView()
+
+ private var qrCodeSize: Int?
+
+ private var isUpdating = false
+
+ override init(frame: CGRect) {
+ self.imageNode = TransformImageNode()
+
+ super.init(frame: frame)
+
+ self.backgroundColor = UIColor.white
+ self.clipsToBounds = true
+ self.layer.cornerRadius = 24.0
+ self.layer.allowsGroupOpacity = true
+
+ self.addSubview(self.imageNode.view)
+ }
+
+ required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+
+ func update(component: QrCodeComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment, transition: ComponentTransition) -> CGSize {
+ self.isUpdating = true
+ defer {
+ self.isUpdating = false
+ }
+ let previousComponent = self.component
+ self.component = component
+ self.state = state
+
+ if previousComponent?.link != component.link {
+ self.imageNode.setSignal(qrCode(string: component.link, color: .black, backgroundColor: .white, icon: .cutout, ecl: component.ecl) |> beforeNext { [weak self] size, _ in
+ guard let self else {
+ return
+ }
+ self.qrCodeSize = size
+ if !self.isUpdating {
+ self.state?.updated()
+ }
+ } |> map { $0.1 }, attemptSynchronously: true)
+ }
+
+ let size = CGSize(width: 256.0, height: 256.0)
+ let imageSize = CGSize(width: 240.0, height: 240.0)
+
+ let makeImageLayout = self.imageNode.asyncLayout()
+ let imageApply = makeImageLayout(TransformImageArguments(corners: ImageCorners(), imageSize: imageSize, boundingSize: imageSize, intrinsicInsets: UIEdgeInsets(), emptyColor: nil))
+ let _ = imageApply()
+ let imageFrame = CGRect(origin: CGPoint(x: (size.width - imageSize.width) / 2.0, y: (size.height - imageSize.height) / 2.0), size: imageSize)
+ self.imageNode.frame = imageFrame
+
+ if let qrCodeSize = self.qrCodeSize {
+ let (_, cutoutFrame, _) = qrCodeCutout(size: qrCodeSize, dimensions: imageSize, scale: nil)
+
+ let _ = self.icon.update(
+ transition: .immediate,
+ component: AnyComponent(LottieComponent(
+ content: LottieComponent.AppBundleContent(name: "PlaneLogo"),
+ loop: true
+ )),
+ environment: {},
+ containerSize: cutoutFrame.size
+ )
+ if let iconView = self.icon.view {
+ if iconView.superview == nil {
+ self.addSubview(iconView)
+ }
+ iconView.bounds = CGRect(origin: CGPoint(), size: cutoutFrame.size)
+ iconView.center = imageFrame.center.offsetBy(dx: 0.0, dy: -1.0)
+ }
+ }
+
+ return size
+ }
+ }
+
+ func makeView() -> View {
+ return View(frame: CGRect())
+ }
+
+ func update(view: View, availableSize: CGSize, state: EmptyComponentState, environment: Environment, transition: ComponentTransition) -> CGSize {
+ return view.update(component: self, availableSize: availableSize, state: state, environment: environment, transition: transition)
+ }
+}
diff --git a/submodules/SearchBarNode/BUILD b/submodules/SearchBarNode/BUILD
index 1842fa27..343809aa 100644
--- a/submodules/SearchBarNode/BUILD
+++ b/submodules/SearchBarNode/BUILD
@@ -21,6 +21,8 @@ swift_library(
"//submodules/AvatarNode:AvatarNode",
"//submodules/AccountContext:AccountContext",
"//submodules/TelegramUI/Components/EmojiStatusComponent",
+ "//submodules/TelegramUI/Components/GlassBackgroundComponent",
+ "//submodules/Components/ComponentDisplayAdapters",
],
visibility = [
"//visibility:public",
diff --git a/submodules/SearchBarNode/Sources/SearchBarNode.swift b/submodules/SearchBarNode/Sources/SearchBarNode.swift
index 131323d3..849b0919 100644
--- a/submodules/SearchBarNode/Sources/SearchBarNode.swift
+++ b/submodules/SearchBarNode/Sources/SearchBarNode.swift
@@ -11,6 +11,7 @@ import AvatarNode
import AccountContext
import ComponentFlow
import EmojiStatusComponent
+import ComponentDisplayAdapters
private func generateLoupeIcon(color: UIColor) -> UIImage? {
return generateTintedImage(image: UIImage(bundleImageName: "Components/Search Bar/Loupe"), color: color)
@@ -369,6 +370,7 @@ private class SearchBarTextField: UITextField, UIScrollViewDelegate {
}
var theme: SearchBarNodeTheme
+ let style: SearchBarStyle
fileprivate func layoutTokens(transition: ContainedViewLayoutTransition = .immediate) {
var hasSelected = false
@@ -508,6 +510,12 @@ private class SearchBarTextField: UITextField, UIScrollViewDelegate {
}
fileprivate var tokensWidth: CGFloat = 0.0
+ var tokensInsetWidth: CGFloat {
+ if self.tokensWidth == 0.0 {
+ return 0.0
+ }
+ return self.tokensWidth + 8.0
+ }
private let measurePrefixLabel: ImmediateTextNode
let prefixLabel: ImmediateTextNode
@@ -519,8 +527,9 @@ private class SearchBarTextField: UITextField, UIScrollViewDelegate {
}
}
- init(theme: SearchBarNodeTheme) {
+ init(theme: SearchBarNodeTheme, style: SearchBarStyle) {
self.theme = theme
+ self.style = style
self.placeholderLabel = ImmediateTextNode()
self.placeholderLabel.isUserInteractionEnabled = false
@@ -547,7 +556,10 @@ private class SearchBarTextField: UITextField, UIScrollViewDelegate {
super.init(frame: CGRect())
- self.addSubnode(self.placeholderLabel)
+ if case .glass = style {
+ } else {
+ self.addSubnode(self.placeholderLabel)
+ }
self.addSubnode(self.prefixLabel)
self.addSubnode(self.clippingNode)
self.clippingNode.addSubnode(self.tokenContainerNode)
@@ -682,11 +694,19 @@ private class SearchBarTextField: UITextField, UIScrollViewDelegate {
let textRect = self.textRect(forBounds: bounds)
let labelSize = self.placeholderLabel.updateLayout(textRect.size)
- self.placeholderLabel.frame = CGRect(origin: CGPoint(x: textRect.minX + placeholderXOffset, y: textRect.minY + textOffset + placeholderYOffset), size: labelSize)
+
+ switch self.style {
+ case .glass, .inlineNavigation:
+ placeholderYOffset += 0.0
+ case .legacy, .modern:
+ break
+ }
+
+ self.placeholderLabel.frame = CGRect(origin: CGPoint(x: textRect.minX + placeholderXOffset, y: floorToScreenPixels(bounds.height - labelSize.height) * 0.5), size: labelSize)
let prefixSize = self.prefixLabel.updateLayout(CGSize(width: floor(bounds.size.width * 0.7), height: bounds.size.height))
let prefixBounds = bounds.insetBy(dx: 4.0, dy: 4.0)
- self.prefixLabel.frame = CGRect(origin: CGPoint(x: prefixBounds.minX, y: prefixBounds.minY + textOffset + placeholderYOffset), size: prefixSize)
+ self.prefixLabel.frame = CGRect(origin: CGPoint(x: prefixBounds.minX, y: floorToScreenPixels(bounds.height - prefixSize.height) * 0.5), size: prefixSize)
}
override func deleteBackward() {
@@ -813,40 +833,52 @@ public final class SearchBarNodeTheme: Equatable {
public enum SearchBarStyle {
case modern
case legacy
+ case inlineNavigation
+ case glass
var font: UIFont {
switch self {
- case .modern:
- return Font.regular(17.0)
- case .legacy:
- return Font.regular(14.0)
+ case .modern, .inlineNavigation, .glass:
+ return Font.regular(17.0)
+ case .legacy:
+ return Font.regular(14.0)
}
}
var cornerDiameter: CGFloat {
switch self {
- case .modern:
- return 21.0
- case .legacy:
- return 14.0
+ case .modern, .inlineNavigation:
+ return 21.0
+ case .glass:
+ return 22.0
+ case .legacy:
+ return 14.0
}
}
var height: CGFloat {
switch self {
- case .modern:
- return 36.0
- case .legacy:
- return 28.0
+ case .inlineNavigation:
+ return 48.0
+ case .glass:
+ return 44.0
+ case .modern:
+ return 36.0
+ case .legacy:
+ return 28.0
}
}
var padding: CGFloat {
switch self {
- case .modern:
- return 10.0
- case .legacy:
- return 8.0
+ case .inlineNavigation:
+ return 0.0
+ case .glass:
+ return 20.0
+ case .modern:
+ return 10.0
+ case .legacy:
+ return 8.0
}
}
}
@@ -868,6 +900,9 @@ public class SearchBarNode: ASDisplayNode, UITextFieldDelegate {
public var tokensUpdated: (([SearchBarToken]) -> Void)?
+ private let inlineSearchPlaceholder: SearchBarPlaceholderNode
+ private var inlineSearchPlaceholderContentsView: SearchBarPlaceholderContentView?
+
private let backgroundNode: NavigationBackgroundNode
private let separatorNode: ASDisplayNode
private let textBackgroundNode: ASDisplayNode
@@ -877,6 +912,8 @@ public class SearchBarNode: ASDisplayNode, UITextFieldDelegate {
private let clearButton: HighlightableButtonNode
private let cancelButton: HighlightableButtonNode
+ private var takenSearchPlaceholderContentView: SearchBarPlaceholderContentView?
+
public var placeholderString: NSAttributedString? {
get {
return self.textField.placeholderString
@@ -941,6 +978,12 @@ public class SearchBarNode: ASDisplayNode, UITextFieldDelegate {
activityIndicator.removeFromSupernode()
}
self.iconNode.isHidden = self.activity
+ if let takenSearchPlaceholderContentView = self.takenSearchPlaceholderContentView {
+ takenSearchPlaceholderContentView.updateSearchIconVisibility(isVisible: !self.activity)
+ }
+ if let inlineSearchPlaceholderContentsView = self.inlineSearchPlaceholderContentsView {
+ inlineSearchPlaceholderContentsView.updateSearchIconVisibility(isVisible: !self.activity)
+ }
}
}
}
@@ -965,17 +1008,24 @@ public class SearchBarNode: ASDisplayNode, UITextFieldDelegate {
private var validLayout: (CGSize, CGFloat, CGFloat)?
- private let fieldStyle: SearchBarStyle
+ public let fieldStyle: SearchBarStyle
private let forceSeparator: Bool
private var theme: SearchBarNodeTheme?
+ private var presentationTheme: PresentationTheme
private var strings: PresentationStrings?
private let cancelText: String?
- public init(theme: SearchBarNodeTheme, strings: PresentationStrings, fieldStyle: SearchBarStyle = .legacy, icon: Icon = .loupe, forceSeparator: Bool = false, displayBackground: Bool = true, cancelText: String? = nil) {
+ private var isAnimatingOut: Bool = false
+
+ public init(theme: SearchBarNodeTheme, presentationTheme: PresentationTheme, strings: PresentationStrings, fieldStyle: SearchBarStyle = .legacy, icon: Icon = .loupe, forceSeparator: Bool = false, displayBackground: Bool = true, cancelText: String? = nil) {
+ self.presentationTheme = presentationTheme
+
self.fieldStyle = fieldStyle
self.forceSeparator = forceSeparator
self.cancelText = cancelText
self.icon = icon
+
+ self.inlineSearchPlaceholder = SearchBarPlaceholderNode(fieldStyle: .glass)
self.backgroundNode = NavigationBackgroundNode(color: theme.background)
self.backgroundNode.isUserInteractionEnabled = false
@@ -994,7 +1044,7 @@ public class SearchBarNode: ASDisplayNode, UITextFieldDelegate {
self.iconNode.displaysAsynchronously = false
self.iconNode.displayWithoutProcessing = true
- self.textField = SearchBarTextField(theme: theme)
+ self.textField = SearchBarTextField(theme: theme, style: fieldStyle)
self.textField.accessibilityTraits = .searchField
self.textField.autocorrectionType = .no
self.textField.returnKeyType = .search
@@ -1011,14 +1061,27 @@ public class SearchBarNode: ASDisplayNode, UITextFieldDelegate {
super.init()
- self.addSubnode(self.backgroundNode)
- self.addSubnode(self.separatorNode)
-
- self.addSubnode(self.textBackgroundNode)
+ switch self.fieldStyle {
+ case .glass:
+ break
+ case .inlineNavigation:
+ break
+ case .legacy, .modern:
+ self.addSubnode(self.backgroundNode)
+ self.addSubnode(self.separatorNode)
+ self.addSubnode(self.textBackgroundNode)
+ }
self.view.addSubview(self.textField)
- self.addSubnode(self.iconNode)
+
+ switch self.fieldStyle {
+ case .glass, .inlineNavigation:
+ break
+ case .legacy, .modern:
+ self.addSubnode(self.iconNode)
+ self.addSubnode(self.cancelButton)
+ }
+
self.addSubnode(self.clearButton)
- self.addSubnode(self.cancelButton)
self.textField.delegate = self
self.textField.addTarget(self, action: #selector(self.textFieldDidChange(_:)), for: .editingChanged)
@@ -1043,11 +1106,11 @@ public class SearchBarNode: ASDisplayNode, UITextFieldDelegate {
self.cancelButton.addTarget(self, action: #selector(self.cancelPressed), forControlEvents: .touchUpInside)
self.clearButton.addTarget(self, action: #selector(self.clearPressed), forControlEvents: .touchUpInside)
- self.updateThemeAndStrings(theme: theme, strings: strings)
+ self.updateThemeAndStrings(theme: theme, presentationTheme: presentationTheme, strings: strings)
self.updateIsEmpty(animated: false)
}
- public func updateThemeAndStrings(theme: SearchBarNodeTheme, strings: PresentationStrings) {
+ public func updateThemeAndStrings(theme: SearchBarNodeTheme, presentationTheme: PresentationTheme, strings: PresentationStrings) {
if self.theme != theme || self.strings !== strings {
self.clearButton.accessibilityLabel = strings.WebSearch_RecentSectionClear
self.cancelButton.accessibilityLabel = self.cancelText ?? strings.Common_Cancel
@@ -1080,6 +1143,7 @@ public class SearchBarNode: ASDisplayNode, UITextFieldDelegate {
}
self.theme = theme
+ self.presentationTheme = presentationTheme
self.strings = strings
if let (boundingSize, leftInset, rightInset) = self.validLayout {
self.updateLayout(boundingSize: boundingSize, leftInset: leftInset, rightInset: rightInset, transition: .immediate)
@@ -1093,19 +1157,40 @@ public class SearchBarNode: ASDisplayNode, UITextFieldDelegate {
self.backgroundNode.update(size: self.backgroundNode.bounds.size, transition: .immediate)
transition.updateFrame(node: self.separatorNode, frame: CGRect(origin: CGPoint(x: 0.0, y: self.bounds.size.height), size: CGSize(width: self.bounds.size.width, height: UIScreenPixel)))
- let verticalOffset: CGFloat = boundingSize.height - 82.0
-
let contentFrame = CGRect(origin: CGPoint(x: leftInset, y: 0.0), size: CGSize(width: boundingSize.width - leftInset - rightInset, height: boundingSize.height))
- let textBackgroundHeight = self.fieldStyle.height
+ let textBackgroundHeight: CGFloat
+ if case .inlineNavigation = self.fieldStyle {
+ textBackgroundHeight = boundingSize.height
+ } else {
+ textBackgroundHeight = self.fieldStyle.height
+ }
+ let verticalOffset: CGFloat
+ switch self.fieldStyle {
+ case .inlineNavigation, .glass:
+ verticalOffset = -textBackgroundHeight
+ case .legacy, .modern:
+ verticalOffset = boundingSize.height - 82.0
+ }
let cancelButtonSize = self.cancelButton.measure(CGSize(width: 100.0, height: CGFloat.infinity))
transition.updateFrame(node: self.cancelButton, frame: CGRect(origin: CGPoint(x: contentFrame.maxX - 10.0 - cancelButtonSize.width, y: verticalOffset + textBackgroundHeight + floorToScreenPixels((textBackgroundHeight - cancelButtonSize.height) / 2.0)), size: cancelButtonSize))
let padding = self.fieldStyle.padding
- let textBackgroundFrame = CGRect(origin: CGPoint(x: contentFrame.minX + padding, y: verticalOffset + textBackgroundHeight), size: CGSize(width: contentFrame.width - padding * 2.0 - (self.hasCancelButton ? cancelButtonSize.width + 11.0 : 0.0), height: textBackgroundHeight))
+ var textBackgroundFrame = CGRect(origin: CGPoint(x: contentFrame.minX + padding, y: verticalOffset + textBackgroundHeight), size: CGSize(width: contentFrame.width - padding - (self.hasCancelButton ? cancelButtonSize.width + 11.0 : 0.0), height: textBackgroundHeight))
+ if case .glass = self.fieldStyle {
+ textBackgroundFrame.size.width -= 8.0
+ } else {
+ textBackgroundFrame.size.width -= padding
+ }
transition.updateFrame(node: self.textBackgroundNode, frame: textBackgroundFrame)
- let textFrame = CGRect(origin: CGPoint(x: textBackgroundFrame.minX + 24.0, y: textBackgroundFrame.minY), size: CGSize(width: max(1.0, textBackgroundFrame.size.width - 24.0 - 27.0), height: textBackgroundFrame.size.height))
+ var textFrame = CGRect(origin: CGPoint(x: 0.0, y: textBackgroundFrame.minY), size: CGSize(width: max(1.0, textBackgroundFrame.size.width - 24.0 - 27.0), height: textBackgroundFrame.size.height))
+ if case .inlineNavigation = self.fieldStyle {
+ textFrame.size.width = boundingSize.width - 27.0
+ textBackgroundFrame.size.width = boundingSize.width
+ } else {
+ textFrame.origin.x = textBackgroundFrame.minX + 24.0
+ }
if let iconImage = self.iconNode.image {
let iconSize = iconImage.size
@@ -1121,6 +1206,54 @@ public class SearchBarNode: ASDisplayNode, UITextFieldDelegate {
transition.updateFrame(node: self.clearButton, frame: CGRect(origin: CGPoint(x: textBackgroundFrame.maxX - 6.0 - clearSize.width, y: textBackgroundFrame.minY + floor((textBackgroundFrame.size.height - clearSize.height) / 2.0)), size: clearSize))
self.textField.frame = textFrame
+
+ let additionalPlaceholderInset = self.textField.tokensInsetWidth
+
+ let searchPlaceholderFrame = CGRect(origin: CGPoint(x: leftInset + 16.0, y: 0.0), size: CGSize(width: max(0.0, boundingSize.width - 16.0 * 2.0 - leftInset - rightInset), height: 44.0))
+
+ if case .glass = self.fieldStyle, self.takenSearchPlaceholderContentView == nil {
+ transition.updateFrame(node: self.inlineSearchPlaceholder, frame: searchPlaceholderFrame)
+ var isFirstTime = false
+ if let theme = self.theme {
+ let _ = self.inlineSearchPlaceholder.updateLayout(
+ placeholderString: self.placeholderString,
+ compactPlaceholderString: self.placeholderString,
+ constrainedSize: searchPlaceholderFrame.size,
+ expansionProgress: 1.0,
+ iconColor: theme.inputIcon,
+ foregroundColor: self.presentationTheme.chat.inputPanel.panelControlColor,
+ backgroundColor: self.presentationTheme.rootController.navigationBar.opaqueBackgroundColor,
+ controlColor: self.presentationTheme.chat.inputPanel.panelControlColor,
+ transition: transition
+ )
+ if self.inlineSearchPlaceholderContentsView == nil {
+ isFirstTime = true
+ let inlineSearchPlaceholderContentsView = self.inlineSearchPlaceholder.takeContents()
+ inlineSearchPlaceholderContentsView.onCancel = { [weak self] in
+ guard let self else {
+ return
+ }
+ self.cancel?()
+ }
+ self.inlineSearchPlaceholderContentsView = inlineSearchPlaceholderContentsView
+ self.view.insertSubview(inlineSearchPlaceholderContentsView, at: 0)
+ }
+ }
+ if let inlineSearchPlaceholderContentsView = self.inlineSearchPlaceholderContentsView {
+ inlineSearchPlaceholderContentsView.update(size: searchPlaceholderFrame.size, isActive: true, additionalPlaceholderInset: additionalPlaceholderInset, transition: transition)
+ transition.updateFrame(view: inlineSearchPlaceholderContentsView, frame: searchPlaceholderFrame)
+
+ if isFirstTime {
+ self.updateIsEmpty(animated: false)
+ inlineSearchPlaceholderContentsView.updateSearchIconVisibility(isVisible: !self.activity)
+ }
+ }
+ }
+
+ if !self.isAnimatingOut, let takenSearchPlaceholderContentView = self.takenSearchPlaceholderContentView {
+ transition.updateFrame(view: takenSearchPlaceholderContentView, frame: searchPlaceholderFrame)
+ takenSearchPlaceholderContentView.update(size: searchPlaceholderFrame.size, isActive: true, additionalPlaceholderInset: additionalPlaceholderInset, transition: transition)
+ }
}
@objc private func tapGesture(_ recognizer: UITapGestureRecognizer) {
@@ -1138,7 +1271,33 @@ public class SearchBarNode: ASDisplayNode, UITextFieldDelegate {
}
public func animateIn(from node: SearchBarPlaceholderNode, duration: Double, timingFunction: String) {
- let initialTextBackgroundFrame = node.view.convert(node.backgroundNode.frame, to: self.view)
+ guard let (boundingSize, leftInset, rightInset) = self.validLayout else {
+ return
+ }
+
+ self.inlineSearchPlaceholder.isHidden = true
+
+ let takenSearchPlaceholderContentView = node.takeContents()
+ takenSearchPlaceholderContentView.onCancel = { [weak self] in
+ guard let self else {
+ return
+ }
+ self.cancel?()
+ }
+ self.takenSearchPlaceholderContentView = takenSearchPlaceholderContentView
+ self.view.insertSubview(takenSearchPlaceholderContentView, at: 0)
+ if let inlineSearchPlaceholderContentsView = self.inlineSearchPlaceholderContentsView {
+ inlineSearchPlaceholderContentsView.removeFromSuperview()
+ }
+
+ let sourceFrame = node.view.convert(node.bounds, to: self.view)
+ let targetFrame = CGRect(origin: CGPoint(x: leftInset + 16.0, y: 0.0), size: CGSize(width: max(0.0, boundingSize.width - 16.0 * 2.0 - leftInset - rightInset), height: 44.0))
+ let transition: ContainedViewLayoutTransition = .animated(duration: duration, curve: timingFunction == kCAMediaTimingFunctionSpring ? .spring : .easeInOut)
+ takenSearchPlaceholderContentView.frame = sourceFrame
+ transition.updateFrame(view: takenSearchPlaceholderContentView, frame: targetFrame)
+ takenSearchPlaceholderContentView.update(size: targetFrame.size, isActive: true, additionalPlaceholderInset: self.textField.tokensInsetWidth, transition: transition)
+
+ /*let initialTextBackgroundFrame = node.view.convert(node.backgroundView.frame, to: self.view)
let initialBackgroundFrame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: self.bounds.size.width, height: max(0.0, initialTextBackgroundFrame.maxY + 8.0)))
if let fromBackgroundColor = node.backgroundColor, let toBackgroundColor = self.backgroundNode.backgroundColor {
@@ -1152,7 +1311,7 @@ public class SearchBarNode: ASDisplayNode, UITextFieldDelegate {
self.separatorNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: duration)
self.separatorNode.layer.animateFrame(from: initialSeparatorFrame, to: self.separatorNode.frame, duration: duration, timingFunction: timingFunction)
- if let fromTextBackgroundColor = node.backgroundNode.backgroundColor, let toTextBackgroundColor = self.textBackgroundNode.backgroundColor {
+ if let fromTextBackgroundColor = node.backgroundView.backgroundColor, let toTextBackgroundColor = self.textBackgroundNode.backgroundColor {
self.textBackgroundNode.layer.animate(from: fromTextBackgroundColor.cgColor, to: toTextBackgroundColor.cgColor, keyPath: "backgroundColor", timingFunction: timingFunction, duration: duration * 1.0)
}
self.textBackgroundNode.layer.animateFrame(from: initialTextBackgroundFrame, to: self.textBackgroundNode.frame, duration: duration, timingFunction: timingFunction)
@@ -1177,7 +1336,7 @@ public class SearchBarNode: ASDisplayNode, UITextFieldDelegate {
let cancelButtonFrame = self.cancelButton.frame
self.cancelButton.layer.animatePosition(from: CGPoint(x: self.bounds.size.width + cancelButtonFrame.size.width / 2.0, y: initialTextBackgroundFrame.midY), to: self.cancelButton.layer.position, duration: duration, timingFunction: timingFunction)
- node.isHidden = true
+ node.isHidden = true*/
}
public func deactivate(clear: Bool = true) {
@@ -1191,7 +1350,9 @@ public class SearchBarNode: ASDisplayNode, UITextFieldDelegate {
}
public func transitionOut(to node: SearchBarPlaceholderNode, transition: ContainedViewLayoutTransition, completion: @escaping () -> Void) {
- let targetTextBackgroundFrame = node.view.convert(node.backgroundNode.frame, to: self.view)
+ self.isAnimatingOut = true
+
+ /*let targetTextBackgroundFrame = node.view.convert(node.backgroundView.frame, to: self.view)
let duration: Double = transition.isAnimated ? 0.5 : 0.0
let timingFunction = kCAMediaTimingFunctionSpring
@@ -1307,8 +1468,8 @@ public class SearchBarNode: ASDisplayNode, UITextFieldDelegate {
let transitionBackgroundNode = ASDisplayNode()
transitionBackgroundNode.isLayerBacked = true
transitionBackgroundNode.displaysAsynchronously = false
- transitionBackgroundNode.backgroundColor = node.backgroundNode.backgroundColor
- transitionBackgroundNode.cornerRadius = node.backgroundNode.cornerRadius
+ transitionBackgroundNode.backgroundColor = node.backgroundView.backgroundColor
+ transitionBackgroundNode.cornerRadius = node.backgroundView.layer.cornerRadius
self.insertSubnode(transitionBackgroundNode, aboveSubnode: self.textBackgroundNode)
transitionBackgroundNode.layer.animateFrame(from: self.textBackgroundNode.frame, to: targetTextBackgroundFrame, duration: duration, timingFunction: timingFunction, removeOnCompletion: false)
@@ -1331,7 +1492,52 @@ public class SearchBarNode: ASDisplayNode, UITextFieldDelegate {
self.iconNode.layer.animateFrame(from: self.iconNode.frame, to: targetIconFrame, duration: duration, timingFunction: timingFunction, removeOnCompletion: false)
let cancelButtonFrame = self.cancelButton.frame
- self.cancelButton.layer.animatePosition(from: self.cancelButton.layer.position, to: CGPoint(x: self.bounds.size.width + cancelButtonFrame.size.width / 2.0, y: targetTextBackgroundFrame.midY), duration: duration, timingFunction: timingFunction, removeOnCompletion: false)
+ self.cancelButton.layer.animatePosition(from: self.cancelButton.layer.position, to: CGPoint(x: self.bounds.size.width + cancelButtonFrame.size.width / 2.0, y: targetTextBackgroundFrame.midY), duration: duration, timingFunction: timingFunction, removeOnCompletion: false)*/
+
+ if let takenSearchPlaceholderContentView = self.takenSearchPlaceholderContentView {
+ let transition = ComponentTransition(transition)
+ let alphaTransition: ComponentTransition = transition.animation.isImmediate ? .immediate : .easeInOut(duration: 0.2)
+
+ let sourceFrame = node.view.convert(node.bounds, to: self.view)
+ takenSearchPlaceholderContentView.update(size: sourceFrame.size, isActive: false, additionalPlaceholderInset: 0.0, transition: transition.containedViewLayoutTransition)
+ takenSearchPlaceholderContentView.updatePlaceholderVisibility(isVisible: true)
+ takenSearchPlaceholderContentView.updateSearchIconVisibility(isVisible: true)
+
+ transition.setFrame(view: takenSearchPlaceholderContentView, frame: sourceFrame, completion: { [weak node] _ in
+ node?.putBackContents()
+ completion()
+ })
+
+ let textBackgroundHeight: CGFloat
+ if case .inlineNavigation = self.fieldStyle {
+ textBackgroundHeight = sourceFrame.height
+ } else {
+ textBackgroundHeight = self.fieldStyle.height
+ }
+
+ let padding = self.fieldStyle.padding
+ var textBackgroundFrame = CGRect(origin: CGPoint(x: sourceFrame.minX + padding, y: sourceFrame.minY), size: CGSize(width: sourceFrame.width - padding, height: textBackgroundHeight))
+ if case .glass = self.fieldStyle {
+ textBackgroundFrame.size.width -= 8.0
+ } else {
+ textBackgroundFrame.size.width -= padding
+ }
+
+ var textFrame = CGRect(origin: CGPoint(x: 0.0, y: textBackgroundFrame.minY), size: CGSize(width: max(1.0, textBackgroundFrame.size.width - 24.0 - 27.0), height: textBackgroundFrame.size.height))
+ if case .inlineNavigation = self.fieldStyle {
+ textFrame.size.width = sourceFrame.width - 27.0
+ textBackgroundFrame.size.width = sourceFrame.width
+ } else {
+ textFrame.origin.x = textBackgroundFrame.minX + 24.0
+ }
+ transition.setFrame(view: self.textField, frame: textFrame)
+ //alphaTransition.setAlpha(view: self.textField, alpha: 0.0)
+ self.textField.isHidden = true
+
+ let clearSize = self.clearButton.bounds.size
+ alphaTransition.setAlpha(view: self.clearButton.view, alpha: 0.0)
+ transition.setFrame(view: self.clearButton.view, frame: CGRect(origin: CGPoint(x: textBackgroundFrame.maxX - 6.0 - clearSize.width, y: textBackgroundFrame.minY + floor((textBackgroundFrame.size.height - clearSize.height) / 2.0)), size: clearSize))
+ }
}
public func textFieldDidBeginEditing(_ textField: UITextField) {
@@ -1403,6 +1609,10 @@ public class SearchBarNode: ASDisplayNode, UITextFieldDelegate {
let transition: ContainedViewLayoutTransition = animated ? .animated(duration: 0.3, curve: .spring) : .immediate
let placeholderTransition = !isEmpty ? .immediate : transition
placeholderTransition.updateAlpha(node: self.textField.placeholderLabel, alpha: isEmpty ? 1.0 : 0.0)
+ if let takenSearchPlaceholderContentView = self.takenSearchPlaceholderContentView {
+ takenSearchPlaceholderContentView.updatePlaceholderVisibility(isVisible: isEmpty)
+ }
+ self.inlineSearchPlaceholderContentsView?.updatePlaceholderVisibility(isVisible: isEmpty)
let clearIsHidden = (textIsEmpty && tokensEmpty) && self.prefixString == nil
transition.updateAlpha(node: self.clearButton.imageNode, alpha: clearIsHidden ? 0.0 : 1.0)
diff --git a/submodules/SearchBarNode/Sources/SearchBarPlaceholderNode.swift b/submodules/SearchBarNode/Sources/SearchBarPlaceholderNode.swift
index 25c468e6..f6f4e3ff 100644
--- a/submodules/SearchBarNode/Sources/SearchBarPlaceholderNode.swift
+++ b/submodules/SearchBarNode/Sources/SearchBarPlaceholderNode.swift
@@ -5,6 +5,8 @@ import AsyncDisplayKit
import Display
import AppBundle
import ComponentFlow
+import GlassBackgroundComponent
+import ComponentDisplayAdapters
private let templateLoupeIcon = UIImage(bundleImageName: "Components/Search Bar/Loupe")
@@ -21,44 +23,69 @@ private class SearchBarPlaceholderNodeView: UIView {
}
}
-public class SearchBarPlaceholderNode: ASDisplayNode {
- public var activate: (() -> Void)?
+public final class SearchBarPlaceholderContentView: UIView {
+ private struct Params {
+ var placeholderString: NSAttributedString?
+ var compactPlaceholderString: NSAttributedString?
+ var constrainedSize: CGSize
+ var expansionProgress: CGFloat
+ var iconColor: UIColor
+ var foregroundColor: UIColor
+ var backgroundColor: UIColor
+ var controlColor: UIColor
+ var isActive: Bool
+ var additionalPlaceholderInset: CGFloat
+
+ init(placeholderString: NSAttributedString?, compactPlaceholderString: NSAttributedString?, constrainedSize: CGSize, expansionProgress: CGFloat, iconColor: UIColor, foregroundColor: UIColor, backgroundColor: UIColor, controlColor: UIColor, isActive: Bool, additionalPlaceholderInset: CGFloat) {
+ self.placeholderString = placeholderString
+ self.compactPlaceholderString = compactPlaceholderString
+ self.constrainedSize = constrainedSize
+ self.expansionProgress = expansionProgress
+ self.iconColor = iconColor
+ self.foregroundColor = foregroundColor
+ self.backgroundColor = backgroundColor
+ self.controlColor = controlColor
+ self.isActive = isActive
+ self.additionalPlaceholderInset = additionalPlaceholderInset
+ }
+ }
- private let fieldStyle: SearchBarStyle
- public let backgroundNode: ASDisplayNode
+ let fieldStyle: SearchBarStyle
+ let plainBackgroundView: UIImageView
+ let glassBackgroundView: GlassBackgroundView?
private var fillBackgroundColor: UIColor
private var foregroundColor: UIColor
private var iconColor: UIColor
- public let iconNode: ASImageNode
- public let labelNode: TextNode
+ let iconNode: ASImageNode
+ let labelNode: TextNode
+ let plainIconNode: ASImageNode
+ let plainLabelNode: TextNode
- var pointerInteraction: PointerInteraction?
+ private var close: (background: GlassBackgroundView, icon: UIImageView)?
- public private(set) var placeholderString: NSAttributedString?
+ private(set) var placeholderString: NSAttributedString?
- private(set) var accessoryComponentContainer: UIView?
- private(set) var accessoryComponentView: ComponentHostView?
+ private var params: Params?
- convenience public override init() {
- self.init(fieldStyle: .legacy)
- }
+ public var onCancel: (() -> Void)?
- public init(fieldStyle: SearchBarStyle = .legacy) {
+ init(fieldStyle: SearchBarStyle) {
self.fieldStyle = fieldStyle
- self.backgroundNode = ASDisplayNode()
- self.backgroundNode.isLayerBacked = false
- self.backgroundNode.displaysAsynchronously = false
-
self.fillBackgroundColor = UIColor.white
self.foregroundColor = UIColor(rgb: 0xededed)
self.iconColor = UIColor(rgb: 0x000000, alpha: 0.0)
- self.backgroundNode.backgroundColor = self.foregroundColor
- self.backgroundNode.cornerRadius = self.fieldStyle.cornerDiameter / 2.0
+ self.plainBackgroundView = UIImageView()
+
+ switch fieldStyle {
+ case .legacy, .modern:
+ self.glassBackgroundView = nil
+ case .inlineNavigation, .glass:
+ self.glassBackgroundView = GlassBackgroundView()
+ }
self.iconNode = ASImageNode()
- self.iconNode.isLayerBacked = true
self.iconNode.displaysAsynchronously = false
self.iconNode.displayWithoutProcessing = true
@@ -66,51 +93,431 @@ public class SearchBarPlaceholderNode: ASDisplayNode {
self.labelNode.isOpaque = false
self.labelNode.isUserInteractionEnabled = false
+ self.plainIconNode = ASImageNode()
+ self.plainIconNode.displaysAsynchronously = false
+ self.plainIconNode.displayWithoutProcessing = true
+
+ self.plainLabelNode = TextNode()
+ self.plainLabelNode.isOpaque = false
+ self.plainLabelNode.isUserInteractionEnabled = false
+
+ super.init(frame: CGRect())
+
+ self.plainBackgroundView.isUserInteractionEnabled = true
+ self.addSubview(self.plainBackgroundView)
+
+ self.plainBackgroundView.addSubview(self.plainIconNode.view)
+ self.plainBackgroundView.addSubview(self.plainLabelNode.view)
+
+ if let glassBackgroundView = self.glassBackgroundView {
+ self.addSubview(glassBackgroundView)
+
+ glassBackgroundView.contentView.addSubview(self.iconNode.view)
+ glassBackgroundView.contentView.addSubview(self.labelNode.view)
+ }
+ }
+
+ required public init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+
+ @objc private func onCloseTapGesture(_ recognizer: UITapGestureRecognizer) {
+ if case .ended = recognizer.state {
+ self.onCancel?()
+ }
+ }
+
+ func updateLayout(
+ placeholderString: NSAttributedString?,
+ compactPlaceholderString: NSAttributedString?,
+ constrainedSize: CGSize,
+ expansionProgress: CGFloat,
+ iconColor: UIColor,
+ foregroundColor: UIColor,
+ backgroundColor: UIColor,
+ controlColor: UIColor,
+ transition: ContainedViewLayoutTransition
+ ) -> CGFloat {
+ let params = Params(
+ placeholderString: placeholderString,
+ compactPlaceholderString: compactPlaceholderString,
+ constrainedSize: constrainedSize,
+ expansionProgress: expansionProgress,
+ iconColor: iconColor,
+ foregroundColor: foregroundColor,
+ backgroundColor: backgroundColor,
+ controlColor: controlColor,
+ isActive: false,
+ additionalPlaceholderInset: 0.0
+ )
+ self.params = params
+ return self.updateLayout(params: params, transition: transition)
+ }
+
+ public func update(size: CGSize, isActive: Bool, additionalPlaceholderInset: CGFloat, transition: ContainedViewLayoutTransition) {
+ guard var params = self.params else {
+ return
+ }
+ params.constrainedSize = size
+ params.expansionProgress = 1.0
+ params.isActive = isActive
+ params.additionalPlaceholderInset = additionalPlaceholderInset
+ let _ = self.updateLayout(params: params, transition: transition)
+ }
+
+ private func updateLayout(params: Params, transition: ContainedViewLayoutTransition) -> CGFloat {
+ let labelLayout = TextNode.asyncLayout(self.labelNode)
+ let plainLabelLayout = TextNode.asyncLayout(self.plainLabelNode)
+ let currentForegroundColor = self.foregroundColor
+ let currentIconColor = self.iconColor
+
+ let placeholderString: NSAttributedString?
+ if params.constrainedSize.width < 350.0 {
+ placeholderString = params.compactPlaceholderString
+ } else {
+ placeholderString = params.placeholderString
+ }
+
+ let (labelLayoutResult, labelApply) = labelLayout(TextNodeLayoutArguments(attributedString: placeholderString, backgroundColor: .clear, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: params.constrainedSize, alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
+ let (_, plainLabelApply) = plainLabelLayout(TextNodeLayoutArguments(attributedString: placeholderString, backgroundColor: .clear, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: params.constrainedSize, alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
+
+ var updatedColor: UIColor?
+ var updatedIconImage: UIImage?
+ if !currentForegroundColor.isEqual(params.foregroundColor) {
+ updatedColor = params.foregroundColor
+ }
+ if !currentIconColor.isEqual(params.iconColor) {
+ updatedIconImage = generateLoupeIcon(color: params.iconColor)
+ }
+
+ let height = params.constrainedSize.height * params.expansionProgress
+
+ let _ = labelApply()
+ let _ = plainLabelApply()
+
+ self.fillBackgroundColor = params.backgroundColor
+ self.foregroundColor = params.foregroundColor
+ self.iconColor = params.iconColor
+ self.plainBackgroundView.isUserInteractionEnabled = params.expansionProgress > 0.9999
+
+ if let updatedColor {
+ self.plainBackgroundView.backgroundColor = updatedColor
+ }
+ if let updatedIconImage {
+ self.iconNode.image = updatedIconImage
+ self.plainIconNode.image = updatedIconImage
+ }
+
+ self.placeholderString = placeholderString
+
+ var iconSize = CGSize()
+ var totalWidth = labelLayoutResult.size.width
+
+ var spacing: CGFloat = 4.0
+ if params.isActive {
+ spacing = 2.0
+ }
+
+ let iconX: CGFloat
+ if let iconImage = self.iconNode.image {
+ iconSize = iconImage.size
+ totalWidth += iconSize.width + spacing
+ if params.isActive {
+ iconX = 8.0
+ } else {
+ iconX = floor((params.constrainedSize.width - totalWidth) / 2.0)
+ }
+ transition.updateFrame(node: self.iconNode, frame: CGRect(origin: CGPoint(x: iconX, y: floorToScreenPixels((height - iconSize.height) / 2.0)), size: iconSize))
+ transition.updateFrame(node: self.plainIconNode, frame: CGRect(origin: CGPoint(x: iconX, y: floorToScreenPixels((height - iconSize.height) / 2.0)), size: iconSize))
+ } else {
+ iconX = 12.0
+ }
+ var textOffset: CGFloat = 0.0
+ if params.constrainedSize.height >= 36.0 {
+ textOffset += 1.0
+ }
+ let labelX: CGFloat = iconX + iconSize.width + spacing + params.additionalPlaceholderInset
+ let labelFrame = CGRect(origin: CGPoint(x: labelX, y: floorToScreenPixels((height - labelLayoutResult.size.height) / 2.0) + textOffset), size: labelLayoutResult.size)
+ transition.updateFrame(node: self.labelNode, frame: labelFrame)
+ transition.updateFrame(node: self.plainLabelNode, frame: labelFrame)
+
+ var innerAlpha = max(0.0, params.expansionProgress - 0.77) / 0.23
+ if innerAlpha > 0.9999 {
+ innerAlpha = 1.0
+ } else if innerAlpha < 0.0001 {
+ innerAlpha = 0.0
+ }
+ if self.labelNode.alpha != innerAlpha {
+ if !transition.isAnimated {
+ self.labelNode.layer.removeAnimation(forKey: "opacity")
+ self.iconNode.layer.removeAnimation(forKey: "opacity")
+ self.plainLabelNode.layer.removeAnimation(forKey: "opacity")
+ self.plainIconNode.layer.removeAnimation(forKey: "opacity")
+ }
+
+ transition.updateAlpha(node: self.labelNode, alpha: innerAlpha)
+ transition.updateAlpha(node: self.iconNode, alpha: innerAlpha)
+
+ transition.updateAlpha(node: self.plainLabelNode, alpha: innerAlpha)
+ transition.updateAlpha(node: self.plainIconNode, alpha: innerAlpha)
+ }
+
+ let outerAlpha = min(0.3, params.expansionProgress) / 0.3
+ let cornerRadius = height * 0.5
+
+ if self.plainBackgroundView.layer.cornerRadius != cornerRadius {
+ if !transition.isAnimated {
+ self.plainBackgroundView.layer.removeAnimation(forKey: "cornerRadius")
+ }
+ transition.updateCornerRadius(layer: self.plainBackgroundView.layer, cornerRadius: cornerRadius)
+ }
+
+ var plainBackgroundAlpha = outerAlpha
+ if params.isActive {
+ plainBackgroundAlpha = 0.0
+ }
+ if self.plainBackgroundView.alpha != plainBackgroundAlpha {
+ if !transition.isAnimated {
+ self.plainBackgroundView.layer.removeAnimation(forKey: "opacity")
+ }
+ transition.updateAlpha(layer: self.plainBackgroundView.layer, alpha: plainBackgroundAlpha)
+ }
+
+ var backgroundFrame = CGRect(origin: CGPoint(), size: CGSize(width: params.constrainedSize.width, height: height))
+ if params.isActive {
+ backgroundFrame.size.width -= 44.0 + 8.0
+ }
+
+ if self.plainBackgroundView.frame != backgroundFrame {
+ if !transition.isAnimated {
+ self.plainBackgroundView.layer.removeAnimation(forKey: "position")
+ self.plainBackgroundView.layer.removeAnimation(forKey: "bounds")
+ }
+ transition.updateFrame(view: self.plainBackgroundView, frame: CGRect(origin: CGPoint(), size: CGSize(width: params.constrainedSize.width, height: height)))
+ }
+
+ if let glassBackgroundView = self.glassBackgroundView {
+ transition.updatePosition(layer: glassBackgroundView.layer, position: backgroundFrame.center)
+ transition.updateBounds(layer: glassBackgroundView.layer, bounds: CGRect(origin: CGPoint(), size: backgroundFrame.size))
+ var backgroundAlpha: CGFloat = 1.0
+ if backgroundFrame.height < 16.0 {
+ backgroundAlpha = max(0.0, min(1.0, backgroundFrame.height / 16.0))
+ }
+ if !params.isActive {
+ backgroundAlpha = 0.0
+ }
+ ComponentTransition(transition).setAlpha(view: glassBackgroundView, alpha: backgroundAlpha)
+ let isDark = params.backgroundColor.hsb.b < 0.5
+ if params.isActive {
+ glassBackgroundView.update(size: backgroundFrame.size, cornerRadius: backgroundFrame.height * 0.5, isDark: isDark, tintColor: .init(kind: .panel, color: UIColor(white: isDark ? 0.0 : 1.0, alpha: 0.6)), isInteractive: true, transition: ComponentTransition(transition))
+ }
+
+ if params.isActive {
+ let transition = ComponentTransition(transition)
+
+ let closeFrame = CGRect(origin: CGPoint(x: params.constrainedSize.width - 44.0, y: 0.0), size: CGSize(width: 44.0, height: 44.0))
+
+ let close: (background: GlassBackgroundView, icon: UIImageView)
+ var closeTransition = transition
+ if let current = self.close {
+ close = current
+ } else {
+ closeTransition = closeTransition.withAnimation(.none)
+ close = (GlassBackgroundView(), UIImageView())
+ self.close = close
+
+ close.icon.image = generateImage(CGSize(width: 40.0, height: 40.0), contextGenerator: { size, context in
+ context.clear(CGRect(origin: CGPoint(), size: size))
+
+ context.setLineWidth(2.0)
+ context.setLineCap(.round)
+ context.setStrokeColor(UIColor.white.cgColor)
+
+ context.beginPath()
+ context.move(to: CGPoint(x: 12.0, y: 12.0))
+ context.addLine(to: CGPoint(x: size.width - 12.0, y: size.height - 12.0))
+ context.move(to: CGPoint(x: size.width - 12.0, y: 12.0))
+ context.addLine(to: CGPoint(x: 12.0, y: size.height - 12.0))
+ context.strokePath()
+ })?.withRenderingMode(.alwaysTemplate)
+
+ close.background.contentView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.onCloseTapGesture(_:))))
+
+ close.background.contentView.addSubview(close.icon)
+ self.insertSubview(close.background, at: 0)
+
+ if let image = close.icon.image {
+ close.icon.frame = image.size.centered(in: CGRect(origin: CGPoint(), size: closeFrame.size))
+ }
+
+ close.background.frame = closeFrame.offsetBy(dx: closeFrame.width + 40.0, dy: 0.0)
+ let isDark = params.backgroundColor.hsb.b < 0.5
+ close.background.update(size: close.background.bounds.size, cornerRadius: close.background.bounds.height * 0.5, isDark: isDark, tintColor: .init(kind: .panel, color: UIColor(white: isDark ? 0.0 : 1.0, alpha: 0.6)), isInteractive: true, transition: .immediate)
+ ComponentTransition.immediate.setScale(view: close.background, scale: 0.001)
+ }
+
+ close.icon.tintColor = params.controlColor
+
+ transition.setPosition(view: close.background, position: closeFrame.center)
+ transition.setBounds(view: close.background, bounds: CGRect(origin: CGPoint(), size: closeFrame.size))
+ transition.setScale(view: close.background, scale: 1.0)
+
+ if let image = close.icon.image {
+ transition.setFrame(view: close.icon, frame: image.size.centered(in: CGRect(origin: CGPoint(), size: closeFrame.size)))
+ }
+
+ let isDark = params.backgroundColor.hsb.b < 0.5
+ close.background.update(size: closeFrame.size, cornerRadius: closeFrame.height * 0.5, isDark: isDark, tintColor: .init(kind: .panel, color: UIColor(white: isDark ? 0.0 : 1.0, alpha: 0.6)), isInteractive: true, transition: closeTransition)
+ } else {
+ let transition = ComponentTransition(transition)
+
+ if let close = self.close {
+ self.close = nil
+ let closeBackground = close.background
+ let closeFrame = CGRect(origin: CGPoint(x: params.constrainedSize.width - 44.0, y: 0.0), size: CGSize(width: 44.0, height: 44.0)).offsetBy(dx: 44.0 + 40.0, dy: 0.0)
+ transition.setPosition(view: closeBackground, position: closeFrame.center)
+ transition.setBounds(view: closeBackground, bounds: CGRect(origin: CGPoint(), size: closeFrame.size))
+ let isDark = params.backgroundColor.hsb.b < 0.5
+ closeBackground.update(size: closeFrame.size, cornerRadius: closeFrame.height * 0.5, isDark: isDark, tintColor: .init(kind: .panel, color: UIColor(white: isDark ? 0.0 : 1.0, alpha: 0.6)), isInteractive: true, transition: transition)
+ transition.setScale(view: closeBackground, scale: 0.001, completion: { [weak closeBackground] _ in
+ closeBackground?.removeFromSuperview()
+ })
+ }
+ }
+ }
+
+ /*if let accessoryComponentContainer = self.accessoryComponentContainer {
+ accessoryComponentContainer.frame = CGRect(origin: CGPoint(x: constrainedSize.width - accessoryComponentContainer.bounds.width - 4.0, y: floor((constrainedSize.height * expansionProgress - accessoryComponentContainer.bounds.height) / 2.0)), size: accessoryComponentContainer.bounds.size)
+ transition.updateAlpha(layer: accessoryComponentContainer.layer, alpha: innerAlpha)
+ }*/
+
+ return height
+ }
+
+ public func updatePlaceholderVisibility(isVisible: Bool) {
+ self.labelNode.isHidden = !isVisible
+ self.plainLabelNode.isHidden = !isVisible
+ }
+
+ public func updateSearchIconVisibility(isVisible: Bool) {
+ self.iconNode.isHidden = !isVisible
+ self.plainIconNode.isHidden = !isVisible
+ }
+}
+
+public class SearchBarPlaceholderNode: ASDisplayNode {
+ private struct Params {
+ var placeholderString: NSAttributedString?
+ var compactPlaceholderString: NSAttributedString?
+ var constrainedSize: CGSize
+ var expansionProgress: CGFloat
+ var iconColor: UIColor
+ var foregroundColor: UIColor
+ var backgroundColor: UIColor
+ var controlColor: UIColor
+
+ init(placeholderString: NSAttributedString?, compactPlaceholderString: NSAttributedString?, constrainedSize: CGSize, expansionProgress: CGFloat, iconColor: UIColor, foregroundColor: UIColor, backgroundColor: UIColor, controlColor: UIColor) {
+ self.placeholderString = placeholderString
+ self.compactPlaceholderString = compactPlaceholderString
+ self.constrainedSize = constrainedSize
+ self.expansionProgress = expansionProgress
+ self.iconColor = iconColor
+ self.foregroundColor = foregroundColor
+ self.backgroundColor = backgroundColor
+ self.controlColor = controlColor
+ }
+ }
+
+ public var activate: (() -> Void)?
+
+ private let containerView: UIView
+ private let contentView: SearchBarPlaceholderContentView
+
+ public var backgroundView: UIView {
+ if let glassBackgroundView = self.contentView.glassBackgroundView {
+ return glassBackgroundView
+ } else {
+ return self.contentView.plainBackgroundView
+ }
+ }
+
+ public var iconNode: ASImageNode {
+ return self.contentView.iconNode
+ }
+
+ public var labelNode: TextNode {
+ return self.contentView.labelNode
+ }
+
+ public var fieldStyle: SearchBarStyle {
+ return self.contentView.fieldStyle
+ }
+
+ var pointerInteraction: PointerInteraction?
+
+ public var placeholderString: NSAttributedString? {
+ return self.contentView.placeholderString
+ }
+
+ private(set) var accessoryComponentContainer: UIView?
+ private(set) var accessoryComponentView: ComponentHostView?
+
+ private var params: Params?
+ private var currentLayoutHeight: CGFloat?
+ private var isTakenOut: Bool = false
+
+ public init(fieldStyle: SearchBarStyle = .legacy) {
+ self.containerView = UIView()
+ self.contentView = SearchBarPlaceholderContentView(fieldStyle: fieldStyle)
+
super.init()
- self.addSubnode(self.backgroundNode)
- self.addSubnode(self.iconNode)
- self.addSubnode(self.labelNode)
-
- self.backgroundNode.isUserInteractionEnabled = true
+ self.view.addSubview(self.containerView)
+ self.containerView.addSubview(self.contentView)
}
override public func didLoad() {
super.didLoad()
let gestureRecognizer = TapLongTapOrDoubleTapGestureRecognizer(target: self, action: #selector(self.backgroundTap(_:)))
- gestureRecognizer.highlight = { [weak self] point in
+ /*gestureRecognizer.highlight = { [weak self] point in
guard let strongSelf = self else {
return
}
- if let _ = point {
- strongSelf.backgroundNode.layer.animate(from: (strongSelf.backgroundNode.backgroundColor ?? strongSelf.foregroundColor).cgColor, to: strongSelf.foregroundColor.withMultipliedBrightnessBy(0.9).cgColor, keyPath: "backgroundColor", timingFunction: CAMediaTimingFunctionName.easeInEaseOut.rawValue, duration: 0.2)
- strongSelf.backgroundNode.backgroundColor = strongSelf.foregroundColor.withMultipliedBrightnessBy(0.9)
- } else {
- strongSelf.backgroundNode.layer.animate(from: (strongSelf.backgroundNode.backgroundColor ?? strongSelf.foregroundColor).cgColor, to: strongSelf.foregroundColor.cgColor, keyPath: "backgroundColor", timingFunction: CAMediaTimingFunctionName.easeInEaseOut.rawValue, duration: 0.4)
- strongSelf.backgroundNode.backgroundColor = strongSelf.foregroundColor
+ if let backgroundNode = strongSelf.contentView.backgroundNode {
+ if let _ = point {
+ backgroundNode.layer.animate(from: (backgroundNode.backgroundColor ?? strongSelf.foregroundColor).cgColor, to: strongSelf.foregroundColor.withMultipliedBrightnessBy(0.9).cgColor, keyPath: "backgroundColor", timingFunction: CAMediaTimingFunctionName.easeInEaseOut.rawValue, duration: 0.2)
+ backgroundNode.backgroundColor = strongSelf.foregroundColor.withMultipliedBrightnessBy(0.9)
+ } else {
+ backgroundNode.layer.animate(from: (backgroundNode.backgroundColor ?? strongSelf.foregroundColor).cgColor, to: strongSelf.foregroundColor.cgColor, keyPath: "backgroundColor", timingFunction: CAMediaTimingFunctionName.easeInEaseOut.rawValue, duration: 0.4)
+ backgroundNode.backgroundColor = strongSelf.foregroundColor
+ }
}
- }
+ }*/
gestureRecognizer.tapActionAtPoint = { _ in
return .waitForSingleTap
}
- self.backgroundNode.view.addGestureRecognizer(gestureRecognizer)
+ self.containerView.addGestureRecognizer(gestureRecognizer)
- self.pointerInteraction = PointerInteraction(node: self, style: .caret, willEnter: { [weak self] in
+ /*self.pointerInteraction = PointerInteraction(node: self, style: .caret, willEnter: { [weak self] in
guard let strongSelf = self else {
return
}
- strongSelf.backgroundNode.backgroundColor = strongSelf.foregroundColor.withMultipliedBrightnessBy(0.95)
+ if let backgroundNode = strongSelf.contentView.backgroundNode {
+ backgroundNode.backgroundColor = strongSelf.foregroundColor.withMultipliedBrightnessBy(0.95)
+ }
}, willExit: { [weak self] in
guard let strongSelf = self else {
return
}
- strongSelf.backgroundNode.backgroundColor = strongSelf.foregroundColor
- })
+ if let backgroundNode = strongSelf.contentView.backgroundNode {
+ backgroundNode.backgroundColor = strongSelf.foregroundColor
+ }
+ })*/
}
public func setAccessoryComponent(component: AnyComponent?) {
- if let component = component {
+ /*if let component = component {
let accessoryComponentContainer: UIView
if let current = self.accessoryComponentContainer {
accessoryComponentContainer = current
@@ -142,119 +549,43 @@ public class SearchBarPlaceholderNode: ASDisplayNode {
accessoryComponentView.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false, completion: { [weak accessoryComponentView] _ in
accessoryComponentView?.removeFromSuperview()
})
+ }*/
+ }
+
+ public func takeContents() -> SearchBarPlaceholderContentView {
+ self.isTakenOut = true
+ return self.contentView
+ }
+
+ public func putBackContents() {
+ self.isTakenOut = false
+ self.containerView.addSubview(self.contentView)
+ if let params = self.params {
+ let _ = self.update(params: params, transition: .immediate)
}
}
- public func asyncLayout() -> (_ placeholderString: NSAttributedString?, _ compactPlaceholderString: NSAttributedString?, _ constrainedSize: CGSize, _ expansionProgress: CGFloat, _ iconColor: UIColor, _ foregroundColor: UIColor, _ backgroundColor: UIColor, _ transition: ContainedViewLayoutTransition) -> (CGFloat, () -> Void) {
- let labelLayout = TextNode.asyncLayout(self.labelNode)
- let currentForegroundColor = self.foregroundColor
- let currentIconColor = self.iconColor
+ public func updateLayout(placeholderString: NSAttributedString?, compactPlaceholderString: NSAttributedString?, constrainedSize: CGSize, expansionProgress: CGFloat, iconColor: UIColor, foregroundColor: UIColor, backgroundColor: UIColor, controlColor: UIColor, transition: ContainedViewLayoutTransition) -> CGFloat {
+ let params = Params(placeholderString: placeholderString, compactPlaceholderString: compactPlaceholderString, constrainedSize: constrainedSize, expansionProgress: expansionProgress, iconColor: iconColor, foregroundColor: foregroundColor, backgroundColor: backgroundColor, controlColor: controlColor)
+ self.params = params
- return { fullPlaceholderString, compactPlaceholderString, constrainedSize, expansionProgress, iconColor, foregroundColor, backgroundColor, transition in
- let placeholderString: NSAttributedString?
- if constrainedSize.width < 350.0 {
- placeholderString = compactPlaceholderString
- } else {
- placeholderString = fullPlaceholderString
- }
-
- let (labelLayoutResult, labelApply) = labelLayout(TextNodeLayoutArguments(attributedString: placeholderString, backgroundColor: .clear, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: constrainedSize, alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
-
- var updatedColor: UIColor?
- var updatedIconImage: UIImage?
- if !currentForegroundColor.isEqual(foregroundColor) {
- updatedColor = foregroundColor
- }
- if !currentIconColor.isEqual(iconColor) {
- updatedIconImage = generateLoupeIcon(color: iconColor)
- }
-
- let height = constrainedSize.height * expansionProgress
- return (height, { [weak self] in
- if let strongSelf = self {
- let _ = labelApply()
-
- strongSelf.fillBackgroundColor = backgroundColor
- strongSelf.foregroundColor = foregroundColor
- strongSelf.iconColor = iconColor
- strongSelf.backgroundNode.isUserInteractionEnabled = expansionProgress > 0.9999
-
- if let updatedColor = updatedColor {
- strongSelf.backgroundNode.backgroundColor = updatedColor
- }
- if let updatedIconImage = updatedIconImage {
- strongSelf.iconNode.image = updatedIconImage
- }
-
- strongSelf.placeholderString = placeholderString
-
- var iconSize = CGSize()
- var totalWidth = labelLayoutResult.size.width
- let spacing: CGFloat = 6.0
-
- if let iconImage = strongSelf.iconNode.image {
- iconSize = iconImage.size
- totalWidth += iconSize.width + spacing
- transition.updateFrame(node: strongSelf.iconNode, frame: CGRect(origin: CGPoint(x: floor((constrainedSize.width - totalWidth) / 2.0), y: floorToScreenPixels((height - iconSize.height) / 2.0)), size: iconSize))
- }
- var textOffset: CGFloat = 0.0
- if constrainedSize.height >= 36.0 {
- textOffset += 1.0
- }
- let labelFrame = CGRect(origin: CGPoint(x: floor((constrainedSize.width - totalWidth) / 2.0) + iconSize.width + spacing, y: floorToScreenPixels((height - labelLayoutResult.size.height) / 2.0) + textOffset), size: labelLayoutResult.size)
- transition.updateFrame(node: strongSelf.labelNode, frame: labelFrame)
-
- var innerAlpha = max(0.0, expansionProgress - 0.77) / 0.23
- if innerAlpha > 0.9999 {
- innerAlpha = 1.0
- } else if innerAlpha < 0.0001 {
- innerAlpha = 0.0
- }
- if strongSelf.labelNode.alpha != innerAlpha {
- if !transition.isAnimated {
- strongSelf.labelNode.layer.removeAnimation(forKey: "opacity")
- strongSelf.iconNode.layer.removeAnimation(forKey: "opacity")
- }
-
- transition.updateAlpha(node: strongSelf.labelNode, alpha: innerAlpha)
- transition.updateAlpha(node: strongSelf.iconNode, alpha: innerAlpha)
- }
-
- let outerAlpha = min(0.3, expansionProgress) / 0.3
- let cornerRadius = min(strongSelf.fieldStyle.cornerDiameter / 2.0, height / 2.0)
-
- if strongSelf.backgroundNode.cornerRadius != cornerRadius {
- if !transition.isAnimated {
- strongSelf.backgroundNode.layer.removeAnimation(forKey: "cornerRadius")
- }
- transition.updateCornerRadius(node: strongSelf.backgroundNode, cornerRadius: cornerRadius)
- }
-
- if strongSelf.backgroundNode.alpha != outerAlpha {
- if !transition.isAnimated {
- strongSelf.backgroundNode.layer.removeAnimation(forKey: "opacity")
- }
- transition.updateAlpha(node: strongSelf.backgroundNode, alpha: outerAlpha)
- }
-
- if strongSelf.backgroundNode.frame != CGRect(origin: CGPoint(), size: CGSize(width: constrainedSize.width, height: height)) {
- if !transition.isAnimated {
- strongSelf.backgroundNode.layer.removeAnimation(forKey: "position")
- strongSelf.backgroundNode.layer.removeAnimation(forKey: "bounds")
- }
- transition.updateFrame(node: strongSelf.backgroundNode, frame: CGRect(origin: CGPoint(), size: CGSize(width: constrainedSize.width, height: height)))
- }
-
- if let accessoryComponentContainer = strongSelf.accessoryComponentContainer {
- accessoryComponentContainer.frame = CGRect(origin: CGPoint(x: constrainedSize.width - accessoryComponentContainer.bounds.width - 4.0, y: floor((constrainedSize.height * expansionProgress - accessoryComponentContainer.bounds.height) / 2.0)), size: accessoryComponentContainer.bounds.size)
- transition.updateAlpha(layer: accessoryComponentContainer.layer, alpha: innerAlpha)
-
- }
- }
- })
+ if self.isTakenOut {
+ return self.currentLayoutHeight ?? 44.0
+ } else {
+ let height = self.update(params: params, transition: transition)
+ self.currentLayoutHeight = height
+ return height
}
}
+ private func update(params: Params, transition: ContainedViewLayoutTransition) -> CGFloat {
+ let height = self.contentView.updateLayout(placeholderString: params.placeholderString, compactPlaceholderString: params.compactPlaceholderString, constrainedSize: params.constrainedSize, expansionProgress: params.expansionProgress, iconColor: params.iconColor, foregroundColor: params.foregroundColor, backgroundColor: params.backgroundColor, controlColor: params.controlColor, transition: transition)
+ let size = CGSize(width: params.constrainedSize.width, height: height)
+ transition.updateFrame(view: self.containerView, frame: CGRect(origin: CGPoint(), size: size))
+ transition.updateFrame(view: self.contentView, frame: CGRect(origin: CGPoint(), size: size))
+ return height
+ }
+
@objc private func backgroundTap(_ recognizer: TapLongTapOrDoubleTapGestureRecognizer) {
if case .ended = recognizer.state {
self.activate?()
diff --git a/submodules/SearchUI/BUILD b/submodules/SearchUI/BUILD
index 7210ffaa..84660a90 100644
--- a/submodules/SearchUI/BUILD
+++ b/submodules/SearchUI/BUILD
@@ -10,12 +10,16 @@ swift_library(
"-warnings-as-errors",
],
deps = [
- "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
- "//submodules/AsyncDisplayKit:AsyncDisplayKit",
- "//submodules/Display:Display",
- "//submodules/TelegramPresentationData:TelegramPresentationData",
- "//submodules/SearchBarNode:SearchBarNode",
- "//submodules/ChatListSearchItemNode:ChatListSearchItemNode",
+ "//submodules/SSignalKit/SwiftSignalKit",
+ "//submodules/AsyncDisplayKit",
+ "//submodules/Display",
+ "//submodules/TelegramPresentationData",
+ "//submodules/SearchBarNode",
+ "//submodules/TelegramUI/Components/GlassBackgroundComponent",
+ "//submodules/ComponentFlow",
+ "//submodules/Components/ComponentDisplayAdapters",
+ "//submodules/AppBundle",
+ "//submodules/ActivityIndicator",
],
visibility = [
"//visibility:public",
diff --git a/submodules/SearchUI/Sources/FixSearchableListNodeScrolling.swift b/submodules/SearchUI/Sources/FixSearchableListNodeScrolling.swift
index 9d202507..3704caa3 100644
--- a/submodules/SearchUI/Sources/FixSearchableListNodeScrolling.swift
+++ b/submodules/SearchUI/Sources/FixSearchableListNodeScrolling.swift
@@ -1,33 +1,6 @@
import Foundation
import AsyncDisplayKit
import Display
-import ChatListSearchItemNode
-
-public func fixSearchableListNodeScrolling(_ listNode: ListView) {
- var searchItemNode: ListViewItemNode?
- var nextItemNode: ListViewItemNode?
-
- listNode.forEachItemNode { itemNode in
- if let itemNode = itemNode as? ChatListSearchItemNode {
- searchItemNode = itemNode
- } else if searchItemNode != nil && nextItemNode == nil {
- nextItemNode = itemNode as? ListViewItemNode
- }
- }
-
- if let searchItemNode = searchItemNode {
- let itemFrame = searchItemNode.apparentFrame
- if itemFrame.contains(CGPoint(x: 0.0, y: listNode.insets.top)) {
- if itemFrame.minY + itemFrame.height * 0.6 < listNode.insets.top {
- if let nextItemNode = nextItemNode {
- listNode.ensureItemNodeVisibleAtTopInset(nextItemNode)
- }
- } else {
- listNode.ensureItemNodeVisibleAtTopInset(searchItemNode)
- }
- }
- }
-}
public func fixNavigationSearchableListNodeScrolling(_ listNode: ListView, searchNode: NavigationBarSearchContentNode) -> Bool {
if searchNode.expansionProgress > 0.0 && searchNode.expansionProgress < 1.0 {
@@ -47,22 +20,3 @@ public func fixNavigationSearchableListNodeScrolling(_ listNode: ListView, searc
}
return false
}
-
-func fixNavigationSearchableGridNodeScrolling(_ gridNode: GridNode, searchNode: NavigationBarSearchContentNode) -> Bool {
- if searchNode.expansionProgress > 0.0 && searchNode.expansionProgress < 1.0 {
- let scrollToItem: GridNodeScrollToItem
- let targetProgress: CGFloat
- if searchNode.expansionProgress < 0.6 {
- scrollToItem = GridNodeScrollToItem(index: 0, position: .top(-navigationBarSearchContentHeight), transition: .animated(duration: 0.3, curve: .easeInOut), directionHint: .up, adjustForSection: true, adjustForTopInset: true)
- targetProgress = 0.0
- } else {
- scrollToItem = GridNodeScrollToItem(index: 0, position: .top(0.0), transition: .animated(duration: 0.3, curve: .easeInOut), directionHint: .up, adjustForSection: true, adjustForTopInset: true)
- targetProgress = 1.0
- }
- searchNode.updateExpansionProgress(targetProgress, animated: true)
-
- gridNode.transaction(GridNodeTransaction(deleteItems: [], insertItems: [], updateItems: [], scrollToItem: scrollToItem, updateLayout: nil, itemTransition: .immediate, stationaryItems: .none, updateFirstIndexInSectionOffset: nil, updateOpaqueState: nil, synchronousLoads: false), completion: { _ in })
- return true
- }
- return false
-}
diff --git a/submodules/SearchUI/Sources/NavigationBarSearchContentNode.swift b/submodules/SearchUI/Sources/NavigationBarSearchContentNode.swift
index 49978807..e63cadc7 100644
--- a/submodules/SearchUI/Sources/NavigationBarSearchContentNode.swift
+++ b/submodules/SearchUI/Sources/NavigationBarSearchContentNode.swift
@@ -4,11 +4,28 @@ import AsyncDisplayKit
import Display
import TelegramPresentationData
import SearchBarNode
+import GlassBackgroundComponent
+import ComponentFlow
+import ComponentDisplayAdapters
+import AppBundle
+import ActivityIndicator
private let searchBarFont = Font.regular(17.0)
-public let navigationBarSearchContentHeight: CGFloat = 54.0
+public let navigationBarSearchContentHeight: CGFloat = 60.0
public class NavigationBarSearchContentNode: NavigationBarContentNode {
+ private struct Params: Equatable {
+ let size: CGSize
+ let leftInset: CGFloat
+ let rightInset: CGFloat
+
+ init(size: CGSize, leftInset: CGFloat, rightInset: CGFloat) {
+ self.size = size
+ self.leftInset = leftInset
+ self.rightInset = rightInset
+ }
+ }
+
public var theme: PresentationTheme?
public var placeholder: String
public var compactPlaceholder: String
@@ -19,8 +36,6 @@ public class NavigationBarSearchContentNode: NavigationBarContentNode {
private var disabledOverlay: ASDisplayNode?
public var expansionProgress: CGFloat = 1.0
-
- public var additionalHeight: CGFloat = 0.0
private var validLayout: (CGSize, CGFloat, CGFloat)?
@@ -30,7 +45,7 @@ public class NavigationBarSearchContentNode: NavigationBarContentNode {
self.compactPlaceholder = compactPlaceholder ?? placeholder
self.inline = inline
- self.placeholderNode = SearchBarPlaceholderNode(fieldStyle: .modern)
+ self.placeholderNode = SearchBarPlaceholderNode(fieldStyle: .glass)
self.placeholderNode.labelNode.displaysAsynchronously = false
super.init()
@@ -41,6 +56,8 @@ public class NavigationBarSearchContentNode: NavigationBarContentNode {
self.addSubnode(self.placeholderNode)
self.placeholderNode.activate = activate
+
+ //self.backgroundColor = .red
}
public func updateThemeAndPlaceholder(theme: PresentationTheme, placeholder: String, compactPlaceholder: String? = nil) {
@@ -102,10 +119,10 @@ public class NavigationBarSearchContentNode: NavigationBarContentNode {
}
private func updatePlaceholder(_ progress: CGFloat, size: CGSize, leftInset: CGFloat, rightInset: CGFloat, transition: ContainedViewLayoutTransition) {
- let padding: CGFloat = 10.0
+ let padding: CGFloat = 16.0
let baseWidth = size.width - padding * 2.0 - leftInset - rightInset
- let fieldHeight: CGFloat = 36.0
+ let fieldHeight: CGFloat = 44.0
let fraction = fieldHeight / self.nominalHeight
let fullFraction = navigationBarSearchContentHeight / self.nominalHeight
@@ -116,21 +133,19 @@ public class NavigationBarSearchContentNode: NavigationBarContentNode {
var visibleProgress: CGFloat = toLow + (self.expansionProgress - fromLow) * (toHigh - toLow) / (fromHigh - fromLow)
visibleProgress = max(0.0, min(1.0, visibleProgress))
- let searchBarNodeLayout = self.placeholderNode.asyncLayout()
-
let textColor = self.theme?.rootController.navigationSearchBar.inputPlaceholderTextColor ?? UIColor(rgb: 0x8e8e93)
var fillColor = self.theme?.rootController.navigationSearchBar.inputFillColor ?? .clear
if self.inline, let theme = self.theme, fillColor.distance(to: theme.list.blocksBackgroundColor) < 100 {
fillColor = fillColor.withMultipliedBrightnessBy(0.8)
}
- let backgroundColor = self.theme?.rootController.navigationBar.opaqueBackgroundColor ?? .clear
+ let backgroundColor = self.theme?.chatList.regularSearchBarColor ?? .clear
+ let controlColor = self.theme?.chat.inputPanel.panelControlColor ?? .black
let placeholderString = NSAttributedString(string: self.placeholder, font: searchBarFont, textColor: textColor)
let compactPlaceholderString = NSAttributedString(string: self.compactPlaceholder, font: searchBarFont, textColor: textColor)
- let (searchBarHeight, searchBarApply) = searchBarNodeLayout(placeholderString, compactPlaceholderString, CGSize(width: baseWidth, height: fieldHeight), visibleProgress, textColor, fillColor, backgroundColor, transition)
- searchBarApply()
+ let searchBarHeight = self.placeholderNode.updateLayout(placeholderString: placeholderString, compactPlaceholderString: compactPlaceholderString, constrainedSize: CGSize(width: baseWidth, height: fieldHeight), expansionProgress: visibleProgress, iconColor: textColor, foregroundColor: fillColor, backgroundColor: backgroundColor, controlColor: controlColor, transition: transition)
let searchBarFrame = CGRect(origin: CGPoint(x: padding + leftInset, y: size.height + (1.0 - visibleProgress) * fieldHeight - 8.0 - fieldHeight), size: CGSize(width: baseWidth, height: fieldHeight))
transition.updateFrame(node: self.placeholderNode, frame: searchBarFrame)
@@ -143,10 +158,12 @@ public class NavigationBarSearchContentNode: NavigationBarContentNode {
}
}
- override public func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, transition: ContainedViewLayoutTransition) {
+ override public func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, transition: ContainedViewLayoutTransition) -> CGSize {
self.validLayout = (size, leftInset, rightInset)
self.updatePlaceholder(self.expansionProgress, size: size, leftInset: leftInset, rightInset: rightInset, transition: transition)
+
+ return size
}
override public var height: CGFloat {
@@ -158,7 +175,7 @@ public class NavigationBarSearchContentNode: NavigationBarContentNode {
}
override public var nominalHeight: CGFloat {
- return navigationBarSearchContentHeight + self.additionalHeight
+ return 60.0
}
override public var mode: NavigationBarContentMode {
diff --git a/submodules/SearchUI/Sources/SearchDisplayController.swift b/submodules/SearchUI/Sources/SearchDisplayController.swift
index 50420e6b..53cdd002 100644
--- a/submodules/SearchUI/Sources/SearchDisplayController.swift
+++ b/submodules/SearchUI/Sources/SearchDisplayController.swift
@@ -25,12 +25,14 @@ public final class SearchDisplayController {
}
}
- private let searchBar: SearchBarNode
+ private var searchBar: SearchBarNode?
+ private let searchBarIsExternal: Bool
private let mode: SearchDisplayControllerMode
private let backgroundNode: BackgroundNode
public let contentNode: SearchDisplayControllerContentNode
private var hasSeparator: Bool
private let inline: Bool
+ private let cancel: () -> Void
private var containerLayout: (ContainerViewLayout, CGFloat)?
@@ -38,71 +40,75 @@ public final class SearchDisplayController {
private var isSearchingDisposable: Disposable?
- public init(presentationData: PresentationData, mode: SearchDisplayControllerMode = .navigation, placeholder: String? = nil, hasBackground: Bool = false, hasSeparator: Bool = false, contentNode: SearchDisplayControllerContentNode, inline: Bool = false, cancel: @escaping () -> Void) {
+ public init(
+ presentationData: PresentationData,
+ mode: SearchDisplayControllerMode = .navigation,
+ placeholder: String? = nil,
+ hasBackground: Bool = false,
+ hasSeparator: Bool = false,
+ contentNode: SearchDisplayControllerContentNode,
+ inline: Bool = false,
+ cancel: @escaping () -> Void,
+ fieldStyle: SearchBarStyle = .modern,
+ searchBarIsExternal: Bool = false
+ ) {
self.inline = inline
- self.searchBar = SearchBarNode(theme: SearchBarNodeTheme(theme: presentationData.theme, hasBackground: hasBackground, hasSeparator: hasSeparator, inline: inline), strings: presentationData.strings, fieldStyle: .modern, forceSeparator: hasSeparator, displayBackground: hasBackground)
+ self.cancel = cancel
+ self.searchBarIsExternal = searchBarIsExternal
+
+ if !searchBarIsExternal {
+ self.searchBar = SearchBarNode(theme: SearchBarNodeTheme(theme: presentationData.theme, hasBackground: hasBackground, hasSeparator: hasSeparator, inline: inline), presentationTheme: presentationData.theme, strings: presentationData.strings, fieldStyle: fieldStyle, forceSeparator: hasSeparator, displayBackground: hasBackground)
+ }
self.backgroundNode = BackgroundNode()
self.backgroundNode.allowsGroupOpacity = true
self.mode = mode
self.contentNode = contentNode
self.hasSeparator = hasSeparator
+
+ if let searchBar = self.searchBar {
+ self.setSearchBar(searchBar)
+ }
- self.searchBar.textUpdated = { [weak contentNode] text, _ in
- contentNode?.searchTextUpdated(text: text)
- }
- self.searchBar.tokensUpdated = { [weak contentNode] tokens in
- contentNode?.searchTokensUpdated(tokens: tokens)
- }
- self.searchBar.cancel = { [weak self] in
- self?.isDeactivating = true
- cancel()
- }
- self.searchBar.clearPrefix = { [weak contentNode] in
- contentNode?.searchTextClearPrefix()
- }
- self.searchBar.clearTokens = { [weak contentNode] in
- contentNode?.searchTextClearTokens()
- }
self.contentNode.cancel = { [weak self] in
self?.isDeactivating = true
cancel()
}
self.contentNode.dismissInput = { [weak self] in
- self?.searchBar.deactivate(clear: false)
+ self?.searchBar?.deactivate(clear: false)
}
var isFirstTime = true
self.contentNode.setQuery = { [weak self] prefix, tokens, query in
- if let strongSelf = self {
- strongSelf.searchBar.prefixString = prefix
- let previousTokens = strongSelf.searchBar.tokens
- strongSelf.searchBar.tokens = tokens
- strongSelf.searchBar.text = query
+ if let strongSelf = self, let searchBar = strongSelf.searchBar {
+ searchBar.prefixString = prefix
+ let previousTokens = searchBar.tokens
+ searchBar.tokens = tokens
+ searchBar.text = query
if previousTokens.count < tokens.count && !isFirstTime {
if let lastToken = tokens.last, !lastToken.permanent {
- strongSelf.searchBar.selectLastToken()
+ searchBar.selectLastToken()
}
}
isFirstTime = false
}
}
if let placeholder = placeholder {
- self.searchBar.placeholderString = NSAttributedString(string: placeholder, font: Font.regular(17.0), textColor: presentationData.theme.rootController.navigationSearchBar.inputPlaceholderTextColor)
+ self.searchBar?.placeholderString = NSAttributedString(string: placeholder, font: Font.regular(17.0), textColor: presentationData.theme.rootController.navigationSearchBar.inputPlaceholderTextColor)
}
self.contentNode.setPlaceholder = { [weak self] string in
- guard string != self?.searchBar.placeholderString?.string else {
+ guard string != self?.searchBar?.placeholderString?.string else {
return
}
- if let mutableAttributedString = self?.searchBar.placeholderString?.mutableCopy() as? NSMutableAttributedString {
+ if let mutableAttributedString = self?.searchBar?.placeholderString?.mutableCopy() as? NSMutableAttributedString {
mutableAttributedString.mutableString.setString(string)
- self?.searchBar.placeholderString = mutableAttributedString
+ self?.searchBar?.placeholderString = mutableAttributedString
}
}
self.isSearchingDisposable = (contentNode.isSearching
|> deliverOnMainQueue).start(next: { [weak self] value in
- self?.searchBar.activity = value
+ self?.searchBar?.activity = value
})
if self.contentNode.hasDim {
@@ -113,9 +119,32 @@ public final class SearchDisplayController {
self.backgroundNode.isTransparent = false
}
}
+
+ public func setSearchBar(_ searchBar: SearchBarNode) {
+ self.searchBar = searchBar
+
+ searchBar.textUpdated = { [weak contentNode] text, _ in
+ contentNode?.searchTextUpdated(text: text)
+ }
+ searchBar.tokensUpdated = { [weak contentNode] tokens in
+ contentNode?.searchTokensUpdated(tokens: tokens)
+ }
+ searchBar.cancel = { [weak self] in
+ self?.isDeactivating = true
+ self?.cancel()
+ }
+ searchBar.clearPrefix = { [weak contentNode] in
+ contentNode?.searchTextClearPrefix()
+ }
+ searchBar.clearTokens = { [weak contentNode] in
+ contentNode?.searchTextClearTokens()
+ }
+ }
public func updatePresentationData(_ presentationData: PresentationData) {
- self.searchBar.updateThemeAndStrings(theme: SearchBarNodeTheme(theme: presentationData.theme, hasSeparator: self.hasSeparator, inline: self.inline), strings: presentationData.strings)
+ if !self.searchBarIsExternal {
+ self.searchBar?.updateThemeAndStrings(theme: SearchBarNodeTheme(theme: presentationData.theme, hasSeparator: self.hasSeparator, inline: self.inline), presentationTheme: presentationData.theme, strings: presentationData.strings)
+ }
self.contentNode.updatePresentationData(presentationData)
if self.contentNode.hasDim {
@@ -128,6 +157,8 @@ public final class SearchDisplayController {
}
public func containerLayoutUpdated(_ layout: ContainerViewLayout, navigationBarHeight: CGFloat, transition: ContainedViewLayoutTransition) {
+ let defaultNavigationBarHeight = navigationBarHeight
+
let statusBarHeight: CGFloat = layout.statusBarHeight ?? 0.0
let searchBarHeight: CGFloat = max(20.0, statusBarHeight) + 44.0
let navigationBarOffset: CGFloat
@@ -137,32 +168,44 @@ public final class SearchDisplayController {
navigationBarOffset = 0.0
}
var navigationBarFrame = CGRect(origin: CGPoint(x: 0.0, y: navigationBarOffset), size: CGSize(width: layout.size.width, height: searchBarHeight))
+ if self.searchBarIsExternal {
+ navigationBarFrame.size.height -= 50.0
+ }
if layout.statusBarHeight == nil {
navigationBarFrame.size.height = 64.0
}
navigationBarFrame.size.height += 10.0
+ var navigationBarHeight = navigationBarFrame.maxY
- let searchBarFrame: CGRect
- if case .navigation = self.mode {
- searchBarFrame = CGRect(x: 0.0, y: 0.0, width: layout.size.width, height: 54.0)
- } else {
- searchBarFrame = navigationBarFrame
+ if !self.searchBarIsExternal, let searchBar = self.searchBar {
+ let searchBarFrame: CGRect
+ if case .navigation = self.mode {
+ if case .glass = searchBar.fieldStyle {
+ navigationBarHeight = defaultNavigationBarHeight
+ searchBarFrame = CGRect(x: 0.0, y: 0.0, width: layout.size.width, height: 44.0)
+ } else {
+ searchBarFrame = CGRect(x: 0.0, y: 0.0, width: layout.size.width, height: 54.0)
+ }
+ } else {
+ searchBarFrame = navigationBarFrame
+ navigationBarHeight = navigationBarFrame.maxY + 8.0
+ }
+ transition.updateFrame(node: searchBar, frame: searchBarFrame)
+ searchBar.updateLayout(boundingSize: searchBarFrame.size, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, transition: transition)
}
- transition.updateFrame(node: self.searchBar, frame: searchBarFrame)
- self.searchBar.updateLayout(boundingSize: searchBarFrame.size, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, transition: transition)
- self.containerLayout = (layout, navigationBarFrame.maxY)
+ self.containerLayout = (layout, navigationBarHeight)
let bounds = CGRect(origin: CGPoint(), size: layout.size)
- transition.updateFrame(node: self.backgroundNode, frame: bounds.insetBy(dx: -20.0, dy: -20.0))
+ transition.updateFrame(node: self.backgroundNode, frame: bounds)//.insetBy(dx: -20.0, dy: -20.0))
- var size = layout.size
- size.width += 20.0 * 2.0
- transition.updateFrame(node: self.contentNode, frame: CGRect(origin: CGPoint(x: 0.0, y: 20.0), size: size))
+ let size = layout.size
+ //size.width += 20.0 * 2.0
+ transition.updateFrame(node: self.contentNode, frame: CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: size))
- var safeInsets = layout.safeInsets
- safeInsets.left += 20.0
- safeInsets.right += 20.0
+ let safeInsets = layout.safeInsets
+ //safeInsets.left += 20.0
+ //safeInsets.right += 20.0
self.contentNode.containerLayoutUpdated(ContainerViewLayout(size: size, metrics: LayoutMetrics(), deviceMetrics: layout.deviceMetrics, intrinsicInsets: layout.intrinsicInsets, safeInsets: safeInsets, additionalInsets: UIEdgeInsets(), statusBarHeight: nil, inputHeight: layout.inputHeight, inputHeightIsInteractivellyChanging: layout.inputHeightIsInteractivellyChanging, inVoiceOver: layout.inVoiceOver), navigationBarHeight: navigationBarHeight, transition: transition)
}
@@ -183,14 +226,14 @@ public final class SearchDisplayController {
self.backgroundNode.isTransparent = false
}
- var size = layout.size
- size.width += 20.0 * 2.0
+ let size = layout.size
+ //size.width += 20.0 * 2.0
- self.contentNode.frame = CGRect(origin: CGPoint(x: 0.0, y: 20.0), size: size)
+ self.contentNode.frame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: size)
- var safeInsets = layout.safeInsets
- safeInsets.left += 20.0
- safeInsets.right += 20.0
+ let safeInsets = layout.safeInsets
+ //safeInsets.left += 20.0
+ //safeInsets.right += 20.0
self.contentNode.containerLayoutUpdated(ContainerViewLayout(size: size, metrics: LayoutMetrics(), deviceMetrics: layout.deviceMetrics, intrinsicInsets: UIEdgeInsets(), safeInsets: safeInsets, additionalInsets: UIEdgeInsets(), statusBarHeight: nil, inputHeight: nil, inputHeightIsInteractivellyChanging: false, inVoiceOver: false), navigationBarHeight: navigationBarHeight, transition: .immediate)
var contentNavigationBarHeight = navigationBarHeight
@@ -201,22 +244,22 @@ public final class SearchDisplayController {
if !self.contentNode.hasDim {
self.backgroundNode.alpha = 1.0
self.backgroundNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2, timingFunction: CAMediaTimingFunctionName.linear.rawValue)
-
- self.backgroundNode.layer.animateScale(from: 0.85, to: 1.0, duration: 0.5, timingFunction: kCAMediaTimingFunctionSpring)
}
- if !self.contentNode.hasDim {
- if let placeholder = placeholder {
- self.searchBar.placeholderString = placeholder.placeholderString
- }
- } else {
- if let placeholder = placeholder {
- let initialTextBackgroundFrame = placeholder.convert(placeholder.backgroundNode.frame, to: nil)
- let contentNodePosition = self.backgroundNode.layer.position
- if contentNode.animateBackgroundAppearance {
- self.backgroundNode.layer.animatePosition(from: CGPoint(x: contentNodePosition.x, y: contentNodePosition.y + (initialTextBackgroundFrame.maxY + 8.0 - contentNavigationBarHeight)), to: contentNodePosition, duration: 0.5, timingFunction: kCAMediaTimingFunctionSpring)
+ if !self.searchBarIsExternal {
+ if !self.contentNode.hasDim {
+ if let placeholder = placeholder {
+ self.searchBar?.placeholderString = placeholder.placeholderString
+ }
+ } else {
+ if let placeholder = placeholder {
+ let initialTextBackgroundFrame = placeholder.convert(placeholder.backgroundView.frame, to: nil)
+ let contentNodePosition = self.backgroundNode.layer.position
+ if contentNode.animateBackgroundAppearance {
+ self.backgroundNode.layer.animatePosition(from: CGPoint(x: contentNodePosition.x, y: contentNodePosition.y + (initialTextBackgroundFrame.maxY + 8.0 - contentNavigationBarHeight)), to: contentNodePosition, duration: 0.5, timingFunction: kCAMediaTimingFunctionSpring)
+ }
+ self.searchBar?.placeholderString = placeholder.placeholderString
}
- self.searchBar.placeholderString = placeholder.placeholderString
}
}
@@ -240,39 +283,49 @@ public final class SearchDisplayController {
navigationBarFrame = CGRect(x: 0.0, y: 0.0, width: layout.size.width, height: 54.0)
}
- self.searchBar.frame = navigationBarFrame
- insertSubnode(self.searchBar, true)
- self.searchBar.layout()
-
- if focus {
- self.searchBar.activate()
+ if !self.searchBarIsExternal, let searchBar = self.searchBar {
+ searchBar.frame = navigationBarFrame
+ insertSubnode(searchBar, true)
+ searchBar.layout()
+
+ if focus {
+ searchBar.activate()
+ }
}
+
if let placeholder = placeholder {
- self.searchBar.animateIn(from: placeholder, duration: 0.5, timingFunction: kCAMediaTimingFunctionSpring)
+ if !self.searchBarIsExternal, let searchBar = self.searchBar {
+ searchBar.animateIn(from: placeholder, duration: 0.5, timingFunction: kCAMediaTimingFunctionSpring)
+ }
if self.contentNode.hasDim {
self.contentNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.3, timingFunction: CAMediaTimingFunctionName.easeOut.rawValue)
}
} else {
- self.searchBar.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.3, timingFunction: CAMediaTimingFunctionName.easeOut.rawValue)
+ if !self.searchBarIsExternal, let searchBar = self.searchBar {
+ searchBar.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.3, timingFunction: CAMediaTimingFunctionName.easeOut.rawValue)
+ }
self.contentNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.3, timingFunction: CAMediaTimingFunctionName.easeOut.rawValue)
}
}
- public func deactivate(placeholder: SearchBarPlaceholderNode?, animated: Bool = true) {
- self.searchBar.deactivate(clear: false)
+ public func deactivate(placeholder: SearchBarPlaceholderNode?, animated: Bool = true, completion: (() -> Void)? = nil) {
+ if let searchBar = self.searchBar {
+ searchBar.deactivate(clear: false)
+ }
- let searchBar = self.searchBar
- if let placeholder = placeholder {
- searchBar.transitionOut(to: placeholder, transition: animated ? .animated(duration: 0.5, curve: .spring) : .immediate, completion: {
- [weak searchBar] in
- searchBar?.removeFromSupernode()
- })
- } else {
- searchBar.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.3, removeOnCompletion: false, completion: { [weak searchBar] finished in
- if finished {
+ if !self.searchBarIsExternal, let searchBar = self.searchBar {
+ if let placeholder = placeholder {
+ searchBar.transitionOut(to: placeholder, transition: animated ? .animated(duration: 0.5, curve: .spring) : .immediate, completion: {
+ [weak searchBar] in
searchBar?.removeFromSupernode()
- }
- })
+ })
+ } else {
+ searchBar.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.3, removeOnCompletion: false, completion: { [weak searchBar] finished in
+ if finished {
+ searchBar?.removeFromSupernode()
+ }
+ })
+ }
}
let backgroundNode = self.backgroundNode
@@ -282,10 +335,12 @@ public final class SearchDisplayController {
if finished {
backgroundNode?.removeFromSupernode()
}
+ completion?()
})
} else {
backgroundNode.removeFromSupernode()
contentNode.removeFromSupernode()
+ completion?()
}
}
diff --git a/submodules/SectionHeaderItem/Sources/SectionHeaderItem.swift b/submodules/SectionHeaderItem/Sources/SectionHeaderItem.swift
index 37a1f4f9..2a5f15e6 100644
--- a/submodules/SectionHeaderItem/Sources/SectionHeaderItem.swift
+++ b/submodules/SectionHeaderItem/Sources/SectionHeaderItem.swift
@@ -73,7 +73,7 @@ private class SectionHeaderItemNode: ListViewItemNode {
private var layoutParams: ListViewItemLayoutParams?
required init() {
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
}
override func layoutForParams(_ params: ListViewItemLayoutParams, item: ListViewItem, previousItem: ListViewItem?, nextItem: ListViewItem?) {
diff --git a/submodules/SettingsUI/BUILD b/submodules/SettingsUI/BUILD
index 353a1ec8..06cc3d6d 100644
--- a/submodules/SettingsUI/BUILD
+++ b/submodules/SettingsUI/BUILD
@@ -23,7 +23,6 @@ swift_library(
"//submodules/PresentationDataUtils:PresentationDataUtils",
"//submodules/AvatarNode:AvatarNode",
"//submodules/CallListUI:CallListUI",
- "//submodules/ChatListSearchItemNode:ChatListSearchItemNode",
"//submodules/ChatListSearchItemHeader:ChatListSearchItemHeader",
"//submodules/ChatListUI:ChatListUI",
"//submodules/ContactsPeerItem:ContactsPeerItem",
@@ -129,9 +128,13 @@ swift_library(
"//submodules/TelegramUI/Components/Settings/PasskeysScreen",
"//submodules/TelegramUI/Components/FaceScanScreen",
"//submodules/ComponentFlow",
+ "//submodules/Components/ComponentDisplayAdapters",
"//submodules/Components/BundleIconComponent",
"//submodules/TelegramUI/Components/ButtonComponent",
"//submodules/TelegramUI/Components/SliderComponent",
+ "//submodules/TelegramUI/Components/AlertComponent",
+ "//submodules/TelegramUI/Components/AlertComponent/AlertInputFieldComponent",
+ "//submodules/TelegramUI/Components/EdgeEffect",
],
visibility = [
"//visibility:public",
diff --git a/submodules/SettingsUI/Sources/BubbleSettings/BubbleSettingsController.swift b/submodules/SettingsUI/Sources/BubbleSettings/BubbleSettingsController.swift
index 65965353..dfbb3230 100644
--- a/submodules/SettingsUI/Sources/BubbleSettings/BubbleSettingsController.swift
+++ b/submodules/SettingsUI/Sources/BubbleSettings/BubbleSettingsController.swift
@@ -320,7 +320,9 @@ final class BubbleSettingsController: ViewController {
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
self.presentationThemeSettings = presentationThemeSettings
- super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationTheme: self.presentationData.theme, presentationStrings: self.presentationData.strings))
+ super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationTheme: self.presentationData.theme, presentationStrings: self.presentationData.strings, style: .glass))
+
+ self._hasGlassStyle = true
self.blocksBackgroundWhenInOverlay = true
self.acceptsFocusWhenInOverlay = true
diff --git a/submodules/SettingsUI/Sources/ChangePhoneNumberController.swift b/submodules/SettingsUI/Sources/ChangePhoneNumberController.swift
index bda486bb..9a03e479 100644
--- a/submodules/SettingsUI/Sources/ChangePhoneNumberController.swift
+++ b/submodules/SettingsUI/Sources/ChangePhoneNumberController.swift
@@ -48,7 +48,7 @@ public func ChangePhoneNumberController(context: AccountContext) -> ViewControll
controller?.inProgress = false
var dismissImpl: (() -> Void)?
- let codeController = AuthorizationSequenceCodeEntryController(presentationData: presentationData, back: {
+ let codeController = AuthorizationSequenceCodeEntryController(sharedContext: context.sharedContext, presentationData: presentationData, back: {
dismissImpl?()
})
codeController.loginWithCode = { [weak codeController] code in
@@ -109,7 +109,7 @@ public func ChangePhoneNumberController(context: AccountContext) -> ViewControll
let mnc = carrier.mobileNetworkCode ?? "none"
let _ = context.engine.auth.reportMissingCode(phoneNumber: phoneNumber, phoneCodeHash: next.hash, mnc: mnc).start()
- AuthorizationSequenceController.presentDidNotGetCodeUI(controller: codeController, presentationData: context.sharedContext.currentPresentationData.with({ $0 }), phoneNumber: phoneNumber, mnc: mnc)
+ AuthorizationSequenceController.presentDidNotGetCodeUI(sharedContext: context.sharedContext, controller: codeController, presentationData: context.sharedContext.currentPresentationData.with({ $0 }), phoneNumber: phoneNumber, mnc: mnc)
}
codeController.openFragment = { url in
context.sharedContext.applicationBindings.openUrl(url)
@@ -154,7 +154,15 @@ public func ChangePhoneNumberController(context: AccountContext) -> ViewControll
controller?.view.window?.rootViewController?.present(composeController, animated: true, completion: nil)
} else {
- controller?.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: nil, text: presentationData.strings.Login_EmailNotConfiguredError, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ let alertController = textAlertController(
+ context: context,
+ title: nil,
+ text: presentationData.strings.Login_EmailNotConfiguredError,
+ actions: [
+ TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})
+ ]
+ )
+ controller?.present(alertController, in: .window(.root))
}
}))
case .generic:
diff --git a/submodules/SettingsUI/Sources/Data and Storage/AutodownloadDataUsagePickerItem.swift b/submodules/SettingsUI/Sources/Data and Storage/AutodownloadDataUsagePickerItem.swift
index 735565cf..acb2d8f7 100644
--- a/submodules/SettingsUI/Sources/Data and Storage/AutodownloadDataUsagePickerItem.swift
+++ b/submodules/SettingsUI/Sources/Data and Storage/AutodownloadDataUsagePickerItem.swift
@@ -133,7 +133,7 @@ private final class AutodownloadDataUsagePickerItemNode: ListViewItemNode {
self.activateArea = AccessibilityAreaNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.lowTextNode)
self.addSubnode(self.mediumTextNode)
diff --git a/submodules/SettingsUI/Sources/Data and Storage/AutodownloadSizeLimitItem.swift b/submodules/SettingsUI/Sources/Data and Storage/AutodownloadSizeLimitItem.swift
index affc44c9..280d7365 100644
--- a/submodules/SettingsUI/Sources/Data and Storage/AutodownloadSizeLimitItem.swift
+++ b/submodules/SettingsUI/Sources/Data and Storage/AutodownloadSizeLimitItem.swift
@@ -143,7 +143,7 @@ private final class AutodownloadSizeLimitItemNode: ListViewItemNode {
self.maxTextNode.isUserInteractionEnabled = false
self.maxTextNode.displaysAsynchronously = false
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.textNode)
self.addSubnode(self.minTextNode)
diff --git a/submodules/SettingsUI/Sources/Data and Storage/CalculatingCacheSizeItem.swift b/submodules/SettingsUI/Sources/Data and Storage/CalculatingCacheSizeItem.swift
index 2d6531d3..2f86442b 100644
--- a/submodules/SettingsUI/Sources/Data and Storage/CalculatingCacheSizeItem.swift
+++ b/submodules/SettingsUI/Sources/Data and Storage/CalculatingCacheSizeItem.swift
@@ -90,7 +90,7 @@ private final class CalculatingCacheSizeItemNode: ListViewItemNode {
self.titleNode.contentMode = .left
self.titleNode.contentsScale = UIScreen.main.scale
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.titleNode)
}
diff --git a/submodules/SettingsUI/Sources/Data and Storage/EnergyUsageBatteryLevelItem.swift b/submodules/SettingsUI/Sources/Data and Storage/EnergyUsageBatteryLevelItem.swift
index 84ce6fb2..831492c2 100644
--- a/submodules/SettingsUI/Sources/Data and Storage/EnergyUsageBatteryLevelItem.swift
+++ b/submodules/SettingsUI/Sources/Data and Storage/EnergyUsageBatteryLevelItem.swift
@@ -112,7 +112,7 @@ class EnergyUsageBatteryLevelItemNode: ListViewItemNode {
self.batteryBackgroundNode = ASImageNode()
self.batteryForegroundNode = ASImageNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.leftTextNode)
self.addSubnode(self.rightTextNode)
diff --git a/submodules/SettingsUI/Sources/Data and Storage/KeepMediaDurationPickerItem.swift b/submodules/SettingsUI/Sources/Data and Storage/KeepMediaDurationPickerItem.swift
index 69cf7884..a62039c1 100644
--- a/submodules/SettingsUI/Sources/Data and Storage/KeepMediaDurationPickerItem.swift
+++ b/submodules/SettingsUI/Sources/Data and Storage/KeepMediaDurationPickerItem.swift
@@ -107,7 +107,7 @@ private final class KeepMediaDurationPickerItemNode: ListViewItemNode {
}
self.textNodes = textNodes
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
for textNode in textNodes {
self.addSubnode(textNode)
diff --git a/submodules/SettingsUI/Sources/Data and Storage/MaximumCacheSizePickerItem.swift b/submodules/SettingsUI/Sources/Data and Storage/MaximumCacheSizePickerItem.swift
index 6d6d7257..25c1db6d 100644
--- a/submodules/SettingsUI/Sources/Data and Storage/MaximumCacheSizePickerItem.swift
+++ b/submodules/SettingsUI/Sources/Data and Storage/MaximumCacheSizePickerItem.swift
@@ -122,7 +122,7 @@ private final class MaximumCacheSizePickerItemNode: ListViewItemNode {
}
self.textNodes = textNodes
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
for textNode in textNodes {
self.addSubnode(textNode)
diff --git a/submodules/SettingsUI/Sources/Data and Storage/ProxyServerActionSheetController.swift b/submodules/SettingsUI/Sources/Data and Storage/ProxyServerActionSheetController.swift
index f4c1aee4..bcc32f58 100644
--- a/submodules/SettingsUI/Sources/Data and Storage/ProxyServerActionSheetController.swift
+++ b/submodules/SettingsUI/Sources/Data and Storage/ProxyServerActionSheetController.swift
@@ -14,6 +14,7 @@ import PresentationDataUtils
import UrlEscaping
public final class ProxyServerActionSheetController: ActionSheetController {
+ private let sharedContext: SharedAccountContext
private var presentationDisposable: Disposable?
private let _ready = Promise()
@@ -25,10 +26,11 @@ public final class ProxyServerActionSheetController: ActionSheetController {
convenience public init(context: AccountContext, server: ProxyServerSettings) {
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
- self.init(presentationData: presentationData, accountManager: context.sharedContext.accountManager, postbox: context.account.postbox, network: context.account.network, server: server, updatedPresentationData: context.sharedContext.presentationData)
+ self.init(sharedContext: context.sharedContext, presentationData: presentationData, accountManager: context.sharedContext.accountManager, postbox: context.account.postbox, network: context.account.network, server: server, updatedPresentationData: context.sharedContext.presentationData)
}
- public init(presentationData: PresentationData, accountManager: AccountManager, postbox: Postbox, network: Network, server: ProxyServerSettings, updatedPresentationData: Signal?) {
+ public init(sharedContext: SharedAccountContext, presentationData: PresentationData, accountManager: AccountManager, postbox: Postbox, network: Network, server: ProxyServerSettings, updatedPresentationData: Signal?) {
+ self.sharedContext = sharedContext
let sheetTheme = ActionSheetControllerTheme(presentationData: presentationData)
super.init(theme: sheetTheme)
@@ -39,7 +41,7 @@ public final class ProxyServerActionSheetController: ActionSheetController {
items.append(ActionSheetTextItem(title: presentationData.strings.SocksProxySetup_AdNoticeHelp))
}
items.append(ProxyServerInfoItem(strings: presentationData.strings, network: network, server: server))
- items.append(ProxyServerActionItem(accountManager:accountManager, postbox: postbox, network: network, presentationData: presentationData, server: server, dismiss: { [weak self] success in
+ items.append(ProxyServerActionItem(sharedContext: sharedContext, accountManager:accountManager, postbox: postbox, network: network, presentationData: presentationData, server: server, dismiss: { [weak self] success in
guard let strongSelf = self, !strongSelf.isDismissed else {
return
}
@@ -262,6 +264,7 @@ private final class ProxyServerInfoItemNode: ActionSheetItemNode {
}
private final class ProxyServerActionItem: ActionSheetItem {
+ private let sharedContext: SharedAccountContext
private let accountManager: AccountManager
private let postbox: Postbox
private let network: Network
@@ -270,7 +273,8 @@ private final class ProxyServerActionItem: ActionSheetItem {
private let dismiss: (Bool) -> Void
private let present: (ViewController, Any?) -> Void
- init(accountManager: AccountManager, postbox: Postbox, network: Network, presentationData: PresentationData, server: ProxyServerSettings, dismiss: @escaping (Bool) -> Void, present: @escaping (ViewController, Any?) -> Void) {
+ init(sharedContext: SharedAccountContext, accountManager: AccountManager, postbox: Postbox, network: Network, presentationData: PresentationData, server: ProxyServerSettings, dismiss: @escaping (Bool) -> Void, present: @escaping (ViewController, Any?) -> Void) {
+ self.sharedContext = sharedContext
self.accountManager = accountManager
self.postbox = postbox
self.network = network
@@ -281,7 +285,7 @@ private final class ProxyServerActionItem: ActionSheetItem {
}
func node(theme: ActionSheetControllerTheme) -> ActionSheetItemNode {
- return ProxyServerActionItemNode(accountManager: self.accountManager, postbox: self.postbox, network: self.network, presentationData: self.presentationData, theme: theme, server: self.server, dismiss: self.dismiss, present: self.present)
+ return ProxyServerActionItemNode(sharedContext: self.sharedContext, accountManager: self.accountManager, postbox: self.postbox, network: self.network, presentationData: self.presentationData, theme: theme, server: self.server, dismiss: self.dismiss, present: self.present)
}
func updateNode(_ node: ActionSheetItemNode) {
@@ -289,6 +293,7 @@ private final class ProxyServerActionItem: ActionSheetItem {
}
private final class ProxyServerActionItemNode: ActionSheetItemNode {
+ private let sharedContext: SharedAccountContext
private let accountManager: AccountManager
private let postbox: Postbox
private let network: Network
@@ -305,7 +310,8 @@ private final class ProxyServerActionItemNode: ActionSheetItemNode {
private let disposable = MetaDisposable()
private var revertSettings: ProxySettings?
- init(accountManager: AccountManager, postbox: Postbox, network: Network, presentationData: PresentationData, theme: ActionSheetControllerTheme, server: ProxyServerSettings, dismiss: @escaping (Bool) -> Void, present: @escaping (ViewController, Any?) -> Void) {
+ init(sharedContext: SharedAccountContext, accountManager: AccountManager, postbox: Postbox, network: Network, presentationData: PresentationData, theme: ActionSheetControllerTheme, server: ProxyServerSettings, dismiss: @escaping (Bool) -> Void, present: @escaping (ViewController, Any?) -> Void) {
+ self.sharedContext = sharedContext
self.accountManager = accountManager
self.postbox = postbox
self.network = network
@@ -430,7 +436,7 @@ private final class ProxyServerActionItemNode: ActionSheetItemNode {
strongSelf.buttonNode.isUserInteractionEnabled = true
strongSelf.requestLayoutUpdate()
- strongSelf.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: nil, text: strongSelf.presentationData.strings.SocksProxySetup_FailedToConnect, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), nil)
+ strongSelf.present(textAlertController(sharedContext: strongSelf.sharedContext, title: nil, text: strongSelf.presentationData.strings.SocksProxySetup_FailedToConnect, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), nil)
}
}
}))
diff --git a/submodules/SettingsUI/Sources/Data and Storage/ProxySettingsActionItem.swift b/submodules/SettingsUI/Sources/Data and Storage/ProxySettingsActionItem.swift
index 6b3e7849..e1f086ab 100644
--- a/submodules/SettingsUI/Sources/Data and Storage/ProxySettingsActionItem.swift
+++ b/submodules/SettingsUI/Sources/Data and Storage/ProxySettingsActionItem.swift
@@ -114,7 +114,7 @@ private final class ProxySettingsActionItemNode: ListViewItemNode {
self.highlightedBackgroundNode = ASDisplayNode()
self.highlightedBackgroundNode.isLayerBacked = true
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.isAccessibilityElement = true
diff --git a/submodules/SettingsUI/Sources/Data and Storage/ProxySettingsServerItem.swift b/submodules/SettingsUI/Sources/Data and Storage/ProxySettingsServerItem.swift
index da7512dd..3108d649 100644
--- a/submodules/SettingsUI/Sources/Data and Storage/ProxySettingsServerItem.swift
+++ b/submodules/SettingsUI/Sources/Data and Storage/ProxySettingsServerItem.swift
@@ -174,7 +174,7 @@ private final class ProxySettingsServerItemNode: ItemListRevealOptionsItemNode {
self.highlightedBackgroundNode = ASDisplayNode()
self.highlightedBackgroundNode.isLayerBacked = true
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.addSubnode(self.titleNode)
self.addSubnode(self.statusNode)
diff --git a/submodules/SettingsUI/Sources/Data and Storage/StorageUsageItem.swift b/submodules/SettingsUI/Sources/Data and Storage/StorageUsageItem.swift
index e50a2c31..7a085e60 100644
--- a/submodules/SettingsUI/Sources/Data and Storage/StorageUsageItem.swift
+++ b/submodules/SettingsUI/Sources/Data and Storage/StorageUsageItem.swift
@@ -119,7 +119,7 @@ private final class StorageUsageItemNode: ListViewItemNode {
self.lineNodes = []
self.descriptionNodes = []
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.lineMaskNode)
}
diff --git a/submodules/SettingsUI/Sources/Data and Storage/WebBrowserDomainController.swift b/submodules/SettingsUI/Sources/Data and Storage/WebBrowserDomainController.swift
index 4d62514a..d75618da 100644
--- a/submodules/SettingsUI/Sources/Data and Storage/WebBrowserDomainController.swift
+++ b/submodules/SettingsUI/Sources/Data and Storage/WebBrowserDomainController.swift
@@ -7,465 +7,99 @@ import TelegramCore
import TelegramPresentationData
import AccountContext
import UrlEscaping
-import ActivityIndicator
+import ComponentFlow
+import AlertComponent
+import AlertInputFieldComponent
-private final class WebBrowserDomainInputFieldNode: ASDisplayNode, ASEditableTextNodeDelegate {
- private var theme: PresentationTheme
- private let backgroundNode: ASImageNode
- fileprivate let textInputNode: EditableTextNode
- private let placeholderNode: ASTextNode
+public func webBrowserDomainController(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal)? = nil, apply: @escaping (String?) -> Void) -> ViewController {
+ let presentationData = context.sharedContext.currentPresentationData.with { $0 }
+ let strings = presentationData.strings
- var updateHeight: (() -> Void)?
- var complete: (() -> Void)?
- var textChanged: ((String) -> Void)?
+ let inputState = AlertInputFieldComponent.ExternalState()
- private let backgroundInsets = UIEdgeInsets(top: 8.0, left: 16.0, bottom: 15.0, right: 16.0)
- private let inputInsets = UIEdgeInsets(top: 5.0, left: 12.0, bottom: 5.0, right: 12.0)
-
- var text: String {
- get {
- return self.textInputNode.attributedText?.string ?? ""
- }
- set {
- self.textInputNode.attributedText = NSAttributedString(string: newValue, font: Font.regular(17.0), textColor: self.theme.actionSheet.inputTextColor)
- self.placeholderNode.isHidden = !newValue.isEmpty
- }
+ let doneIsEnabled: Signal = inputState.valueSignal
+ |> map { value in
+ return !value.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
}
- var placeholder: String = "" {
- didSet {
- self.placeholderNode.attributedText = NSAttributedString(string: self.placeholder, font: Font.regular(17.0), textColor: self.theme.actionSheet.inputPlaceholderColor)
- }
- }
-
- init(theme: PresentationTheme, placeholder: String) {
- self.theme = theme
+ let doneInProgressPromise = ValuePromise(false)
+
+ var content: [AnyComponentWithIdentity] = []
+ content.append(AnyComponentWithIdentity(
+ id: "title",
+ component: AnyComponent(
+ AlertTitleComponent(title: strings.WebBrowser_Exceptions_Create_Title)
+ )
+ ))
+ content.append(AnyComponentWithIdentity(
+ id: "text",
+ component: AnyComponent(
+ AlertTextComponent(content: .plain(strings.WebBrowser_Exceptions_Create_Text))
+ )
+ ))
- self.backgroundNode = ASImageNode()
- self.backgroundNode.isLayerBacked = true
- self.backgroundNode.displaysAsynchronously = false
- self.backgroundNode.displayWithoutProcessing = true
- self.backgroundNode.image = generateStretchableFilledCircleImage(diameter: 12.0, color: theme.actionSheet.inputHollowBackgroundColor, strokeColor: theme.actionSheet.inputBorderColor, strokeWidth: 1.0)
-
- self.textInputNode = EditableTextNode()
- self.textInputNode.typingAttributes = [NSAttributedString.Key.font.rawValue: Font.regular(17.0), NSAttributedString.Key.foregroundColor.rawValue: theme.actionSheet.inputTextColor]
- self.textInputNode.clipsToBounds = true
- self.textInputNode.hitTestSlop = UIEdgeInsets(top: -5.0, left: -5.0, bottom: -5.0, right: -5.0)
- self.textInputNode.textContainerInset = UIEdgeInsets(top: self.inputInsets.top, left: 0.0, bottom: self.inputInsets.bottom, right: 0.0)
- self.textInputNode.keyboardAppearance = theme.rootController.keyboardColor.keyboardAppearance
- self.textInputNode.keyboardType = .URL
- self.textInputNode.autocapitalizationType = .none
- self.textInputNode.returnKeyType = .done
- self.textInputNode.autocorrectionType = .no
- self.textInputNode.tintColor = theme.actionSheet.controlAccentColor
-
- self.placeholderNode = ASTextNode()
- self.placeholderNode.isUserInteractionEnabled = false
- self.placeholderNode.displaysAsynchronously = false
- self.placeholderNode.attributedText = NSAttributedString(string: placeholder, font: Font.regular(17.0), textColor: self.theme.actionSheet.inputPlaceholderColor)
-
- super.init()
-
- self.textInputNode.delegate = self
-
- self.addSubnode(self.backgroundNode)
- self.addSubnode(self.textInputNode)
- self.addSubnode(self.placeholderNode)
- }
-
- func updateTheme(_ theme: PresentationTheme) {
- self.theme = theme
-
- self.backgroundNode.image = generateStretchableFilledCircleImage(diameter: 12.0, color: self.theme.actionSheet.inputHollowBackgroundColor, strokeColor: self.theme.actionSheet.inputBorderColor, strokeWidth: 1.0)
- self.textInputNode.keyboardAppearance = self.theme.rootController.keyboardColor.keyboardAppearance
- self.placeholderNode.attributedText = NSAttributedString(string: self.placeholderNode.attributedText?.string ?? "", font: Font.regular(17.0), textColor: self.theme.actionSheet.inputPlaceholderColor)
- self.textInputNode.tintColor = self.theme.actionSheet.controlAccentColor
- }
-
- func updateLayout(width: CGFloat, transition: ContainedViewLayoutTransition) -> CGFloat {
- let backgroundInsets = self.backgroundInsets
- let inputInsets = self.inputInsets
-
- let textFieldHeight = self.calculateTextFieldMetrics(width: width)
- let panelHeight = textFieldHeight + backgroundInsets.top + backgroundInsets.bottom
-
- let backgroundFrame = CGRect(origin: CGPoint(x: backgroundInsets.left, y: backgroundInsets.top), size: CGSize(width: width - backgroundInsets.left - backgroundInsets.right, height: panelHeight - backgroundInsets.top - backgroundInsets.bottom))
- transition.updateFrame(node: self.backgroundNode, frame: backgroundFrame)
-
- let placeholderSize = self.placeholderNode.measure(backgroundFrame.size)
- transition.updateFrame(node: self.placeholderNode, frame: CGRect(origin: CGPoint(x: backgroundFrame.minX + inputInsets.left, y: backgroundFrame.minY + floor((backgroundFrame.size.height - placeholderSize.height) / 2.0)), size: placeholderSize))
-
- transition.updateFrame(node: self.textInputNode, frame: CGRect(origin: CGPoint(x: backgroundFrame.minX + inputInsets.left, y: backgroundFrame.minY), size: CGSize(width: backgroundFrame.size.width - inputInsets.left - inputInsets.right, height: backgroundFrame.size.height)))
-
- return panelHeight
- }
-
- func activateInput() {
- self.textInputNode.becomeFirstResponder()
- }
-
- func deactivateInput() {
- self.textInputNode.resignFirstResponder()
- }
-
- @objc func editableTextNodeDidUpdateText(_ editableTextNode: ASEditableTextNode) {
- self.updateTextNodeText(animated: true)
- self.textChanged?(editableTextNode.textView.text)
- self.placeholderNode.isHidden = !(editableTextNode.textView.text ?? "").isEmpty
- }
-
- private let domainRegex = try? NSRegularExpression(pattern: "^(https?://)?([a-zA-Z0-9-]+\\.?)*([a-zA-Z]*)?(:)?(/)?$", options: [])
- private let pathRegex = try? NSRegularExpression(pattern: "^(https?://)?([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,6}/", options: [])
-
- var inProgress = false
-
- func editableTextNode(_ editableTextNode: ASEditableTextNode, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
- if self.inProgress {
- return false
- }
- if text == "\n" {
- self.complete?()
- return false
- }
-
- if let domainRegex = self.domainRegex, let pathRegex = self.pathRegex {
- let updatedText = (editableTextNode.textView.text as NSString).replacingCharacters(in: range, with: text)
- let domainMatches = domainRegex.matches(in: updatedText, options: [], range: NSRange(location: 0, length: updatedText.utf16.count))
- let pathMatches = pathRegex.matches(in: updatedText, options: [], range: NSRange(location: 0, length: updatedText.utf16.count))
-
- if domainMatches.count > 0, pathMatches.count == 0 {
- return true
- } else {
- return false
- }
- }
-
- return true
- }
-
- private func calculateTextFieldMetrics(width: CGFloat) -> CGFloat {
- let backgroundInsets = self.backgroundInsets
- let inputInsets = self.inputInsets
-
- let unboundTextFieldHeight = max(33.0, ceil(self.textInputNode.measure(CGSize(width: width - backgroundInsets.left - backgroundInsets.right - inputInsets.left - inputInsets.right, height: CGFloat.greatestFiniteMagnitude)).height))
-
- return min(61.0, max(33.0, unboundTextFieldHeight))
- }
-
- private func updateTextNodeText(animated: Bool) {
- let backgroundInsets = self.backgroundInsets
-
- let textFieldHeight = self.calculateTextFieldMetrics(width: self.bounds.size.width)
-
- let panelHeight = textFieldHeight + backgroundInsets.top + backgroundInsets.bottom
- if !self.bounds.size.height.isEqual(to: panelHeight) {
- self.updateHeight?()
- }
- }
-
- @objc func clearPressed() {
- self.textInputNode.attributedText = nil
- self.deactivateInput()
- }
-}
-
-private final class WebBrowserDomainAlertContentNode: AlertContentNode {
- private let strings: PresentationStrings
-
- private let titleNode: ASTextNode
- private let textNode: ASTextNode
- let activityIndicator: ActivityIndicator
- let inputFieldNode: WebBrowserDomainInputFieldNode
-
- private let actionNodesSeparator: ASDisplayNode
- private let actionNodes: [TextAlertContentActionNode]
- private let actionVerticalSeparators: [ASDisplayNode]
-
- private let disposable = MetaDisposable()
-
- private var validLayout: CGSize?
-
- private let hapticFeedback = HapticFeedback()
-
- var complete: (() -> Void)? {
- didSet {
- self.inputFieldNode.complete = self.complete
- }
- }
-
- override var dismissOnOutsideTap: Bool {
- return self.isUserInteractionEnabled
- }
-
- init(theme: AlertControllerTheme, ptheme: PresentationTheme, strings: PresentationStrings, actions: [TextAlertAction]) {
- self.strings = strings
-
- self.titleNode = ASTextNode()
- self.titleNode.maximumNumberOfLines = 2
- self.textNode = ASTextNode()
- self.textNode.maximumNumberOfLines = 2
-
- self.activityIndicator = ActivityIndicator(type: .custom(ptheme.rootController.navigationBar.secondaryTextColor, 20.0, 1.5, false), speed: .slow)
- self.activityIndicator.isHidden = true
-
- self.inputFieldNode = WebBrowserDomainInputFieldNode(theme: ptheme, placeholder: strings.WebBrowser_Exceptions_Create_Placeholder)
- self.inputFieldNode.text = ""
-
- self.actionNodesSeparator = ASDisplayNode()
- self.actionNodesSeparator.isLayerBacked = true
-
- self.actionNodes = actions.map { action -> TextAlertContentActionNode in
- return TextAlertContentActionNode(theme: theme, action: action)
- }
-
- var actionVerticalSeparators: [ASDisplayNode] = []
- if actions.count > 1 {
- for _ in 0 ..< actions.count - 1 {
- let separatorNode = ASDisplayNode()
- separatorNode.isLayerBacked = true
- actionVerticalSeparators.append(separatorNode)
- }
- }
- self.actionVerticalSeparators = actionVerticalSeparators
-
- super.init()
-
- self.addSubnode(self.titleNode)
- self.addSubnode(self.textNode)
-
- self.addSubnode(self.inputFieldNode)
- self.addSubnode(self.activityIndicator)
-
- self.addSubnode(self.actionNodesSeparator)
-
- for actionNode in self.actionNodes {
- self.addSubnode(actionNode)
- }
- self.actionNodes.last?.actionEnabled = false
-
- for separatorNode in self.actionVerticalSeparators {
- self.addSubnode(separatorNode)
- }
-
- self.inputFieldNode.updateHeight = { [weak self] in
- if let strongSelf = self {
- if let _ = strongSelf.validLayout {
- strongSelf.requestLayout?(.animated(duration: 0.15, curve: .spring))
- }
- }
- }
-
- self.inputFieldNode.textChanged = { [weak self] text in
- if let strongSelf = self, let lastNode = strongSelf.actionNodes.last {
- lastNode.actionEnabled = !text.isEmpty
- }
- }
-
- self.updateTheme(theme)
- }
-
- deinit {
- self.disposable.dispose()
- }
-
- var link: String {
- return self.inputFieldNode.text
- }
-
- override func updateTheme(_ theme: AlertControllerTheme) {
- self.titleNode.attributedText = NSAttributedString(string: self.strings.WebBrowser_Exceptions_Create_Title, font: Font.bold(17.0), textColor: theme.primaryColor, paragraphAlignment: .center)
- self.textNode.attributedText = NSAttributedString(string: self.strings.WebBrowser_Exceptions_Create_Text, font: Font.regular(13.0), textColor: theme.primaryColor, paragraphAlignment: .center)
-
- self.actionNodesSeparator.backgroundColor = theme.separatorColor
- for actionNode in self.actionNodes {
- actionNode.updateTheme(theme)
- }
- for separatorNode in self.actionVerticalSeparators {
- separatorNode.backgroundColor = theme.separatorColor
- }
-
- if let size = self.validLayout {
- _ = self.updateLayout(size: size, transition: .immediate)
- }
- }
-
- override func updateLayout(size: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
- var size = size
- size.width = min(size.width, 270.0)
- let measureSize = CGSize(width: size.width - 16.0 * 2.0, height: CGFloat.greatestFiniteMagnitude)
-
- let hadValidLayout = self.validLayout != nil
-
- self.validLayout = size
-
- var origin: CGPoint = CGPoint(x: 0.0, y: 20.0)
- let spacing: CGFloat = 5.0
-
- let titleSize = self.titleNode.measure(measureSize)
- transition.updateFrame(node: self.titleNode, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - titleSize.width) / 2.0), y: origin.y), size: titleSize))
- origin.y += titleSize.height + 4.0
-
- let textSize = self.textNode.measure(measureSize)
- transition.updateFrame(node: self.textNode, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - textSize.width) / 2.0), y: origin.y), size: textSize))
- origin.y += textSize.height + 6.0 + spacing
-
- let actionButtonHeight: CGFloat = 44.0
- var minActionsWidth: CGFloat = 0.0
- let maxActionWidth: CGFloat = floor(size.width / CGFloat(self.actionNodes.count))
- let actionTitleInsets: CGFloat = 8.0
-
- var effectiveActionLayout = TextAlertContentActionLayout.horizontal
- for actionNode in self.actionNodes {
- let actionTitleSize = actionNode.titleNode.updateLayout(CGSize(width: maxActionWidth, height: actionButtonHeight))
- if case .horizontal = effectiveActionLayout, actionTitleSize.height > actionButtonHeight * 0.6667 {
- effectiveActionLayout = .vertical
- }
- switch effectiveActionLayout {
- case .horizontal:
- minActionsWidth += actionTitleSize.width + actionTitleInsets
- case .vertical:
- minActionsWidth = max(minActionsWidth, actionTitleSize.width + actionTitleInsets)
- }
- }
-
- let insets = UIEdgeInsets(top: 18.0, left: 18.0, bottom: 9.0, right: 18.0)
-
- var contentWidth = max(titleSize.width, minActionsWidth)
- contentWidth = max(contentWidth, 234.0)
-
- var actionsHeight: CGFloat = 0.0
- switch effectiveActionLayout {
- case .horizontal:
- actionsHeight = actionButtonHeight
- case .vertical:
- actionsHeight = actionButtonHeight * CGFloat(self.actionNodes.count)
- }
-
- let resultWidth = contentWidth + insets.left + insets.right
-
- let inputFieldWidth = resultWidth
- let inputFieldHeight = self.inputFieldNode.updateLayout(width: inputFieldWidth, transition: transition)
- let inputHeight = inputFieldHeight
- let inputFrame = CGRect(x: 0.0, y: origin.y, width: resultWidth, height: inputFieldHeight)
- transition.updateFrame(node: self.inputFieldNode, frame: inputFrame)
- transition.updateAlpha(node: self.inputFieldNode, alpha: inputHeight > 0.0 ? 1.0 : 0.0)
-
- let activitySize = CGSize(width: 20.0, height: 20.0)
- transition.updateFrame(node: self.activityIndicator, frame: CGRect(origin: CGPoint(x: inputFrame.maxX - activitySize.width - 23.0, y: inputFrame.midY - activitySize.height / 2.0 - 3.0), size: activitySize))
-
- let resultSize = CGSize(width: resultWidth, height: titleSize.height + textSize.height + spacing + inputHeight + actionsHeight + insets.top + insets.bottom)
-
- transition.updateFrame(node: self.actionNodesSeparator, frame: CGRect(origin: CGPoint(x: 0.0, y: resultSize.height - actionsHeight - UIScreenPixel), size: CGSize(width: resultSize.width, height: UIScreenPixel)))
-
- var actionOffset: CGFloat = 0.0
- let actionWidth: CGFloat = floor(resultSize.width / CGFloat(self.actionNodes.count))
- var separatorIndex = -1
- var nodeIndex = 0
- for actionNode in self.actionNodes {
- if separatorIndex >= 0 {
- let separatorNode = self.actionVerticalSeparators[separatorIndex]
- switch effectiveActionLayout {
- case .horizontal:
- transition.updateFrame(node: separatorNode, frame: CGRect(origin: CGPoint(x: actionOffset - UIScreenPixel, y: resultSize.height - actionsHeight), size: CGSize(width: UIScreenPixel, height: actionsHeight - UIScreenPixel)))
- case .vertical:
- transition.updateFrame(node: separatorNode, frame: CGRect(origin: CGPoint(x: 0.0, y: resultSize.height - actionsHeight + actionOffset - UIScreenPixel), size: CGSize(width: resultSize.width, height: UIScreenPixel)))
- }
- }
- separatorIndex += 1
-
- let currentActionWidth: CGFloat
- switch effectiveActionLayout {
- case .horizontal:
- if nodeIndex == self.actionNodes.count - 1 {
- currentActionWidth = resultSize.width - actionOffset
- } else {
- currentActionWidth = actionWidth
- }
- case .vertical:
- currentActionWidth = resultSize.width
- }
-
- let actionNodeFrame: CGRect
- switch effectiveActionLayout {
- case .horizontal:
- actionNodeFrame = CGRect(origin: CGPoint(x: actionOffset, y: resultSize.height - actionsHeight), size: CGSize(width: currentActionWidth, height: actionButtonHeight))
- actionOffset += currentActionWidth
- case .vertical:
- actionNodeFrame = CGRect(origin: CGPoint(x: 0.0, y: resultSize.height - actionsHeight + actionOffset), size: CGSize(width: currentActionWidth, height: actionButtonHeight))
- actionOffset += actionButtonHeight
- }
-
- transition.updateFrame(node: actionNode, frame: actionNodeFrame)
-
- nodeIndex += 1
- }
-
- if !hadValidLayout {
- self.inputFieldNode.activateInput()
- }
-
- return resultSize
- }
-
- func animateError() {
- self.inputFieldNode.layer.addShakeAnimation()
- self.hapticFeedback.error()
- }
-}
-
-public func webBrowserDomainController(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal)? = nil, apply: @escaping (String?) -> Void) -> AlertController {
- let presentationData = updatedPresentationData?.initial ?? context.sharedContext.currentPresentationData.with { $0 }
-
- var dismissImpl: ((Bool) -> Void)?
+ let domainRegex = try? NSRegularExpression(pattern: "^(https?://)?([a-zA-Z0-9-]+\\.?)*([a-zA-Z]*)?(:)?(/)?$", options: [])
+ let pathRegex = try? NSRegularExpression(pattern: "^(https?://)?([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,6}/", options: [])
var applyImpl: (() -> Void)?
+ content.append(AnyComponentWithIdentity(
+ id: "input",
+ component: AnyComponent(
+ AlertInputFieldComponent(
+ context: context,
+ initialValue: nil,
+ placeholder: strings.WebBrowser_Exceptions_Create_Placeholder,
+ characterLimit: nil,
+ hasClearButton: true,
+ keyboardType: .URL,
+ autocapitalizationType: .none,
+ autocorrectionType: .no,
+ isInitiallyFocused: true,
+ externalState: inputState,
+ shouldChangeText: { updatedText in
+ guard let domainRegex, let pathRegex else {
+ return true
+ }
+ let domainMatches = domainRegex.matches(in: updatedText, options: [], range: NSRange(location: 0, length: updatedText.utf16.count))
+ let pathMatches = pathRegex.matches(in: updatedText, options: [], range: NSRange(location: 0, length: updatedText.utf16.count))
+ if domainMatches.count > 0, pathMatches.count == 0 {
+ return true
+ } else {
+ return false
+ }
+ },
+ returnKeyAction: {
+ applyImpl?()
+ }
+ )
+ )
+ ))
- var inProgress = false
- let actions: [TextAlertAction] = [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {
- if !inProgress {
- dismissImpl?(true)
- apply(nil)
- }
- }), TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_Done, action: {
- if !inProgress {
- applyImpl?()
- }
- })]
-
- let contentNode = WebBrowserDomainAlertContentNode(theme: AlertControllerTheme(presentationData: presentationData), ptheme: presentationData.theme, strings: presentationData.strings, actions: actions)
- contentNode.complete = {
- applyImpl?()
+ var effectiveUpdatedPresentationData: (PresentationData, Signal)
+ if let updatedPresentationData {
+ effectiveUpdatedPresentationData = updatedPresentationData
+ } else {
+ effectiveUpdatedPresentationData = (presentationData, context.sharedContext.presentationData)
}
- applyImpl = { [weak contentNode] in
- guard let contentNode = contentNode else {
- return
- }
- inProgress = true
- contentNode.inputFieldNode.inProgress = true
- contentNode.activityIndicator.isHidden = false
-
- let updatedLink = explicitUrl(contentNode.link)
+
+ let alertController = AlertScreen(
+ configuration: AlertScreen.Configuration(allowInputInset: true),
+ content: content,
+ actions: [
+ .init(title: strings.Common_Cancel),
+ .init(title: strings.Common_Done, type: .default, action: {
+ applyImpl?()
+ }, autoDismiss: false, isEnabled: doneIsEnabled, progress: doneInProgressPromise.get())
+ ],
+ updatedPresentationData: effectiveUpdatedPresentationData
+ )
+ applyImpl = {
+ let updatedLink = explicitUrl(inputState.value)
if !updatedLink.isEmpty && isValidUrl(updatedLink, validSchemes: ["http": true, "https": true]) {
+ doneInProgressPromise.set(true)
apply(updatedLink)
} else {
- contentNode.animateError()
+ inputState.animateError()
}
}
-
- let controller = AlertController(theme: AlertControllerTheme(presentationData: presentationData), contentNode: contentNode)
- let presentationDataDisposable = (updatedPresentationData?.signal ?? context.sharedContext.presentationData).start(next: { [weak controller, weak contentNode] presentationData in
- controller?.theme = AlertControllerTheme(presentationData: presentationData)
- contentNode?.inputFieldNode.updateTheme(presentationData.theme)
- })
- controller.dismissed = { _ in
- presentationDataDisposable.dispose()
- }
- dismissImpl = { [weak controller] animated in
- contentNode.inputFieldNode.deactivateInput()
- if animated {
- controller?.dismissAnimated()
- } else {
- controller?.dismiss()
- }
- }
- return controller
+ return alertController
}
diff --git a/submodules/SettingsUI/Sources/Data and Storage/WebBrowserDomainExceptionItem.swift b/submodules/SettingsUI/Sources/Data and Storage/WebBrowserDomainExceptionItem.swift
index 2ba71084..29197201 100644
--- a/submodules/SettingsUI/Sources/Data and Storage/WebBrowserDomainExceptionItem.swift
+++ b/submodules/SettingsUI/Sources/Data and Storage/WebBrowserDomainExceptionItem.swift
@@ -132,7 +132,7 @@ final class WebBrowserDomainExceptionItemNode: ItemListRevealOptionsItemNode, It
self.activateArea = AccessibilityAreaNode()
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.addSubnode(self.iconNode)
self.addSubnode(self.titleNode)
diff --git a/submodules/SettingsUI/Sources/Data and Storage/WebBrowserItem.swift b/submodules/SettingsUI/Sources/Data and Storage/WebBrowserItem.swift
index 410254c4..ecaa1035 100644
--- a/submodules/SettingsUI/Sources/Data and Storage/WebBrowserItem.swift
+++ b/submodules/SettingsUI/Sources/Data and Storage/WebBrowserItem.swift
@@ -117,7 +117,7 @@ private final class WebBrowserItemNode: ListViewItemNode {
self.activateArea = AccessibilityAreaNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.iconNode)
self.addSubnode(self.checkIconNode)
diff --git a/submodules/SettingsUI/Sources/Data and Storage/WebBrowserSettingsController.swift b/submodules/SettingsUI/Sources/Data and Storage/WebBrowserSettingsController.swift
index c66c0a99..85fd2174 100644
--- a/submodules/SettingsUI/Sources/Data and Storage/WebBrowserSettingsController.swift
+++ b/submodules/SettingsUI/Sources/Data and Storage/WebBrowserSettingsController.swift
@@ -419,7 +419,7 @@ public func webBrowserSettingsController(context: AccountContext) -> ViewControl
})
dismissImpl = { [weak linkController] in
linkController?.view.endEditing(true)
- linkController?.dismissAnimated()
+ linkController?.dismiss(completion: nil)
}
controller?.present(linkController, in: .window(.root))
}
diff --git a/submodules/SettingsUI/Sources/DeleteAccountOptionsController.swift b/submodules/SettingsUI/Sources/DeleteAccountOptionsController.swift
index df1a0039..7cd58def 100644
--- a/submodules/SettingsUI/Sources/DeleteAccountOptionsController.swift
+++ b/submodules/SettingsUI/Sources/DeleteAccountOptionsController.swift
@@ -16,6 +16,7 @@ import AccountUtils
import PremiumUI
import PasswordSetupUI
import StorageUsageScreen
+import AlertComponent
private struct DeleteAccountOptionsArguments {
let changePhoneNumber: () -> Void
@@ -102,43 +103,43 @@ private enum DeleteAccountOptionsEntry: ItemListNodeEntry, Equatable {
let arguments = arguments as! DeleteAccountOptionsArguments
switch self {
case let .changePhoneNumber(_, title, text):
- return ItemListDisclosureItem(presentationData: presentationData, icon: PresentationResourcesSettings.changePhoneNumber, title: title, label: text, labelStyle: .multilineDetailText, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
+ return ItemListDisclosureItem(presentationData: presentationData, systemStyle: .glass, icon: PresentationResourcesSettings.changePhoneNumber, title: title, label: text, labelStyle: .multilineDetailText, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
arguments.changePhoneNumber()
})
case let .addAccount(_, title, text):
- return ItemListDisclosureItem(presentationData: presentationData, icon: PresentationResourcesSettings.deleteAddAccount, title: title, label: text, labelStyle: .multilineDetailText, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
+ return ItemListDisclosureItem(presentationData: presentationData, systemStyle: .glass, icon: PresentationResourcesSettings.deleteAddAccount, title: title, label: text, labelStyle: .multilineDetailText, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
arguments.addAccount()
})
case let .changePrivacy(_, title, text):
- return ItemListDisclosureItem(presentationData: presentationData, icon: PresentationResourcesSettings.security, title: title, label: text, labelStyle: .multilineDetailText, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
+ return ItemListDisclosureItem(presentationData: presentationData, systemStyle: .glass, icon: PresentationResourcesSettings.security, title: title, label: text, labelStyle: .multilineDetailText, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
arguments.setupPrivacy()
})
case let .setTwoStepAuth(_, title, text):
- return ItemListDisclosureItem(presentationData: presentationData, icon: PresentationResourcesSettings.deleteSetTwoStepAuth, title: title, label: text, labelStyle: .multilineDetailText, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
+ return ItemListDisclosureItem(presentationData: presentationData, systemStyle: .glass, icon: PresentationResourcesSettings.deleteSetTwoStepAuth, title: title, label: text, labelStyle: .multilineDetailText, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
arguments.setupTwoStepAuth()
})
case let .setPasscode(_, title, text):
- return ItemListDisclosureItem(presentationData: presentationData, icon: PresentationResourcesSettings.deleteSetPasscode, title: title, label: text, labelStyle: .multilineDetailText, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
+ return ItemListDisclosureItem(presentationData: presentationData, systemStyle: .glass, icon: PresentationResourcesSettings.deleteSetPasscode, title: title, label: text, labelStyle: .multilineDetailText, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
arguments.setPasscode()
})
case let .clearCache(_, title, text):
- return ItemListDisclosureItem(presentationData: presentationData, icon: PresentationResourcesSettings.dataAndStorage, title: title, label: text, labelStyle: .multilineDetailText, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
+ return ItemListDisclosureItem(presentationData: presentationData, systemStyle: .glass, icon: PresentationResourcesSettings.dataAndStorage, title: title, label: text, labelStyle: .multilineDetailText, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
arguments.clearCache()
})
case let .clearSyncedContacts(_, title, text):
- return ItemListDisclosureItem(presentationData: presentationData, icon: PresentationResourcesSettings.clearSynced, title: title, label: text, labelStyle: .multilineDetailText, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
+ return ItemListDisclosureItem(presentationData: presentationData, systemStyle: .glass, icon: PresentationResourcesSettings.clearSynced, title: title, label: text, labelStyle: .multilineDetailText, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
arguments.clearSyncedContacts()
})
case let .deleteChats(_, title, text):
- return ItemListDisclosureItem(presentationData: presentationData, icon: PresentationResourcesSettings.deleteChats, title: title, label: text, labelStyle: .multilineDetailText, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
+ return ItemListDisclosureItem(presentationData: presentationData, systemStyle: .glass, icon: PresentationResourcesSettings.deleteChats, title: title, label: text, labelStyle: .multilineDetailText, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
arguments.deleteChats()
})
case let .contactSupport(_, title, text):
- return ItemListDisclosureItem(presentationData: presentationData, icon: PresentationResourcesSettings.support, title: title, label: text, labelStyle: .multilineDetailText, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
+ return ItemListDisclosureItem(presentationData: presentationData, systemStyle: .glass, icon: PresentationResourcesSettings.support, title: title, label: text, labelStyle: .multilineDetailText, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
arguments.contactSupport()
})
case let .deleteAccount(_, title):
- return ItemListActionItem(presentationData: presentationData, title: title, kind: .destructive, alignment: .natural, sectionId: self.section, style: .blocks, action: {
+ return ItemListActionItem(presentationData: presentationData, systemStyle: .glass, title: title, kind: .destructive, alignment: .natural, sectionId: self.section, style: .blocks, action: {
arguments.deleteAccount()
})
}
@@ -362,32 +363,36 @@ public func deleteAccountOptionsController(context: AccountContext, navigationCo
}, dismissInput: {}, contentContext: nil, progress: nil, completion: nil)
})
}
-
- let alertController = textAlertController(context: context, title: nil, text: presentationData.strings.Settings_FAQ_Intro, actions: [
- TextAlertAction(type: .genericAction, title: presentationData.strings.Settings_FAQ_Button, action: {
- openFaq(resolvedUrlPromise)
- dismissImpl?()
- }),
- TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {
- supportPeerDisposable.set((supportPeer.get()
- |> take(1)
- |> deliverOnMainQueue).start(next: { peerId in
- guard let peerId = peerId else {
- return
- }
- let _ = (context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: peerId))
- |> deliverOnMainQueue).start(next: { peer in
- guard let peer = peer else {
+ let alertController = AlertScreen(
+ context: context,
+ title: nil,
+ text: presentationData.strings.Settings_FAQ_Intro,
+ actions: [
+ .init(title: presentationData.strings.Settings_FAQ_Button, action: {
+ openFaq(resolvedUrlPromise)
+ dismissImpl?()
+ }),
+ .init(title: presentationData.strings.Common_OK, type: .default, action: {
+ supportPeerDisposable.set((supportPeer.get()
+ |> take(1)
+ |> deliverOnMainQueue).start(next: { peerId in
+ guard let peerId else {
return
}
- if let navigationController = navigationController {
- dismissImpl?()
- context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: context, chatLocation: .peer(peer)))
- }
- })
- }))
- })
- ])
+ let _ = (context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: peerId))
+ |> deliverOnMainQueue).start(next: { peer in
+ guard let peer else {
+ return
+ }
+ if let navigationController = navigationController {
+ dismissImpl?()
+ context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: context, chatLocation: .peer(peer)))
+ }
+ })
+ }))
+ })
+ ]
+ )
alertController.dismissed = { _ in
addAppLogEvent(postbox: context.account.postbox, type: "deactivate.options_support_cancel")
}
diff --git a/submodules/SettingsUI/Sources/DeleteAccountPeersItem.swift b/submodules/SettingsUI/Sources/DeleteAccountPeersItem.swift
index 0e7581bd..1ce362fc 100644
--- a/submodules/SettingsUI/Sources/DeleteAccountPeersItem.swift
+++ b/submodules/SettingsUI/Sources/DeleteAccountPeersItem.swift
@@ -169,7 +169,7 @@ class DeleteAccountPeersItemNode: ListViewItemNode, ItemListItemNode {
self.listView = ListView()
self.listView.transform = CATransform3DMakeRotation(-CGFloat.pi / 2.0, 0.0, 0.0, 1.0)
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.listView)
diff --git a/submodules/SettingsUI/Sources/DeleteAccountPhoneItem.swift b/submodules/SettingsUI/Sources/DeleteAccountPhoneItem.swift
index 11c8ad49..396d6583 100644
--- a/submodules/SettingsUI/Sources/DeleteAccountPhoneItem.swift
+++ b/submodules/SettingsUI/Sources/DeleteAccountPhoneItem.swift
@@ -167,7 +167,7 @@ final class DeleteAccountPhoneItemNode: ListViewItemNode, ItemListItemNode {
self.phoneInputNode = PhoneInputNode(fontSize: 17.0)
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.phoneBackground)
self.addSubnode(self.countryButton)
diff --git a/submodules/SettingsUI/Sources/Language Selection/LocalizationListController.swift b/submodules/SettingsUI/Sources/Language Selection/LocalizationListController.swift
index 8417ebce..63ec3ccf 100644
--- a/submodules/SettingsUI/Sources/Language Selection/LocalizationListController.swift
+++ b/submodules/SettingsUI/Sources/Language Selection/LocalizationListController.swift
@@ -36,7 +36,7 @@ public class LocalizationListController: ViewController {
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
- super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData))
+ super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData, style: .glass))
self.editItem = UIBarButtonItem(title: self.presentationData.strings.Common_Done, style: .done, target: self, action: #selector(self.editPressed))
self.doneItem = UIBarButtonItem(title: self.presentationData.strings.Common_Edit, style: .plain, target: self, action: #selector(self.editPressed))
@@ -86,7 +86,7 @@ public class LocalizationListController: ViewController {
private func updateThemeAndStrings() {
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style
- self.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationData: self.presentationData))
+ self.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationData: self.presentationData, style: .glass), transition: .immediate)
self.searchContentNode?.updateThemeAndPlaceholder(theme: self.presentationData.theme, placeholder: self.presentationData.strings.Common_Search)
self.title = self.presentationData.strings.Settings_AppLanguage
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Back, style: .plain, target: nil, action: nil)
diff --git a/submodules/SettingsUI/Sources/Language Selection/LocalizationListControllerNode.swift b/submodules/SettingsUI/Sources/Language Selection/LocalizationListControllerNode.swift
index 4651de00..ec93cca6 100644
--- a/submodules/SettingsUI/Sources/Language Selection/LocalizationListControllerNode.swift
+++ b/submodules/SettingsUI/Sources/Language Selection/LocalizationListControllerNode.swift
@@ -165,7 +165,7 @@ private final class LocalizationListSearchContainerNode: SearchDisplayController
self.presentationDataPromise = Promise(self.presentationData)
self.dimNode = ASDisplayNode()
- self.dimNode.backgroundColor = UIColor.black.withAlphaComponent(0.5)
+ self.dimNode.backgroundColor = .clear
self.listNode = ListView()
self.listNode.accessibilityPageScrolledString = { row, count in
@@ -809,7 +809,7 @@ final class LocalizationListControllerNode: ViewControllerTracingNode {
self.searchDisplayController = SearchDisplayController(presentationData: self.presentationData, contentNode: LocalizationListSearchContainerNode(context: self.context, listState: self.currentListState ?? LocalizationListState.defaultSettings, selectLocalization: { [weak self] info in self?.selectLocalization(info) }, applyingCode: self.applyingCode.get()), inline: true, cancel: { [weak self] in
self?.requestDeactivateSearch()
- })
+ }, fieldStyle: placeholderNode.fieldStyle)
self.searchDisplayController?.containerLayoutUpdated(containerLayout, navigationBarHeight: navigationBarHeight, transition: .immediate)
self.searchDisplayController?.activate(insertSubnode: { [weak self, weak placeholderNode] subnode, isSearchBar in
diff --git a/submodules/SettingsUI/Sources/LogoutOptionsController.swift b/submodules/SettingsUI/Sources/LogoutOptionsController.swift
index 9deadca7..862a3054 100644
--- a/submodules/SettingsUI/Sources/LogoutOptionsController.swift
+++ b/submodules/SettingsUI/Sources/LogoutOptionsController.swift
@@ -272,10 +272,6 @@ public func logoutOptionsController(context: AccountContext, navigationControlle
context.sharedContext.accountManager.accessChallengeData()
)
|> map { presentationData, accessChallengeData -> (ItemListControllerState, (ItemListNodeState, Any)) in
- let leftNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Cancel), style: .regular, enabled: true, action: {
- dismissImpl?()
- })
-
var hasPasscode = false
switch accessChallengeData.data {
case .numericalPassword, .plaintextPassword:
@@ -284,7 +280,7 @@ public func logoutOptionsController(context: AccountContext, navigationControlle
break
}
- let controllerState = ItemListControllerState(presentationData: ItemListPresentationData(presentationData), title: .text(presentationData.strings.LogoutOptions_Title), leftNavigationButton: leftNavigationButton, rightNavigationButton: nil, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back))
+ let controllerState = ItemListControllerState(presentationData: ItemListPresentationData(presentationData), title: .text(presentationData.strings.LogoutOptions_Title), leftNavigationButton: nil, rightNavigationButton: nil, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back))
let listState = ItemListNodeState(presentationData: ItemListPresentationData(presentationData), entries: logoutOptionsEntries(presentationData: presentationData, canAddAccounts: canAddAccounts, hasPasscode: hasPasscode), style: .blocks)
return (controllerState, (listState, arguments))
diff --git a/submodules/SettingsUI/Sources/Notifications/Exceptions/NotificationExceptionControllerNode.swift b/submodules/SettingsUI/Sources/Notifications/Exceptions/NotificationExceptionControllerNode.swift
index 336ce4ce..32ca8fcb 100644
--- a/submodules/SettingsUI/Sources/Notifications/Exceptions/NotificationExceptionControllerNode.swift
+++ b/submodules/SettingsUI/Sources/Notifications/Exceptions/NotificationExceptionControllerNode.swift
@@ -243,7 +243,6 @@ private final class NotificationExceptionArguments {
}
private enum NotificationExceptionEntryId: Hashable {
- case search
case peerId(Int64)
case addException
case removeAll
@@ -254,13 +253,6 @@ private enum NotificationExceptionEntryId: Hashable {
static func ==(lhs: NotificationExceptionEntryId, rhs: NotificationExceptionEntryId) -> Bool {
switch lhs {
- case .search:
- switch rhs {
- case .search:
- return true
- default:
- return false
- }
case .addException:
switch rhs {
case .addException:
@@ -302,7 +294,6 @@ private enum NotificationExceptionEntry : ItemListNodeEntry {
typealias ItemGenerationArguments = NotificationExceptionArguments
- case search(PresentationTheme, PresentationStrings)
case peer(index: Int, peer: EnginePeer, theme: PresentationTheme, strings: PresentationStrings, dateFormat: PresentationDateTimeFormat, nameDisplayOrder: PresentationPersonNameOrder, description: String, notificationSettings: TelegramPeerNotificationSettings, revealed: Bool, editing: Bool, isSearching: Bool)
case addPeer(index: Int, peer: EnginePeer, theme: PresentationTheme, strings: PresentationStrings, dateFormat: PresentationDateTimeFormat, nameDisplayOrder: PresentationPersonNameOrder)
case addException(PresentationTheme, PresentationStrings, NotificationExceptionMode.Mode, Bool)
@@ -311,10 +302,6 @@ private enum NotificationExceptionEntry : ItemListNodeEntry {
func item(presentationData: ItemListPresentationData, arguments: Any) -> ListViewItem {
let arguments = arguments as! NotificationExceptionArguments
switch self {
- case let .search(theme, strings):
- return NotificationSearchItem(theme: theme, placeholder: strings.Common_Search, activate: {
- arguments.activateSearch()
- })
case let .addException(theme, strings, mode, editing):
let icon: UIImage?
switch mode {
@@ -352,8 +339,6 @@ private enum NotificationExceptionEntry : ItemListNodeEntry {
var stableId: NotificationExceptionEntryId {
switch self {
- case .search:
- return .search
case .addException:
return .addException
case let .peer(_, peer, _, _, _, _, _, _, _, _, _):
@@ -367,13 +352,6 @@ private enum NotificationExceptionEntry : ItemListNodeEntry {
static func == (lhs: NotificationExceptionEntry, rhs: NotificationExceptionEntry) -> Bool {
switch lhs {
- case let .search(lhsTheme, lhsStrings):
- switch rhs {
- case let .search(rhsTheme, rhsStrings):
- return lhsTheme === rhsTheme && lhsStrings === rhsStrings
- default:
- return false
- }
case let .addException(lhsTheme, lhsStrings, lhsMode, lhsEditing):
switch rhs {
case let .addException(rhsTheme, rhsStrings, rhsMode, rhsEditing):
@@ -406,18 +384,16 @@ private enum NotificationExceptionEntry : ItemListNodeEntry {
static func <(lhs: NotificationExceptionEntry, rhs: NotificationExceptionEntry) -> Bool {
switch lhs {
- case .search:
- return true
case .addException:
switch rhs {
- case .search, .addException:
+ case .addException:
return false
default:
return true
}
case let .peer(lhsIndex, _, _, _, _, _, _, _, _, _, _):
switch rhs {
- case .search, .addException:
+ case .addException:
return false
case let .peer(rhsIndex, _, _, _, _, _, _, _, _, _, _):
return lhsIndex < rhsIndex
@@ -428,7 +404,7 @@ private enum NotificationExceptionEntry : ItemListNodeEntry {
}
case let .addPeer(lhsIndex, _, _, _, _, _):
switch rhs {
- case .search, .addException:
+ case .addException:
return false
case let .peer(rhsIndex, _, _, _, _, _, _, _, _, _, _):
return lhsIndex < rhsIndex
@@ -936,7 +912,7 @@ final class NotificationExceptionsControllerNode: ViewControllerTracingNode {
self.searchDisplayController = SearchDisplayController(presentationData: self.presentationData, contentNode: NotificationExceptionsSearchContainerNode(context: self.context, mode: self.stateValue.modify {$0}.mode, arguments: self.arguments!), cancel: { [weak self] in
self?.requestDeactivateSearch(true)
- })
+ }, fieldStyle: placeholderNode.fieldStyle)
self.searchDisplayController?.containerLayoutUpdated(containerLayout, navigationBarHeight: navigationBarHeight, transition: .immediate)
self.searchDisplayController?.activate(insertSubnode: { [weak self, weak placeholderNode] subnode, isSearchBar in
@@ -1007,7 +983,7 @@ private final class NotificationExceptionsSearchContainerNode: SearchDisplayCont
self.themeAndStringsPromise = Promise((self.presentationData.theme, self.presentationData.strings))
self.dimNode = ASDisplayNode()
- self.dimNode.backgroundColor = UIColor.black.withAlphaComponent(0.5)
+ self.dimNode.backgroundColor = .clear
self.listNode = ListView()
self.listNode.accessibilityPageScrolledString = { row, count in
diff --git a/submodules/SettingsUI/Sources/Notifications/Exceptions/NotificationExceptions.swift b/submodules/SettingsUI/Sources/Notifications/Exceptions/NotificationExceptions.swift
index 7cdd4094..7a13bda8 100644
--- a/submodules/SettingsUI/Sources/Notifications/Exceptions/NotificationExceptions.swift
+++ b/submodules/SettingsUI/Sources/Notifications/Exceptions/NotificationExceptions.swift
@@ -39,7 +39,9 @@ public class NotificationExceptionsController: ViewController {
self.updatedMode = updatedMode
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
- super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData))
+ super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData, style: .glass))
+
+ self._hasGlassStyle = true
self.removeAllItem = UIBarButtonItem(title: self.presentationData.strings.Notification_Exceptions_DeleteAll, style: .plain, target: self, action: #selector(self.removeAllPressed))
self.editItem = UIBarButtonItem(title: self.presentationData.strings.Common_Done, style: .done, target: self, action: #selector(self.editPressed))
@@ -90,7 +92,7 @@ public class NotificationExceptionsController: ViewController {
private func updateThemeAndStrings() {
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style
- self.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationData: self.presentationData))
+ self.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationData: self.presentationData, style: .glass), transition: .immediate)
self.searchContentNode?.updateThemeAndPlaceholder(theme: self.presentationData.theme, placeholder: self.presentationData.strings.Common_Search)
self.title = self.presentationData.strings.Notifications_ExceptionsTitle
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Back, style: .plain, target: nil, action: nil)
diff --git a/submodules/SettingsUI/Sources/Notifications/NotificationsCategoryItemListItem.swift b/submodules/SettingsUI/Sources/Notifications/NotificationsCategoryItemListItem.swift
index 9e0f727d..a63e4174 100644
--- a/submodules/SettingsUI/Sources/Notifications/NotificationsCategoryItemListItem.swift
+++ b/submodules/SettingsUI/Sources/Notifications/NotificationsCategoryItemListItem.swift
@@ -148,7 +148,7 @@ public class NotificationsCategoryItemListItemNode: ListViewItemNode, ItemListIt
self.activateArea = AccessibilityAreaNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.titleNode)
self.addSubnode(self.subtitleNode)
diff --git a/submodules/SettingsUI/Sources/Privacy and Security/ForwardPrivacyChatPreviewItem.swift b/submodules/SettingsUI/Sources/Privacy and Security/ForwardPrivacyChatPreviewItem.swift
index f522f382..d7bb50ba 100644
--- a/submodules/SettingsUI/Sources/Privacy and Security/ForwardPrivacyChatPreviewItem.swift
+++ b/submodules/SettingsUI/Sources/Privacy and Security/ForwardPrivacyChatPreviewItem.swift
@@ -115,7 +115,7 @@ class ForwardPrivacyChatPreviewItemNode: ListViewItemNode {
self.measureTextNode = TextNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.clipsToBounds = true
diff --git a/submodules/SettingsUI/Sources/Privacy and Security/GlobalAutoremoveHeaderItem.swift b/submodules/SettingsUI/Sources/Privacy and Security/GlobalAutoremoveHeaderItem.swift
index 585f1d76..5eda7838 100644
--- a/submodules/SettingsUI/Sources/Privacy and Security/GlobalAutoremoveHeaderItem.swift
+++ b/submodules/SettingsUI/Sources/Privacy and Security/GlobalAutoremoveHeaderItem.swift
@@ -68,7 +68,7 @@ class GlobalAutoremoveHeaderItemNode: ListViewItemNode {
init() {
self.animationNode = DefaultAnimatedStickerNodeImpl()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.animationNode)
}
diff --git a/submodules/SettingsUI/Sources/Privacy and Security/GlobalAutoremoveScreen.swift b/submodules/SettingsUI/Sources/Privacy and Security/GlobalAutoremoveScreen.swift
index a10a405f..6b4d5aae 100644
--- a/submodules/SettingsUI/Sources/Privacy and Security/GlobalAutoremoveScreen.swift
+++ b/submodules/SettingsUI/Sources/Privacy and Security/GlobalAutoremoveScreen.swift
@@ -269,8 +269,8 @@ public func globalAutoremoveScreen(context: AccountContext, initialValue: Int32,
} else {
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
let valueText = timeIntervalString(strings: presentationData.strings, value: timeout, usage: .afterTime)
- presentControllerImpl?(standardTextAlertController(
- theme: AlertControllerTheme(presentationData: presentationData),
+ presentControllerImpl?(textAlertController(
+ context: context,
title: presentationData.strings.GlobalAutodeleteSettings_SetConfirmTitle,
text: presentationData.strings.GlobalAutodeleteSettings_SetConfirmText(valueText).string,
actions: [
@@ -350,8 +350,8 @@ public func globalAutoremoveScreen(context: AccountContext, initialValue: Int32,
text = presentationData.strings.GlobalAutodeleteSettings_AttemptDisabledGenericSelection
}
- presentControllerImpl?(standardTextAlertController(
- theme: AlertControllerTheme(presentationData: presentationData),
+ presentControllerImpl?(textAlertController(
+ context: context,
title: nil,
text: text,
actions: [
diff --git a/submodules/SettingsUI/Sources/Privacy and Security/LoginEmailSetupController.swift b/submodules/SettingsUI/Sources/Privacy and Security/LoginEmailSetupController.swift
index 45cb19e0..60087d54 100644
--- a/submodules/SettingsUI/Sources/Privacy and Security/LoginEmailSetupController.swift
+++ b/submodules/SettingsUI/Sources/Privacy and Security/LoginEmailSetupController.swift
@@ -5,6 +5,7 @@ import SwiftSignalKit
import TelegramCore
import AccountContext
import TelegramPresentationData
+import PresentationDataUtils
import AuthorizationUI
import AuthenticationServices
import UndoUI
@@ -76,7 +77,7 @@ public func loginEmailSetupController(context: AccountContext, blocking: Bool, e
var dismissCodeControllerImpl: (() -> Void)?
var presentControllerImpl: ((ViewController) -> Void)?
- let codeController = AuthorizationSequenceCodeEntryController(presentationData: presentationData, back: {
+ let codeController = AuthorizationSequenceCodeEntryController(sharedContext: context.sharedContext, presentationData: presentationData, back: {
dismissCodeControllerImpl?()
dismiss()
})
@@ -119,7 +120,7 @@ public func loginEmailSetupController(context: AccountContext, blocking: Bool, e
codeController?.resetCode()
}
- presentControllerImpl?(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]))
+ presentControllerImpl?(textAlertController(context: context, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]))
}
}
}, completed: { [weak codeController] in
@@ -148,7 +149,7 @@ public func loginEmailSetupController(context: AccountContext, blocking: Bool, e
text = presentationData.strings.Login_EmailNotAllowedError
}
- presentControllerImpl?(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]))
+ presentControllerImpl?(textAlertController(context: context, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]))
}, completed: { [weak emailController] in
emailController?.inProgress = false
})
@@ -173,7 +174,7 @@ public func loginEmailSetupController(context: AccountContext, blocking: Bool, e
switch credential {
case let appleIdCredential as ASAuthorizationAppleIDCredential:
guard let tokenData = appleIdCredential.identityToken, let token = String(data: tokenData, encoding: .utf8) else {
- emailController?.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: nil, text: presentationData.strings.Login_UnknownError, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ emailController?.present(textAlertController(context: context, title: nil, text: presentationData.strings.Login_UnknownError, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), in: .window(.root))
return
}
let _ = (verifyLoginEmailChange(account: context.account, code: .appleToken(token))
@@ -193,7 +194,7 @@ public func loginEmailSetupController(context: AccountContext, blocking: Bool, e
case .emailNotAllowed:
text = presentationData.strings.Login_EmailNotAllowedError
}
- emailController?.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), in: .window(.root))
+ emailController?.present(textAlertController(context: context, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), in: .window(.root))
}, completed: { [weak emailController] in
emailController?.authorization = nil
emailController?.authorizationDelegate = nil
diff --git a/submodules/SettingsUI/Sources/Privacy and Security/PrivacyAndSecurityController.swift b/submodules/SettingsUI/Sources/Privacy and Security/PrivacyAndSecurityController.swift
index 09aeb828..ed2b35e3 100644
--- a/submodules/SettingsUI/Sources/Privacy and Security/PrivacyAndSecurityController.swift
+++ b/submodules/SettingsUI/Sources/Privacy and Security/PrivacyAndSecurityController.swift
@@ -45,8 +45,11 @@ private final class PrivacyAndSecurityControllerArguments {
let openEmailSettings: (String?) -> Void
let openMessagePrivacy: () -> Void
let openGiftsPrivacy: () -> Void
+ let openDeletedMessages: () -> Void
+ let openGhostMode: () -> Void
+ let openMisc: () -> Void
- init(account: Account, openBlockedUsers: @escaping () -> Void, openLastSeenPrivacy: @escaping () -> Void, openGroupsPrivacy: @escaping () -> Void, openVoiceCallPrivacy: @escaping () -> Void, openProfilePhotoPrivacy: @escaping () -> Void, openForwardPrivacy: @escaping () -> Void, openPhoneNumberPrivacy: @escaping () -> Void, openVoiceMessagePrivacy: @escaping () -> Void, openBioPrivacy: @escaping () -> Void, openBirthdayPrivacy: @escaping () -> Void, openSavedMusicPrivacy: @escaping () -> Void, openPasscode: @escaping () -> Void, openTwoStepVerification: @escaping (TwoStepVerificationAccessConfiguration?) -> Void, openPasskeys: @escaping () -> Void, openActiveSessions: @escaping () -> Void, toggleArchiveAndMuteNonContacts: @escaping (Bool) -> Void, setupAccountAutoremove: @escaping () -> Void, setupMessageAutoremove: @escaping () -> Void, openDataSettings: @escaping () -> Void, openEmailSettings: @escaping (String?) -> Void, openMessagePrivacy: @escaping () -> Void, openGiftsPrivacy: @escaping () -> Void) {
+ init(account: Account, openBlockedUsers: @escaping () -> Void, openLastSeenPrivacy: @escaping () -> Void, openGroupsPrivacy: @escaping () -> Void, openVoiceCallPrivacy: @escaping () -> Void, openProfilePhotoPrivacy: @escaping () -> Void, openForwardPrivacy: @escaping () -> Void, openPhoneNumberPrivacy: @escaping () -> Void, openVoiceMessagePrivacy: @escaping () -> Void, openBioPrivacy: @escaping () -> Void, openBirthdayPrivacy: @escaping () -> Void, openSavedMusicPrivacy: @escaping () -> Void, openPasscode: @escaping () -> Void, openTwoStepVerification: @escaping (TwoStepVerificationAccessConfiguration?) -> Void, openPasskeys: @escaping () -> Void, openActiveSessions: @escaping () -> Void, toggleArchiveAndMuteNonContacts: @escaping (Bool) -> Void, setupAccountAutoremove: @escaping () -> Void, setupMessageAutoremove: @escaping () -> Void, openDataSettings: @escaping () -> Void, openEmailSettings: @escaping (String?) -> Void, openMessagePrivacy: @escaping () -> Void, openGiftsPrivacy: @escaping () -> Void, openDeletedMessages: @escaping () -> Void, openGhostMode: @escaping () -> Void, openMisc: @escaping () -> Void) {
self.account = account
self.openBlockedUsers = openBlockedUsers
self.openLastSeenPrivacy = openLastSeenPrivacy
@@ -70,6 +73,9 @@ private final class PrivacyAndSecurityControllerArguments {
self.openEmailSettings = openEmailSettings
self.openMessagePrivacy = openMessagePrivacy
self.openGiftsPrivacy = openGiftsPrivacy
+ self.openDeletedMessages = openDeletedMessages
+ self.openGhostMode = openGhostMode
+ self.openMisc = openMisc
}
}
@@ -81,6 +87,9 @@ private enum PrivacyAndSecuritySection: Int32 {
case messageAutoremove
case dataSettings
case loginEmail
+ case antiDelete
+ case ghostMode
+ case misc
}
public enum PrivacyAndSecurityEntryTag: ItemListItemTag {
@@ -130,6 +139,12 @@ private enum PrivacyAndSecurityEntry: ItemListNodeEntry {
case messageAutoremoveInfo(PresentationTheme, String)
case dataSettings(PresentationTheme, String)
case dataSettingsInfo(PresentationTheme, String)
+ case deletedMessages(PresentationTheme, String, String)
+ case deletedMessagesInfo(PresentationTheme, String)
+ case ghostMode(PresentationTheme, String, String)
+ case ghostModeInfo(PresentationTheme, String)
+ case misc(PresentationTheme, String, String)
+ case miscInfo(PresentationTheme, String)
var section: ItemListSectionId {
switch self {
@@ -145,6 +160,12 @@ private enum PrivacyAndSecurityEntry: ItemListNodeEntry {
return PrivacyAndSecuritySection.account.rawValue
case .dataSettings, .dataSettingsInfo:
return PrivacyAndSecuritySection.dataSettings.rawValue
+ case .deletedMessages, .deletedMessagesInfo:
+ return PrivacyAndSecuritySection.antiDelete.rawValue
+ case .ghostMode, .ghostModeInfo:
+ return PrivacyAndSecuritySection.ghostMode.rawValue
+ case .misc, .miscInfo:
+ return PrivacyAndSecuritySection.misc.rawValue
}
}
@@ -214,6 +235,18 @@ private enum PrivacyAndSecurityEntry: ItemListNodeEntry {
return 31
case .dataSettingsInfo:
return 32
+ case .deletedMessages:
+ return 33
+ case .deletedMessagesInfo:
+ return 34
+ case .ghostMode:
+ return 35
+ case .ghostModeInfo:
+ return 36
+ case .misc:
+ return 37
+ case .miscInfo:
+ return 38
}
}
@@ -411,6 +444,42 @@ private enum PrivacyAndSecurityEntry: ItemListNodeEntry {
} else {
return false
}
+ case let .deletedMessages(lhsTheme, lhsText, lhsValue):
+ if case let .deletedMessages(rhsTheme, rhsText, rhsValue) = rhs, lhsTheme === rhsTheme, lhsText == rhsText, lhsValue == rhsValue {
+ return true
+ } else {
+ return false
+ }
+ case let .deletedMessagesInfo(lhsTheme, lhsText):
+ if case let .deletedMessagesInfo(rhsTheme, rhsText) = rhs, lhsTheme === rhsTheme, lhsText == rhsText {
+ return true
+ } else {
+ return false
+ }
+ case let .ghostMode(lhsTheme, lhsText, lhsValue):
+ if case let .ghostMode(rhsTheme, rhsText, rhsValue) = rhs, lhsTheme === rhsTheme, lhsText == rhsText, lhsValue == rhsValue {
+ return true
+ } else {
+ return false
+ }
+ case let .ghostModeInfo(lhsTheme, lhsText):
+ if case let .ghostModeInfo(rhsTheme, rhsText) = rhs, lhsTheme === rhsTheme, lhsText == rhsText {
+ return true
+ } else {
+ return false
+ }
+ case let .misc(lhsTheme, lhsText, lhsValue):
+ if case let .misc(rhsTheme, rhsText, rhsValue) = rhs, lhsTheme === rhsTheme, lhsText == rhsText, lhsValue == rhsValue {
+ return true
+ } else {
+ return false
+ }
+ case let .miscInfo(lhsTheme, lhsText):
+ if case let .miscInfo(rhsTheme, rhsText) = rhs, lhsTheme === rhsTheme, lhsText == rhsText {
+ return true
+ } else {
+ return false
+ }
}
}
@@ -542,6 +611,24 @@ private enum PrivacyAndSecurityEntry: ItemListNodeEntry {
})
case let .dataSettingsInfo(_, text):
return ItemListTextItem(presentationData: presentationData, text: .plain(text), sectionId: self.section)
+ case let .deletedMessages(_, text, value):
+ return ItemListDisclosureItem(presentationData: presentationData, systemStyle: .glass, icon: UIImage(bundleImageName: "Settings/Menu/Timer")?.precomposed(), title: text, label: value, sectionId: self.section, style: .blocks, action: {
+ arguments.openDeletedMessages()
+ })
+ case let .deletedMessagesInfo(_, text):
+ return ItemListTextItem(presentationData: presentationData, text: .plain(text), sectionId: self.section)
+ case let .ghostMode(_, text, value):
+ return ItemListDisclosureItem(presentationData: presentationData, systemStyle: .glass, icon: UIImage(bundleImageName: "Settings/Menu/Appearance")?.precomposed(), title: text, label: value, sectionId: self.section, style: .blocks, action: {
+ arguments.openGhostMode()
+ })
+ case let .ghostModeInfo(_, text):
+ return ItemListTextItem(presentationData: presentationData, text: .plain(text), sectionId: self.section)
+ case let .misc(_, text, value):
+ return ItemListDisclosureItem(presentationData: presentationData, systemStyle: .glass, icon: UIImage(bundleImageName: "Settings/Menu/Storage")?.precomposed(), title: text, label: value, sectionId: self.section, style: .blocks, action: {
+ arguments.openMisc()
+ })
+ case let .miscInfo(_, text):
+ return ItemListTextItem(presentationData: presentationData, text: .plain(text), sectionId: self.section)
}
}
}
@@ -1406,10 +1493,10 @@ public func privacyAndSecurityController(
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
let controller = textAlertController(
context: context, title: emailPattern, text: presentationData.strings.PrivacySettings_LoginEmailAlertText, actions: [
- TextAlertAction(type: .genericAction, title: presentationData.strings.PrivacySettings_LoginEmailAlertChange, action: {
+ TextAlertAction(type: .defaultAction, title: presentationData.strings.PrivacySettings_LoginEmailAlertChange, action: {
setupEmailImpl?(emailPattern)
}),
- TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_Cancel, action: {
+ TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {
})
], actionLayout: .vertical
@@ -1497,6 +1584,12 @@ public func privacyAndSecurityController(
}), true)
}
}))
+ }, openDeletedMessages: {
+ pushControllerImpl?(deletedMessagesController(context: context), true)
+ }, openGhostMode: {
+ pushControllerImpl?(ghostModeController(context: context), true)
+ }, openMisc: {
+ pushControllerImpl?(miscController(context: context), true)
})
actionsDisposable.add(context.engine.peers.managedUpdatedRecentPeers().start())
diff --git a/submodules/SettingsUI/Sources/Privacy and Security/PrivacyIntroController.swift b/submodules/SettingsUI/Sources/Privacy and Security/PrivacyIntroController.swift
index 73a50a65..b6c12d70 100644
--- a/submodules/SettingsUI/Sources/Privacy and Security/PrivacyIntroController.swift
+++ b/submodules/SettingsUI/Sources/Privacy and Security/PrivacyIntroController.swift
@@ -120,7 +120,7 @@ public final class PrivacyIntroController: ViewController {
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
- super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData))
+ super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData, style: .glass))
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style
@@ -161,7 +161,7 @@ public final class PrivacyIntroController: ViewController {
private func updateThemeAndStrings() {
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style
- self.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationData: self.presentationData))
+ self.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationData: self.presentationData, style: .glass), transition: .immediate)
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Back, style: .plain, target: nil, action: nil)
self.controllerNode.updatePresentationData(self.presentationData)
}
diff --git a/submodules/SettingsUI/Sources/Privacy and Security/Recent Sessions/ItemListRecentSessionItem.swift b/submodules/SettingsUI/Sources/Privacy and Security/Recent Sessions/ItemListRecentSessionItem.swift
index 77684f5b..a872ae6a 100644
--- a/submodules/SettingsUI/Sources/Privacy and Security/Recent Sessions/ItemListRecentSessionItem.swift
+++ b/submodules/SettingsUI/Sources/Privacy and Security/Recent Sessions/ItemListRecentSessionItem.swift
@@ -241,7 +241,7 @@ class ItemListRecentSessionItemNode: ItemListRevealOptionsItemNode {
self.activateArea = AccessibilityAreaNode()
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.addSubnode(self.containerNode)
self.containerNode.addSubnode(self.iconNode)
diff --git a/submodules/SettingsUI/Sources/Privacy and Security/Recent Sessions/ItemListWebsiteItem.swift b/submodules/SettingsUI/Sources/Privacy and Security/Recent Sessions/ItemListWebsiteItem.swift
index cd902c96..1dc5be38 100644
--- a/submodules/SettingsUI/Sources/Privacy and Security/Recent Sessions/ItemListWebsiteItem.swift
+++ b/submodules/SettingsUI/Sources/Privacy and Security/Recent Sessions/ItemListWebsiteItem.swift
@@ -190,7 +190,7 @@ class ItemListWebsiteItemNode: ItemListRevealOptionsItemNode {
self.activateArea = AccessibilityAreaNode()
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.addSubnode(self.containerNode)
self.containerNode.addSubnode(self.avatarNode)
diff --git a/submodules/SettingsUI/Sources/Privacy and Security/Recent Sessions/RecentSessionsHeaderItem.swift b/submodules/SettingsUI/Sources/Privacy and Security/Recent Sessions/RecentSessionsHeaderItem.swift
index 2bd1a4d1..0b9dab7e 100644
--- a/submodules/SettingsUI/Sources/Privacy and Security/Recent Sessions/RecentSessionsHeaderItem.swift
+++ b/submodules/SettingsUI/Sources/Privacy and Security/Recent Sessions/RecentSessionsHeaderItem.swift
@@ -92,7 +92,7 @@ class RecentSessionsHeaderItemNode: ListViewItemNode {
self.buttonNode = SolidRoundedButtonNode(theme: SolidRoundedButtonTheme(backgroundColor: .black, foregroundColor: .white), fontSize: 16.0, height: 50.0, cornerRadius: 11.0)
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.titleNode)
self.addSubnode(self.animationNode)
diff --git a/submodules/SettingsUI/Sources/Privacy and Security/SelectivePrivacySettingsController.swift b/submodules/SettingsUI/Sources/Privacy and Security/SelectivePrivacySettingsController.swift
index 5f656d9b..6913f3f3 100644
--- a/submodules/SettingsUI/Sources/Privacy and Security/SelectivePrivacySettingsController.swift
+++ b/submodules/SettingsUI/Sources/Privacy and Security/SelectivePrivacySettingsController.swift
@@ -1664,6 +1664,12 @@ public func selectivePrivacySettingsController(
} else {
updatedDisallowedGifts.remove(.premium)
}
+ case .channel:
+ if value {
+ updatedDisallowedGifts.insert(.channel)
+ } else {
+ updatedDisallowedGifts.remove(.channel)
+ }
default:
break
}
diff --git a/submodules/SettingsUI/Sources/Search/SettingsSearchItem.swift b/submodules/SettingsUI/Sources/Search/SettingsSearchItem.swift
index 595c4adb..076f1874 100644
--- a/submodules/SettingsUI/Sources/Search/SettingsSearchItem.swift
+++ b/submodules/SettingsUI/Sources/Search/SettingsSearchItem.swift
@@ -13,6 +13,9 @@ import AccountContext
import SearchBarNode
import SearchUI
import ChatListSearchItemHeader
+import EdgeEffect
+import ComponentFlow
+import ComponentDisplayAdapters
extension SettingsSearchableItemIcon {
func image() -> UIImage? {
@@ -59,113 +62,6 @@ extension SettingsSearchableItemIcon {
}
}
-final class SettingsSearchItem: ItemListControllerSearch {
- let context: AccountContext
- let theme: PresentationTheme
- let placeholder: String
- let activated: Bool
- let updateActivated: (Bool) -> Void
- let presentController: (ViewController, Any?) -> Void
- let pushController: (ViewController) -> Void
- let getNavigationController: (() -> NavigationController?)?
- let resolvedFaqUrl: Signal
- let exceptionsList: Signal
- let archivedStickerPacks: Signal<[ArchivedStickerPackItem]?, NoError>
- let privacySettings: Signal
- let hasTwoStepAuth: Signal
- let twoStepAuthData: Signal
- let activeSessionsContext: Signal
- let webSessionsContext: Signal
-
- private var updateActivity: ((Bool) -> Void)?
- private var activity: ValuePromise = ValuePromise(ignoreRepeated: false)
- private let activityDisposable = MetaDisposable()
-
- init(context: AccountContext, theme: PresentationTheme, placeholder: String, activated: Bool, updateActivated: @escaping (Bool) -> Void, presentController: @escaping (ViewController, Any?) -> Void, pushController: @escaping (ViewController) -> Void, getNavigationController: (() -> NavigationController?)?, resolvedFaqUrl: Signal, exceptionsList: Signal, archivedStickerPacks: Signal<[ArchivedStickerPackItem]?, NoError>, privacySettings: Signal, hasTwoStepAuth: Signal, twoStepAuthData: Signal, activeSessionsContext: Signal, webSessionsContext: Signal) {
- self.context = context
- self.theme = theme
- self.placeholder = placeholder
- self.activated = activated
- self.updateActivated = updateActivated
- self.presentController = presentController
- self.pushController = pushController
- self.getNavigationController = getNavigationController
- self.resolvedFaqUrl = resolvedFaqUrl
- self.exceptionsList = exceptionsList
- self.archivedStickerPacks = archivedStickerPacks
- self.privacySettings = privacySettings
- self.hasTwoStepAuth = hasTwoStepAuth
- self.twoStepAuthData = twoStepAuthData
- self.activeSessionsContext = activeSessionsContext
- self.webSessionsContext = webSessionsContext
- self.activityDisposable.set((activity.get() |> mapToSignal { value -> Signal in
- if value {
- return .single(value) |> delay(0.2, queue: Queue.mainQueue())
- } else {
- return .single(value)
- }
- }).start(next: { [weak self] value in
- self?.updateActivity?(value)
- }))
- }
-
- deinit {
- self.activityDisposable.dispose()
- }
-
- func isEqual(to: ItemListControllerSearch) -> Bool {
- if let to = to as? SettingsSearchItem {
- if self.context !== to.context || self.theme !== to.theme || self.placeholder != to.placeholder || self.activated != to.activated {
- return false
- }
- return true
- } else {
- return false
- }
- }
-
- func titleContentNode(current: (NavigationBarContentNode & ItemListControllerSearchNavigationContentNode)?) -> (NavigationBarContentNode & ItemListControllerSearchNavigationContentNode)? {
- let updateActivated: (Bool) -> Void = self.updateActivated
- if let current = current as? NavigationBarSearchContentNode {
- current.updateThemeAndPlaceholder(theme: self.theme, placeholder: self.placeholder)
- return current
- } else {
- let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
- return NavigationBarSearchContentNode(theme: presentationData.theme, placeholder: presentationData.strings.Settings_Search, activate: {
- updateActivated(true)
- })
- }
- }
-
- func node(current: ItemListControllerSearchNode?, titleContentNode: (NavigationBarContentNode & ItemListControllerSearchNavigationContentNode)?) -> ItemListControllerSearchNode {
- let updateActivated: (Bool) -> Void = self.updateActivated
- let presentController: (ViewController, Any?) -> Void = self.presentController
- let pushController: (ViewController) -> Void = self.pushController
-
- if let current = current as? SettingsSearchItemNode, let titleContentNode = titleContentNode as? NavigationBarSearchContentNode {
- current.updatePresentationData(self.context.sharedContext.currentPresentationData.with { $0 })
- if current.isSearching != self.activated {
- if self.activated {
- current.activateSearch(placeholderNode: titleContentNode.placeholderNode)
- } else {
- current.deactivateSearch(placeholderNode: titleContentNode.placeholderNode)
- }
- }
- return current
- } else {
- return SettingsSearchItemNode(context: self.context, cancel: {
- updateActivated(false)
- }, updateActivity: { [weak self] value in
- self?.activity.set(value)
- }, pushController: { c in
- pushController(c)
- }, presentController: { c, a in
- presentController(c, a)
- }, getNavigationController: self.getNavigationController, resolvedFaqUrl: self.resolvedFaqUrl, exceptionsList: self.exceptionsList, archivedStickerPacks: self.archivedStickerPacks, privacySettings: self.privacySettings, hasTwoStepAuth: self.hasTwoStepAuth, twoStepAuthData: self.twoStepAuthData, activeSessionsContext: self.activeSessionsContext, webSessionsContext: self.webSessionsContext)
- }
- }
-}
-
final class SettingsSearchInteraction {
let openItem: (SettingsSearchableItem) -> Void
let deleteRecentItem: (SettingsSearchableItemId) -> Void
@@ -333,6 +229,8 @@ public final class SettingsSearchContainerNode: SearchDisplayControllerContentNo
private let listNode: ListView
private let recentListNode: ListView
+ private let edgeEffectView: EdgeEffectView
+
private var enqueuedTransitions: [SettingsSearchContainerTransition] = []
private var enqueuedRecentTransitions: [(SettingsSearchContainerRecentTransition, Bool)] = []
private var hasValidLayout = false
@@ -365,12 +263,15 @@ public final class SettingsSearchContainerNode: SearchDisplayControllerContentNo
return presentationData.strings.VoiceOver_ScrollStatus(row, count).string
}
+ self.edgeEffectView = EdgeEffectView()
+
super.init()
self.backgroundColor = self.presentationData.theme.chatList.backgroundColor
self.addSubnode(self.recentListNode)
self.addSubnode(self.listNode)
+ self.view.addSubview(self.edgeEffectView)
let interaction = SettingsSearchInteraction(openItem: { result in
addRecentSettingsSearchItem(engine: context.engine, item: result.id)
@@ -620,6 +521,12 @@ public final class SettingsSearchContainerNode: SearchDisplayControllerContentNo
self.dequeueTransition()
}
}
+
+ let edgeEffectHeight: CGFloat = insets.bottom + 8.0
+ let edgeEffectFrame = CGRect(origin: CGPoint(x: 0.0, y: layout.size.height - edgeEffectHeight), size: CGSize(width: layout.size.width, height: edgeEffectHeight))
+ transition.updateFrame(view: self.edgeEffectView, frame: edgeEffectFrame)
+ self.edgeEffectView.update(content: self.presentationData.theme.list.plainBackgroundColor, rect: edgeEffectFrame, edge: .bottom, edgeSize: min(edgeEffectHeight, 50.0), transition: ComponentTransition(transition))
+ transition.updateAlpha(layer: self.edgeEffectView.layer, alpha: edgeEffectHeight > 21.0 ? 1.0 : 0.0)
}
public override func scrollToTop() {
@@ -715,7 +622,7 @@ private final class SettingsSearchItemNode: ItemListControllerSearchNode {
}
}, resolvedFaqUrl: self.resolvedFaqUrl, exceptionsList: self.exceptionsList, archivedStickerPacks: self.archivedStickerPacks, privacySettings: self.privacySettings, hasTwoStepAuth: self.hasTwoStepAuth, twoStepAuthData: self.twoStepAuthData, activeSessionsContext: self.activeSessionsContext, webSessionsContext: self.webSessionsContext), cancel: { [weak self] in
self?.cancel()
- })
+ }, fieldStyle: placeholderNode.fieldStyle)
self.searchDisplayController?.containerLayoutUpdated(containerLayout, navigationBarHeight: navigationBarHeight, transition: .immediate)
self.searchDisplayController?.activate(insertSubnode: { [weak self, weak placeholderNode] subnode, isSearchBar in
diff --git a/submodules/SettingsUI/Sources/Search/SettingsSearchRecentItem.swift b/submodules/SettingsUI/Sources/Search/SettingsSearchRecentItem.swift
index 10f315d5..f2863b3b 100644
--- a/submodules/SettingsUI/Sources/Search/SettingsSearchRecentItem.swift
+++ b/submodules/SettingsUI/Sources/Search/SettingsSearchRecentItem.swift
@@ -127,7 +127,7 @@ class SettingsSearchRecentItemNode: ItemListRevealOptionsItemNode {
self.subtitleNode.contentMode = .left
self.subtitleNode.contentsScale = UIScreenScale
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.addSubnode(self.backgroundNode)
self.addSubnode(self.separatorNode)
diff --git a/submodules/SettingsUI/Sources/Search/SettingsSearchResultItem.swift b/submodules/SettingsUI/Sources/Search/SettingsSearchResultItem.swift
index 7e730023..c04b38af 100644
--- a/submodules/SettingsUI/Sources/Search/SettingsSearchResultItem.swift
+++ b/submodules/SettingsUI/Sources/Search/SettingsSearchResultItem.swift
@@ -117,7 +117,7 @@ class SettingsSearchResultItemNode: ListViewItemNode {
self.highlightedBackgroundNode = ASDisplayNode()
self.highlightedBackgroundNode.isLayerBacked = true
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.addSubnode(self.iconNode)
self.addSubnode(self.titleNode)
diff --git a/submodules/SettingsUI/Sources/Terms of Service/TermsOfServiceController.swift b/submodules/SettingsUI/Sources/Terms of Service/TermsOfServiceController.swift
index 333125c4..2317be18 100644
--- a/submodules/SettingsUI/Sources/Terms of Service/TermsOfServiceController.swift
+++ b/submodules/SettingsUI/Sources/Terms of Service/TermsOfServiceController.swift
@@ -6,7 +6,9 @@ import Display
import AsyncDisplayKit
import TelegramPresentationData
import TelegramUIPreferences
+import PresentationDataUtils
import ProgressNavigationButtonNode
+import AccountContext
public class TermsOfServiceControllerTheme {
public let statusBarStyle: StatusBarStyle
@@ -43,6 +45,7 @@ public class TermsOfServiceController: ViewController, StandalonePresentableCont
return self.displayNode as! TermsOfServiceControllerNode
}
+ private let context: AccountContext
private let presentationData: PresentationData
private let text: String
private let entities: [MessageTextEntity]
@@ -67,7 +70,8 @@ public class TermsOfServiceController: ViewController, StandalonePresentableCont
}
}
- public init(presentationData: PresentationData, text: String, entities: [MessageTextEntity], ageConfirmation: Int32?, signingUp: Bool, accept: @escaping (String?) -> Void, decline: @escaping () -> Void, openUrl: @escaping (String) -> Void) {
+ public init(context: AccountContext, presentationData: PresentationData, text: String, entities: [MessageTextEntity], ageConfirmation: Int32?, signingUp: Bool, accept: @escaping (String?) -> Void, decline: @escaping () -> Void, openUrl: @escaping (String) -> Void) {
+ self.context = context
self.presentationData = presentationData
self.text = text
self.entities = entities
@@ -112,7 +116,7 @@ public class TermsOfServiceController: ViewController, StandalonePresentableCont
text = strongSelf.presentationData.strings.PrivacyPolicy_DeclineMessage
declineTitle = strongSelf.presentationData.strings.PrivacyPolicy_DeclineDeclineAndDelete
}
- strongSelf.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: strongSelf.presentationData.strings.PrivacyPolicy_Decline, text: text, actions: [TextAlertAction(type: .destructiveAction, title: declineTitle, action: {
+ strongSelf.present(textAlertController(context: strongSelf.context, title: strongSelf.presentationData.strings.PrivacyPolicy_Decline, text: text, actions: [TextAlertAction(type: .destructiveAction, title: declineTitle, action: {
self?.decline()
}), TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_Cancel, action: {
})], actionLayout: .vertical), in: .window(.root))
@@ -122,7 +126,7 @@ public class TermsOfServiceController: ViewController, StandalonePresentableCont
}
if let ageConfirmation = strongSelf.ageConfirmation {
- strongSelf.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: strongSelf.presentationData.strings.PrivacyPolicy_AgeVerificationTitle, text: strongSelf.presentationData.strings.PrivacyPolicy_AgeVerificationMessage("\(ageConfirmation)").string, actions: [TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Common_Cancel, action: {}), TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.PrivacyPolicy_AgeVerificationAgree, action: {
+ strongSelf.present(textAlertController(context: strongSelf.context, title: strongSelf.presentationData.strings.PrivacyPolicy_AgeVerificationTitle, text: strongSelf.presentationData.strings.PrivacyPolicy_AgeVerificationMessage("\(ageConfirmation)").string, actions: [TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Common_Cancel, action: {}), TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.PrivacyPolicy_AgeVerificationAgree, action: {
self?.accept(self?.proccessBotNameAfterAccept)
})]), in: .window(.root))
} else {
diff --git a/submodules/SettingsUI/Sources/Text Size/TextSizeSelectionController.swift b/submodules/SettingsUI/Sources/Text Size/TextSizeSelectionController.swift
index 44ab48af..d026f7a4 100644
--- a/submodules/SettingsUI/Sources/Text Size/TextSizeSelectionController.swift
+++ b/submodules/SettingsUI/Sources/Text Size/TextSizeSelectionController.swift
@@ -228,7 +228,6 @@ private final class TextSizeSelectionControllerNode: ASDisplayNode, ASScrollView
}, openChatFolderUpdates: {}, hideChatFolderUpdates: {
}, openStories: { _, _ in
}, openStarsTopup: { _ in
- }, dismissNotice: { _ in
}, editPeer: { _ in
}, openWebApp: { _ in
}, openPhotoSetup: {
@@ -625,7 +624,8 @@ final class TextSizeSelectionController: ViewController {
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
self.presentationThemeSettings = presentationThemeSettings
- super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationTheme: self.presentationData.theme, presentationStrings: self.presentationData.strings))
+ super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationTheme: self.presentationData.theme, presentationStrings: self.presentationData.strings, style: .glass))
+ self._hasGlassStyle = true
self.blocksBackgroundWhenInOverlay = true
self.acceptsFocusWhenInOverlay = true
diff --git a/submodules/SettingsUI/Sources/Text Size/TextSizeSelectionItem.swift b/submodules/SettingsUI/Sources/Text Size/TextSizeSelectionItem.swift
index f19fe421..125e1151 100644
--- a/submodules/SettingsUI/Sources/Text Size/TextSizeSelectionItem.swift
+++ b/submodules/SettingsUI/Sources/Text Size/TextSizeSelectionItem.swift
@@ -110,7 +110,7 @@ class BubbleSettingsRadiusItemNode: ListViewItemNode, ItemListItemNode {
self.disabledOverlayNode = ASDisplayNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.leftIconNode)
self.addSubnode(self.rightIconNode)
diff --git a/submodules/SettingsUI/Sources/ThemePickerGridItem.swift b/submodules/SettingsUI/Sources/ThemePickerGridItem.swift
index 5504d026..aae20dae 100644
--- a/submodules/SettingsUI/Sources/ThemePickerGridItem.swift
+++ b/submodules/SettingsUI/Sources/ThemePickerGridItem.swift
@@ -406,7 +406,7 @@ class ThemeGridThemeItemNode: ListViewItemNode, ItemListItemNode {
self.scrollNode = ASScrollNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.containerNode)
self.addSubnode(self.scrollNode)
diff --git a/submodules/SettingsUI/Sources/Themes/ThemePreviewController.swift b/submodules/SettingsUI/Sources/Themes/ThemePreviewController.swift
index 2713ca2a..26504db1 100644
--- a/submodules/SettingsUI/Sources/Themes/ThemePreviewController.swift
+++ b/submodules/SettingsUI/Sources/Themes/ThemePreviewController.swift
@@ -157,7 +157,7 @@ public final class ThemePreviewController: ViewController {
let titleView = CounterControllerTitleView(theme: strongSelf.previewTheme)
titleView.title = CounterControllerTitle(title: themeName, counter: hasInstallsCount ? strongSelf.presentationData.strings.Theme_UsersCount(max(1, theme.installCount ?? 0)) : "")
strongSelf.navigationItem.titleView = titleView
- strongSelf.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationTheme: presentationTheme, presentationStrings: strongSelf.presentationData.strings))
+ strongSelf.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationTheme: presentationTheme, presentationStrings: strongSelf.presentationData.strings), transition: .immediate)
}
})
diff --git a/submodules/SettingsUI/Sources/Themes/ThemePreviewControllerNode.swift b/submodules/SettingsUI/Sources/Themes/ThemePreviewControllerNode.swift
index 9232eaf4..a0afa08c 100644
--- a/submodules/SettingsUI/Sources/Themes/ThemePreviewControllerNode.swift
+++ b/submodules/SettingsUI/Sources/Themes/ThemePreviewControllerNode.swift
@@ -377,7 +377,6 @@ final class ThemePreviewControllerNode: ASDisplayNode, ASScrollViewDelegate {
}, openChatFolderUpdates: {}, hideChatFolderUpdates: {
}, openStories: { _, _ in
}, openStarsTopup: { _ in
- }, dismissNotice: { _ in
}, editPeer: { _ in
}, openWebApp: { _ in
}, openPhotoSetup: {
diff --git a/submodules/SettingsUI/Sources/Themes/ThemeSettingsAccentColorItem.swift b/submodules/SettingsUI/Sources/Themes/ThemeSettingsAccentColorItem.swift
index 2e5218a8..7d673f35 100644
--- a/submodules/SettingsUI/Sources/Themes/ThemeSettingsAccentColorItem.swift
+++ b/submodules/SettingsUI/Sources/Themes/ThemeSettingsAccentColorItem.swift
@@ -298,7 +298,7 @@ private final class ThemeSettingsAccentColorIconItemNode : ListViewItemNode {
self.dotsNode.displayWithoutProcessing = true
self.dotsNode.image = generateDotsImage()
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.addSubnode(self.containerNode)
self.containerNode.addSubnode(self.fillNode)
@@ -537,7 +537,7 @@ private final class ThemeSettingsAccentColorPickerItemNode : ListViewItemNode {
self.imageNode.displayWithoutProcessing = true
self.imageNode.image = generateCustomSwatchImage()
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.addSubnode(self.imageNode)
}
@@ -734,7 +734,7 @@ class ThemeSettingsAccentColorItemNode: ListViewItemNode, ItemListItemNode {
self.listNode = ListView()
self.listNode.transform = CATransform3DMakeRotation(-CGFloat.pi / 2.0, 0.0, 0.0, 1.0)
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.containerNode)
self.addSubnode(self.listNode)
diff --git a/submodules/SettingsUI/Sources/Themes/ThemeSettingsAppIconItem.swift b/submodules/SettingsUI/Sources/Themes/ThemeSettingsAppIconItem.swift
index 421d3d41..4ba20460 100644
--- a/submodules/SettingsUI/Sources/Themes/ThemeSettingsAppIconItem.swift
+++ b/submodules/SettingsUI/Sources/Themes/ThemeSettingsAppIconItem.swift
@@ -229,7 +229,7 @@ class ThemeSettingsAppIconItemNode: ListViewItemNode, ItemListItemNode {
self.containerNode = ASDisplayNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.containerNode)
}
diff --git a/submodules/SettingsUI/Sources/Themes/ThemeSettingsBrightnessItem.swift b/submodules/SettingsUI/Sources/Themes/ThemeSettingsBrightnessItem.swift
index c4fa77d5..81aee3ec 100644
--- a/submodules/SettingsUI/Sources/Themes/ThemeSettingsBrightnessItem.swift
+++ b/submodules/SettingsUI/Sources/Themes/ThemeSettingsBrightnessItem.swift
@@ -90,7 +90,7 @@ class ThemeSettingsBrightnessItemNode: ListViewItemNode {
self.rightIconNode.displaysAsynchronously = false
self.rightIconNode.displayWithoutProcessing = true
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.leftIconNode)
self.addSubnode(self.rightIconNode)
diff --git a/submodules/SettingsUI/Sources/Themes/ThemeSettingsChatPreviewItem.swift b/submodules/SettingsUI/Sources/Themes/ThemeSettingsChatPreviewItem.swift
index ac07ff62..b475dce6 100644
--- a/submodules/SettingsUI/Sources/Themes/ThemeSettingsChatPreviewItem.swift
+++ b/submodules/SettingsUI/Sources/Themes/ThemeSettingsChatPreviewItem.swift
@@ -130,7 +130,7 @@ class ThemeSettingsChatPreviewItemNode: ListViewItemNode {
self.containerNode = ASDisplayNode()
self.containerNode.subnodeTransform = CATransform3DMakeRotation(CGFloat.pi, 0.0, 0.0, 1.0)
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.clipsToBounds = true
diff --git a/submodules/SettingsUI/Sources/Themes/ThemeSettingsFontSizeItem.swift b/submodules/SettingsUI/Sources/Themes/ThemeSettingsFontSizeItem.swift
index aff462c9..08d11cee 100644
--- a/submodules/SettingsUI/Sources/Themes/ThemeSettingsFontSizeItem.swift
+++ b/submodules/SettingsUI/Sources/Themes/ThemeSettingsFontSizeItem.swift
@@ -110,7 +110,7 @@ class ThemeSettingsFontSizeItemNode: ListViewItemNode, ItemListItemNode {
self.disabledOverlayNode = ASDisplayNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.leftIconNode)
self.addSubnode(self.rightIconNode)
diff --git a/submodules/ShimmerEffect/Sources/ShimmerEffect.swift b/submodules/ShimmerEffect/Sources/ShimmerEffect.swift
index 2c586b59..467e16a7 100644
--- a/submodules/ShimmerEffect/Sources/ShimmerEffect.swift
+++ b/submodules/ShimmerEffect/Sources/ShimmerEffect.swift
@@ -236,12 +236,11 @@ public final class ShimmerEffectForegroundNode: ASDisplayNode {
let image: UIImage?
if horizontal {
- let baseAlpha: CGFloat = 0.1
+ //let baseAlpha: CGFloat = 0.1
image = generateImage(CGSize(width: effectSize ?? 200.0, height: 16.0), opaque: false, scale: 1.0, rotatedContext: { size, context in
context.clear(CGRect(origin: CGPoint(), size: size))
- let foregroundColor = UIColor(white: 1.0, alpha: min(1.0, baseAlpha * 4.0))
-
+ //let foregroundColor = foregroundColor //.withAlphaComponent(min(1.0, baseAlpha * 3.0))
if let shadowImage {
UIGraphicsPushContext(context)
diff --git a/submodules/StatisticsUI/BUILD b/submodules/StatisticsUI/BUILD
index 293b755d..f5dbe1a1 100644
--- a/submodules/StatisticsUI/BUILD
+++ b/submodules/StatisticsUI/BUILD
@@ -49,13 +49,14 @@ swift_library(
"//submodules/TelegramNotices",
"//submodules/UIKitRuntimeUtils",
"//submodules/PasswordSetupUI",
- "//submodules/TelegramUI/Components/PeerManagement/OwnershipTransferController",
"//submodules/TelegramUI/Components/ListItemComponentAdaptor",
"//submodules/TelegramUI/Components/Stars/StarsWithdrawalScreen",
"//submodules/TelegramUI/Components/ButtonComponent",
"//submodules/TelegramUI/Components/ListActionItemComponent",
"//submodules/TelegramUI/Components/Stars/StarsAvatarComponent",
"//submodules/TelegramUI/Components/PremiumPeerShortcutComponent",
+ "//submodules/TelegramUI/Components/AlertComponent",
+ "//submodules/TelegramUI/Components/AlertComponent/AlertInputFieldComponent",
],
visibility = [
"//visibility:public",
diff --git a/submodules/StatisticsUI/Sources/BackButton.swift b/submodules/StatisticsUI/Sources/BackButton.swift
index 271cae3d..ff04a480 100644
--- a/submodules/StatisticsUI/Sources/BackButton.swift
+++ b/submodules/StatisticsUI/Sources/BackButton.swift
@@ -149,7 +149,7 @@ final class PeerInfoHeaderNavigationButton: HighlightableButtonNode {
case .back:
text = presentationData.strings.Common_Back
accessibilityText = presentationData.strings.Common_Back
- icon = NavigationBar.backArrowImage(color: .white)
+ icon = navigationBarBackArrowImage(color: .white)
case .edit:
text = presentationData.strings.Common_Edit
accessibilityText = text
diff --git a/submodules/StatisticsUI/Sources/BoostLevelHeaderItem.swift b/submodules/StatisticsUI/Sources/BoostLevelHeaderItem.swift
index 92707133..5bb6750c 100644
--- a/submodules/StatisticsUI/Sources/BoostLevelHeaderItem.swift
+++ b/submodules/StatisticsUI/Sources/BoostLevelHeaderItem.swift
@@ -76,7 +76,7 @@ class IncreaseLimitHeaderItemNode: ListViewItemNode {
private var item: BoostLevelHeaderItem?
init() {
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
}
override func didLoad() {
diff --git a/submodules/StatisticsUI/Sources/BoostsTabsItem.swift b/submodules/StatisticsUI/Sources/BoostsTabsItem.swift
index 538b3235..334ede42 100644
--- a/submodules/StatisticsUI/Sources/BoostsTabsItem.swift
+++ b/submodules/StatisticsUI/Sources/BoostsTabsItem.swift
@@ -111,7 +111,7 @@ private final class BoostsTabsItemNode: ListViewItemNode {
self.selectionNode = ASImageNode()
self.selectionNode.displaysAsynchronously = false
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.boostsTextNode)
self.addSubnode(self.giftsTextNode)
diff --git a/submodules/StatisticsUI/Sources/ChannelStatsController.swift b/submodules/StatisticsUI/Sources/ChannelStatsController.swift
index 3602d253..af215827 100644
--- a/submodules/StatisticsUI/Sources/ChannelStatsController.swift
+++ b/submodules/StatisticsUI/Sources/ChannelStatsController.swift
@@ -1229,7 +1229,7 @@ private enum StatsEntry: ItemListNodeEntry {
arguments.presentCpmLocked()
})
case .earnStarsInfo:
- return ItemListDisclosureItem(presentationData: presentationData, icon: PresentationResourcesSettings.earnStars, title: presentationData.strings.Monetization_EarnStarsInfo_Title, titleBadge: presentationData.strings.Settings_New, label: presentationData.strings.Monetization_EarnStarsInfo_Text, labelStyle: .multilineDetailText, sectionId: self.section, style: .blocks, action: {
+ return ItemListDisclosureItem(presentationData: presentationData, icon: PresentationResourcesSettings.earnStars, title: presentationData.strings.Monetization_EarnStarsInfo_Title, titleBadge: nil, label: presentationData.strings.Monetization_EarnStarsInfo_Text, labelStyle: .multilineDetailText, sectionId: self.section, style: .blocks, action: {
arguments.openEarnStars()
})
}
diff --git a/submodules/StatisticsUI/Sources/MonetizationBalanceItem.swift b/submodules/StatisticsUI/Sources/MonetizationBalanceItem.swift
index 98441dc4..687d2a42 100644
--- a/submodules/StatisticsUI/Sources/MonetizationBalanceItem.swift
+++ b/submodules/StatisticsUI/Sources/MonetizationBalanceItem.swift
@@ -140,7 +140,7 @@ final class MonetizationBalanceItemNode: ListViewItemNode, ItemListItemNode {
self.activateArea = AccessibilityAreaNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.iconNode)
self.addSubnode(self.balanceTextNode)
diff --git a/submodules/StatisticsUI/Sources/MonetizationIntroScreen.swift b/submodules/StatisticsUI/Sources/MonetizationIntroScreen.swift
index 2dc7e168..b82e5658 100644
--- a/submodules/StatisticsUI/Sources/MonetizationIntroScreen.swift
+++ b/submodules/StatisticsUI/Sources/MonetizationIntroScreen.swift
@@ -12,7 +12,7 @@ import SheetComponent
import BundleIconComponent
import BalancedTextComponent
import MultilineTextComponent
-import SolidRoundedButtonComponent
+import ButtonComponent
import LottieComponent
import AccountContext
@@ -73,7 +73,7 @@ private final class SheetContent: CombinedComponent {
let title = Child(BalancedTextComponent.self)
let list = Child(List.self)
- let actionButton = Child(SolidRoundedButtonComponent.self)
+ let actionButton = Child(ButtonComponent.self)
let infoBackground = Child(RoundedRectangle.self)
let infoTitle = Child(MultilineTextComponent.self)
@@ -284,7 +284,7 @@ private final class SheetContent: CombinedComponent {
let infoBackground = infoBackground.update(
component: RoundedRectangle(
color: theme.list.blocksBackgroundColor,
- cornerRadius: 10.0
+ cornerRadius: 26.0
),
availableSize: CGSize(width: context.availableSize.width - sideInset * 2.0, height: totalInfoHeight),
transition: .immediate
@@ -307,37 +307,48 @@ private final class SheetContent: CombinedComponent {
contentSize.height += infoPadding
contentSize.height += spacing
+ var buttonTitle: [AnyComponentWithIdentity] = []
+ buttonTitle.append(AnyComponentWithIdentity(id: 0, component: AnyComponent(LottieComponent(
+ content: LottieComponent.AppBundleContent(name: "anim_ok"),
+ color: theme.list.itemCheckColors.foregroundColor,
+ startingPosition: .begin,
+ size: CGSize(width: 28.0, height: 28.0),
+ playOnce: state.playOnce
+ ))))
+ buttonTitle.append(AnyComponentWithIdentity(id: 1, component: AnyComponent(ButtonTextContentComponent(
+ text: strings.Monetization_Intro_Understood,
+ badge: 0,
+ textColor: theme.list.itemCheckColors.foregroundColor,
+ badgeBackground: theme.list.itemCheckColors.foregroundColor,
+ badgeForeground: theme.list.itemCheckColors.fillColor
+ ))))
+
+ let buttonInsets = ContainerViewLayout.concentricInsets(bottomInset: environment.safeInsets.bottom, innerDiameter: 52.0, sideInset: 30.0)
let actionButton = actionButton.update(
- component: SolidRoundedButtonComponent(
- title: strings.Monetization_Intro_Understood,
- theme: SolidRoundedButtonComponent.Theme(
- backgroundColor: theme.list.itemCheckColors.fillColor,
- backgroundColors: [],
- foregroundColor: theme.list.itemCheckColors.foregroundColor
+ component: ButtonComponent(
+ background: ButtonComponent.Background(
+ style: .glass,
+ color: theme.list.itemCheckColors.fillColor,
+ foreground: theme.list.itemCheckColors.foregroundColor,
+ pressedColor: theme.list.itemCheckColors.fillColor.withMultipliedAlpha(0.9)
+ ),
+ content: AnyComponentWithIdentity(
+ id: AnyHashable(0),
+ component: AnyComponent(HStack(buttonTitle, spacing: 2.0))
),
- font: .bold,
- fontSize: 17.0,
- height: 50.0,
- cornerRadius: 10.0,
- gloss: false,
- iconName: nil,
- animationName: nil,
- iconPosition: .left,
action: {
component.dismiss()
}
),
- availableSize: CGSize(width: context.availableSize.width - sideInset * 2.0, height: 50.0),
+ availableSize: CGSize(width: context.availableSize.width - buttonInsets.left - buttonInsets.right, height: 52.0),
transition: context.transition
)
context.add(actionButton
.position(CGPoint(x: context.availableSize.width / 2.0, y: contentSize.height + actionButton.size.height / 2.0))
)
contentSize.height += actionButton.size.height
- contentSize.height += 22.0
-
- contentSize.height += environment.safeInsets.bottom
-
+ contentSize.height += buttonInsets.bottom
+
state.playAnimationIfNeeded()
return contentSize
@@ -397,6 +408,7 @@ private final class SheetContainerComponent: CombinedComponent {
})
}
)),
+ style: .glass,
backgroundColor: .color(environment.theme.actionSheet.opaqueItemBackgroundColor),
followContentSizeChanges: true,
externalState: sheetExternalState,
diff --git a/submodules/StatisticsUI/Sources/RevenueWithdrawalController.swift b/submodules/StatisticsUI/Sources/RevenueWithdrawalController.swift
index 7969836a..e6abc597 100644
--- a/submodules/StatisticsUI/Sources/RevenueWithdrawalController.swift
+++ b/submodules/StatisticsUI/Sources/RevenueWithdrawalController.swift
@@ -6,107 +6,148 @@ import TelegramPresentationData
import PresentationDataUtils
import AccountContext
import PasswordSetupUI
-import Markdown
-import OwnershipTransferController
+import ComponentFlow
+import AlertComponent
+import AlertInputFieldComponent
-func confirmRevenueWithdrawalController(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal)? = nil, peerId: EnginePeer.Id, present: @escaping (ViewController, Any?) -> Void, completion: @escaping (String) -> Void) -> ViewController {
- let presentationData = updatedPresentationData?.initial ?? context.sharedContext.currentPresentationData.with { $0 }
+func confirmRevenueWithdrawalController(
+ context: AccountContext,
+ updatedPresentationData: (initial: PresentationData, signal: Signal)? = nil,
+ peerId: EnginePeer.Id,
+ present: @escaping (ViewController, Any?) -> Void,
+ completion: @escaping (String) -> Void
+) -> ViewController {
+ let presentationData = context.sharedContext.currentPresentationData.with { $0 }
+ let strings = presentationData.strings
+
+ let inputState = AlertInputFieldComponent.ExternalState()
+
+ let doneIsEnabled: Signal = inputState.valueSignal
+ |> map { value in
+ return !value.isEmpty
+ }
+
+ let doneInProgressPromise = ValuePromise(false)
+
+ var content: [AnyComponentWithIdentity] = []
+ content.append(AnyComponentWithIdentity(
+ id: "title",
+ component: AnyComponent(
+ AlertTitleComponent(title: strings.Monetization_Withdraw_EnterPassword_Title)
+ )
+ ))
+ content.append(AnyComponentWithIdentity(
+ id: "text",
+ component: AnyComponent(
+ AlertTextComponent(content: .plain(strings.Monetization_Withdraw_EnterPassword_Text))
+ )
+ ))
+
+ var applyImpl: (() -> Void)?
+ content.append(AnyComponentWithIdentity(
+ id: "input",
+ component: AnyComponent(
+ AlertInputFieldComponent(
+ context: context,
+ placeholder: strings.Channel_OwnershipTransfer_PasswordPlaceholder,
+ isSecureTextEntry: true,
+ isInitiallyFocused: true,
+ externalState: inputState,
+ returnKeyAction: {
+ applyImpl?()
+ }
+ )
+ )
+ ))
+
+ var effectiveUpdatedPresentationData: (PresentationData, Signal)
+ if let updatedPresentationData {
+ effectiveUpdatedPresentationData = updatedPresentationData
+ } else {
+ effectiveUpdatedPresentationData = (presentationData, context.sharedContext.presentationData)
+ }
var dismissImpl: (() -> Void)?
- var proceedImpl: (() -> Void)?
-
- let disposable = MetaDisposable()
-
- let contentNode = ChannelOwnershipTransferAlertContentNode(theme: AlertControllerTheme(presentationData: presentationData), ptheme: presentationData.theme, strings: presentationData.strings, title: presentationData.strings.Monetization_Withdraw_EnterPassword_Title, text: presentationData.strings.Monetization_Withdraw_EnterPassword_Text, actions: [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {
- dismissImpl?()
- }), TextAlertAction(type: .defaultAction, title: presentationData.strings.Monetization_Withdraw_EnterPassword_Done, action: {
- proceedImpl?()
- })])
-
- contentNode.complete = {
- proceedImpl?()
- }
-
- let controller = AlertController(theme: AlertControllerTheme(presentationData: presentationData), contentNode: contentNode)
- let presentationDataDisposable = (updatedPresentationData?.signal ?? context.sharedContext.presentationData).start(next: { [weak controller, weak contentNode] presentationData in
- controller?.theme = AlertControllerTheme(presentationData: presentationData)
- contentNode?.theme = presentationData.theme
- })
- controller.dismissed = { _ in
- presentationDataDisposable.dispose()
- disposable.dispose()
- }
- dismissImpl = { [weak controller, weak contentNode] in
- contentNode?.dismissInput()
- controller?.dismissAnimated()
- }
- proceedImpl = { [weak contentNode] in
- guard let contentNode = contentNode else {
- return
- }
- contentNode.updateIsChecking(true)
-
- let signal = context.engine.peers.requestStarsRevenueWithdrawalUrl(peerId: peerId, ton: true, amount: nil, password: contentNode.password)
- disposable.set((signal |> deliverOnMainQueue).start(next: { url in
+ let alertController = AlertScreen(
+ configuration: AlertScreen.Configuration(allowInputInset: true),
+ content: content,
+ actions: [
+ .init(title: strings.Common_Cancel),
+ .init(title: strings.Monetization_Withdraw_EnterPassword_Done, type: .default, action: {
+ applyImpl?()
+ }, autoDismiss: false, isEnabled: doneIsEnabled, progress: doneInProgressPromise.get())
+ ],
+ updatedPresentationData: effectiveUpdatedPresentationData
+ )
+ applyImpl = {
+ doneInProgressPromise.set(true)
+
+ let _ = (context.engine.peers.requestStarsRevenueWithdrawalUrl(peerId: peerId, ton: true, amount: nil, password: inputState.value)
+ |> deliverOnMainQueue).start(next: { url in
dismissImpl?()
completion(url)
- }, error: { [weak contentNode] error in
+ }, error: { error in
var errorTextAndActions: (String, [TextAlertAction])?
switch error {
- case .invalidPassword:
- contentNode?.animateError()
- case .limitExceeded:
- errorTextAndActions = (presentationData.strings.TwoStepAuth_FloodError, [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})])
- default:
- errorTextAndActions = (presentationData.strings.Login_UnknownError, [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})])
+ case .invalidPassword:
+ inputState.animateError()
+ case .limitExceeded:
+ errorTextAndActions = (strings.TwoStepAuth_FloodError, [TextAlertAction(type: .defaultAction, title: strings.Common_OK, action: {})])
+ default:
+ errorTextAndActions = (strings.Login_UnknownError, [TextAlertAction(type: .defaultAction, title: strings.Common_OK, action: {})])
}
- contentNode?.updateIsChecking(false)
-
+ doneInProgressPromise.set(false)
+
if let (text, actions) = errorTextAndActions {
dismissImpl?()
present(textAlertController(context: context, title: nil, text: text, actions: actions), nil)
}
- }))
+ })
}
-
- return controller
+ dismissImpl = { [weak alertController] in
+ alertController?.dismiss(completion: nil)
+ }
+ return alertController
}
public func revenueWithdrawalController(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal)? = nil, peerId: EnginePeer.Id, initialError: RequestStarsRevenueWithdrawalError, present: @escaping (ViewController, Any?) -> Void, completion: @escaping (String) -> Void) -> ViewController {
let presentationData = updatedPresentationData?.initial ?? context.sharedContext.currentPresentationData.with { $0 }
- let theme = AlertControllerTheme(presentationData: presentationData)
+ let strings = presentationData.strings
- var title: NSAttributedString? = NSAttributedString(string: presentationData.strings.OwnershipTransfer_SecurityCheck, font: Font.semibold(presentationData.listsFontSize.itemListBaseFontSize), textColor: theme.primaryColor, paragraphAlignment: .center)
+ var title: String? = strings.OwnershipTransfer_SecurityCheck
+ var text = strings.Monetization_Withdraw_SecurityRequirements
- var text = presentationData.strings.Monetization_Withdraw_SecurityRequirements
- let textFontSize = presentationData.listsFontSize.baseDisplaySize * 13.0 / 17.0
-
- var actions: [TextAlertAction] = []
+ var actions: [AlertScreen.Action] = [
+ .init(title: strings.Common_OK, type: .default)
+ ]
switch initialError {
- case .requestPassword:
- return confirmRevenueWithdrawalController(context: context, updatedPresentationData: updatedPresentationData, peerId: peerId, present: present, completion: completion)
- case .twoStepAuthTooFresh, .authSessionTooFresh:
- text = text + presentationData.strings.Monetization_Withdraw_ComeBackLater
- actions = [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]
- case .twoStepAuthMissing:
- actions = [TextAlertAction(type: .genericAction, title: presentationData.strings.OwnershipTransfer_SetupTwoStepAuth, action: {
+ case .requestPassword:
+ return confirmRevenueWithdrawalController(context: context, updatedPresentationData: updatedPresentationData, peerId: peerId, present: present, completion: completion)
+ case .twoStepAuthTooFresh, .authSessionTooFresh:
+ text = text + strings.Monetization_Withdraw_ComeBackLater
+ case .twoStepAuthMissing:
+ actions = [
+ .init(title: strings.OwnershipTransfer_SetupTwoStepAuth, type: .default, action: {
let controller = SetupTwoStepVerificationController(context: context, initialState: .automatic, stateUpdated: { update, shouldDismiss, controller in
if shouldDismiss {
controller.dismiss()
}
})
present(controller, ViewControllerPresentationArguments(presentationAnimation: .modalSheet))
- }), TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_Cancel, action: {})]
- default:
- title = nil
- text = presentationData.strings.Login_UnknownError
- actions = [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]
+ }),
+ .init(title: strings.Common_Cancel)
+ ]
+ default:
+ title = nil
+ text = strings.Login_UnknownError
}
- let body = MarkdownAttributeSet(font: Font.regular(textFontSize), textColor: theme.primaryColor)
- let bold = MarkdownAttributeSet(font: Font.semibold(textFontSize), textColor: theme.primaryColor)
- let attributedText = parseMarkdownIntoAttributedString(text, attributes: MarkdownAttributes(body: body, bold: bold, link: body, linkAttribute: { _ in return nil }), textAlignment: .center)
-
- return richTextAlertController(context: context, title: title, text: attributedText, actions: actions)
+ return AlertScreen(
+ context: context,
+ configuration: AlertScreen.Configuration(actionAlignment: .vertical),
+ title: title,
+ text: text,
+ actions: actions
+ )
}
diff --git a/submodules/StatisticsUI/Sources/StarsTransactionItem.swift b/submodules/StatisticsUI/Sources/StarsTransactionItem.swift
index 1ab05b98..f0fa8796 100644
--- a/submodules/StatisticsUI/Sources/StarsTransactionItem.swift
+++ b/submodules/StatisticsUI/Sources/StarsTransactionItem.swift
@@ -113,7 +113,7 @@ final class StarsTransactionItemNode: ListViewItemNode, ItemListItemNode {
self.activateArea = AccessibilityAreaNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
}
func asyncLayout() -> (_ item: StarsTransactionItem, _ params: ListViewItemLayoutParams, _ insets: ItemListNeighbors) -> (ListViewItemNodeLayout, () -> Void) {
diff --git a/submodules/StatisticsUI/Sources/StatsGraphItem.swift b/submodules/StatisticsUI/Sources/StatsGraphItem.swift
index 7f8d1c85..0ab64e45 100644
--- a/submodules/StatisticsUI/Sources/StatsGraphItem.swift
+++ b/submodules/StatisticsUI/Sources/StatsGraphItem.swift
@@ -133,7 +133,7 @@ public final class StatsGraphItemNode: ListViewItemNode {
self.activityIndicator = ActivityIndicator(type: ActivityIndicatorType.custom(.black, 16.0, 2.0, false))
self.activityIndicator.isHidden = true
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.chartContainerNode.addSubnode(self.chartNode)
self.chartContainerNode.addSubnode(self.activityIndicator)
diff --git a/submodules/StatisticsUI/Sources/StatsMessageItem.swift b/submodules/StatisticsUI/Sources/StatsMessageItem.swift
index 1a2bf60b..641da989 100644
--- a/submodules/StatisticsUI/Sources/StatsMessageItem.swift
+++ b/submodules/StatisticsUI/Sources/StatsMessageItem.swift
@@ -184,7 +184,7 @@ final class StatsMessageItemNode: ListViewItemNode, ItemListItemNode {
self.activateArea = AccessibilityAreaNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.containerNode.addSubnode(self.contextSourceNode)
self.containerNode.targetNodeForActivationProgress = self.contextSourceNode.contentNode
diff --git a/submodules/StatisticsUI/Sources/StatsOverviewItem.swift b/submodules/StatisticsUI/Sources/StatsOverviewItem.swift
index a5b9d6d2..78952691 100644
--- a/submodules/StatisticsUI/Sources/StatsOverviewItem.swift
+++ b/submodules/StatisticsUI/Sources/StatsOverviewItem.swift
@@ -327,7 +327,7 @@ class StatsOverviewItemNode: ListViewItemNode {
self.bottomLeftItem = ValueItemNode()
self.bottomRightItem = ValueItemNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.clipsToBounds = true
diff --git a/submodules/StatisticsUI/Sources/TransactionInfoScreen.swift b/submodules/StatisticsUI/Sources/TransactionInfoScreen.swift
index 3a87d208..c652c059 100644
--- a/submodules/StatisticsUI/Sources/TransactionInfoScreen.swift
+++ b/submodules/StatisticsUI/Sources/TransactionInfoScreen.swift
@@ -12,11 +12,11 @@ import SheetComponent
import BundleIconComponent
import BalancedTextComponent
import MultilineTextComponent
-import SolidRoundedButtonComponent
-import LottieComponent
+import ButtonComponent
import AccountContext
import TelegramStringFormatting
import PremiumPeerShortcutComponent
+import GlassBarButtonComponent
private final class SheetContent: CombinedComponent {
typealias EnvironmentType = ViewControllerComponentContainer.Environment
@@ -55,18 +55,6 @@ private final class SheetContent: CombinedComponent {
}
final class State: ComponentState {
- var cachedCloseImage: (UIImage, PresentationTheme)?
-
- let playOnce = ActionSlot()
- private var didPlayAnimation = false
-
- func playAnimationIfNeeded() {
- guard !self.didPlayAnimation else {
- return
- }
- self.didPlayAnimation = true
- self.playOnce.invoke(Void())
- }
}
func makeState() -> State {
@@ -74,25 +62,23 @@ private final class SheetContent: CombinedComponent {
}
static var body: Body {
- let closeButton = Child(Button.self)
+ let closeButton = Child(GlassBarButtonComponent.self)
let amount = Child(MultilineTextComponent.self)
let title = Child(MultilineTextComponent.self)
let date = Child(MultilineTextComponent.self)
let peerShortcut = Child(PremiumPeerShortcutComponent.self)
- let actionButton = Child(SolidRoundedButtonComponent.self)
+ let actionButton = Child(ButtonComponent.self)
return { context in
let environment = context.environment[EnvironmentType.self]
let component = context.component
- let state = context.state
let theme = environment.theme
let strings = environment.strings
let dateTimeFormat = component.context.sharedContext.currentPresentationData.with { $0 }.dateTimeFormat
- let sideInset: CGFloat = 16.0 + environment.safeInsets.left
let textSideInset: CGFloat = 32.0 + environment.safeInsets.left
let titleFont = Font.semibold(17.0)
@@ -103,26 +89,27 @@ private final class SheetContent: CombinedComponent {
var contentSize = CGSize(width: context.availableSize.width, height: 45.0)
- let closeImage: UIImage
- if let (image, theme) = state.cachedCloseImage, theme === environment.theme {
- closeImage = image
- } else {
- closeImage = generateCloseButtonImage(backgroundColor: UIColor(rgb: 0x808084, alpha: 0.1), foregroundColor: theme.actionSheet.inputClearButtonColor)!
- state.cachedCloseImage = (closeImage, theme)
- }
-
let closeButton = closeButton.update(
- component: Button(
- content: AnyComponent(Image(image: closeImage)),
- action: { [weak component] in
- component?.dismiss()
+ component: GlassBarButtonComponent(
+ size: CGSize(width: 40.0, height: 40.0),
+ backgroundColor: theme.rootController.navigationBar.glassBarButtonBackgroundColor,
+ isDark: theme.overallDarkAppearance,
+ state: .generic,
+ component: AnyComponentWithIdentity(id: "close", component: AnyComponent(
+ BundleIconComponent(
+ name: "Navigation/Close",
+ tintColor: theme.chat.inputPanel.panelControlColor
+ )
+ )),
+ action: { _ in
+ component.dismiss()
}
),
- availableSize: CGSize(width: 30.0, height: 30.0),
+ availableSize: CGSize(width: 40.0, height: 40.0),
transition: .immediate
)
context.add(closeButton
- .position(CGPoint(x: context.availableSize.width - environment.safeInsets.left - closeButton.size.width, y: 28.0))
+ .position(CGPoint(x: 16.0 + closeButton.size.width / 2.0, y: 16.0 + closeButton.size.height / 2.0))
)
let amountString: NSMutableAttributedString
@@ -255,27 +242,30 @@ private final class SheetContent: CombinedComponent {
.position(CGPoint(x: context.availableSize.width / 2.0, y: contentSize.height + peerShortcut.size.height / 2.0))
)
contentSize.height += peerShortcut.size.height
- contentSize.height += 50.0
+ contentSize.height += 32.0
} else {
- contentSize.height += 45.0
+ contentSize.height += 27.0
}
+ let buttonInsets = ContainerViewLayout.concentricInsets(bottomInset: environment.safeInsets.bottom, innerDiameter: 52.0, sideInset: 30.0)
let actionButton = actionButton.update(
- component: SolidRoundedButtonComponent(
- title: buttonTitle,
- theme: SolidRoundedButtonComponent.Theme(
- backgroundColor: theme.list.itemCheckColors.fillColor,
- backgroundColors: [],
- foregroundColor: theme.list.itemCheckColors.foregroundColor
+ component: ButtonComponent(
+ background: ButtonComponent.Background(
+ style: .glass,
+ color: theme.list.itemCheckColors.fillColor,
+ foreground: theme.list.itemCheckColors.foregroundColor,
+ pressedColor: theme.list.itemCheckColors.fillColor.withMultipliedAlpha(0.9)
+ ),
+ content: AnyComponentWithIdentity(
+ id: AnyHashable(0),
+ component: AnyComponent(ButtonTextContentComponent(
+ text: buttonTitle,
+ badge: 0,
+ textColor: theme.list.itemCheckColors.foregroundColor,
+ badgeBackground: theme.list.itemCheckColors.foregroundColor,
+ badgeForeground: theme.list.itemCheckColors.fillColor
+ ))
),
- font: .bold,
- fontSize: 17.0,
- height: 50.0,
- cornerRadius: 10.0,
- gloss: false,
- iconName: nil,
- animationName: nil,
- iconPosition: .left,
action: {
component.dismiss()
if let explorerUrl {
@@ -283,18 +273,14 @@ private final class SheetContent: CombinedComponent {
}
}
),
- availableSize: CGSize(width: context.availableSize.width - sideInset * 2.0, height: 50.0),
+ availableSize: CGSize(width: context.availableSize.width - buttonInsets.left - buttonInsets.right, height: 52.0),
transition: context.transition
)
context.add(actionButton
.position(CGPoint(x: context.availableSize.width / 2.0, y: contentSize.height + actionButton.size.height / 2.0))
)
contentSize.height += actionButton.size.height
- contentSize.height += 22.0
-
- contentSize.height += environment.safeInsets.bottom
-
- state.playAnimationIfNeeded()
+ contentSize.height += buttonInsets.bottom
return contentSize
}
@@ -360,6 +346,7 @@ private final class SheetContainerComponent: CombinedComponent {
})
}
)),
+ style: .glass,
backgroundColor: .color(environment.theme.actionSheet.opaqueItemBackgroundColor),
followContentSizeChanges: true,
externalState: sheetExternalState,
diff --git a/submodules/StickerPackPreviewUI/Sources/StickerPackScreen.swift b/submodules/StickerPackPreviewUI/Sources/StickerPackScreen.swift
index 4597ed97..1e32fd99 100644
--- a/submodules/StickerPackPreviewUI/Sources/StickerPackScreen.swift
+++ b/submodules/StickerPackPreviewUI/Sources/StickerPackScreen.swift
@@ -1676,18 +1676,23 @@ private final class StickerPackContainer: ASDisplayNode {
self.onLoading()
var loadedCount = 0
- var error = false
+ var fetchingCount = 0
for content in contents {
- if case .result = content {
+ switch content {
+ case .result:
loadedCount += 1
- } else if case .none = content {
- error = true
+ case .fetching:
+ fetchingCount += 1
+ default:
+ break
}
}
- if error {
- self.onError()
- } else if loadedCount == contents.count {
+ if fetchingCount == 0 {
+ if loadedCount == 0 {
+ self.onError()
+ return
+ }
self.onReady()
if !contents.isEmpty && self.currentStickerPacks.isEmpty {
diff --git a/submodules/TabBarUI/BUILD b/submodules/TabBarUI/BUILD
index a2bed9e0..2a3e1999 100644
--- a/submodules/TabBarUI/BUILD
+++ b/submodules/TabBarUI/BUILD
@@ -19,6 +19,7 @@ swift_library(
"//submodules/ComponentFlow",
"//submodules/Components/ComponentDisplayAdapters",
"//submodules/TelegramUI/Components/TabBarComponent",
+ "//submodules/TelegramUI/Components/GlassControls",
],
visibility = [
"//visibility:public",
diff --git a/submodules/TabBarUI/Sources/TabBarContollerNode.swift b/submodules/TabBarUI/Sources/TabBarContollerNode.swift
index abee8621..c4de51c3 100644
--- a/submodules/TabBarUI/Sources/TabBarContollerNode.swift
+++ b/submodules/TabBarUI/Sources/TabBarContollerNode.swift
@@ -6,27 +6,25 @@ import TelegramPresentationData
import ComponentFlow
import ComponentDisplayAdapters
import TabBarComponent
-
-private extension ToolbarTheme {
- convenience init(theme: PresentationTheme) {
- self.init(barBackgroundColor: theme.rootController.tabBar.backgroundColor, barSeparatorColor: .clear, barTextColor: theme.rootController.tabBar.textColor, barSelectedTextColor: theme.rootController.tabBar.selectedTextColor)
- }
-}
+import GlassControls
final class TabBarControllerNode: ASDisplayNode {
private struct Params: Equatable {
let layout: ContainerViewLayout
let toolbar: Toolbar?
let isTabBarHidden: Bool
+ let currentControllerSearchState: ViewController.TabBarSearchState?
init(
layout: ContainerViewLayout,
toolbar: Toolbar?,
- isTabBarHidden: Bool
+ isTabBarHidden: Bool,
+ currentControllerSearchState: ViewController.TabBarSearchState?
) {
self.layout = layout
self.toolbar = toolbar
self.isTabBarHidden = isTabBarHidden
+ self.currentControllerSearchState = currentControllerSearchState
}
}
@@ -51,33 +49,36 @@ final class TabBarControllerNode: ASDisplayNode {
}
private var theme: PresentationTheme
+ private var strings: PresentationStrings
private let itemSelected: (Int, Bool, [ASDisplayNode]) -> Void
private let contextAction: (Int, ContextExtractedContentContainingView, ContextGesture) -> Void
private let tabBarView = ComponentView()
private let disabledOverlayNode: ASDisplayNode
- private var toolbarNode: ToolbarNode?
+ private var toolbar: ComponentView?
private let toolbarActionSelected: (ToolbarActionOption) -> Void
private let disabledPressed: () -> Void
+ private let activateSearch: () -> Void
+ private let deactivateSearch: () -> Void
private(set) var tabBarItems: [TabBarNodeItem] = []
private(set) var selectedIndex: Int = 0
- private(set) var currentControllerNode: ASDisplayNode?
+ private weak var currentController: ViewController?
private var layoutResult: LayoutResult?
private var isUpdateRequested: Bool = false
private var isChangingSelectedIndex: Bool = false
- func setCurrentControllerNode(_ node: ASDisplayNode?) -> () -> Void {
- guard node !== self.currentControllerNode else {
+ func setCurrentController(_ controller: ViewController?) -> () -> Void {
+ guard controller !== self.currentController else {
return {}
}
- let previousNode = self.currentControllerNode
- self.currentControllerNode = node
- if let currentControllerNode = self.currentControllerNode {
+ let previousNode = self.currentController?.displayNode
+ self.currentController = controller
+ if let currentControllerNode = self.currentController?.displayNode {
if let previousNode {
self.insertSubnode(currentControllerNode, aboveSubnode: previousNode)
} else {
@@ -89,14 +90,22 @@ final class TabBarControllerNode: ASDisplayNode {
}
return { [weak self, weak previousNode] in
- if previousNode !== self?.currentControllerNode {
+ if previousNode !== self?.currentController?.displayNode {
previousNode?.removeFromSupernode()
}
}
}
+
+ var currentSearchNode: ASDisplayNode? {
+ if let tabBarComponentView = self.tabBarView.view as? TabBarComponent.View {
+ return tabBarComponentView.currentSearchNode
+ }
+ return nil
+ }
- init(theme: PresentationTheme, itemSelected: @escaping (Int, Bool, [ASDisplayNode]) -> Void, contextAction: @escaping (Int, ContextExtractedContentContainingView, ContextGesture) -> Void, swipeAction: @escaping (Int, TabBarItemSwipeDirection) -> Void, toolbarActionSelected: @escaping (ToolbarActionOption) -> Void, disabledPressed: @escaping () -> Void) {
+ init(theme: PresentationTheme, strings: PresentationStrings, itemSelected: @escaping (Int, Bool, [ASDisplayNode]) -> Void, contextAction: @escaping (Int, ContextExtractedContentContainingView, ContextGesture) -> Void, swipeAction: @escaping (Int, TabBarItemSwipeDirection) -> Void, toolbarActionSelected: @escaping (ToolbarActionOption) -> Void, disabledPressed: @escaping () -> Void, activateSearch: @escaping () -> Void, deactivateSearch: @escaping () -> Void) {
self.theme = theme
+ self.strings = strings
self.itemSelected = itemSelected
self.contextAction = contextAction
self.disabledOverlayNode = ASDisplayNode()
@@ -104,7 +113,9 @@ final class TabBarControllerNode: ASDisplayNode {
self.disabledOverlayNode.alpha = 0.0
self.toolbarActionSelected = toolbarActionSelected
self.disabledPressed = disabledPressed
-
+ self.activateSearch = activateSearch
+ self.deactivateSearch = deactivateSearch
+
super.init()
self.setViewBlock({
@@ -146,7 +157,6 @@ final class TabBarControllerNode: ASDisplayNode {
self.backgroundColor = theme.list.plainBackgroundColor
self.disabledOverlayNode.backgroundColor = theme.rootController.tabBar.backgroundColor.withAlphaComponent(0.5)
- self.toolbarNode?.updateTheme(ToolbarTheme(theme: theme))
self.requestUpdate()
}
@@ -163,7 +173,7 @@ final class TabBarControllerNode: ASDisplayNode {
}
func containerLayoutUpdated(_ layout: ContainerViewLayout, toolbar: Toolbar?, transition: ContainedViewLayoutTransition) -> CGFloat {
- let params = Params(layout: layout, toolbar: toolbar, isTabBarHidden: self.tabBarHidden)
+ let params = Params(layout: layout, toolbar: toolbar, isTabBarHidden: self.tabBarHidden, currentControllerSearchState: self.currentController?.tabBarSearchState)
if let layoutResult = self.layoutResult, layoutResult.params == params {
return layoutResult.bottomInset
} else {
@@ -179,18 +189,27 @@ final class TabBarControllerNode: ASDisplayNode {
}
private func updateImpl(params: Params, transition: ContainedViewLayoutTransition) -> CGFloat {
- var options: ContainerViewLayoutInsetOptions = []
- if params.layout.metrics.widthClass == .regular {
- options.insert(.input)
+ var panelsBottomInset: CGFloat = params.layout.insets(options: []).bottom
+ if params.layout.metrics.widthClass == .regular, let inputHeight = params.layout.inputHeight, inputHeight != 0.0 {
+ panelsBottomInset = inputHeight + 8.0
}
-
- var bottomInset: CGFloat = params.layout.insets(options: options).bottom
- if bottomInset == 0.0 {
- bottomInset = 8.0
+ if panelsBottomInset == 0.0 {
+ panelsBottomInset = 8.0
} else {
- bottomInset = max(bottomInset, 8.0)
+ panelsBottomInset = max(panelsBottomInset, 8.0)
+ }
+
+ var tabBarBottomInset: CGFloat = panelsBottomInset
+ if let currentController = self.currentController {
+ if let tabBarSearchState = currentController.tabBarSearchState, tabBarSearchState.isActive, let inputHeight = params.layout.inputHeight, inputHeight != 0.0 {
+ tabBarBottomInset = max(tabBarBottomInset, inputHeight + 8.0)
+ }
+ }
+
+ var sideInset: CGFloat = 12.0
+ if tabBarBottomInset <= 28.0 {
+ sideInset = 20.0
}
- let sideInset: CGFloat = 20.0
var selectedId: AnyHashable?
if self.selectedIndex < self.tabBarItems.count {
@@ -208,6 +227,7 @@ final class TabBarControllerNode: ASDisplayNode {
transition: tabBarTransition,
component: AnyComponent(TabBarComponent(
theme: self.theme,
+ strings: self.strings,
items: self.tabBarItems.map { item in
let itemId = AnyHashable(ObjectIdentifier(item.item))
return TabBarComponent.Item(
@@ -230,13 +250,30 @@ final class TabBarControllerNode: ASDisplayNode {
}
)
},
+ search: self.currentController?.tabBarSearchState.flatMap { tabBarSearchState in
+ return TabBarComponent.Search(
+ isActive: tabBarSearchState.isActive,
+ activate: { [weak self] in
+ guard let self else {
+ return
+ }
+ self.activateSearch()
+ },
+ deactivate: { [weak self] in
+ guard let self else {
+ return
+ }
+ self.deactivateSearch()
+ }
+ )
+ },
selectedId: selectedId,
- isTablet: params.layout.metrics.isTablet
+ outerInsets: UIEdgeInsets(top: 0.0, left: sideInset, bottom: tabBarBottomInset, right: sideInset)
)),
environment: {},
containerSize: CGSize(width: params.layout.size.width - sideInset * 2.0, height: 100.0)
)
- let tabBarFrame = CGRect(origin: CGPoint(x: floor((params.layout.size.width - tabBarSize.width) * 0.5), y: params.layout.size.height - (self.tabBarHidden ? 0.0 : (tabBarSize.height + bottomInset))), size: tabBarSize)
+ let tabBarFrame = CGRect(origin: CGPoint(x: floor((params.layout.size.width - tabBarSize.width) * 0.5), y: params.layout.size.height - (self.tabBarHidden ? 0.0 : (tabBarSize.height + tabBarBottomInset))), size: tabBarSize)
if let tabBarComponentView = self.tabBarView.view {
if tabBarComponentView.superview == nil {
@@ -248,34 +285,90 @@ final class TabBarControllerNode: ASDisplayNode {
transition.updateFrame(node: self.disabledOverlayNode, frame: tabBarFrame)
- let toolbarHeight = 50.0 + params.layout.insets(options: options).bottom
- let toolbarFrame = CGRect(origin: CGPoint(x: 0.0, y: params.layout.size.height - toolbarHeight), size: CGSize(width: params.layout.size.width, height: toolbarHeight))
+ let toolbarHeight = 44.0
+ let toolbarFrame = CGRect(origin: CGPoint(x: sideInset, y: params.layout.size.height - panelsBottomInset - toolbarHeight), size: CGSize(width: params.layout.size.width - sideInset * 2.0, height: toolbarHeight))
- if let toolbar = params.toolbar {
- if let toolbarNode = self.toolbarNode {
- transition.updateFrame(node: toolbarNode, frame: toolbarFrame)
- toolbarNode.updateLayout(size: toolbarFrame.size, leftInset: params.layout.safeInsets.left, rightInset: params.layout.safeInsets.right, additionalSideInsets: params.layout.additionalInsets, bottomInset: bottomInset, toolbar: toolbar, transition: transition)
+ if let toolbarData = params.toolbar {
+ let toolbar: ComponentView
+ var toolbarTransition = ComponentTransition(transition)
+ if let current = self.toolbar {
+ toolbar = current
} else {
- let toolbarNode = ToolbarNode(theme: ToolbarTheme(theme: self.theme), displaySeparator: true, left: { [weak self] in
- self?.toolbarActionSelected(.left)
- }, right: { [weak self] in
- self?.toolbarActionSelected(.right)
- }, middle: { [weak self] in
- self?.toolbarActionSelected(.middle)
- })
- toolbarNode.frame = toolbarFrame
- toolbarNode.updateLayout(size: toolbarFrame.size, leftInset: params.layout.safeInsets.left, rightInset: params.layout.safeInsets.right, additionalSideInsets: params.layout.additionalInsets, bottomInset: bottomInset, toolbar: toolbar, transition: .immediate)
- self.addSubnode(toolbarNode)
- self.toolbarNode = toolbarNode
- if transition.isAnimated {
- toolbarNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
- }
+ toolbar = ComponentView()
+ self.toolbar = toolbar
+ toolbarTransition = .immediate
+ }
+
+ let _ = toolbar.update(
+ transition: toolbarTransition,
+ component: AnyComponent(GlassControlPanelComponent(
+ theme: self.theme,
+ leftItem: toolbarData.leftAction.flatMap { value in
+ return GlassControlPanelComponent.Item(
+ items: [GlassControlGroupComponent.Item(
+ id: "left_" + value.title,
+ content: .text(value.title),
+ action: value.isEnabled ? { [weak self] in
+ guard let self else {
+ return
+ }
+ self.toolbarActionSelected(.left)
+ } : nil
+ )],
+ background: .panel
+ )
+ },
+ centralItem: toolbarData.middleAction.flatMap { value in
+ return GlassControlPanelComponent.Item(
+ items: [GlassControlGroupComponent.Item(
+ id: "right_" + value.title,
+ content: .text(value.title),
+ action: value.isEnabled ? { [weak self] in
+ guard let self else {
+ return
+ }
+ self.toolbarActionSelected(.middle)
+ } : nil
+ )],
+ background: .panel
+ )
+ },
+ rightItem: toolbarData.rightAction.flatMap { value in
+ return GlassControlPanelComponent.Item(
+ items: [GlassControlGroupComponent.Item(
+ id: "right_" + value.title,
+ content: .text(value.title),
+ action: value.isEnabled ? { [weak self] in
+ guard let self else {
+ return
+ }
+ self.toolbarActionSelected(.right)
+ } : nil
+ )],
+ background: .panel
+ )
+ },
+ centerAlignmentIfPossible: true
+ )),
+ environment: {},
+ containerSize: toolbarFrame.size
+ )
+
+ if let toolbarView = toolbar.view {
+ if toolbarView.superview == nil {
+ self.view.addSubview(toolbarView)
+ toolbarView.alpha = 0.0
+ }
+ toolbarTransition.setFrame(view: toolbarView, frame: toolbarFrame)
+ ComponentTransition(transition).setAlpha(view: toolbarView, alpha: 1.0)
+ }
+ } else if let toolbar = self.toolbar {
+ self.toolbar = nil
+ if let toolbarView = toolbar.view {
+ ComponentTransition(transition).setAlpha(view: toolbarView, alpha: 0.0, completion: { [weak toolbarView] _ in
+ toolbarView?.removeFromSuperview()
+ })
}
- } else if let toolbarNode = self.toolbarNode {
- self.toolbarNode = nil
- transition.updateAlpha(node: toolbarNode, alpha: 0.0, completion: { [weak toolbarNode] _ in
- toolbarNode?.removeFromSupernode()
- })
}
return params.layout.size.height - tabBarFrame.minY
diff --git a/submodules/TabBarUI/Sources/TabBarController.swift b/submodules/TabBarUI/Sources/TabBarController.swift
index a3f7fe08..111fe208 100644
--- a/submodules/TabBarUI/Sources/TabBarController.swift
+++ b/submodules/TabBarUI/Sources/TabBarController.swift
@@ -93,9 +93,11 @@ open class TabBarControllerImpl: ViewController, TabBarController {
private let pendingControllerDisposable = MetaDisposable()
private var theme: PresentationTheme
+ private var strings: PresentationStrings
- public init(theme: PresentationTheme) {
+ public init(theme: PresentationTheme, strings: PresentationStrings) {
self.theme = theme
+ self.strings = strings
super.init(navigationBarPresentationData: nil)
@@ -152,7 +154,7 @@ open class TabBarControllerImpl: ViewController, TabBarController {
}
override open func loadDisplayNode() {
- self.displayNode = TabBarControllerNode(theme: self.theme, itemSelected: { [weak self] index, longTap, itemNodes in
+ self.displayNode = TabBarControllerNode(theme: self.theme, strings: self.strings, itemSelected: { [weak self] index, longTap, itemNodes in
if let strongSelf = self {
if longTap, let controller = strongSelf.controllers[index] as? TabBarContainedController {
controller.presentTabBarPreviewingController(sourceNodes: itemNodes)
@@ -235,6 +237,16 @@ open class TabBarControllerImpl: ViewController, TabBarController {
self?.currentController?.toolbarActionSelected(action: action)
}, disabledPressed: { [weak self] in
self?.currentController?.tabBarDisabledAction()
+ }, activateSearch: { [weak self] in
+ guard let self else {
+ return
+ }
+ self.currentController?.tabBarActivateSearch()
+ }, deactivateSearch: { [weak self] in
+ guard let self else {
+ return
+ }
+ self.currentController?.tabBarDeactivateSearch()
})
self.updateSelectedIndex()
@@ -263,7 +275,8 @@ open class TabBarControllerImpl: ViewController, TabBarController {
}
if let currentController = self.currentController {
currentController.willMove(toParent: nil)
- //self.tabBarControllerNode.currentControllerNode = nil
+ currentController.tabBarSearchStateUpdated = nil
+ currentController.currentTabBarSearchNode = nil
if animated {
currentController.view.layer.animateScale(from: 1.0, to: transitionScale, duration: 0.12, timingFunction: kCAMediaTimingFunctionSpring, removeOnCompletion: false, completion: { completed in
@@ -286,7 +299,7 @@ open class TabBarControllerImpl: ViewController, TabBarController {
currentController.willMove(toParent: self)
self.addChild(currentController)
- let commit = self.tabBarControllerNode.setCurrentControllerNode(currentController.displayNode)
+ let commit = self.tabBarControllerNode.setCurrentController(currentController)
if animated {
currentController.view.layer.animateScale(from: transitionScale, to: 1.0, duration: 0.15, delay: 0.1, timingFunction: kCAMediaTimingFunctionSpring)
currentController.view.layer.allowsGroupOpacity = true
@@ -303,6 +316,22 @@ open class TabBarControllerImpl: ViewController, TabBarController {
currentController.displayNode.recursivelyEnsureDisplaySynchronously(true)
self.statusBar.statusBarStyle = currentController.statusBar.statusBarStyle
+
+ currentController.tabBarSearchStateUpdated = { [weak self] transition in
+ guard let self else {
+ return
+ }
+ if let layout = self.validLayout {
+ self.containerLayoutUpdated(layout, transition: transition)
+ }
+ }
+
+ currentController.currentTabBarSearchNode = { [weak self] in
+ guard let self else {
+ return nil
+ }
+ return self.tabBarControllerNode.currentSearchNode
+ }
}
if let layout = self.validLayout {
diff --git a/submodules/TelegramApi/Sources/Api0.swift b/submodules/TelegramApi/Sources/Api0.swift
index 1f0fce87..455ff48a 100644
--- a/submodules/TelegramApi/Sources/Api0.swift
+++ b/submodules/TelegramApi/Sources/Api0.swift
@@ -417,6 +417,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-1279654347] = { return Api.InputMedia.parse_inputMediaPhoto($0) }
dict[-440664550] = { return Api.InputMedia.parse_inputMediaPhotoExternal($0) }
dict[261416433] = { return Api.InputMedia.parse_inputMediaPoll($0) }
+ dict[-207018934] = { return Api.InputMedia.parse_inputMediaStakeDice($0) }
dict[-1979852936] = { return Api.InputMedia.parse_inputMediaStory($0) }
dict[-1614454818] = { return Api.InputMedia.parse_inputMediaTodo($0) }
dict[58495792] = { return Api.InputMedia.parse_inputMediaUploadedDocument($0) }
@@ -432,6 +433,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[1548122514] = { return Api.InputNotifyPeer.parse_inputNotifyForumTopic($0) }
dict[-1195615476] = { return Api.InputNotifyPeer.parse_inputNotifyPeer($0) }
dict[423314455] = { return Api.InputNotifyPeer.parse_inputNotifyUsers($0) }
+ dict[1528613672] = { return Api.InputPasskeyCredential.parse_inputPasskeyCredentialFirebasePNV($0) }
dict[1009235855] = { return Api.InputPasskeyCredential.parse_inputPasskeyCredentialPublicKey($0) }
dict[-1021329078] = { return Api.InputPasskeyResponse.parse_inputPasskeyResponseLogin($0) }
dict[1046713180] = { return Api.InputPasskeyResponse.parse_inputPasskeyResponseRegister($0) }
@@ -572,7 +574,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-1098720356] = { return Api.MediaArea.parse_mediaAreaVenue($0) }
dict[1235637404] = { return Api.MediaArea.parse_mediaAreaWeather($0) }
dict[-808853502] = { return Api.MediaAreaCoordinates.parse_mediaAreaCoordinates($0) }
- dict[-1188071729] = { return Api.Message.parse_message($0) }
+ dict[-1665888023] = { return Api.Message.parse_message($0) }
dict[-1868117372] = { return Api.Message.parse_messageEmpty($0) }
dict[2055212554] = { return Api.Message.parse_messageService($0) }
dict[-872240531] = { return Api.MessageAction.parse_messageActionBoostApply($0) }
@@ -660,7 +662,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-1386050360] = { return Api.MessageExtendedMedia.parse_messageExtendedMediaPreview($0) }
dict[1313731771] = { return Api.MessageFwdHeader.parse_messageFwdHeader($0) }
dict[1882335561] = { return Api.MessageMedia.parse_messageMediaContact($0) }
- dict[1065280907] = { return Api.MessageMedia.parse_messageMediaDice($0) }
+ dict[147581959] = { return Api.MessageMedia.parse_messageMediaDice($0) }
dict[1389939929] = { return Api.MessageMedia.parse_messageMediaDocument($0) }
dict[1038967584] = { return Api.MessageMedia.parse_messageMediaEmpty($0) }
dict[-38694904] = { return Api.MessageMedia.parse_messageMediaGame($0) }
@@ -1127,6 +1129,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-302247650] = { return Api.Update.parse_updateDraftMessage($0) }
dict[457133559] = { return Api.Update.parse_updateEditChannelMessage($0) }
dict[-469536605] = { return Api.Update.parse_updateEditMessage($0) }
+ dict[-73640838] = { return Api.Update.parse_updateEmojiGameInfo($0) }
dict[386986326] = { return Api.Update.parse_updateEncryptedChatTyping($0) }
dict[956179895] = { return Api.Update.parse_updateEncryptedMessagesRead($0) }
dict[-1264392051] = { return Api.Update.parse_updateEncryption($0) }
@@ -1417,6 +1420,9 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-253500010] = { return Api.messages.Dialogs.parse_dialogsNotModified($0) }
dict[1910543603] = { return Api.messages.Dialogs.parse_dialogsSlice($0) }
dict[-1506535550] = { return Api.messages.DiscussionMessage.parse_discussionMessage($0) }
+ dict[1155883043] = { return Api.messages.EmojiGameInfo.parse_emojiGameDiceInfo($0) }
+ dict[1508266805] = { return Api.messages.EmojiGameInfo.parse_emojiGameUnavailable($0) }
+ dict[-634726841] = { return Api.messages.EmojiGameOutcome.parse_emojiGameOutcome($0) }
dict[-2011186869] = { return Api.messages.EmojiGroups.parse_emojiGroups($0) }
dict[1874111879] = { return Api.messages.EmojiGroups.parse_emojiGroupsNotModified($0) }
dict[410107472] = { return Api.messages.ExportedChatInvite.parse_exportedChatInvite($0) }
@@ -2573,6 +2579,10 @@ public extension Api {
_1.serialize(buffer, boxed)
case let _1 as Api.messages.DiscussionMessage:
_1.serialize(buffer, boxed)
+ case let _1 as Api.messages.EmojiGameInfo:
+ _1.serialize(buffer, boxed)
+ case let _1 as Api.messages.EmojiGameOutcome:
+ _1.serialize(buffer, boxed)
case let _1 as Api.messages.EmojiGroups:
_1.serialize(buffer, boxed)
case let _1 as Api.messages.ExportedChatInvite:
diff --git a/submodules/TelegramApi/Sources/Api1.swift b/submodules/TelegramApi/Sources/Api1.swift
index 2177c01e..1056c070 100644
--- a/submodules/TelegramApi/Sources/Api1.swift
+++ b/submodules/TelegramApi/Sources/Api1.swift
@@ -24,12 +24,8 @@ public extension Api {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.AccountDaysTTL.accountDaysTTL(days: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.AccountDaysTTL.accountDaysTTL(days: _1!)
}
}
@@ -88,12 +84,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 3) == 0) || _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.AttachMenuBot.attachMenuBot(flags: _1!, botId: _2!, shortName: _3!, peerTypes: _4, icons: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.AttachMenuBot.attachMenuBot(flags: _1!, botId: _2!, shortName: _3!, peerTypes: _4, icons: _5!)
}
}
@@ -144,12 +140,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.AttachMenuBotIcon.attachMenuBotIcon(flags: _1!, name: _2!, icon: _3!, colors: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.AttachMenuBotIcon.attachMenuBotIcon(flags: _1!, name: _2!, icon: _3!, colors: _4)
}
}
@@ -184,12 +179,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.AttachMenuBotIconColor.attachMenuBotIconColor(name: _1!, color: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.AttachMenuBotIconColor.attachMenuBotIconColor(name: _1!, color: _2!)
}
}
@@ -249,12 +241,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.AttachMenuBots.attachMenuBots(hash: _1!, bots: _2!, users: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.AttachMenuBots.attachMenuBots(hash: _1!, bots: _2!, users: _3!)
}
public static func parse_attachMenuBotsNotModified(_ reader: BufferReader) -> AttachMenuBots? {
return Api.AttachMenuBots.attachMenuBotsNotModified
@@ -300,12 +290,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.AttachMenuBotsBot.attachMenuBotsBot(bot: _1!, users: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.AttachMenuBotsBot.attachMenuBotsBot(bot: _1!, users: _2!)
}
}
@@ -420,12 +407,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.AuctionBidLevel.auctionBidLevel(pos: _1!, amount: _2!, date: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.AuctionBidLevel.auctionBidLevel(pos: _1!, amount: _2!, date: _3!)
}
}
@@ -504,12 +489,20 @@ public extension Api {
let _c11 = _11 != nil
let _c12 = _12 != nil
let _c13 = _13 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 {
- return Api.Authorization.authorization(flags: _1!, hash: _2!, deviceModel: _3!, platform: _4!, systemVersion: _5!, apiId: _6!, appName: _7!, appVersion: _8!, dateCreated: _9!, dateActive: _10!, ip: _11!, country: _12!, region: _13!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ if !_c13 { return nil }
+ return Api.Authorization.authorization(flags: _1!, hash: _2!, deviceModel: _3!, platform: _4!, systemVersion: _5!, apiId: _6!, appName: _7!, appVersion: _8!, dateCreated: _9!, dateActive: _10!, ip: _11!, country: _12!, region: _13!)
}
}
@@ -564,12 +557,14 @@ public extension Api {
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.AutoDownloadSettings.autoDownloadSettings(flags: _1!, photoSizeMax: _2!, videoSizeMax: _3!, fileSizeMax: _4!, videoUploadMaxbitrate: _5!, smallQueueActiveOperationsMax: _6!, largeQueueActiveOperationsMax: _7!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.AutoDownloadSettings.autoDownloadSettings(flags: _1!, photoSizeMax: _2!, videoSizeMax: _3!, fileSizeMax: _4!, videoUploadMaxbitrate: _5!, smallQueueActiveOperationsMax: _6!, largeQueueActiveOperationsMax: _7!)
}
}
@@ -608,12 +603,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.AutoSaveException.autoSaveException(peer: _1!, settings: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.AutoSaveException.autoSaveException(peer: _1!, settings: _2!)
}
}
@@ -648,12 +640,9 @@ public extension Api {
if Int(_1!) & Int(1 << 2) != 0 {_2 = reader.readInt64() }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 2) == 0) || _2 != nil
- if _c1 && _c2 {
- return Api.AutoSaveSettings.autoSaveSettings(flags: _1!, videoMaxSize: _2)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.AutoSaveSettings.autoSaveSettings(flags: _1!, videoMaxSize: _2)
}
}
@@ -704,12 +693,13 @@ public extension Api {
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.AvailableEffect.availableEffect(flags: _1!, id: _2!, emoticon: _3!, staticIconId: _4, effectStickerId: _5!, effectAnimationId: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.AvailableEffect.availableEffect(flags: _1!, id: _2!, emoticon: _3!, staticIconId: _4, effectStickerId: _5!, effectAnimationId: _6)
}
}
@@ -790,12 +780,17 @@ public extension Api {
let _c8 = _8 != nil
let _c9 = (Int(_1!) & Int(1 << 1) == 0) || _9 != nil
let _c10 = (Int(_1!) & Int(1 << 1) == 0) || _10 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 {
- return Api.AvailableReaction.availableReaction(flags: _1!, reaction: _2!, title: _3!, staticIcon: _4!, appearAnimation: _5!, selectAnimation: _6!, activateAnimation: _7!, effectAnimation: _8!, aroundAnimation: _9, centerIcon: _10)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ return Api.AvailableReaction.availableReaction(flags: _1!, reaction: _2!, title: _3!, staticIcon: _4!, appearAnimation: _5!, selectAnimation: _6!, activateAnimation: _7!, effectAnimation: _8!, aroundAnimation: _9, centerIcon: _10)
}
}
@@ -830,12 +825,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.BankCardOpenUrl.bankCardOpenUrl(url: _1!, name: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.BankCardOpenUrl.bankCardOpenUrl(url: _1!, name: _2!)
}
}
@@ -954,12 +946,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.Birthday.birthday(flags: _1!, day: _2!, month: _3!, year: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.Birthday.birthday(flags: _1!, day: _2!, month: _3!, year: _4)
}
}
@@ -1062,12 +1053,16 @@ public extension Api {
let _c7 = (Int(_1!) & Int(1 << 4) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 5) == 0) || _8 != nil
let _c9 = (Int(_1!) & Int(1 << 6) == 0) || _9 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
- return Api.Boost.boost(flags: _1!, id: _2!, userId: _3, giveawayMsgId: _4, date: _5!, expires: _6!, usedGiftSlug: _7, multiplier: _8, stars: _9)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ return Api.Boost.boost(flags: _1!, id: _2!, userId: _3, giveawayMsgId: _4, date: _5!, expires: _6!, usedGiftSlug: _7, multiplier: _8, stars: _9)
}
}
@@ -1143,12 +1138,16 @@ public extension Api {
let _c7 = _7 != nil
let _c8 = (Int(_1!) & Int(1 << 0) == 0) || _8 != nil
let _c9 = _9 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
- return Api.BotApp.botApp(flags: _1!, id: _2!, accessHash: _3!, shortName: _4!, title: _5!, description: _6!, photo: _7!, document: _8, hash: _9!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ return Api.BotApp.botApp(flags: _1!, id: _2!, accessHash: _3!, shortName: _4!, title: _5!, description: _6!, photo: _7!, document: _8, hash: _9!)
}
public static func parse_botAppNotModified(_ reader: BufferReader) -> BotApp? {
return Api.BotApp.botAppNotModified
@@ -1202,12 +1201,13 @@ public extension Api {
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 4) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.BotAppSettings.botAppSettings(flags: _1!, placeholderPath: _2, backgroundColor: _3, backgroundDarkColor: _4, headerColor: _5, headerDarkColor: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.BotAppSettings.botAppSettings(flags: _1!, placeholderPath: _2, backgroundColor: _3, backgroundDarkColor: _4, headerColor: _5, headerDarkColor: _6)
}
}
diff --git a/submodules/TelegramApi/Sources/Api10.swift b/submodules/TelegramApi/Sources/Api10.swift
index 6da06977..08d007a9 100644
--- a/submodules/TelegramApi/Sources/Api10.swift
+++ b/submodules/TelegramApi/Sources/Api10.swift
@@ -138,12 +138,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.InputFileLocation.inputDocumentFileLocation(id: _1!, accessHash: _2!, fileReference: _3!, thumbSize: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.InputFileLocation.inputDocumentFileLocation(id: _1!, accessHash: _2!, fileReference: _3!, thumbSize: _4!)
}
public static func parse_inputEncryptedFileLocation(_ reader: BufferReader) -> InputFileLocation? {
var _1: Int64?
@@ -152,12 +151,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputFileLocation.inputEncryptedFileLocation(id: _1!, accessHash: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputFileLocation.inputEncryptedFileLocation(id: _1!, accessHash: _2!)
}
public static func parse_inputFileLocation(_ reader: BufferReader) -> InputFileLocation? {
var _1: Int64?
@@ -172,12 +168,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.InputFileLocation.inputFileLocation(volumeId: _1!, localId: _2!, secret: _3!, fileReference: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.InputFileLocation.inputFileLocation(volumeId: _1!, localId: _2!, secret: _3!, fileReference: _4!)
}
public static func parse_inputGroupCallStream(_ reader: BufferReader) -> InputFileLocation? {
var _1: Int32?
@@ -200,12 +195,13 @@ public extension Api {
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.InputFileLocation.inputGroupCallStream(flags: _1!, call: _2!, timeMs: _3!, scale: _4!, videoChannel: _5, videoQuality: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.InputFileLocation.inputGroupCallStream(flags: _1!, call: _2!, timeMs: _3!, scale: _4!, videoChannel: _5, videoQuality: _6)
}
public static func parse_inputPeerPhotoFileLocation(_ reader: BufferReader) -> InputFileLocation? {
var _1: Int32?
@@ -219,12 +215,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.InputFileLocation.inputPeerPhotoFileLocation(flags: _1!, peer: _2!, photoId: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.InputFileLocation.inputPeerPhotoFileLocation(flags: _1!, peer: _2!, photoId: _3!)
}
public static func parse_inputPhotoFileLocation(_ reader: BufferReader) -> InputFileLocation? {
var _1: Int64?
@@ -239,12 +233,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.InputFileLocation.inputPhotoFileLocation(id: _1!, accessHash: _2!, fileReference: _3!, thumbSize: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.InputFileLocation.inputPhotoFileLocation(id: _1!, accessHash: _2!, fileReference: _3!, thumbSize: _4!)
}
public static func parse_inputPhotoLegacyFileLocation(_ reader: BufferReader) -> InputFileLocation? {
var _1: Int64?
@@ -265,12 +258,13 @@ public extension Api {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.InputFileLocation.inputPhotoLegacyFileLocation(id: _1!, accessHash: _2!, fileReference: _3!, volumeId: _4!, localId: _5!, secret: _6!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.InputFileLocation.inputPhotoLegacyFileLocation(id: _1!, accessHash: _2!, fileReference: _3!, volumeId: _4!, localId: _5!, secret: _6!)
}
public static func parse_inputSecureFileLocation(_ reader: BufferReader) -> InputFileLocation? {
var _1: Int64?
@@ -279,12 +273,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputFileLocation.inputSecureFileLocation(id: _1!, accessHash: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputFileLocation.inputSecureFileLocation(id: _1!, accessHash: _2!)
}
public static func parse_inputStickerSetThumb(_ reader: BufferReader) -> InputFileLocation? {
var _1: Api.InputStickerSet?
@@ -295,12 +286,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputFileLocation.inputStickerSetThumb(stickerset: _1!, thumbVersion: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputFileLocation.inputStickerSetThumb(stickerset: _1!, thumbVersion: _2!)
}
public static func parse_inputTakeoutFileLocation(_ reader: BufferReader) -> InputFileLocation? {
return Api.InputFileLocation.inputTakeoutFileLocation
@@ -340,12 +328,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputFolderPeer.inputFolderPeer(peer: _1!, folderId: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputFolderPeer.inputFolderPeer(peer: _1!, folderId: _2!)
}
}
@@ -390,12 +375,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputGame.inputGameID(id: _1!, accessHash: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputGame.inputGameID(id: _1!, accessHash: _2!)
}
public static func parse_inputGameShortName(_ reader: BufferReader) -> InputGame? {
var _1: Api.InputUser?
@@ -406,12 +388,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputGame.inputGameShortName(botId: _1!, shortName: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputGame.inputGameShortName(botId: _1!, shortName: _2!)
}
}
@@ -463,12 +442,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.InputGeoPoint.inputGeoPoint(flags: _1!, lat: _2!, long: _3!, accuracyRadius: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.InputGeoPoint.inputGeoPoint(flags: _1!, lat: _2!, long: _3!, accuracyRadius: _4)
}
public static func parse_inputGeoPointEmpty(_ reader: BufferReader) -> InputGeoPoint? {
return Api.InputGeoPoint.inputGeoPointEmpty
@@ -524,34 +502,23 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputGroupCall.inputGroupCall(id: _1!, accessHash: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputGroupCall.inputGroupCall(id: _1!, accessHash: _2!)
}
public static func parse_inputGroupCallInviteMessage(_ reader: BufferReader) -> InputGroupCall? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.InputGroupCall.inputGroupCallInviteMessage(msgId: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputGroupCall.inputGroupCallInviteMessage(msgId: _1!)
}
public static func parse_inputGroupCallSlug(_ reader: BufferReader) -> InputGroupCall? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.InputGroupCall.inputGroupCallSlug(slug: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputGroupCall.inputGroupCallSlug(slug: _1!)
}
}
@@ -731,23 +698,16 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputInvoice.inputInvoiceBusinessBotTransferStars(bot: _1!, stars: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputInvoice.inputInvoiceBusinessBotTransferStars(bot: _1!, stars: _2!)
}
public static func parse_inputInvoiceChatInviteSubscription(_ reader: BufferReader) -> InputInvoice? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.InputInvoice.inputInvoiceChatInviteSubscription(hash: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputInvoice.inputInvoiceChatInviteSubscription(hash: _1!)
}
public static func parse_inputInvoiceMessage(_ reader: BufferReader) -> InputInvoice? {
var _1: Api.InputPeer?
@@ -758,12 +718,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputInvoice.inputInvoiceMessage(peer: _1!, msgId: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputInvoice.inputInvoiceMessage(peer: _1!, msgId: _2!)
}
public static func parse_inputInvoicePremiumAuthCode(_ reader: BufferReader) -> InputInvoice? {
var _1: Api.InputStorePaymentPurpose?
@@ -771,12 +728,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.InputStorePaymentPurpose
}
let _c1 = _1 != nil
- if _c1 {
- return Api.InputInvoice.inputInvoicePremiumAuthCode(purpose: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputInvoice.inputInvoicePremiumAuthCode(purpose: _1!)
}
public static func parse_inputInvoicePremiumGiftCode(_ reader: BufferReader) -> InputInvoice? {
var _1: Api.InputStorePaymentPurpose?
@@ -789,12 +742,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputInvoice.inputInvoicePremiumGiftCode(purpose: _1!, option: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputInvoice.inputInvoicePremiumGiftCode(purpose: _1!, option: _2!)
}
public static func parse_inputInvoicePremiumGiftStars(_ reader: BufferReader) -> InputInvoice? {
var _1: Int32?
@@ -813,23 +763,18 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.InputInvoice.inputInvoicePremiumGiftStars(flags: _1!, userId: _2!, months: _3!, message: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.InputInvoice.inputInvoicePremiumGiftStars(flags: _1!, userId: _2!, months: _3!, message: _4)
}
public static func parse_inputInvoiceSlug(_ reader: BufferReader) -> InputInvoice? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.InputInvoice.inputInvoiceSlug(slug: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputInvoice.inputInvoiceSlug(slug: _1!)
}
public static func parse_inputInvoiceStarGift(_ reader: BufferReader) -> InputInvoice? {
var _1: Int32?
@@ -848,12 +793,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.InputInvoice.inputInvoiceStarGift(flags: _1!, peer: _2!, giftId: _3!, message: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.InputInvoice.inputInvoiceStarGift(flags: _1!, peer: _2!, giftId: _3!, message: _4)
}
public static func parse_inputInvoiceStarGiftAuctionBid(_ reader: BufferReader) -> InputInvoice? {
var _1: Int32?
@@ -875,12 +819,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.InputInvoice.inputInvoiceStarGiftAuctionBid(flags: _1!, peer: _2, giftId: _3!, bidAmount: _4!, message: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.InputInvoice.inputInvoiceStarGiftAuctionBid(flags: _1!, peer: _2, giftId: _3!, bidAmount: _4!, message: _5)
}
public static func parse_inputInvoiceStarGiftDropOriginalDetails(_ reader: BufferReader) -> InputInvoice? {
var _1: Api.InputSavedStarGift?
@@ -888,12 +832,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.InputSavedStarGift
}
let _c1 = _1 != nil
- if _c1 {
- return Api.InputInvoice.inputInvoiceStarGiftDropOriginalDetails(stargift: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputInvoice.inputInvoiceStarGiftDropOriginalDetails(stargift: _1!)
}
public static func parse_inputInvoiceStarGiftPrepaidUpgrade(_ reader: BufferReader) -> InputInvoice? {
var _1: Api.InputPeer?
@@ -904,12 +844,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputInvoice.inputInvoiceStarGiftPrepaidUpgrade(peer: _1!, hash: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputInvoice.inputInvoiceStarGiftPrepaidUpgrade(peer: _1!, hash: _2!)
}
public static func parse_inputInvoiceStarGiftResale(_ reader: BufferReader) -> InputInvoice? {
var _1: Int32?
@@ -923,12 +860,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.InputInvoice.inputInvoiceStarGiftResale(flags: _1!, slug: _2!, toId: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.InputInvoice.inputInvoiceStarGiftResale(flags: _1!, slug: _2!, toId: _3!)
}
public static func parse_inputInvoiceStarGiftTransfer(_ reader: BufferReader) -> InputInvoice? {
var _1: Api.InputSavedStarGift?
@@ -941,12 +876,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputInvoice.inputInvoiceStarGiftTransfer(stargift: _1!, toId: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputInvoice.inputInvoiceStarGiftTransfer(stargift: _1!, toId: _2!)
}
public static func parse_inputInvoiceStarGiftUpgrade(_ reader: BufferReader) -> InputInvoice? {
var _1: Int32?
@@ -957,12 +889,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputInvoice.inputInvoiceStarGiftUpgrade(flags: _1!, stargift: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputInvoice.inputInvoiceStarGiftUpgrade(flags: _1!, stargift: _2!)
}
public static func parse_inputInvoiceStars(_ reader: BufferReader) -> InputInvoice? {
var _1: Api.InputStorePaymentPurpose?
@@ -970,12 +899,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.InputStorePaymentPurpose
}
let _c1 = _1 != nil
- if _c1 {
- return Api.InputInvoice.inputInvoiceStars(purpose: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputInvoice.inputInvoiceStars(purpose: _1!)
}
}
diff --git a/submodules/TelegramApi/Sources/Api11.swift b/submodules/TelegramApi/Sources/Api11.swift
index 4914c64e..f44bd4e7 100644
--- a/submodules/TelegramApi/Sources/Api11.swift
+++ b/submodules/TelegramApi/Sources/Api11.swift
@@ -13,6 +13,7 @@ public extension Api {
case inputMediaPhoto(flags: Int32, id: Api.InputPhoto, ttlSeconds: Int32?)
case inputMediaPhotoExternal(flags: Int32, url: String, ttlSeconds: Int32?)
case inputMediaPoll(flags: Int32, poll: Api.Poll, correctAnswers: [Buffer]?, solution: String?, solutionEntities: [Api.MessageEntity]?)
+ case inputMediaStakeDice(gameHash: String, tonAmount: Int64, clientSeed: Buffer)
case inputMediaStory(peer: Api.InputPeer, id: Int32)
case inputMediaTodo(todo: Api.TodoList)
case inputMediaUploadedDocument(flags: Int32, file: Api.InputFile, thumb: Api.InputFile?, mimeType: String, attributes: [Api.DocumentAttribute], stickers: [Api.InputDocument]?, videoCover: Api.InputPhoto?, videoTimestamp: Int32?, ttlSeconds: Int32?)
@@ -148,6 +149,14 @@ public extension Api {
item.serialize(buffer, true)
}}
break
+ case .inputMediaStakeDice(let gameHash, let tonAmount, let clientSeed):
+ if boxed {
+ buffer.appendInt32(-207018934)
+ }
+ serializeString(gameHash, buffer: buffer, boxed: false)
+ serializeInt64(tonAmount, buffer: buffer, boxed: false)
+ serializeBytes(clientSeed, buffer: buffer, boxed: false)
+ break
case .inputMediaStory(let peer, let id):
if boxed {
buffer.appendInt32(-1979852936)
@@ -245,6 +254,8 @@ public extension Api {
return ("inputMediaPhotoExternal", [("flags", flags as Any), ("url", url as Any), ("ttlSeconds", ttlSeconds as Any)])
case .inputMediaPoll(let flags, let poll, let correctAnswers, let solution, let solutionEntities):
return ("inputMediaPoll", [("flags", flags as Any), ("poll", poll as Any), ("correctAnswers", correctAnswers as Any), ("solution", solution as Any), ("solutionEntities", solutionEntities as Any)])
+ case .inputMediaStakeDice(let gameHash, let tonAmount, let clientSeed):
+ return ("inputMediaStakeDice", [("gameHash", gameHash as Any), ("tonAmount", tonAmount as Any), ("clientSeed", clientSeed as Any)])
case .inputMediaStory(let peer, let id):
return ("inputMediaStory", [("peer", peer as Any), ("id", id as Any)])
case .inputMediaTodo(let todo):
@@ -273,23 +284,18 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.InputMedia.inputMediaContact(phoneNumber: _1!, firstName: _2!, lastName: _3!, vcard: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.InputMedia.inputMediaContact(phoneNumber: _1!, firstName: _2!, lastName: _3!, vcard: _4!)
}
public static func parse_inputMediaDice(_ reader: BufferReader) -> InputMedia? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.InputMedia.inputMediaDice(emoticon: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputMedia.inputMediaDice(emoticon: _1!)
}
public static func parse_inputMediaDocument(_ reader: BufferReader) -> InputMedia? {
var _1: Int32?
@@ -314,12 +320,13 @@ public extension Api {
let _c4 = (Int(_1!) & Int(1 << 4) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.InputMedia.inputMediaDocument(flags: _1!, id: _2!, videoCover: _3, videoTimestamp: _4, ttlSeconds: _5, query: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.InputMedia.inputMediaDocument(flags: _1!, id: _2!, videoCover: _3, videoTimestamp: _4, ttlSeconds: _5, query: _6)
}
public static func parse_inputMediaDocumentExternal(_ reader: BufferReader) -> InputMedia? {
var _1: Int32?
@@ -339,12 +346,12 @@ public extension Api {
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.InputMedia.inputMediaDocumentExternal(flags: _1!, url: _2!, ttlSeconds: _3, videoCover: _4, videoTimestamp: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.InputMedia.inputMediaDocumentExternal(flags: _1!, url: _2!, ttlSeconds: _3, videoCover: _4, videoTimestamp: _5)
}
public static func parse_inputMediaEmpty(_ reader: BufferReader) -> InputMedia? {
return Api.InputMedia.inputMediaEmpty
@@ -355,12 +362,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.InputGame
}
let _c1 = _1 != nil
- if _c1 {
- return Api.InputMedia.inputMediaGame(id: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputMedia.inputMediaGame(id: _1!)
}
public static func parse_inputMediaGeoLive(_ reader: BufferReader) -> InputMedia? {
var _1: Int32?
@@ -380,12 +383,12 @@ public extension Api {
let _c3 = (Int(_1!) & Int(1 << 2) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.InputMedia.inputMediaGeoLive(flags: _1!, geoPoint: _2!, heading: _3, period: _4, proximityNotificationRadius: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.InputMedia.inputMediaGeoLive(flags: _1!, geoPoint: _2!, heading: _3, period: _4, proximityNotificationRadius: _5)
}
public static func parse_inputMediaGeoPoint(_ reader: BufferReader) -> InputMedia? {
var _1: Api.InputGeoPoint?
@@ -393,12 +396,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.InputGeoPoint
}
let _c1 = _1 != nil
- if _c1 {
- return Api.InputMedia.inputMediaGeoPoint(geoPoint: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputMedia.inputMediaGeoPoint(geoPoint: _1!)
}
public static func parse_inputMediaInvoice(_ reader: BufferReader) -> InputMedia? {
var _1: Int32?
@@ -439,12 +438,17 @@ public extension Api {
let _c8 = _8 != nil
let _c9 = (Int(_1!) & Int(1 << 1) == 0) || _9 != nil
let _c10 = (Int(_1!) & Int(1 << 2) == 0) || _10 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 {
- return Api.InputMedia.inputMediaInvoice(flags: _1!, title: _2!, description: _3!, photo: _4, invoice: _5!, payload: _6!, provider: _7, providerData: _8!, startParam: _9, extendedMedia: _10)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ return Api.InputMedia.inputMediaInvoice(flags: _1!, title: _2!, description: _3!, photo: _4, invoice: _5!, payload: _6!, provider: _7, providerData: _8!, startParam: _9, extendedMedia: _10)
}
public static func parse_inputMediaPaidMedia(_ reader: BufferReader) -> InputMedia? {
var _1: Int32?
@@ -461,12 +465,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.InputMedia.inputMediaPaidMedia(flags: _1!, starsAmount: _2!, extendedMedia: _3!, payload: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.InputMedia.inputMediaPaidMedia(flags: _1!, starsAmount: _2!, extendedMedia: _3!, payload: _4)
}
public static func parse_inputMediaPhoto(_ reader: BufferReader) -> InputMedia? {
var _1: Int32?
@@ -480,12 +483,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.InputMedia.inputMediaPhoto(flags: _1!, id: _2!, ttlSeconds: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.InputMedia.inputMediaPhoto(flags: _1!, id: _2!, ttlSeconds: _3)
}
public static func parse_inputMediaPhotoExternal(_ reader: BufferReader) -> InputMedia? {
var _1: Int32?
@@ -497,12 +498,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.InputMedia.inputMediaPhotoExternal(flags: _1!, url: _2!, ttlSeconds: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.InputMedia.inputMediaPhotoExternal(flags: _1!, url: _2!, ttlSeconds: _3)
}
public static func parse_inputMediaPoll(_ reader: BufferReader) -> InputMedia? {
var _1: Int32?
@@ -526,12 +525,27 @@ public extension Api {
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.InputMedia.inputMediaPoll(flags: _1!, poll: _2!, correctAnswers: _3, solution: _4, solutionEntities: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.InputMedia.inputMediaPoll(flags: _1!, poll: _2!, correctAnswers: _3, solution: _4, solutionEntities: _5)
+ }
+ public static func parse_inputMediaStakeDice(_ reader: BufferReader) -> InputMedia? {
+ var _1: String?
+ _1 = parseString(reader)
+ var _2: Int64?
+ _2 = reader.readInt64()
+ var _3: Buffer?
+ _3 = parseBytes(reader)
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = _3 != nil
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.InputMedia.inputMediaStakeDice(gameHash: _1!, tonAmount: _2!, clientSeed: _3!)
}
public static func parse_inputMediaStory(_ reader: BufferReader) -> InputMedia? {
var _1: Api.InputPeer?
@@ -542,12 +556,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputMedia.inputMediaStory(peer: _1!, id: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputMedia.inputMediaStory(peer: _1!, id: _2!)
}
public static func parse_inputMediaTodo(_ reader: BufferReader) -> InputMedia? {
var _1: Api.TodoList?
@@ -555,12 +566,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.TodoList
}
let _c1 = _1 != nil
- if _c1 {
- return Api.InputMedia.inputMediaTodo(todo: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputMedia.inputMediaTodo(todo: _1!)
}
public static func parse_inputMediaUploadedDocument(_ reader: BufferReader) -> InputMedia? {
var _1: Int32?
@@ -600,12 +607,16 @@ public extension Api {
let _c7 = (Int(_1!) & Int(1 << 6) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 7) == 0) || _8 != nil
let _c9 = (Int(_1!) & Int(1 << 1) == 0) || _9 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
- return Api.InputMedia.inputMediaUploadedDocument(flags: _1!, file: _2!, thumb: _3, mimeType: _4!, attributes: _5!, stickers: _6, videoCover: _7, videoTimestamp: _8, ttlSeconds: _9)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ return Api.InputMedia.inputMediaUploadedDocument(flags: _1!, file: _2!, thumb: _3, mimeType: _4!, attributes: _5!, stickers: _6, videoCover: _7, videoTimestamp: _8, ttlSeconds: _9)
}
public static func parse_inputMediaUploadedPhoto(_ reader: BufferReader) -> InputMedia? {
var _1: Int32?
@@ -624,12 +635,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.InputMedia.inputMediaUploadedPhoto(flags: _1!, file: _2!, stickers: _3, ttlSeconds: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.InputMedia.inputMediaUploadedPhoto(flags: _1!, file: _2!, stickers: _3, ttlSeconds: _4)
}
public static func parse_inputMediaVenue(_ reader: BufferReader) -> InputMedia? {
var _1: Api.InputGeoPoint?
@@ -652,12 +662,13 @@ public extension Api {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.InputMedia.inputMediaVenue(geoPoint: _1!, title: _2!, address: _3!, provider: _4!, venueId: _5!, venueType: _6!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.InputMedia.inputMediaVenue(geoPoint: _1!, title: _2!, address: _3!, provider: _4!, venueId: _5!, venueType: _6!)
}
public static func parse_inputMediaWebPage(_ reader: BufferReader) -> InputMedia? {
var _1: Int32?
@@ -666,12 +677,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputMedia.inputMediaWebPage(flags: _1!, url: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputMedia.inputMediaWebPage(flags: _1!, url: _2!)
}
}
@@ -733,23 +741,16 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputMessage.inputMessageCallbackQuery(id: _1!, queryId: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputMessage.inputMessageCallbackQuery(id: _1!, queryId: _2!)
}
public static func parse_inputMessageID(_ reader: BufferReader) -> InputMessage? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.InputMessage.inputMessageID(id: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputMessage.inputMessageID(id: _1!)
}
public static func parse_inputMessagePinned(_ reader: BufferReader) -> InputMessage? {
return Api.InputMessage.inputMessagePinned
@@ -758,12 +759,8 @@ public extension Api {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.InputMessage.inputMessageReplyTo(id: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputMessage.inputMessageReplyTo(id: _1!)
}
}
@@ -842,12 +839,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputNotifyPeer.inputNotifyForumTopic(peer: _1!, topMsgId: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputNotifyPeer.inputNotifyForumTopic(peer: _1!, topMsgId: _2!)
}
public static func parse_inputNotifyPeer(_ reader: BufferReader) -> InputNotifyPeer? {
var _1: Api.InputPeer?
@@ -855,12 +849,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
}
let _c1 = _1 != nil
- if _c1 {
- return Api.InputNotifyPeer.inputNotifyPeer(peer: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputNotifyPeer.inputNotifyPeer(peer: _1!)
}
public static func parse_inputNotifyUsers(_ reader: BufferReader) -> InputNotifyPeer? {
return Api.InputNotifyPeer.inputNotifyUsers
@@ -870,10 +860,17 @@ public extension Api {
}
public extension Api {
enum InputPasskeyCredential: TypeConstructorDescription {
+ case inputPasskeyCredentialFirebasePNV(pnvToken: String)
case inputPasskeyCredentialPublicKey(id: String, rawId: String, response: Api.InputPasskeyResponse)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
+ case .inputPasskeyCredentialFirebasePNV(let pnvToken):
+ if boxed {
+ buffer.appendInt32(1528613672)
+ }
+ serializeString(pnvToken, buffer: buffer, boxed: false)
+ break
case .inputPasskeyCredentialPublicKey(let id, let rawId, let response):
if boxed {
buffer.appendInt32(1009235855)
@@ -887,11 +884,20 @@ public extension Api {
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
+ case .inputPasskeyCredentialFirebasePNV(let pnvToken):
+ return ("inputPasskeyCredentialFirebasePNV", [("pnvToken", pnvToken as Any)])
case .inputPasskeyCredentialPublicKey(let id, let rawId, let response):
return ("inputPasskeyCredentialPublicKey", [("id", id as Any), ("rawId", rawId as Any), ("response", response as Any)])
}
}
+ public static func parse_inputPasskeyCredentialFirebasePNV(_ reader: BufferReader) -> InputPasskeyCredential? {
+ var _1: String?
+ _1 = parseString(reader)
+ let _c1 = _1 != nil
+ if !_c1 { return nil }
+ return Api.InputPasskeyCredential.inputPasskeyCredentialFirebasePNV(pnvToken: _1!)
+ }
public static func parse_inputPasskeyCredentialPublicKey(_ reader: BufferReader) -> InputPasskeyCredential? {
var _1: String?
_1 = parseString(reader)
@@ -904,12 +910,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.InputPasskeyCredential.inputPasskeyCredentialPublicKey(id: _1!, rawId: _2!, response: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.InputPasskeyCredential.inputPasskeyCredentialPublicKey(id: _1!, rawId: _2!, response: _3!)
}
}
@@ -964,12 +968,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.InputPasskeyResponse.inputPasskeyResponseLogin(clientData: _1!, authenticatorData: _2!, signature: _3!, userHandle: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.InputPasskeyResponse.inputPasskeyResponseLogin(clientData: _1!, authenticatorData: _2!, signature: _3!, userHandle: _4!)
}
public static func parse_inputPasskeyResponseRegister(_ reader: BufferReader) -> InputPasskeyResponse? {
var _1: Api.DataJSON?
@@ -980,122 +983,9 @@ public extension Api {
_2 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputPasskeyResponse.inputPasskeyResponseRegister(clientData: _1!, attestationData: _2!)
- }
- else {
- return nil
- }
- }
-
- }
-}
-public extension Api {
- enum InputPaymentCredentials: TypeConstructorDescription {
- case inputPaymentCredentials(flags: Int32, data: Api.DataJSON)
- case inputPaymentCredentialsApplePay(paymentData: Api.DataJSON)
- case inputPaymentCredentialsGooglePay(paymentToken: Api.DataJSON)
- case inputPaymentCredentialsSaved(id: String, tmpPassword: Buffer)
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .inputPaymentCredentials(let flags, let data):
- if boxed {
- buffer.appendInt32(873977640)
- }
- serializeInt32(flags, buffer: buffer, boxed: false)
- data.serialize(buffer, true)
- break
- case .inputPaymentCredentialsApplePay(let paymentData):
- if boxed {
- buffer.appendInt32(178373535)
- }
- paymentData.serialize(buffer, true)
- break
- case .inputPaymentCredentialsGooglePay(let paymentToken):
- if boxed {
- buffer.appendInt32(-1966921727)
- }
- paymentToken.serialize(buffer, true)
- break
- case .inputPaymentCredentialsSaved(let id, let tmpPassword):
- if boxed {
- buffer.appendInt32(-1056001329)
- }
- serializeString(id, buffer: buffer, boxed: false)
- serializeBytes(tmpPassword, buffer: buffer, boxed: false)
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .inputPaymentCredentials(let flags, let data):
- return ("inputPaymentCredentials", [("flags", flags as Any), ("data", data as Any)])
- case .inputPaymentCredentialsApplePay(let paymentData):
- return ("inputPaymentCredentialsApplePay", [("paymentData", paymentData as Any)])
- case .inputPaymentCredentialsGooglePay(let paymentToken):
- return ("inputPaymentCredentialsGooglePay", [("paymentToken", paymentToken as Any)])
- case .inputPaymentCredentialsSaved(let id, let tmpPassword):
- return ("inputPaymentCredentialsSaved", [("id", id as Any), ("tmpPassword", tmpPassword as Any)])
- }
- }
-
- public static func parse_inputPaymentCredentials(_ reader: BufferReader) -> InputPaymentCredentials? {
- var _1: Int32?
- _1 = reader.readInt32()
- var _2: Api.DataJSON?
- if let signature = reader.readInt32() {
- _2 = Api.parse(reader, signature: signature) as? Api.DataJSON
- }
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputPaymentCredentials.inputPaymentCredentials(flags: _1!, data: _2!)
- }
- else {
- return nil
- }
- }
- public static func parse_inputPaymentCredentialsApplePay(_ reader: BufferReader) -> InputPaymentCredentials? {
- var _1: Api.DataJSON?
- if let signature = reader.readInt32() {
- _1 = Api.parse(reader, signature: signature) as? Api.DataJSON
- }
- let _c1 = _1 != nil
- if _c1 {
- return Api.InputPaymentCredentials.inputPaymentCredentialsApplePay(paymentData: _1!)
- }
- else {
- return nil
- }
- }
- public static func parse_inputPaymentCredentialsGooglePay(_ reader: BufferReader) -> InputPaymentCredentials? {
- var _1: Api.DataJSON?
- if let signature = reader.readInt32() {
- _1 = Api.parse(reader, signature: signature) as? Api.DataJSON
- }
- let _c1 = _1 != nil
- if _c1 {
- return Api.InputPaymentCredentials.inputPaymentCredentialsGooglePay(paymentToken: _1!)
- }
- else {
- return nil
- }
- }
- public static func parse_inputPaymentCredentialsSaved(_ reader: BufferReader) -> InputPaymentCredentials? {
- var _1: String?
- _1 = parseString(reader)
- var _2: Buffer?
- _2 = parseBytes(reader)
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputPaymentCredentials.inputPaymentCredentialsSaved(id: _1!, tmpPassword: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputPasskeyResponse.inputPasskeyResponseRegister(clientData: _1!, attestationData: _2!)
}
}
diff --git a/submodules/TelegramApi/Sources/Api12.swift b/submodules/TelegramApi/Sources/Api12.swift
index ae88c149..42fc616a 100644
--- a/submodules/TelegramApi/Sources/Api12.swift
+++ b/submodules/TelegramApi/Sources/Api12.swift
@@ -1,3 +1,99 @@
+public extension Api {
+ enum InputPaymentCredentials: TypeConstructorDescription {
+ case inputPaymentCredentials(flags: Int32, data: Api.DataJSON)
+ case inputPaymentCredentialsApplePay(paymentData: Api.DataJSON)
+ case inputPaymentCredentialsGooglePay(paymentToken: Api.DataJSON)
+ case inputPaymentCredentialsSaved(id: String, tmpPassword: Buffer)
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .inputPaymentCredentials(let flags, let data):
+ if boxed {
+ buffer.appendInt32(873977640)
+ }
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ data.serialize(buffer, true)
+ break
+ case .inputPaymentCredentialsApplePay(let paymentData):
+ if boxed {
+ buffer.appendInt32(178373535)
+ }
+ paymentData.serialize(buffer, true)
+ break
+ case .inputPaymentCredentialsGooglePay(let paymentToken):
+ if boxed {
+ buffer.appendInt32(-1966921727)
+ }
+ paymentToken.serialize(buffer, true)
+ break
+ case .inputPaymentCredentialsSaved(let id, let tmpPassword):
+ if boxed {
+ buffer.appendInt32(-1056001329)
+ }
+ serializeString(id, buffer: buffer, boxed: false)
+ serializeBytes(tmpPassword, buffer: buffer, boxed: false)
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .inputPaymentCredentials(let flags, let data):
+ return ("inputPaymentCredentials", [("flags", flags as Any), ("data", data as Any)])
+ case .inputPaymentCredentialsApplePay(let paymentData):
+ return ("inputPaymentCredentialsApplePay", [("paymentData", paymentData as Any)])
+ case .inputPaymentCredentialsGooglePay(let paymentToken):
+ return ("inputPaymentCredentialsGooglePay", [("paymentToken", paymentToken as Any)])
+ case .inputPaymentCredentialsSaved(let id, let tmpPassword):
+ return ("inputPaymentCredentialsSaved", [("id", id as Any), ("tmpPassword", tmpPassword as Any)])
+ }
+ }
+
+ public static func parse_inputPaymentCredentials(_ reader: BufferReader) -> InputPaymentCredentials? {
+ var _1: Int32?
+ _1 = reader.readInt32()
+ var _2: Api.DataJSON?
+ if let signature = reader.readInt32() {
+ _2 = Api.parse(reader, signature: signature) as? Api.DataJSON
+ }
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputPaymentCredentials.inputPaymentCredentials(flags: _1!, data: _2!)
+ }
+ public static func parse_inputPaymentCredentialsApplePay(_ reader: BufferReader) -> InputPaymentCredentials? {
+ var _1: Api.DataJSON?
+ if let signature = reader.readInt32() {
+ _1 = Api.parse(reader, signature: signature) as? Api.DataJSON
+ }
+ let _c1 = _1 != nil
+ if !_c1 { return nil }
+ return Api.InputPaymentCredentials.inputPaymentCredentialsApplePay(paymentData: _1!)
+ }
+ public static func parse_inputPaymentCredentialsGooglePay(_ reader: BufferReader) -> InputPaymentCredentials? {
+ var _1: Api.DataJSON?
+ if let signature = reader.readInt32() {
+ _1 = Api.parse(reader, signature: signature) as? Api.DataJSON
+ }
+ let _c1 = _1 != nil
+ if !_c1 { return nil }
+ return Api.InputPaymentCredentials.inputPaymentCredentialsGooglePay(paymentToken: _1!)
+ }
+ public static func parse_inputPaymentCredentialsSaved(_ reader: BufferReader) -> InputPaymentCredentials? {
+ var _1: String?
+ _1 = parseString(reader)
+ var _2: Buffer?
+ _2 = parseBytes(reader)
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputPaymentCredentials.inputPaymentCredentialsSaved(id: _1!, tmpPassword: _2!)
+ }
+
+ }
+}
public extension Api {
indirect enum InputPeer: TypeConstructorDescription {
case inputPeerChannel(channelId: Int64, accessHash: Int64)
@@ -87,12 +183,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputPeer.inputPeerChannel(channelId: _1!, accessHash: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputPeer.inputPeerChannel(channelId: _1!, accessHash: _2!)
}
public static func parse_inputPeerChannelFromMessage(_ reader: BufferReader) -> InputPeer? {
var _1: Api.InputPeer?
@@ -106,23 +199,17 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.InputPeer.inputPeerChannelFromMessage(peer: _1!, msgId: _2!, channelId: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.InputPeer.inputPeerChannelFromMessage(peer: _1!, msgId: _2!, channelId: _3!)
}
public static func parse_inputPeerChat(_ reader: BufferReader) -> InputPeer? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
- if _c1 {
- return Api.InputPeer.inputPeerChat(chatId: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputPeer.inputPeerChat(chatId: _1!)
}
public static func parse_inputPeerEmpty(_ reader: BufferReader) -> InputPeer? {
return Api.InputPeer.inputPeerEmpty
@@ -137,12 +224,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputPeer.inputPeerUser(userId: _1!, accessHash: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputPeer.inputPeerUser(userId: _1!, accessHash: _2!)
}
public static func parse_inputPeerUserFromMessage(_ reader: BufferReader) -> InputPeer? {
var _1: Api.InputPeer?
@@ -156,12 +240,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.InputPeer.inputPeerUserFromMessage(peer: _1!, msgId: _2!, userId: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.InputPeer.inputPeerUserFromMessage(peer: _1!, msgId: _2!, userId: _3!)
}
}
@@ -232,12 +314,15 @@ public extension Api {
let _c6 = (Int(_1!) & Int(1 << 6) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 7) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 8) == 0) || _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.InputPeerNotifySettings.inputPeerNotifySettings(flags: _1!, showPreviews: _2, silent: _3, muteUntil: _4, sound: _5, storiesMuted: _6, storiesHideSender: _7, storiesSound: _8)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.InputPeerNotifySettings.inputPeerNotifySettings(flags: _1!, showPreviews: _2, silent: _3, muteUntil: _4, sound: _5, storiesMuted: _6, storiesHideSender: _7, storiesSound: _8)
}
}
@@ -272,12 +357,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputPhoneCall.inputPhoneCall(id: _1!, accessHash: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputPhoneCall.inputPhoneCall(id: _1!, accessHash: _2!)
}
}
@@ -325,12 +407,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.InputPhoto.inputPhoto(id: _1!, accessHash: _2!, fileReference: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.InputPhoto.inputPhoto(id: _1!, accessHash: _2!, fileReference: _3!)
}
public static func parse_inputPhotoEmpty(_ reader: BufferReader) -> InputPhoto? {
return Api.InputPhoto.inputPhotoEmpty
@@ -671,12 +751,8 @@ public extension Api {
_1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.InputPrivacyRule.inputPrivacyValueAllowChatParticipants(chats: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputPrivacyRule.inputPrivacyValueAllowChatParticipants(chats: _1!)
}
public static func parse_inputPrivacyValueAllowCloseFriends(_ reader: BufferReader) -> InputPrivacyRule? {
return Api.InputPrivacyRule.inputPrivacyValueAllowCloseFriends
@@ -693,12 +769,8 @@ public extension Api {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputUser.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.InputPrivacyRule.inputPrivacyValueAllowUsers(users: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputPrivacyRule.inputPrivacyValueAllowUsers(users: _1!)
}
public static func parse_inputPrivacyValueDisallowAll(_ reader: BufferReader) -> InputPrivacyRule? {
return Api.InputPrivacyRule.inputPrivacyValueDisallowAll
@@ -712,12 +784,8 @@ public extension Api {
_1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.InputPrivacyRule.inputPrivacyValueDisallowChatParticipants(chats: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputPrivacyRule.inputPrivacyValueDisallowChatParticipants(chats: _1!)
}
public static func parse_inputPrivacyValueDisallowContacts(_ reader: BufferReader) -> InputPrivacyRule? {
return Api.InputPrivacyRule.inputPrivacyValueDisallowContacts
@@ -728,12 +796,8 @@ public extension Api {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputUser.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.InputPrivacyRule.inputPrivacyValueDisallowUsers(users: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputPrivacyRule.inputPrivacyValueDisallowUsers(users: _1!)
}
}
diff --git a/submodules/TelegramApi/Sources/Api13.swift b/submodules/TelegramApi/Sources/Api13.swift
index 43504702..fa5243cf 100644
--- a/submodules/TelegramApi/Sources/Api13.swift
+++ b/submodules/TelegramApi/Sources/Api13.swift
@@ -33,23 +33,15 @@ public extension Api {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.InputQuickReplyShortcut.inputQuickReplyShortcut(shortcut: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputQuickReplyShortcut.inputQuickReplyShortcut(shortcut: _1!)
}
public static func parse_inputQuickReplyShortcutId(_ reader: BufferReader) -> InputQuickReplyShortcut? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.InputQuickReplyShortcut.inputQuickReplyShortcutId(shortcutId: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputQuickReplyShortcut.inputQuickReplyShortcutId(shortcutId: _1!)
}
}
@@ -141,12 +133,16 @@ public extension Api {
let _c7 = (Int(_1!) & Int(1 << 4) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 5) == 0) || _8 != nil
let _c9 = (Int(_1!) & Int(1 << 6) == 0) || _9 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
- return Api.InputReplyTo.inputReplyToMessage(flags: _1!, replyToMsgId: _2!, topMsgId: _3, replyToPeerId: _4, quoteText: _5, quoteEntities: _6, quoteOffset: _7, monoforumPeerId: _8, todoItemId: _9)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ return Api.InputReplyTo.inputReplyToMessage(flags: _1!, replyToMsgId: _2!, topMsgId: _3, replyToPeerId: _4, quoteText: _5, quoteEntities: _6, quoteOffset: _7, monoforumPeerId: _8, todoItemId: _9)
}
public static func parse_inputReplyToMonoForum(_ reader: BufferReader) -> InputReplyTo? {
var _1: Api.InputPeer?
@@ -154,12 +150,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
}
let _c1 = _1 != nil
- if _c1 {
- return Api.InputReplyTo.inputReplyToMonoForum(monoforumPeerId: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputReplyTo.inputReplyToMonoForum(monoforumPeerId: _1!)
}
public static func parse_inputReplyToStory(_ reader: BufferReader) -> InputReplyTo? {
var _1: Api.InputPeer?
@@ -170,12 +162,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputReplyTo.inputReplyToStory(peer: _1!, storyId: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputReplyTo.inputReplyToStory(peer: _1!, storyId: _2!)
}
}
@@ -230,34 +219,23 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputSavedStarGift.inputSavedStarGiftChat(peer: _1!, savedId: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputSavedStarGift.inputSavedStarGiftChat(peer: _1!, savedId: _2!)
}
public static func parse_inputSavedStarGiftSlug(_ reader: BufferReader) -> InputSavedStarGift? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.InputSavedStarGift.inputSavedStarGiftSlug(slug: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputSavedStarGift.inputSavedStarGiftSlug(slug: _1!)
}
public static func parse_inputSavedStarGiftUser(_ reader: BufferReader) -> InputSavedStarGift? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.InputSavedStarGift.inputSavedStarGiftUser(msgId: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputSavedStarGift.inputSavedStarGiftUser(msgId: _1!)
}
}
@@ -305,12 +283,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputSecureFile.inputSecureFile(id: _1!, accessHash: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputSecureFile.inputSecureFile(id: _1!, accessHash: _2!)
}
public static func parse_inputSecureFileUploaded(_ reader: BufferReader) -> InputSecureFile? {
var _1: Int64?
@@ -328,12 +303,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.InputSecureFile.inputSecureFileUploaded(id: _1!, parts: _2!, md5Checksum: _3!, fileHash: _4!, secret: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.InputSecureFile.inputSecureFileUploaded(id: _1!, parts: _2!, md5Checksum: _3!, fileHash: _4!, secret: _5!)
}
}
@@ -420,12 +395,16 @@ public extension Api {
let _c7 = (Int(_1!) & Int(1 << 6) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 4) == 0) || _8 != nil
let _c9 = (Int(_1!) & Int(1 << 5) == 0) || _9 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
- return Api.InputSecureValue.inputSecureValue(flags: _1!, type: _2!, data: _3, frontSide: _4, reverseSide: _5, selfie: _6, translation: _7, files: _8, plainData: _9)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ return Api.InputSecureValue.inputSecureValue(flags: _1!, type: _2!, data: _3, frontSide: _4, reverseSide: _5, selfie: _6, translation: _7, files: _8, plainData: _9)
}
}
@@ -480,12 +459,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.InputSingleMedia.inputSingleMedia(flags: _1!, media: _2!, randomId: _3!, message: _4!, entities: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.InputSingleMedia.inputSingleMedia(flags: _1!, media: _2!, randomId: _3!, message: _4!, entities: _5)
}
}
@@ -525,23 +504,15 @@ public extension Api {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
- if _c1 {
- return Api.InputStarGiftAuction.inputStarGiftAuction(giftId: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputStarGiftAuction.inputStarGiftAuction(giftId: _1!)
}
public static func parse_inputStarGiftAuctionSlug(_ reader: BufferReader) -> InputStarGiftAuction? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.InputStarGiftAuction.inputStarGiftAuctionSlug(slug: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputStarGiftAuction.inputStarGiftAuctionSlug(slug: _1!)
}
}
@@ -576,12 +547,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputStarsTransaction.inputStarsTransaction(flags: _1!, id: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputStarsTransaction.inputStarsTransaction(flags: _1!, id: _2!)
}
}
@@ -718,12 +686,8 @@ public extension Api {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.InputStickerSet.inputStickerSetDice(emoticon: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputStickerSet.inputStickerSetDice(emoticon: _1!)
}
public static func parse_inputStickerSetEmojiChannelDefaultStatuses(_ reader: BufferReader) -> InputStickerSet? {
return Api.InputStickerSet.inputStickerSetEmojiChannelDefaultStatuses
@@ -747,12 +711,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputStickerSet.inputStickerSetID(id: _1!, accessHash: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputStickerSet.inputStickerSetID(id: _1!, accessHash: _2!)
}
public static func parse_inputStickerSetPremiumGifts(_ reader: BufferReader) -> InputStickerSet? {
return Api.InputStickerSet.inputStickerSetPremiumGifts
@@ -761,12 +722,8 @@ public extension Api {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.InputStickerSet.inputStickerSetShortName(shortName: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputStickerSet.inputStickerSetShortName(shortName: _1!)
}
public static func parse_inputStickerSetTonGifts(_ reader: BufferReader) -> InputStickerSet? {
return Api.InputStickerSet.inputStickerSetTonGifts
@@ -820,12 +777,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.InputStickerSetItem.inputStickerSetItem(flags: _1!, document: _2!, emoji: _3!, maskCoords: _4, keywords: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.InputStickerSetItem.inputStickerSetItem(flags: _1!, document: _2!, emoji: _3!, maskCoords: _4, keywords: _5)
}
}
@@ -867,12 +824,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.InputDocument
}
let _c1 = _1 != nil
- if _c1 {
- return Api.InputStickeredMedia.inputStickeredMediaDocument(id: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputStickeredMedia.inputStickeredMediaDocument(id: _1!)
}
public static func parse_inputStickeredMediaPhoto(_ reader: BufferReader) -> InputStickeredMedia? {
var _1: Api.InputPhoto?
@@ -880,12 +833,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.InputPhoto
}
let _c1 = _1 != nil
- if _c1 {
- return Api.InputStickeredMedia.inputStickeredMediaPhoto(id: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputStickeredMedia.inputStickeredMediaPhoto(id: _1!)
}
}
@@ -1047,12 +996,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.InputStorePaymentPurpose.inputStorePaymentAuthCode(flags: _1!, phoneNumber: _2!, phoneCodeHash: _3!, currency: _4!, amount: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.InputStorePaymentPurpose.inputStorePaymentAuthCode(flags: _1!, phoneNumber: _2!, phoneCodeHash: _3!, currency: _4!, amount: _5!)
}
public static func parse_inputStorePaymentGiftPremium(_ reader: BufferReader) -> InputStorePaymentPurpose? {
var _1: Api.InputUser?
@@ -1066,12 +1015,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.InputStorePaymentPurpose.inputStorePaymentGiftPremium(userId: _1!, currency: _2!, amount: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.InputStorePaymentPurpose.inputStorePaymentGiftPremium(userId: _1!, currency: _2!, amount: _3!)
}
public static func parse_inputStorePaymentPremiumGiftCode(_ reader: BufferReader) -> InputStorePaymentPurpose? {
var _1: Int32?
@@ -1098,12 +1045,13 @@ public extension Api {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.InputStorePaymentPurpose.inputStorePaymentPremiumGiftCode(flags: _1!, users: _2!, boostPeer: _3, currency: _4!, amount: _5!, message: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.InputStorePaymentPurpose.inputStorePaymentPremiumGiftCode(flags: _1!, users: _2!, boostPeer: _3, currency: _4!, amount: _5!, message: _6)
}
public static func parse_inputStorePaymentPremiumGiveaway(_ reader: BufferReader) -> InputStorePaymentPurpose? {
var _1: Int32?
@@ -1139,23 +1087,23 @@ public extension Api {
let _c7 = _7 != nil
let _c8 = _8 != nil
let _c9 = _9 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
- return Api.InputStorePaymentPurpose.inputStorePaymentPremiumGiveaway(flags: _1!, boostPeer: _2!, additionalPeers: _3, countriesIso2: _4, prizeDescription: _5, randomId: _6!, untilDate: _7!, currency: _8!, amount: _9!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ return Api.InputStorePaymentPurpose.inputStorePaymentPremiumGiveaway(flags: _1!, boostPeer: _2!, additionalPeers: _3, countriesIso2: _4, prizeDescription: _5, randomId: _6!, untilDate: _7!, currency: _8!, amount: _9!)
}
public static func parse_inputStorePaymentPremiumSubscription(_ reader: BufferReader) -> InputStorePaymentPurpose? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.InputStorePaymentPurpose.inputStorePaymentPremiumSubscription(flags: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputStorePaymentPurpose.inputStorePaymentPremiumSubscription(flags: _1!)
}
public static func parse_inputStorePaymentStarsGift(_ reader: BufferReader) -> InputStorePaymentPurpose? {
var _1: Api.InputUser?
@@ -1172,12 +1120,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.InputStorePaymentPurpose.inputStorePaymentStarsGift(userId: _1!, stars: _2!, currency: _3!, amount: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.InputStorePaymentPurpose.inputStorePaymentStarsGift(userId: _1!, stars: _2!, currency: _3!, amount: _4!)
}
public static func parse_inputStorePaymentStarsGiveaway(_ reader: BufferReader) -> InputStorePaymentPurpose? {
var _1: Int32?
@@ -1219,12 +1166,18 @@ public extension Api {
let _c9 = _9 != nil
let _c10 = _10 != nil
let _c11 = _11 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 {
- return Api.InputStorePaymentPurpose.inputStorePaymentStarsGiveaway(flags: _1!, stars: _2!, boostPeer: _3!, additionalPeers: _4, countriesIso2: _5, prizeDescription: _6, randomId: _7!, untilDate: _8!, currency: _9!, amount: _10!, users: _11!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ return Api.InputStorePaymentPurpose.inputStorePaymentStarsGiveaway(flags: _1!, stars: _2!, boostPeer: _3!, additionalPeers: _4, countriesIso2: _5, prizeDescription: _6, randomId: _7!, untilDate: _8!, currency: _9!, amount: _10!, users: _11!)
}
public static func parse_inputStorePaymentStarsTopup(_ reader: BufferReader) -> InputStorePaymentPurpose? {
var _1: Int32?
@@ -1244,12 +1197,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.InputStorePaymentPurpose.inputStorePaymentStarsTopup(flags: _1!, stars: _2!, currency: _3!, amount: _4!, spendPurposePeer: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.InputStorePaymentPurpose.inputStorePaymentStarsTopup(flags: _1!, stars: _2!, currency: _3!, amount: _4!, spendPurposePeer: _5)
}
}
diff --git a/submodules/TelegramApi/Sources/Api14.swift b/submodules/TelegramApi/Sources/Api14.swift
index 5f436a06..4b917cf6 100644
--- a/submodules/TelegramApi/Sources/Api14.swift
+++ b/submodules/TelegramApi/Sources/Api14.swift
@@ -37,23 +37,16 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputTheme.inputTheme(id: _1!, accessHash: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputTheme.inputTheme(id: _1!, accessHash: _2!)
}
public static func parse_inputThemeSlug(_ reader: BufferReader) -> InputTheme? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.InputTheme.inputThemeSlug(slug: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputTheme.inputThemeSlug(slug: _1!)
}
}
@@ -120,12 +113,14 @@ public extension Api {
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 1) == 0) || _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.InputThemeSettings.inputThemeSettings(flags: _1!, baseTheme: _2!, accentColor: _3!, outboxAccentColor: _4, messageColors: _5, wallpaper: _6, wallpaperSettings: _7)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.InputThemeSettings.inputThemeSettings(flags: _1!, baseTheme: _2!, accentColor: _3!, outboxAccentColor: _4, messageColors: _5, wallpaper: _6, wallpaperSettings: _7)
}
}
@@ -189,12 +184,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputUser.inputUser(userId: _1!, accessHash: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputUser.inputUser(userId: _1!, accessHash: _2!)
}
public static func parse_inputUserEmpty(_ reader: BufferReader) -> InputUser? {
return Api.InputUser.inputUserEmpty
@@ -211,12 +203,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.InputUser.inputUserFromMessage(peer: _1!, msgId: _2!, userId: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.InputUser.inputUserFromMessage(peer: _1!, msgId: _2!, userId: _3!)
}
public static func parse_inputUserSelf(_ reader: BufferReader) -> InputUser? {
return Api.InputUser.inputUserSelf
@@ -272,34 +262,23 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputWallPaper.inputWallPaper(id: _1!, accessHash: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputWallPaper.inputWallPaper(id: _1!, accessHash: _2!)
}
public static func parse_inputWallPaperNoFile(_ reader: BufferReader) -> InputWallPaper? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
- if _c1 {
- return Api.InputWallPaper.inputWallPaperNoFile(id: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputWallPaper.inputWallPaperNoFile(id: _1!)
}
public static func parse_inputWallPaperSlug(_ reader: BufferReader) -> InputWallPaper? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.InputWallPaper.inputWallPaperSlug(slug: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputWallPaper.inputWallPaperSlug(slug: _1!)
}
}
@@ -348,12 +327,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.InputWebDocument.inputWebDocument(url: _1!, size: _2!, mimeType: _3!, attributes: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.InputWebDocument.inputWebDocument(url: _1!, size: _2!, mimeType: _3!, attributes: _4!)
}
}
@@ -422,12 +400,11 @@ public extension Api {
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.InputWebFileLocation.inputWebFileAudioAlbumThumbLocation(flags: _1!, document: _2, title: _3, performer: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.InputWebFileLocation.inputWebFileAudioAlbumThumbLocation(flags: _1!, document: _2, title: _3, performer: _4)
}
public static func parse_inputWebFileGeoPointLocation(_ reader: BufferReader) -> InputWebFileLocation? {
var _1: Api.InputGeoPoint?
@@ -450,12 +427,13 @@ public extension Api {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.InputWebFileLocation.inputWebFileGeoPointLocation(geoPoint: _1!, accessHash: _2!, w: _3!, h: _4!, zoom: _5!, scale: _6!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.InputWebFileLocation.inputWebFileGeoPointLocation(geoPoint: _1!, accessHash: _2!, w: _3!, h: _4!, zoom: _5!, scale: _6!)
}
public static func parse_inputWebFileLocation(_ reader: BufferReader) -> InputWebFileLocation? {
var _1: String?
@@ -464,12 +442,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputWebFileLocation.inputWebFileLocation(url: _1!, accessHash: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputWebFileLocation.inputWebFileLocation(url: _1!, accessHash: _2!)
}
}
@@ -536,12 +511,14 @@ public extension Api {
let _c5 = (Int(_1!) & Int(1 << 8) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 10) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 11) == 0) || _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.Invoice.invoice(flags: _1!, currency: _2!, prices: _3!, maxTipAmount: _4, suggestedTipAmounts: _5, termsUrl: _6, subscriptionPeriod: _7)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.Invoice.invoice(flags: _1!, currency: _2!, prices: _3!, maxTipAmount: _4, suggestedTipAmounts: _5, termsUrl: _6, subscriptionPeriod: _7)
}
}
@@ -578,12 +555,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.JSONObjectValue.jsonObjectValue(key: _1!, value: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.JSONObjectValue.jsonObjectValue(key: _1!, value: _2!)
}
}
@@ -669,12 +643,8 @@ public extension Api {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.JSONValue.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.JSONValue.jsonArray(value: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.JSONValue.jsonArray(value: _1!)
}
public static func parse_jsonBool(_ reader: BufferReader) -> JSONValue? {
var _1: Api.Bool?
@@ -682,12 +652,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.Bool
}
let _c1 = _1 != nil
- if _c1 {
- return Api.JSONValue.jsonBool(value: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.JSONValue.jsonBool(value: _1!)
}
public static func parse_jsonNull(_ reader: BufferReader) -> JSONValue? {
return Api.JSONValue.jsonNull
@@ -696,12 +662,8 @@ public extension Api {
var _1: Double?
_1 = reader.readDouble()
let _c1 = _1 != nil
- if _c1 {
- return Api.JSONValue.jsonNumber(value: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.JSONValue.jsonNumber(value: _1!)
}
public static func parse_jsonObject(_ reader: BufferReader) -> JSONValue? {
var _1: [Api.JSONObjectValue]?
@@ -709,23 +671,15 @@ public extension Api {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.JSONObjectValue.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.JSONValue.jsonObject(value: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.JSONValue.jsonObject(value: _1!)
}
public static func parse_jsonString(_ reader: BufferReader) -> JSONValue? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.JSONValue.jsonString(value: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.JSONValue.jsonString(value: _1!)
}
}
@@ -955,12 +909,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.KeyboardButton.inputKeyboardButtonRequestPeer(flags: _1!, text: _2!, buttonId: _3!, peerType: _4!, maxQuantity: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.KeyboardButton.inputKeyboardButtonRequestPeer(flags: _1!, text: _2!, buttonId: _3!, peerType: _4!, maxQuantity: _5!)
}
public static func parse_inputKeyboardButtonUrlAuth(_ reader: BufferReader) -> KeyboardButton? {
var _1: Int32?
@@ -980,12 +934,12 @@ public extension Api {
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.KeyboardButton.inputKeyboardButtonUrlAuth(flags: _1!, text: _2!, fwdText: _3, url: _4!, bot: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.KeyboardButton.inputKeyboardButtonUrlAuth(flags: _1!, text: _2!, fwdText: _3, url: _4!, bot: _5!)
}
public static func parse_inputKeyboardButtonUserProfile(_ reader: BufferReader) -> KeyboardButton? {
var _1: String?
@@ -996,34 +950,23 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.KeyboardButton.inputKeyboardButtonUserProfile(text: _1!, userId: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.KeyboardButton.inputKeyboardButtonUserProfile(text: _1!, userId: _2!)
}
public static func parse_keyboardButton(_ reader: BufferReader) -> KeyboardButton? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.KeyboardButton.keyboardButton(text: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.KeyboardButton.keyboardButton(text: _1!)
}
public static func parse_keyboardButtonBuy(_ reader: BufferReader) -> KeyboardButton? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.KeyboardButton.keyboardButtonBuy(text: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.KeyboardButton.keyboardButtonBuy(text: _1!)
}
public static func parse_keyboardButtonCallback(_ reader: BufferReader) -> KeyboardButton? {
var _1: Int32?
@@ -1035,12 +978,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.KeyboardButton.keyboardButtonCallback(flags: _1!, text: _2!, data: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.KeyboardButton.keyboardButtonCallback(flags: _1!, text: _2!, data: _3!)
}
public static func parse_keyboardButtonCopy(_ reader: BufferReader) -> KeyboardButton? {
var _1: String?
@@ -1049,34 +990,23 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.KeyboardButton.keyboardButtonCopy(text: _1!, copyText: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.KeyboardButton.keyboardButtonCopy(text: _1!, copyText: _2!)
}
public static func parse_keyboardButtonGame(_ reader: BufferReader) -> KeyboardButton? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.KeyboardButton.keyboardButtonGame(text: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.KeyboardButton.keyboardButtonGame(text: _1!)
}
public static func parse_keyboardButtonRequestGeoLocation(_ reader: BufferReader) -> KeyboardButton? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.KeyboardButton.keyboardButtonRequestGeoLocation(text: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.KeyboardButton.keyboardButtonRequestGeoLocation(text: _1!)
}
public static func parse_keyboardButtonRequestPeer(_ reader: BufferReader) -> KeyboardButton? {
var _1: String?
@@ -1093,23 +1023,18 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.KeyboardButton.keyboardButtonRequestPeer(text: _1!, buttonId: _2!, peerType: _3!, maxQuantity: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.KeyboardButton.keyboardButtonRequestPeer(text: _1!, buttonId: _2!, peerType: _3!, maxQuantity: _4!)
}
public static func parse_keyboardButtonRequestPhone(_ reader: BufferReader) -> KeyboardButton? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.KeyboardButton.keyboardButtonRequestPhone(text: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.KeyboardButton.keyboardButtonRequestPhone(text: _1!)
}
public static func parse_keyboardButtonRequestPoll(_ reader: BufferReader) -> KeyboardButton? {
var _1: Int32?
@@ -1123,12 +1048,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.KeyboardButton.keyboardButtonRequestPoll(flags: _1!, quiz: _2, text: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.KeyboardButton.keyboardButtonRequestPoll(flags: _1!, quiz: _2, text: _3!)
}
public static func parse_keyboardButtonSimpleWebView(_ reader: BufferReader) -> KeyboardButton? {
var _1: String?
@@ -1137,12 +1060,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.KeyboardButton.keyboardButtonSimpleWebView(text: _1!, url: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.KeyboardButton.keyboardButtonSimpleWebView(text: _1!, url: _2!)
}
public static func parse_keyboardButtonSwitchInline(_ reader: BufferReader) -> KeyboardButton? {
var _1: Int32?
@@ -1159,12 +1079,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.KeyboardButton.keyboardButtonSwitchInline(flags: _1!, text: _2!, query: _3!, peerTypes: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.KeyboardButton.keyboardButtonSwitchInline(flags: _1!, text: _2!, query: _3!, peerTypes: _4)
}
public static func parse_keyboardButtonUrl(_ reader: BufferReader) -> KeyboardButton? {
var _1: String?
@@ -1173,12 +1092,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.KeyboardButton.keyboardButtonUrl(text: _1!, url: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.KeyboardButton.keyboardButtonUrl(text: _1!, url: _2!)
}
public static func parse_keyboardButtonUrlAuth(_ reader: BufferReader) -> KeyboardButton? {
var _1: Int32?
@@ -1196,12 +1112,12 @@ public extension Api {
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.KeyboardButton.keyboardButtonUrlAuth(flags: _1!, text: _2!, fwdText: _3, url: _4!, buttonId: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.KeyboardButton.keyboardButtonUrlAuth(flags: _1!, text: _2!, fwdText: _3, url: _4!, buttonId: _5!)
}
public static func parse_keyboardButtonUserProfile(_ reader: BufferReader) -> KeyboardButton? {
var _1: String?
@@ -1210,12 +1126,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.KeyboardButton.keyboardButtonUserProfile(text: _1!, userId: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.KeyboardButton.keyboardButtonUserProfile(text: _1!, userId: _2!)
}
public static func parse_keyboardButtonWebView(_ reader: BufferReader) -> KeyboardButton? {
var _1: String?
@@ -1224,12 +1137,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.KeyboardButton.keyboardButtonWebView(text: _1!, url: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.KeyboardButton.keyboardButtonWebView(text: _1!, url: _2!)
}
}
diff --git a/submodules/TelegramApi/Sources/Api15.swift b/submodules/TelegramApi/Sources/Api15.swift
index 4bb0329f..6b606c80 100644
--- a/submodules/TelegramApi/Sources/Api15.swift
+++ b/submodules/TelegramApi/Sources/Api15.swift
@@ -30,12 +30,8 @@ public extension Api {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.KeyboardButton.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.KeyboardButtonRow.keyboardButtonRow(buttons: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.KeyboardButtonRow.keyboardButtonRow(buttons: _1!)
}
}
@@ -70,12 +66,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.LabeledPrice.labeledPrice(label: _1!, amount: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.LabeledPrice.labeledPrice(label: _1!, amount: _2!)
}
}
@@ -124,12 +117,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.LangPackDifference.langPackDifference(langCode: _1!, fromVersion: _2!, version: _3!, strings: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.LangPackDifference.langPackDifference(langCode: _1!, fromVersion: _2!, version: _3!, strings: _4!)
}
}
@@ -192,12 +184,16 @@ public extension Api {
let _c7 = _7 != nil
let _c8 = _8 != nil
let _c9 = _9 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
- return Api.LangPackLanguage.langPackLanguage(flags: _1!, name: _2!, nativeName: _3!, langCode: _4!, baseLangCode: _5, pluralCode: _6!, stringsCount: _7!, translatedCount: _8!, translationsUrl: _9!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ return Api.LangPackLanguage.langPackLanguage(flags: _1!, name: _2!, nativeName: _3!, langCode: _4!, baseLangCode: _5, pluralCode: _6!, stringsCount: _7!, translatedCount: _8!, translationsUrl: _9!)
}
}
@@ -257,23 +253,16 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.LangPackString.langPackString(key: _1!, value: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.LangPackString.langPackString(key: _1!, value: _2!)
}
public static func parse_langPackStringDeleted(_ reader: BufferReader) -> LangPackString? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.LangPackString.langPackStringDeleted(key: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.LangPackString.langPackStringDeleted(key: _1!)
}
public static func parse_langPackStringPluralized(_ reader: BufferReader) -> LangPackString? {
var _1: Int32?
@@ -300,12 +289,15 @@ public extension Api {
let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 4) == 0) || _7 != nil
let _c8 = _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.LangPackString.langPackStringPluralized(flags: _1!, key: _2!, zeroValue: _3, oneValue: _4, twoValue: _5, fewValue: _6, manyValue: _7, otherValue: _8!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.LangPackString.langPackStringPluralized(flags: _1!, key: _2!, zeroValue: _3, oneValue: _4, twoValue: _5, fewValue: _6, manyValue: _7, otherValue: _8!)
}
}
@@ -348,12 +340,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.MaskCoords.maskCoords(n: _1!, x: _2!, y: _3!, zoom: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.MaskCoords.maskCoords(n: _1!, x: _2!, y: _3!, zoom: _4!)
}
}
@@ -488,12 +479,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.MediaArea.inputMediaAreaChannelPost(coordinates: _1!, channel: _2!, msgId: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.MediaArea.inputMediaAreaChannelPost(coordinates: _1!, channel: _2!, msgId: _3!)
}
public static func parse_inputMediaAreaVenue(_ reader: BufferReader) -> MediaArea? {
var _1: Api.MediaAreaCoordinates?
@@ -507,12 +496,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.MediaArea.inputMediaAreaVenue(coordinates: _1!, queryId: _2!, resultId: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.MediaArea.inputMediaAreaVenue(coordinates: _1!, queryId: _2!, resultId: _3!)
}
public static func parse_mediaAreaChannelPost(_ reader: BufferReader) -> MediaArea? {
var _1: Api.MediaAreaCoordinates?
@@ -526,12 +513,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.MediaArea.mediaAreaChannelPost(coordinates: _1!, channelId: _2!, msgId: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.MediaArea.mediaAreaChannelPost(coordinates: _1!, channelId: _2!, msgId: _3!)
}
public static func parse_mediaAreaGeoPoint(_ reader: BufferReader) -> MediaArea? {
var _1: Int32?
@@ -552,12 +537,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.MediaArea.mediaAreaGeoPoint(flags: _1!, coordinates: _2!, geo: _3!, address: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.MediaArea.mediaAreaGeoPoint(flags: _1!, coordinates: _2!, geo: _3!, address: _4)
}
public static func parse_mediaAreaStarGift(_ reader: BufferReader) -> MediaArea? {
var _1: Api.MediaAreaCoordinates?
@@ -568,12 +552,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MediaArea.mediaAreaStarGift(coordinates: _1!, slug: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MediaArea.mediaAreaStarGift(coordinates: _1!, slug: _2!)
}
public static func parse_mediaAreaSuggestedReaction(_ reader: BufferReader) -> MediaArea? {
var _1: Int32?
@@ -589,12 +570,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.MediaArea.mediaAreaSuggestedReaction(flags: _1!, coordinates: _2!, reaction: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.MediaArea.mediaAreaSuggestedReaction(flags: _1!, coordinates: _2!, reaction: _3!)
}
public static func parse_mediaAreaUrl(_ reader: BufferReader) -> MediaArea? {
var _1: Api.MediaAreaCoordinates?
@@ -605,12 +584,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MediaArea.mediaAreaUrl(coordinates: _1!, url: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MediaArea.mediaAreaUrl(coordinates: _1!, url: _2!)
}
public static func parse_mediaAreaVenue(_ reader: BufferReader) -> MediaArea? {
var _1: Api.MediaAreaCoordinates?
@@ -638,12 +614,14 @@ public extension Api {
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.MediaArea.mediaAreaVenue(coordinates: _1!, geo: _2!, title: _3!, address: _4!, provider: _5!, venueId: _6!, venueType: _7!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.MediaArea.mediaAreaVenue(coordinates: _1!, geo: _2!, title: _3!, address: _4!, provider: _5!, venueId: _6!, venueType: _7!)
}
public static func parse_mediaAreaWeather(_ reader: BufferReader) -> MediaArea? {
var _1: Api.MediaAreaCoordinates?
@@ -660,12 +638,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.MediaArea.mediaAreaWeather(coordinates: _1!, emoji: _2!, temperatureC: _3!, color: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.MediaArea.mediaAreaWeather(coordinates: _1!, emoji: _2!, temperatureC: _3!, color: _4!)
}
}
@@ -720,27 +697,29 @@ public extension Api {
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = (Int(_1!) & Int(1 << 0) == 0) || _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.MediaAreaCoordinates.mediaAreaCoordinates(flags: _1!, x: _2!, y: _3!, w: _4!, h: _5!, rotation: _6!, radius: _7)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.MediaAreaCoordinates.mediaAreaCoordinates(flags: _1!, x: _2!, y: _3!, w: _4!, h: _5!, rotation: _6!, radius: _7)
}
}
}
public extension Api {
indirect enum Message: TypeConstructorDescription {
- case message(flags: Int32, flags2: Int32, id: Int32, fromId: Api.Peer?, fromBoostsApplied: Int32?, peerId: Api.Peer, savedPeerId: Api.Peer?, fwdFrom: Api.MessageFwdHeader?, viaBotId: Int64?, viaBusinessBotId: Int64?, replyTo: Api.MessageReplyHeader?, date: Int32, message: String, media: Api.MessageMedia?, replyMarkup: Api.ReplyMarkup?, entities: [Api.MessageEntity]?, views: Int32?, forwards: Int32?, replies: Api.MessageReplies?, editDate: Int32?, postAuthor: String?, groupedId: Int64?, reactions: Api.MessageReactions?, restrictionReason: [Api.RestrictionReason]?, ttlPeriod: Int32?, quickReplyShortcutId: Int32?, effect: Int64?, factcheck: Api.FactCheck?, reportDeliveryUntilDate: Int32?, paidMessageStars: Int64?, suggestedPost: Api.SuggestedPost?, scheduleRepeatPeriod: Int32?)
+ case message(flags: Int32, flags2: Int32, id: Int32, fromId: Api.Peer?, fromBoostsApplied: Int32?, peerId: Api.Peer, savedPeerId: Api.Peer?, fwdFrom: Api.MessageFwdHeader?, viaBotId: Int64?, viaBusinessBotId: Int64?, replyTo: Api.MessageReplyHeader?, date: Int32, message: String, media: Api.MessageMedia?, replyMarkup: Api.ReplyMarkup?, entities: [Api.MessageEntity]?, views: Int32?, forwards: Int32?, replies: Api.MessageReplies?, editDate: Int32?, postAuthor: String?, groupedId: Int64?, reactions: Api.MessageReactions?, restrictionReason: [Api.RestrictionReason]?, ttlPeriod: Int32?, quickReplyShortcutId: Int32?, effect: Int64?, factcheck: Api.FactCheck?, reportDeliveryUntilDate: Int32?, paidMessageStars: Int64?, suggestedPost: Api.SuggestedPost?, scheduleRepeatPeriod: Int32?, summaryFromLanguage: String?)
case messageEmpty(flags: Int32, id: Int32, peerId: Api.Peer?)
case messageService(flags: Int32, id: Int32, fromId: Api.Peer?, peerId: Api.Peer, savedPeerId: Api.Peer?, replyTo: Api.MessageReplyHeader?, date: Int32, action: Api.MessageAction, reactions: Api.MessageReactions?, ttlPeriod: Int32?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
- case .message(let flags, let flags2, let id, let fromId, let fromBoostsApplied, let peerId, let savedPeerId, let fwdFrom, let viaBotId, let viaBusinessBotId, let replyTo, let date, let message, let media, let replyMarkup, let entities, let views, let forwards, let replies, let editDate, let postAuthor, let groupedId, let reactions, let restrictionReason, let ttlPeriod, let quickReplyShortcutId, let effect, let factcheck, let reportDeliveryUntilDate, let paidMessageStars, let suggestedPost, let scheduleRepeatPeriod):
+ case .message(let flags, let flags2, let id, let fromId, let fromBoostsApplied, let peerId, let savedPeerId, let fwdFrom, let viaBotId, let viaBusinessBotId, let replyTo, let date, let message, let media, let replyMarkup, let entities, let views, let forwards, let replies, let editDate, let postAuthor, let groupedId, let reactions, let restrictionReason, let ttlPeriod, let quickReplyShortcutId, let effect, let factcheck, let reportDeliveryUntilDate, let paidMessageStars, let suggestedPost, let scheduleRepeatPeriod, let summaryFromLanguage):
if boxed {
- buffer.appendInt32(-1188071729)
+ buffer.appendInt32(-1665888023)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(flags2, buffer: buffer, boxed: false)
@@ -782,6 +761,7 @@ public extension Api {
if Int(flags2) & Int(1 << 6) != 0 {serializeInt64(paidMessageStars!, buffer: buffer, boxed: false)}
if Int(flags2) & Int(1 << 7) != 0 {suggestedPost!.serialize(buffer, true)}
if Int(flags2) & Int(1 << 10) != 0 {serializeInt32(scheduleRepeatPeriod!, buffer: buffer, boxed: false)}
+ if Int(flags2) & Int(1 << 11) != 0 {serializeString(summaryFromLanguage!, buffer: buffer, boxed: false)}
break
case .messageEmpty(let flags, let id, let peerId):
if boxed {
@@ -811,8 +791,8 @@ public extension Api {
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
- case .message(let flags, let flags2, let id, let fromId, let fromBoostsApplied, let peerId, let savedPeerId, let fwdFrom, let viaBotId, let viaBusinessBotId, let replyTo, let date, let message, let media, let replyMarkup, let entities, let views, let forwards, let replies, let editDate, let postAuthor, let groupedId, let reactions, let restrictionReason, let ttlPeriod, let quickReplyShortcutId, let effect, let factcheck, let reportDeliveryUntilDate, let paidMessageStars, let suggestedPost, let scheduleRepeatPeriod):
- return ("message", [("flags", flags as Any), ("flags2", flags2 as Any), ("id", id as Any), ("fromId", fromId as Any), ("fromBoostsApplied", fromBoostsApplied as Any), ("peerId", peerId as Any), ("savedPeerId", savedPeerId as Any), ("fwdFrom", fwdFrom as Any), ("viaBotId", viaBotId as Any), ("viaBusinessBotId", viaBusinessBotId as Any), ("replyTo", replyTo as Any), ("date", date as Any), ("message", message as Any), ("media", media as Any), ("replyMarkup", replyMarkup as Any), ("entities", entities as Any), ("views", views as Any), ("forwards", forwards as Any), ("replies", replies as Any), ("editDate", editDate as Any), ("postAuthor", postAuthor as Any), ("groupedId", groupedId as Any), ("reactions", reactions as Any), ("restrictionReason", restrictionReason as Any), ("ttlPeriod", ttlPeriod as Any), ("quickReplyShortcutId", quickReplyShortcutId as Any), ("effect", effect as Any), ("factcheck", factcheck as Any), ("reportDeliveryUntilDate", reportDeliveryUntilDate as Any), ("paidMessageStars", paidMessageStars as Any), ("suggestedPost", suggestedPost as Any), ("scheduleRepeatPeriod", scheduleRepeatPeriod as Any)])
+ case .message(let flags, let flags2, let id, let fromId, let fromBoostsApplied, let peerId, let savedPeerId, let fwdFrom, let viaBotId, let viaBusinessBotId, let replyTo, let date, let message, let media, let replyMarkup, let entities, let views, let forwards, let replies, let editDate, let postAuthor, let groupedId, let reactions, let restrictionReason, let ttlPeriod, let quickReplyShortcutId, let effect, let factcheck, let reportDeliveryUntilDate, let paidMessageStars, let suggestedPost, let scheduleRepeatPeriod, let summaryFromLanguage):
+ return ("message", [("flags", flags as Any), ("flags2", flags2 as Any), ("id", id as Any), ("fromId", fromId as Any), ("fromBoostsApplied", fromBoostsApplied as Any), ("peerId", peerId as Any), ("savedPeerId", savedPeerId as Any), ("fwdFrom", fwdFrom as Any), ("viaBotId", viaBotId as Any), ("viaBusinessBotId", viaBusinessBotId as Any), ("replyTo", replyTo as Any), ("date", date as Any), ("message", message as Any), ("media", media as Any), ("replyMarkup", replyMarkup as Any), ("entities", entities as Any), ("views", views as Any), ("forwards", forwards as Any), ("replies", replies as Any), ("editDate", editDate as Any), ("postAuthor", postAuthor as Any), ("groupedId", groupedId as Any), ("reactions", reactions as Any), ("restrictionReason", restrictionReason as Any), ("ttlPeriod", ttlPeriod as Any), ("quickReplyShortcutId", quickReplyShortcutId as Any), ("effect", effect as Any), ("factcheck", factcheck as Any), ("reportDeliveryUntilDate", reportDeliveryUntilDate as Any), ("paidMessageStars", paidMessageStars as Any), ("suggestedPost", suggestedPost as Any), ("scheduleRepeatPeriod", scheduleRepeatPeriod as Any), ("summaryFromLanguage", summaryFromLanguage as Any)])
case .messageEmpty(let flags, let id, let peerId):
return ("messageEmpty", [("flags", flags as Any), ("id", id as Any), ("peerId", peerId as Any)])
case .messageService(let flags, let id, let fromId, let peerId, let savedPeerId, let replyTo, let date, let action, let reactions, let ttlPeriod):
@@ -911,6 +891,8 @@ public extension Api {
} }
var _32: Int32?
if Int(_2!) & Int(1 << 10) != 0 {_32 = reader.readInt32() }
+ var _33: String?
+ if Int(_2!) & Int(1 << 11) != 0 {_33 = parseString(reader) }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
@@ -943,12 +925,41 @@ public extension Api {
let _c30 = (Int(_2!) & Int(1 << 6) == 0) || _30 != nil
let _c31 = (Int(_2!) & Int(1 << 7) == 0) || _31 != nil
let _c32 = (Int(_2!) & Int(1 << 10) == 0) || _32 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 && _c19 && _c20 && _c21 && _c22 && _c23 && _c24 && _c25 && _c26 && _c27 && _c28 && _c29 && _c30 && _c31 && _c32 {
- return Api.Message.message(flags: _1!, flags2: _2!, id: _3!, fromId: _4, fromBoostsApplied: _5, peerId: _6!, savedPeerId: _7, fwdFrom: _8, viaBotId: _9, viaBusinessBotId: _10, replyTo: _11, date: _12!, message: _13!, media: _14, replyMarkup: _15, entities: _16, views: _17, forwards: _18, replies: _19, editDate: _20, postAuthor: _21, groupedId: _22, reactions: _23, restrictionReason: _24, ttlPeriod: _25, quickReplyShortcutId: _26, effect: _27, factcheck: _28, reportDeliveryUntilDate: _29, paidMessageStars: _30, suggestedPost: _31, scheduleRepeatPeriod: _32)
- }
- else {
- return nil
- }
+ let _c33 = (Int(_2!) & Int(1 << 11) == 0) || _33 != nil
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ if !_c13 { return nil }
+ if !_c14 { return nil }
+ if !_c15 { return nil }
+ if !_c16 { return nil }
+ if !_c17 { return nil }
+ if !_c18 { return nil }
+ if !_c19 { return nil }
+ if !_c20 { return nil }
+ if !_c21 { return nil }
+ if !_c22 { return nil }
+ if !_c23 { return nil }
+ if !_c24 { return nil }
+ if !_c25 { return nil }
+ if !_c26 { return nil }
+ if !_c27 { return nil }
+ if !_c28 { return nil }
+ if !_c29 { return nil }
+ if !_c30 { return nil }
+ if !_c31 { return nil }
+ if !_c32 { return nil }
+ if !_c33 { return nil }
+ return Api.Message.message(flags: _1!, flags2: _2!, id: _3!, fromId: _4, fromBoostsApplied: _5, peerId: _6!, savedPeerId: _7, fwdFrom: _8, viaBotId: _9, viaBusinessBotId: _10, replyTo: _11, date: _12!, message: _13!, media: _14, replyMarkup: _15, entities: _16, views: _17, forwards: _18, replies: _19, editDate: _20, postAuthor: _21, groupedId: _22, reactions: _23, restrictionReason: _24, ttlPeriod: _25, quickReplyShortcutId: _26, effect: _27, factcheck: _28, reportDeliveryUntilDate: _29, paidMessageStars: _30, suggestedPost: _31, scheduleRepeatPeriod: _32, summaryFromLanguage: _33)
}
public static func parse_messageEmpty(_ reader: BufferReader) -> Message? {
var _1: Int32?
@@ -962,12 +973,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Message.messageEmpty(flags: _1!, id: _2!, peerId: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Message.messageEmpty(flags: _1!, id: _2!, peerId: _3)
}
public static func parse_messageService(_ reader: BufferReader) -> Message? {
var _1: Int32?
@@ -1012,12 +1021,17 @@ public extension Api {
let _c8 = _8 != nil
let _c9 = (Int(_1!) & Int(1 << 20) == 0) || _9 != nil
let _c10 = (Int(_1!) & Int(1 << 25) == 0) || _10 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 {
- return Api.Message.messageService(flags: _1!, id: _2!, fromId: _3, peerId: _4!, savedPeerId: _5, replyTo: _6, date: _7!, action: _8!, reactions: _9, ttlPeriod: _10)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ return Api.Message.messageService(flags: _1!, id: _2!, fromId: _3, peerId: _4!, savedPeerId: _5, replyTo: _6, date: _7!, action: _8!, reactions: _9, ttlPeriod: _10)
}
}
@@ -1735,12 +1749,8 @@ public extension Api {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.MessageAction.messageActionBoostApply(boosts: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.MessageAction.messageActionBoostApply(boosts: _1!)
}
public static func parse_messageActionBotAllowed(_ reader: BufferReader) -> MessageAction? {
var _1: Int32?
@@ -1754,23 +1764,17 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 2) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.MessageAction.messageActionBotAllowed(flags: _1!, domain: _2, app: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.MessageAction.messageActionBotAllowed(flags: _1!, domain: _2, app: _3)
}
public static func parse_messageActionChannelCreate(_ reader: BufferReader) -> MessageAction? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.MessageAction.messageActionChannelCreate(title: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.MessageAction.messageActionChannelCreate(title: _1!)
}
public static func parse_messageActionChannelMigrateFrom(_ reader: BufferReader) -> MessageAction? {
var _1: String?
@@ -1779,12 +1783,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageAction.messageActionChannelMigrateFrom(title: _1!, chatId: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageAction.messageActionChannelMigrateFrom(title: _1!, chatId: _2!)
}
public static func parse_messageActionChatAddUser(_ reader: BufferReader) -> MessageAction? {
var _1: [Int64]?
@@ -1792,12 +1793,8 @@ public extension Api {
_1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.MessageAction.messageActionChatAddUser(users: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.MessageAction.messageActionChatAddUser(users: _1!)
}
public static func parse_messageActionChatCreate(_ reader: BufferReader) -> MessageAction? {
var _1: String?
@@ -1808,12 +1805,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageAction.messageActionChatCreate(title: _1!, users: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageAction.messageActionChatCreate(title: _1!, users: _2!)
}
public static func parse_messageActionChatDeletePhoto(_ reader: BufferReader) -> MessageAction? {
return Api.MessageAction.messageActionChatDeletePhoto
@@ -1822,12 +1816,8 @@ public extension Api {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
- if _c1 {
- return Api.MessageAction.messageActionChatDeleteUser(userId: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.MessageAction.messageActionChatDeleteUser(userId: _1!)
}
public static func parse_messageActionChatEditPhoto(_ reader: BufferReader) -> MessageAction? {
var _1: Api.Photo?
@@ -1835,34 +1825,22 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.Photo
}
let _c1 = _1 != nil
- if _c1 {
- return Api.MessageAction.messageActionChatEditPhoto(photo: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.MessageAction.messageActionChatEditPhoto(photo: _1!)
}
public static func parse_messageActionChatEditTitle(_ reader: BufferReader) -> MessageAction? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.MessageAction.messageActionChatEditTitle(title: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.MessageAction.messageActionChatEditTitle(title: _1!)
}
public static func parse_messageActionChatJoinedByLink(_ reader: BufferReader) -> MessageAction? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
- if _c1 {
- return Api.MessageAction.messageActionChatJoinedByLink(inviterId: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.MessageAction.messageActionChatJoinedByLink(inviterId: _1!)
}
public static func parse_messageActionChatJoinedByRequest(_ reader: BufferReader) -> MessageAction? {
return Api.MessageAction.messageActionChatJoinedByRequest
@@ -1871,12 +1849,8 @@ public extension Api {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
- if _c1 {
- return Api.MessageAction.messageActionChatMigrateTo(channelId: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.MessageAction.messageActionChatMigrateTo(channelId: _1!)
}
public static func parse_messageActionConferenceCall(_ reader: BufferReader) -> MessageAction? {
var _1: Int32?
@@ -1893,12 +1867,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 2) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 3) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.MessageAction.messageActionConferenceCall(flags: _1!, callId: _2!, duration: _3, otherParticipants: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.MessageAction.messageActionConferenceCall(flags: _1!, callId: _2!, duration: _3, otherParticipants: _4)
}
public static func parse_messageActionContactSignUp(_ reader: BufferReader) -> MessageAction? {
return Api.MessageAction.messageActionContactSignUp
@@ -1907,12 +1880,8 @@ public extension Api {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.MessageAction.messageActionCustomAction(message: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.MessageAction.messageActionCustomAction(message: _1!)
}
public static func parse_messageActionEmpty(_ reader: BufferReader) -> MessageAction? {
return Api.MessageAction.messageActionEmpty
@@ -1924,12 +1893,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageAction.messageActionGameScore(gameId: _1!, score: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageAction.messageActionGameScore(gameId: _1!, score: _2!)
}
public static func parse_messageActionGeoProximityReached(_ reader: BufferReader) -> MessageAction? {
var _1: Api.Peer?
@@ -1945,12 +1911,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.MessageAction.messageActionGeoProximityReached(fromId: _1!, toId: _2!, distance: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.MessageAction.messageActionGeoProximityReached(fromId: _1!, toId: _2!, distance: _3!)
}
public static func parse_messageActionGiftCode(_ reader: BufferReader) -> MessageAction? {
var _1: Int32?
@@ -1984,12 +1948,16 @@ public extension Api {
let _c7 = (Int(_1!) & Int(1 << 3) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 3) == 0) || _8 != nil
let _c9 = (Int(_1!) & Int(1 << 4) == 0) || _9 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
- return Api.MessageAction.messageActionGiftCode(flags: _1!, boostPeer: _2, days: _3!, slug: _4!, currency: _5, amount: _6, cryptoCurrency: _7, cryptoAmount: _8, message: _9)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ return Api.MessageAction.messageActionGiftCode(flags: _1!, boostPeer: _2, days: _3!, slug: _4!, currency: _5, amount: _6, cryptoCurrency: _7, cryptoAmount: _8, message: _9)
}
public static func parse_messageActionGiftPremium(_ reader: BufferReader) -> MessageAction? {
var _1: Int32?
@@ -2015,12 +1983,14 @@ public extension Api {
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 1) == 0) || _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.MessageAction.messageActionGiftPremium(flags: _1!, currency: _2!, amount: _3!, days: _4!, cryptoCurrency: _5, cryptoAmount: _6, message: _7)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.MessageAction.messageActionGiftPremium(flags: _1!, currency: _2!, amount: _3!, days: _4!, cryptoCurrency: _5, cryptoAmount: _6, message: _7)
}
public static func parse_messageActionGiftStars(_ reader: BufferReader) -> MessageAction? {
var _1: Int32?
@@ -2044,12 +2014,14 @@ public extension Api {
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 1) == 0) || _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.MessageAction.messageActionGiftStars(flags: _1!, currency: _2!, amount: _3!, stars: _4!, cryptoCurrency: _5, cryptoAmount: _6, transactionId: _7)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.MessageAction.messageActionGiftStars(flags: _1!, currency: _2!, amount: _3!, stars: _4!, cryptoCurrency: _5, cryptoAmount: _6, transactionId: _7)
}
public static func parse_messageActionGiftTon(_ reader: BufferReader) -> MessageAction? {
var _1: Int32?
@@ -2070,12 +2042,13 @@ public extension Api {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.MessageAction.messageActionGiftTon(flags: _1!, currency: _2!, amount: _3!, cryptoCurrency: _4!, cryptoAmount: _5!, transactionId: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.MessageAction.messageActionGiftTon(flags: _1!, currency: _2!, amount: _3!, cryptoCurrency: _4!, cryptoAmount: _5!, transactionId: _6)
}
public static func parse_messageActionGiveawayLaunch(_ reader: BufferReader) -> MessageAction? {
var _1: Int32?
@@ -2084,12 +2057,9 @@ public extension Api {
if Int(_1!) & Int(1 << 0) != 0 {_2 = reader.readInt64() }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
- if _c1 && _c2 {
- return Api.MessageAction.messageActionGiveawayLaunch(flags: _1!, stars: _2)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageAction.messageActionGiveawayLaunch(flags: _1!, stars: _2)
}
public static func parse_messageActionGiveawayResults(_ reader: BufferReader) -> MessageAction? {
var _1: Int32?
@@ -2101,12 +2071,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.MessageAction.messageActionGiveawayResults(flags: _1!, winnersCount: _2!, unclaimedCount: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.MessageAction.messageActionGiveawayResults(flags: _1!, winnersCount: _2!, unclaimedCount: _3!)
}
public static func parse_messageActionGroupCall(_ reader: BufferReader) -> MessageAction? {
var _1: Int32?
@@ -2120,12 +2088,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.MessageAction.messageActionGroupCall(flags: _1!, call: _2!, duration: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.MessageAction.messageActionGroupCall(flags: _1!, call: _2!, duration: _3)
}
public static func parse_messageActionGroupCallScheduled(_ reader: BufferReader) -> MessageAction? {
var _1: Api.InputGroupCall?
@@ -2136,12 +2102,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageAction.messageActionGroupCallScheduled(call: _1!, scheduleDate: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageAction.messageActionGroupCallScheduled(call: _1!, scheduleDate: _2!)
}
public static func parse_messageActionHistoryClear(_ reader: BufferReader) -> MessageAction? {
return Api.MessageAction.messageActionHistoryClear
@@ -2157,12 +2120,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageAction.messageActionInviteToGroupCall(call: _1!, users: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageAction.messageActionInviteToGroupCall(call: _1!, users: _2!)
}
public static func parse_messageActionPaidMessagesPrice(_ reader: BufferReader) -> MessageAction? {
var _1: Int32?
@@ -2171,12 +2131,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageAction.messageActionPaidMessagesPrice(flags: _1!, stars: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageAction.messageActionPaidMessagesPrice(flags: _1!, stars: _2!)
}
public static func parse_messageActionPaidMessagesRefunded(_ reader: BufferReader) -> MessageAction? {
var _1: Int32?
@@ -2185,12 +2142,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageAction.messageActionPaidMessagesRefunded(count: _1!, stars: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageAction.messageActionPaidMessagesRefunded(count: _1!, stars: _2!)
}
public static func parse_messageActionPaymentRefunded(_ reader: BufferReader) -> MessageAction? {
var _1: Int32?
@@ -2215,12 +2169,13 @@ public extension Api {
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
let _c6 = _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.MessageAction.messageActionPaymentRefunded(flags: _1!, peer: _2!, currency: _3!, totalAmount: _4!, payload: _5, charge: _6!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.MessageAction.messageActionPaymentRefunded(flags: _1!, peer: _2!, currency: _3!, totalAmount: _4!, payload: _5, charge: _6!)
}
public static func parse_messageActionPaymentSent(_ reader: BufferReader) -> MessageAction? {
var _1: Int32?
@@ -2238,12 +2193,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 4) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.MessageAction.messageActionPaymentSent(flags: _1!, currency: _2!, totalAmount: _3!, invoiceSlug: _4, subscriptionUntilDate: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.MessageAction.messageActionPaymentSent(flags: _1!, currency: _2!, totalAmount: _3!, invoiceSlug: _4, subscriptionUntilDate: _5)
}
public static func parse_messageActionPaymentSentMe(_ reader: BufferReader) -> MessageAction? {
var _1: Int32?
@@ -2274,12 +2229,15 @@ public extension Api {
let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil
let _c7 = _7 != nil
let _c8 = (Int(_1!) & Int(1 << 4) == 0) || _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.MessageAction.messageActionPaymentSentMe(flags: _1!, currency: _2!, totalAmount: _3!, payload: _4!, info: _5, shippingOptionId: _6, charge: _7!, subscriptionUntilDate: _8)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.MessageAction.messageActionPaymentSentMe(flags: _1!, currency: _2!, totalAmount: _3!, payload: _4!, info: _5, shippingOptionId: _6, charge: _7!, subscriptionUntilDate: _8)
}
public static func parse_messageActionPhoneCall(_ reader: BufferReader) -> MessageAction? {
var _1: Int32?
@@ -2296,12 +2254,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.MessageAction.messageActionPhoneCall(flags: _1!, callId: _2!, reason: _3, duration: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.MessageAction.messageActionPhoneCall(flags: _1!, callId: _2!, reason: _3, duration: _4)
}
public static func parse_messageActionPinMessage(_ reader: BufferReader) -> MessageAction? {
return Api.MessageAction.messageActionPinMessage
@@ -2324,12 +2281,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.MessageAction.messageActionPrizeStars(flags: _1!, stars: _2!, transactionId: _3!, boostPeer: _4!, giveawayMsgId: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.MessageAction.messageActionPrizeStars(flags: _1!, stars: _2!, transactionId: _3!, boostPeer: _4!, giveawayMsgId: _5!)
}
public static func parse_messageActionRequestedPeer(_ reader: BufferReader) -> MessageAction? {
var _1: Int32?
@@ -2340,12 +2297,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageAction.messageActionRequestedPeer(buttonId: _1!, peers: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageAction.messageActionRequestedPeer(buttonId: _1!, peers: _2!)
}
public static func parse_messageActionRequestedPeerSentMe(_ reader: BufferReader) -> MessageAction? {
var _1: Int32?
@@ -2356,12 +2310,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageAction.messageActionRequestedPeerSentMe(buttonId: _1!, peers: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageAction.messageActionRequestedPeerSentMe(buttonId: _1!, peers: _2!)
}
public static func parse_messageActionScreenshotTaken(_ reader: BufferReader) -> MessageAction? {
return Api.MessageAction.messageActionScreenshotTaken
@@ -2372,12 +2323,8 @@ public extension Api {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SecureValueType.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.MessageAction.messageActionSecureValuesSent(types: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.MessageAction.messageActionSecureValuesSent(types: _1!)
}
public static func parse_messageActionSecureValuesSentMe(_ reader: BufferReader) -> MessageAction? {
var _1: [Api.SecureValue]?
@@ -2390,12 +2337,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageAction.messageActionSecureValuesSentMe(values: _1!, credentials: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageAction.messageActionSecureValuesSentMe(values: _1!, credentials: _2!)
}
public static func parse_messageActionSetChatTheme(_ reader: BufferReader) -> MessageAction? {
var _1: Api.ChatTheme?
@@ -2403,12 +2347,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.ChatTheme
}
let _c1 = _1 != nil
- if _c1 {
- return Api.MessageAction.messageActionSetChatTheme(theme: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.MessageAction.messageActionSetChatTheme(theme: _1!)
}
public static func parse_messageActionSetChatWallPaper(_ reader: BufferReader) -> MessageAction? {
var _1: Int32?
@@ -2419,12 +2359,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageAction.messageActionSetChatWallPaper(flags: _1!, wallpaper: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageAction.messageActionSetChatWallPaper(flags: _1!, wallpaper: _2!)
}
public static func parse_messageActionSetMessagesTTL(_ reader: BufferReader) -> MessageAction? {
var _1: Int32?
@@ -2436,12 +2373,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.MessageAction.messageActionSetMessagesTTL(flags: _1!, period: _2!, autoSettingFrom: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.MessageAction.messageActionSetMessagesTTL(flags: _1!, period: _2!, autoSettingFrom: _3)
}
public static func parse_messageActionStarGift(_ reader: BufferReader) -> MessageAction? {
var _1: Int32?
@@ -2493,12 +2428,20 @@ public extension Api {
let _c11 = (Int(_1!) & Int(1 << 15) == 0) || _11 != nil
let _c12 = (Int(_1!) & Int(1 << 18) == 0) || _12 != nil
let _c13 = (Int(_1!) & Int(1 << 19) == 0) || _13 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 {
- return Api.MessageAction.messageActionStarGift(flags: _1!, gift: _2!, message: _3, convertStars: _4, upgradeMsgId: _5, upgradeStars: _6, fromId: _7, peer: _8, savedId: _9, prepaidUpgradeHash: _10, giftMsgId: _11, toId: _12, giftNum: _13)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ if !_c13 { return nil }
+ return Api.MessageAction.messageActionStarGift(flags: _1!, gift: _2!, message: _3, convertStars: _4, upgradeMsgId: _5, upgradeStars: _6, fromId: _7, peer: _8, savedId: _9, prepaidUpgradeHash: _10, giftMsgId: _11, toId: _12, giftNum: _13)
}
public static func parse_messageActionStarGiftPurchaseOffer(_ reader: BufferReader) -> MessageAction? {
var _1: Int32?
@@ -2517,12 +2460,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.MessageAction.messageActionStarGiftPurchaseOffer(flags: _1!, gift: _2!, price: _3!, expiresAt: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.MessageAction.messageActionStarGiftPurchaseOffer(flags: _1!, gift: _2!, price: _3!, expiresAt: _4!)
}
public static func parse_messageActionStarGiftPurchaseOfferDeclined(_ reader: BufferReader) -> MessageAction? {
var _1: Int32?
@@ -2538,12 +2480,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.MessageAction.messageActionStarGiftPurchaseOfferDeclined(flags: _1!, gift: _2!, price: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.MessageAction.messageActionStarGiftPurchaseOfferDeclined(flags: _1!, gift: _2!, price: _3!)
}
public static func parse_messageActionStarGiftUnique(_ reader: BufferReader) -> MessageAction? {
var _1: Int32?
@@ -2587,12 +2527,18 @@ public extension Api {
let _c9 = (Int(_1!) & Int(1 << 9) == 0) || _9 != nil
let _c10 = (Int(_1!) & Int(1 << 10) == 0) || _10 != nil
let _c11 = (Int(_1!) & Int(1 << 12) == 0) || _11 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 {
- return Api.MessageAction.messageActionStarGiftUnique(flags: _1!, gift: _2!, canExportAt: _3, transferStars: _4, fromId: _5, peer: _6, savedId: _7, resaleAmount: _8, canTransferAt: _9, canResellAt: _10, dropOriginalDetailsStars: _11)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ return Api.MessageAction.messageActionStarGiftUnique(flags: _1!, gift: _2!, canExportAt: _3, transferStars: _4, fromId: _5, peer: _6, savedId: _7, resaleAmount: _8, canTransferAt: _9, canResellAt: _10, dropOriginalDetailsStars: _11)
}
public static func parse_messageActionSuggestBirthday(_ reader: BufferReader) -> MessageAction? {
var _1: Api.Birthday?
@@ -2600,12 +2546,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.Birthday
}
let _c1 = _1 != nil
- if _c1 {
- return Api.MessageAction.messageActionSuggestBirthday(birthday: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.MessageAction.messageActionSuggestBirthday(birthday: _1!)
}
public static func parse_messageActionSuggestProfilePhoto(_ reader: BufferReader) -> MessageAction? {
var _1: Api.Photo?
@@ -2613,12 +2555,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.Photo
}
let _c1 = _1 != nil
- if _c1 {
- return Api.MessageAction.messageActionSuggestProfilePhoto(photo: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.MessageAction.messageActionSuggestProfilePhoto(photo: _1!)
}
public static func parse_messageActionSuggestedPostApproval(_ reader: BufferReader) -> MessageAction? {
var _1: Int32?
@@ -2635,23 +2573,18 @@ public extension Api {
let _c2 = (Int(_1!) & Int(1 << 2) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 3) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 4) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.MessageAction.messageActionSuggestedPostApproval(flags: _1!, rejectComment: _2, scheduleDate: _3, price: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.MessageAction.messageActionSuggestedPostApproval(flags: _1!, rejectComment: _2, scheduleDate: _3, price: _4)
}
public static func parse_messageActionSuggestedPostRefund(_ reader: BufferReader) -> MessageAction? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.MessageAction.messageActionSuggestedPostRefund(flags: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.MessageAction.messageActionSuggestedPostRefund(flags: _1!)
}
public static func parse_messageActionSuggestedPostSuccess(_ reader: BufferReader) -> MessageAction? {
var _1: Api.StarsAmount?
@@ -2659,12 +2592,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.StarsAmount
}
let _c1 = _1 != nil
- if _c1 {
- return Api.MessageAction.messageActionSuggestedPostSuccess(price: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.MessageAction.messageActionSuggestedPostSuccess(price: _1!)
}
public static func parse_messageActionTodoAppendTasks(_ reader: BufferReader) -> MessageAction? {
var _1: [Api.TodoItem]?
@@ -2672,12 +2601,8 @@ public extension Api {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.TodoItem.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.MessageAction.messageActionTodoAppendTasks(list: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.MessageAction.messageActionTodoAppendTasks(list: _1!)
}
public static func parse_messageActionTodoCompletions(_ reader: BufferReader) -> MessageAction? {
var _1: [Int32]?
@@ -2690,12 +2615,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageAction.messageActionTodoCompletions(completed: _1!, incompleted: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageAction.messageActionTodoCompletions(completed: _1!, incompleted: _2!)
}
public static func parse_messageActionTopicCreate(_ reader: BufferReader) -> MessageAction? {
var _1: Int32?
@@ -2710,12 +2632,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.MessageAction.messageActionTopicCreate(flags: _1!, title: _2!, iconColor: _3!, iconEmojiId: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.MessageAction.messageActionTopicCreate(flags: _1!, title: _2!, iconColor: _3!, iconEmojiId: _4)
}
public static func parse_messageActionTopicEdit(_ reader: BufferReader) -> MessageAction? {
var _1: Int32?
@@ -2737,23 +2658,19 @@ public extension Api {
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.MessageAction.messageActionTopicEdit(flags: _1!, title: _2, iconEmojiId: _3, closed: _4, hidden: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.MessageAction.messageActionTopicEdit(flags: _1!, title: _2, iconEmojiId: _3, closed: _4, hidden: _5)
}
public static func parse_messageActionWebViewDataSent(_ reader: BufferReader) -> MessageAction? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.MessageAction.messageActionWebViewDataSent(text: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.MessageAction.messageActionWebViewDataSent(text: _1!)
}
public static func parse_messageActionWebViewDataSentMe(_ reader: BufferReader) -> MessageAction? {
var _1: String?
@@ -2762,12 +2679,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageAction.messageActionWebViewDataSentMe(text: _1!, data: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageAction.messageActionWebViewDataSentMe(text: _1!, data: _2!)
}
}
diff --git a/submodules/TelegramApi/Sources/Api16.swift b/submodules/TelegramApi/Sources/Api16.swift
index 90af1af4..1cec7d62 100644
--- a/submodules/TelegramApi/Sources/Api16.swift
+++ b/submodules/TelegramApi/Sources/Api16.swift
@@ -239,12 +239,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.MessageEntity.inputMessageEntityMentionName(offset: _1!, length: _2!, userId: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.MessageEntity.inputMessageEntityMentionName(offset: _1!, length: _2!, userId: _3!)
}
public static func parse_messageEntityBankCard(_ reader: BufferReader) -> MessageEntity? {
var _1: Int32?
@@ -253,12 +251,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageEntity.messageEntityBankCard(offset: _1!, length: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageEntity.messageEntityBankCard(offset: _1!, length: _2!)
}
public static func parse_messageEntityBlockquote(_ reader: BufferReader) -> MessageEntity? {
var _1: Int32?
@@ -270,12 +265,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.MessageEntity.messageEntityBlockquote(flags: _1!, offset: _2!, length: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.MessageEntity.messageEntityBlockquote(flags: _1!, offset: _2!, length: _3!)
}
public static func parse_messageEntityBold(_ reader: BufferReader) -> MessageEntity? {
var _1: Int32?
@@ -284,12 +277,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageEntity.messageEntityBold(offset: _1!, length: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageEntity.messageEntityBold(offset: _1!, length: _2!)
}
public static func parse_messageEntityBotCommand(_ reader: BufferReader) -> MessageEntity? {
var _1: Int32?
@@ -298,12 +288,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageEntity.messageEntityBotCommand(offset: _1!, length: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageEntity.messageEntityBotCommand(offset: _1!, length: _2!)
}
public static func parse_messageEntityCashtag(_ reader: BufferReader) -> MessageEntity? {
var _1: Int32?
@@ -312,12 +299,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageEntity.messageEntityCashtag(offset: _1!, length: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageEntity.messageEntityCashtag(offset: _1!, length: _2!)
}
public static func parse_messageEntityCode(_ reader: BufferReader) -> MessageEntity? {
var _1: Int32?
@@ -326,12 +310,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageEntity.messageEntityCode(offset: _1!, length: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageEntity.messageEntityCode(offset: _1!, length: _2!)
}
public static func parse_messageEntityCustomEmoji(_ reader: BufferReader) -> MessageEntity? {
var _1: Int32?
@@ -343,12 +324,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.MessageEntity.messageEntityCustomEmoji(offset: _1!, length: _2!, documentId: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.MessageEntity.messageEntityCustomEmoji(offset: _1!, length: _2!, documentId: _3!)
}
public static func parse_messageEntityEmail(_ reader: BufferReader) -> MessageEntity? {
var _1: Int32?
@@ -357,12 +336,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageEntity.messageEntityEmail(offset: _1!, length: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageEntity.messageEntityEmail(offset: _1!, length: _2!)
}
public static func parse_messageEntityHashtag(_ reader: BufferReader) -> MessageEntity? {
var _1: Int32?
@@ -371,12 +347,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageEntity.messageEntityHashtag(offset: _1!, length: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageEntity.messageEntityHashtag(offset: _1!, length: _2!)
}
public static func parse_messageEntityItalic(_ reader: BufferReader) -> MessageEntity? {
var _1: Int32?
@@ -385,12 +358,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageEntity.messageEntityItalic(offset: _1!, length: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageEntity.messageEntityItalic(offset: _1!, length: _2!)
}
public static func parse_messageEntityMention(_ reader: BufferReader) -> MessageEntity? {
var _1: Int32?
@@ -399,12 +369,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageEntity.messageEntityMention(offset: _1!, length: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageEntity.messageEntityMention(offset: _1!, length: _2!)
}
public static func parse_messageEntityMentionName(_ reader: BufferReader) -> MessageEntity? {
var _1: Int32?
@@ -416,12 +383,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.MessageEntity.messageEntityMentionName(offset: _1!, length: _2!, userId: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.MessageEntity.messageEntityMentionName(offset: _1!, length: _2!, userId: _3!)
}
public static func parse_messageEntityPhone(_ reader: BufferReader) -> MessageEntity? {
var _1: Int32?
@@ -430,12 +395,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageEntity.messageEntityPhone(offset: _1!, length: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageEntity.messageEntityPhone(offset: _1!, length: _2!)
}
public static func parse_messageEntityPre(_ reader: BufferReader) -> MessageEntity? {
var _1: Int32?
@@ -447,12 +409,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.MessageEntity.messageEntityPre(offset: _1!, length: _2!, language: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.MessageEntity.messageEntityPre(offset: _1!, length: _2!, language: _3!)
}
public static func parse_messageEntitySpoiler(_ reader: BufferReader) -> MessageEntity? {
var _1: Int32?
@@ -461,12 +421,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageEntity.messageEntitySpoiler(offset: _1!, length: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageEntity.messageEntitySpoiler(offset: _1!, length: _2!)
}
public static func parse_messageEntityStrike(_ reader: BufferReader) -> MessageEntity? {
var _1: Int32?
@@ -475,12 +432,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageEntity.messageEntityStrike(offset: _1!, length: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageEntity.messageEntityStrike(offset: _1!, length: _2!)
}
public static func parse_messageEntityTextUrl(_ reader: BufferReader) -> MessageEntity? {
var _1: Int32?
@@ -492,12 +446,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.MessageEntity.messageEntityTextUrl(offset: _1!, length: _2!, url: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.MessageEntity.messageEntityTextUrl(offset: _1!, length: _2!, url: _3!)
}
public static func parse_messageEntityUnderline(_ reader: BufferReader) -> MessageEntity? {
var _1: Int32?
@@ -506,12 +458,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageEntity.messageEntityUnderline(offset: _1!, length: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageEntity.messageEntityUnderline(offset: _1!, length: _2!)
}
public static func parse_messageEntityUnknown(_ reader: BufferReader) -> MessageEntity? {
var _1: Int32?
@@ -520,12 +469,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageEntity.messageEntityUnknown(offset: _1!, length: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageEntity.messageEntityUnknown(offset: _1!, length: _2!)
}
public static func parse_messageEntityUrl(_ reader: BufferReader) -> MessageEntity? {
var _1: Int32?
@@ -534,12 +480,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageEntity.messageEntityUrl(offset: _1!, length: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageEntity.messageEntityUrl(offset: _1!, length: _2!)
}
}
@@ -585,12 +528,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.MessageMedia
}
let _c1 = _1 != nil
- if _c1 {
- return Api.MessageExtendedMedia.messageExtendedMedia(media: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.MessageExtendedMedia.messageExtendedMedia(media: _1!)
}
public static func parse_messageExtendedMediaPreview(_ reader: BufferReader) -> MessageExtendedMedia? {
var _1: Int32?
@@ -610,12 +549,12 @@ public extension Api {
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.MessageExtendedMedia.messageExtendedMediaPreview(flags: _1!, w: _2, h: _3, thumb: _4, videoDuration: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.MessageExtendedMedia.messageExtendedMediaPreview(flags: _1!, w: _2, h: _3, thumb: _4, videoDuration: _5)
}
}
@@ -696,12 +635,19 @@ public extension Api {
let _c10 = (Int(_1!) & Int(1 << 9) == 0) || _10 != nil
let _c11 = (Int(_1!) & Int(1 << 10) == 0) || _11 != nil
let _c12 = (Int(_1!) & Int(1 << 6) == 0) || _12 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 {
- return Api.MessageFwdHeader.messageFwdHeader(flags: _1!, fromId: _2, fromName: _3, date: _4!, channelPost: _5, postAuthor: _6, savedFromPeer: _7, savedFromMsgId: _8, savedFromId: _9, savedFromName: _10, savedDate: _11, psaType: _12)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ return Api.MessageFwdHeader.messageFwdHeader(flags: _1!, fromId: _2, fromName: _3, date: _4!, channelPost: _5, postAuthor: _6, savedFromPeer: _7, savedFromMsgId: _8, savedFromId: _9, savedFromName: _10, savedDate: _11, psaType: _12)
}
}
@@ -709,7 +655,7 @@ public extension Api {
public extension Api {
indirect enum MessageMedia: TypeConstructorDescription {
case messageMediaContact(phoneNumber: String, firstName: String, lastName: String, vcard: String, userId: Int64)
- case messageMediaDice(value: Int32, emoticon: String)
+ case messageMediaDice(flags: Int32, value: Int32, emoticon: String, gameOutcome: Api.messages.EmojiGameOutcome?)
case messageMediaDocument(flags: Int32, document: Api.Document?, altDocuments: [Api.Document]?, videoCover: Api.Photo?, videoTimestamp: Int32?, ttlSeconds: Int32?)
case messageMediaEmpty
case messageMediaGame(game: Api.Game)
@@ -740,12 +686,14 @@ public extension Api {
serializeString(vcard, buffer: buffer, boxed: false)
serializeInt64(userId, buffer: buffer, boxed: false)
break
- case .messageMediaDice(let value, let emoticon):
+ case .messageMediaDice(let flags, let value, let emoticon, let gameOutcome):
if boxed {
- buffer.appendInt32(1065280907)
+ buffer.appendInt32(147581959)
}
+ serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(value, buffer: buffer, boxed: false)
serializeString(emoticon, buffer: buffer, boxed: false)
+ if Int(flags) & Int(1 << 0) != 0 {gameOutcome!.serialize(buffer, true)}
break
case .messageMediaDocument(let flags, let document, let altDocuments, let videoCover, let videoTimestamp, let ttlSeconds):
if boxed {
@@ -930,8 +878,8 @@ public extension Api {
switch self {
case .messageMediaContact(let phoneNumber, let firstName, let lastName, let vcard, let userId):
return ("messageMediaContact", [("phoneNumber", phoneNumber as Any), ("firstName", firstName as Any), ("lastName", lastName as Any), ("vcard", vcard as Any), ("userId", userId as Any)])
- case .messageMediaDice(let value, let emoticon):
- return ("messageMediaDice", [("value", value as Any), ("emoticon", emoticon as Any)])
+ case .messageMediaDice(let flags, let value, let emoticon, let gameOutcome):
+ return ("messageMediaDice", [("flags", flags as Any), ("value", value as Any), ("emoticon", emoticon as Any), ("gameOutcome", gameOutcome as Any)])
case .messageMediaDocument(let flags, let document, let altDocuments, let videoCover, let videoTimestamp, let ttlSeconds):
return ("messageMediaDocument", [("flags", flags as Any), ("document", document as Any), ("altDocuments", altDocuments as Any), ("videoCover", videoCover as Any), ("videoTimestamp", videoTimestamp as Any), ("ttlSeconds", ttlSeconds as Any)])
case .messageMediaEmpty:
@@ -985,26 +933,33 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.MessageMedia.messageMediaContact(phoneNumber: _1!, firstName: _2!, lastName: _3!, vcard: _4!, userId: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.MessageMedia.messageMediaContact(phoneNumber: _1!, firstName: _2!, lastName: _3!, vcard: _4!, userId: _5!)
}
public static func parse_messageMediaDice(_ reader: BufferReader) -> MessageMedia? {
var _1: Int32?
_1 = reader.readInt32()
- var _2: String?
- _2 = parseString(reader)
+ var _2: Int32?
+ _2 = reader.readInt32()
+ var _3: String?
+ _3 = parseString(reader)
+ var _4: Api.messages.EmojiGameOutcome?
+ if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
+ _4 = Api.parse(reader, signature: signature) as? Api.messages.EmojiGameOutcome
+ } }
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageMedia.messageMediaDice(value: _1!, emoticon: _2!)
- }
- else {
- return nil
- }
+ let _c3 = _3 != nil
+ let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.MessageMedia.messageMediaDice(flags: _1!, value: _2!, emoticon: _3!, gameOutcome: _4)
}
public static func parse_messageMediaDocument(_ reader: BufferReader) -> MessageMedia? {
var _1: Int32?
@@ -1031,12 +986,13 @@ public extension Api {
let _c4 = (Int(_1!) & Int(1 << 9) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 10) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.MessageMedia.messageMediaDocument(flags: _1!, document: _2, altDocuments: _3, videoCover: _4, videoTimestamp: _5, ttlSeconds: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.MessageMedia.messageMediaDocument(flags: _1!, document: _2, altDocuments: _3, videoCover: _4, videoTimestamp: _5, ttlSeconds: _6)
}
public static func parse_messageMediaEmpty(_ reader: BufferReader) -> MessageMedia? {
return Api.MessageMedia.messageMediaEmpty
@@ -1047,12 +1003,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.Game
}
let _c1 = _1 != nil
- if _c1 {
- return Api.MessageMedia.messageMediaGame(game: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.MessageMedia.messageMediaGame(game: _1!)
}
public static func parse_messageMediaGeo(_ reader: BufferReader) -> MessageMedia? {
var _1: Api.GeoPoint?
@@ -1060,12 +1012,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.GeoPoint
}
let _c1 = _1 != nil
- if _c1 {
- return Api.MessageMedia.messageMediaGeo(geo: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.MessageMedia.messageMediaGeo(geo: _1!)
}
public static func parse_messageMediaGeoLive(_ reader: BufferReader) -> MessageMedia? {
var _1: Int32?
@@ -1085,12 +1033,12 @@ public extension Api {
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.MessageMedia.messageMediaGeoLive(flags: _1!, geo: _2!, heading: _3, period: _4!, proximityNotificationRadius: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.MessageMedia.messageMediaGeoLive(flags: _1!, geo: _2!, heading: _3, period: _4!, proximityNotificationRadius: _5)
}
public static func parse_messageMediaGiveaway(_ reader: BufferReader) -> MessageMedia? {
var _1: Int32?
@@ -1121,12 +1069,15 @@ public extension Api {
let _c6 = (Int(_1!) & Int(1 << 4) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 5) == 0) || _7 != nil
let _c8 = _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.MessageMedia.messageMediaGiveaway(flags: _1!, channels: _2!, countriesIso2: _3, prizeDescription: _4, quantity: _5!, months: _6, stars: _7, untilDate: _8!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.MessageMedia.messageMediaGiveaway(flags: _1!, channels: _2!, countriesIso2: _3, prizeDescription: _4, quantity: _5!, months: _6, stars: _7, untilDate: _8!)
}
public static func parse_messageMediaGiveawayResults(_ reader: BufferReader) -> MessageMedia? {
var _1: Int32?
@@ -1164,12 +1115,18 @@ public extension Api {
let _c9 = (Int(_1!) & Int(1 << 5) == 0) || _9 != nil
let _c10 = (Int(_1!) & Int(1 << 1) == 0) || _10 != nil
let _c11 = _11 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 {
- return Api.MessageMedia.messageMediaGiveawayResults(flags: _1!, channelId: _2!, additionalPeersCount: _3, launchMsgId: _4!, winnersCount: _5!, unclaimedCount: _6!, winners: _7!, months: _8, stars: _9, prizeDescription: _10, untilDate: _11!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ return Api.MessageMedia.messageMediaGiveawayResults(flags: _1!, channelId: _2!, additionalPeersCount: _3, launchMsgId: _4!, winnersCount: _5!, unclaimedCount: _6!, winners: _7!, months: _8, stars: _9, prizeDescription: _10, untilDate: _11!)
}
public static func parse_messageMediaInvoice(_ reader: BufferReader) -> MessageMedia? {
var _1: Int32?
@@ -1203,12 +1160,16 @@ public extension Api {
let _c7 = _7 != nil
let _c8 = _8 != nil
let _c9 = (Int(_1!) & Int(1 << 4) == 0) || _9 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
- return Api.MessageMedia.messageMediaInvoice(flags: _1!, title: _2!, description: _3!, photo: _4, receiptMsgId: _5, currency: _6!, totalAmount: _7!, startParam: _8!, extendedMedia: _9)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ return Api.MessageMedia.messageMediaInvoice(flags: _1!, title: _2!, description: _3!, photo: _4, receiptMsgId: _5, currency: _6!, totalAmount: _7!, startParam: _8!, extendedMedia: _9)
}
public static func parse_messageMediaPaidMedia(_ reader: BufferReader) -> MessageMedia? {
var _1: Int64?
@@ -1219,12 +1180,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageMedia.messageMediaPaidMedia(starsAmount: _1!, extendedMedia: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageMedia.messageMediaPaidMedia(starsAmount: _1!, extendedMedia: _2!)
}
public static func parse_messageMediaPhoto(_ reader: BufferReader) -> MessageMedia? {
var _1: Int32?
@@ -1238,12 +1196,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 2) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.MessageMedia.messageMediaPhoto(flags: _1!, photo: _2, ttlSeconds: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.MessageMedia.messageMediaPhoto(flags: _1!, photo: _2, ttlSeconds: _3)
}
public static func parse_messageMediaPoll(_ reader: BufferReader) -> MessageMedia? {
var _1: Api.Poll?
@@ -1256,12 +1212,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageMedia.messageMediaPoll(poll: _1!, results: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageMedia.messageMediaPoll(poll: _1!, results: _2!)
}
public static func parse_messageMediaStory(_ reader: BufferReader) -> MessageMedia? {
var _1: Int32?
@@ -1280,12 +1233,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.MessageMedia.messageMediaStory(flags: _1!, peer: _2!, id: _3!, story: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.MessageMedia.messageMediaStory(flags: _1!, peer: _2!, id: _3!, story: _4)
}
public static func parse_messageMediaToDo(_ reader: BufferReader) -> MessageMedia? {
var _1: Int32?
@@ -1301,12 +1253,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.MessageMedia.messageMediaToDo(flags: _1!, todo: _2!, completions: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.MessageMedia.messageMediaToDo(flags: _1!, todo: _2!, completions: _3)
}
public static func parse_messageMediaUnsupported(_ reader: BufferReader) -> MessageMedia? {
return Api.MessageMedia.messageMediaUnsupported
@@ -1332,12 +1282,13 @@ public extension Api {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.MessageMedia.messageMediaVenue(geo: _1!, title: _2!, address: _3!, provider: _4!, venueId: _5!, venueType: _6!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.MessageMedia.messageMediaVenue(geo: _1!, title: _2!, address: _3!, provider: _4!, venueId: _5!, venueType: _6!)
}
public static func parse_messageMediaVideoStream(_ reader: BufferReader) -> MessageMedia? {
var _1: Int32?
@@ -1348,12 +1299,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageMedia.messageMediaVideoStream(flags: _1!, call: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageMedia.messageMediaVideoStream(flags: _1!, call: _2!)
}
public static func parse_messageMediaWebPage(_ reader: BufferReader) -> MessageMedia? {
var _1: Int32?
@@ -1364,12 +1312,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageMedia.messageMediaWebPage(flags: _1!, webpage: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageMedia.messageMediaWebPage(flags: _1!, webpage: _2!)
}
}
diff --git a/submodules/TelegramApi/Sources/Api17.swift b/submodules/TelegramApi/Sources/Api17.swift
index abefb9f7..5cc52b37 100644
--- a/submodules/TelegramApi/Sources/Api17.swift
+++ b/submodules/TelegramApi/Sources/Api17.swift
@@ -40,12 +40,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.MessagePeerReaction.messagePeerReaction(flags: _1!, peerId: _2!, date: _3!, reaction: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.MessagePeerReaction.messagePeerReaction(flags: _1!, peerId: _2!, date: _3!, reaction: _4!)
}
}
@@ -111,12 +110,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.MessagePeerVote.messagePeerVote(peer: _1!, option: _2!, date: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.MessagePeerVote.messagePeerVote(peer: _1!, option: _2!, date: _3!)
}
public static func parse_messagePeerVoteInputOption(_ reader: BufferReader) -> MessagePeerVote? {
var _1: Api.Peer?
@@ -127,12 +124,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessagePeerVote.messagePeerVoteInputOption(peer: _1!, date: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessagePeerVote.messagePeerVoteInputOption(peer: _1!, date: _2!)
}
public static func parse_messagePeerVoteMultiple(_ reader: BufferReader) -> MessagePeerVote? {
var _1: Api.Peer?
@@ -148,12 +142,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.MessagePeerVote.messagePeerVoteMultiple(peer: _1!, options: _2!, date: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.MessagePeerVote.messagePeerVoteMultiple(peer: _1!, options: _2!, date: _3!)
}
}
@@ -188,12 +180,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageRange.messageRange(minId: _1!, maxId: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageRange.messageRange(minId: _1!, maxId: _2!)
}
}
@@ -254,12 +243,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 4) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.MessageReactions.messageReactions(flags: _1!, results: _2!, recentReactions: _3, topReactors: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.MessageReactions.messageReactions(flags: _1!, results: _2!, recentReactions: _3, topReactors: _4)
}
}
@@ -300,12 +288,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 3) == 0) || _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.MessageReactor.messageReactor(flags: _1!, peerId: _2, count: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.MessageReactor.messageReactor(flags: _1!, peerId: _2, count: _3!)
}
}
@@ -366,12 +352,14 @@ public extension Api {
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 3) == 0) || _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.MessageReplies.messageReplies(flags: _1!, replies: _2!, repliesPts: _3!, recentRepliers: _4, channelId: _5, maxId: _6, readMaxId: _7)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.MessageReplies.messageReplies(flags: _1!, replies: _2!, repliesPts: _3!, recentRepliers: _4, channelId: _5, maxId: _6, readMaxId: _7)
}
}
@@ -460,12 +448,17 @@ public extension Api {
let _c8 = (Int(_1!) & Int(1 << 7) == 0) || _8 != nil
let _c9 = (Int(_1!) & Int(1 << 10) == 0) || _9 != nil
let _c10 = (Int(_1!) & Int(1 << 11) == 0) || _10 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 {
- return Api.MessageReplyHeader.messageReplyHeader(flags: _1!, replyToMsgId: _2, replyToPeerId: _3, replyFrom: _4, replyMedia: _5, replyToTopId: _6, quoteText: _7, quoteEntities: _8, quoteOffset: _9, todoItemId: _10)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ return Api.MessageReplyHeader.messageReplyHeader(flags: _1!, replyToMsgId: _2, replyToPeerId: _3, replyFrom: _4, replyMedia: _5, replyToTopId: _6, quoteText: _7, quoteEntities: _8, quoteOffset: _9, todoItemId: _10)
}
public static func parse_messageReplyStoryHeader(_ reader: BufferReader) -> MessageReplyHeader? {
var _1: Api.Peer?
@@ -476,12 +469,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageReplyHeader.messageReplyStoryHeader(peer: _1!, storyId: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageReplyHeader.messageReplyStoryHeader(peer: _1!, storyId: _2!)
}
}
@@ -516,12 +506,9 @@ public extension Api {
_2 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MessageReportOption.messageReportOption(text: _1!, option: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MessageReportOption.messageReportOption(text: _1!, option: _2!)
}
}
@@ -566,12 +553,11 @@ public extension Api {
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.MessageViews.messageViews(flags: _1!, views: _2, forwards: _3, replies: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.MessageViews.messageViews(flags: _1!, views: _2, forwards: _3, replies: _4)
}
}
@@ -770,12 +756,8 @@ public extension Api {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.MessagesFilter.inputMessagesFilterPhoneCalls(flags: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.MessagesFilter.inputMessagesFilterPhoneCalls(flags: _1!)
}
public static func parse_inputMessagesFilterPhotoVideo(_ reader: BufferReader) -> MessagesFilter? {
return Api.MessagesFilter.inputMessagesFilterPhotoVideo
@@ -834,12 +816,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.MissingInvitee.missingInvitee(flags: _1!, userId: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.MissingInvitee.missingInvitee(flags: _1!, userId: _2!)
}
}
@@ -892,12 +871,13 @@ public extension Api {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.MyBoost.myBoost(flags: _1!, slot: _2!, peer: _3, date: _4!, expires: _5!, cooldownUntilDate: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.MyBoost.myBoost(flags: _1!, slot: _2!, peer: _3, date: _4!, expires: _5!, cooldownUntilDate: _6)
}
}
@@ -936,12 +916,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.NearestDc.nearestDc(country: _1!, thisDc: _2!, nearestDc: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.NearestDc.nearestDc(country: _1!, thisDc: _2!, nearestDc: _3!)
}
}
diff --git a/submodules/TelegramApi/Sources/Api18.swift b/submodules/TelegramApi/Sources/Api18.swift
index 11ea4e2a..f14c2c27 100644
--- a/submodules/TelegramApi/Sources/Api18.swift
+++ b/submodules/TelegramApi/Sources/Api18.swift
@@ -58,12 +58,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.NotificationSound.notificationSoundLocal(title: _1!, data: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.NotificationSound.notificationSoundLocal(title: _1!, data: _2!)
}
public static func parse_notificationSoundNone(_ reader: BufferReader) -> NotificationSound? {
return Api.NotificationSound.notificationSoundNone
@@ -72,12 +69,8 @@ public extension Api {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
- if _c1 {
- return Api.NotificationSound.notificationSoundRingtone(id: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.NotificationSound.notificationSoundRingtone(id: _1!)
}
}
@@ -156,12 +149,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.NotifyPeer.notifyForumTopic(peer: _1!, topMsgId: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.NotifyPeer.notifyForumTopic(peer: _1!, topMsgId: _2!)
}
public static func parse_notifyPeer(_ reader: BufferReader) -> NotifyPeer? {
var _1: Api.Peer?
@@ -169,12 +159,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.Peer
}
let _c1 = _1 != nil
- if _c1 {
- return Api.NotifyPeer.notifyPeer(peer: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.NotifyPeer.notifyPeer(peer: _1!)
}
public static func parse_notifyUsers(_ reader: BufferReader) -> NotifyPeer? {
return Api.NotifyPeer.notifyUsers
@@ -208,12 +194,8 @@ public extension Api {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.OutboxReadDate.outboxReadDate(date: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.OutboxReadDate.outboxReadDate(date: _1!)
}
}
@@ -282,12 +264,13 @@ public extension Api {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.Page.page(flags: _1!, url: _2!, blocks: _3!, photos: _4!, documents: _5!, views: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.Page.page(flags: _1!, url: _2!, blocks: _3!, photos: _4!, documents: _5!, views: _6)
}
}
@@ -636,12 +619,8 @@ public extension Api {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.PageBlock.pageBlockAnchor(name: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.PageBlock.pageBlockAnchor(name: _1!)
}
public static func parse_pageBlockAudio(_ reader: BufferReader) -> PageBlock? {
var _1: Int64?
@@ -652,12 +631,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.PageBlock.pageBlockAudio(audioId: _1!, caption: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.PageBlock.pageBlockAudio(audioId: _1!, caption: _2!)
}
public static func parse_pageBlockAuthorDate(_ reader: BufferReader) -> PageBlock? {
var _1: Api.RichText?
@@ -668,12 +644,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.PageBlock.pageBlockAuthorDate(author: _1!, publishedDate: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.PageBlock.pageBlockAuthorDate(author: _1!, publishedDate: _2!)
}
public static func parse_pageBlockBlockquote(_ reader: BufferReader) -> PageBlock? {
var _1: Api.RichText?
@@ -686,12 +659,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.PageBlock.pageBlockBlockquote(text: _1!, caption: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.PageBlock.pageBlockBlockquote(text: _1!, caption: _2!)
}
public static func parse_pageBlockChannel(_ reader: BufferReader) -> PageBlock? {
var _1: Api.Chat?
@@ -699,12 +669,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.Chat
}
let _c1 = _1 != nil
- if _c1 {
- return Api.PageBlock.pageBlockChannel(channel: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.PageBlock.pageBlockChannel(channel: _1!)
}
public static func parse_pageBlockCollage(_ reader: BufferReader) -> PageBlock? {
var _1: [Api.PageBlock]?
@@ -717,12 +683,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.PageBlock.pageBlockCollage(items: _1!, caption: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.PageBlock.pageBlockCollage(items: _1!, caption: _2!)
}
public static func parse_pageBlockCover(_ reader: BufferReader) -> PageBlock? {
var _1: Api.PageBlock?
@@ -730,12 +693,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.PageBlock
}
let _c1 = _1 != nil
- if _c1 {
- return Api.PageBlock.pageBlockCover(cover: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.PageBlock.pageBlockCover(cover: _1!)
}
public static func parse_pageBlockDetails(_ reader: BufferReader) -> PageBlock? {
var _1: Int32?
@@ -751,12 +710,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.PageBlock.pageBlockDetails(flags: _1!, blocks: _2!, title: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.PageBlock.pageBlockDetails(flags: _1!, blocks: _2!, title: _3!)
}
public static func parse_pageBlockDivider(_ reader: BufferReader) -> PageBlock? {
return Api.PageBlock.pageBlockDivider
@@ -785,12 +742,14 @@ public extension Api {
let _c5 = (Int(_1!) & Int(1 << 5) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 5) == 0) || _6 != nil
let _c7 = _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.PageBlock.pageBlockEmbed(flags: _1!, url: _2, html: _3, posterPhotoId: _4, w: _5, h: _6, caption: _7!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.PageBlock.pageBlockEmbed(flags: _1!, url: _2, html: _3, posterPhotoId: _4, w: _5, h: _6, caption: _7!)
}
public static func parse_pageBlockEmbedPost(_ reader: BufferReader) -> PageBlock? {
var _1: String?
@@ -818,12 +777,14 @@ public extension Api {
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.PageBlock.pageBlockEmbedPost(url: _1!, webpageId: _2!, authorPhotoId: _3!, author: _4!, date: _5!, blocks: _6!, caption: _7!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.PageBlock.pageBlockEmbedPost(url: _1!, webpageId: _2!, authorPhotoId: _3!, author: _4!, date: _5!, blocks: _6!, caption: _7!)
}
public static func parse_pageBlockFooter(_ reader: BufferReader) -> PageBlock? {
var _1: Api.RichText?
@@ -831,12 +792,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.RichText
}
let _c1 = _1 != nil
- if _c1 {
- return Api.PageBlock.pageBlockFooter(text: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.PageBlock.pageBlockFooter(text: _1!)
}
public static func parse_pageBlockHeader(_ reader: BufferReader) -> PageBlock? {
var _1: Api.RichText?
@@ -844,12 +801,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.RichText
}
let _c1 = _1 != nil
- if _c1 {
- return Api.PageBlock.pageBlockHeader(text: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.PageBlock.pageBlockHeader(text: _1!)
}
public static func parse_pageBlockKicker(_ reader: BufferReader) -> PageBlock? {
var _1: Api.RichText?
@@ -857,12 +810,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.RichText
}
let _c1 = _1 != nil
- if _c1 {
- return Api.PageBlock.pageBlockKicker(text: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.PageBlock.pageBlockKicker(text: _1!)
}
public static func parse_pageBlockList(_ reader: BufferReader) -> PageBlock? {
var _1: [Api.PageListItem]?
@@ -870,12 +819,8 @@ public extension Api {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PageListItem.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.PageBlock.pageBlockList(items: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.PageBlock.pageBlockList(items: _1!)
}
public static func parse_pageBlockMap(_ reader: BufferReader) -> PageBlock? {
var _1: Api.GeoPoint?
@@ -897,12 +842,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.PageBlock.pageBlockMap(geo: _1!, zoom: _2!, w: _3!, h: _4!, caption: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.PageBlock.pageBlockMap(geo: _1!, zoom: _2!, w: _3!, h: _4!, caption: _5!)
}
public static func parse_pageBlockOrderedList(_ reader: BufferReader) -> PageBlock? {
var _1: [Api.PageListOrderedItem]?
@@ -910,12 +855,8 @@ public extension Api {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PageListOrderedItem.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.PageBlock.pageBlockOrderedList(items: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.PageBlock.pageBlockOrderedList(items: _1!)
}
public static func parse_pageBlockParagraph(_ reader: BufferReader) -> PageBlock? {
var _1: Api.RichText?
@@ -923,12 +864,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.RichText
}
let _c1 = _1 != nil
- if _c1 {
- return Api.PageBlock.pageBlockParagraph(text: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.PageBlock.pageBlockParagraph(text: _1!)
}
public static func parse_pageBlockPhoto(_ reader: BufferReader) -> PageBlock? {
var _1: Int32?
@@ -948,12 +885,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.PageBlock.pageBlockPhoto(flags: _1!, photoId: _2!, caption: _3!, url: _4, webpageId: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.PageBlock.pageBlockPhoto(flags: _1!, photoId: _2!, caption: _3!, url: _4, webpageId: _5)
}
public static func parse_pageBlockPreformatted(_ reader: BufferReader) -> PageBlock? {
var _1: Api.RichText?
@@ -964,12 +901,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.PageBlock.pageBlockPreformatted(text: _1!, language: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.PageBlock.pageBlockPreformatted(text: _1!, language: _2!)
}
public static func parse_pageBlockPullquote(_ reader: BufferReader) -> PageBlock? {
var _1: Api.RichText?
@@ -982,12 +916,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.PageBlock.pageBlockPullquote(text: _1!, caption: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.PageBlock.pageBlockPullquote(text: _1!, caption: _2!)
}
public static func parse_pageBlockRelatedArticles(_ reader: BufferReader) -> PageBlock? {
var _1: Api.RichText?
@@ -1000,12 +931,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.PageBlock.pageBlockRelatedArticles(title: _1!, articles: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.PageBlock.pageBlockRelatedArticles(title: _1!, articles: _2!)
}
public static func parse_pageBlockSlideshow(_ reader: BufferReader) -> PageBlock? {
var _1: [Api.PageBlock]?
@@ -1018,12 +946,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.PageBlock.pageBlockSlideshow(items: _1!, caption: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.PageBlock.pageBlockSlideshow(items: _1!, caption: _2!)
}
public static func parse_pageBlockSubheader(_ reader: BufferReader) -> PageBlock? {
var _1: Api.RichText?
@@ -1031,12 +956,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.RichText
}
let _c1 = _1 != nil
- if _c1 {
- return Api.PageBlock.pageBlockSubheader(text: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.PageBlock.pageBlockSubheader(text: _1!)
}
public static func parse_pageBlockSubtitle(_ reader: BufferReader) -> PageBlock? {
var _1: Api.RichText?
@@ -1044,12 +965,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.RichText
}
let _c1 = _1 != nil
- if _c1 {
- return Api.PageBlock.pageBlockSubtitle(text: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.PageBlock.pageBlockSubtitle(text: _1!)
}
public static func parse_pageBlockTable(_ reader: BufferReader) -> PageBlock? {
var _1: Int32?
@@ -1065,12 +982,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.PageBlock.pageBlockTable(flags: _1!, title: _2!, rows: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.PageBlock.pageBlockTable(flags: _1!, title: _2!, rows: _3!)
}
public static func parse_pageBlockTitle(_ reader: BufferReader) -> PageBlock? {
var _1: Api.RichText?
@@ -1078,12 +993,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.RichText
}
let _c1 = _1 != nil
- if _c1 {
- return Api.PageBlock.pageBlockTitle(text: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.PageBlock.pageBlockTitle(text: _1!)
}
public static func parse_pageBlockUnsupported(_ reader: BufferReader) -> PageBlock? {
return Api.PageBlock.pageBlockUnsupported
@@ -1100,12 +1011,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.PageBlock.pageBlockVideo(flags: _1!, videoId: _2!, caption: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.PageBlock.pageBlockVideo(flags: _1!, videoId: _2!, caption: _3!)
}
}
diff --git a/submodules/TelegramApi/Sources/Api19.swift b/submodules/TelegramApi/Sources/Api19.swift
index 2cb2a538..76f9fd8e 100644
--- a/submodules/TelegramApi/Sources/Api19.swift
+++ b/submodules/TelegramApi/Sources/Api19.swift
@@ -32,12 +32,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.PageCaption.pageCaption(text: _1!, credit: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.PageCaption.pageCaption(text: _1!, credit: _2!)
}
}
@@ -83,12 +80,8 @@ public extension Api {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PageBlock.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.PageListItem.pageListItemBlocks(blocks: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.PageListItem.pageListItemBlocks(blocks: _1!)
}
public static func parse_pageListItemText(_ reader: BufferReader) -> PageListItem? {
var _1: Api.RichText?
@@ -96,12 +89,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.RichText
}
let _c1 = _1 != nil
- if _c1 {
- return Api.PageListItem.pageListItemText(text: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.PageListItem.pageListItemText(text: _1!)
}
}
@@ -152,12 +141,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.PageListOrderedItem.pageListOrderedItemBlocks(num: _1!, blocks: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.PageListOrderedItem.pageListOrderedItemBlocks(num: _1!, blocks: _2!)
}
public static func parse_pageListOrderedItemText(_ reader: BufferReader) -> PageListOrderedItem? {
var _1: String?
@@ -168,12 +154,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.PageListOrderedItem.pageListOrderedItemText(num: _1!, text: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.PageListOrderedItem.pageListOrderedItemText(num: _1!, text: _2!)
}
}
@@ -232,12 +215,15 @@ public extension Api {
let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 3) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 4) == 0) || _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.PageRelatedArticle.pageRelatedArticle(flags: _1!, url: _2!, webpageId: _3!, title: _4, description: _5, photoId: _6, author: _7, publishedDate: _8)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.PageRelatedArticle.pageRelatedArticle(flags: _1!, url: _2!, webpageId: _3!, title: _4, description: _5, photoId: _6, author: _7, publishedDate: _8)
}
}
@@ -282,12 +268,11 @@ public extension Api {
let _c2 = (Int(_1!) & Int(1 << 7) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.PageTableCell.pageTableCell(flags: _1!, text: _2, colspan: _3, rowspan: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.PageTableCell.pageTableCell(flags: _1!, text: _2, colspan: _3, rowspan: _4)
}
}
@@ -324,12 +309,8 @@ public extension Api {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PageTableCell.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.PageTableRow.pageTableRow(cells: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.PageTableRow.pageTableRow(cells: _1!)
}
}
@@ -386,12 +367,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
}
let _c1 = _1 != nil
- if _c1 {
- return Api.PaidReactionPrivacy.paidReactionPrivacyPeer(peer: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.PaidReactionPrivacy.paidReactionPrivacyPeer(peer: _1!)
}
}
@@ -442,12 +419,13 @@ public extension Api {
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.Passkey.passkey(flags: _1!, id: _2!, name: _3!, date: _4!, softwareEmojiId: _5, lastUsageDate: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.Passkey.passkey(flags: _1!, id: _2!, name: _3!, date: _4!, softwareEmojiId: _5, lastUsageDate: _6)
}
}
@@ -499,12 +477,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.PasswordKdfAlgo.passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow(salt1: _1!, salt2: _2!, g: _3!, p: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.PasswordKdfAlgo.passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow(salt1: _1!, salt2: _2!, g: _3!, p: _4!)
}
public static func parse_passwordKdfAlgoUnknown(_ reader: BufferReader) -> PasswordKdfAlgo? {
return Api.PasswordKdfAlgo.passwordKdfAlgoUnknown
@@ -542,12 +519,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.PaymentCharge.paymentCharge(id: _1!, providerChargeId: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.PaymentCharge.paymentCharge(id: _1!, providerChargeId: _2!)
}
}
@@ -582,12 +556,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.PaymentFormMethod.paymentFormMethod(url: _1!, title: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.PaymentFormMethod.paymentFormMethod(url: _1!, title: _2!)
}
}
@@ -636,12 +607,12 @@ public extension Api {
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.PaymentRequestedInfo.paymentRequestedInfo(flags: _1!, name: _2, phone: _3, email: _4, shippingAddress: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.PaymentRequestedInfo.paymentRequestedInfo(flags: _1!, name: _2, phone: _3, email: _4, shippingAddress: _5)
}
}
@@ -676,12 +647,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.PaymentSavedCredentials.paymentSavedCredentialsCard(id: _1!, title: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.PaymentSavedCredentials.paymentSavedCredentialsCard(id: _1!, title: _2!)
}
}
@@ -730,34 +698,22 @@ public extension Api {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
- if _c1 {
- return Api.Peer.peerChannel(channelId: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Peer.peerChannel(channelId: _1!)
}
public static func parse_peerChat(_ reader: BufferReader) -> Peer? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
- if _c1 {
- return Api.Peer.peerChat(chatId: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Peer.peerChat(chatId: _1!)
}
public static func parse_peerUser(_ reader: BufferReader) -> Peer? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
- if _c1 {
- return Api.Peer.peerUser(userId: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Peer.peerUser(userId: _1!)
}
}
@@ -794,12 +750,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.PeerBlocked.peerBlocked(peerId: _1!, date: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.PeerBlocked.peerBlocked(peerId: _1!, date: _2!)
}
}
@@ -865,12 +818,8 @@ public extension Api {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
- if _c1 {
- return Api.PeerColor.inputPeerColorCollectible(collectibleId: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.PeerColor.inputPeerColorCollectible(collectibleId: _1!)
}
public static func parse_peerColor(_ reader: BufferReader) -> PeerColor? {
var _1: Int32?
@@ -882,12 +831,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.PeerColor.peerColor(flags: _1!, color: _2, backgroundEmojiId: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.PeerColor.peerColor(flags: _1!, color: _2, backgroundEmojiId: _3)
}
public static func parse_peerColorCollectible(_ reader: BufferReader) -> PeerColor? {
var _1: Int32?
@@ -918,12 +865,15 @@ public extension Api {
let _c6 = _6 != nil
let _c7 = (Int(_1!) & Int(1 << 0) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 1) == 0) || _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.PeerColor.peerColorCollectible(flags: _1!, collectibleId: _2!, giftEmojiId: _3!, backgroundEmojiId: _4!, accentColor: _5!, colors: _6!, darkAccentColor: _7, darkColors: _8)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.PeerColor.peerColorCollectible(flags: _1!, collectibleId: _2!, giftEmojiId: _3!, backgroundEmojiId: _4!, accentColor: _5!, colors: _6!, darkAccentColor: _7, darkColors: _8)
}
}
@@ -973,23 +923,17 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.PeerLocated.peerLocated(peer: _1!, expires: _2!, distance: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.PeerLocated.peerLocated(peer: _1!, expires: _2!, distance: _3!)
}
public static func parse_peerSelfLocated(_ reader: BufferReader) -> PeerLocated? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.PeerLocated.peerSelfLocated(expires: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.PeerLocated.peerSelfLocated(expires: _1!)
}
}
@@ -1084,12 +1028,19 @@ public extension Api {
let _c10 = (Int(_1!) & Int(1 << 8) == 0) || _10 != nil
let _c11 = (Int(_1!) & Int(1 << 9) == 0) || _11 != nil
let _c12 = (Int(_1!) & Int(1 << 10) == 0) || _12 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 {
- return Api.PeerNotifySettings.peerNotifySettings(flags: _1!, showPreviews: _2, silent: _3, muteUntil: _4, iosSound: _5, androidSound: _6, otherSound: _7, storiesMuted: _8, storiesHideSender: _9, storiesIosSound: _10, storiesAndroidSound: _11, storiesOtherSound: _12)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ return Api.PeerNotifySettings.peerNotifySettings(flags: _1!, showPreviews: _2, silent: _3, muteUntil: _4, iosSound: _5, androidSound: _6, otherSound: _7, storiesMuted: _8, storiesHideSender: _9, storiesIosSound: _10, storiesAndroidSound: _11, storiesOtherSound: _12)
}
}
@@ -1160,12 +1111,18 @@ public extension Api {
let _c9 = (Int(_1!) & Int(1 << 16) == 0) || _9 != nil
let _c10 = (Int(_1!) & Int(1 << 17) == 0) || _10 != nil
let _c11 = (Int(_1!) & Int(1 << 18) == 0) || _11 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 {
- return Api.PeerSettings.peerSettings(flags: _1!, geoDistance: _2, requestChatTitle: _3, requestChatDate: _4, businessBotId: _5, businessBotManageUrl: _6, chargePaidMessageStars: _7, registrationMonth: _8, phoneCountry: _9, nameChangeDate: _10, photoChangeDate: _11)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ return Api.PeerSettings.peerSettings(flags: _1!, geoDistance: _2, requestChatTitle: _3, requestChatDate: _4, businessBotId: _5, businessBotManageUrl: _6, chargePaidMessageStars: _7, registrationMonth: _8, phoneCountry: _9, nameChangeDate: _10, photoChangeDate: _11)
}
}
@@ -1216,12 +1173,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.PeerStories.peerStories(flags: _1!, peer: _2!, maxReadId: _3, stories: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.PeerStories.peerStories(flags: _1!, peer: _2!, maxReadId: _3, stories: _4!)
}
}
@@ -1268,12 +1224,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.PendingSuggestion.pendingSuggestion(suggestion: _1!, title: _2!, description: _3!, url: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.PendingSuggestion.pendingSuggestion(suggestion: _1!, title: _2!, description: _3!, url: _4!)
}
}
@@ -1427,12 +1382,19 @@ public extension Api {
let _c10 = _10 != nil
let _c11 = _11 != nil
let _c12 = (Int(_1!) & Int(1 << 7) == 0) || _12 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 {
- return Api.PhoneCall.phoneCall(flags: _1!, id: _2!, accessHash: _3!, date: _4!, adminId: _5!, participantId: _6!, gAOrB: _7!, keyFingerprint: _8!, protocol: _9!, connections: _10!, startDate: _11!, customParameters: _12)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ return Api.PhoneCall.phoneCall(flags: _1!, id: _2!, accessHash: _3!, date: _4!, adminId: _5!, participantId: _6!, gAOrB: _7!, keyFingerprint: _8!, protocol: _9!, connections: _10!, startDate: _11!, customParameters: _12)
}
public static func parse_phoneCallAccepted(_ reader: BufferReader) -> PhoneCall? {
var _1: Int32?
@@ -1461,12 +1423,15 @@ public extension Api {
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.PhoneCall.phoneCallAccepted(flags: _1!, id: _2!, accessHash: _3!, date: _4!, adminId: _5!, participantId: _6!, gB: _7!, protocol: _8!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.PhoneCall.phoneCallAccepted(flags: _1!, id: _2!, accessHash: _3!, date: _4!, adminId: _5!, participantId: _6!, gB: _7!, protocol: _8!)
}
public static func parse_phoneCallDiscarded(_ reader: BufferReader) -> PhoneCall? {
var _1: Int32?
@@ -1483,23 +1448,18 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.PhoneCall.phoneCallDiscarded(flags: _1!, id: _2!, reason: _3, duration: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.PhoneCall.phoneCallDiscarded(flags: _1!, id: _2!, reason: _3, duration: _4)
}
public static func parse_phoneCallEmpty(_ reader: BufferReader) -> PhoneCall? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
- if _c1 {
- return Api.PhoneCall.phoneCallEmpty(id: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.PhoneCall.phoneCallEmpty(id: _1!)
}
public static func parse_phoneCallRequested(_ reader: BufferReader) -> PhoneCall? {
var _1: Int32?
@@ -1528,12 +1488,15 @@ public extension Api {
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.PhoneCall.phoneCallRequested(flags: _1!, id: _2!, accessHash: _3!, date: _4!, adminId: _5!, participantId: _6!, gAHash: _7!, protocol: _8!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.PhoneCall.phoneCallRequested(flags: _1!, id: _2!, accessHash: _3!, date: _4!, adminId: _5!, participantId: _6!, gAHash: _7!, protocol: _8!)
}
public static func parse_phoneCallWaiting(_ reader: BufferReader) -> PhoneCall? {
var _1: Int32?
@@ -1562,12 +1525,15 @@ public extension Api {
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = (Int(_1!) & Int(1 << 0) == 0) || _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.PhoneCall.phoneCallWaiting(flags: _1!, id: _2!, accessHash: _3!, date: _4!, adminId: _5!, participantId: _6!, protocol: _7!, receiveDate: _8)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.PhoneCall.phoneCallWaiting(flags: _1!, id: _2!, accessHash: _3!, date: _4!, adminId: _5!, participantId: _6!, protocol: _7!, receiveDate: _8)
}
}
diff --git a/submodules/TelegramApi/Sources/Api2.swift b/submodules/TelegramApi/Sources/Api2.swift
index 2c7da602..3bc728b1 100644
--- a/submodules/TelegramApi/Sources/Api2.swift
+++ b/submodules/TelegramApi/Sources/Api2.swift
@@ -46,12 +46,13 @@ public extension Api {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.BotBusinessConnection.botBusinessConnection(flags: _1!, connectionId: _2!, userId: _3!, dcId: _4!, date: _5!, rights: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.BotBusinessConnection.botBusinessConnection(flags: _1!, connectionId: _2!, userId: _3!, dcId: _4!, date: _5!, rights: _6)
}
}
@@ -86,12 +87,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.BotCommand.botCommand(command: _1!, description: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.BotCommand.botCommand(command: _1!, description: _2!)
}
}
@@ -188,12 +186,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
}
let _c1 = _1 != nil
- if _c1 {
- return Api.BotCommandScope.botCommandScopePeer(peer: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.BotCommandScope.botCommandScopePeer(peer: _1!)
}
public static func parse_botCommandScopePeerAdmins(_ reader: BufferReader) -> BotCommandScope? {
var _1: Api.InputPeer?
@@ -201,12 +195,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
}
let _c1 = _1 != nil
- if _c1 {
- return Api.BotCommandScope.botCommandScopePeerAdmins(peer: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.BotCommandScope.botCommandScopePeerAdmins(peer: _1!)
}
public static func parse_botCommandScopePeerUser(_ reader: BufferReader) -> BotCommandScope? {
var _1: Api.InputPeer?
@@ -219,12 +209,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.BotCommandScope.botCommandScopePeerUser(peer: _1!, userId: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.BotCommandScope.botCommandScopePeerUser(peer: _1!, userId: _2!)
}
public static func parse_botCommandScopeUsers(_ reader: BufferReader) -> BotCommandScope? {
return Api.BotCommandScope.botCommandScopeUsers
@@ -310,12 +297,17 @@ public extension Api {
let _c8 = (Int(_1!) & Int(1 << 7) == 0) || _8 != nil
let _c9 = (Int(_1!) & Int(1 << 8) == 0) || _9 != nil
let _c10 = (Int(_1!) & Int(1 << 9) == 0) || _10 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 {
- return Api.BotInfo.botInfo(flags: _1!, userId: _2, description: _3, descriptionPhoto: _4, descriptionDocument: _5, commands: _6, menuButton: _7, privacyPolicyUrl: _8, appSettings: _9, verifierSettings: _10)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ return Api.BotInfo.botInfo(flags: _1!, userId: _2, description: _3, descriptionPhoto: _4, descriptionDocument: _5, commands: _6, menuButton: _7, privacyPolicyUrl: _8, appSettings: _9, verifierSettings: _10)
}
}
@@ -458,12 +450,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.BotInlineMessage.botInlineMessageMediaAuto(flags: _1!, message: _2!, entities: _3, replyMarkup: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.BotInlineMessage.botInlineMessageMediaAuto(flags: _1!, message: _2!, entities: _3, replyMarkup: _4)
}
public static func parse_botInlineMessageMediaContact(_ reader: BufferReader) -> BotInlineMessage? {
var _1: Int32?
@@ -486,12 +477,13 @@ public extension Api {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.BotInlineMessage.botInlineMessageMediaContact(flags: _1!, phoneNumber: _2!, firstName: _3!, lastName: _4!, vcard: _5!, replyMarkup: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.BotInlineMessage.botInlineMessageMediaContact(flags: _1!, phoneNumber: _2!, firstName: _3!, lastName: _4!, vcard: _5!, replyMarkup: _6)
}
public static func parse_botInlineMessageMediaGeo(_ reader: BufferReader) -> BotInlineMessage? {
var _1: Int32?
@@ -516,12 +508,13 @@ public extension Api {
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.BotInlineMessage.botInlineMessageMediaGeo(flags: _1!, geo: _2!, heading: _3, period: _4, proximityNotificationRadius: _5, replyMarkup: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.BotInlineMessage.botInlineMessageMediaGeo(flags: _1!, geo: _2!, heading: _3, period: _4, proximityNotificationRadius: _5, replyMarkup: _6)
}
public static func parse_botInlineMessageMediaInvoice(_ reader: BufferReader) -> BotInlineMessage? {
var _1: Int32?
@@ -549,12 +542,14 @@ public extension Api {
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = (Int(_1!) & Int(1 << 2) == 0) || _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.BotInlineMessage.botInlineMessageMediaInvoice(flags: _1!, title: _2!, description: _3!, photo: _4, currency: _5!, totalAmount: _6!, replyMarkup: _7)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.BotInlineMessage.botInlineMessageMediaInvoice(flags: _1!, title: _2!, description: _3!, photo: _4, currency: _5!, totalAmount: _6!, replyMarkup: _7)
}
public static func parse_botInlineMessageMediaVenue(_ reader: BufferReader) -> BotInlineMessage? {
var _1: Int32?
@@ -585,12 +580,15 @@ public extension Api {
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = (Int(_1!) & Int(1 << 2) == 0) || _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.BotInlineMessage.botInlineMessageMediaVenue(flags: _1!, geo: _2!, title: _3!, address: _4!, provider: _5!, venueId: _6!, venueType: _7!, replyMarkup: _8)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.BotInlineMessage.botInlineMessageMediaVenue(flags: _1!, geo: _2!, title: _3!, address: _4!, provider: _5!, venueId: _6!, venueType: _7!, replyMarkup: _8)
}
public static func parse_botInlineMessageMediaWebPage(_ reader: BufferReader) -> BotInlineMessage? {
var _1: Int32?
@@ -612,12 +610,12 @@ public extension Api {
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.BotInlineMessage.botInlineMessageMediaWebPage(flags: _1!, message: _2!, entities: _3, url: _4!, replyMarkup: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.BotInlineMessage.botInlineMessageMediaWebPage(flags: _1!, message: _2!, entities: _3, url: _4!, replyMarkup: _5)
}
public static func parse_botInlineMessageText(_ reader: BufferReader) -> BotInlineMessage? {
var _1: Int32?
@@ -636,12 +634,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.BotInlineMessage.botInlineMessageText(flags: _1!, message: _2!, entities: _3, replyMarkup: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.BotInlineMessage.botInlineMessageText(flags: _1!, message: _2!, entities: _3, replyMarkup: _4)
}
}
@@ -723,12 +720,15 @@ public extension Api {
let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 3) == 0) || _7 != nil
let _c8 = _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.BotInlineResult.botInlineMediaResult(flags: _1!, id: _2!, type: _3!, photo: _4, document: _5, title: _6, description: _7, sendMessage: _8!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.BotInlineResult.botInlineMediaResult(flags: _1!, id: _2!, type: _3!, photo: _4, document: _5, title: _6, description: _7, sendMessage: _8!)
}
public static func parse_botInlineResult(_ reader: BufferReader) -> BotInlineResult? {
var _1: Int32?
@@ -764,12 +764,16 @@ public extension Api {
let _c7 = (Int(_1!) & Int(1 << 4) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 5) == 0) || _8 != nil
let _c9 = _9 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
- return Api.BotInlineResult.botInlineResult(flags: _1!, id: _2!, type: _3!, title: _4, description: _5, url: _6, thumb: _7, content: _8, sendMessage: _9!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ return Api.BotInlineResult.botInlineResult(flags: _1!, id: _2!, type: _3!, title: _4, description: _5, url: _6, thumb: _7, content: _8, sendMessage: _9!)
}
}
@@ -822,12 +826,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.BotMenuButton.botMenuButton(text: _1!, url: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.BotMenuButton.botMenuButton(text: _1!, url: _2!)
}
public static func parse_botMenuButtonCommands(_ reader: BufferReader) -> BotMenuButton? {
return Api.BotMenuButton.botMenuButtonCommands
@@ -870,12 +871,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.BotPreviewMedia.botPreviewMedia(date: _1!, media: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.BotPreviewMedia.botPreviewMedia(date: _1!, media: _2!)
}
}
@@ -914,12 +912,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.BotVerification.botVerification(botId: _1!, icon: _2!, description: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.BotVerification.botVerification(botId: _1!, icon: _2!, description: _3!)
}
}
@@ -962,12 +958,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.BotVerifierSettings.botVerifierSettings(flags: _1!, icon: _2!, company: _3!, customDescription: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.BotVerifierSettings.botVerifierSettings(flags: _1!, icon: _2!, company: _3!, customDescription: _4)
}
}
@@ -1014,12 +1009,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.BusinessAwayMessage.businessAwayMessage(flags: _1!, shortcutId: _2!, schedule: _3!, recipients: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.BusinessAwayMessage.businessAwayMessage(flags: _1!, shortcutId: _2!, schedule: _3!, recipients: _4!)
}
}
@@ -1075,12 +1069,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.BusinessAwayMessageSchedule.businessAwayMessageScheduleCustom(startDate: _1!, endDate: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.BusinessAwayMessageSchedule.businessAwayMessageScheduleCustom(startDate: _1!, endDate: _2!)
}
public static func parse_businessAwayMessageScheduleOutsideWorkHours(_ reader: BufferReader) -> BusinessAwayMessageSchedule? {
return Api.BusinessAwayMessageSchedule.businessAwayMessageScheduleOutsideWorkHours
@@ -1134,12 +1125,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 4) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 6) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.BusinessBotRecipients.businessBotRecipients(flags: _1!, users: _2, excludeUsers: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.BusinessBotRecipients.businessBotRecipients(flags: _1!, users: _2, excludeUsers: _3)
}
}
@@ -1170,12 +1159,8 @@ public extension Api {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.BusinessBotRights.businessBotRights(flags: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.BusinessBotRights.businessBotRights(flags: _1!)
}
}
@@ -1232,12 +1217,13 @@ public extension Api {
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
let _c6 = _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.BusinessChatLink.businessChatLink(flags: _1!, link: _2!, message: _3!, entities: _4, title: _5, views: _6!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.BusinessChatLink.businessChatLink(flags: _1!, link: _2!, message: _3!, entities: _4, title: _5, views: _6!)
}
}
diff --git a/submodules/TelegramApi/Sources/Api20.swift b/submodules/TelegramApi/Sources/Api20.swift
index 27e9c338..fff136f0 100644
--- a/submodules/TelegramApi/Sources/Api20.swift
+++ b/submodules/TelegramApi/Sources/Api20.swift
@@ -69,12 +69,8 @@ public extension Api {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.PhoneCallDiscardReason.phoneCallDiscardReasonMigrateConferenceCall(slug: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.PhoneCallDiscardReason.phoneCallDiscardReasonMigrateConferenceCall(slug: _1!)
}
public static func parse_phoneCallDiscardReasonMissed(_ reader: BufferReader) -> PhoneCallDiscardReason? {
return Api.PhoneCallDiscardReason.phoneCallDiscardReasonMissed
@@ -126,12 +122,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.PhoneCallProtocol.phoneCallProtocol(flags: _1!, minLayer: _2!, maxLayer: _3!, libraryVersions: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.PhoneCallProtocol.phoneCallProtocol(flags: _1!, minLayer: _2!, maxLayer: _3!, libraryVersions: _4!)
}
}
@@ -197,12 +192,13 @@ public extension Api {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.PhoneConnection.phoneConnection(flags: _1!, id: _2!, ip: _3!, ipv6: _4!, port: _5!, peerTag: _6!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.PhoneConnection.phoneConnection(flags: _1!, id: _2!, ip: _3!, ipv6: _4!, port: _5!, peerTag: _6!)
}
public static func parse_phoneConnectionWebrtc(_ reader: BufferReader) -> PhoneConnection? {
var _1: Int32?
@@ -226,12 +222,14 @@ public extension Api {
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.PhoneConnection.phoneConnectionWebrtc(flags: _1!, id: _2!, ip: _3!, ipv6: _4!, port: _5!, username: _6!, password: _7!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.PhoneConnection.phoneConnectionWebrtc(flags: _1!, id: _2!, ip: _3!, ipv6: _4!, port: _5!, username: _6!, password: _7!)
}
}
@@ -311,23 +309,22 @@ public extension Api {
let _c6 = _6 != nil
let _c7 = (Int(_1!) & Int(1 << 1) == 0) || _7 != nil
let _c8 = _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.Photo.photo(flags: _1!, id: _2!, accessHash: _3!, fileReference: _4!, date: _5!, sizes: _6!, videoSizes: _7, dcId: _8!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.Photo.photo(flags: _1!, id: _2!, accessHash: _3!, fileReference: _4!, date: _5!, sizes: _6!, videoSizes: _7, dcId: _8!)
}
public static func parse_photoEmpty(_ reader: BufferReader) -> Photo? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
- if _c1 {
- return Api.Photo.photoEmpty(id: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Photo.photoEmpty(id: _1!)
}
}
@@ -427,12 +424,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.PhotoSize.photoCachedSize(type: _1!, w: _2!, h: _3!, bytes: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.PhotoSize.photoCachedSize(type: _1!, w: _2!, h: _3!, bytes: _4!)
}
public static func parse_photoPathSize(_ reader: BufferReader) -> PhotoSize? {
var _1: String?
@@ -441,12 +437,9 @@ public extension Api {
_2 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.PhotoSize.photoPathSize(type: _1!, bytes: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.PhotoSize.photoPathSize(type: _1!, bytes: _2!)
}
public static func parse_photoSize(_ reader: BufferReader) -> PhotoSize? {
var _1: String?
@@ -461,23 +454,18 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.PhotoSize.photoSize(type: _1!, w: _2!, h: _3!, size: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.PhotoSize.photoSize(type: _1!, w: _2!, h: _3!, size: _4!)
}
public static func parse_photoSizeEmpty(_ reader: BufferReader) -> PhotoSize? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.PhotoSize.photoSizeEmpty(type: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.PhotoSize.photoSizeEmpty(type: _1!)
}
public static func parse_photoSizeProgressive(_ reader: BufferReader) -> PhotoSize? {
var _1: String?
@@ -494,12 +482,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.PhotoSize.photoSizeProgressive(type: _1!, w: _2!, h: _3!, sizes: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.PhotoSize.photoSizeProgressive(type: _1!, w: _2!, h: _3!, sizes: _4!)
}
public static func parse_photoStrippedSize(_ reader: BufferReader) -> PhotoSize? {
var _1: String?
@@ -508,12 +495,9 @@ public extension Api {
_2 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.PhotoSize.photoStrippedSize(type: _1!, bytes: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.PhotoSize.photoStrippedSize(type: _1!, bytes: _2!)
}
}
@@ -572,12 +556,13 @@ public extension Api {
let _c4 = _4 != nil
let _c5 = (Int(_2!) & Int(1 << 4) == 0) || _5 != nil
let _c6 = (Int(_2!) & Int(1 << 5) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.Poll.poll(id: _1!, flags: _2!, question: _3!, answers: _4!, closePeriod: _5, closeDate: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.Poll.poll(id: _1!, flags: _2!, question: _3!, answers: _4!, closePeriod: _5, closeDate: _6)
}
}
@@ -614,12 +599,9 @@ public extension Api {
_2 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.PollAnswer.pollAnswer(text: _1!, option: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.PollAnswer.pollAnswer(text: _1!, option: _2!)
}
}
@@ -658,12 +640,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.PollAnswerVoters.pollAnswerVoters(flags: _1!, option: _2!, voters: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.PollAnswerVoters.pollAnswerVoters(flags: _1!, option: _2!, voters: _3!)
}
}
@@ -732,12 +712,13 @@ public extension Api {
let _c4 = (Int(_1!) & Int(1 << 3) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 4) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 4) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.PollResults.pollResults(flags: _1!, results: _2, totalVoters: _3, recentVoters: _4, solution: _5, solutionEntities: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.PollResults.pollResults(flags: _1!, results: _2, totalVoters: _3, recentVoters: _4, solution: _5, solutionEntities: _6)
}
}
@@ -772,12 +753,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.PopularContact.popularContact(clientId: _1!, importers: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.PopularContact.popularContact(clientId: _1!, importers: _2!)
}
}
@@ -828,12 +806,13 @@ public extension Api {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.PostAddress.postAddress(streetLine1: _1!, streetLine2: _2!, city: _3!, state: _4!, countryIso2: _5!, postCode: _6!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.PostAddress.postAddress(streetLine1: _1!, streetLine2: _2!, city: _3!, state: _4!, countryIso2: _5!, postCode: _6!)
}
}
@@ -888,12 +867,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.PostInteractionCounters.postInteractionCountersMessage(msgId: _1!, views: _2!, forwards: _3!, reactions: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.PostInteractionCounters.postInteractionCountersMessage(msgId: _1!, views: _2!, forwards: _3!, reactions: _4!)
}
public static func parse_postInteractionCountersStory(_ reader: BufferReader) -> PostInteractionCounters? {
var _1: Int32?
@@ -908,12 +886,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.PostInteractionCounters.postInteractionCountersStory(storyId: _1!, views: _2!, forwards: _3!, reactions: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.PostInteractionCounters.postInteractionCountersStory(storyId: _1!, views: _2!, forwards: _3!, reactions: _4!)
}
}
@@ -968,12 +945,14 @@ public extension Api {
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.PremiumGiftCodeOption.premiumGiftCodeOption(flags: _1!, users: _2!, months: _3!, storeProduct: _4, storeQuantity: _5, currency: _6!, amount: _7!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.PremiumGiftCodeOption.premiumGiftCodeOption(flags: _1!, users: _2!, months: _3!, storeProduct: _4, storeQuantity: _5, currency: _6!, amount: _7!)
}
}
@@ -1028,12 +1007,14 @@ public extension Api {
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = (Int(_1!) & Int(1 << 0) == 0) || _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.PremiumSubscriptionOption.premiumSubscriptionOption(flags: _1!, transaction: _2, months: _3!, currency: _4!, amount: _5!, botUrl: _6!, storeProduct: _7)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.PremiumSubscriptionOption.premiumSubscriptionOption(flags: _1!, transaction: _2, months: _3!, currency: _4!, amount: _5!, botUrl: _6!, storeProduct: _7)
}
}
@@ -1089,12 +1070,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.PrepaidGiveaway.prepaidGiveaway(id: _1!, months: _2!, quantity: _3!, date: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.PrepaidGiveaway.prepaidGiveaway(id: _1!, months: _2!, quantity: _3!, date: _4!)
}
public static func parse_prepaidStarsGiveaway(_ reader: BufferReader) -> PrepaidGiveaway? {
var _1: Int64?
@@ -1112,12 +1092,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.PrepaidGiveaway.prepaidStarsGiveaway(id: _1!, stars: _2!, quantity: _3!, boosts: _4!, date: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.PrepaidGiveaway.prepaidStarsGiveaway(id: _1!, stars: _2!, quantity: _3!, boosts: _4!, date: _5!)
}
}
diff --git a/submodules/TelegramApi/Sources/Api21.swift b/submodules/TelegramApi/Sources/Api21.swift
index 9d4e9060..a40db16a 100644
--- a/submodules/TelegramApi/Sources/Api21.swift
+++ b/submodules/TelegramApi/Sources/Api21.swift
@@ -147,12 +147,8 @@ public extension Api {
_1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.PrivacyRule.privacyValueAllowChatParticipants(chats: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.PrivacyRule.privacyValueAllowChatParticipants(chats: _1!)
}
public static func parse_privacyValueAllowCloseFriends(_ reader: BufferReader) -> PrivacyRule? {
return Api.PrivacyRule.privacyValueAllowCloseFriends
@@ -169,12 +165,8 @@ public extension Api {
_1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.PrivacyRule.privacyValueAllowUsers(users: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.PrivacyRule.privacyValueAllowUsers(users: _1!)
}
public static func parse_privacyValueDisallowAll(_ reader: BufferReader) -> PrivacyRule? {
return Api.PrivacyRule.privacyValueDisallowAll
@@ -188,12 +180,8 @@ public extension Api {
_1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.PrivacyRule.privacyValueDisallowChatParticipants(chats: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.PrivacyRule.privacyValueDisallowChatParticipants(chats: _1!)
}
public static func parse_privacyValueDisallowContacts(_ reader: BufferReader) -> PrivacyRule? {
return Api.PrivacyRule.privacyValueDisallowContacts
@@ -204,12 +192,8 @@ public extension Api {
_1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.PrivacyRule.privacyValueDisallowUsers(users: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.PrivacyRule.privacyValueDisallowUsers(users: _1!)
}
}
@@ -364,12 +348,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.Message
}
let _c1 = _1 != nil
- if _c1 {
- return Api.PublicForward.publicForwardMessage(message: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.PublicForward.publicForwardMessage(message: _1!)
}
public static func parse_publicForwardStory(_ reader: BufferReader) -> PublicForward? {
var _1: Api.Peer?
@@ -382,12 +362,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.PublicForward.publicForwardStory(peer: _1!, story: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.PublicForward.publicForwardStory(peer: _1!, story: _2!)
}
}
@@ -430,12 +407,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.QuickReply.quickReply(shortcutId: _1!, shortcut: _2!, topMessage: _3!, count: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.QuickReply.quickReply(shortcutId: _1!, shortcut: _2!, topMessage: _3!, count: _4!)
}
}
@@ -493,23 +469,15 @@ public extension Api {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
- if _c1 {
- return Api.Reaction.reactionCustomEmoji(documentId: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Reaction.reactionCustomEmoji(documentId: _1!)
}
public static func parse_reactionEmoji(_ reader: BufferReader) -> Reaction? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.Reaction.reactionEmoji(emoticon: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Reaction.reactionEmoji(emoticon: _1!)
}
public static func parse_reactionEmpty(_ reader: BufferReader) -> Reaction? {
return Api.Reaction.reactionEmpty
@@ -560,12 +528,11 @@ public extension Api {
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.ReactionCount.reactionCount(flags: _1!, chosenOrder: _2, reaction: _3!, count: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.ReactionCount.reactionCount(flags: _1!, chosenOrder: _2, reaction: _3!, count: _4!)
}
}
@@ -660,12 +627,12 @@ public extension Api {
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.ReactionsNotifySettings.reactionsNotifySettings(flags: _1!, messagesNotifyFrom: _2, storiesNotifyFrom: _3, sound: _4!, showPreviews: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.ReactionsNotifySettings.reactionsNotifySettings(flags: _1!, messagesNotifyFrom: _2, storiesNotifyFrom: _3, sound: _4!, showPreviews: _5!)
}
}
@@ -700,12 +667,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ReadParticipantDate.readParticipantDate(userId: _1!, date: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ReadParticipantDate.readParticipantDate(userId: _1!, date: _2!)
}
}
diff --git a/submodules/TelegramApi/Sources/Api22.swift b/submodules/TelegramApi/Sources/Api22.swift
index db61ed18..31bf060e 100644
--- a/submodules/TelegramApi/Sources/Api22.swift
+++ b/submodules/TelegramApi/Sources/Api22.swift
@@ -28,12 +28,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ReceivedNotifyMessage.receivedNotifyMessage(id: _1!, flags: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ReceivedNotifyMessage.receivedNotifyMessage(id: _1!, flags: _2!)
}
}
@@ -107,12 +104,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.RecentMeUrl.recentMeUrlChat(url: _1!, chatId: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.RecentMeUrl.recentMeUrlChat(url: _1!, chatId: _2!)
}
public static func parse_recentMeUrlChatInvite(_ reader: BufferReader) -> RecentMeUrl? {
var _1: String?
@@ -123,12 +117,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.RecentMeUrl.recentMeUrlChatInvite(url: _1!, chatInvite: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.RecentMeUrl.recentMeUrlChatInvite(url: _1!, chatInvite: _2!)
}
public static func parse_recentMeUrlStickerSet(_ reader: BufferReader) -> RecentMeUrl? {
var _1: String?
@@ -139,23 +130,16 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.RecentMeUrl.recentMeUrlStickerSet(url: _1!, set: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.RecentMeUrl.recentMeUrlStickerSet(url: _1!, set: _2!)
}
public static func parse_recentMeUrlUnknown(_ reader: BufferReader) -> RecentMeUrl? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.RecentMeUrl.recentMeUrlUnknown(url: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.RecentMeUrl.recentMeUrlUnknown(url: _1!)
}
public static func parse_recentMeUrlUser(_ reader: BufferReader) -> RecentMeUrl? {
var _1: String?
@@ -164,12 +148,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.RecentMeUrl.recentMeUrlUser(url: _1!, userId: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.RecentMeUrl.recentMeUrlUser(url: _1!, userId: _2!)
}
}
@@ -204,12 +185,9 @@ public extension Api {
if Int(_1!) & Int(1 << 1) != 0 {_2 = reader.readInt32() }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 1) == 0) || _2 != nil
- if _c1 && _c2 {
- return Api.RecentStory.recentStory(flags: _1!, maxId: _2)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.RecentStory.recentStory(flags: _1!, maxId: _2)
}
}
@@ -280,12 +258,8 @@ public extension Api {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.KeyboardButtonRow.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.ReplyMarkup.replyInlineMarkup(rows: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ReplyMarkup.replyInlineMarkup(rows: _1!)
}
public static func parse_replyKeyboardForceReply(_ reader: BufferReader) -> ReplyMarkup? {
var _1: Int32?
@@ -294,23 +268,16 @@ public extension Api {
if Int(_1!) & Int(1 << 3) != 0 {_2 = parseString(reader) }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 3) == 0) || _2 != nil
- if _c1 && _c2 {
- return Api.ReplyMarkup.replyKeyboardForceReply(flags: _1!, placeholder: _2)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ReplyMarkup.replyKeyboardForceReply(flags: _1!, placeholder: _2)
}
public static func parse_replyKeyboardHide(_ reader: BufferReader) -> ReplyMarkup? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.ReplyMarkup.replyKeyboardHide(flags: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ReplyMarkup.replyKeyboardHide(flags: _1!)
}
public static func parse_replyKeyboardMarkup(_ reader: BufferReader) -> ReplyMarkup? {
var _1: Int32?
@@ -324,12 +291,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 3) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.ReplyMarkup.replyKeyboardMarkup(flags: _1!, rows: _2!, placeholder: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.ReplyMarkup.replyKeyboardMarkup(flags: _1!, rows: _2!, placeholder: _3)
}
}
@@ -523,12 +488,9 @@ public extension Api {
_2 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ReportResult.reportResultAddComment(flags: _1!, option: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ReportResult.reportResultAddComment(flags: _1!, option: _2!)
}
public static func parse_reportResultChooseOption(_ reader: BufferReader) -> ReportResult? {
var _1: String?
@@ -539,12 +501,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ReportResult.reportResultChooseOption(title: _1!, options: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ReportResult.reportResultChooseOption(title: _1!, options: _2!)
}
public static func parse_reportResultReported(_ reader: BufferReader) -> ReportResult? {
return Api.ReportResult.reportResultReported
@@ -620,12 +579,11 @@ public extension Api {
let _c2 = (Int(_1!) & Int(1 << 3) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.RequestPeerType.requestPeerTypeBroadcast(flags: _1!, hasUsername: _2, userAdminRights: _3, botAdminRights: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.RequestPeerType.requestPeerTypeBroadcast(flags: _1!, hasUsername: _2, userAdminRights: _3, botAdminRights: _4)
}
public static func parse_requestPeerTypeChat(_ reader: BufferReader) -> RequestPeerType? {
var _1: Int32?
@@ -651,12 +609,12 @@ public extension Api {
let _c3 = (Int(_1!) & Int(1 << 4) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.RequestPeerType.requestPeerTypeChat(flags: _1!, hasUsername: _2, forum: _3, userAdminRights: _4, botAdminRights: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.RequestPeerType.requestPeerTypeChat(flags: _1!, hasUsername: _2, forum: _3, userAdminRights: _4, botAdminRights: _5)
}
public static func parse_requestPeerTypeUser(_ reader: BufferReader) -> RequestPeerType? {
var _1: Int32?
@@ -672,12 +630,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.RequestPeerType.requestPeerTypeUser(flags: _1!, bot: _2, premium: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.RequestPeerType.requestPeerTypeUser(flags: _1!, bot: _2, premium: _3)
}
}
@@ -752,12 +708,12 @@ public extension Api {
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.RequestedPeer.requestedPeerChannel(flags: _1!, channelId: _2!, title: _3, username: _4, photo: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.RequestedPeer.requestedPeerChannel(flags: _1!, channelId: _2!, title: _3, username: _4, photo: _5)
}
public static func parse_requestedPeerChat(_ reader: BufferReader) -> RequestedPeer? {
var _1: Int32?
@@ -774,12 +730,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.RequestedPeer.requestedPeerChat(flags: _1!, chatId: _2!, title: _3, photo: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.RequestedPeer.requestedPeerChat(flags: _1!, chatId: _2!, title: _3, photo: _4)
}
public static func parse_requestedPeerUser(_ reader: BufferReader) -> RequestedPeer? {
var _1: Int32?
@@ -802,12 +757,13 @@ public extension Api {
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.RequestedPeer.requestedPeerUser(flags: _1!, userId: _2!, firstName: _3, lastName: _4, username: _5, photo: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.RequestedPeer.requestedPeerUser(flags: _1!, userId: _2!, firstName: _3, lastName: _4, username: _5, photo: _6)
}
}
@@ -859,12 +815,8 @@ public extension Api {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
- if _c1 {
- return Api.RequirementToContact.requirementToContactPaidMessages(starsAmount: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.RequirementToContact.requirementToContactPaidMessages(starsAmount: _1!)
}
public static func parse_requirementToContactPremium(_ reader: BufferReader) -> RequirementToContact? {
return Api.RequirementToContact.requirementToContactPremium
diff --git a/submodules/TelegramApi/Sources/Api23.swift b/submodules/TelegramApi/Sources/Api23.swift
index de67bb1f..84004762 100644
--- a/submodules/TelegramApi/Sources/Api23.swift
+++ b/submodules/TelegramApi/Sources/Api23.swift
@@ -32,12 +32,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.RestrictionReason.restrictionReason(platform: _1!, reason: _2!, text: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.RestrictionReason.restrictionReason(platform: _1!, reason: _2!, text: _3!)
}
}
@@ -219,12 +217,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.RichText.textAnchor(text: _1!, name: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.RichText.textAnchor(text: _1!, name: _2!)
}
public static func parse_textBold(_ reader: BufferReader) -> RichText? {
var _1: Api.RichText?
@@ -232,12 +227,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.RichText
}
let _c1 = _1 != nil
- if _c1 {
- return Api.RichText.textBold(text: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.RichText.textBold(text: _1!)
}
public static func parse_textConcat(_ reader: BufferReader) -> RichText? {
var _1: [Api.RichText]?
@@ -245,12 +236,8 @@ public extension Api {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.RichText.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.RichText.textConcat(texts: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.RichText.textConcat(texts: _1!)
}
public static func parse_textEmail(_ reader: BufferReader) -> RichText? {
var _1: Api.RichText?
@@ -261,12 +248,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.RichText.textEmail(text: _1!, email: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.RichText.textEmail(text: _1!, email: _2!)
}
public static func parse_textEmpty(_ reader: BufferReader) -> RichText? {
return Api.RichText.textEmpty
@@ -277,12 +261,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.RichText
}
let _c1 = _1 != nil
- if _c1 {
- return Api.RichText.textFixed(text: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.RichText.textFixed(text: _1!)
}
public static func parse_textImage(_ reader: BufferReader) -> RichText? {
var _1: Int64?
@@ -294,12 +274,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.RichText.textImage(documentId: _1!, w: _2!, h: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.RichText.textImage(documentId: _1!, w: _2!, h: _3!)
}
public static func parse_textItalic(_ reader: BufferReader) -> RichText? {
var _1: Api.RichText?
@@ -307,12 +285,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.RichText
}
let _c1 = _1 != nil
- if _c1 {
- return Api.RichText.textItalic(text: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.RichText.textItalic(text: _1!)
}
public static func parse_textMarked(_ reader: BufferReader) -> RichText? {
var _1: Api.RichText?
@@ -320,12 +294,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.RichText
}
let _c1 = _1 != nil
- if _c1 {
- return Api.RichText.textMarked(text: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.RichText.textMarked(text: _1!)
}
public static func parse_textPhone(_ reader: BufferReader) -> RichText? {
var _1: Api.RichText?
@@ -336,23 +306,16 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.RichText.textPhone(text: _1!, phone: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.RichText.textPhone(text: _1!, phone: _2!)
}
public static func parse_textPlain(_ reader: BufferReader) -> RichText? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.RichText.textPlain(text: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.RichText.textPlain(text: _1!)
}
public static func parse_textStrike(_ reader: BufferReader) -> RichText? {
var _1: Api.RichText?
@@ -360,12 +323,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.RichText
}
let _c1 = _1 != nil
- if _c1 {
- return Api.RichText.textStrike(text: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.RichText.textStrike(text: _1!)
}
public static func parse_textSubscript(_ reader: BufferReader) -> RichText? {
var _1: Api.RichText?
@@ -373,12 +332,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.RichText
}
let _c1 = _1 != nil
- if _c1 {
- return Api.RichText.textSubscript(text: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.RichText.textSubscript(text: _1!)
}
public static func parse_textSuperscript(_ reader: BufferReader) -> RichText? {
var _1: Api.RichText?
@@ -386,12 +341,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.RichText
}
let _c1 = _1 != nil
- if _c1 {
- return Api.RichText.textSuperscript(text: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.RichText.textSuperscript(text: _1!)
}
public static func parse_textUnderline(_ reader: BufferReader) -> RichText? {
var _1: Api.RichText?
@@ -399,12 +350,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.RichText
}
let _c1 = _1 != nil
- if _c1 {
- return Api.RichText.textUnderline(text: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.RichText.textUnderline(text: _1!)
}
public static func parse_textUrl(_ reader: BufferReader) -> RichText? {
var _1: Api.RichText?
@@ -418,12 +365,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.RichText.textUrl(text: _1!, url: _2!, webpageId: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.RichText.textUrl(text: _1!, url: _2!, webpageId: _3!)
}
}
@@ -466,12 +411,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.SavedContact.savedPhoneContact(phone: _1!, firstName: _2!, lastName: _3!, date: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.SavedContact.savedPhoneContact(phone: _1!, firstName: _2!, lastName: _3!, date: _4!)
}
}
@@ -545,12 +489,15 @@ public extension Api {
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = (Int(_1!) & Int(1 << 1) == 0) || _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.SavedDialog.monoForumDialog(flags: _1!, peer: _2!, topMessage: _3!, readInboxMaxId: _4!, readOutboxMaxId: _5!, unreadCount: _6!, unreadReactionsCount: _7!, draft: _8)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.SavedDialog.monoForumDialog(flags: _1!, peer: _2!, topMessage: _3!, readInboxMaxId: _4!, readOutboxMaxId: _5!, unreadCount: _6!, unreadReactionsCount: _7!, draft: _8)
}
public static func parse_savedDialog(_ reader: BufferReader) -> SavedDialog? {
var _1: Int32?
@@ -564,12 +511,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.SavedDialog.savedDialog(flags: _1!, peer: _2!, topMessage: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.SavedDialog.savedDialog(flags: _1!, peer: _2!, topMessage: _3!)
}
}
@@ -614,12 +559,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.SavedReactionTag.savedReactionTag(flags: _1!, reaction: _2!, title: _3, count: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.SavedReactionTag.savedReactionTag(flags: _1!, reaction: _2!, title: _3, count: _4!)
}
}
@@ -726,12 +670,24 @@ public extension Api {
let _c15 = (Int(_1!) & Int(1 << 16) == 0) || _15 != nil
let _c16 = (Int(_1!) & Int(1 << 18) == 0) || _16 != nil
let _c17 = (Int(_1!) & Int(1 << 19) == 0) || _17 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 {
- return Api.SavedStarGift.savedStarGift(flags: _1!, fromId: _2, date: _3!, gift: _4!, message: _5, msgId: _6, savedId: _7, convertStars: _8, upgradeStars: _9, canExportAt: _10, transferStars: _11, canTransferAt: _12, canResellAt: _13, collectionId: _14, prepaidUpgradeHash: _15, dropOriginalDetailsStars: _16, giftNum: _17)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ if !_c13 { return nil }
+ if !_c14 { return nil }
+ if !_c15 { return nil }
+ if !_c16 { return nil }
+ if !_c17 { return nil }
+ return Api.SavedStarGift.savedStarGift(flags: _1!, fromId: _2, date: _3!, gift: _4!, message: _5, msgId: _6, savedId: _7, convertStars: _8, upgradeStars: _9, canExportAt: _10, transferStars: _11, canTransferAt: _12, canResellAt: _13, collectionId: _14, prepaidUpgradeHash: _15, dropOriginalDetailsStars: _16, giftNum: _17)
}
}
@@ -778,12 +734,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.SearchPostsFlood.searchPostsFlood(flags: _1!, totalDaily: _2!, remains: _3!, waitTill: _4, starsAmount: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.SearchPostsFlood.searchPostsFlood(flags: _1!, totalDaily: _2!, remains: _3!, waitTill: _4, starsAmount: _5!)
}
}
@@ -826,12 +782,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.SearchResultsCalendarPeriod.searchResultsCalendarPeriod(date: _1!, minMsgId: _2!, maxMsgId: _3!, count: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.SearchResultsCalendarPeriod.searchResultsCalendarPeriod(date: _1!, minMsgId: _2!, maxMsgId: _3!, count: _4!)
}
}
@@ -870,12 +825,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.SearchResultsPosition.searchResultPosition(msgId: _1!, date: _2!, offset: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.SearchResultsPosition.searchResultPosition(msgId: _1!, date: _2!, offset: _3!)
}
}
@@ -914,12 +867,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.SecureCredentialsEncrypted.secureCredentialsEncrypted(data: _1!, hash: _2!, secret: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.SecureCredentialsEncrypted.secureCredentialsEncrypted(data: _1!, hash: _2!, secret: _3!)
}
}
@@ -958,12 +909,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.SecureData.secureData(data: _1!, dataHash: _2!, secret: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.SecureData.secureData(data: _1!, dataHash: _2!, secret: _3!)
}
}
@@ -1027,12 +976,14 @@ public extension Api {
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.SecureFile.secureFile(id: _1!, accessHash: _2!, size: _3!, dcId: _4!, date: _5!, fileHash: _6!, secret: _7!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.SecureFile.secureFile(id: _1!, accessHash: _2!, size: _3!, dcId: _4!, date: _5!, fileHash: _6!, secret: _7!)
}
public static func parse_secureFileEmpty(_ reader: BufferReader) -> SecureFile? {
return Api.SecureFile.secureFileEmpty
@@ -1084,23 +1035,15 @@ public extension Api {
var _1: Buffer?
_1 = parseBytes(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.SecurePasswordKdfAlgo.securePasswordKdfAlgoPBKDF2HMACSHA512iter100000(salt: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.SecurePasswordKdfAlgo.securePasswordKdfAlgoPBKDF2HMACSHA512iter100000(salt: _1!)
}
public static func parse_securePasswordKdfAlgoSHA512(_ reader: BufferReader) -> SecurePasswordKdfAlgo? {
var _1: Buffer?
_1 = parseBytes(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.SecurePasswordKdfAlgo.securePasswordKdfAlgoSHA512(salt: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.SecurePasswordKdfAlgo.securePasswordKdfAlgoSHA512(salt: _1!)
}
public static func parse_securePasswordKdfAlgoUnknown(_ reader: BufferReader) -> SecurePasswordKdfAlgo? {
return Api.SecurePasswordKdfAlgo.securePasswordKdfAlgoUnknown
diff --git a/submodules/TelegramApi/Sources/Api24.swift b/submodules/TelegramApi/Sources/Api24.swift
index 22a2ae99..77fe9cc5 100644
--- a/submodules/TelegramApi/Sources/Api24.swift
+++ b/submodules/TelegramApi/Sources/Api24.swift
@@ -33,23 +33,15 @@ public extension Api {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.SecurePlainData.securePlainEmail(email: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.SecurePlainData.securePlainEmail(email: _1!)
}
public static func parse_securePlainPhone(_ reader: BufferReader) -> SecurePlainData? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.SecurePlainData.securePlainPhone(phone: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.SecurePlainData.securePlainPhone(phone: _1!)
}
}
@@ -99,12 +91,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.SecureRequiredType.secureRequiredType(flags: _1!, type: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.SecureRequiredType.secureRequiredType(flags: _1!, type: _2!)
}
public static func parse_secureRequiredTypeOneOf(_ reader: BufferReader) -> SecureRequiredType? {
var _1: [Api.SecureRequiredType]?
@@ -112,12 +101,8 @@ public extension Api {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SecureRequiredType.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.SecureRequiredType.secureRequiredTypeOneOf(types: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.SecureRequiredType.secureRequiredTypeOneOf(types: _1!)
}
}
@@ -158,12 +143,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.SecureSecretSettings.secureSecretSettings(secureAlgo: _1!, secureSecret: _2!, secureSecretId: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.SecureSecretSettings.secureSecretSettings(secureAlgo: _1!, secureSecret: _2!, secureSecretId: _3!)
}
}
@@ -254,12 +237,17 @@ public extension Api {
let _c8 = (Int(_1!) & Int(1 << 4) == 0) || _8 != nil
let _c9 = (Int(_1!) & Int(1 << 5) == 0) || _9 != nil
let _c10 = _10 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 {
- return Api.SecureValue.secureValue(flags: _1!, type: _2!, data: _3, frontSide: _4, reverseSide: _5, selfie: _6, translation: _7, files: _8, plainData: _9, hash: _10!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ return Api.SecureValue.secureValue(flags: _1!, type: _2!, data: _3, frontSide: _4, reverseSide: _5, selfie: _6, translation: _7, files: _8, plainData: _9, hash: _10!)
}
}
@@ -397,12 +385,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.SecureValueError.secureValueError(type: _1!, hash: _2!, text: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.SecureValueError.secureValueError(type: _1!, hash: _2!, text: _3!)
}
public static func parse_secureValueErrorData(_ reader: BufferReader) -> SecureValueError? {
var _1: Api.SecureValueType?
@@ -419,12 +405,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.SecureValueError.secureValueErrorData(type: _1!, dataHash: _2!, field: _3!, text: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.SecureValueError.secureValueErrorData(type: _1!, dataHash: _2!, field: _3!, text: _4!)
}
public static func parse_secureValueErrorFile(_ reader: BufferReader) -> SecureValueError? {
var _1: Api.SecureValueType?
@@ -438,12 +423,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.SecureValueError.secureValueErrorFile(type: _1!, fileHash: _2!, text: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.SecureValueError.secureValueErrorFile(type: _1!, fileHash: _2!, text: _3!)
}
public static func parse_secureValueErrorFiles(_ reader: BufferReader) -> SecureValueError? {
var _1: Api.SecureValueType?
@@ -459,12 +442,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.SecureValueError.secureValueErrorFiles(type: _1!, fileHash: _2!, text: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.SecureValueError.secureValueErrorFiles(type: _1!, fileHash: _2!, text: _3!)
}
public static func parse_secureValueErrorFrontSide(_ reader: BufferReader) -> SecureValueError? {
var _1: Api.SecureValueType?
@@ -478,12 +459,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.SecureValueError.secureValueErrorFrontSide(type: _1!, fileHash: _2!, text: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.SecureValueError.secureValueErrorFrontSide(type: _1!, fileHash: _2!, text: _3!)
}
public static func parse_secureValueErrorReverseSide(_ reader: BufferReader) -> SecureValueError? {
var _1: Api.SecureValueType?
@@ -497,12 +476,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.SecureValueError.secureValueErrorReverseSide(type: _1!, fileHash: _2!, text: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.SecureValueError.secureValueErrorReverseSide(type: _1!, fileHash: _2!, text: _3!)
}
public static func parse_secureValueErrorSelfie(_ reader: BufferReader) -> SecureValueError? {
var _1: Api.SecureValueType?
@@ -516,12 +493,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.SecureValueError.secureValueErrorSelfie(type: _1!, fileHash: _2!, text: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.SecureValueError.secureValueErrorSelfie(type: _1!, fileHash: _2!, text: _3!)
}
public static func parse_secureValueErrorTranslationFile(_ reader: BufferReader) -> SecureValueError? {
var _1: Api.SecureValueType?
@@ -535,12 +510,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.SecureValueError.secureValueErrorTranslationFile(type: _1!, fileHash: _2!, text: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.SecureValueError.secureValueErrorTranslationFile(type: _1!, fileHash: _2!, text: _3!)
}
public static func parse_secureValueErrorTranslationFiles(_ reader: BufferReader) -> SecureValueError? {
var _1: Api.SecureValueType?
@@ -556,12 +529,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.SecureValueError.secureValueErrorTranslationFiles(type: _1!, fileHash: _2!, text: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.SecureValueError.secureValueErrorTranslationFiles(type: _1!, fileHash: _2!, text: _3!)
}
}
@@ -598,12 +569,9 @@ public extension Api {
_2 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.SecureValueHash.secureValueHash(type: _1!, hash: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.SecureValueHash.secureValueHash(type: _1!, hash: _2!)
}
}
@@ -812,12 +780,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.SendAsPeer.sendAsPeer(flags: _1!, peer: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.SendAsPeer.sendAsPeer(flags: _1!, peer: _2!)
}
}
@@ -1030,23 +995,17 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.SendMessageAction.sendMessageEmojiInteraction(emoticon: _1!, msgId: _2!, interaction: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.SendMessageAction.sendMessageEmojiInteraction(emoticon: _1!, msgId: _2!, interaction: _3!)
}
public static func parse_sendMessageEmojiInteractionSeen(_ reader: BufferReader) -> SendMessageAction? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.SendMessageAction.sendMessageEmojiInteractionSeen(emoticon: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.SendMessageAction.sendMessageEmojiInteractionSeen(emoticon: _1!)
}
public static func parse_sendMessageGamePlayAction(_ reader: BufferReader) -> SendMessageAction? {
return Api.SendMessageAction.sendMessageGamePlayAction
@@ -1058,12 +1017,8 @@ public extension Api {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.SendMessageAction.sendMessageHistoryImportAction(progress: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.SendMessageAction.sendMessageHistoryImportAction(progress: _1!)
}
public static func parse_sendMessageRecordAudioAction(_ reader: BufferReader) -> SendMessageAction? {
return Api.SendMessageAction.sendMessageRecordAudioAction
@@ -1083,12 +1038,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.SendMessageAction.sendMessageTextDraftAction(randomId: _1!, text: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.SendMessageAction.sendMessageTextDraftAction(randomId: _1!, text: _2!)
}
public static func parse_sendMessageTypingAction(_ reader: BufferReader) -> SendMessageAction? {
return Api.SendMessageAction.sendMessageTypingAction
@@ -1097,56 +1049,36 @@ public extension Api {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.SendMessageAction.sendMessageUploadAudioAction(progress: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.SendMessageAction.sendMessageUploadAudioAction(progress: _1!)
}
public static func parse_sendMessageUploadDocumentAction(_ reader: BufferReader) -> SendMessageAction? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.SendMessageAction.sendMessageUploadDocumentAction(progress: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.SendMessageAction.sendMessageUploadDocumentAction(progress: _1!)
}
public static func parse_sendMessageUploadPhotoAction(_ reader: BufferReader) -> SendMessageAction? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.SendMessageAction.sendMessageUploadPhotoAction(progress: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.SendMessageAction.sendMessageUploadPhotoAction(progress: _1!)
}
public static func parse_sendMessageUploadRoundAction(_ reader: BufferReader) -> SendMessageAction? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.SendMessageAction.sendMessageUploadRoundAction(progress: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.SendMessageAction.sendMessageUploadRoundAction(progress: _1!)
}
public static func parse_sendMessageUploadVideoAction(_ reader: BufferReader) -> SendMessageAction? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.SendMessageAction.sendMessageUploadVideoAction(progress: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.SendMessageAction.sendMessageUploadVideoAction(progress: _1!)
}
public static func parse_speakingInGroupCallAction(_ reader: BufferReader) -> SendMessageAction? {
return Api.SendMessageAction.speakingInGroupCallAction
diff --git a/submodules/TelegramApi/Sources/Api25.swift b/submodules/TelegramApi/Sources/Api25.swift
index 5abc7a1d..08d8aafe 100644
--- a/submodules/TelegramApi/Sources/Api25.swift
+++ b/submodules/TelegramApi/Sources/Api25.swift
@@ -38,12 +38,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.ShippingOption.shippingOption(id: _1!, title: _2!, prices: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.ShippingOption.shippingOption(id: _1!, title: _2!, prices: _3!)
}
}
@@ -82,12 +80,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.SmsJob.smsJob(jobId: _1!, phoneNumber: _2!, text: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.SmsJob.smsJob(jobId: _1!, phoneNumber: _2!, text: _3!)
}
}
@@ -182,12 +178,21 @@ public extension Api {
let _c12 = (Int(_1!) & Int(1 << 8) == 0) || _12 != nil
let _c13 = (Int(_1!) & Int(1 << 15) == 0) || _13 != nil
let _c14 = (Int(_1!) & Int(1 << 15) == 0) || _14 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 {
- return Api.SponsoredMessage.sponsoredMessage(flags: _1!, randomId: _2!, url: _3!, title: _4!, message: _5!, entities: _6, photo: _7, media: _8, color: _9, buttonText: _10!, sponsorInfo: _11, additionalInfo: _12, minDisplayDuration: _13, maxDisplayDuration: _14)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ if !_c13 { return nil }
+ if !_c14 { return nil }
+ return Api.SponsoredMessage.sponsoredMessage(flags: _1!, randomId: _2!, url: _3!, title: _4!, message: _5!, entities: _6, photo: _7, media: _8, color: _9, buttonText: _10!, sponsorInfo: _11, additionalInfo: _12, minDisplayDuration: _13, maxDisplayDuration: _14)
}
}
@@ -222,12 +227,9 @@ public extension Api {
_2 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.SponsoredMessageReportOption.sponsoredMessageReportOption(text: _1!, option: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.SponsoredMessageReportOption.sponsoredMessageReportOption(text: _1!, option: _2!)
}
}
@@ -276,12 +278,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.SponsoredPeer.sponsoredPeer(flags: _1!, randomId: _2!, peer: _3!, sponsorInfo: _4, additionalInfo: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.SponsoredPeer.sponsoredPeer(flags: _1!, randomId: _2!, peer: _3!, sponsorInfo: _4, additionalInfo: _5)
}
}
@@ -440,12 +442,29 @@ public extension Api {
let _c20 = (Int(_1!) & Int(1 << 11) == 0) || _20 != nil
let _c21 = (Int(_1!) & Int(1 << 12) == 0) || _21 != nil
let _c22 = (Int(_1!) & Int(1 << 13) == 0) || _22 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 && _c19 && _c20 && _c21 && _c22 {
- return Api.StarGift.starGift(flags: _1!, id: _2!, sticker: _3!, stars: _4!, availabilityRemains: _5, availabilityTotal: _6, availabilityResale: _7, convertStars: _8!, firstSaleDate: _9, lastSaleDate: _10, upgradeStars: _11, resellMinStars: _12, title: _13, releasedBy: _14, perUserTotal: _15, perUserRemains: _16, lockedUntilDate: _17, auctionSlug: _18, giftsPerRound: _19, auctionStartDate: _20, upgradeVariants: _21, background: _22)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ if !_c13 { return nil }
+ if !_c14 { return nil }
+ if !_c15 { return nil }
+ if !_c16 { return nil }
+ if !_c17 { return nil }
+ if !_c18 { return nil }
+ if !_c19 { return nil }
+ if !_c20 { return nil }
+ if !_c21 { return nil }
+ if !_c22 { return nil }
+ return Api.StarGift.starGift(flags: _1!, id: _2!, sticker: _3!, stars: _4!, availabilityRemains: _5, availabilityTotal: _6, availabilityResale: _7, convertStars: _8!, firstSaleDate: _9, lastSaleDate: _10, upgradeStars: _11, resellMinStars: _12, title: _13, releasedBy: _14, perUserTotal: _15, perUserRemains: _16, lockedUntilDate: _17, auctionSlug: _18, giftsPerRound: _19, auctionStartDate: _20, upgradeVariants: _21, background: _22)
}
public static func parse_starGiftUnique(_ reader: BufferReader) -> StarGift? {
var _1: Int32?
@@ -528,12 +547,29 @@ public extension Api {
let _c20 = (Int(_1!) & Int(1 << 11) == 0) || _20 != nil
let _c21 = (Int(_1!) & Int(1 << 12) == 0) || _21 != nil
let _c22 = (Int(_1!) & Int(1 << 13) == 0) || _22 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 && _c19 && _c20 && _c21 && _c22 {
- return Api.StarGift.starGiftUnique(flags: _1!, id: _2!, giftId: _3!, title: _4!, slug: _5!, num: _6!, ownerId: _7, ownerName: _8, ownerAddress: _9, attributes: _10!, availabilityIssued: _11!, availabilityTotal: _12!, giftAddress: _13, resellAmount: _14, releasedBy: _15, valueAmount: _16, valueCurrency: _17, valueUsdAmount: _18, themePeer: _19, peerColor: _20, hostId: _21, offerMinStars: _22)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ if !_c13 { return nil }
+ if !_c14 { return nil }
+ if !_c15 { return nil }
+ if !_c16 { return nil }
+ if !_c17 { return nil }
+ if !_c18 { return nil }
+ if !_c19 { return nil }
+ if !_c20 { return nil }
+ if !_c21 { return nil }
+ if !_c22 { return nil }
+ return Api.StarGift.starGiftUnique(flags: _1!, id: _2!, giftId: _3!, title: _4!, slug: _5!, num: _6!, ownerId: _7, ownerName: _8, ownerAddress: _9, attributes: _10!, availabilityIssued: _11!, availabilityTotal: _12!, giftAddress: _13, resellAmount: _14, releasedBy: _15, valueAmount: _16, valueCurrency: _17, valueUsdAmount: _18, themePeer: _19, peerColor: _20, hostId: _21, offerMinStars: _22)
}
}
@@ -578,12 +614,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.StarGiftActiveAuctionState.starGiftActiveAuctionState(gift: _1!, state: _2!, userState: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.StarGiftActiveAuctionState.starGiftActiveAuctionState(gift: _1!, state: _2!, userState: _3!)
}
}
@@ -673,12 +707,14 @@ public extension Api {
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.StarGiftAttribute.starGiftAttributeBackdrop(name: _1!, backdropId: _2!, centerColor: _3!, edgeColor: _4!, patternColor: _5!, textColor: _6!, rarityPermille: _7!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.StarGiftAttribute.starGiftAttributeBackdrop(name: _1!, backdropId: _2!, centerColor: _3!, edgeColor: _4!, patternColor: _5!, textColor: _6!, rarityPermille: _7!)
}
public static func parse_starGiftAttributeModel(_ reader: BufferReader) -> StarGiftAttribute? {
var _1: String?
@@ -692,12 +728,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.StarGiftAttribute.starGiftAttributeModel(name: _1!, document: _2!, rarityPermille: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.StarGiftAttribute.starGiftAttributeModel(name: _1!, document: _2!, rarityPermille: _3!)
}
public static func parse_starGiftAttributeOriginalDetails(_ reader: BufferReader) -> StarGiftAttribute? {
var _1: Int32?
@@ -721,12 +755,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.StarGiftAttribute.starGiftAttributeOriginalDetails(flags: _1!, senderId: _2, recipientId: _3!, date: _4!, message: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.StarGiftAttribute.starGiftAttributeOriginalDetails(flags: _1!, senderId: _2, recipientId: _3!, date: _4!, message: _5)
}
public static func parse_starGiftAttributePattern(_ reader: BufferReader) -> StarGiftAttribute? {
var _1: String?
@@ -740,12 +774,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.StarGiftAttribute.starGiftAttributePattern(name: _1!, document: _2!, rarityPermille: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.StarGiftAttribute.starGiftAttributePattern(name: _1!, document: _2!, rarityPermille: _3!)
}
}
@@ -782,12 +814,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.StarGiftAttributeCounter.starGiftAttributeCounter(attribute: _1!, count: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.StarGiftAttributeCounter.starGiftAttributeCounter(attribute: _1!, count: _2!)
}
}
@@ -836,34 +865,22 @@ public extension Api {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.StarGiftAttributeId.starGiftAttributeIdBackdrop(backdropId: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.StarGiftAttributeId.starGiftAttributeIdBackdrop(backdropId: _1!)
}
public static func parse_starGiftAttributeIdModel(_ reader: BufferReader) -> StarGiftAttributeId? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
- if _c1 {
- return Api.StarGiftAttributeId.starGiftAttributeIdModel(documentId: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.StarGiftAttributeId.starGiftAttributeIdModel(documentId: _1!)
}
public static func parse_starGiftAttributeIdPattern(_ reader: BufferReader) -> StarGiftAttributeId? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
- if _c1 {
- return Api.StarGiftAttributeId.starGiftAttributeIdPattern(documentId: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.StarGiftAttributeId.starGiftAttributeIdPattern(documentId: _1!)
}
}
@@ -926,12 +943,15 @@ public extension Api {
let _c6 = _6 != nil
let _c7 = (Int(_1!) & Int(1 << 1) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 2) == 0) || _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.StarGiftAuctionAcquiredGift.starGiftAuctionAcquiredGift(flags: _1!, peer: _2!, date: _3!, bidAmount: _4!, round: _5!, pos: _6!, message: _7, giftNum: _8)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.StarGiftAuctionAcquiredGift.starGiftAuctionAcquiredGift(flags: _1!, peer: _2!, date: _3!, bidAmount: _4!, round: _5!, pos: _6!, message: _7, giftNum: _8)
}
}
@@ -978,12 +998,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.StarGiftAuctionRound.starGiftAuctionRound(num: _1!, duration: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.StarGiftAuctionRound.starGiftAuctionRound(num: _1!, duration: _2!)
}
public static func parse_starGiftAuctionRoundExtendable(_ reader: BufferReader) -> StarGiftAuctionRound? {
var _1: Int32?
@@ -998,12 +1015,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.StarGiftAuctionRound.starGiftAuctionRoundExtendable(num: _1!, duration: _2!, extendTop: _3!, extendWindow: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.StarGiftAuctionRound.starGiftAuctionRoundExtendable(num: _1!, duration: _2!, extendTop: _3!, extendWindow: _4!)
}
}
@@ -1120,12 +1136,19 @@ public extension Api {
let _c10 = _10 != nil
let _c11 = _11 != nil
let _c12 = _12 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 {
- return Api.StarGiftAuctionState.starGiftAuctionState(version: _1!, startDate: _2!, endDate: _3!, minBidAmount: _4!, bidLevels: _5!, topBidders: _6!, nextRoundAt: _7!, lastGiftNum: _8!, giftsLeft: _9!, currentRound: _10!, totalRounds: _11!, rounds: _12!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ return Api.StarGiftAuctionState.starGiftAuctionState(version: _1!, startDate: _2!, endDate: _3!, minBidAmount: _4!, bidLevels: _5!, topBidders: _6!, nextRoundAt: _7!, lastGiftNum: _8!, giftsLeft: _9!, currentRound: _10!, totalRounds: _11!, rounds: _12!)
}
public static func parse_starGiftAuctionStateFinished(_ reader: BufferReader) -> StarGiftAuctionState? {
var _1: Int32?
@@ -1149,12 +1172,14 @@ public extension Api {
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 1) == 0) || _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.StarGiftAuctionState.starGiftAuctionStateFinished(flags: _1!, startDate: _2!, endDate: _3!, averagePrice: _4!, listedCount: _5, fragmentListedCount: _6, fragmentListedUrl: _7)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.StarGiftAuctionState.starGiftAuctionStateFinished(flags: _1!, startDate: _2!, endDate: _3!, averagePrice: _4!, listedCount: _5, fragmentListedCount: _6, fragmentListedUrl: _7)
}
public static func parse_starGiftAuctionStateNotModified(_ reader: BufferReader) -> StarGiftAuctionState? {
return Api.StarGiftAuctionState.starGiftAuctionStateNotModified
@@ -1210,12 +1235,13 @@ public extension Api {
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
let _c6 = _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.StarGiftAuctionUserState.starGiftAuctionUserState(flags: _1!, bidAmount: _2, bidDate: _3, minBidAmount: _4, bidPeer: _5, acquiredCount: _6!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.StarGiftAuctionUserState.starGiftAuctionUserState(flags: _1!, bidAmount: _2, bidDate: _3, minBidAmount: _4, bidPeer: _5, acquiredCount: _6!)
}
}
@@ -1254,12 +1280,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.StarGiftBackground.starGiftBackground(centerColor: _1!, edgeColor: _2!, textColor: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.StarGiftBackground.starGiftBackground(centerColor: _1!, edgeColor: _2!, textColor: _3!)
}
}
@@ -1312,12 +1336,13 @@ public extension Api {
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.StarGiftCollection.starGiftCollection(flags: _1!, collectionId: _2!, title: _3!, icon: _4, giftsCount: _5!, hash: _6!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.StarGiftCollection.starGiftCollection(flags: _1!, collectionId: _2!, title: _3!, icon: _4, giftsCount: _5!, hash: _6!)
}
}
@@ -1352,12 +1377,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.StarGiftUpgradePrice.starGiftUpgradePrice(date: _1!, upgradeStars: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.StarGiftUpgradePrice.starGiftUpgradePrice(date: _1!, upgradeStars: _2!)
}
}
@@ -1410,12 +1432,13 @@ public extension Api {
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.StarRefProgram.starRefProgram(flags: _1!, botId: _2!, commissionPermille: _3!, durationMonths: _4, endDate: _5, dailyRevenuePerUser: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.StarRefProgram.starRefProgram(flags: _1!, botId: _2!, commissionPermille: _3!, durationMonths: _4, endDate: _5, dailyRevenuePerUser: _6)
}
}
@@ -1459,23 +1482,16 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.StarsAmount.starsAmount(amount: _1!, nanos: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.StarsAmount.starsAmount(amount: _1!, nanos: _2!)
}
public static func parse_starsTonAmount(_ reader: BufferReader) -> StarsAmount? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
- if _c1 {
- return Api.StarsAmount.starsTonAmount(amount: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.StarsAmount.starsTonAmount(amount: _1!)
}
}
@@ -1522,12 +1538,12 @@ public extension Api {
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.StarsGiftOption.starsGiftOption(flags: _1!, stars: _2!, storeProduct: _3, currency: _4!, amount: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.StarsGiftOption.starsGiftOption(flags: _1!, stars: _2!, storeProduct: _3, currency: _4!, amount: _5!)
}
}
@@ -1588,12 +1604,14 @@ public extension Api {
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.StarsGiveawayOption.starsGiveawayOption(flags: _1!, stars: _2!, yearlyBoosts: _3!, storeProduct: _4, currency: _5!, amount: _6!, winners: _7!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.StarsGiveawayOption.starsGiveawayOption(flags: _1!, stars: _2!, yearlyBoosts: _3!, storeProduct: _4, currency: _5!, amount: _6!, winners: _7!)
}
}
@@ -1632,12 +1650,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.StarsGiveawayWinnersOption.starsGiveawayWinnersOption(flags: _1!, users: _2!, perUserStars: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.StarsGiveawayWinnersOption.starsGiveawayWinnersOption(flags: _1!, users: _2!, perUserStars: _3!)
}
}
diff --git a/submodules/TelegramApi/Sources/Api26.swift b/submodules/TelegramApi/Sources/Api26.swift
index fd08d27e..4a5c08c4 100644
--- a/submodules/TelegramApi/Sources/Api26.swift
+++ b/submodules/TelegramApi/Sources/Api26.swift
@@ -40,12 +40,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.StarsRating.starsRating(flags: _1!, level: _2!, currentLevelStars: _3!, stars: _4!, nextLevelStars: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.StarsRating.starsRating(flags: _1!, level: _2!, currentLevelStars: _3!, stars: _4!, nextLevelStars: _5)
}
}
@@ -98,12 +98,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.StarsRevenueStatus.starsRevenueStatus(flags: _1!, currentBalance: _2!, availableBalance: _3!, overallRevenue: _4!, nextWithdrawalAt: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.StarsRevenueStatus.starsRevenueStatus(flags: _1!, currentBalance: _2!, availableBalance: _3!, overallRevenue: _4!, nextWithdrawalAt: _5)
}
}
@@ -172,12 +172,16 @@ public extension Api {
let _c7 = (Int(_1!) & Int(1 << 4) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 5) == 0) || _8 != nil
let _c9 = (Int(_1!) & Int(1 << 6) == 0) || _9 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
- return Api.StarsSubscription.starsSubscription(flags: _1!, id: _2!, peer: _3!, untilDate: _4!, pricing: _5!, chatInviteHash: _6, title: _7, photo: _8, invoiceSlug: _9)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ return Api.StarsSubscription.starsSubscription(flags: _1!, id: _2!, peer: _3!, untilDate: _4!, pricing: _5!, chatInviteHash: _6, title: _7, photo: _8, invoiceSlug: _9)
}
}
@@ -212,12 +216,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.StarsSubscriptionPricing.starsSubscriptionPricing(period: _1!, amount: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.StarsSubscriptionPricing.starsSubscriptionPricing(period: _1!, amount: _2!)
}
}
@@ -264,12 +265,12 @@ public extension Api {
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.StarsTopupOption.starsTopupOption(flags: _1!, stars: _2!, storeProduct: _3, currency: _4!, amount: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.StarsTopupOption.starsTopupOption(flags: _1!, stars: _2!, storeProduct: _3, currency: _4!, amount: _5!)
}
}
@@ -410,12 +411,31 @@ public extension Api {
let _c22 = (Int(_1!) & Int(1 << 20) == 0) || _22 != nil
let _c23 = (Int(_1!) & Int(1 << 23) == 0) || _23 != nil
let _c24 = (Int(_1!) & Int(1 << 23) == 0) || _24 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 && _c19 && _c20 && _c21 && _c22 && _c23 && _c24 {
- return Api.StarsTransaction.starsTransaction(flags: _1!, id: _2!, amount: _3!, date: _4!, peer: _5!, title: _6, description: _7, photo: _8, transactionDate: _9, transactionUrl: _10, botPayload: _11, msgId: _12, extendedMedia: _13, subscriptionPeriod: _14, giveawayPostId: _15, stargift: _16, floodskipNumber: _17, starrefCommissionPermille: _18, starrefPeer: _19, starrefAmount: _20, paidMessages: _21, premiumGiftMonths: _22, adsProceedsFromDate: _23, adsProceedsToDate: _24)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ if !_c13 { return nil }
+ if !_c14 { return nil }
+ if !_c15 { return nil }
+ if !_c16 { return nil }
+ if !_c17 { return nil }
+ if !_c18 { return nil }
+ if !_c19 { return nil }
+ if !_c20 { return nil }
+ if !_c21 { return nil }
+ if !_c22 { return nil }
+ if !_c23 { return nil }
+ if !_c24 { return nil }
+ return Api.StarsTransaction.starsTransaction(flags: _1!, id: _2!, amount: _3!, date: _4!, peer: _5!, title: _6, description: _7, photo: _8, transactionDate: _9, transactionUrl: _10, botPayload: _11, msgId: _12, extendedMedia: _13, subscriptionPeriod: _14, giveawayPostId: _15, stargift: _16, floodskipNumber: _17, starrefCommissionPermille: _18, starrefPeer: _19, starrefAmount: _20, paidMessages: _21, premiumGiftMonths: _22, adsProceedsFromDate: _23, adsProceedsToDate: _24)
}
}
@@ -511,12 +531,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.Peer
}
let _c1 = _1 != nil
- if _c1 {
- return Api.StarsTransactionPeer.starsTransactionPeer(peer: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.StarsTransactionPeer.starsTransactionPeer(peer: _1!)
}
public static func parse_starsTransactionPeerAPI(_ reader: BufferReader) -> StarsTransactionPeer? {
return Api.StarsTransactionPeer.starsTransactionPeerAPI
@@ -572,12 +588,9 @@ public extension Api {
_2 = reader.readDouble()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.StatsAbsValueAndPrev.statsAbsValueAndPrev(current: _1!, previous: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.StatsAbsValueAndPrev.statsAbsValueAndPrev(current: _1!, previous: _2!)
}
}
@@ -612,12 +625,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.StatsDateRangeDays.statsDateRangeDays(minDate: _1!, maxDate: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.StatsDateRangeDays.statsDateRangeDays(minDate: _1!, maxDate: _2!)
}
}
@@ -676,34 +686,24 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.StatsGraph.statsGraph(flags: _1!, json: _2!, zoomToken: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.StatsGraph.statsGraph(flags: _1!, json: _2!, zoomToken: _3)
}
public static func parse_statsGraphAsync(_ reader: BufferReader) -> StatsGraph? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.StatsGraph.statsGraphAsync(token: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.StatsGraph.statsGraphAsync(token: _1!)
}
public static func parse_statsGraphError(_ reader: BufferReader) -> StatsGraph? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.StatsGraph.statsGraphError(error: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.StatsGraph.statsGraphError(error: _1!)
}
}
@@ -746,12 +746,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.StatsGroupTopAdmin.statsGroupTopAdmin(userId: _1!, deleted: _2!, kicked: _3!, banned: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.StatsGroupTopAdmin.statsGroupTopAdmin(userId: _1!, deleted: _2!, kicked: _3!, banned: _4!)
}
}
@@ -786,12 +785,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.StatsGroupTopInviter.statsGroupTopInviter(userId: _1!, invitations: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.StatsGroupTopInviter.statsGroupTopInviter(userId: _1!, invitations: _2!)
}
}
@@ -830,12 +826,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.StatsGroupTopPoster.statsGroupTopPoster(userId: _1!, messages: _2!, avgChars: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.StatsGroupTopPoster.statsGroupTopPoster(userId: _1!, messages: _2!, avgChars: _3!)
}
}
@@ -870,12 +864,9 @@ public extension Api {
_2 = reader.readDouble()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.StatsPercentValue.statsPercentValue(part: _1!, total: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.StatsPercentValue.statsPercentValue(part: _1!, total: _2!)
}
}
@@ -906,12 +897,8 @@ public extension Api {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.StatsURL.statsURL(url: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.StatsURL.statsURL(url: _1!)
}
}
@@ -952,12 +939,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.StickerKeyword.stickerKeyword(documentId: _1!, keyword: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.StickerKeyword.stickerKeyword(documentId: _1!, keyword: _2!)
}
}
@@ -998,12 +982,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.StickerPack.stickerPack(emoticon: _1!, documents: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.StickerPack.stickerPack(emoticon: _1!, documents: _2!)
}
}
@@ -1084,12 +1065,19 @@ public extension Api {
let _c10 = (Int(_1!) & Int(1 << 8) == 0) || _10 != nil
let _c11 = _11 != nil
let _c12 = _12 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 {
- return Api.StickerSet.stickerSet(flags: _1!, installedDate: _2, id: _3!, accessHash: _4!, title: _5!, shortName: _6!, thumbs: _7, thumbDcId: _8, thumbVersion: _9, thumbDocumentId: _10, count: _11!, hash: _12!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ return Api.StickerSet.stickerSet(flags: _1!, installedDate: _2, id: _3!, accessHash: _4!, title: _5!, shortName: _6!, thumbs: _7, thumbDcId: _8, thumbVersion: _9, thumbDocumentId: _10, count: _11!, hash: _12!)
}
}
@@ -1175,12 +1163,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.StickerSetCovered.stickerSetCovered(set: _1!, cover: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.StickerSetCovered.stickerSetCovered(set: _1!, cover: _2!)
}
public static func parse_stickerSetFullCovered(_ reader: BufferReader) -> StickerSetCovered? {
var _1: Api.StickerSet?
@@ -1203,12 +1188,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.StickerSetCovered.stickerSetFullCovered(set: _1!, packs: _2!, keywords: _3!, documents: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.StickerSetCovered.stickerSetFullCovered(set: _1!, packs: _2!, keywords: _3!, documents: _4!)
}
public static func parse_stickerSetMultiCovered(_ reader: BufferReader) -> StickerSetCovered? {
var _1: Api.StickerSet?
@@ -1221,12 +1205,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.StickerSetCovered.stickerSetMultiCovered(set: _1!, covers: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.StickerSetCovered.stickerSetMultiCovered(set: _1!, covers: _2!)
}
public static func parse_stickerSetNoCovered(_ reader: BufferReader) -> StickerSetCovered? {
var _1: Api.StickerSet?
@@ -1234,12 +1215,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.StickerSet
}
let _c1 = _1 != nil
- if _c1 {
- return Api.StickerSetCovered.stickerSetNoCovered(set: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.StickerSetCovered.stickerSetNoCovered(set: _1!)
}
}
@@ -1278,12 +1255,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.StoriesStealthMode.storiesStealthMode(flags: _1!, activeUntilDate: _2, cooldownUntilDate: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.StoriesStealthMode.storiesStealthMode(flags: _1!, activeUntilDate: _2, cooldownUntilDate: _3)
}
}
diff --git a/submodules/TelegramApi/Sources/Api27.swift b/submodules/TelegramApi/Sources/Api27.swift
index 075ddc82..12cbc688 100644
--- a/submodules/TelegramApi/Sources/Api27.swift
+++ b/submodules/TelegramApi/Sources/Api27.swift
@@ -44,12 +44,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.StoryAlbum.storyAlbum(flags: _1!, albumId: _2!, title: _3!, iconPhoto: _4, iconVideo: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.StoryAlbum.storyAlbum(flags: _1!, albumId: _2!, title: _3!, iconPhoto: _4, iconVideo: _5)
}
}
@@ -94,12 +94,11 @@ public extension Api {
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.StoryFwdHeader.storyFwdHeader(flags: _1!, from: _2, fromName: _3, storyId: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.StoryFwdHeader.storyFwdHeader(flags: _1!, from: _2, fromName: _3, storyId: _4)
}
}
@@ -237,23 +236,28 @@ public extension Api {
let _c12 = (Int(_1!) & Int(1 << 3) == 0) || _12 != nil
let _c13 = (Int(_1!) & Int(1 << 15) == 0) || _13 != nil
let _c14 = (Int(_1!) & Int(1 << 19) == 0) || _14 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 {
- return Api.StoryItem.storyItem(flags: _1!, id: _2!, date: _3!, fromId: _4, fwdFrom: _5, expireDate: _6!, caption: _7, entities: _8, media: _9!, mediaAreas: _10, privacy: _11, views: _12, sentReaction: _13, albums: _14)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ if !_c13 { return nil }
+ if !_c14 { return nil }
+ return Api.StoryItem.storyItem(flags: _1!, id: _2!, date: _3!, fromId: _4, fwdFrom: _5, expireDate: _6!, caption: _7, entities: _8, media: _9!, mediaAreas: _10, privacy: _11, views: _12, sentReaction: _13, albums: _14)
}
public static func parse_storyItemDeleted(_ reader: BufferReader) -> StoryItem? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.StoryItem.storyItemDeleted(id: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.StoryItem.storyItemDeleted(id: _1!)
}
public static func parse_storyItemSkipped(_ reader: BufferReader) -> StoryItem? {
var _1: Int32?
@@ -268,12 +272,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.StoryItem.storyItemSkipped(flags: _1!, id: _2!, date: _3!, expireDate: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.StoryItem.storyItemSkipped(flags: _1!, id: _2!, date: _3!, expireDate: _4!)
}
}
@@ -335,12 +338,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.StoryReaction.storyReaction(peerId: _1!, date: _2!, reaction: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.StoryReaction.storyReaction(peerId: _1!, date: _2!, reaction: _3!)
}
public static func parse_storyReactionPublicForward(_ reader: BufferReader) -> StoryReaction? {
var _1: Api.Message?
@@ -348,12 +349,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.Message
}
let _c1 = _1 != nil
- if _c1 {
- return Api.StoryReaction.storyReactionPublicForward(message: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.StoryReaction.storyReactionPublicForward(message: _1!)
}
public static func parse_storyReactionPublicRepost(_ reader: BufferReader) -> StoryReaction? {
var _1: Api.Peer?
@@ -366,12 +363,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.StoryReaction.storyReactionPublicRepost(peerId: _1!, story: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.StoryReaction.storyReactionPublicRepost(peerId: _1!, story: _2!)
}
}
@@ -437,12 +431,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.StoryView.storyView(flags: _1!, userId: _2!, date: _3!, reaction: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.StoryView.storyView(flags: _1!, userId: _2!, date: _3!, reaction: _4)
}
public static func parse_storyViewPublicForward(_ reader: BufferReader) -> StoryView? {
var _1: Int32?
@@ -453,12 +446,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.StoryView.storyViewPublicForward(flags: _1!, message: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.StoryView.storyViewPublicForward(flags: _1!, message: _2!)
}
public static func parse_storyViewPublicRepost(_ reader: BufferReader) -> StoryView? {
var _1: Int32?
@@ -474,12 +464,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.StoryView.storyViewPublicRepost(flags: _1!, peerId: _2!, story: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.StoryView.storyViewPublicRepost(flags: _1!, peerId: _2!, story: _3!)
}
}
@@ -542,12 +530,13 @@ public extension Api {
let _c4 = (Int(_1!) & Int(1 << 3) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 4) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.StoryViews.storyViews(flags: _1!, viewsCount: _2!, forwardsCount: _3, reactions: _4, reactionsCount: _5, recentViewers: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.StoryViews.storyViews(flags: _1!, viewsCount: _2!, forwardsCount: _3, reactions: _4, reactionsCount: _5, recentViewers: _6)
}
}
@@ -588,12 +577,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 3) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.SuggestedPost.suggestedPost(flags: _1!, price: _2, scheduleDate: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.SuggestedPost.suggestedPost(flags: _1!, price: _2, scheduleDate: _3)
}
}
@@ -634,12 +621,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.TextWithEntities.textWithEntities(text: _1!, entities: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.TextWithEntities.textWithEntities(text: _1!, entities: _2!)
}
}
@@ -710,12 +694,16 @@ public extension Api {
let _c7 = (Int(_1!) & Int(1 << 3) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 6) == 0) || _8 != nil
let _c9 = (Int(_1!) & Int(1 << 4) == 0) || _9 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
- return Api.Theme.theme(flags: _1!, id: _2!, accessHash: _3!, slug: _4!, title: _5!, document: _6, settings: _7, emoticon: _8, installsCount: _9)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ return Api.Theme.theme(flags: _1!, id: _2!, accessHash: _3!, slug: _4!, title: _5!, document: _6, settings: _7, emoticon: _8, installsCount: _9)
}
}
@@ -776,12 +764,13 @@ public extension Api {
let _c4 = (Int(_1!) & Int(1 << 3) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.ThemeSettings.themeSettings(flags: _1!, baseTheme: _2!, accentColor: _3!, outboxAccentColor: _4, messageColors: _5, wallpaper: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.ThemeSettings.themeSettings(flags: _1!, baseTheme: _2!, accentColor: _3!, outboxAccentColor: _4, messageColors: _5, wallpaper: _6)
}
}
@@ -820,12 +809,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Timezone.timezone(id: _1!, name: _2!, utcOffset: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Timezone.timezone(id: _1!, name: _2!, utcOffset: _3!)
}
}
@@ -866,12 +853,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.TodoCompletion.todoCompletion(id: _1!, completedBy: _2!, date: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.TodoCompletion.todoCompletion(id: _1!, completedBy: _2!, date: _3!)
}
}
@@ -908,12 +893,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.TodoItem.todoItem(id: _1!, title: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.TodoItem.todoItem(id: _1!, title: _2!)
}
}
@@ -960,12 +942,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.TodoList.todoList(flags: _1!, title: _2!, list: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.TodoList.todoList(flags: _1!, title: _2!, list: _3!)
}
}
@@ -1002,12 +982,9 @@ public extension Api {
_2 = reader.readDouble()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.TopPeer.topPeer(peer: _1!, rating: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.TopPeer.topPeer(peer: _1!, rating: _2!)
}
}
@@ -1178,12 +1155,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.TopPeerCategoryPeers.topPeerCategoryPeers(category: _1!, count: _2!, peers: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.TopPeerCategoryPeers.topPeerCategoryPeers(category: _1!, count: _2!, peers: _3!)
}
}
@@ -1247,6 +1222,7 @@ public extension Api {
case updateDraftMessage(flags: Int32, peer: Api.Peer, topMsgId: Int32?, savedPeerId: Api.Peer?, draft: Api.DraftMessage)
case updateEditChannelMessage(message: Api.Message, pts: Int32, ptsCount: Int32)
case updateEditMessage(message: Api.Message, pts: Int32, ptsCount: Int32)
+ case updateEmojiGameInfo(info: Api.messages.EmojiGameInfo)
case updateEncryptedChatTyping(chatId: Int32)
case updateEncryptedMessagesRead(chatId: Int32, maxDate: Int32, date: Int32)
case updateEncryption(chat: Api.EncryptedChat, date: Int32)
@@ -1887,6 +1863,12 @@ public extension Api {
serializeInt32(pts, buffer: buffer, boxed: false)
serializeInt32(ptsCount, buffer: buffer, boxed: false)
break
+ case .updateEmojiGameInfo(let info):
+ if boxed {
+ buffer.appendInt32(-73640838)
+ }
+ info.serialize(buffer, true)
+ break
case .updateEncryptedChatTyping(let chatId):
if boxed {
buffer.appendInt32(386986326)
@@ -2774,6 +2756,8 @@ public extension Api {
return ("updateEditChannelMessage", [("message", message as Any), ("pts", pts as Any), ("ptsCount", ptsCount as Any)])
case .updateEditMessage(let message, let pts, let ptsCount):
return ("updateEditMessage", [("message", message as Any), ("pts", pts as Any), ("ptsCount", ptsCount as Any)])
+ case .updateEmojiGameInfo(let info):
+ return ("updateEmojiGameInfo", [("info", info as Any)])
case .updateEncryptedChatTyping(let chatId):
return ("updateEncryptedChatTyping", [("chatId", chatId as Any)])
case .updateEncryptedMessagesRead(let chatId, let maxDate, let date):
@@ -2978,12 +2962,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updateBotBusinessConnect(connection: _1!, qts: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updateBotBusinessConnect(connection: _1!, qts: _2!)
}
public static func parse_updateBotCallbackQuery(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -3012,12 +2993,15 @@ public extension Api {
let _c6 = _6 != nil
let _c7 = (Int(_1!) & Int(1 << 0) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 1) == 0) || _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.Update.updateBotCallbackQuery(flags: _1!, queryId: _2!, userId: _3!, peer: _4!, msgId: _5!, chatInstance: _6!, data: _7, gameShortName: _8)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.Update.updateBotCallbackQuery(flags: _1!, queryId: _2!, userId: _3!, peer: _4!, msgId: _5!, chatInstance: _6!, data: _7, gameShortName: _8)
}
public static func parse_updateBotChatBoost(_ reader: BufferReader) -> Update? {
var _1: Api.Peer?
@@ -3033,12 +3017,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateBotChatBoost(peer: _1!, boost: _2!, qts: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateBotChatBoost(peer: _1!, boost: _2!, qts: _3!)
}
public static func parse_updateBotChatInviteRequester(_ reader: BufferReader) -> Update? {
var _1: Api.Peer?
@@ -3063,12 +3045,13 @@ public extension Api {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.Update.updateBotChatInviteRequester(peer: _1!, date: _2!, userId: _3!, about: _4!, invite: _5!, qts: _6!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.Update.updateBotChatInviteRequester(peer: _1!, date: _2!, userId: _3!, about: _4!, invite: _5!, qts: _6!)
}
public static func parse_updateBotCommands(_ reader: BufferReader) -> Update? {
var _1: Api.Peer?
@@ -3084,12 +3067,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateBotCommands(peer: _1!, botId: _2!, commands: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateBotCommands(peer: _1!, botId: _2!, commands: _3!)
}
public static func parse_updateBotDeleteBusinessMessage(_ reader: BufferReader) -> Update? {
var _1: String?
@@ -3108,12 +3089,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.Update.updateBotDeleteBusinessMessage(connectionId: _1!, peer: _2!, messages: _3!, qts: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.Update.updateBotDeleteBusinessMessage(connectionId: _1!, peer: _2!, messages: _3!, qts: _4!)
}
public static func parse_updateBotEditBusinessMessage(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -3135,12 +3115,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.Update.updateBotEditBusinessMessage(flags: _1!, connectionId: _2!, message: _3!, replyToMessage: _4, qts: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.Update.updateBotEditBusinessMessage(flags: _1!, connectionId: _2!, message: _3!, replyToMessage: _4, qts: _5!)
}
public static func parse_updateBotInlineQuery(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -3168,12 +3148,14 @@ public extension Api {
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil
let _c7 = _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.Update.updateBotInlineQuery(flags: _1!, queryId: _2!, userId: _3!, query: _4!, geo: _5, peerType: _6, offset: _7!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.Update.updateBotInlineQuery(flags: _1!, queryId: _2!, userId: _3!, query: _4!, geo: _5, peerType: _6, offset: _7!)
}
public static func parse_updateBotInlineSend(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -3198,12 +3180,13 @@ public extension Api {
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.Update.updateBotInlineSend(flags: _1!, userId: _2!, query: _3!, geo: _4, id: _5!, msgId: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.Update.updateBotInlineSend(flags: _1!, userId: _2!, query: _3!, geo: _4, id: _5!, msgId: _6)
}
public static func parse_updateBotMenuButton(_ reader: BufferReader) -> Update? {
var _1: Int64?
@@ -3214,12 +3197,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updateBotMenuButton(botId: _1!, button: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updateBotMenuButton(botId: _1!, button: _2!)
}
public static func parse_updateBotMessageReaction(_ reader: BufferReader) -> Update? {
var _1: Api.Peer?
@@ -3251,12 +3231,14 @@ public extension Api {
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.Update.updateBotMessageReaction(peer: _1!, msgId: _2!, date: _3!, actor: _4!, oldReactions: _5!, newReactions: _6!, qts: _7!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.Update.updateBotMessageReaction(peer: _1!, msgId: _2!, date: _3!, actor: _4!, oldReactions: _5!, newReactions: _6!, qts: _7!)
}
public static func parse_updateBotMessageReactions(_ reader: BufferReader) -> Update? {
var _1: Api.Peer?
@@ -3278,12 +3260,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.Update.updateBotMessageReactions(peer: _1!, msgId: _2!, date: _3!, reactions: _4!, qts: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.Update.updateBotMessageReactions(peer: _1!, msgId: _2!, date: _3!, reactions: _4!, qts: _5!)
}
public static func parse_updateBotNewBusinessMessage(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -3305,12 +3287,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.Update.updateBotNewBusinessMessage(flags: _1!, connectionId: _2!, message: _3!, replyToMessage: _4, qts: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.Update.updateBotNewBusinessMessage(flags: _1!, connectionId: _2!, message: _3!, replyToMessage: _4, qts: _5!)
}
public static func parse_updateBotPrecheckoutQuery(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -3339,12 +3321,15 @@ public extension Api {
let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil
let _c7 = _7 != nil
let _c8 = _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.Update.updateBotPrecheckoutQuery(flags: _1!, queryId: _2!, userId: _3!, payload: _4!, info: _5, shippingOptionId: _6, currency: _7!, totalAmount: _8!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.Update.updateBotPrecheckoutQuery(flags: _1!, queryId: _2!, userId: _3!, payload: _4!, info: _5, shippingOptionId: _6, currency: _7!, totalAmount: _8!)
}
public static func parse_updateBotPurchasedPaidMedia(_ reader: BufferReader) -> Update? {
var _1: Int64?
@@ -3356,12 +3341,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateBotPurchasedPaidMedia(userId: _1!, payload: _2!, qts: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateBotPurchasedPaidMedia(userId: _1!, payload: _2!, qts: _3!)
}
public static func parse_updateBotShippingQuery(_ reader: BufferReader) -> Update? {
var _1: Int64?
@@ -3378,12 +3361,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.Update.updateBotShippingQuery(queryId: _1!, userId: _2!, payload: _3!, shippingAddress: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.Update.updateBotShippingQuery(queryId: _1!, userId: _2!, payload: _3!, shippingAddress: _4!)
}
public static func parse_updateBotStopped(_ reader: BufferReader) -> Update? {
var _1: Int64?
@@ -3400,12 +3382,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.Update.updateBotStopped(userId: _1!, date: _2!, stopped: _3!, qts: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.Update.updateBotStopped(userId: _1!, date: _2!, stopped: _3!, qts: _4!)
}
public static func parse_updateBotWebhookJSON(_ reader: BufferReader) -> Update? {
var _1: Api.DataJSON?
@@ -3413,12 +3394,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.DataJSON
}
let _c1 = _1 != nil
- if _c1 {
- return Api.Update.updateBotWebhookJSON(data: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Update.updateBotWebhookJSON(data: _1!)
}
public static func parse_updateBotWebhookJSONQuery(_ reader: BufferReader) -> Update? {
var _1: Int64?
@@ -3432,12 +3409,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateBotWebhookJSONQuery(queryId: _1!, data: _2!, timeout: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateBotWebhookJSONQuery(queryId: _1!, data: _2!, timeout: _3!)
}
public static func parse_updateBusinessBotCallbackQuery(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -3468,23 +3443,22 @@ public extension Api {
let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil
let _c7 = _7 != nil
let _c8 = (Int(_1!) & Int(1 << 0) == 0) || _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.Update.updateBusinessBotCallbackQuery(flags: _1!, queryId: _2!, userId: _3!, connectionId: _4!, message: _5!, replyToMessage: _6, chatInstance: _7!, data: _8)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.Update.updateBusinessBotCallbackQuery(flags: _1!, queryId: _2!, userId: _3!, connectionId: _4!, message: _5!, replyToMessage: _6, chatInstance: _7!, data: _8)
}
public static func parse_updateChannel(_ reader: BufferReader) -> Update? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
- if _c1 {
- return Api.Update.updateChannel(channelId: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Update.updateChannel(channelId: _1!)
}
public static func parse_updateChannelAvailableMessages(_ reader: BufferReader) -> Update? {
var _1: Int64?
@@ -3493,12 +3467,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updateChannelAvailableMessages(channelId: _1!, availableMinId: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updateChannelAvailableMessages(channelId: _1!, availableMinId: _2!)
}
public static func parse_updateChannelMessageForwards(_ reader: BufferReader) -> Update? {
var _1: Int64?
@@ -3510,12 +3481,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateChannelMessageForwards(channelId: _1!, id: _2!, forwards: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateChannelMessageForwards(channelId: _1!, id: _2!, forwards: _3!)
}
public static func parse_updateChannelMessageViews(_ reader: BufferReader) -> Update? {
var _1: Int64?
@@ -3527,12 +3496,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateChannelMessageViews(channelId: _1!, id: _2!, views: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateChannelMessageViews(channelId: _1!, id: _2!, views: _3!)
}
public static func parse_updateChannelParticipant(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -3568,12 +3535,16 @@ public extension Api {
let _c7 = (Int(_1!) & Int(1 << 1) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 2) == 0) || _8 != nil
let _c9 = _9 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
- return Api.Update.updateChannelParticipant(flags: _1!, channelId: _2!, date: _3!, actorId: _4!, userId: _5!, prevParticipant: _6, newParticipant: _7, invite: _8, qts: _9!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ return Api.Update.updateChannelParticipant(flags: _1!, channelId: _2!, date: _3!, actorId: _4!, userId: _5!, prevParticipant: _6, newParticipant: _7, invite: _8, qts: _9!)
}
public static func parse_updateChannelReadMessagesContents(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -3595,12 +3566,12 @@ public extension Api {
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.Update.updateChannelReadMessagesContents(flags: _1!, channelId: _2!, topMsgId: _3, savedPeerId: _4, messages: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.Update.updateChannelReadMessagesContents(flags: _1!, channelId: _2!, topMsgId: _3, savedPeerId: _4, messages: _5!)
}
public static func parse_updateChannelTooLong(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -3612,12 +3583,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateChannelTooLong(flags: _1!, channelId: _2!, pts: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateChannelTooLong(flags: _1!, channelId: _2!, pts: _3)
}
public static func parse_updateChannelUserTyping(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -3639,12 +3608,12 @@ public extension Api {
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.Update.updateChannelUserTyping(flags: _1!, channelId: _2!, topMsgId: _3, fromId: _4!, action: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.Update.updateChannelUserTyping(flags: _1!, channelId: _2!, topMsgId: _3, fromId: _4!, action: _5!)
}
public static func parse_updateChannelViewForumAsMessages(_ reader: BufferReader) -> Update? {
var _1: Int64?
@@ -3655,12 +3624,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updateChannelViewForumAsMessages(channelId: _1!, enabled: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updateChannelViewForumAsMessages(channelId: _1!, enabled: _2!)
}
public static func parse_updateChannelWebPage(_ reader: BufferReader) -> Update? {
var _1: Int64?
@@ -3677,23 +3643,18 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.Update.updateChannelWebPage(channelId: _1!, webpage: _2!, pts: _3!, ptsCount: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.Update.updateChannelWebPage(channelId: _1!, webpage: _2!, pts: _3!, ptsCount: _4!)
}
public static func parse_updateChat(_ reader: BufferReader) -> Update? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
- if _c1 {
- return Api.Update.updateChat(chatId: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Update.updateChat(chatId: _1!)
}
public static func parse_updateChatDefaultBannedRights(_ reader: BufferReader) -> Update? {
var _1: Api.Peer?
@@ -3709,12 +3670,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateChatDefaultBannedRights(peer: _1!, defaultBannedRights: _2!, version: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateChatDefaultBannedRights(peer: _1!, defaultBannedRights: _2!, version: _3!)
}
public static func parse_updateChatParticipant(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -3750,12 +3709,16 @@ public extension Api {
let _c7 = (Int(_1!) & Int(1 << 1) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 2) == 0) || _8 != nil
let _c9 = _9 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
- return Api.Update.updateChatParticipant(flags: _1!, chatId: _2!, date: _3!, actorId: _4!, userId: _5!, prevParticipant: _6, newParticipant: _7, invite: _8, qts: _9!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ return Api.Update.updateChatParticipant(flags: _1!, chatId: _2!, date: _3!, actorId: _4!, userId: _5!, prevParticipant: _6, newParticipant: _7, invite: _8, qts: _9!)
}
public static func parse_updateChatParticipantAdd(_ reader: BufferReader) -> Update? {
var _1: Int64?
@@ -3773,12 +3736,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.Update.updateChatParticipantAdd(chatId: _1!, userId: _2!, inviterId: _3!, date: _4!, version: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.Update.updateChatParticipantAdd(chatId: _1!, userId: _2!, inviterId: _3!, date: _4!, version: _5!)
}
public static func parse_updateChatParticipantAdmin(_ reader: BufferReader) -> Update? {
var _1: Int64?
@@ -3795,12 +3758,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.Update.updateChatParticipantAdmin(chatId: _1!, userId: _2!, isAdmin: _3!, version: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.Update.updateChatParticipantAdmin(chatId: _1!, userId: _2!, isAdmin: _3!, version: _4!)
}
public static func parse_updateChatParticipantDelete(_ reader: BufferReader) -> Update? {
var _1: Int64?
@@ -3812,12 +3774,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateChatParticipantDelete(chatId: _1!, userId: _2!, version: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateChatParticipantDelete(chatId: _1!, userId: _2!, version: _3!)
}
public static func parse_updateChatParticipants(_ reader: BufferReader) -> Update? {
var _1: Api.ChatParticipants?
@@ -3825,12 +3785,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.ChatParticipants
}
let _c1 = _1 != nil
- if _c1 {
- return Api.Update.updateChatParticipants(participants: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Update.updateChatParticipants(participants: _1!)
}
public static func parse_updateChatUserTyping(_ reader: BufferReader) -> Update? {
var _1: Int64?
@@ -3846,12 +3802,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateChatUserTyping(chatId: _1!, fromId: _2!, action: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateChatUserTyping(chatId: _1!, fromId: _2!, action: _3!)
}
public static func parse_updateConfig(_ reader: BufferReader) -> Update? {
return Api.Update.updateConfig
@@ -3865,12 +3819,8 @@ public extension Api {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.DcOption.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.Update.updateDcOptions(dcOptions: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Update.updateDcOptions(dcOptions: _1!)
}
public static func parse_updateDeleteChannelMessages(_ reader: BufferReader) -> Update? {
var _1: Int64?
@@ -3887,12 +3837,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.Update.updateDeleteChannelMessages(channelId: _1!, messages: _2!, pts: _3!, ptsCount: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.Update.updateDeleteChannelMessages(channelId: _1!, messages: _2!, pts: _3!, ptsCount: _4!)
}
public static func parse_updateDeleteGroupCallMessages(_ reader: BufferReader) -> Update? {
var _1: Api.InputGroupCall?
@@ -3905,12 +3854,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updateDeleteGroupCallMessages(call: _1!, messages: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updateDeleteGroupCallMessages(call: _1!, messages: _2!)
}
public static func parse_updateDeleteMessages(_ reader: BufferReader) -> Update? {
var _1: [Int32]?
@@ -3924,23 +3870,17 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateDeleteMessages(messages: _1!, pts: _2!, ptsCount: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateDeleteMessages(messages: _1!, pts: _2!, ptsCount: _3!)
}
public static func parse_updateDeleteQuickReply(_ reader: BufferReader) -> Update? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.Update.updateDeleteQuickReply(shortcutId: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Update.updateDeleteQuickReply(shortcutId: _1!)
}
public static func parse_updateDeleteQuickReplyMessages(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -3951,12 +3891,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updateDeleteQuickReplyMessages(shortcutId: _1!, messages: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updateDeleteQuickReplyMessages(shortcutId: _1!, messages: _2!)
}
public static func parse_updateDeleteScheduledMessages(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -3977,12 +3914,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.Update.updateDeleteScheduledMessages(flags: _1!, peer: _2!, messages: _3!, sentMessages: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.Update.updateDeleteScheduledMessages(flags: _1!, peer: _2!, messages: _3!, sentMessages: _4)
}
public static func parse_updateDialogFilter(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -3996,12 +3932,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateDialogFilter(flags: _1!, id: _2!, filter: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateDialogFilter(flags: _1!, id: _2!, filter: _3)
}
public static func parse_updateDialogFilterOrder(_ reader: BufferReader) -> Update? {
var _1: [Int32]?
@@ -4009,12 +3943,8 @@ public extension Api {
_1 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.Update.updateDialogFilterOrder(order: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Update.updateDialogFilterOrder(order: _1!)
}
public static func parse_updateDialogFilters(_ reader: BufferReader) -> Update? {
return Api.Update.updateDialogFilters
@@ -4031,12 +3961,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 1) == 0) || _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateDialogPinned(flags: _1!, folderId: _2, peer: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateDialogPinned(flags: _1!, folderId: _2, peer: _3!)
}
public static func parse_updateDialogUnreadMark(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -4052,12 +3980,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateDialogUnreadMark(flags: _1!, peer: _2!, savedPeerId: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateDialogUnreadMark(flags: _1!, peer: _2!, savedPeerId: _3)
}
public static func parse_updateDraftMessage(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -4081,12 +4007,12 @@ public extension Api {
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.Update.updateDraftMessage(flags: _1!, peer: _2!, topMsgId: _3, savedPeerId: _4, draft: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.Update.updateDraftMessage(flags: _1!, peer: _2!, topMsgId: _3, savedPeerId: _4, draft: _5!)
}
public static func parse_updateEditChannelMessage(_ reader: BufferReader) -> Update? {
var _1: Api.Message?
@@ -4100,12 +4026,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateEditChannelMessage(message: _1!, pts: _2!, ptsCount: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateEditChannelMessage(message: _1!, pts: _2!, ptsCount: _3!)
}
public static func parse_updateEditMessage(_ reader: BufferReader) -> Update? {
var _1: Api.Message?
@@ -4119,23 +4043,26 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateEditMessage(message: _1!, pts: _2!, ptsCount: _3!)
- }
- else {
- return nil
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateEditMessage(message: _1!, pts: _2!, ptsCount: _3!)
+ }
+ public static func parse_updateEmojiGameInfo(_ reader: BufferReader) -> Update? {
+ var _1: Api.messages.EmojiGameInfo?
+ if let signature = reader.readInt32() {
+ _1 = Api.parse(reader, signature: signature) as? Api.messages.EmojiGameInfo
}
+ let _c1 = _1 != nil
+ if !_c1 { return nil }
+ return Api.Update.updateEmojiGameInfo(info: _1!)
}
public static func parse_updateEncryptedChatTyping(_ reader: BufferReader) -> Update? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.Update.updateEncryptedChatTyping(chatId: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Update.updateEncryptedChatTyping(chatId: _1!)
}
public static func parse_updateEncryptedMessagesRead(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -4147,12 +4074,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateEncryptedMessagesRead(chatId: _1!, maxDate: _2!, date: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateEncryptedMessagesRead(chatId: _1!, maxDate: _2!, date: _3!)
}
public static func parse_updateEncryption(_ reader: BufferReader) -> Update? {
var _1: Api.EncryptedChat?
@@ -4163,12 +4088,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updateEncryption(chat: _1!, date: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updateEncryption(chat: _1!, date: _2!)
}
public static func parse_updateFavedStickers(_ reader: BufferReader) -> Update? {
return Api.Update.updateFavedStickers
@@ -4185,12 +4107,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateFolderPeers(folderPeers: _1!, pts: _2!, ptsCount: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateFolderPeers(folderPeers: _1!, pts: _2!, ptsCount: _3!)
}
public static func parse_updateGeoLiveViewed(_ reader: BufferReader) -> Update? {
var _1: Api.Peer?
@@ -4201,12 +4121,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updateGeoLiveViewed(peer: _1!, msgId: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updateGeoLiveViewed(peer: _1!, msgId: _2!)
}
public static func parse_updateGroupCall(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -4222,12 +4139,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 1) == 0) || _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateGroupCall(flags: _1!, peer: _2, call: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateGroupCall(flags: _1!, peer: _2, call: _3!)
}
public static func parse_updateGroupCallChainBlocks(_ reader: BufferReader) -> Update? {
var _1: Api.InputGroupCall?
@@ -4246,12 +4161,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.Update.updateGroupCallChainBlocks(call: _1!, subChainId: _2!, blocks: _3!, nextOffset: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.Update.updateGroupCallChainBlocks(call: _1!, subChainId: _2!, blocks: _3!, nextOffset: _4!)
}
public static func parse_updateGroupCallConnection(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -4262,12 +4176,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updateGroupCallConnection(flags: _1!, params: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updateGroupCallConnection(flags: _1!, params: _2!)
}
public static func parse_updateGroupCallEncryptedMessage(_ reader: BufferReader) -> Update? {
var _1: Api.InputGroupCall?
@@ -4283,12 +4194,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateGroupCallEncryptedMessage(call: _1!, fromId: _2!, encryptedMessage: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateGroupCallEncryptedMessage(call: _1!, fromId: _2!, encryptedMessage: _3!)
}
public static func parse_updateGroupCallMessage(_ reader: BufferReader) -> Update? {
var _1: Api.InputGroupCall?
@@ -4301,12 +4210,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updateGroupCallMessage(call: _1!, message: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updateGroupCallMessage(call: _1!, message: _2!)
}
public static func parse_updateGroupCallParticipants(_ reader: BufferReader) -> Update? {
var _1: Api.InputGroupCall?
@@ -4322,12 +4228,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateGroupCallParticipants(call: _1!, participants: _2!, version: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateGroupCallParticipants(call: _1!, participants: _2!, version: _3!)
}
public static func parse_updateInlineBotCallbackQuery(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -4353,12 +4257,14 @@ public extension Api {
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 1) == 0) || _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.Update.updateInlineBotCallbackQuery(flags: _1!, queryId: _2!, userId: _3!, msgId: _4!, chatInstance: _5!, data: _6, gameShortName: _7)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.Update.updateInlineBotCallbackQuery(flags: _1!, queryId: _2!, userId: _3!, msgId: _4!, chatInstance: _5!, data: _6, gameShortName: _7)
}
public static func parse_updateLangPack(_ reader: BufferReader) -> Update? {
var _1: Api.LangPackDifference?
@@ -4366,23 +4272,15 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.LangPackDifference
}
let _c1 = _1 != nil
- if _c1 {
- return Api.Update.updateLangPack(difference: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Update.updateLangPack(difference: _1!)
}
public static func parse_updateLangPackTooLong(_ reader: BufferReader) -> Update? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.Update.updateLangPackTooLong(langCode: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Update.updateLangPackTooLong(langCode: _1!)
}
public static func parse_updateLoginToken(_ reader: BufferReader) -> Update? {
return Api.Update.updateLoginToken
@@ -4401,12 +4299,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateMessageExtendedMedia(peer: _1!, msgId: _2!, extendedMedia: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateMessageExtendedMedia(peer: _1!, msgId: _2!, extendedMedia: _3!)
}
public static func parse_updateMessageID(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -4415,12 +4311,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updateMessageID(id: _1!, randomId: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updateMessageID(id: _1!, randomId: _2!)
}
public static func parse_updateMessagePoll(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -4439,12 +4332,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.Update.updateMessagePoll(flags: _1!, pollId: _2!, poll: _3, results: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.Update.updateMessagePoll(flags: _1!, pollId: _2!, poll: _3, results: _4!)
}
public static func parse_updateMessagePollVote(_ reader: BufferReader) -> Update? {
var _1: Int64?
@@ -4463,12 +4355,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.Update.updateMessagePollVote(pollId: _1!, peer: _2!, options: _3!, qts: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.Update.updateMessagePollVote(pollId: _1!, peer: _2!, options: _3!, qts: _4!)
}
public static func parse_updateMessageReactions(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -4495,12 +4386,13 @@ public extension Api {
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
let _c6 = _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.Update.updateMessageReactions(flags: _1!, peer: _2!, msgId: _3!, topMsgId: _4, savedPeerId: _5, reactions: _6!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.Update.updateMessageReactions(flags: _1!, peer: _2!, msgId: _3!, topMsgId: _4, savedPeerId: _5, reactions: _6!)
}
public static func parse_updateMonoForumNoPaidException(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -4514,12 +4406,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateMonoForumNoPaidException(flags: _1!, channelId: _2!, savedPeerId: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateMonoForumNoPaidException(flags: _1!, channelId: _2!, savedPeerId: _3!)
}
public static func parse_updateMoveStickerSetToTop(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -4528,12 +4418,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updateMoveStickerSetToTop(flags: _1!, stickerset: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updateMoveStickerSetToTop(flags: _1!, stickerset: _2!)
}
public static func parse_updateNewAuthorization(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -4551,12 +4438,12 @@ public extension Api {
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.Update.updateNewAuthorization(flags: _1!, hash: _2!, date: _3, device: _4, location: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.Update.updateNewAuthorization(flags: _1!, hash: _2!, date: _3, device: _4, location: _5)
}
public static func parse_updateNewChannelMessage(_ reader: BufferReader) -> Update? {
var _1: Api.Message?
@@ -4570,12 +4457,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateNewChannelMessage(message: _1!, pts: _2!, ptsCount: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateNewChannelMessage(message: _1!, pts: _2!, ptsCount: _3!)
}
public static func parse_updateNewEncryptedMessage(_ reader: BufferReader) -> Update? {
var _1: Api.EncryptedMessage?
@@ -4586,12 +4471,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updateNewEncryptedMessage(message: _1!, qts: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updateNewEncryptedMessage(message: _1!, qts: _2!)
}
public static func parse_updateNewMessage(_ reader: BufferReader) -> Update? {
var _1: Api.Message?
@@ -4605,12 +4487,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateNewMessage(message: _1!, pts: _2!, ptsCount: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateNewMessage(message: _1!, pts: _2!, ptsCount: _3!)
}
public static func parse_updateNewQuickReply(_ reader: BufferReader) -> Update? {
var _1: Api.QuickReply?
@@ -4618,12 +4498,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.QuickReply
}
let _c1 = _1 != nil
- if _c1 {
- return Api.Update.updateNewQuickReply(quickReply: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Update.updateNewQuickReply(quickReply: _1!)
}
public static func parse_updateNewScheduledMessage(_ reader: BufferReader) -> Update? {
var _1: Api.Message?
@@ -4631,12 +4507,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.Message
}
let _c1 = _1 != nil
- if _c1 {
- return Api.Update.updateNewScheduledMessage(message: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Update.updateNewScheduledMessage(message: _1!)
}
public static func parse_updateNewStickerSet(_ reader: BufferReader) -> Update? {
var _1: Api.messages.StickerSet?
@@ -4644,12 +4516,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.messages.StickerSet
}
let _c1 = _1 != nil
- if _c1 {
- return Api.Update.updateNewStickerSet(stickerset: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Update.updateNewStickerSet(stickerset: _1!)
}
public static func parse_updateNewStoryReaction(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -4665,12 +4533,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateNewStoryReaction(storyId: _1!, peer: _2!, reaction: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateNewStoryReaction(storyId: _1!, peer: _2!, reaction: _3!)
}
public static func parse_updateNotifySettings(_ reader: BufferReader) -> Update? {
var _1: Api.NotifyPeer?
@@ -4683,12 +4549,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updateNotifySettings(peer: _1!, notifySettings: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updateNotifySettings(peer: _1!, notifySettings: _2!)
}
public static func parse_updatePaidReactionPrivacy(_ reader: BufferReader) -> Update? {
var _1: Api.PaidReactionPrivacy?
@@ -4696,12 +4559,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.PaidReactionPrivacy
}
let _c1 = _1 != nil
- if _c1 {
- return Api.Update.updatePaidReactionPrivacy(private: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Update.updatePaidReactionPrivacy(private: _1!)
}
public static func parse_updatePeerBlocked(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -4712,12 +4571,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updatePeerBlocked(flags: _1!, peerId: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updatePeerBlocked(flags: _1!, peerId: _2!)
}
public static func parse_updatePeerHistoryTTL(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -4731,12 +4587,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updatePeerHistoryTTL(flags: _1!, peer: _2!, ttlPeriod: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updatePeerHistoryTTL(flags: _1!, peer: _2!, ttlPeriod: _3)
}
public static func parse_updatePeerLocated(_ reader: BufferReader) -> Update? {
var _1: [Api.PeerLocated]?
@@ -4744,12 +4598,8 @@ public extension Api {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PeerLocated.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.Update.updatePeerLocated(peers: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Update.updatePeerLocated(peers: _1!)
}
public static func parse_updatePeerSettings(_ reader: BufferReader) -> Update? {
var _1: Api.Peer?
@@ -4762,12 +4612,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updatePeerSettings(peer: _1!, settings: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updatePeerSettings(peer: _1!, settings: _2!)
}
public static func parse_updatePeerWallpaper(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -4783,12 +4630,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updatePeerWallpaper(flags: _1!, peer: _2!, wallpaper: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updatePeerWallpaper(flags: _1!, peer: _2!, wallpaper: _3)
}
public static func parse_updatePendingJoinRequests(_ reader: BufferReader) -> Update? {
var _1: Api.Peer?
@@ -4804,12 +4649,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updatePendingJoinRequests(peer: _1!, requestsPending: _2!, recentRequesters: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updatePendingJoinRequests(peer: _1!, requestsPending: _2!, recentRequesters: _3!)
}
public static func parse_updatePhoneCall(_ reader: BufferReader) -> Update? {
var _1: Api.PhoneCall?
@@ -4817,12 +4660,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.PhoneCall
}
let _c1 = _1 != nil
- if _c1 {
- return Api.Update.updatePhoneCall(phoneCall: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Update.updatePhoneCall(phoneCall: _1!)
}
public static func parse_updatePhoneCallSignalingData(_ reader: BufferReader) -> Update? {
var _1: Int64?
@@ -4831,12 +4670,9 @@ public extension Api {
_2 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updatePhoneCallSignalingData(phoneCallId: _1!, data: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updatePhoneCallSignalingData(phoneCallId: _1!, data: _2!)
}
public static func parse_updatePinnedChannelMessages(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -4856,12 +4692,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.Update.updatePinnedChannelMessages(flags: _1!, channelId: _2!, messages: _3!, pts: _4!, ptsCount: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.Update.updatePinnedChannelMessages(flags: _1!, channelId: _2!, messages: _3!, pts: _4!, ptsCount: _5!)
}
public static func parse_updatePinnedDialogs(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -4875,12 +4711,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 1) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updatePinnedDialogs(flags: _1!, folderId: _2, order: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updatePinnedDialogs(flags: _1!, folderId: _2, order: _3)
}
public static func parse_updatePinnedForumTopic(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -4894,12 +4728,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updatePinnedForumTopic(flags: _1!, peer: _2!, topicId: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updatePinnedForumTopic(flags: _1!, peer: _2!, topicId: _3!)
}
public static func parse_updatePinnedForumTopics(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -4915,12 +4747,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updatePinnedForumTopics(flags: _1!, peer: _2!, order: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updatePinnedForumTopics(flags: _1!, peer: _2!, order: _3)
}
public static func parse_updatePinnedMessages(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -4942,12 +4772,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.Update.updatePinnedMessages(flags: _1!, peer: _2!, messages: _3!, pts: _4!, ptsCount: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.Update.updatePinnedMessages(flags: _1!, peer: _2!, messages: _3!, pts: _4!, ptsCount: _5!)
}
public static func parse_updatePinnedSavedDialogs(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -4958,12 +4788,9 @@ public extension Api {
} }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
- if _c1 && _c2 {
- return Api.Update.updatePinnedSavedDialogs(flags: _1!, order: _2)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updatePinnedSavedDialogs(flags: _1!, order: _2)
}
public static func parse_updatePrivacy(_ reader: BufferReader) -> Update? {
var _1: Api.PrivacyKey?
@@ -4976,12 +4803,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updatePrivacy(key: _1!, rules: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updatePrivacy(key: _1!, rules: _2!)
}
public static func parse_updatePtsChanged(_ reader: BufferReader) -> Update? {
return Api.Update.updatePtsChanged
@@ -4992,12 +4816,8 @@ public extension Api {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.QuickReply.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.Update.updateQuickReplies(quickReplies: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Update.updateQuickReplies(quickReplies: _1!)
}
public static func parse_updateQuickReplyMessage(_ reader: BufferReader) -> Update? {
var _1: Api.Message?
@@ -5005,12 +4825,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.Message
}
let _c1 = _1 != nil
- if _c1 {
- return Api.Update.updateQuickReplyMessage(message: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Update.updateQuickReplyMessage(message: _1!)
}
public static func parse_updateReadChannelDiscussionInbox(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -5031,12 +4847,13 @@ public extension Api {
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.Update.updateReadChannelDiscussionInbox(flags: _1!, channelId: _2!, topMsgId: _3!, readMaxId: _4!, broadcastId: _5, broadcastPost: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.Update.updateReadChannelDiscussionInbox(flags: _1!, channelId: _2!, topMsgId: _3!, readMaxId: _4!, broadcastId: _5, broadcastPost: _6)
}
public static func parse_updateReadChannelDiscussionOutbox(_ reader: BufferReader) -> Update? {
var _1: Int64?
@@ -5048,12 +4865,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateReadChannelDiscussionOutbox(channelId: _1!, topMsgId: _2!, readMaxId: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateReadChannelDiscussionOutbox(channelId: _1!, topMsgId: _2!, readMaxId: _3!)
}
public static func parse_updateReadChannelInbox(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -5074,12 +4889,13 @@ public extension Api {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.Update.updateReadChannelInbox(flags: _1!, folderId: _2, channelId: _3!, maxId: _4!, stillUnreadCount: _5!, pts: _6!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.Update.updateReadChannelInbox(flags: _1!, folderId: _2, channelId: _3!, maxId: _4!, stillUnreadCount: _5!, pts: _6!)
}
public static func parse_updateReadChannelOutbox(_ reader: BufferReader) -> Update? {
var _1: Int64?
@@ -5088,12 +4904,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updateReadChannelOutbox(channelId: _1!, maxId: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updateReadChannelOutbox(channelId: _1!, maxId: _2!)
}
public static func parse_updateReadFeaturedEmojiStickers(_ reader: BufferReader) -> Update? {
return Api.Update.updateReadFeaturedEmojiStickers
@@ -5128,12 +4941,15 @@ public extension Api {
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.Update.updateReadHistoryInbox(flags: _1!, folderId: _2, peer: _3!, topMsgId: _4, maxId: _5!, stillUnreadCount: _6!, pts: _7!, ptsCount: _8!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.Update.updateReadHistoryInbox(flags: _1!, folderId: _2, peer: _3!, topMsgId: _4, maxId: _5!, stillUnreadCount: _6!, pts: _7!, ptsCount: _8!)
}
public static func parse_updateReadHistoryOutbox(_ reader: BufferReader) -> Update? {
var _1: Api.Peer?
@@ -5150,12 +4966,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.Update.updateReadHistoryOutbox(peer: _1!, maxId: _2!, pts: _3!, ptsCount: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.Update.updateReadHistoryOutbox(peer: _1!, maxId: _2!, pts: _3!, ptsCount: _4!)
}
public static func parse_updateReadMessagesContents(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -5175,12 +4990,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.Update.updateReadMessagesContents(flags: _1!, messages: _2!, pts: _3!, ptsCount: _4!, date: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.Update.updateReadMessagesContents(flags: _1!, messages: _2!, pts: _3!, ptsCount: _4!, date: _5)
}
public static func parse_updateReadMonoForumInbox(_ reader: BufferReader) -> Update? {
var _1: Int64?
@@ -5194,12 +5009,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateReadMonoForumInbox(channelId: _1!, savedPeerId: _2!, readMaxId: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateReadMonoForumInbox(channelId: _1!, savedPeerId: _2!, readMaxId: _3!)
}
public static func parse_updateReadMonoForumOutbox(_ reader: BufferReader) -> Update? {
var _1: Int64?
@@ -5213,12 +5026,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateReadMonoForumOutbox(channelId: _1!, savedPeerId: _2!, readMaxId: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateReadMonoForumOutbox(channelId: _1!, savedPeerId: _2!, readMaxId: _3!)
}
public static func parse_updateReadStories(_ reader: BufferReader) -> Update? {
var _1: Api.Peer?
@@ -5229,12 +5040,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updateReadStories(peer: _1!, maxId: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updateReadStories(peer: _1!, maxId: _2!)
}
public static func parse_updateRecentEmojiStatuses(_ reader: BufferReader) -> Update? {
return Api.Update.updateRecentEmojiStatuses
@@ -5254,12 +5062,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updateSavedDialogPinned(flags: _1!, peer: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updateSavedDialogPinned(flags: _1!, peer: _2!)
}
public static func parse_updateSavedGifs(_ reader: BufferReader) -> Update? {
return Api.Update.updateSavedGifs
@@ -5276,12 +5081,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.auth.SentCode
}
let _c1 = _1 != nil
- if _c1 {
- return Api.Update.updateSentPhoneCode(sentCode: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Update.updateSentPhoneCode(sentCode: _1!)
}
public static func parse_updateSentStoryReaction(_ reader: BufferReader) -> Update? {
var _1: Api.Peer?
@@ -5297,12 +5098,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateSentStoryReaction(peer: _1!, storyId: _2!, reaction: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateSentStoryReaction(peer: _1!, storyId: _2!, reaction: _3!)
}
public static func parse_updateServiceNotification(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -5327,23 +5126,20 @@ public extension Api {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.Update.updateServiceNotification(flags: _1!, inboxDate: _2, type: _3!, message: _4!, media: _5!, entities: _6!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.Update.updateServiceNotification(flags: _1!, inboxDate: _2, type: _3!, message: _4!, media: _5!, entities: _6!)
}
public static func parse_updateSmsJob(_ reader: BufferReader) -> Update? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.Update.updateSmsJob(jobId: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Update.updateSmsJob(jobId: _1!)
}
public static func parse_updateStarGiftAuctionState(_ reader: BufferReader) -> Update? {
var _1: Int64?
@@ -5354,12 +5150,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updateStarGiftAuctionState(giftId: _1!, state: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updateStarGiftAuctionState(giftId: _1!, state: _2!)
}
public static func parse_updateStarGiftAuctionUserState(_ reader: BufferReader) -> Update? {
var _1: Int64?
@@ -5370,12 +5163,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updateStarGiftAuctionUserState(giftId: _1!, userState: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updateStarGiftAuctionUserState(giftId: _1!, userState: _2!)
}
public static func parse_updateStarsBalance(_ reader: BufferReader) -> Update? {
var _1: Api.StarsAmount?
@@ -5383,12 +5173,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.StarsAmount
}
let _c1 = _1 != nil
- if _c1 {
- return Api.Update.updateStarsBalance(balance: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Update.updateStarsBalance(balance: _1!)
}
public static func parse_updateStarsRevenueStatus(_ reader: BufferReader) -> Update? {
var _1: Api.Peer?
@@ -5401,23 +5187,16 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updateStarsRevenueStatus(peer: _1!, status: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updateStarsRevenueStatus(peer: _1!, status: _2!)
}
public static func parse_updateStickerSets(_ reader: BufferReader) -> Update? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.Update.updateStickerSets(flags: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Update.updateStickerSets(flags: _1!)
}
public static func parse_updateStickerSetsOrder(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -5428,12 +5207,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updateStickerSetsOrder(flags: _1!, order: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updateStickerSetsOrder(flags: _1!, order: _2!)
}
public static func parse_updateStoriesStealthMode(_ reader: BufferReader) -> Update? {
var _1: Api.StoriesStealthMode?
@@ -5441,12 +5217,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.StoriesStealthMode
}
let _c1 = _1 != nil
- if _c1 {
- return Api.Update.updateStoriesStealthMode(stealthMode: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Update.updateStoriesStealthMode(stealthMode: _1!)
}
public static func parse_updateStory(_ reader: BufferReader) -> Update? {
var _1: Api.Peer?
@@ -5459,12 +5231,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updateStory(peer: _1!, story: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updateStory(peer: _1!, story: _2!)
}
public static func parse_updateStoryID(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -5473,12 +5242,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updateStoryID(id: _1!, randomId: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updateStoryID(id: _1!, randomId: _2!)
}
public static func parse_updateTheme(_ reader: BufferReader) -> Update? {
var _1: Api.Theme?
@@ -5486,12 +5252,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.Theme
}
let _c1 = _1 != nil
- if _c1 {
- return Api.Update.updateTheme(theme: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Update.updateTheme(theme: _1!)
}
public static func parse_updateTranscribedAudio(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -5511,23 +5273,19 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.Update.updateTranscribedAudio(flags: _1!, peer: _2!, msgId: _3!, transcriptionId: _4!, text: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.Update.updateTranscribedAudio(flags: _1!, peer: _2!, msgId: _3!, transcriptionId: _4!, text: _5!)
}
public static func parse_updateUser(_ reader: BufferReader) -> Update? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
- if _c1 {
- return Api.Update.updateUser(userId: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Update.updateUser(userId: _1!)
}
public static func parse_updateUserEmojiStatus(_ reader: BufferReader) -> Update? {
var _1: Int64?
@@ -5538,12 +5296,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updateUserEmojiStatus(userId: _1!, emojiStatus: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updateUserEmojiStatus(userId: _1!, emojiStatus: _2!)
}
public static func parse_updateUserName(_ reader: BufferReader) -> Update? {
var _1: Int64?
@@ -5560,12 +5315,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.Update.updateUserName(userId: _1!, firstName: _2!, lastName: _3!, usernames: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.Update.updateUserName(userId: _1!, firstName: _2!, lastName: _3!, usernames: _4!)
}
public static func parse_updateUserPhone(_ reader: BufferReader) -> Update? {
var _1: Int64?
@@ -5574,12 +5328,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updateUserPhone(userId: _1!, phone: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updateUserPhone(userId: _1!, phone: _2!)
}
public static func parse_updateUserStatus(_ reader: BufferReader) -> Update? {
var _1: Int64?
@@ -5590,12 +5341,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Update.updateUserStatus(userId: _1!, status: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Update.updateUserStatus(userId: _1!, status: _2!)
}
public static func parse_updateUserTyping(_ reader: BufferReader) -> Update? {
var _1: Int32?
@@ -5612,12 +5360,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.Update.updateUserTyping(flags: _1!, userId: _2!, topMsgId: _3, action: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.Update.updateUserTyping(flags: _1!, userId: _2!, topMsgId: _3, action: _4!)
}
public static func parse_updateWebPage(_ reader: BufferReader) -> Update? {
var _1: Api.WebPage?
@@ -5631,23 +5378,17 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.Update.updateWebPage(webpage: _1!, pts: _2!, ptsCount: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.Update.updateWebPage(webpage: _1!, pts: _2!, ptsCount: _3!)
}
public static func parse_updateWebViewResultSent(_ reader: BufferReader) -> Update? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
- if _c1 {
- return Api.Update.updateWebViewResultSent(queryId: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Update.updateWebViewResultSent(queryId: _1!)
}
}
diff --git a/submodules/TelegramApi/Sources/Api28.swift b/submodules/TelegramApi/Sources/Api28.swift
index 69ae42de..247694f3 100644
--- a/submodules/TelegramApi/Sources/Api28.swift
+++ b/submodules/TelegramApi/Sources/Api28.swift
@@ -159,12 +159,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Updates.updateShort(update: _1!, date: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Updates.updateShort(update: _1!, date: _2!)
}
public static func parse_updateShortChatMessage(_ reader: BufferReader) -> Updates? {
var _1: Int32?
@@ -212,12 +209,20 @@ public extension Api {
let _c11 = (Int(_1!) & Int(1 << 3) == 0) || _11 != nil
let _c12 = (Int(_1!) & Int(1 << 7) == 0) || _12 != nil
let _c13 = (Int(_1!) & Int(1 << 25) == 0) || _13 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 {
- return Api.Updates.updateShortChatMessage(flags: _1!, id: _2!, fromId: _3!, chatId: _4!, message: _5!, pts: _6!, ptsCount: _7!, date: _8!, fwdFrom: _9, viaBotId: _10, replyTo: _11, entities: _12, ttlPeriod: _13)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ if !_c13 { return nil }
+ return Api.Updates.updateShortChatMessage(flags: _1!, id: _2!, fromId: _3!, chatId: _4!, message: _5!, pts: _6!, ptsCount: _7!, date: _8!, fwdFrom: _9, viaBotId: _10, replyTo: _11, entities: _12, ttlPeriod: _13)
}
public static func parse_updateShortMessage(_ reader: BufferReader) -> Updates? {
var _1: Int32?
@@ -262,12 +267,19 @@ public extension Api {
let _c10 = (Int(_1!) & Int(1 << 3) == 0) || _10 != nil
let _c11 = (Int(_1!) & Int(1 << 7) == 0) || _11 != nil
let _c12 = (Int(_1!) & Int(1 << 25) == 0) || _12 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 {
- return Api.Updates.updateShortMessage(flags: _1!, id: _2!, userId: _3!, message: _4!, pts: _5!, ptsCount: _6!, date: _7!, fwdFrom: _8, viaBotId: _9, replyTo: _10, entities: _11, ttlPeriod: _12)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ return Api.Updates.updateShortMessage(flags: _1!, id: _2!, userId: _3!, message: _4!, pts: _5!, ptsCount: _6!, date: _7!, fwdFrom: _8, viaBotId: _9, replyTo: _10, entities: _11, ttlPeriod: _12)
}
public static func parse_updateShortSentMessage(_ reader: BufferReader) -> Updates? {
var _1: Int32?
@@ -298,12 +310,15 @@ public extension Api {
let _c6 = (Int(_1!) & Int(1 << 9) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 7) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 25) == 0) || _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.Updates.updateShortSentMessage(flags: _1!, id: _2!, pts: _3!, ptsCount: _4!, date: _5!, media: _6, entities: _7, ttlPeriod: _8)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.Updates.updateShortSentMessage(flags: _1!, id: _2!, pts: _3!, ptsCount: _4!, date: _5!, media: _6, entities: _7, ttlPeriod: _8)
}
public static func parse_updates(_ reader: BufferReader) -> Updates? {
var _1: [Api.Update]?
@@ -327,12 +342,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.Updates.updates(updates: _1!, users: _2!, chats: _3!, date: _4!, seq: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.Updates.updates(updates: _1!, users: _2!, chats: _3!, date: _4!, seq: _5!)
}
public static func parse_updatesCombined(_ reader: BufferReader) -> Updates? {
var _1: [Api.Update]?
@@ -359,12 +374,13 @@ public extension Api {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.Updates.updatesCombined(updates: _1!, users: _2!, chats: _3!, date: _4!, seqStart: _5!, seq: _6!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.Updates.updatesCombined(updates: _1!, users: _2!, chats: _3!, date: _4!, seqStart: _5!, seq: _6!)
}
public static func parse_updatesTooLong(_ reader: BufferReader) -> Updates? {
return Api.Updates.updatesTooLong
@@ -418,12 +434,8 @@ public extension Api {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.UrlAuthResult.urlAuthResultAccepted(url: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.UrlAuthResult.urlAuthResultAccepted(url: _1!)
}
public static func parse_urlAuthResultDefault(_ reader: BufferReader) -> UrlAuthResult? {
return Api.UrlAuthResult.urlAuthResultDefault
@@ -440,12 +452,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.UrlAuthResult.urlAuthResultRequest(flags: _1!, bot: _2!, domain: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.UrlAuthResult.urlAuthResultRequest(flags: _1!, bot: _2!, domain: _3!)
}
}
@@ -593,23 +603,36 @@ public extension Api {
let _c20 = (Int(_2!) & Int(1 << 12) == 0) || _20 != nil
let _c21 = (Int(_2!) & Int(1 << 14) == 0) || _21 != nil
let _c22 = (Int(_2!) & Int(1 << 15) == 0) || _22 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 && _c19 && _c20 && _c21 && _c22 {
- return Api.User.user(flags: _1!, flags2: _2!, id: _3!, accessHash: _4, firstName: _5, lastName: _6, username: _7, phone: _8, photo: _9, status: _10, botInfoVersion: _11, restrictionReason: _12, botInlinePlaceholder: _13, langCode: _14, emojiStatus: _15, usernames: _16, storiesMaxId: _17, color: _18, profileColor: _19, botActiveUsers: _20, botVerificationIcon: _21, sendPaidMessagesStars: _22)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ if !_c13 { return nil }
+ if !_c14 { return nil }
+ if !_c15 { return nil }
+ if !_c16 { return nil }
+ if !_c17 { return nil }
+ if !_c18 { return nil }
+ if !_c19 { return nil }
+ if !_c20 { return nil }
+ if !_c21 { return nil }
+ if !_c22 { return nil }
+ return Api.User.user(flags: _1!, flags2: _2!, id: _3!, accessHash: _4, firstName: _5, lastName: _6, username: _7, phone: _8, photo: _9, status: _10, botInfoVersion: _11, restrictionReason: _12, botInlinePlaceholder: _13, langCode: _14, emojiStatus: _15, usernames: _16, storiesMaxId: _17, color: _18, profileColor: _19, botActiveUsers: _20, botVerificationIcon: _21, sendPaidMessagesStars: _22)
}
public static func parse_userEmpty(_ reader: BufferReader) -> User? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
- if _c1 {
- return Api.User.userEmpty(id: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.User.userEmpty(id: _1!)
}
}
@@ -842,12 +865,46 @@ public extension Api {
let _c37 = (Int(_2!) & Int(1 << 20) == 0) || _37 != nil
let _c38 = (Int(_2!) & Int(1 << 21) == 0) || _38 != nil
let _c39 = (Int(_2!) & Int(1 << 22) == 0) || _39 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 && _c19 && _c20 && _c21 && _c22 && _c23 && _c24 && _c25 && _c26 && _c27 && _c28 && _c29 && _c30 && _c31 && _c32 && _c33 && _c34 && _c35 && _c36 && _c37 && _c38 && _c39 {
- return Api.UserFull.userFull(flags: _1!, flags2: _2!, id: _3!, about: _4, settings: _5!, personalPhoto: _6, profilePhoto: _7, fallbackPhoto: _8, notifySettings: _9!, botInfo: _10, pinnedMsgId: _11, commonChatsCount: _12!, folderId: _13, ttlPeriod: _14, theme: _15, privateForwardName: _16, botGroupAdminRights: _17, botBroadcastAdminRights: _18, wallpaper: _19, stories: _20, businessWorkHours: _21, businessLocation: _22, businessGreetingMessage: _23, businessAwayMessage: _24, businessIntro: _25, birthday: _26, personalChannelId: _27, personalChannelMessage: _28, stargiftsCount: _29, starrefProgram: _30, botVerification: _31, sendPaidMessagesStars: _32, disallowedGifts: _33, starsRating: _34, starsMyPendingRating: _35, starsMyPendingRatingDate: _36, mainTab: _37, savedMusic: _38, note: _39)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ if !_c13 { return nil }
+ if !_c14 { return nil }
+ if !_c15 { return nil }
+ if !_c16 { return nil }
+ if !_c17 { return nil }
+ if !_c18 { return nil }
+ if !_c19 { return nil }
+ if !_c20 { return nil }
+ if !_c21 { return nil }
+ if !_c22 { return nil }
+ if !_c23 { return nil }
+ if !_c24 { return nil }
+ if !_c25 { return nil }
+ if !_c26 { return nil }
+ if !_c27 { return nil }
+ if !_c28 { return nil }
+ if !_c29 { return nil }
+ if !_c30 { return nil }
+ if !_c31 { return nil }
+ if !_c32 { return nil }
+ if !_c33 { return nil }
+ if !_c34 { return nil }
+ if !_c35 { return nil }
+ if !_c36 { return nil }
+ if !_c37 { return nil }
+ if !_c38 { return nil }
+ if !_c39 { return nil }
+ return Api.UserFull.userFull(flags: _1!, flags2: _2!, id: _3!, about: _4, settings: _5!, personalPhoto: _6, profilePhoto: _7, fallbackPhoto: _8, notifySettings: _9!, botInfo: _10, pinnedMsgId: _11, commonChatsCount: _12!, folderId: _13, ttlPeriod: _14, theme: _15, privateForwardName: _16, botGroupAdminRights: _17, botBroadcastAdminRights: _18, wallpaper: _19, stories: _20, businessWorkHours: _21, businessLocation: _22, businessGreetingMessage: _23, businessAwayMessage: _24, businessIntro: _25, birthday: _26, personalChannelId: _27, personalChannelMessage: _28, stargiftsCount: _29, starrefProgram: _30, botVerification: _31, sendPaidMessagesStars: _32, disallowedGifts: _33, starsRating: _34, starsMyPendingRating: _35, starsMyPendingRatingDate: _36, mainTab: _37, savedMusic: _38, note: _39)
}
}
@@ -899,12 +956,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.UserProfilePhoto.userProfilePhoto(flags: _1!, photoId: _2!, strippedThumb: _3, dcId: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.UserProfilePhoto.userProfilePhoto(flags: _1!, photoId: _2!, strippedThumb: _3, dcId: _4!)
}
public static func parse_userProfilePhotoEmpty(_ reader: BufferReader) -> UserProfilePhoto? {
return Api.UserProfilePhoto.userProfilePhotoEmpty
@@ -986,56 +1042,36 @@ public extension Api {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.UserStatus.userStatusLastMonth(flags: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.UserStatus.userStatusLastMonth(flags: _1!)
}
public static func parse_userStatusLastWeek(_ reader: BufferReader) -> UserStatus? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.UserStatus.userStatusLastWeek(flags: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.UserStatus.userStatusLastWeek(flags: _1!)
}
public static func parse_userStatusOffline(_ reader: BufferReader) -> UserStatus? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.UserStatus.userStatusOffline(wasOnline: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.UserStatus.userStatusOffline(wasOnline: _1!)
}
public static func parse_userStatusOnline(_ reader: BufferReader) -> UserStatus? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.UserStatus.userStatusOnline(expires: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.UserStatus.userStatusOnline(expires: _1!)
}
public static func parse_userStatusRecently(_ reader: BufferReader) -> UserStatus? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.UserStatus.userStatusRecently(flags: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.UserStatus.userStatusRecently(flags: _1!)
}
}
@@ -1070,12 +1106,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Username.username(flags: _1!, username: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Username.username(flags: _1!, username: _2!)
}
}
@@ -1155,12 +1188,13 @@ public extension Api {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.VideoSize.videoSize(flags: _1!, type: _2!, w: _3!, h: _4!, size: _5!, videoStartTs: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.VideoSize.videoSize(flags: _1!, type: _2!, w: _3!, h: _4!, size: _5!, videoStartTs: _6)
}
public static func parse_videoSizeEmojiMarkup(_ reader: BufferReader) -> VideoSize? {
var _1: Int64?
@@ -1171,12 +1205,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.VideoSize.videoSizeEmojiMarkup(emojiId: _1!, backgroundColors: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.VideoSize.videoSizeEmojiMarkup(emojiId: _1!, backgroundColors: _2!)
}
public static func parse_videoSizeStickerMarkup(_ reader: BufferReader) -> VideoSize? {
var _1: Api.InputStickerSet?
@@ -1192,12 +1223,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.VideoSize.videoSizeStickerMarkup(stickerset: _1!, stickerId: _2!, backgroundColors: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.VideoSize.videoSizeStickerMarkup(stickerset: _1!, stickerId: _2!, backgroundColors: _3!)
}
}
@@ -1263,12 +1292,13 @@ public extension Api {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_2!) & Int(1 << 2) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.WallPaper.wallPaper(id: _1!, flags: _2!, accessHash: _3!, slug: _4!, document: _5!, settings: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.WallPaper.wallPaper(id: _1!, flags: _2!, accessHash: _3!, slug: _4!, document: _5!, settings: _6)
}
public static func parse_wallPaperNoFile(_ reader: BufferReader) -> WallPaper? {
var _1: Int64?
@@ -1282,12 +1312,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_2!) & Int(1 << 2) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.WallPaper.wallPaperNoFile(id: _1!, flags: _2!, settings: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.WallPaper.wallPaperNoFile(id: _1!, flags: _2!, settings: _3)
}
}
@@ -1346,12 +1374,15 @@ public extension Api {
let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 4) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 7) == 0) || _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.WallPaperSettings.wallPaperSettings(flags: _1!, backgroundColor: _2, secondBackgroundColor: _3, thirdBackgroundColor: _4, fourthBackgroundColor: _5, intensity: _6, rotation: _7, emoticon: _8)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.WallPaperSettings.wallPaperSettings(flags: _1!, backgroundColor: _2, secondBackgroundColor: _3, thirdBackgroundColor: _4, fourthBackgroundColor: _5, intensity: _6, rotation: _7, emoticon: _8)
}
}
@@ -1414,12 +1445,16 @@ public extension Api {
let _c7 = _7 != nil
let _c8 = _8 != nil
let _c9 = _9 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
- return Api.WebAuthorization.webAuthorization(hash: _1!, botId: _2!, domain: _3!, browser: _4!, platform: _5!, dateCreated: _6!, dateActive: _7!, ip: _8!, region: _9!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ return Api.WebAuthorization.webAuthorization(hash: _1!, botId: _2!, domain: _3!, browser: _4!, platform: _5!, dateCreated: _6!, dateActive: _7!, ip: _8!, region: _9!)
}
}
@@ -1488,12 +1523,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.WebDocument.webDocument(url: _1!, accessHash: _2!, size: _3!, mimeType: _4!, attributes: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.WebDocument.webDocument(url: _1!, accessHash: _2!, size: _3!, mimeType: _4!, attributes: _5!)
}
public static func parse_webDocumentNoProxy(_ reader: BufferReader) -> WebDocument? {
var _1: String?
@@ -1510,12 +1545,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.WebDocument.webDocumentNoProxy(url: _1!, size: _2!, mimeType: _3!, attributes: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.WebDocument.webDocumentNoProxy(url: _1!, size: _2!, mimeType: _3!, attributes: _4!)
}
}
@@ -1663,12 +1697,26 @@ public extension Api {
let _c17 = (Int(_1!) & Int(1 << 9) == 0) || _17 != nil
let _c18 = (Int(_1!) & Int(1 << 10) == 0) || _18 != nil
let _c19 = (Int(_1!) & Int(1 << 12) == 0) || _19 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 && _c19 {
- return Api.WebPage.webPage(flags: _1!, id: _2!, url: _3!, displayUrl: _4!, hash: _5!, type: _6, siteName: _7, title: _8, description: _9, photo: _10, embedUrl: _11, embedType: _12, embedWidth: _13, embedHeight: _14, duration: _15, author: _16, document: _17, cachedPage: _18, attributes: _19)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ if !_c13 { return nil }
+ if !_c14 { return nil }
+ if !_c15 { return nil }
+ if !_c16 { return nil }
+ if !_c17 { return nil }
+ if !_c18 { return nil }
+ if !_c19 { return nil }
+ return Api.WebPage.webPage(flags: _1!, id: _2!, url: _3!, displayUrl: _4!, hash: _5!, type: _6, siteName: _7, title: _8, description: _9, photo: _10, embedUrl: _11, embedType: _12, embedWidth: _13, embedHeight: _14, duration: _15, author: _16, document: _17, cachedPage: _18, attributes: _19)
}
public static func parse_webPageEmpty(_ reader: BufferReader) -> WebPage? {
var _1: Int32?
@@ -1680,12 +1728,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.WebPage.webPageEmpty(flags: _1!, id: _2!, url: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.WebPage.webPageEmpty(flags: _1!, id: _2!, url: _3)
}
public static func parse_webPageNotModified(_ reader: BufferReader) -> WebPage? {
var _1: Int32?
@@ -1694,12 +1740,9 @@ public extension Api {
if Int(_1!) & Int(1 << 0) != 0 {_2 = reader.readInt32() }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
- if _c1 && _c2 {
- return Api.WebPage.webPageNotModified(flags: _1!, cachedPageViews: _2)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.WebPage.webPageNotModified(flags: _1!, cachedPageViews: _2)
}
public static func parse_webPagePending(_ reader: BufferReader) -> WebPage? {
var _1: Int32?
@@ -1714,12 +1757,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.WebPage.webPagePending(flags: _1!, id: _2!, url: _3, date: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.WebPage.webPagePending(flags: _1!, id: _2!, url: _3, date: _4!)
}
}
diff --git a/submodules/TelegramApi/Sources/Api29.swift b/submodules/TelegramApi/Sources/Api29.swift
index 17bc8c5a..7814d89e 100644
--- a/submodules/TelegramApi/Sources/Api29.swift
+++ b/submodules/TelegramApi/Sources/Api29.swift
@@ -93,12 +93,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.WebPageAttribute.webPageAttributeStarGiftAuction(gift: _1!, endDate: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.WebPageAttribute.webPageAttributeStarGiftAuction(gift: _1!, endDate: _2!)
}
public static func parse_webPageAttributeStarGiftCollection(_ reader: BufferReader) -> WebPageAttribute? {
var _1: [Api.Document]?
@@ -106,12 +103,8 @@ public extension Api {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Document.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.WebPageAttribute.webPageAttributeStarGiftCollection(icons: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.WebPageAttribute.webPageAttributeStarGiftCollection(icons: _1!)
}
public static func parse_webPageAttributeStickerSet(_ reader: BufferReader) -> WebPageAttribute? {
var _1: Int32?
@@ -122,12 +115,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.WebPageAttribute.webPageAttributeStickerSet(flags: _1!, stickers: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.WebPageAttribute.webPageAttributeStickerSet(flags: _1!, stickers: _2!)
}
public static func parse_webPageAttributeStory(_ reader: BufferReader) -> WebPageAttribute? {
var _1: Int32?
@@ -146,12 +136,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.WebPageAttribute.webPageAttributeStory(flags: _1!, peer: _2!, id: _3!, story: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.WebPageAttribute.webPageAttributeStory(flags: _1!, peer: _2!, id: _3!, story: _4)
}
public static func parse_webPageAttributeTheme(_ reader: BufferReader) -> WebPageAttribute? {
var _1: Int32?
@@ -167,12 +156,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.WebPageAttribute.webPageAttributeTheme(flags: _1!, documents: _2, settings: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.WebPageAttribute.webPageAttributeTheme(flags: _1!, documents: _2, settings: _3)
}
public static func parse_webPageAttributeUniqueStarGift(_ reader: BufferReader) -> WebPageAttribute? {
var _1: Api.StarGift?
@@ -180,12 +167,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.StarGift
}
let _c1 = _1 != nil
- if _c1 {
- return Api.WebPageAttribute.webPageAttributeUniqueStarGift(gift: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.WebPageAttribute.webPageAttributeUniqueStarGift(gift: _1!)
}
}
@@ -222,12 +205,9 @@ public extension Api {
} }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
- if _c1 && _c2 {
- return Api.WebViewMessageSent.webViewMessageSent(flags: _1!, msgId: _2)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.WebViewMessageSent.webViewMessageSent(flags: _1!, msgId: _2)
}
}
@@ -266,12 +246,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.WebViewResult.webViewResultUrl(flags: _1!, queryId: _2, url: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.WebViewResult.webViewResultUrl(flags: _1!, queryId: _2, url: _3!)
}
}
@@ -346,12 +324,13 @@ public extension Api.account {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.account.AuthorizationForm.authorizationForm(flags: _1!, requiredTypes: _2!, values: _3!, errors: _4!, users: _5!, privacyPolicyUrl: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.account.AuthorizationForm.authorizationForm(flags: _1!, requiredTypes: _2!, values: _3!, errors: _4!, users: _5!, privacyPolicyUrl: _6)
}
}
@@ -392,12 +371,9 @@ public extension Api.account {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.account.Authorizations.authorizations(authorizationTtlDays: _1!, authorizations: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.account.Authorizations.authorizations(authorizationTtlDays: _1!, authorizations: _2!)
}
}
@@ -442,12 +418,10 @@ public extension Api.account {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.account.AutoDownloadSettings.autoDownloadSettings(low: _1!, medium: _2!, high: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.account.AutoDownloadSettings.autoDownloadSettings(low: _1!, medium: _2!, high: _3!)
}
}
@@ -522,12 +496,13 @@ public extension Api.account {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.account.AutoSaveSettings.autoSaveSettings(usersSettings: _1!, chatsSettings: _2!, broadcastsSettings: _3!, exceptions: _4!, chats: _5!, users: _6!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.account.AutoSaveSettings.autoSaveSettings(usersSettings: _1!, chatsSettings: _2!, broadcastsSettings: _3!, exceptions: _4!, chats: _5!, users: _6!)
}
}
@@ -584,12 +559,10 @@ public extension Api.account {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.account.BusinessChatLinks.businessChatLinks(links: _1!, chats: _2!, users: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.account.BusinessChatLinks.businessChatLinks(links: _1!, chats: _2!, users: _3!)
}
}
@@ -667,12 +640,13 @@ public extension Api.account {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.account.ChatThemes.chatThemes(flags: _1!, hash: _2!, themes: _3!, chats: _4!, users: _5!, nextOffset: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.account.ChatThemes.chatThemes(flags: _1!, hash: _2!, themes: _3!, chats: _4!, users: _5!, nextOffset: _6)
}
public static func parse_chatThemesNotModified(_ reader: BufferReader) -> ChatThemes? {
return Api.account.ChatThemes.chatThemesNotModified
@@ -722,12 +696,9 @@ public extension Api.account {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.account.ConnectedBots.connectedBots(connectedBots: _1!, users: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.account.ConnectedBots.connectedBots(connectedBots: _1!, users: _2!)
}
}
@@ -758,12 +729,8 @@ public extension Api.account {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.account.ContentSettings.contentSettings(flags: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.account.ContentSettings.contentSettings(flags: _1!)
}
}
@@ -804,12 +771,8 @@ public extension Api.account {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.account.EmailVerified.emailVerified(email: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.account.EmailVerified.emailVerified(email: _1!)
}
public static func parse_emailVerifiedLogin(_ reader: BufferReader) -> EmailVerified? {
var _1: String?
@@ -820,12 +783,9 @@ public extension Api.account {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.account.EmailVerified.emailVerifiedLogin(email: _1!, sentCode: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.account.EmailVerified.emailVerifiedLogin(email: _1!, sentCode: _2!)
}
}
@@ -875,12 +835,9 @@ public extension Api.account {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.account.EmojiStatuses.emojiStatuses(hash: _1!, statuses: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.account.EmojiStatuses.emojiStatuses(hash: _1!, statuses: _2!)
}
public static func parse_emojiStatusesNotModified(_ reader: BufferReader) -> EmojiStatuses? {
return Api.account.EmojiStatuses.emojiStatusesNotModified
@@ -914,12 +871,8 @@ public extension Api.account {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
- if _c1 {
- return Api.account.PaidMessagesRevenue.paidMessagesRevenue(starsAmount: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.account.PaidMessagesRevenue.paidMessagesRevenue(starsAmount: _1!)
}
}
@@ -952,12 +905,8 @@ public extension Api.account {
_1 = Api.parse(reader, signature: signature) as? Api.DataJSON
}
let _c1 = _1 != nil
- if _c1 {
- return Api.account.PasskeyRegistrationOptions.passkeyRegistrationOptions(options: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.account.PasskeyRegistrationOptions.passkeyRegistrationOptions(options: _1!)
}
}
@@ -994,12 +943,8 @@ public extension Api.account {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Passkey.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.account.Passkeys.passkeys(passkeys: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.account.Passkeys.passkeys(passkeys: _1!)
}
}
@@ -1076,12 +1021,18 @@ public extension Api.account {
let _c9 = _9 != nil
let _c10 = (Int(_1!) & Int(1 << 5) == 0) || _10 != nil
let _c11 = (Int(_1!) & Int(1 << 6) == 0) || _11 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 {
- return Api.account.Password.password(flags: _1!, currentAlgo: _2, srpB: _3, srpId: _4, hint: _5, emailUnconfirmedPattern: _6, newAlgo: _7!, newSecureAlgo: _8!, secureRandom: _9!, pendingResetDate: _10, loginEmailPattern: _11)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ return Api.account.Password.password(flags: _1!, currentAlgo: _2, srpB: _3, srpId: _4, hint: _5, emailUnconfirmedPattern: _6, newAlgo: _7!, newSecureAlgo: _8!, secureRandom: _9!, pendingResetDate: _10, loginEmailPattern: _11)
}
}
@@ -1136,12 +1087,13 @@ public extension Api.account {
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.account.PasswordInputSettings.passwordInputSettings(flags: _1!, newAlgo: _2, newPasswordHash: _3, hint: _4, email: _5, newSecureSettings: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.account.PasswordInputSettings.passwordInputSettings(flags: _1!, newAlgo: _2, newPasswordHash: _3, hint: _4, email: _5, newSecureSettings: _6)
}
}
@@ -1182,12 +1134,10 @@ public extension Api.account {
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.account.PasswordSettings.passwordSettings(flags: _1!, email: _2, secureSettings: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.account.PasswordSettings.passwordSettings(flags: _1!, email: _2, secureSettings: _3)
}
}
@@ -1244,12 +1194,10 @@ public extension Api.account {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.account.PrivacyRules.privacyRules(rules: _1!, chats: _2!, users: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.account.PrivacyRules.privacyRules(rules: _1!, chats: _2!, users: _3!)
}
}
@@ -1298,12 +1246,8 @@ public extension Api.account {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.account.ResetPasswordResult.resetPasswordFailedWait(retryDate: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.account.ResetPasswordResult.resetPasswordFailedWait(retryDate: _1!)
}
public static func parse_resetPasswordOk(_ reader: BufferReader) -> ResetPasswordResult? {
return Api.account.ResetPasswordResult.resetPasswordOk
@@ -1312,12 +1256,8 @@ public extension Api.account {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.account.ResetPasswordResult.resetPasswordRequestedWait(untilDate: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.account.ResetPasswordResult.resetPasswordRequestedWait(untilDate: _1!)
}
}
@@ -1388,12 +1328,13 @@ public extension Api.account {
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.account.ResolvedBusinessChatLinks.resolvedBusinessChatLinks(flags: _1!, peer: _2!, message: _3!, entities: _4, chats: _5!, users: _6!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.account.ResolvedBusinessChatLinks.resolvedBusinessChatLinks(flags: _1!, peer: _2!, message: _3!, entities: _4, chats: _5!, users: _6!)
}
}
diff --git a/submodules/TelegramApi/Sources/Api3.swift b/submodules/TelegramApi/Sources/Api3.swift
index 49988fc9..b71ce826 100644
--- a/submodules/TelegramApi/Sources/Api3.swift
+++ b/submodules/TelegramApi/Sources/Api3.swift
@@ -34,12 +34,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.BusinessGreetingMessage.businessGreetingMessage(shortcutId: _1!, recipients: _2!, noActivityDays: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.BusinessGreetingMessage.businessGreetingMessage(shortcutId: _1!, recipients: _2!, noActivityDays: _3!)
}
}
@@ -84,12 +82,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.BusinessIntro.businessIntro(flags: _1!, title: _2!, description: _3!, sticker: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.BusinessIntro.businessIntro(flags: _1!, title: _2!, description: _3!, sticker: _4)
}
}
@@ -130,12 +127,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.BusinessLocation.businessLocation(flags: _1!, geoPoint: _2, address: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.BusinessLocation.businessLocation(flags: _1!, geoPoint: _2, address: _3!)
}
}
@@ -176,12 +171,9 @@ public extension Api {
} }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 4) == 0) || _2 != nil
- if _c1 && _c2 {
- return Api.BusinessRecipients.businessRecipients(flags: _1!, users: _2)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.BusinessRecipients.businessRecipients(flags: _1!, users: _2)
}
}
@@ -216,12 +208,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.BusinessWeeklyOpen.businessWeeklyOpen(startMinute: _1!, endMinute: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.BusinessWeeklyOpen.businessWeeklyOpen(startMinute: _1!, endMinute: _2!)
}
}
@@ -266,12 +255,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.BusinessWorkHours.businessWorkHours(flags: _1!, timezoneId: _2!, weeklyOpen: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.BusinessWorkHours.businessWorkHours(flags: _1!, timezoneId: _2!, weeklyOpen: _3!)
}
}
@@ -308,12 +295,8 @@ public extension Api {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.CdnPublicKey.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.CdnConfig.cdnConfig(publicKeys: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.CdnConfig.cdnConfig(publicKeys: _1!)
}
}
@@ -348,12 +331,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.CdnPublicKey.cdnPublicKey(dcId: _1!, publicKey: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.CdnPublicKey.cdnPublicKey(dcId: _1!, publicKey: _2!)
}
}
@@ -398,12 +378,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.ChannelAdminLogEvent.channelAdminLogEvent(id: _1!, date: _2!, userId: _3!, action: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.ChannelAdminLogEvent.channelAdminLogEvent(id: _1!, date: _2!, userId: _3!, action: _4!)
}
}
@@ -922,12 +901,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangeAbout(prevValue: _1!, newValue: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangeAbout(prevValue: _1!, newValue: _2!)
}
public static func parse_channelAdminLogEventActionChangeAvailableReactions(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.ChatReactions?
@@ -940,12 +916,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangeAvailableReactions(prevValue: _1!, newValue: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangeAvailableReactions(prevValue: _1!, newValue: _2!)
}
public static func parse_channelAdminLogEventActionChangeEmojiStatus(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.EmojiStatus?
@@ -958,12 +931,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangeEmojiStatus(prevValue: _1!, newValue: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangeEmojiStatus(prevValue: _1!, newValue: _2!)
}
public static func parse_channelAdminLogEventActionChangeEmojiStickerSet(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.InputStickerSet?
@@ -976,12 +946,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangeEmojiStickerSet(prevStickerset: _1!, newStickerset: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangeEmojiStickerSet(prevStickerset: _1!, newStickerset: _2!)
}
public static func parse_channelAdminLogEventActionChangeHistoryTTL(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Int32?
@@ -990,12 +957,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangeHistoryTTL(prevValue: _1!, newValue: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangeHistoryTTL(prevValue: _1!, newValue: _2!)
}
public static func parse_channelAdminLogEventActionChangeLinkedChat(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Int64?
@@ -1004,12 +968,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangeLinkedChat(prevValue: _1!, newValue: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangeLinkedChat(prevValue: _1!, newValue: _2!)
}
public static func parse_channelAdminLogEventActionChangeLocation(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.ChannelLocation?
@@ -1022,12 +983,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangeLocation(prevValue: _1!, newValue: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangeLocation(prevValue: _1!, newValue: _2!)
}
public static func parse_channelAdminLogEventActionChangePeerColor(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.PeerColor?
@@ -1040,12 +998,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangePeerColor(prevValue: _1!, newValue: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangePeerColor(prevValue: _1!, newValue: _2!)
}
public static func parse_channelAdminLogEventActionChangePhoto(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.Photo?
@@ -1058,12 +1013,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangePhoto(prevPhoto: _1!, newPhoto: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangePhoto(prevPhoto: _1!, newPhoto: _2!)
}
public static func parse_channelAdminLogEventActionChangeProfilePeerColor(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.PeerColor?
@@ -1076,12 +1028,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangeProfilePeerColor(prevValue: _1!, newValue: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangeProfilePeerColor(prevValue: _1!, newValue: _2!)
}
public static func parse_channelAdminLogEventActionChangeStickerSet(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.InputStickerSet?
@@ -1094,12 +1043,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangeStickerSet(prevStickerset: _1!, newStickerset: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangeStickerSet(prevStickerset: _1!, newStickerset: _2!)
}
public static func parse_channelAdminLogEventActionChangeTitle(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: String?
@@ -1108,12 +1054,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangeTitle(prevValue: _1!, newValue: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangeTitle(prevValue: _1!, newValue: _2!)
}
public static func parse_channelAdminLogEventActionChangeUsername(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: String?
@@ -1122,12 +1065,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangeUsername(prevValue: _1!, newValue: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangeUsername(prevValue: _1!, newValue: _2!)
}
public static func parse_channelAdminLogEventActionChangeUsernames(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: [String]?
@@ -1140,12 +1080,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangeUsernames(prevValue: _1!, newValue: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangeUsernames(prevValue: _1!, newValue: _2!)
}
public static func parse_channelAdminLogEventActionChangeWallpaper(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.WallPaper?
@@ -1158,12 +1095,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangeWallpaper(prevValue: _1!, newValue: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangeWallpaper(prevValue: _1!, newValue: _2!)
}
public static func parse_channelAdminLogEventActionCreateTopic(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.ForumTopic?
@@ -1171,12 +1105,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.ForumTopic
}
let _c1 = _1 != nil
- if _c1 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionCreateTopic(topic: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionCreateTopic(topic: _1!)
}
public static func parse_channelAdminLogEventActionDefaultBannedRights(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.ChatBannedRights?
@@ -1189,12 +1119,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionDefaultBannedRights(prevBannedRights: _1!, newBannedRights: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionDefaultBannedRights(prevBannedRights: _1!, newBannedRights: _2!)
}
public static func parse_channelAdminLogEventActionDeleteMessage(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.Message?
@@ -1202,12 +1129,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.Message
}
let _c1 = _1 != nil
- if _c1 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionDeleteMessage(message: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionDeleteMessage(message: _1!)
}
public static func parse_channelAdminLogEventActionDeleteTopic(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.ForumTopic?
@@ -1215,12 +1138,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.ForumTopic
}
let _c1 = _1 != nil
- if _c1 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionDeleteTopic(topic: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionDeleteTopic(topic: _1!)
}
public static func parse_channelAdminLogEventActionDiscardGroupCall(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.InputGroupCall?
@@ -1228,12 +1147,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.InputGroupCall
}
let _c1 = _1 != nil
- if _c1 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionDiscardGroupCall(call: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionDiscardGroupCall(call: _1!)
}
public static func parse_channelAdminLogEventActionEditMessage(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.Message?
@@ -1246,12 +1161,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionEditMessage(prevMessage: _1!, newMessage: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionEditMessage(prevMessage: _1!, newMessage: _2!)
}
public static func parse_channelAdminLogEventActionEditTopic(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.ForumTopic?
@@ -1264,12 +1176,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionEditTopic(prevTopic: _1!, newTopic: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionEditTopic(prevTopic: _1!, newTopic: _2!)
}
public static func parse_channelAdminLogEventActionExportedInviteDelete(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.ExportedChatInvite?
@@ -1277,12 +1186,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.ExportedChatInvite
}
let _c1 = _1 != nil
- if _c1 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionExportedInviteDelete(invite: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionExportedInviteDelete(invite: _1!)
}
public static func parse_channelAdminLogEventActionExportedInviteEdit(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.ExportedChatInvite?
@@ -1295,12 +1200,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionExportedInviteEdit(prevInvite: _1!, newInvite: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionExportedInviteEdit(prevInvite: _1!, newInvite: _2!)
}
public static func parse_channelAdminLogEventActionExportedInviteRevoke(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.ExportedChatInvite?
@@ -1308,12 +1210,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.ExportedChatInvite
}
let _c1 = _1 != nil
- if _c1 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionExportedInviteRevoke(invite: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionExportedInviteRevoke(invite: _1!)
}
public static func parse_channelAdminLogEventActionParticipantInvite(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.ChannelParticipant?
@@ -1321,12 +1219,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.ChannelParticipant
}
let _c1 = _1 != nil
- if _c1 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionParticipantInvite(participant: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionParticipantInvite(participant: _1!)
}
public static func parse_channelAdminLogEventActionParticipantJoin(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
return Api.ChannelAdminLogEventAction.channelAdminLogEventActionParticipantJoin
@@ -1340,12 +1234,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionParticipantJoinByInvite(flags: _1!, invite: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionParticipantJoinByInvite(flags: _1!, invite: _2!)
}
public static func parse_channelAdminLogEventActionParticipantJoinByRequest(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.ExportedChatInvite?
@@ -1356,12 +1247,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionParticipantJoinByRequest(invite: _1!, approvedBy: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionParticipantJoinByRequest(invite: _1!, approvedBy: _2!)
}
public static func parse_channelAdminLogEventActionParticipantLeave(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
return Api.ChannelAdminLogEventAction.channelAdminLogEventActionParticipantLeave
@@ -1372,12 +1260,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.GroupCallParticipant
}
let _c1 = _1 != nil
- if _c1 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionParticipantMute(participant: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionParticipantMute(participant: _1!)
}
public static func parse_channelAdminLogEventActionParticipantSubExtend(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.ChannelParticipant?
@@ -1390,12 +1274,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionParticipantSubExtend(prevParticipant: _1!, newParticipant: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionParticipantSubExtend(prevParticipant: _1!, newParticipant: _2!)
}
public static func parse_channelAdminLogEventActionParticipantToggleAdmin(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.ChannelParticipant?
@@ -1408,12 +1289,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionParticipantToggleAdmin(prevParticipant: _1!, newParticipant: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionParticipantToggleAdmin(prevParticipant: _1!, newParticipant: _2!)
}
public static func parse_channelAdminLogEventActionParticipantToggleBan(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.ChannelParticipant?
@@ -1426,12 +1304,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionParticipantToggleBan(prevParticipant: _1!, newParticipant: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionParticipantToggleBan(prevParticipant: _1!, newParticipant: _2!)
}
public static func parse_channelAdminLogEventActionParticipantUnmute(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.GroupCallParticipant?
@@ -1439,12 +1314,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.GroupCallParticipant
}
let _c1 = _1 != nil
- if _c1 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionParticipantUnmute(participant: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionParticipantUnmute(participant: _1!)
}
public static func parse_channelAdminLogEventActionParticipantVolume(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.GroupCallParticipant?
@@ -1452,12 +1323,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.GroupCallParticipant
}
let _c1 = _1 != nil
- if _c1 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionParticipantVolume(participant: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionParticipantVolume(participant: _1!)
}
public static func parse_channelAdminLogEventActionPinTopic(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Int32?
@@ -1473,12 +1340,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionPinTopic(flags: _1!, prevTopic: _2, newTopic: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionPinTopic(flags: _1!, prevTopic: _2, newTopic: _3)
}
public static func parse_channelAdminLogEventActionSendMessage(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.Message?
@@ -1486,12 +1351,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.Message
}
let _c1 = _1 != nil
- if _c1 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionSendMessage(message: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionSendMessage(message: _1!)
}
public static func parse_channelAdminLogEventActionStartGroupCall(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.InputGroupCall?
@@ -1499,12 +1360,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.InputGroupCall
}
let _c1 = _1 != nil
- if _c1 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionStartGroupCall(call: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionStartGroupCall(call: _1!)
}
public static func parse_channelAdminLogEventActionStopPoll(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.Message?
@@ -1512,12 +1369,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.Message
}
let _c1 = _1 != nil
- if _c1 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionStopPoll(message: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionStopPoll(message: _1!)
}
public static func parse_channelAdminLogEventActionToggleAntiSpam(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.Bool?
@@ -1525,12 +1378,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.Bool
}
let _c1 = _1 != nil
- if _c1 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionToggleAntiSpam(newValue: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionToggleAntiSpam(newValue: _1!)
}
public static func parse_channelAdminLogEventActionToggleAutotranslation(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.Bool?
@@ -1538,12 +1387,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.Bool
}
let _c1 = _1 != nil
- if _c1 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionToggleAutotranslation(newValue: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionToggleAutotranslation(newValue: _1!)
}
public static func parse_channelAdminLogEventActionToggleForum(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.Bool?
@@ -1551,12 +1396,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.Bool
}
let _c1 = _1 != nil
- if _c1 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionToggleForum(newValue: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionToggleForum(newValue: _1!)
}
public static func parse_channelAdminLogEventActionToggleGroupCallSetting(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.Bool?
@@ -1564,12 +1405,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.Bool
}
let _c1 = _1 != nil
- if _c1 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionToggleGroupCallSetting(joinMuted: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionToggleGroupCallSetting(joinMuted: _1!)
}
public static func parse_channelAdminLogEventActionToggleInvites(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.Bool?
@@ -1577,12 +1414,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.Bool
}
let _c1 = _1 != nil
- if _c1 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionToggleInvites(newValue: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionToggleInvites(newValue: _1!)
}
public static func parse_channelAdminLogEventActionToggleNoForwards(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.Bool?
@@ -1590,12 +1423,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.Bool
}
let _c1 = _1 != nil
- if _c1 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionToggleNoForwards(newValue: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionToggleNoForwards(newValue: _1!)
}
public static func parse_channelAdminLogEventActionTogglePreHistoryHidden(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.Bool?
@@ -1603,12 +1432,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.Bool
}
let _c1 = _1 != nil
- if _c1 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionTogglePreHistoryHidden(newValue: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionTogglePreHistoryHidden(newValue: _1!)
}
public static func parse_channelAdminLogEventActionToggleSignatureProfiles(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.Bool?
@@ -1616,12 +1441,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.Bool
}
let _c1 = _1 != nil
- if _c1 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionToggleSignatureProfiles(newValue: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionToggleSignatureProfiles(newValue: _1!)
}
public static func parse_channelAdminLogEventActionToggleSignatures(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.Bool?
@@ -1629,12 +1450,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.Bool
}
let _c1 = _1 != nil
- if _c1 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionToggleSignatures(newValue: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionToggleSignatures(newValue: _1!)
}
public static func parse_channelAdminLogEventActionToggleSlowMode(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Int32?
@@ -1643,12 +1460,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionToggleSlowMode(prevValue: _1!, newValue: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionToggleSlowMode(prevValue: _1!, newValue: _2!)
}
public static func parse_channelAdminLogEventActionUpdatePinned(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
var _1: Api.Message?
@@ -1656,12 +1470,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.Message
}
let _c1 = _1 != nil
- if _c1 {
- return Api.ChannelAdminLogEventAction.channelAdminLogEventActionUpdatePinned(message: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChannelAdminLogEventAction.channelAdminLogEventActionUpdatePinned(message: _1!)
}
}
diff --git a/submodules/TelegramApi/Sources/Api30.swift b/submodules/TelegramApi/Sources/Api30.swift
index 0d25527d..b10d58f7 100644
--- a/submodules/TelegramApi/Sources/Api30.swift
+++ b/submodules/TelegramApi/Sources/Api30.swift
@@ -39,12 +39,8 @@ public extension Api.account {
_1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.account.SavedMusicIds.savedMusicIds(ids: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.account.SavedMusicIds.savedMusicIds(ids: _1!)
}
public static func parse_savedMusicIdsNotModified(_ reader: BufferReader) -> SavedMusicIds? {
return Api.account.SavedMusicIds.savedMusicIdsNotModified
@@ -92,12 +88,8 @@ public extension Api.account {
_1 = Api.parse(reader, signature: signature) as? Api.Document
}
let _c1 = _1 != nil
- if _c1 {
- return Api.account.SavedRingtone.savedRingtoneConverted(document: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.account.SavedRingtone.savedRingtoneConverted(document: _1!)
}
}
@@ -147,12 +139,9 @@ public extension Api.account {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.account.SavedRingtones.savedRingtones(hash: _1!, ringtones: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.account.SavedRingtones.savedRingtones(hash: _1!, ringtones: _2!)
}
public static func parse_savedRingtonesNotModified(_ reader: BufferReader) -> SavedRingtones? {
return Api.account.SavedRingtones.savedRingtonesNotModified
@@ -190,12 +179,9 @@ public extension Api.account {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.account.SentEmailCode.sentEmailCode(emailPattern: _1!, length: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.account.SentEmailCode.sentEmailCode(emailPattern: _1!, length: _2!)
}
}
@@ -226,12 +212,8 @@ public extension Api.account {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
- if _c1 {
- return Api.account.Takeout.takeout(id: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.account.Takeout.takeout(id: _1!)
}
}
@@ -281,12 +263,9 @@ public extension Api.account {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.account.Themes.themes(hash: _1!, themes: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.account.Themes.themes(hash: _1!, themes: _2!)
}
public static func parse_themesNotModified(_ reader: BufferReader) -> Themes? {
return Api.account.Themes.themesNotModified
@@ -324,12 +303,9 @@ public extension Api.account {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.account.TmpPassword.tmpPassword(tmpPassword: _1!, validUntil: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.account.TmpPassword.tmpPassword(tmpPassword: _1!, validUntil: _2!)
}
}
@@ -379,12 +355,9 @@ public extension Api.account {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.account.WallPapers.wallPapers(hash: _1!, wallpapers: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.account.WallPapers.wallPapers(hash: _1!, wallpapers: _2!)
}
public static func parse_wallPapersNotModified(_ reader: BufferReader) -> WallPapers? {
return Api.account.WallPapers.wallPapersNotModified
@@ -434,12 +407,9 @@ public extension Api.account {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.account.WebAuthorizations.webAuthorizations(authorizations: _1!, users: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.account.WebAuthorizations.webAuthorizations(authorizations: _1!, users: _2!)
}
}
@@ -498,12 +468,12 @@ public extension Api.auth {
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.auth.Authorization.authorization(flags: _1!, otherwiseReloginDays: _2, tmpSessions: _3, futureAuthToken: _4, user: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.auth.Authorization.authorization(flags: _1!, otherwiseReloginDays: _2, tmpSessions: _3, futureAuthToken: _4, user: _5!)
}
public static func parse_authorizationSignUpRequired(_ reader: BufferReader) -> Authorization? {
var _1: Int32?
@@ -514,12 +484,9 @@ public extension Api.auth {
} }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
- if _c1 && _c2 {
- return Api.auth.Authorization.authorizationSignUpRequired(flags: _1!, termsOfService: _2)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.auth.Authorization.authorizationSignUpRequired(flags: _1!, termsOfService: _2)
}
}
@@ -630,12 +597,9 @@ public extension Api.auth {
_2 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.auth.ExportedAuthorization.exportedAuthorization(id: _1!, bytes: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.auth.ExportedAuthorization.exportedAuthorization(id: _1!, bytes: _2!)
}
}
@@ -670,12 +634,9 @@ public extension Api.auth {
if Int(_1!) & Int(1 << 0) != 0 {_2 = parseBytes(reader) }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
- if _c1 && _c2 {
- return Api.auth.LoggedOut.loggedOut(flags: _1!, futureAuthToken: _2)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.auth.LoggedOut.loggedOut(flags: _1!, futureAuthToken: _2)
}
}
@@ -729,12 +690,9 @@ public extension Api.auth {
_2 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.auth.LoginToken.loginToken(expires: _1!, token: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.auth.LoginToken.loginToken(expires: _1!, token: _2!)
}
public static func parse_loginTokenMigrateTo(_ reader: BufferReader) -> LoginToken? {
var _1: Int32?
@@ -743,12 +701,9 @@ public extension Api.auth {
_2 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.auth.LoginToken.loginTokenMigrateTo(dcId: _1!, token: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.auth.LoginToken.loginTokenMigrateTo(dcId: _1!, token: _2!)
}
public static func parse_loginTokenSuccess(_ reader: BufferReader) -> LoginToken? {
var _1: Api.auth.Authorization?
@@ -756,12 +711,8 @@ public extension Api.auth {
_1 = Api.parse(reader, signature: signature) as? Api.auth.Authorization
}
let _c1 = _1 != nil
- if _c1 {
- return Api.auth.LoginToken.loginTokenSuccess(authorization: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.auth.LoginToken.loginTokenSuccess(authorization: _1!)
}
}
@@ -794,12 +745,8 @@ public extension Api.auth {
_1 = Api.parse(reader, signature: signature) as? Api.DataJSON
}
let _c1 = _1 != nil
- if _c1 {
- return Api.auth.PasskeyLoginOptions.passkeyLoginOptions(options: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.auth.PasskeyLoginOptions.passkeyLoginOptions(options: _1!)
}
}
@@ -830,12 +777,8 @@ public extension Api.auth {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.auth.PasswordRecovery.passwordRecovery(emailPattern: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.auth.PasswordRecovery.passwordRecovery(emailPattern: _1!)
}
}
@@ -909,12 +852,12 @@ public extension Api.auth {
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.auth.SentCode.sentCode(flags: _1!, type: _2!, phoneCodeHash: _3!, nextType: _4, timeout: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.auth.SentCode.sentCode(flags: _1!, type: _2!, phoneCodeHash: _3!, nextType: _4, timeout: _5)
}
public static func parse_sentCodePaymentRequired(_ reader: BufferReader) -> SentCode? {
var _1: String?
@@ -935,12 +878,13 @@ public extension Api.auth {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.auth.SentCode.sentCodePaymentRequired(storeProduct: _1!, phoneCodeHash: _2!, supportEmailAddress: _3!, supportEmailSubject: _4!, currency: _5!, amount: _6!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.auth.SentCode.sentCodePaymentRequired(storeProduct: _1!, phoneCodeHash: _2!, supportEmailAddress: _3!, supportEmailSubject: _4!, currency: _5!, amount: _6!)
}
public static func parse_sentCodeSuccess(_ reader: BufferReader) -> SentCode? {
var _1: Api.auth.Authorization?
@@ -948,12 +892,8 @@ public extension Api.auth {
_1 = Api.parse(reader, signature: signature) as? Api.auth.Authorization
}
let _c1 = _1 != nil
- if _c1 {
- return Api.auth.SentCode.sentCodeSuccess(authorization: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.auth.SentCode.sentCodeSuccess(authorization: _1!)
}
}
@@ -1088,23 +1028,15 @@ public extension Api.auth {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.auth.SentCodeType.sentCodeTypeApp(length: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.auth.SentCodeType.sentCodeTypeApp(length: _1!)
}
public static func parse_sentCodeTypeCall(_ reader: BufferReader) -> SentCodeType? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.auth.SentCodeType.sentCodeTypeCall(length: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.auth.SentCodeType.sentCodeTypeCall(length: _1!)
}
public static func parse_sentCodeTypeEmailCode(_ reader: BufferReader) -> SentCodeType? {
var _1: Int32?
@@ -1122,12 +1054,12 @@ public extension Api.auth {
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 3) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 4) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.auth.SentCodeType.sentCodeTypeEmailCode(flags: _1!, emailPattern: _2!, length: _3!, resetAvailablePeriod: _4, resetPendingDate: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.auth.SentCodeType.sentCodeTypeEmailCode(flags: _1!, emailPattern: _2!, length: _3!, resetAvailablePeriod: _4, resetPendingDate: _5)
}
public static func parse_sentCodeTypeFirebaseSms(_ reader: BufferReader) -> SentCodeType? {
var _1: Int32?
@@ -1151,23 +1083,21 @@ public extension Api.auth {
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil
let _c7 = _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.auth.SentCodeType.sentCodeTypeFirebaseSms(flags: _1!, nonce: _2, playIntegrityProjectId: _3, playIntegrityNonce: _4, receipt: _5, pushTimeout: _6, length: _7!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.auth.SentCodeType.sentCodeTypeFirebaseSms(flags: _1!, nonce: _2, playIntegrityProjectId: _3, playIntegrityNonce: _4, receipt: _5, pushTimeout: _6, length: _7!)
}
public static func parse_sentCodeTypeFlashCall(_ reader: BufferReader) -> SentCodeType? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.auth.SentCodeType.sentCodeTypeFlashCall(pattern: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.auth.SentCodeType.sentCodeTypeFlashCall(pattern: _1!)
}
public static func parse_sentCodeTypeFragmentSms(_ reader: BufferReader) -> SentCodeType? {
var _1: String?
@@ -1176,12 +1106,9 @@ public extension Api.auth {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.auth.SentCodeType.sentCodeTypeFragmentSms(url: _1!, length: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.auth.SentCodeType.sentCodeTypeFragmentSms(url: _1!, length: _2!)
}
public static func parse_sentCodeTypeMissedCall(_ reader: BufferReader) -> SentCodeType? {
var _1: String?
@@ -1190,34 +1117,23 @@ public extension Api.auth {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.auth.SentCodeType.sentCodeTypeMissedCall(prefix: _1!, length: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.auth.SentCodeType.sentCodeTypeMissedCall(prefix: _1!, length: _2!)
}
public static func parse_sentCodeTypeSetUpEmailRequired(_ reader: BufferReader) -> SentCodeType? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.auth.SentCodeType.sentCodeTypeSetUpEmailRequired(flags: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.auth.SentCodeType.sentCodeTypeSetUpEmailRequired(flags: _1!)
}
public static func parse_sentCodeTypeSms(_ reader: BufferReader) -> SentCodeType? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.auth.SentCodeType.sentCodeTypeSms(length: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.auth.SentCodeType.sentCodeTypeSms(length: _1!)
}
public static func parse_sentCodeTypeSmsPhrase(_ reader: BufferReader) -> SentCodeType? {
var _1: Int32?
@@ -1226,12 +1142,9 @@ public extension Api.auth {
if Int(_1!) & Int(1 << 0) != 0 {_2 = parseString(reader) }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
- if _c1 && _c2 {
- return Api.auth.SentCodeType.sentCodeTypeSmsPhrase(flags: _1!, beginning: _2)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.auth.SentCodeType.sentCodeTypeSmsPhrase(flags: _1!, beginning: _2)
}
public static func parse_sentCodeTypeSmsWord(_ reader: BufferReader) -> SentCodeType? {
var _1: Int32?
@@ -1240,12 +1153,9 @@ public extension Api.auth {
if Int(_1!) & Int(1 << 0) != 0 {_2 = parseString(reader) }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
- if _c1 && _c2 {
- return Api.auth.SentCodeType.sentCodeTypeSmsWord(flags: _1!, beginning: _2)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.auth.SentCodeType.sentCodeTypeSmsWord(flags: _1!, beginning: _2)
}
}
diff --git a/submodules/TelegramApi/Sources/Api31.swift b/submodules/TelegramApi/Sources/Api31.swift
index b35e3904..d713950b 100644
--- a/submodules/TelegramApi/Sources/Api31.swift
+++ b/submodules/TelegramApi/Sources/Api31.swift
@@ -32,12 +32,10 @@ public extension Api.bots {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.bots.BotInfo.botInfo(name: _1!, about: _2!, description: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.bots.BotInfo.botInfo(name: _1!, about: _2!, description: _3!)
}
}
@@ -82,12 +80,10 @@ public extension Api.bots {
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.bots.PopularAppBots.popularAppBots(flags: _1!, nextOffset: _2, users: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.bots.PopularAppBots.popularAppBots(flags: _1!, nextOffset: _2, users: _3!)
}
}
@@ -134,12 +130,9 @@ public extension Api.bots {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.bots.PreviewInfo.previewInfo(media: _1!, langCodes: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.bots.PreviewInfo.previewInfo(media: _1!, langCodes: _2!)
}
}
@@ -196,12 +189,10 @@ public extension Api.channels {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.channels.AdminLogResults.adminLogResults(events: _1!, chats: _2!, users: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.channels.AdminLogResults.adminLogResults(events: _1!, chats: _2!, users: _3!)
}
}
@@ -254,12 +245,10 @@ public extension Api.channels {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.channels.ChannelParticipant.channelParticipant(participant: _1!, chats: _2!, users: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.channels.ChannelParticipant.channelParticipant(participant: _1!, chats: _2!, users: _3!)
}
}
@@ -329,12 +318,11 @@ public extension Api.channels {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.channels.ChannelParticipants.channelParticipants(count: _1!, participants: _2!, chats: _3!, users: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.channels.ChannelParticipants.channelParticipants(count: _1!, participants: _2!, chats: _3!, users: _4!)
}
public static func parse_channelParticipantsNotModified(_ reader: BufferReader) -> ChannelParticipants? {
return Api.channels.ChannelParticipants.channelParticipantsNotModified
@@ -394,12 +382,10 @@ public extension Api.channels {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.channels.SendAsPeers.sendAsPeers(peers: _1!, chats: _2!, users: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.channels.SendAsPeers.sendAsPeers(peers: _1!, chats: _2!, users: _3!)
}
}
@@ -461,12 +447,9 @@ public extension Api.channels {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.channels.SponsoredMessageReportResult.sponsoredMessageReportResultChooseOption(title: _1!, options: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.channels.SponsoredMessageReportResult.sponsoredMessageReportResultChooseOption(title: _1!, options: _2!)
}
public static func parse_sponsoredMessageReportResultReported(_ reader: BufferReader) -> SponsoredMessageReportResult? {
return Api.channels.SponsoredMessageReportResult.sponsoredMessageReportResultReported
@@ -569,12 +552,13 @@ public extension Api.chatlists {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.chatlists.ChatlistInvite.chatlistInvite(flags: _1!, title: _2!, emoticon: _3, peers: _4!, chats: _5!, users: _6!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.chatlists.ChatlistInvite.chatlistInvite(flags: _1!, title: _2!, emoticon: _3, peers: _4!, chats: _5!, users: _6!)
}
public static func parse_chatlistInviteAlready(_ reader: BufferReader) -> ChatlistInvite? {
var _1: Int32?
@@ -600,12 +584,12 @@ public extension Api.chatlists {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.chatlists.ChatlistInvite.chatlistInviteAlready(filterId: _1!, missingPeers: _2!, alreadyPeers: _3!, chats: _4!, users: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.chatlists.ChatlistInvite.chatlistInviteAlready(filterId: _1!, missingPeers: _2!, alreadyPeers: _3!, chats: _4!, users: _5!)
}
}
@@ -662,12 +646,10 @@ public extension Api.chatlists {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.chatlists.ChatlistUpdates.chatlistUpdates(missingPeers: _1!, chats: _2!, users: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.chatlists.ChatlistUpdates.chatlistUpdates(missingPeers: _1!, chats: _2!, users: _3!)
}
}
@@ -706,12 +688,9 @@ public extension Api.chatlists {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.chatlists.ExportedChatlistInvite.exportedChatlistInvite(filter: _1!, invite: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.chatlists.ExportedChatlistInvite.exportedChatlistInvite(filter: _1!, invite: _2!)
}
}
@@ -768,12 +747,10 @@ public extension Api.chatlists {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.chatlists.ExportedInvites.exportedInvites(invites: _1!, chats: _2!, users: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.chatlists.ExportedInvites.exportedInvites(invites: _1!, chats: _2!, users: _3!)
}
}
@@ -854,12 +831,10 @@ public extension Api.contacts {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.contacts.Blocked.blocked(blocked: _1!, chats: _2!, users: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.contacts.Blocked.blocked(blocked: _1!, chats: _2!, users: _3!)
}
public static func parse_blockedSlice(_ reader: BufferReader) -> Blocked? {
var _1: Int32?
@@ -880,12 +855,11 @@ public extension Api.contacts {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.contacts.Blocked.blockedSlice(count: _1!, blocked: _2!, chats: _3!, users: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.contacts.Blocked.blockedSlice(count: _1!, blocked: _2!, chats: _3!, users: _4!)
}
}
@@ -932,12 +906,9 @@ public extension Api.contacts {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.contacts.ContactBirthdays.contactBirthdays(contacts: _1!, users: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.contacts.ContactBirthdays.contactBirthdays(contacts: _1!, users: _2!)
}
}
@@ -997,12 +968,10 @@ public extension Api.contacts {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.contacts.Contacts.contacts(contacts: _1!, savedCount: _2!, users: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.contacts.Contacts.contacts(contacts: _1!, savedCount: _2!, users: _3!)
}
public static func parse_contactsNotModified(_ reader: BufferReader) -> Contacts? {
return Api.contacts.Contacts.contactsNotModified
@@ -1072,12 +1041,11 @@ public extension Api.contacts {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.contacts.Found.found(myResults: _1!, results: _2!, chats: _3!, users: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.contacts.Found.found(myResults: _1!, results: _2!, chats: _3!, users: _4!)
}
}
@@ -1144,12 +1112,11 @@ public extension Api.contacts {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.contacts.ImportedContacts.importedContacts(imported: _1!, popularInvites: _2!, retryContacts: _3!, users: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.contacts.ImportedContacts.importedContacts(imported: _1!, popularInvites: _2!, retryContacts: _3!, users: _4!)
}
}
@@ -1202,12 +1169,10 @@ public extension Api.contacts {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.contacts.ResolvedPeer.resolvedPeer(peer: _1!, chats: _2!, users: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.contacts.ResolvedPeer.resolvedPeer(peer: _1!, chats: _2!, users: _3!)
}
}
@@ -1273,12 +1238,10 @@ public extension Api.contacts {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.contacts.SponsoredPeers.sponsoredPeers(peers: _1!, chats: _2!, users: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.contacts.SponsoredPeers.sponsoredPeers(peers: _1!, chats: _2!, users: _3!)
}
public static func parse_sponsoredPeersEmpty(_ reader: BufferReader) -> SponsoredPeers? {
return Api.contacts.SponsoredPeers.sponsoredPeersEmpty
@@ -1356,12 +1319,10 @@ public extension Api.contacts {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.contacts.TopPeers.topPeers(categories: _1!, chats: _2!, users: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.contacts.TopPeers.topPeers(categories: _1!, chats: _2!, users: _3!)
}
public static func parse_topPeersDisabled(_ reader: BufferReader) -> TopPeers? {
return Api.contacts.TopPeers.topPeersDisabled
@@ -1418,12 +1379,13 @@ public extension Api.fragment {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.fragment.CollectibleInfo.collectibleInfo(purchaseDate: _1!, currency: _2!, amount: _3!, cryptoCurrency: _4!, cryptoAmount: _5!, url: _6!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.fragment.CollectibleInfo.collectibleInfo(purchaseDate: _1!, currency: _2!, amount: _3!, cryptoCurrency: _4!, cryptoAmount: _5!, url: _6!)
}
}
@@ -1469,12 +1431,9 @@ public extension Api.help {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.help.AppConfig.appConfig(hash: _1!, config: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.help.AppConfig.appConfig(hash: _1!, config: _2!)
}
public static func parse_appConfigNotModified(_ reader: BufferReader) -> AppConfig? {
return Api.help.AppConfig.appConfigNotModified
diff --git a/submodules/TelegramApi/Sources/Api32.swift b/submodules/TelegramApi/Sources/Api32.swift
index a9067b18..5649eb9f 100644
--- a/submodules/TelegramApi/Sources/Api32.swift
+++ b/submodules/TelegramApi/Sources/Api32.swift
@@ -71,12 +71,15 @@ public extension Api.help {
let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 2) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 3) == 0) || _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.help.AppUpdate.appUpdate(flags: _1!, id: _2!, version: _3!, text: _4!, entities: _5!, document: _6, url: _7, sticker: _8)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.help.AppUpdate.appUpdate(flags: _1!, id: _2!, version: _3!, text: _4!, entities: _5!, document: _6, url: _7, sticker: _8)
}
public static func parse_noAppUpdate(_ reader: BufferReader) -> AppUpdate? {
return Api.help.AppUpdate.noAppUpdate
@@ -129,12 +132,9 @@ public extension Api.help {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.help.CountriesList.countriesList(countries: _1!, hash: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.help.CountriesList.countriesList(countries: _1!, hash: _2!)
}
public static func parse_countriesListNotModified(_ reader: BufferReader) -> CountriesList? {
return Api.help.CountriesList.countriesListNotModified
@@ -190,12 +190,12 @@ public extension Api.help {
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.help.Country.country(flags: _1!, iso2: _2!, defaultName: _3!, name: _4, countryCodes: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.help.Country.country(flags: _1!, iso2: _2!, defaultName: _3!, name: _4, countryCodes: _5!)
}
}
@@ -250,12 +250,11 @@ public extension Api.help {
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.help.CountryCode.countryCode(flags: _1!, countryCode: _2!, prefixes: _3, patterns: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.help.CountryCode.countryCode(flags: _1!, countryCode: _2!, prefixes: _3, patterns: _4)
}
}
@@ -309,12 +308,10 @@ public extension Api.help {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.help.DeepLinkInfo.deepLinkInfo(flags: _1!, message: _2!, entities: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.help.DeepLinkInfo.deepLinkInfo(flags: _1!, message: _2!, entities: _3)
}
public static func parse_deepLinkInfoEmpty(_ reader: BufferReader) -> DeepLinkInfo? {
return Api.help.DeepLinkInfo.deepLinkInfoEmpty
@@ -348,12 +345,8 @@ public extension Api.help {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.help.InviteText.inviteText(message: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.help.InviteText.inviteText(message: _1!)
}
}
@@ -399,12 +392,9 @@ public extension Api.help {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.help.PassportConfig.passportConfig(hash: _1!, countriesLangs: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.help.PassportConfig.passportConfig(hash: _1!, countriesLangs: _2!)
}
public static func parse_passportConfigNotModified(_ reader: BufferReader) -> PassportConfig? {
return Api.help.PassportConfig.passportConfigNotModified
@@ -462,12 +452,13 @@ public extension Api.help {
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 4) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.help.PeerColorOption.peerColorOption(flags: _1!, colorId: _2!, colors: _3, darkColors: _4, channelMinLevel: _5, groupMinLevel: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.help.PeerColorOption.peerColorOption(flags: _1!, colorId: _2!, colors: _3, darkColors: _4, channelMinLevel: _5, groupMinLevel: _6)
}
}
@@ -537,12 +528,10 @@ public extension Api.help {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.help.PeerColorSet.peerColorProfileSet(paletteColors: _1!, bgColors: _2!, storyColors: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.help.PeerColorSet.peerColorProfileSet(paletteColors: _1!, bgColors: _2!, storyColors: _3!)
}
public static func parse_peerColorSet(_ reader: BufferReader) -> PeerColorSet? {
var _1: [Int32]?
@@ -550,12 +539,8 @@ public extension Api.help {
_1 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.help.PeerColorSet.peerColorSet(colors: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.help.PeerColorSet.peerColorSet(colors: _1!)
}
}
@@ -605,12 +590,9 @@ public extension Api.help {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.help.PeerColors.peerColors(hash: _1!, colors: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.help.PeerColors.peerColors(hash: _1!, colors: _2!)
}
public static func parse_peerColorsNotModified(_ reader: BufferReader) -> PeerColors? {
return Api.help.PeerColors.peerColorsNotModified
@@ -694,12 +676,13 @@ public extension Api.help {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.help.PremiumPromo.premiumPromo(statusText: _1!, statusEntities: _2!, videoSections: _3!, videos: _4!, periodOptions: _5!, users: _6!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.help.PremiumPromo.premiumPromo(statusText: _1!, statusEntities: _2!, videoSections: _3!, videos: _4!, periodOptions: _5!, users: _6!)
}
}
@@ -803,23 +786,24 @@ public extension Api.help {
let _c8 = (Int(_1!) & Int(1 << 4) == 0) || _8 != nil
let _c9 = _9 != nil
let _c10 = _10 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 {
- return Api.help.PromoData.promoData(flags: _1!, expires: _2!, peer: _3, psaType: _4, psaMessage: _5, pendingSuggestions: _6!, dismissedSuggestions: _7!, customPendingSuggestion: _8, chats: _9!, users: _10!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ return Api.help.PromoData.promoData(flags: _1!, expires: _2!, peer: _3, psaType: _4, psaMessage: _5, pendingSuggestions: _6!, dismissedSuggestions: _7!, customPendingSuggestion: _8, chats: _9!, users: _10!)
}
public static func parse_promoDataEmpty(_ reader: BufferReader) -> PromoData? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.help.PromoData.promoDataEmpty(expires: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.help.PromoData.promoDataEmpty(expires: _1!)
}
}
@@ -876,12 +860,10 @@ public extension Api.help {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.help.RecentMeUrls.recentMeUrls(urls: _1!, chats: _2!, users: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.help.RecentMeUrls.recentMeUrls(urls: _1!, chats: _2!, users: _3!)
}
}
@@ -918,12 +900,9 @@ public extension Api.help {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.help.Support.support(phoneNumber: _1!, user: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.help.Support.support(phoneNumber: _1!, user: _2!)
}
}
@@ -954,12 +933,8 @@ public extension Api.help {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.help.SupportName.supportName(name: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.help.SupportName.supportName(name: _1!)
}
}
@@ -1014,12 +989,12 @@ public extension Api.help {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.help.TermsOfService.termsOfService(flags: _1!, id: _2!, text: _3!, entities: _4!, minAgeConfirm: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.help.TermsOfService.termsOfService(flags: _1!, id: _2!, text: _3!, entities: _4!, minAgeConfirm: _5)
}
}
@@ -1065,23 +1040,16 @@ public extension Api.help {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.help.TermsOfServiceUpdate.termsOfServiceUpdate(expires: _1!, termsOfService: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.help.TermsOfServiceUpdate.termsOfServiceUpdate(expires: _1!, termsOfService: _2!)
}
public static func parse_termsOfServiceUpdateEmpty(_ reader: BufferReader) -> TermsOfServiceUpdate? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.help.TermsOfServiceUpdate.termsOfServiceUpdateEmpty(expires: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.help.TermsOfServiceUpdate.termsOfServiceUpdateEmpty(expires: _1!)
}
}
@@ -1131,12 +1099,9 @@ public extension Api.help {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.help.TimezonesList.timezonesList(timezones: _1!, hash: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.help.TimezonesList.timezonesList(timezones: _1!, hash: _2!)
}
public static func parse_timezonesListNotModified(_ reader: BufferReader) -> TimezonesList? {
return Api.help.TimezonesList.timezonesListNotModified
@@ -1197,12 +1162,11 @@ public extension Api.help {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.help.UserInfo.userInfo(message: _1!, entities: _2!, author: _3!, date: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.help.UserInfo.userInfo(message: _1!, entities: _2!, author: _3!, date: _4!)
}
public static func parse_userInfoEmpty(_ reader: BufferReader) -> UserInfo? {
return Api.help.UserInfo.userInfoEmpty
@@ -1254,12 +1218,11 @@ public extension Api.messages {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.messages.AffectedFoundMessages.affectedFoundMessages(pts: _1!, ptsCount: _2!, offset: _3!, messages: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.messages.AffectedFoundMessages.affectedFoundMessages(pts: _1!, ptsCount: _2!, offset: _3!, messages: _4!)
}
}
@@ -1298,12 +1261,10 @@ public extension Api.messages {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.messages.AffectedHistory.affectedHistory(pts: _1!, ptsCount: _2!, offset: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.messages.AffectedHistory.affectedHistory(pts: _1!, ptsCount: _2!, offset: _3!)
}
}
@@ -1338,12 +1299,9 @@ public extension Api.messages {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.messages.AffectedMessages.affectedMessages(pts: _1!, ptsCount: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.messages.AffectedMessages.affectedMessages(pts: _1!, ptsCount: _2!)
}
}
diff --git a/submodules/TelegramApi/Sources/Api33.swift b/submodules/TelegramApi/Sources/Api33.swift
index 1341629f..98c550df 100644
--- a/submodules/TelegramApi/Sources/Api33.swift
+++ b/submodules/TelegramApi/Sources/Api33.swift
@@ -43,12 +43,9 @@ public extension Api.messages {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.messages.AllStickers.allStickers(hash: _1!, sets: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.messages.AllStickers.allStickers(hash: _1!, sets: _2!)
}
public static func parse_allStickersNotModified(_ reader: BufferReader) -> AllStickers? {
return Api.messages.AllStickers.allStickersNotModified
@@ -92,12 +89,9 @@ public extension Api.messages {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.messages.ArchivedStickers.archivedStickers(count: _1!, sets: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.messages.ArchivedStickers.archivedStickers(count: _1!, sets: _2!)
}
}
@@ -157,12 +151,10 @@ public extension Api.messages {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.messages.AvailableEffects.availableEffects(hash: _1!, effects: _2!, documents: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.messages.AvailableEffects.availableEffects(hash: _1!, effects: _2!, documents: _3!)
}
public static func parse_availableEffectsNotModified(_ reader: BufferReader) -> AvailableEffects? {
return Api.messages.AvailableEffects.availableEffectsNotModified
@@ -215,12 +207,9 @@ public extension Api.messages {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.messages.AvailableReactions.availableReactions(hash: _1!, reactions: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.messages.AvailableReactions.availableReactions(hash: _1!, reactions: _2!)
}
public static func parse_availableReactionsNotModified(_ reader: BufferReader) -> AvailableReactions? {
return Api.messages.AvailableReactions.availableReactionsNotModified
@@ -260,12 +249,9 @@ public extension Api.messages {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.messages.BotApp.botApp(flags: _1!, app: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.messages.BotApp.botApp(flags: _1!, app: _2!)
}
}
@@ -308,12 +294,11 @@ public extension Api.messages {
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 2) == 0) || _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.messages.BotCallbackAnswer.botCallbackAnswer(flags: _1!, message: _2, url: _3, cacheTime: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.messages.BotCallbackAnswer.botCallbackAnswer(flags: _1!, message: _2, url: _3, cacheTime: _4!)
}
}
@@ -348,12 +333,9 @@ public extension Api.messages {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.messages.BotPreparedInlineMessage.botPreparedInlineMessage(id: _1!, expireDate: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.messages.BotPreparedInlineMessage.botPreparedInlineMessage(id: _1!, expireDate: _2!)
}
}
@@ -428,12 +410,15 @@ public extension Api.messages {
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.messages.BotResults.botResults(flags: _1!, queryId: _2!, nextOffset: _3, switchPm: _4, switchWebview: _5, results: _6!, cacheTime: _7!, users: _8!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.messages.BotResults.botResults(flags: _1!, queryId: _2!, nextOffset: _3, switchPm: _4, switchWebview: _5, results: _6!, cacheTime: _7!, users: _8!)
}
}
@@ -480,12 +465,9 @@ public extension Api.messages {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.messages.ChatAdminsWithInvites.chatAdminsWithInvites(admins: _1!, users: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.messages.ChatAdminsWithInvites.chatAdminsWithInvites(admins: _1!, users: _2!)
}
}
@@ -538,12 +520,10 @@ public extension Api.messages {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.messages.ChatFull.chatFull(fullChat: _1!, chats: _2!, users: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.messages.ChatFull.chatFull(fullChat: _1!, chats: _2!, users: _3!)
}
}
@@ -594,12 +574,10 @@ public extension Api.messages {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.messages.ChatInviteImporters.chatInviteImporters(count: _1!, importers: _2!, users: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.messages.ChatInviteImporters.chatInviteImporters(count: _1!, importers: _2!, users: _3!)
}
}
@@ -650,12 +628,8 @@ public extension Api.messages {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.messages.Chats.chats(chats: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.messages.Chats.chats(chats: _1!)
}
public static func parse_chatsSlice(_ reader: BufferReader) -> Chats? {
var _1: Int32?
@@ -666,12 +640,9 @@ public extension Api.messages {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.messages.Chats.chatsSlice(count: _1!, chats: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.messages.Chats.chatsSlice(count: _1!, chats: _2!)
}
}
@@ -702,12 +673,8 @@ public extension Api.messages {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.messages.CheckedHistoryImportPeer.checkedHistoryImportPeer(confirmText: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.messages.CheckedHistoryImportPeer.checkedHistoryImportPeer(confirmText: _1!)
}
}
@@ -759,23 +726,18 @@ public extension Api.messages {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.messages.DhConfig.dhConfig(g: _1!, p: _2!, version: _3!, random: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.messages.DhConfig.dhConfig(g: _1!, p: _2!, version: _3!, random: _4!)
}
public static func parse_dhConfigNotModified(_ reader: BufferReader) -> DhConfig? {
var _1: Buffer?
_1 = parseBytes(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.messages.DhConfig.dhConfigNotModified(random: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.messages.DhConfig.dhConfigNotModified(random: _1!)
}
}
@@ -816,12 +778,9 @@ public extension Api.messages {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.messages.DialogFilters.dialogFilters(flags: _1!, filters: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.messages.DialogFilters.dialogFilters(flags: _1!, filters: _2!)
}
}
@@ -926,23 +885,18 @@ public extension Api.messages {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.messages.Dialogs.dialogs(dialogs: _1!, messages: _2!, chats: _3!, users: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.messages.Dialogs.dialogs(dialogs: _1!, messages: _2!, chats: _3!, users: _4!)
}
public static func parse_dialogsNotModified(_ reader: BufferReader) -> Dialogs? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.messages.Dialogs.dialogsNotModified(count: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.messages.Dialogs.dialogsNotModified(count: _1!)
}
public static func parse_dialogsSlice(_ reader: BufferReader) -> Dialogs? {
var _1: Int32?
@@ -968,12 +922,12 @@ public extension Api.messages {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.messages.Dialogs.dialogsSlice(count: _1!, dialogs: _2!, messages: _3!, chats: _4!, users: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.messages.Dialogs.dialogsSlice(count: _1!, dialogs: _2!, messages: _3!, chats: _4!, users: _5!)
}
}
@@ -1050,12 +1004,132 @@ public extension Api.messages {
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.messages.DiscussionMessage.discussionMessage(flags: _1!, messages: _2!, maxId: _3, readInboxMaxId: _4, readOutboxMaxId: _5, unreadCount: _6!, chats: _7!, users: _8!)
- }
- else {
- return nil
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.messages.DiscussionMessage.discussionMessage(flags: _1!, messages: _2!, maxId: _3, readInboxMaxId: _4, readOutboxMaxId: _5, unreadCount: _6!, chats: _7!, users: _8!)
+ }
+
+ }
+}
+public extension Api.messages {
+ enum EmojiGameInfo: TypeConstructorDescription {
+ case emojiGameDiceInfo(flags: Int32, gameHash: String, prevStake: Int64, currentStreak: Int32, params: [Int32], playsLeft: Int32?)
+ case emojiGameUnavailable
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .emojiGameDiceInfo(let flags, let gameHash, let prevStake, let currentStreak, let params, let playsLeft):
+ if boxed {
+ buffer.appendInt32(1155883043)
+ }
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ serializeString(gameHash, buffer: buffer, boxed: false)
+ serializeInt64(prevStake, buffer: buffer, boxed: false)
+ serializeInt32(currentStreak, buffer: buffer, boxed: false)
+ buffer.appendInt32(481674261)
+ buffer.appendInt32(Int32(params.count))
+ for item in params {
+ serializeInt32(item, buffer: buffer, boxed: false)
+ }
+ if Int(flags) & Int(1 << 0) != 0 {serializeInt32(playsLeft!, buffer: buffer, boxed: false)}
+ break
+ case .emojiGameUnavailable:
+ if boxed {
+ buffer.appendInt32(1508266805)
+ }
+
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .emojiGameDiceInfo(let flags, let gameHash, let prevStake, let currentStreak, let params, let playsLeft):
+ return ("emojiGameDiceInfo", [("flags", flags as Any), ("gameHash", gameHash as Any), ("prevStake", prevStake as Any), ("currentStreak", currentStreak as Any), ("params", params as Any), ("playsLeft", playsLeft as Any)])
+ case .emojiGameUnavailable:
+ return ("emojiGameUnavailable", [])
+ }
+ }
+
+ public static func parse_emojiGameDiceInfo(_ reader: BufferReader) -> EmojiGameInfo? {
+ var _1: Int32?
+ _1 = reader.readInt32()
+ var _2: String?
+ _2 = parseString(reader)
+ var _3: Int64?
+ _3 = reader.readInt64()
+ var _4: Int32?
+ _4 = reader.readInt32()
+ var _5: [Int32]?
+ if let _ = reader.readInt32() {
+ _5 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
}
+ var _6: Int32?
+ if Int(_1!) & Int(1 << 0) != 0 {_6 = reader.readInt32() }
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = _3 != nil
+ let _c4 = _4 != nil
+ let _c5 = _5 != nil
+ let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.messages.EmojiGameInfo.emojiGameDiceInfo(flags: _1!, gameHash: _2!, prevStake: _3!, currentStreak: _4!, params: _5!, playsLeft: _6)
+ }
+ public static func parse_emojiGameUnavailable(_ reader: BufferReader) -> EmojiGameInfo? {
+ return Api.messages.EmojiGameInfo.emojiGameUnavailable
+ }
+
+ }
+}
+public extension Api.messages {
+ enum EmojiGameOutcome: TypeConstructorDescription {
+ case emojiGameOutcome(seed: Buffer, stakeTonAmount: Int64, tonAmount: Int64)
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .emojiGameOutcome(let seed, let stakeTonAmount, let tonAmount):
+ if boxed {
+ buffer.appendInt32(-634726841)
+ }
+ serializeBytes(seed, buffer: buffer, boxed: false)
+ serializeInt64(stakeTonAmount, buffer: buffer, boxed: false)
+ serializeInt64(tonAmount, buffer: buffer, boxed: false)
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .emojiGameOutcome(let seed, let stakeTonAmount, let tonAmount):
+ return ("emojiGameOutcome", [("seed", seed as Any), ("stakeTonAmount", stakeTonAmount as Any), ("tonAmount", tonAmount as Any)])
+ }
+ }
+
+ public static func parse_emojiGameOutcome(_ reader: BufferReader) -> EmojiGameOutcome? {
+ var _1: Buffer?
+ _1 = parseBytes(reader)
+ var _2: Int64?
+ _2 = reader.readInt64()
+ var _3: Int64?
+ _3 = reader.readInt64()
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = _3 != nil
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.messages.EmojiGameOutcome.emojiGameOutcome(seed: _1!, stakeTonAmount: _2!, tonAmount: _3!)
}
}
@@ -1105,12 +1179,9 @@ public extension Api.messages {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.messages.EmojiGroups.emojiGroups(hash: _1!, groups: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.messages.EmojiGroups.emojiGroups(hash: _1!, groups: _2!)
}
public static func parse_emojiGroupsNotModified(_ reader: BufferReader) -> EmojiGroups? {
return Api.messages.EmojiGroups.emojiGroupsNotModified
@@ -1171,12 +1242,9 @@ public extension Api.messages {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.messages.ExportedChatInvite.exportedChatInvite(invite: _1!, users: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.messages.ExportedChatInvite.exportedChatInvite(invite: _1!, users: _2!)
}
public static func parse_exportedChatInviteReplaced(_ reader: BufferReader) -> ExportedChatInvite? {
var _1: Api.ExportedChatInvite?
@@ -1194,12 +1262,10 @@ public extension Api.messages {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.messages.ExportedChatInvite.exportedChatInviteReplaced(invite: _1!, newInvite: _2!, users: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.messages.ExportedChatInvite.exportedChatInviteReplaced(invite: _1!, newInvite: _2!, users: _3!)
}
}
@@ -1250,164 +1316,10 @@ public extension Api.messages {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.messages.ExportedChatInvites.exportedChatInvites(count: _1!, invites: _2!, users: _3!)
- }
- else {
- return nil
- }
- }
-
- }
-}
-public extension Api.messages {
- enum FavedStickers: TypeConstructorDescription {
- case favedStickers(hash: Int64, packs: [Api.StickerPack], stickers: [Api.Document])
- case favedStickersNotModified
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .favedStickers(let hash, let packs, let stickers):
- if boxed {
- buffer.appendInt32(750063767)
- }
- serializeInt64(hash, buffer: buffer, boxed: false)
- buffer.appendInt32(481674261)
- buffer.appendInt32(Int32(packs.count))
- for item in packs {
- item.serialize(buffer, true)
- }
- buffer.appendInt32(481674261)
- buffer.appendInt32(Int32(stickers.count))
- for item in stickers {
- item.serialize(buffer, true)
- }
- break
- case .favedStickersNotModified:
- if boxed {
- buffer.appendInt32(-1634752813)
- }
-
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .favedStickers(let hash, let packs, let stickers):
- return ("favedStickers", [("hash", hash as Any), ("packs", packs as Any), ("stickers", stickers as Any)])
- case .favedStickersNotModified:
- return ("favedStickersNotModified", [])
- }
- }
-
- public static func parse_favedStickers(_ reader: BufferReader) -> FavedStickers? {
- var _1: Int64?
- _1 = reader.readInt64()
- var _2: [Api.StickerPack]?
- if let _ = reader.readInt32() {
- _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StickerPack.self)
- }
- var _3: [Api.Document]?
- if let _ = reader.readInt32() {
- _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Document.self)
- }
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.messages.FavedStickers.favedStickers(hash: _1!, packs: _2!, stickers: _3!)
- }
- else {
- return nil
- }
- }
- public static func parse_favedStickersNotModified(_ reader: BufferReader) -> FavedStickers? {
- return Api.messages.FavedStickers.favedStickersNotModified
- }
-
- }
-}
-public extension Api.messages {
- enum FeaturedStickers: TypeConstructorDescription {
- case featuredStickers(flags: Int32, hash: Int64, count: Int32, sets: [Api.StickerSetCovered], unread: [Int64])
- case featuredStickersNotModified(count: Int32)
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .featuredStickers(let flags, let hash, let count, let sets, let unread):
- if boxed {
- buffer.appendInt32(-1103615738)
- }
- serializeInt32(flags, buffer: buffer, boxed: false)
- serializeInt64(hash, buffer: buffer, boxed: false)
- serializeInt32(count, buffer: buffer, boxed: false)
- buffer.appendInt32(481674261)
- buffer.appendInt32(Int32(sets.count))
- for item in sets {
- item.serialize(buffer, true)
- }
- buffer.appendInt32(481674261)
- buffer.appendInt32(Int32(unread.count))
- for item in unread {
- serializeInt64(item, buffer: buffer, boxed: false)
- }
- break
- case .featuredStickersNotModified(let count):
- if boxed {
- buffer.appendInt32(-958657434)
- }
- serializeInt32(count, buffer: buffer, boxed: false)
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .featuredStickers(let flags, let hash, let count, let sets, let unread):
- return ("featuredStickers", [("flags", flags as Any), ("hash", hash as Any), ("count", count as Any), ("sets", sets as Any), ("unread", unread as Any)])
- case .featuredStickersNotModified(let count):
- return ("featuredStickersNotModified", [("count", count as Any)])
- }
- }
-
- public static func parse_featuredStickers(_ reader: BufferReader) -> FeaturedStickers? {
- var _1: Int32?
- _1 = reader.readInt32()
- var _2: Int64?
- _2 = reader.readInt64()
- var _3: Int32?
- _3 = reader.readInt32()
- var _4: [Api.StickerSetCovered]?
- if let _ = reader.readInt32() {
- _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StickerSetCovered.self)
- }
- var _5: [Int64]?
- if let _ = reader.readInt32() {
- _5 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self)
- }
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = _3 != nil
- let _c4 = _4 != nil
- let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.messages.FeaturedStickers.featuredStickers(flags: _1!, hash: _2!, count: _3!, sets: _4!, unread: _5!)
- }
- else {
- return nil
- }
- }
- public static func parse_featuredStickersNotModified(_ reader: BufferReader) -> FeaturedStickers? {
- var _1: Int32?
- _1 = reader.readInt32()
- let _c1 = _1 != nil
- if _c1 {
- return Api.messages.FeaturedStickers.featuredStickersNotModified(count: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.messages.ExportedChatInvites.exportedChatInvites(count: _1!, invites: _2!, users: _3!)
}
}
diff --git a/submodules/TelegramApi/Sources/Api34.swift b/submodules/TelegramApi/Sources/Api34.swift
index a0c446bb..23900f23 100644
--- a/submodules/TelegramApi/Sources/Api34.swift
+++ b/submodules/TelegramApi/Sources/Api34.swift
@@ -1,3 +1,149 @@
+public extension Api.messages {
+ enum FavedStickers: TypeConstructorDescription {
+ case favedStickers(hash: Int64, packs: [Api.StickerPack], stickers: [Api.Document])
+ case favedStickersNotModified
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .favedStickers(let hash, let packs, let stickers):
+ if boxed {
+ buffer.appendInt32(750063767)
+ }
+ serializeInt64(hash, buffer: buffer, boxed: false)
+ buffer.appendInt32(481674261)
+ buffer.appendInt32(Int32(packs.count))
+ for item in packs {
+ item.serialize(buffer, true)
+ }
+ buffer.appendInt32(481674261)
+ buffer.appendInt32(Int32(stickers.count))
+ for item in stickers {
+ item.serialize(buffer, true)
+ }
+ break
+ case .favedStickersNotModified:
+ if boxed {
+ buffer.appendInt32(-1634752813)
+ }
+
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .favedStickers(let hash, let packs, let stickers):
+ return ("favedStickers", [("hash", hash as Any), ("packs", packs as Any), ("stickers", stickers as Any)])
+ case .favedStickersNotModified:
+ return ("favedStickersNotModified", [])
+ }
+ }
+
+ public static func parse_favedStickers(_ reader: BufferReader) -> FavedStickers? {
+ var _1: Int64?
+ _1 = reader.readInt64()
+ var _2: [Api.StickerPack]?
+ if let _ = reader.readInt32() {
+ _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StickerPack.self)
+ }
+ var _3: [Api.Document]?
+ if let _ = reader.readInt32() {
+ _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Document.self)
+ }
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = _3 != nil
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.messages.FavedStickers.favedStickers(hash: _1!, packs: _2!, stickers: _3!)
+ }
+ public static func parse_favedStickersNotModified(_ reader: BufferReader) -> FavedStickers? {
+ return Api.messages.FavedStickers.favedStickersNotModified
+ }
+
+ }
+}
+public extension Api.messages {
+ enum FeaturedStickers: TypeConstructorDescription {
+ case featuredStickers(flags: Int32, hash: Int64, count: Int32, sets: [Api.StickerSetCovered], unread: [Int64])
+ case featuredStickersNotModified(count: Int32)
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .featuredStickers(let flags, let hash, let count, let sets, let unread):
+ if boxed {
+ buffer.appendInt32(-1103615738)
+ }
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ serializeInt64(hash, buffer: buffer, boxed: false)
+ serializeInt32(count, buffer: buffer, boxed: false)
+ buffer.appendInt32(481674261)
+ buffer.appendInt32(Int32(sets.count))
+ for item in sets {
+ item.serialize(buffer, true)
+ }
+ buffer.appendInt32(481674261)
+ buffer.appendInt32(Int32(unread.count))
+ for item in unread {
+ serializeInt64(item, buffer: buffer, boxed: false)
+ }
+ break
+ case .featuredStickersNotModified(let count):
+ if boxed {
+ buffer.appendInt32(-958657434)
+ }
+ serializeInt32(count, buffer: buffer, boxed: false)
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .featuredStickers(let flags, let hash, let count, let sets, let unread):
+ return ("featuredStickers", [("flags", flags as Any), ("hash", hash as Any), ("count", count as Any), ("sets", sets as Any), ("unread", unread as Any)])
+ case .featuredStickersNotModified(let count):
+ return ("featuredStickersNotModified", [("count", count as Any)])
+ }
+ }
+
+ public static func parse_featuredStickers(_ reader: BufferReader) -> FeaturedStickers? {
+ var _1: Int32?
+ _1 = reader.readInt32()
+ var _2: Int64?
+ _2 = reader.readInt64()
+ var _3: Int32?
+ _3 = reader.readInt32()
+ var _4: [Api.StickerSetCovered]?
+ if let _ = reader.readInt32() {
+ _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StickerSetCovered.self)
+ }
+ var _5: [Int64]?
+ if let _ = reader.readInt32() {
+ _5 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self)
+ }
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = _3 != nil
+ let _c4 = _4 != nil
+ let _c5 = _5 != nil
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.messages.FeaturedStickers.featuredStickers(flags: _1!, hash: _2!, count: _3!, sets: _4!, unread: _5!)
+ }
+ public static func parse_featuredStickersNotModified(_ reader: BufferReader) -> FeaturedStickers? {
+ var _1: Int32?
+ _1 = reader.readInt32()
+ let _c1 = _1 != nil
+ if !_c1 { return nil }
+ return Api.messages.FeaturedStickers.featuredStickersNotModified(count: _1!)
+ }
+
+ }
+}
public extension Api.messages {
enum ForumTopics: TypeConstructorDescription {
case forumTopics(flags: Int32, count: Int32, topics: [Api.ForumTopic], messages: [Api.Message], chats: [Api.Chat], users: [Api.User], pts: Int32)
@@ -72,12 +218,14 @@ public extension Api.messages {
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.messages.ForumTopics.forumTopics(flags: _1!, count: _2!, topics: _3!, messages: _4!, chats: _5!, users: _6!, pts: _7!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.messages.ForumTopics.forumTopics(flags: _1!, count: _2!, topics: _3!, messages: _4!, chats: _5!, users: _6!, pts: _7!)
}
}
@@ -127,12 +275,9 @@ public extension Api.messages {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.messages.FoundStickerSets.foundStickerSets(hash: _1!, sets: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.messages.FoundStickerSets.foundStickerSets(hash: _1!, sets: _2!)
}
public static func parse_foundStickerSetsNotModified(_ reader: BufferReader) -> FoundStickerSets? {
return Api.messages.FoundStickerSets.foundStickerSetsNotModified
@@ -194,12 +339,11 @@ public extension Api.messages {
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.messages.FoundStickers.foundStickers(flags: _1!, nextOffset: _2, hash: _3!, stickers: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.messages.FoundStickers.foundStickers(flags: _1!, nextOffset: _2, hash: _3!, stickers: _4!)
}
public static func parse_foundStickersNotModified(_ reader: BufferReader) -> FoundStickers? {
var _1: Int32?
@@ -208,12 +352,9 @@ public extension Api.messages {
if Int(_1!) & Int(1 << 0) != 0 {_2 = reader.readInt32() }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
- if _c1 && _c2 {
- return Api.messages.FoundStickers.foundStickersNotModified(flags: _1!, nextOffset: _2)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.messages.FoundStickers.foundStickersNotModified(flags: _1!, nextOffset: _2)
}
}
@@ -260,12 +401,9 @@ public extension Api.messages {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.messages.HighScores.highScores(scores: _1!, users: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.messages.HighScores.highScores(scores: _1!, users: _2!)
}
}
@@ -296,12 +434,8 @@ public extension Api.messages {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
- if _c1 {
- return Api.messages.HistoryImport.historyImport(id: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.messages.HistoryImport.historyImport(id: _1!)
}
}
@@ -336,12 +470,9 @@ public extension Api.messages {
if Int(_1!) & Int(1 << 2) != 0 {_2 = parseString(reader) }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 2) == 0) || _2 != nil
- if _c1 && _c2 {
- return Api.messages.HistoryImportParsed.historyImportParsed(flags: _1!, title: _2)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.messages.HistoryImportParsed.historyImportParsed(flags: _1!, title: _2)
}
}
@@ -398,12 +529,10 @@ public extension Api.messages {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.messages.InactiveChats.inactiveChats(dates: _1!, chats: _2!, users: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.messages.InactiveChats.inactiveChats(dates: _1!, chats: _2!, users: _3!)
}
}
@@ -446,12 +575,9 @@ public extension Api.messages {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.messages.InvitedUsers.invitedUsers(updates: _1!, missingInvitees: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.messages.InvitedUsers.invitedUsers(updates: _1!, missingInvitees: _2!)
}
}
@@ -482,12 +608,8 @@ public extension Api.messages {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.messages.MessageEditData.messageEditData(flags: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.messages.MessageEditData.messageEditData(flags: _1!)
}
}
@@ -556,12 +678,13 @@ public extension Api.messages {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.messages.MessageReactionsList.messageReactionsList(flags: _1!, count: _2!, reactions: _3!, chats: _4!, users: _5!, nextOffset: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.messages.MessageReactionsList.messageReactionsList(flags: _1!, count: _2!, reactions: _3!, chats: _4!, users: _5!, nextOffset: _6)
}
}
@@ -618,12 +741,10 @@ public extension Api.messages {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.messages.MessageViews.messageViews(views: _1!, chats: _2!, users: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.messages.MessageViews.messageViews(views: _1!, chats: _2!, users: _3!)
}
}
@@ -776,12 +897,15 @@ public extension Api.messages {
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.messages.Messages.channelMessages(flags: _1!, pts: _2!, count: _3!, offsetIdOffset: _4, messages: _5!, topics: _6!, chats: _7!, users: _8!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.messages.Messages.channelMessages(flags: _1!, pts: _2!, count: _3!, offsetIdOffset: _4, messages: _5!, topics: _6!, chats: _7!, users: _8!)
}
public static func parse_messages(_ reader: BufferReader) -> Messages? {
var _1: [Api.Message]?
@@ -804,23 +928,18 @@ public extension Api.messages {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.messages.Messages.messages(messages: _1!, topics: _2!, chats: _3!, users: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.messages.Messages.messages(messages: _1!, topics: _2!, chats: _3!, users: _4!)
}
public static func parse_messagesNotModified(_ reader: BufferReader) -> Messages? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.messages.Messages.messagesNotModified(count: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.messages.Messages.messagesNotModified(count: _1!)
}
public static func parse_messagesSlice(_ reader: BufferReader) -> Messages? {
var _1: Int32?
@@ -860,12 +979,16 @@ public extension Api.messages {
let _c7 = _7 != nil
let _c8 = _8 != nil
let _c9 = _9 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
- return Api.messages.Messages.messagesSlice(flags: _1!, count: _2!, nextRate: _3, offsetIdOffset: _4, searchFlood: _5, messages: _6!, topics: _7!, chats: _8!, users: _9!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ return Api.messages.Messages.messagesSlice(flags: _1!, count: _2!, nextRate: _3, offsetIdOffset: _4, searchFlood: _5, messages: _6!, topics: _7!, chats: _8!, users: _9!)
}
}
@@ -906,12 +1029,9 @@ public extension Api.messages {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.messages.MyStickers.myStickers(count: _1!, sets: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.messages.MyStickers.myStickers(count: _1!, sets: _2!)
}
}
@@ -984,12 +1104,12 @@ public extension Api.messages {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.messages.PeerDialogs.peerDialogs(dialogs: _1!, messages: _2!, chats: _3!, users: _4!, state: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.messages.PeerDialogs.peerDialogs(dialogs: _1!, messages: _2!, chats: _3!, users: _4!, state: _5!)
}
}
@@ -1042,12 +1162,10 @@ public extension Api.messages {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.messages.PeerSettings.peerSettings(settings: _1!, chats: _2!, users: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.messages.PeerSettings.peerSettings(settings: _1!, chats: _2!, users: _3!)
}
}
@@ -1108,12 +1226,12 @@ public extension Api.messages {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.messages.PreparedInlineMessage.preparedInlineMessage(queryId: _1!, result: _2!, peerTypes: _3!, cacheTime: _4!, users: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.messages.PreparedInlineMessage.preparedInlineMessage(queryId: _1!, result: _2!, peerTypes: _3!, cacheTime: _4!, users: _5!)
}
}
@@ -1189,12 +1307,11 @@ public extension Api.messages {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.messages.QuickReplies.quickReplies(quickReplies: _1!, messages: _2!, chats: _3!, users: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.messages.QuickReplies.quickReplies(quickReplies: _1!, messages: _2!, chats: _3!, users: _4!)
}
public static func parse_quickRepliesNotModified(_ reader: BufferReader) -> QuickReplies? {
return Api.messages.QuickReplies.quickRepliesNotModified
@@ -1247,12 +1364,9 @@ public extension Api.messages {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.messages.Reactions.reactions(hash: _1!, reactions: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.messages.Reactions.reactions(hash: _1!, reactions: _2!)
}
public static func parse_reactionsNotModified(_ reader: BufferReader) -> Reactions? {
return Api.messages.Reactions.reactionsNotModified
@@ -1325,12 +1439,11 @@ public extension Api.messages {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.messages.RecentStickers.recentStickers(hash: _1!, packs: _2!, stickers: _3!, dates: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.messages.RecentStickers.recentStickers(hash: _1!, packs: _2!, stickers: _3!, dates: _4!)
}
public static func parse_recentStickersNotModified(_ reader: BufferReader) -> RecentStickers? {
return Api.messages.RecentStickers.recentStickersNotModified
@@ -1438,23 +1551,18 @@ public extension Api.messages {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.messages.SavedDialogs.savedDialogs(dialogs: _1!, messages: _2!, chats: _3!, users: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.messages.SavedDialogs.savedDialogs(dialogs: _1!, messages: _2!, chats: _3!, users: _4!)
}
public static func parse_savedDialogsNotModified(_ reader: BufferReader) -> SavedDialogs? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.messages.SavedDialogs.savedDialogsNotModified(count: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.messages.SavedDialogs.savedDialogsNotModified(count: _1!)
}
public static func parse_savedDialogsSlice(_ reader: BufferReader) -> SavedDialogs? {
var _1: Int32?
@@ -1480,70 +1588,12 @@ public extension Api.messages {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.messages.SavedDialogs.savedDialogsSlice(count: _1!, dialogs: _2!, messages: _3!, chats: _4!, users: _5!)
- }
- else {
- return nil
- }
- }
-
- }
-}
-public extension Api.messages {
- enum SavedGifs: TypeConstructorDescription {
- case savedGifs(hash: Int64, gifs: [Api.Document])
- case savedGifsNotModified
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .savedGifs(let hash, let gifs):
- if boxed {
- buffer.appendInt32(-2069878259)
- }
- serializeInt64(hash, buffer: buffer, boxed: false)
- buffer.appendInt32(481674261)
- buffer.appendInt32(Int32(gifs.count))
- for item in gifs {
- item.serialize(buffer, true)
- }
- break
- case .savedGifsNotModified:
- if boxed {
- buffer.appendInt32(-402498398)
- }
-
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .savedGifs(let hash, let gifs):
- return ("savedGifs", [("hash", hash as Any), ("gifs", gifs as Any)])
- case .savedGifsNotModified:
- return ("savedGifsNotModified", [])
- }
- }
-
- public static func parse_savedGifs(_ reader: BufferReader) -> SavedGifs? {
- var _1: Int64?
- _1 = reader.readInt64()
- var _2: [Api.Document]?
- if let _ = reader.readInt32() {
- _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Document.self)
- }
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.messages.SavedGifs.savedGifs(hash: _1!, gifs: _2!)
- }
- else {
- return nil
- }
- }
- public static func parse_savedGifsNotModified(_ reader: BufferReader) -> SavedGifs? {
- return Api.messages.SavedGifs.savedGifsNotModified
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.messages.SavedDialogs.savedDialogsSlice(count: _1!, dialogs: _2!, messages: _3!, chats: _4!, users: _5!)
}
}
diff --git a/submodules/TelegramApi/Sources/Api35.swift b/submodules/TelegramApi/Sources/Api35.swift
index 31b027ae..0898d641 100644
--- a/submodules/TelegramApi/Sources/Api35.swift
+++ b/submodules/TelegramApi/Sources/Api35.swift
@@ -1,3 +1,58 @@
+public extension Api.messages {
+ enum SavedGifs: TypeConstructorDescription {
+ case savedGifs(hash: Int64, gifs: [Api.Document])
+ case savedGifsNotModified
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .savedGifs(let hash, let gifs):
+ if boxed {
+ buffer.appendInt32(-2069878259)
+ }
+ serializeInt64(hash, buffer: buffer, boxed: false)
+ buffer.appendInt32(481674261)
+ buffer.appendInt32(Int32(gifs.count))
+ for item in gifs {
+ item.serialize(buffer, true)
+ }
+ break
+ case .savedGifsNotModified:
+ if boxed {
+ buffer.appendInt32(-402498398)
+ }
+
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .savedGifs(let hash, let gifs):
+ return ("savedGifs", [("hash", hash as Any), ("gifs", gifs as Any)])
+ case .savedGifsNotModified:
+ return ("savedGifsNotModified", [])
+ }
+ }
+
+ public static func parse_savedGifs(_ reader: BufferReader) -> SavedGifs? {
+ var _1: Int64?
+ _1 = reader.readInt64()
+ var _2: [Api.Document]?
+ if let _ = reader.readInt32() {
+ _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Document.self)
+ }
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.messages.SavedGifs.savedGifs(hash: _1!, gifs: _2!)
+ }
+ public static func parse_savedGifsNotModified(_ reader: BufferReader) -> SavedGifs? {
+ return Api.messages.SavedGifs.savedGifsNotModified
+ }
+
+ }
+}
public extension Api.messages {
enum SavedReactionTags: TypeConstructorDescription {
case savedReactionTags(tags: [Api.SavedReactionTag], hash: Int64)
@@ -43,12 +98,9 @@ public extension Api.messages {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.messages.SavedReactionTags.savedReactionTags(tags: _1!, hash: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.messages.SavedReactionTags.savedReactionTags(tags: _1!, hash: _2!)
}
public static func parse_savedReactionTagsNotModified(_ reader: BufferReader) -> SavedReactionTags? {
return Api.messages.SavedReactionTags.savedReactionTagsNotModified
@@ -92,12 +144,10 @@ public extension Api.messages {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.messages.SearchCounter.searchCounter(flags: _1!, filter: _2!, count: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.messages.SearchCounter.searchCounter(flags: _1!, filter: _2!, count: _3!)
}
}
@@ -184,12 +234,16 @@ public extension Api.messages {
let _c7 = _7 != nil
let _c8 = _8 != nil
let _c9 = _9 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
- return Api.messages.SearchResultsCalendar.searchResultsCalendar(flags: _1!, count: _2!, minDate: _3!, minMsgId: _4!, offsetIdOffset: _5, periods: _6!, messages: _7!, chats: _8!, users: _9!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ return Api.messages.SearchResultsCalendar.searchResultsCalendar(flags: _1!, count: _2!, minDate: _3!, minMsgId: _4!, offsetIdOffset: _5, periods: _6!, messages: _7!, chats: _8!, users: _9!)
}
}
@@ -230,12 +284,9 @@ public extension Api.messages {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.messages.SearchResultsPositions.searchResultsPositions(count: _1!, positions: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.messages.SearchResultsPositions.searchResultsPositions(count: _1!, positions: _2!)
}
}
@@ -281,23 +332,16 @@ public extension Api.messages {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.messages.SentEncryptedMessage.sentEncryptedFile(date: _1!, file: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.messages.SentEncryptedMessage.sentEncryptedFile(date: _1!, file: _2!)
}
public static func parse_sentEncryptedMessage(_ reader: BufferReader) -> SentEncryptedMessage? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.messages.SentEncryptedMessage.sentEncryptedMessage(date: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.messages.SentEncryptedMessage.sentEncryptedMessage(date: _1!)
}
}
@@ -379,12 +423,14 @@ public extension Api.messages {
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.messages.SponsoredMessages.sponsoredMessages(flags: _1!, postsBetween: _2, startDelay: _3, betweenDelay: _4, messages: _5!, chats: _6!, users: _7!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.messages.SponsoredMessages.sponsoredMessages(flags: _1!, postsBetween: _2, startDelay: _3, betweenDelay: _4, messages: _5!, chats: _6!, users: _7!)
}
public static func parse_sponsoredMessagesEmpty(_ reader: BufferReader) -> SponsoredMessages? {
return Api.messages.SponsoredMessages.sponsoredMessagesEmpty
@@ -459,12 +505,11 @@ public extension Api.messages {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.messages.StickerSet.stickerSet(set: _1!, packs: _2!, keywords: _3!, documents: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.messages.StickerSet.stickerSet(set: _1!, packs: _2!, keywords: _3!, documents: _4!)
}
public static func parse_stickerSetNotModified(_ reader: BufferReader) -> StickerSet? {
return Api.messages.StickerSet.stickerSetNotModified
@@ -513,12 +558,8 @@ public extension Api.messages {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StickerSetCovered.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.messages.StickerSetInstallResult.stickerSetInstallResultArchive(sets: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.messages.StickerSetInstallResult.stickerSetInstallResultArchive(sets: _1!)
}
public static func parse_stickerSetInstallResultSuccess(_ reader: BufferReader) -> StickerSetInstallResult? {
return Api.messages.StickerSetInstallResult.stickerSetInstallResultSuccess
@@ -571,12 +612,9 @@ public extension Api.messages {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.messages.Stickers.stickers(hash: _1!, stickers: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.messages.Stickers.stickers(hash: _1!, stickers: _2!)
}
public static func parse_stickersNotModified(_ reader: BufferReader) -> Stickers? {
return Api.messages.Stickers.stickersNotModified
@@ -626,12 +664,12 @@ public extension Api.messages {
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.messages.TranscribedAudio.transcribedAudio(flags: _1!, transcriptionId: _2!, text: _3!, trialRemainsNum: _4, trialRemainsUntilDate: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.messages.TranscribedAudio.transcribedAudio(flags: _1!, transcriptionId: _2!, text: _3!, trialRemainsNum: _4, trialRemainsUntilDate: _5)
}
}
@@ -668,12 +706,8 @@ public extension Api.messages {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.TextWithEntities.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.messages.TranslatedText.translateResult(result: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.messages.TranslatedText.translateResult(result: _1!)
}
}
@@ -742,12 +776,13 @@ public extension Api.messages {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.messages.VotesList.votesList(flags: _1!, count: _2!, votes: _3!, chats: _4!, users: _5!, nextOffset: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.messages.VotesList.votesList(flags: _1!, count: _2!, votes: _3!, chats: _4!, users: _5!, nextOffset: _6)
}
}
@@ -800,12 +835,10 @@ public extension Api.messages {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.messages.WebPage.webPage(webpage: _1!, chats: _2!, users: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.messages.WebPage.webPage(webpage: _1!, chats: _2!, users: _3!)
}
}
@@ -858,12 +891,10 @@ public extension Api.messages {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.messages.WebPagePreview.webPagePreview(media: _1!, chats: _2!, users: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.messages.WebPagePreview.webPagePreview(media: _1!, chats: _2!, users: _3!)
}
}
@@ -904,12 +935,9 @@ public extension Api.payments {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.payments.BankCardData.bankCardData(title: _1!, openUrls: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.payments.BankCardData.bankCardData(title: _1!, openUrls: _2!)
}
}
@@ -951,12 +979,8 @@ public extension Api.payments {
_1 = Api.parse(reader, signature: signature) as? Api.TextWithEntities
}
let _c1 = _1 != nil
- if _c1 {
- return Api.payments.CheckCanSendGiftResult.checkCanSendGiftResultFail(reason: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.payments.CheckCanSendGiftResult.checkCanSendGiftResultFail(reason: _1!)
}
public static func parse_checkCanSendGiftResultOk(_ reader: BufferReader) -> CheckCanSendGiftResult? {
return Api.payments.CheckCanSendGiftResult.checkCanSendGiftResultOk
@@ -1036,12 +1060,16 @@ public extension Api.payments {
let _c7 = (Int(_1!) & Int(1 << 1) == 0) || _7 != nil
let _c8 = _8 != nil
let _c9 = _9 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
- return Api.payments.CheckedGiftCode.checkedGiftCode(flags: _1!, fromId: _2, giveawayMsgId: _3, toId: _4, date: _5!, days: _6!, usedDate: _7, chats: _8!, users: _9!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ return Api.payments.CheckedGiftCode.checkedGiftCode(flags: _1!, fromId: _2, giveawayMsgId: _3, toId: _4, date: _5!, days: _6!, usedDate: _7, chats: _8!, users: _9!)
}
}
@@ -1092,12 +1120,10 @@ public extension Api.payments {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.payments.ConnectedStarRefBots.connectedStarRefBots(count: _1!, connectedBots: _2!, users: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.payments.ConnectedStarRefBots.connectedStarRefBots(count: _1!, connectedBots: _2!, users: _3!)
}
}
@@ -1128,12 +1154,8 @@ public extension Api.payments {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.payments.ExportedInvoice.exportedInvoice(url: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.payments.ExportedInvoice.exportedInvoice(url: _1!)
}
}
@@ -1195,12 +1217,12 @@ public extension Api.payments {
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 4) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.payments.GiveawayInfo.giveawayInfo(flags: _1!, startDate: _2!, joinedTooEarlyDate: _3, adminDisallowedChatId: _4, disallowedCountry: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.payments.GiveawayInfo.giveawayInfo(flags: _1!, startDate: _2!, joinedTooEarlyDate: _3, adminDisallowedChatId: _4, disallowedCountry: _5)
}
public static func parse_giveawayInfoResults(_ reader: BufferReader) -> GiveawayInfo? {
var _1: Int32?
@@ -1224,12 +1246,14 @@ public extension Api.payments {
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = (Int(_1!) & Int(1 << 2) == 0) || _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.payments.GiveawayInfo.giveawayInfoResults(flags: _1!, startDate: _2!, giftCodeSlug: _3, starsPrize: _4, finishDate: _5!, winnersCount: _6!, activatedCount: _7)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.payments.GiveawayInfo.giveawayInfoResults(flags: _1!, startDate: _2!, giftCodeSlug: _3, starsPrize: _4, finishDate: _5!, winnersCount: _6!, activatedCount: _7)
}
}
@@ -1372,12 +1396,22 @@ public extension Api.payments {
let _c13 = (Int(_1!) & Int(1 << 0) == 0) || _13 != nil
let _c14 = (Int(_1!) & Int(1 << 1) == 0) || _14 != nil
let _c15 = _15 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 {
- return Api.payments.PaymentForm.paymentForm(flags: _1!, formId: _2!, botId: _3!, title: _4!, description: _5!, photo: _6, invoice: _7!, providerId: _8!, url: _9!, nativeProvider: _10, nativeParams: _11, additionalMethods: _12, savedInfo: _13, savedCredentials: _14, users: _15!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ if !_c13 { return nil }
+ if !_c14 { return nil }
+ if !_c15 { return nil }
+ return Api.payments.PaymentForm.paymentForm(flags: _1!, formId: _2!, botId: _3!, title: _4!, description: _5!, photo: _6, invoice: _7!, providerId: _8!, url: _9!, nativeProvider: _10, nativeParams: _11, additionalMethods: _12, savedInfo: _13, savedCredentials: _14, users: _15!)
}
public static func parse_paymentFormStarGift(_ reader: BufferReader) -> PaymentForm? {
var _1: Int64?
@@ -1388,12 +1422,9 @@ public extension Api.payments {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.payments.PaymentForm.paymentFormStarGift(formId: _1!, invoice: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.payments.PaymentForm.paymentFormStarGift(formId: _1!, invoice: _2!)
}
public static func parse_paymentFormStars(_ reader: BufferReader) -> PaymentForm? {
var _1: Int32?
@@ -1426,188 +1457,15 @@ public extension Api.payments {
let _c6 = (Int(_1!) & Int(1 << 5) == 0) || _6 != nil
let _c7 = _7 != nil
let _c8 = _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.payments.PaymentForm.paymentFormStars(flags: _1!, formId: _2!, botId: _3!, title: _4!, description: _5!, photo: _6, invoice: _7!, users: _8!)
- }
- else {
- return nil
- }
- }
-
- }
-}
-public extension Api.payments {
- enum PaymentReceipt: TypeConstructorDescription {
- case paymentReceipt(flags: Int32, date: Int32, botId: Int64, providerId: Int64, title: String, description: String, photo: Api.WebDocument?, invoice: Api.Invoice, info: Api.PaymentRequestedInfo?, shipping: Api.ShippingOption?, tipAmount: Int64?, currency: String, totalAmount: Int64, credentialsTitle: String, users: [Api.User])
- case paymentReceiptStars(flags: Int32, date: Int32, botId: Int64, title: String, description: String, photo: Api.WebDocument?, invoice: Api.Invoice, currency: String, totalAmount: Int64, transactionId: String, users: [Api.User])
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .paymentReceipt(let flags, let date, let botId, let providerId, let title, let description, let photo, let invoice, let info, let shipping, let tipAmount, let currency, let totalAmount, let credentialsTitle, let users):
- if boxed {
- buffer.appendInt32(1891958275)
- }
- serializeInt32(flags, buffer: buffer, boxed: false)
- serializeInt32(date, buffer: buffer, boxed: false)
- serializeInt64(botId, buffer: buffer, boxed: false)
- serializeInt64(providerId, buffer: buffer, boxed: false)
- serializeString(title, buffer: buffer, boxed: false)
- serializeString(description, buffer: buffer, boxed: false)
- if Int(flags) & Int(1 << 2) != 0 {photo!.serialize(buffer, true)}
- invoice.serialize(buffer, true)
- if Int(flags) & Int(1 << 0) != 0 {info!.serialize(buffer, true)}
- if Int(flags) & Int(1 << 1) != 0 {shipping!.serialize(buffer, true)}
- if Int(flags) & Int(1 << 3) != 0 {serializeInt64(tipAmount!, buffer: buffer, boxed: false)}
- serializeString(currency, buffer: buffer, boxed: false)
- serializeInt64(totalAmount, buffer: buffer, boxed: false)
- serializeString(credentialsTitle, buffer: buffer, boxed: false)
- buffer.appendInt32(481674261)
- buffer.appendInt32(Int32(users.count))
- for item in users {
- item.serialize(buffer, true)
- }
- break
- case .paymentReceiptStars(let flags, let date, let botId, let title, let description, let photo, let invoice, let currency, let totalAmount, let transactionId, let users):
- if boxed {
- buffer.appendInt32(-625215430)
- }
- serializeInt32(flags, buffer: buffer, boxed: false)
- serializeInt32(date, buffer: buffer, boxed: false)
- serializeInt64(botId, buffer: buffer, boxed: false)
- serializeString(title, buffer: buffer, boxed: false)
- serializeString(description, buffer: buffer, boxed: false)
- if Int(flags) & Int(1 << 2) != 0 {photo!.serialize(buffer, true)}
- invoice.serialize(buffer, true)
- serializeString(currency, buffer: buffer, boxed: false)
- serializeInt64(totalAmount, buffer: buffer, boxed: false)
- serializeString(transactionId, buffer: buffer, boxed: false)
- buffer.appendInt32(481674261)
- buffer.appendInt32(Int32(users.count))
- for item in users {
- item.serialize(buffer, true)
- }
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .paymentReceipt(let flags, let date, let botId, let providerId, let title, let description, let photo, let invoice, let info, let shipping, let tipAmount, let currency, let totalAmount, let credentialsTitle, let users):
- return ("paymentReceipt", [("flags", flags as Any), ("date", date as Any), ("botId", botId as Any), ("providerId", providerId as Any), ("title", title as Any), ("description", description as Any), ("photo", photo as Any), ("invoice", invoice as Any), ("info", info as Any), ("shipping", shipping as Any), ("tipAmount", tipAmount as Any), ("currency", currency as Any), ("totalAmount", totalAmount as Any), ("credentialsTitle", credentialsTitle as Any), ("users", users as Any)])
- case .paymentReceiptStars(let flags, let date, let botId, let title, let description, let photo, let invoice, let currency, let totalAmount, let transactionId, let users):
- return ("paymentReceiptStars", [("flags", flags as Any), ("date", date as Any), ("botId", botId as Any), ("title", title as Any), ("description", description as Any), ("photo", photo as Any), ("invoice", invoice as Any), ("currency", currency as Any), ("totalAmount", totalAmount as Any), ("transactionId", transactionId as Any), ("users", users as Any)])
- }
- }
-
- public static func parse_paymentReceipt(_ reader: BufferReader) -> PaymentReceipt? {
- var _1: Int32?
- _1 = reader.readInt32()
- var _2: Int32?
- _2 = reader.readInt32()
- var _3: Int64?
- _3 = reader.readInt64()
- var _4: Int64?
- _4 = reader.readInt64()
- var _5: String?
- _5 = parseString(reader)
- var _6: String?
- _6 = parseString(reader)
- var _7: Api.WebDocument?
- if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
- _7 = Api.parse(reader, signature: signature) as? Api.WebDocument
- } }
- var _8: Api.Invoice?
- if let signature = reader.readInt32() {
- _8 = Api.parse(reader, signature: signature) as? Api.Invoice
- }
- var _9: Api.PaymentRequestedInfo?
- if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
- _9 = Api.parse(reader, signature: signature) as? Api.PaymentRequestedInfo
- } }
- var _10: Api.ShippingOption?
- if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
- _10 = Api.parse(reader, signature: signature) as? Api.ShippingOption
- } }
- var _11: Int64?
- if Int(_1!) & Int(1 << 3) != 0 {_11 = reader.readInt64() }
- var _12: String?
- _12 = parseString(reader)
- var _13: Int64?
- _13 = reader.readInt64()
- var _14: String?
- _14 = parseString(reader)
- var _15: [Api.User]?
- if let _ = reader.readInt32() {
- _15 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
- }
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = _3 != nil
- let _c4 = _4 != nil
- let _c5 = _5 != nil
- let _c6 = _6 != nil
- let _c7 = (Int(_1!) & Int(1 << 2) == 0) || _7 != nil
- let _c8 = _8 != nil
- let _c9 = (Int(_1!) & Int(1 << 0) == 0) || _9 != nil
- let _c10 = (Int(_1!) & Int(1 << 1) == 0) || _10 != nil
- let _c11 = (Int(_1!) & Int(1 << 3) == 0) || _11 != nil
- let _c12 = _12 != nil
- let _c13 = _13 != nil
- let _c14 = _14 != nil
- let _c15 = _15 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 {
- return Api.payments.PaymentReceipt.paymentReceipt(flags: _1!, date: _2!, botId: _3!, providerId: _4!, title: _5!, description: _6!, photo: _7, invoice: _8!, info: _9, shipping: _10, tipAmount: _11, currency: _12!, totalAmount: _13!, credentialsTitle: _14!, users: _15!)
- }
- else {
- return nil
- }
- }
- public static func parse_paymentReceiptStars(_ reader: BufferReader) -> PaymentReceipt? {
- var _1: Int32?
- _1 = reader.readInt32()
- var _2: Int32?
- _2 = reader.readInt32()
- var _3: Int64?
- _3 = reader.readInt64()
- var _4: String?
- _4 = parseString(reader)
- var _5: String?
- _5 = parseString(reader)
- var _6: Api.WebDocument?
- if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
- _6 = Api.parse(reader, signature: signature) as? Api.WebDocument
- } }
- var _7: Api.Invoice?
- if let signature = reader.readInt32() {
- _7 = Api.parse(reader, signature: signature) as? Api.Invoice
- }
- var _8: String?
- _8 = parseString(reader)
- var _9: Int64?
- _9 = reader.readInt64()
- var _10: String?
- _10 = parseString(reader)
- var _11: [Api.User]?
- if let _ = reader.readInt32() {
- _11 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
- }
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = _3 != nil
- let _c4 = _4 != nil
- let _c5 = _5 != nil
- let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil
- let _c7 = _7 != nil
- let _c8 = _8 != nil
- let _c9 = _9 != nil
- let _c10 = _10 != nil
- let _c11 = _11 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 {
- return Api.payments.PaymentReceipt.paymentReceiptStars(flags: _1!, date: _2!, botId: _3!, title: _4!, description: _5!, photo: _6, invoice: _7!, currency: _8!, totalAmount: _9!, transactionId: _10!, users: _11!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.payments.PaymentForm.paymentFormStars(flags: _1!, formId: _2!, botId: _3!, title: _4!, description: _5!, photo: _6, invoice: _7!, users: _8!)
}
}
diff --git a/submodules/TelegramApi/Sources/Api36.swift b/submodules/TelegramApi/Sources/Api36.swift
index 22436f1e..1bad226d 100644
--- a/submodules/TelegramApi/Sources/Api36.swift
+++ b/submodules/TelegramApi/Sources/Api36.swift
@@ -1,3 +1,195 @@
+public extension Api.payments {
+ enum PaymentReceipt: TypeConstructorDescription {
+ case paymentReceipt(flags: Int32, date: Int32, botId: Int64, providerId: Int64, title: String, description: String, photo: Api.WebDocument?, invoice: Api.Invoice, info: Api.PaymentRequestedInfo?, shipping: Api.ShippingOption?, tipAmount: Int64?, currency: String, totalAmount: Int64, credentialsTitle: String, users: [Api.User])
+ case paymentReceiptStars(flags: Int32, date: Int32, botId: Int64, title: String, description: String, photo: Api.WebDocument?, invoice: Api.Invoice, currency: String, totalAmount: Int64, transactionId: String, users: [Api.User])
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .paymentReceipt(let flags, let date, let botId, let providerId, let title, let description, let photo, let invoice, let info, let shipping, let tipAmount, let currency, let totalAmount, let credentialsTitle, let users):
+ if boxed {
+ buffer.appendInt32(1891958275)
+ }
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ serializeInt32(date, buffer: buffer, boxed: false)
+ serializeInt64(botId, buffer: buffer, boxed: false)
+ serializeInt64(providerId, buffer: buffer, boxed: false)
+ serializeString(title, buffer: buffer, boxed: false)
+ serializeString(description, buffer: buffer, boxed: false)
+ if Int(flags) & Int(1 << 2) != 0 {photo!.serialize(buffer, true)}
+ invoice.serialize(buffer, true)
+ if Int(flags) & Int(1 << 0) != 0 {info!.serialize(buffer, true)}
+ if Int(flags) & Int(1 << 1) != 0 {shipping!.serialize(buffer, true)}
+ if Int(flags) & Int(1 << 3) != 0 {serializeInt64(tipAmount!, buffer: buffer, boxed: false)}
+ serializeString(currency, buffer: buffer, boxed: false)
+ serializeInt64(totalAmount, buffer: buffer, boxed: false)
+ serializeString(credentialsTitle, buffer: buffer, boxed: false)
+ buffer.appendInt32(481674261)
+ buffer.appendInt32(Int32(users.count))
+ for item in users {
+ item.serialize(buffer, true)
+ }
+ break
+ case .paymentReceiptStars(let flags, let date, let botId, let title, let description, let photo, let invoice, let currency, let totalAmount, let transactionId, let users):
+ if boxed {
+ buffer.appendInt32(-625215430)
+ }
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ serializeInt32(date, buffer: buffer, boxed: false)
+ serializeInt64(botId, buffer: buffer, boxed: false)
+ serializeString(title, buffer: buffer, boxed: false)
+ serializeString(description, buffer: buffer, boxed: false)
+ if Int(flags) & Int(1 << 2) != 0 {photo!.serialize(buffer, true)}
+ invoice.serialize(buffer, true)
+ serializeString(currency, buffer: buffer, boxed: false)
+ serializeInt64(totalAmount, buffer: buffer, boxed: false)
+ serializeString(transactionId, buffer: buffer, boxed: false)
+ buffer.appendInt32(481674261)
+ buffer.appendInt32(Int32(users.count))
+ for item in users {
+ item.serialize(buffer, true)
+ }
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .paymentReceipt(let flags, let date, let botId, let providerId, let title, let description, let photo, let invoice, let info, let shipping, let tipAmount, let currency, let totalAmount, let credentialsTitle, let users):
+ return ("paymentReceipt", [("flags", flags as Any), ("date", date as Any), ("botId", botId as Any), ("providerId", providerId as Any), ("title", title as Any), ("description", description as Any), ("photo", photo as Any), ("invoice", invoice as Any), ("info", info as Any), ("shipping", shipping as Any), ("tipAmount", tipAmount as Any), ("currency", currency as Any), ("totalAmount", totalAmount as Any), ("credentialsTitle", credentialsTitle as Any), ("users", users as Any)])
+ case .paymentReceiptStars(let flags, let date, let botId, let title, let description, let photo, let invoice, let currency, let totalAmount, let transactionId, let users):
+ return ("paymentReceiptStars", [("flags", flags as Any), ("date", date as Any), ("botId", botId as Any), ("title", title as Any), ("description", description as Any), ("photo", photo as Any), ("invoice", invoice as Any), ("currency", currency as Any), ("totalAmount", totalAmount as Any), ("transactionId", transactionId as Any), ("users", users as Any)])
+ }
+ }
+
+ public static func parse_paymentReceipt(_ reader: BufferReader) -> PaymentReceipt? {
+ var _1: Int32?
+ _1 = reader.readInt32()
+ var _2: Int32?
+ _2 = reader.readInt32()
+ var _3: Int64?
+ _3 = reader.readInt64()
+ var _4: Int64?
+ _4 = reader.readInt64()
+ var _5: String?
+ _5 = parseString(reader)
+ var _6: String?
+ _6 = parseString(reader)
+ var _7: Api.WebDocument?
+ if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
+ _7 = Api.parse(reader, signature: signature) as? Api.WebDocument
+ } }
+ var _8: Api.Invoice?
+ if let signature = reader.readInt32() {
+ _8 = Api.parse(reader, signature: signature) as? Api.Invoice
+ }
+ var _9: Api.PaymentRequestedInfo?
+ if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
+ _9 = Api.parse(reader, signature: signature) as? Api.PaymentRequestedInfo
+ } }
+ var _10: Api.ShippingOption?
+ if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
+ _10 = Api.parse(reader, signature: signature) as? Api.ShippingOption
+ } }
+ var _11: Int64?
+ if Int(_1!) & Int(1 << 3) != 0 {_11 = reader.readInt64() }
+ var _12: String?
+ _12 = parseString(reader)
+ var _13: Int64?
+ _13 = reader.readInt64()
+ var _14: String?
+ _14 = parseString(reader)
+ var _15: [Api.User]?
+ if let _ = reader.readInt32() {
+ _15 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
+ }
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = _3 != nil
+ let _c4 = _4 != nil
+ let _c5 = _5 != nil
+ let _c6 = _6 != nil
+ let _c7 = (Int(_1!) & Int(1 << 2) == 0) || _7 != nil
+ let _c8 = _8 != nil
+ let _c9 = (Int(_1!) & Int(1 << 0) == 0) || _9 != nil
+ let _c10 = (Int(_1!) & Int(1 << 1) == 0) || _10 != nil
+ let _c11 = (Int(_1!) & Int(1 << 3) == 0) || _11 != nil
+ let _c12 = _12 != nil
+ let _c13 = _13 != nil
+ let _c14 = _14 != nil
+ let _c15 = _15 != nil
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ if !_c13 { return nil }
+ if !_c14 { return nil }
+ if !_c15 { return nil }
+ return Api.payments.PaymentReceipt.paymentReceipt(flags: _1!, date: _2!, botId: _3!, providerId: _4!, title: _5!, description: _6!, photo: _7, invoice: _8!, info: _9, shipping: _10, tipAmount: _11, currency: _12!, totalAmount: _13!, credentialsTitle: _14!, users: _15!)
+ }
+ public static func parse_paymentReceiptStars(_ reader: BufferReader) -> PaymentReceipt? {
+ var _1: Int32?
+ _1 = reader.readInt32()
+ var _2: Int32?
+ _2 = reader.readInt32()
+ var _3: Int64?
+ _3 = reader.readInt64()
+ var _4: String?
+ _4 = parseString(reader)
+ var _5: String?
+ _5 = parseString(reader)
+ var _6: Api.WebDocument?
+ if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
+ _6 = Api.parse(reader, signature: signature) as? Api.WebDocument
+ } }
+ var _7: Api.Invoice?
+ if let signature = reader.readInt32() {
+ _7 = Api.parse(reader, signature: signature) as? Api.Invoice
+ }
+ var _8: String?
+ _8 = parseString(reader)
+ var _9: Int64?
+ _9 = reader.readInt64()
+ var _10: String?
+ _10 = parseString(reader)
+ var _11: [Api.User]?
+ if let _ = reader.readInt32() {
+ _11 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
+ }
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = _3 != nil
+ let _c4 = _4 != nil
+ let _c5 = _5 != nil
+ let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil
+ let _c7 = _7 != nil
+ let _c8 = _8 != nil
+ let _c9 = _9 != nil
+ let _c10 = _10 != nil
+ let _c11 = _11 != nil
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ return Api.payments.PaymentReceipt.paymentReceiptStars(flags: _1!, date: _2!, botId: _3!, title: _4!, description: _5!, photo: _6, invoice: _7!, currency: _8!, totalAmount: _9!, transactionId: _10!, users: _11!)
+ }
+
+ }
+}
public extension Api.payments {
indirect enum PaymentResult: TypeConstructorDescription {
case paymentResult(updates: Api.Updates)
@@ -35,23 +227,15 @@ public extension Api.payments {
_1 = Api.parse(reader, signature: signature) as? Api.Updates
}
let _c1 = _1 != nil
- if _c1 {
- return Api.payments.PaymentResult.paymentResult(updates: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.payments.PaymentResult.paymentResult(updates: _1!)
}
public static func parse_paymentVerificationNeeded(_ reader: BufferReader) -> PaymentResult? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.payments.PaymentResult.paymentVerificationNeeded(url: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.payments.PaymentResult.paymentVerificationNeeded(url: _1!)
}
}
@@ -144,12 +328,16 @@ public extension Api.payments {
let _c7 = _7 != nil
let _c8 = (Int(_1!) & Int(1 << 2) == 0) || _8 != nil
let _c9 = _9 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
- return Api.payments.ResaleStarGifts.resaleStarGifts(flags: _1!, count: _2!, gifts: _3!, nextOffset: _4, attributes: _5, attributesHash: _6, chats: _7!, counters: _8, users: _9!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ return Api.payments.ResaleStarGifts.resaleStarGifts(flags: _1!, count: _2!, gifts: _3!, nextOffset: _4, attributes: _5, attributesHash: _6, chats: _7!, counters: _8, users: _9!)
}
}
@@ -186,12 +374,9 @@ public extension Api.payments {
} }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
- if _c1 && _c2 {
- return Api.payments.SavedInfo.savedInfo(flags: _1!, savedInfo: _2)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.payments.SavedInfo.savedInfo(flags: _1!, savedInfo: _2)
}
}
@@ -266,12 +451,14 @@ public extension Api.payments {
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.payments.SavedStarGifts.savedStarGifts(flags: _1!, count: _2!, chatNotificationsEnabled: _3, gifts: _4!, nextOffset: _5, chats: _6!, users: _7!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.payments.SavedStarGifts.savedStarGifts(flags: _1!, count: _2!, chatNotificationsEnabled: _3, gifts: _4!, nextOffset: _5, chats: _6!, users: _7!)
}
}
@@ -337,12 +524,10 @@ public extension Api.payments {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.payments.StarGiftActiveAuctions.starGiftActiveAuctions(auctions: _1!, users: _2!, chats: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.payments.StarGiftActiveAuctions.starGiftActiveAuctions(auctions: _1!, users: _2!, chats: _3!)
}
public static func parse_starGiftActiveAuctionsNotModified(_ reader: BufferReader) -> StarGiftActiveAuctions? {
return Api.payments.StarGiftActiveAuctions.starGiftActiveAuctionsNotModified
@@ -402,12 +587,10 @@ public extension Api.payments {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.payments.StarGiftAuctionAcquiredGifts.starGiftAuctionAcquiredGifts(gifts: _1!, users: _2!, chats: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.payments.StarGiftAuctionAcquiredGifts.starGiftAuctionAcquiredGifts(gifts: _1!, users: _2!, chats: _3!)
}
}
@@ -476,12 +659,13 @@ public extension Api.payments {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.payments.StarGiftAuctionState.starGiftAuctionState(gift: _1!, state: _2!, userState: _3!, timeout: _4!, users: _5!, chats: _6!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.payments.StarGiftAuctionState.starGiftAuctionState(gift: _1!, state: _2!, userState: _3!, timeout: _4!, users: _5!, chats: _6!)
}
}
@@ -527,12 +711,8 @@ public extension Api.payments {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StarGiftCollection.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.payments.StarGiftCollections.starGiftCollections(collections: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.payments.StarGiftCollections.starGiftCollections(collections: _1!)
}
public static func parse_starGiftCollectionsNotModified(_ reader: BufferReader) -> StarGiftCollections? {
return Api.payments.StarGiftCollections.starGiftCollectionsNotModified
@@ -572,12 +752,8 @@ public extension Api.payments {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StarGiftAttribute.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.payments.StarGiftUpgradeAttributes.starGiftUpgradeAttributes(attributes: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.payments.StarGiftUpgradeAttributes.starGiftUpgradeAttributes(attributes: _1!)
}
}
@@ -634,12 +810,10 @@ public extension Api.payments {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.payments.StarGiftUpgradePreview.starGiftUpgradePreview(sampleAttributes: _1!, prices: _2!, nextPrices: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.payments.StarGiftUpgradePreview.starGiftUpgradePreview(sampleAttributes: _1!, prices: _2!, nextPrices: _3!)
}
}
@@ -670,12 +844,8 @@ public extension Api.payments {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.payments.StarGiftWithdrawalUrl.starGiftWithdrawalUrl(url: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.payments.StarGiftWithdrawalUrl.starGiftWithdrawalUrl(url: _1!)
}
}
@@ -745,12 +915,11 @@ public extension Api.payments {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.payments.StarGifts.starGifts(hash: _1!, gifts: _2!, chats: _3!, users: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.payments.StarGifts.starGifts(hash: _1!, gifts: _2!, chats: _3!, users: _4!)
}
public static func parse_starGiftsNotModified(_ reader: BufferReader) -> StarGifts? {
return Api.payments.StarGifts.starGiftsNotModified
@@ -784,12 +953,8 @@ public extension Api.payments {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.payments.StarsRevenueAdsAccountUrl.starsRevenueAdsAccountUrl(url: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.payments.StarsRevenueAdsAccountUrl.starsRevenueAdsAccountUrl(url: _1!)
}
}
@@ -842,12 +1007,12 @@ public extension Api.payments {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.payments.StarsRevenueStats.starsRevenueStats(flags: _1!, topHoursGraph: _2, revenueGraph: _3!, status: _4!, usdRate: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.payments.StarsRevenueStats.starsRevenueStats(flags: _1!, topHoursGraph: _2, revenueGraph: _3!, status: _4!, usdRate: _5!)
}
}
@@ -878,12 +1043,8 @@ public extension Api.payments {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.payments.StarsRevenueWithdrawalUrl.starsRevenueWithdrawalUrl(url: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.payments.StarsRevenueWithdrawalUrl.starsRevenueWithdrawalUrl(url: _1!)
}
}
@@ -972,12 +1133,16 @@ public extension Api.payments {
let _c7 = (Int(_1!) & Int(1 << 0) == 0) || _7 != nil
let _c8 = _8 != nil
let _c9 = _9 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
- return Api.payments.StarsStatus.starsStatus(flags: _1!, balance: _2!, subscriptions: _3, subscriptionsNextOffset: _4, subscriptionsMissingBalance: _5, history: _6, nextOffset: _7, chats: _8!, users: _9!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ return Api.payments.StarsStatus.starsStatus(flags: _1!, balance: _2!, subscriptions: _3, subscriptionsNextOffset: _4, subscriptionsMissingBalance: _5, history: _6, nextOffset: _7, chats: _8!, users: _9!)
}
}
@@ -1036,12 +1201,12 @@ public extension Api.payments {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.payments.SuggestedStarRefBots.suggestedStarRefBots(flags: _1!, count: _2!, suggestedBots: _3!, users: _4!, nextOffset: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.payments.SuggestedStarRefBots.suggestedStarRefBots(flags: _1!, count: _2!, suggestedBots: _3!, users: _4!, nextOffset: _5)
}
}
@@ -1094,12 +1259,10 @@ public extension Api.payments {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.payments.UniqueStarGift.uniqueStarGift(gift: _1!, chats: _2!, users: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.payments.UniqueStarGift.uniqueStarGift(gift: _1!, chats: _2!, users: _3!)
}
}
@@ -1178,12 +1341,20 @@ public extension Api.payments {
let _c11 = (Int(_1!) & Int(1 << 4) == 0) || _11 != nil
let _c12 = (Int(_1!) & Int(1 << 5) == 0) || _12 != nil
let _c13 = (Int(_1!) & Int(1 << 5) == 0) || _13 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 {
- return Api.payments.UniqueStarGiftValueInfo.uniqueStarGiftValueInfo(flags: _1!, currency: _2!, value: _3!, initialSaleDate: _4!, initialSaleStars: _5!, initialSalePrice: _6!, lastSaleDate: _7, lastSalePrice: _8, floorPrice: _9, averagePrice: _10, listedCount: _11, fragmentListedCount: _12, fragmentListedUrl: _13)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ if !_c13 { return nil }
+ return Api.payments.UniqueStarGiftValueInfo.uniqueStarGiftValueInfo(flags: _1!, currency: _2!, value: _3!, initialSaleDate: _4!, initialSaleStars: _5!, initialSalePrice: _6!, lastSaleDate: _7, lastSalePrice: _8, floorPrice: _9, averagePrice: _10, listedCount: _11, fragmentListedCount: _12, fragmentListedUrl: _13)
}
}
@@ -1228,12 +1399,10 @@ public extension Api.payments {
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.payments.ValidatedRequestedInfo.validatedRequestedInfo(flags: _1!, id: _2, shippingOptions: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.payments.ValidatedRequestedInfo.validatedRequestedInfo(flags: _1!, id: _2, shippingOptions: _3)
}
}
@@ -1264,12 +1433,8 @@ public extension Api.phone {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.phone.ExportedGroupCallInvite.exportedGroupCallInvite(link: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.phone.ExportedGroupCallInvite.exportedGroupCallInvite(link: _1!)
}
}
@@ -1336,12 +1501,12 @@ public extension Api.phone {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.phone.GroupCall.groupCall(call: _1!, participants: _2!, participantsNextOffset: _3!, chats: _4!, users: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.phone.GroupCall.groupCall(call: _1!, participants: _2!, participantsNextOffset: _3!, chats: _4!, users: _5!)
}
}
@@ -1402,12 +1567,11 @@ public extension Api.phone {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.phone.GroupCallStars.groupCallStars(totalStars: _1!, topDonors: _2!, chats: _3!, users: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.phone.GroupCallStars.groupCallStars(totalStars: _1!, topDonors: _2!, chats: _3!, users: _4!)
}
}
@@ -1444,12 +1608,8 @@ public extension Api.phone {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.GroupCallStreamChannel.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.phone.GroupCallStreamChannels.groupCallStreamChannels(channels: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.phone.GroupCallStreamChannels.groupCallStreamChannels(channels: _1!)
}
}
@@ -1484,12 +1644,9 @@ public extension Api.phone {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.phone.GroupCallStreamRtmpUrl.groupCallStreamRtmpUrl(url: _1!, key: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.phone.GroupCallStreamRtmpUrl.groupCallStreamRtmpUrl(url: _1!, key: _2!)
}
}
@@ -1558,122 +1715,13 @@ public extension Api.phone {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.phone.GroupParticipants.groupParticipants(count: _1!, participants: _2!, nextOffset: _3!, chats: _4!, users: _5!, version: _6!)
- }
- else {
- return nil
- }
- }
-
- }
-}
-public extension Api.phone {
- enum JoinAsPeers: TypeConstructorDescription {
- case joinAsPeers(peers: [Api.Peer], chats: [Api.Chat], users: [Api.User])
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .joinAsPeers(let peers, let chats, let users):
- if boxed {
- buffer.appendInt32(-1343921601)
- }
- buffer.appendInt32(481674261)
- buffer.appendInt32(Int32(peers.count))
- for item in peers {
- item.serialize(buffer, true)
- }
- buffer.appendInt32(481674261)
- buffer.appendInt32(Int32(chats.count))
- for item in chats {
- item.serialize(buffer, true)
- }
- buffer.appendInt32(481674261)
- buffer.appendInt32(Int32(users.count))
- for item in users {
- item.serialize(buffer, true)
- }
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .joinAsPeers(let peers, let chats, let users):
- return ("joinAsPeers", [("peers", peers as Any), ("chats", chats as Any), ("users", users as Any)])
- }
- }
-
- public static func parse_joinAsPeers(_ reader: BufferReader) -> JoinAsPeers? {
- var _1: [Api.Peer]?
- if let _ = reader.readInt32() {
- _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Peer.self)
- }
- var _2: [Api.Chat]?
- if let _ = reader.readInt32() {
- _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
- }
- var _3: [Api.User]?
- if let _ = reader.readInt32() {
- _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
- }
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.phone.JoinAsPeers.joinAsPeers(peers: _1!, chats: _2!, users: _3!)
- }
- else {
- return nil
- }
- }
-
- }
-}
-public extension Api.phone {
- enum PhoneCall: TypeConstructorDescription {
- case phoneCall(phoneCall: Api.PhoneCall, users: [Api.User])
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .phoneCall(let phoneCall, let users):
- if boxed {
- buffer.appendInt32(-326966976)
- }
- phoneCall.serialize(buffer, true)
- buffer.appendInt32(481674261)
- buffer.appendInt32(Int32(users.count))
- for item in users {
- item.serialize(buffer, true)
- }
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .phoneCall(let phoneCall, let users):
- return ("phoneCall", [("phoneCall", phoneCall as Any), ("users", users as Any)])
- }
- }
-
- public static func parse_phoneCall(_ reader: BufferReader) -> PhoneCall? {
- var _1: Api.PhoneCall?
- if let signature = reader.readInt32() {
- _1 = Api.parse(reader, signature: signature) as? Api.PhoneCall
- }
- var _2: [Api.User]?
- if let _ = reader.readInt32() {
- _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
- }
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.phone.PhoneCall.phoneCall(phoneCall: _1!, users: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.phone.GroupParticipants.groupParticipants(count: _1!, participants: _2!, nextOffset: _3!, chats: _4!, users: _5!, version: _6!)
}
}
diff --git a/submodules/TelegramApi/Sources/Api37.swift b/submodules/TelegramApi/Sources/Api37.swift
index 3b5d2415..c9b4cfd1 100644
--- a/submodules/TelegramApi/Sources/Api37.swift
+++ b/submodules/TelegramApi/Sources/Api37.swift
@@ -1,3 +1,108 @@
+public extension Api.phone {
+ enum JoinAsPeers: TypeConstructorDescription {
+ case joinAsPeers(peers: [Api.Peer], chats: [Api.Chat], users: [Api.User])
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .joinAsPeers(let peers, let chats, let users):
+ if boxed {
+ buffer.appendInt32(-1343921601)
+ }
+ buffer.appendInt32(481674261)
+ buffer.appendInt32(Int32(peers.count))
+ for item in peers {
+ item.serialize(buffer, true)
+ }
+ buffer.appendInt32(481674261)
+ buffer.appendInt32(Int32(chats.count))
+ for item in chats {
+ item.serialize(buffer, true)
+ }
+ buffer.appendInt32(481674261)
+ buffer.appendInt32(Int32(users.count))
+ for item in users {
+ item.serialize(buffer, true)
+ }
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .joinAsPeers(let peers, let chats, let users):
+ return ("joinAsPeers", [("peers", peers as Any), ("chats", chats as Any), ("users", users as Any)])
+ }
+ }
+
+ public static func parse_joinAsPeers(_ reader: BufferReader) -> JoinAsPeers? {
+ var _1: [Api.Peer]?
+ if let _ = reader.readInt32() {
+ _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Peer.self)
+ }
+ var _2: [Api.Chat]?
+ if let _ = reader.readInt32() {
+ _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
+ }
+ var _3: [Api.User]?
+ if let _ = reader.readInt32() {
+ _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
+ }
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = _3 != nil
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.phone.JoinAsPeers.joinAsPeers(peers: _1!, chats: _2!, users: _3!)
+ }
+
+ }
+}
+public extension Api.phone {
+ enum PhoneCall: TypeConstructorDescription {
+ case phoneCall(phoneCall: Api.PhoneCall, users: [Api.User])
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .phoneCall(let phoneCall, let users):
+ if boxed {
+ buffer.appendInt32(-326966976)
+ }
+ phoneCall.serialize(buffer, true)
+ buffer.appendInt32(481674261)
+ buffer.appendInt32(Int32(users.count))
+ for item in users {
+ item.serialize(buffer, true)
+ }
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .phoneCall(let phoneCall, let users):
+ return ("phoneCall", [("phoneCall", phoneCall as Any), ("users", users as Any)])
+ }
+ }
+
+ public static func parse_phoneCall(_ reader: BufferReader) -> PhoneCall? {
+ var _1: Api.PhoneCall?
+ if let signature = reader.readInt32() {
+ _1 = Api.parse(reader, signature: signature) as? Api.PhoneCall
+ }
+ var _2: [Api.User]?
+ if let _ = reader.readInt32() {
+ _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
+ }
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.phone.PhoneCall.phoneCall(phoneCall: _1!, users: _2!)
+ }
+
+ }
+}
public extension Api.photos {
enum Photo: TypeConstructorDescription {
case photo(photo: Api.Photo, users: [Api.User])
@@ -36,12 +141,9 @@ public extension Api.photos {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.photos.Photo.photo(photo: _1!, users: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.photos.Photo.photo(photo: _1!, users: _2!)
}
}
@@ -107,12 +209,9 @@ public extension Api.photos {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.photos.Photos.photos(photos: _1!, users: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.photos.Photos.photos(photos: _1!, users: _2!)
}
public static func parse_photosSlice(_ reader: BufferReader) -> Photos? {
var _1: Int32?
@@ -128,12 +227,10 @@ public extension Api.photos {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.photos.Photos.photosSlice(count: _1!, photos: _2!, users: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.photos.Photos.photosSlice(count: _1!, photos: _2!, users: _3!)
}
}
@@ -192,12 +289,12 @@ public extension Api.premium {
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.premium.BoostsList.boostsList(flags: _1!, count: _2!, boosts: _3!, nextOffset: _4, users: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.premium.BoostsList.boostsList(flags: _1!, count: _2!, boosts: _3!, nextOffset: _4, users: _5!)
}
}
@@ -278,12 +375,17 @@ public extension Api.premium {
let _c8 = _8 != nil
let _c9 = (Int(_1!) & Int(1 << 3) == 0) || _9 != nil
let _c10 = (Int(_1!) & Int(1 << 2) == 0) || _10 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 {
- return Api.premium.BoostsStatus.boostsStatus(flags: _1!, level: _2!, currentLevelBoosts: _3!, boosts: _4!, giftBoosts: _5, nextLevelBoosts: _6, premiumAudience: _7, boostUrl: _8!, prepaidGiveaways: _9, myBoostSlots: _10)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ return Api.premium.BoostsStatus.boostsStatus(flags: _1!, level: _2!, currentLevelBoosts: _3!, boosts: _4!, giftBoosts: _5, nextLevelBoosts: _6, premiumAudience: _7, boostUrl: _8!, prepaidGiveaways: _9, myBoostSlots: _10)
}
}
@@ -340,12 +442,10 @@ public extension Api.premium {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.premium.MyBoosts.myBoosts(myBoosts: _1!, chats: _2!, users: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.premium.MyBoosts.myBoosts(myBoosts: _1!, chats: _2!, users: _3!)
}
}
@@ -380,12 +480,9 @@ public extension Api.smsjobs {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.smsjobs.EligibilityToJoin.eligibleToJoin(termsUrl: _1!, monthlySentSms: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.smsjobs.EligibilityToJoin.eligibleToJoin(termsUrl: _1!, monthlySentSms: _2!)
}
}
@@ -444,12 +541,15 @@ public extension Api.smsjobs {
let _c6 = _6 != nil
let _c7 = (Int(_1!) & Int(1 << 1) == 0) || _7 != nil
let _c8 = _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.smsjobs.Status.status(flags: _1!, recentSent: _2!, recentSince: _3!, recentRemains: _4!, totalSent: _5!, totalSince: _6!, lastGiftSlug: _7, termsUrl: _8!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.smsjobs.Status.status(flags: _1!, recentSent: _2!, recentSince: _3!, recentRemains: _4!, totalSent: _5!, totalSince: _6!, lastGiftSlug: _7, termsUrl: _8!)
}
}
@@ -612,12 +712,29 @@ public extension Api.stats {
let _c20 = _20 != nil
let _c21 = _21 != nil
let _c22 = _22 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 && _c19 && _c20 && _c21 && _c22 {
- return Api.stats.BroadcastStats.broadcastStats(period: _1!, followers: _2!, viewsPerPost: _3!, sharesPerPost: _4!, reactionsPerPost: _5!, viewsPerStory: _6!, sharesPerStory: _7!, reactionsPerStory: _8!, enabledNotifications: _9!, growthGraph: _10!, followersGraph: _11!, muteGraph: _12!, topHoursGraph: _13!, interactionsGraph: _14!, ivInteractionsGraph: _15!, viewsBySourceGraph: _16!, newFollowersBySourceGraph: _17!, languagesGraph: _18!, reactionsByEmotionGraph: _19!, storyInteractionsGraph: _20!, storyReactionsByEmotionGraph: _21!, recentPostsInteractions: _22!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ if !_c13 { return nil }
+ if !_c14 { return nil }
+ if !_c15 { return nil }
+ if !_c16 { return nil }
+ if !_c17 { return nil }
+ if !_c18 { return nil }
+ if !_c19 { return nil }
+ if !_c20 { return nil }
+ if !_c21 { return nil }
+ if !_c22 { return nil }
+ return Api.stats.BroadcastStats.broadcastStats(period: _1!, followers: _2!, viewsPerPost: _3!, sharesPerPost: _4!, reactionsPerPost: _5!, viewsPerStory: _6!, sharesPerStory: _7!, reactionsPerStory: _8!, enabledNotifications: _9!, growthGraph: _10!, followersGraph: _11!, muteGraph: _12!, topHoursGraph: _13!, interactionsGraph: _14!, ivInteractionsGraph: _15!, viewsBySourceGraph: _16!, newFollowersBySourceGraph: _17!, languagesGraph: _18!, reactionsByEmotionGraph: _19!, storyInteractionsGraph: _20!, storyReactionsByEmotionGraph: _21!, recentPostsInteractions: _22!)
}
}
@@ -762,12 +879,24 @@ public extension Api.stats {
let _c15 = _15 != nil
let _c16 = _16 != nil
let _c17 = _17 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 {
- return Api.stats.MegagroupStats.megagroupStats(period: _1!, members: _2!, messages: _3!, viewers: _4!, posters: _5!, growthGraph: _6!, membersGraph: _7!, newMembersBySourceGraph: _8!, languagesGraph: _9!, messagesGraph: _10!, actionsGraph: _11!, topHoursGraph: _12!, weekdaysGraph: _13!, topPosters: _14!, topAdmins: _15!, topInviters: _16!, users: _17!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ if !_c13 { return nil }
+ if !_c14 { return nil }
+ if !_c15 { return nil }
+ if !_c16 { return nil }
+ if !_c17 { return nil }
+ return Api.stats.MegagroupStats.megagroupStats(period: _1!, members: _2!, messages: _3!, viewers: _4!, posters: _5!, growthGraph: _6!, membersGraph: _7!, newMembersBySourceGraph: _8!, languagesGraph: _9!, messagesGraph: _10!, actionsGraph: _11!, topHoursGraph: _12!, weekdaysGraph: _13!, topPosters: _14!, topAdmins: _15!, topInviters: _16!, users: _17!)
}
}
@@ -806,12 +935,9 @@ public extension Api.stats {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.stats.MessageStats.messageStats(viewsGraph: _1!, reactionsByEmotionGraph: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.stats.MessageStats.messageStats(viewsGraph: _1!, reactionsByEmotionGraph: _2!)
}
}
@@ -880,12 +1006,13 @@ public extension Api.stats {
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.stats.PublicForwards.publicForwards(flags: _1!, count: _2!, forwards: _3!, nextOffset: _4, chats: _5!, users: _6!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.stats.PublicForwards.publicForwards(flags: _1!, count: _2!, forwards: _3!, nextOffset: _4, chats: _5!, users: _6!)
}
}
@@ -924,12 +1051,9 @@ public extension Api.stats {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.stats.StoryStats.storyStats(viewsGraph: _1!, reactionsByEmotionGraph: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.stats.StoryStats.storyStats(viewsGraph: _1!, reactionsByEmotionGraph: _2!)
}
}
@@ -960,12 +1084,8 @@ public extension Api.stickers {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.stickers.SuggestedShortName.suggestedShortName(shortName: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.stickers.SuggestedShortName.suggestedShortName(shortName: _1!)
}
}
@@ -1151,12 +1271,9 @@ public extension Api.stories {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.stories.Albums.albums(hash: _1!, albums: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.stories.Albums.albums(hash: _1!, albums: _2!)
}
public static func parse_albumsNotModified(_ reader: BufferReader) -> Albums? {
return Api.stories.Albums.albumsNotModified
@@ -1245,12 +1362,14 @@ public extension Api.stories {
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.stories.AllStories.allStories(flags: _1!, count: _2!, state: _3!, peerStories: _4!, chats: _5!, users: _6!, stealthMode: _7!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.stories.AllStories.allStories(flags: _1!, count: _2!, state: _3!, peerStories: _4!, chats: _5!, users: _6!, stealthMode: _7!)
}
public static func parse_allStoriesNotModified(_ reader: BufferReader) -> AllStories? {
var _1: Int32?
@@ -1264,12 +1383,10 @@ public extension Api.stories {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.stories.AllStories.allStoriesNotModified(flags: _1!, state: _2!, stealthMode: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.stories.AllStories.allStoriesNotModified(flags: _1!, state: _2!, stealthMode: _3!)
}
}
@@ -1300,12 +1417,8 @@ public extension Api.stories {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.stories.CanSendStoryCount.canSendStoryCount(countRemains: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.stories.CanSendStoryCount.canSendStoryCount(countRemains: _1!)
}
}
@@ -1374,150 +1487,13 @@ public extension Api.stories {
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.stories.FoundStories.foundStories(flags: _1!, count: _2!, stories: _3!, nextOffset: _4, chats: _5!, users: _6!)
- }
- else {
- return nil
- }
- }
-
- }
-}
-public extension Api.stories {
- enum PeerStories: TypeConstructorDescription {
- case peerStories(stories: Api.PeerStories, chats: [Api.Chat], users: [Api.User])
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .peerStories(let stories, let chats, let users):
- if boxed {
- buffer.appendInt32(-890861720)
- }
- stories.serialize(buffer, true)
- buffer.appendInt32(481674261)
- buffer.appendInt32(Int32(chats.count))
- for item in chats {
- item.serialize(buffer, true)
- }
- buffer.appendInt32(481674261)
- buffer.appendInt32(Int32(users.count))
- for item in users {
- item.serialize(buffer, true)
- }
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .peerStories(let stories, let chats, let users):
- return ("peerStories", [("stories", stories as Any), ("chats", chats as Any), ("users", users as Any)])
- }
- }
-
- public static func parse_peerStories(_ reader: BufferReader) -> PeerStories? {
- var _1: Api.PeerStories?
- if let signature = reader.readInt32() {
- _1 = Api.parse(reader, signature: signature) as? Api.PeerStories
- }
- var _2: [Api.Chat]?
- if let _ = reader.readInt32() {
- _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
- }
- var _3: [Api.User]?
- if let _ = reader.readInt32() {
- _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
- }
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.stories.PeerStories.peerStories(stories: _1!, chats: _2!, users: _3!)
- }
- else {
- return nil
- }
- }
-
- }
-}
-public extension Api.stories {
- enum Stories: TypeConstructorDescription {
- case stories(flags: Int32, count: Int32, stories: [Api.StoryItem], pinnedToTop: [Int32]?, chats: [Api.Chat], users: [Api.User])
-
- public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
- switch self {
- case .stories(let flags, let count, let stories, let pinnedToTop, let chats, let users):
- if boxed {
- buffer.appendInt32(1673780490)
- }
- serializeInt32(flags, buffer: buffer, boxed: false)
- serializeInt32(count, buffer: buffer, boxed: false)
- buffer.appendInt32(481674261)
- buffer.appendInt32(Int32(stories.count))
- for item in stories {
- item.serialize(buffer, true)
- }
- if Int(flags) & Int(1 << 0) != 0 {buffer.appendInt32(481674261)
- buffer.appendInt32(Int32(pinnedToTop!.count))
- for item in pinnedToTop! {
- serializeInt32(item, buffer: buffer, boxed: false)
- }}
- buffer.appendInt32(481674261)
- buffer.appendInt32(Int32(chats.count))
- for item in chats {
- item.serialize(buffer, true)
- }
- buffer.appendInt32(481674261)
- buffer.appendInt32(Int32(users.count))
- for item in users {
- item.serialize(buffer, true)
- }
- break
- }
- }
-
- public func descriptionFields() -> (String, [(String, Any)]) {
- switch self {
- case .stories(let flags, let count, let stories, let pinnedToTop, let chats, let users):
- return ("stories", [("flags", flags as Any), ("count", count as Any), ("stories", stories as Any), ("pinnedToTop", pinnedToTop as Any), ("chats", chats as Any), ("users", users as Any)])
- }
- }
-
- public static func parse_stories(_ reader: BufferReader) -> Stories? {
- var _1: Int32?
- _1 = reader.readInt32()
- var _2: Int32?
- _2 = reader.readInt32()
- var _3: [Api.StoryItem]?
- if let _ = reader.readInt32() {
- _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StoryItem.self)
- }
- var _4: [Int32]?
- if Int(_1!) & Int(1 << 0) != 0 {if let _ = reader.readInt32() {
- _4 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
- } }
- var _5: [Api.Chat]?
- if let _ = reader.readInt32() {
- _5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
- }
- var _6: [Api.User]?
- if let _ = reader.readInt32() {
- _6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
- }
- let _c1 = _1 != nil
- let _c2 = _2 != nil
- let _c3 = _3 != nil
- let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
- let _c5 = _5 != nil
- let _c6 = _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.stories.Stories.stories(flags: _1!, count: _2!, stories: _3!, pinnedToTop: _4, chats: _5!, users: _6!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.stories.FoundStories.foundStories(flags: _1!, count: _2!, stories: _3!, nextOffset: _4, chats: _5!, users: _6!)
}
}
diff --git a/submodules/TelegramApi/Sources/Api38.swift b/submodules/TelegramApi/Sources/Api38.swift
index 77f635e8..68d4e320 100644
--- a/submodules/TelegramApi/Sources/Api38.swift
+++ b/submodules/TelegramApi/Sources/Api38.swift
@@ -1,3 +1,140 @@
+public extension Api.stories {
+ enum PeerStories: TypeConstructorDescription {
+ case peerStories(stories: Api.PeerStories, chats: [Api.Chat], users: [Api.User])
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .peerStories(let stories, let chats, let users):
+ if boxed {
+ buffer.appendInt32(-890861720)
+ }
+ stories.serialize(buffer, true)
+ buffer.appendInt32(481674261)
+ buffer.appendInt32(Int32(chats.count))
+ for item in chats {
+ item.serialize(buffer, true)
+ }
+ buffer.appendInt32(481674261)
+ buffer.appendInt32(Int32(users.count))
+ for item in users {
+ item.serialize(buffer, true)
+ }
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .peerStories(let stories, let chats, let users):
+ return ("peerStories", [("stories", stories as Any), ("chats", chats as Any), ("users", users as Any)])
+ }
+ }
+
+ public static func parse_peerStories(_ reader: BufferReader) -> PeerStories? {
+ var _1: Api.PeerStories?
+ if let signature = reader.readInt32() {
+ _1 = Api.parse(reader, signature: signature) as? Api.PeerStories
+ }
+ var _2: [Api.Chat]?
+ if let _ = reader.readInt32() {
+ _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
+ }
+ var _3: [Api.User]?
+ if let _ = reader.readInt32() {
+ _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
+ }
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = _3 != nil
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.stories.PeerStories.peerStories(stories: _1!, chats: _2!, users: _3!)
+ }
+
+ }
+}
+public extension Api.stories {
+ enum Stories: TypeConstructorDescription {
+ case stories(flags: Int32, count: Int32, stories: [Api.StoryItem], pinnedToTop: [Int32]?, chats: [Api.Chat], users: [Api.User])
+
+ public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
+ switch self {
+ case .stories(let flags, let count, let stories, let pinnedToTop, let chats, let users):
+ if boxed {
+ buffer.appendInt32(1673780490)
+ }
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ serializeInt32(count, buffer: buffer, boxed: false)
+ buffer.appendInt32(481674261)
+ buffer.appendInt32(Int32(stories.count))
+ for item in stories {
+ item.serialize(buffer, true)
+ }
+ if Int(flags) & Int(1 << 0) != 0 {buffer.appendInt32(481674261)
+ buffer.appendInt32(Int32(pinnedToTop!.count))
+ for item in pinnedToTop! {
+ serializeInt32(item, buffer: buffer, boxed: false)
+ }}
+ buffer.appendInt32(481674261)
+ buffer.appendInt32(Int32(chats.count))
+ for item in chats {
+ item.serialize(buffer, true)
+ }
+ buffer.appendInt32(481674261)
+ buffer.appendInt32(Int32(users.count))
+ for item in users {
+ item.serialize(buffer, true)
+ }
+ break
+ }
+ }
+
+ public func descriptionFields() -> (String, [(String, Any)]) {
+ switch self {
+ case .stories(let flags, let count, let stories, let pinnedToTop, let chats, let users):
+ return ("stories", [("flags", flags as Any), ("count", count as Any), ("stories", stories as Any), ("pinnedToTop", pinnedToTop as Any), ("chats", chats as Any), ("users", users as Any)])
+ }
+ }
+
+ public static func parse_stories(_ reader: BufferReader) -> Stories? {
+ var _1: Int32?
+ _1 = reader.readInt32()
+ var _2: Int32?
+ _2 = reader.readInt32()
+ var _3: [Api.StoryItem]?
+ if let _ = reader.readInt32() {
+ _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StoryItem.self)
+ }
+ var _4: [Int32]?
+ if Int(_1!) & Int(1 << 0) != 0 {if let _ = reader.readInt32() {
+ _4 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
+ } }
+ var _5: [Api.Chat]?
+ if let _ = reader.readInt32() {
+ _5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
+ }
+ var _6: [Api.User]?
+ if let _ = reader.readInt32() {
+ _6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
+ }
+ let _c1 = _1 != nil
+ let _c2 = _2 != nil
+ let _c3 = _3 != nil
+ let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
+ let _c5 = _5 != nil
+ let _c6 = _6 != nil
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.stories.Stories.stories(flags: _1!, count: _2!, stories: _3!, pinnedToTop: _4, chats: _5!, users: _6!)
+ }
+
+ }
+}
public extension Api.stories {
enum StoryReactionsList: TypeConstructorDescription {
case storyReactionsList(flags: Int32, count: Int32, reactions: [Api.StoryReaction], chats: [Api.Chat], users: [Api.User], nextOffset: String?)
@@ -62,12 +199,13 @@ public extension Api.stories {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.stories.StoryReactionsList.storyReactionsList(flags: _1!, count: _2!, reactions: _3!, chats: _4!, users: _5!, nextOffset: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.stories.StoryReactionsList.storyReactionsList(flags: _1!, count: _2!, reactions: _3!, chats: _4!, users: _5!, nextOffset: _6)
}
}
@@ -114,12 +252,9 @@ public extension Api.stories {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.stories.StoryViews.storyViews(views: _1!, users: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.stories.StoryViews.storyViews(views: _1!, users: _2!)
}
}
@@ -200,12 +335,16 @@ public extension Api.stories {
let _c7 = _7 != nil
let _c8 = _8 != nil
let _c9 = (Int(_1!) & Int(1 << 0) == 0) || _9 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
- return Api.stories.StoryViewsList.storyViewsList(flags: _1!, count: _2!, viewsCount: _3!, forwardsCount: _4!, reactionsCount: _5!, views: _6!, chats: _7!, users: _8!, nextOffset: _9)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ return Api.stories.StoryViewsList.storyViewsList(flags: _1!, count: _2!, viewsCount: _3!, forwardsCount: _4!, reactionsCount: _5!, views: _6!, chats: _7!, users: _8!, nextOffset: _9)
}
}
@@ -321,12 +460,14 @@ public extension Api.updates {
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.updates.ChannelDifference.channelDifference(flags: _1!, pts: _2!, timeout: _3, newMessages: _4!, otherUpdates: _5!, chats: _6!, users: _7!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.updates.ChannelDifference.channelDifference(flags: _1!, pts: _2!, timeout: _3, newMessages: _4!, otherUpdates: _5!, chats: _6!, users: _7!)
}
public static func parse_channelDifferenceEmpty(_ reader: BufferReader) -> ChannelDifference? {
var _1: Int32?
@@ -338,12 +479,10 @@ public extension Api.updates {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.updates.ChannelDifference.channelDifferenceEmpty(flags: _1!, pts: _2!, timeout: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.updates.ChannelDifference.channelDifferenceEmpty(flags: _1!, pts: _2!, timeout: _3)
}
public static func parse_channelDifferenceTooLong(_ reader: BufferReader) -> ChannelDifference? {
var _1: Int32?
@@ -372,12 +511,13 @@ public extension Api.updates {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.updates.ChannelDifference.channelDifferenceTooLong(flags: _1!, timeout: _2, dialog: _3!, messages: _4!, chats: _5!, users: _6!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.updates.ChannelDifference.channelDifferenceTooLong(flags: _1!, timeout: _2, dialog: _3!, messages: _4!, chats: _5!, users: _6!)
}
}
@@ -513,12 +653,13 @@ public extension Api.updates {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.updates.Difference.difference(newMessages: _1!, newEncryptedMessages: _2!, otherUpdates: _3!, chats: _4!, users: _5!, state: _6!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.updates.Difference.difference(newMessages: _1!, newEncryptedMessages: _2!, otherUpdates: _3!, chats: _4!, users: _5!, state: _6!)
}
public static func parse_differenceEmpty(_ reader: BufferReader) -> Difference? {
var _1: Int32?
@@ -527,12 +668,9 @@ public extension Api.updates {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.updates.Difference.differenceEmpty(date: _1!, seq: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.updates.Difference.differenceEmpty(date: _1!, seq: _2!)
}
public static func parse_differenceSlice(_ reader: BufferReader) -> Difference? {
var _1: [Api.Message]?
@@ -565,23 +703,20 @@ public extension Api.updates {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.updates.Difference.differenceSlice(newMessages: _1!, newEncryptedMessages: _2!, otherUpdates: _3!, chats: _4!, users: _5!, intermediateState: _6!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.updates.Difference.differenceSlice(newMessages: _1!, newEncryptedMessages: _2!, otherUpdates: _3!, chats: _4!, users: _5!, intermediateState: _6!)
}
public static func parse_differenceTooLong(_ reader: BufferReader) -> Difference? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.updates.Difference.differenceTooLong(pts: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.updates.Difference.differenceTooLong(pts: _1!)
}
}
@@ -628,12 +763,12 @@ public extension Api.updates {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.updates.State.state(pts: _1!, qts: _2!, date: _3!, seq: _4!, unreadCount: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.updates.State.state(pts: _1!, qts: _2!, date: _3!, seq: _4!, unreadCount: _5!)
}
}
@@ -673,23 +808,15 @@ public extension Api.upload {
var _1: Buffer?
_1 = parseBytes(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.upload.CdnFile.cdnFile(bytes: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.upload.CdnFile.cdnFile(bytes: _1!)
}
public static func parse_cdnFileReuploadNeeded(_ reader: BufferReader) -> CdnFile? {
var _1: Buffer?
_1 = parseBytes(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.upload.CdnFile.cdnFileReuploadNeeded(requestToken: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.upload.CdnFile.cdnFileReuploadNeeded(requestToken: _1!)
}
}
@@ -747,12 +874,10 @@ public extension Api.upload {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.upload.File.file(type: _1!, mtime: _2!, bytes: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.upload.File.file(type: _1!, mtime: _2!, bytes: _3!)
}
public static func parse_fileCdnRedirect(_ reader: BufferReader) -> File? {
var _1: Int32?
@@ -772,12 +897,12 @@ public extension Api.upload {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.upload.File.fileCdnRedirect(dcId: _1!, fileToken: _2!, encryptionKey: _3!, encryptionIv: _4!, fileHashes: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.upload.File.fileCdnRedirect(dcId: _1!, fileToken: _2!, encryptionKey: _3!, encryptionIv: _4!, fileHashes: _5!)
}
}
@@ -826,12 +951,12 @@ public extension Api.upload {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.upload.WebFile.webFile(size: _1!, mimeType: _2!, fileType: _3!, mtime: _4!, bytes: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.upload.WebFile.webFile(size: _1!, mimeType: _2!, fileType: _3!, mtime: _4!, bytes: _5!)
}
}
@@ -881,23 +1006,16 @@ public extension Api.users {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.users.SavedMusic.savedMusic(count: _1!, documents: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.users.SavedMusic.savedMusic(count: _1!, documents: _2!)
}
public static func parse_savedMusicNotModified(_ reader: BufferReader) -> SavedMusic? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.users.SavedMusic.savedMusicNotModified(count: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.users.SavedMusic.savedMusicNotModified(count: _1!)
}
}
@@ -950,12 +1068,10 @@ public extension Api.users {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.users.UserFull.userFull(fullUser: _1!, chats: _2!, users: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.users.UserFull.userFull(fullUser: _1!, chats: _2!, users: _3!)
}
}
@@ -1006,12 +1122,8 @@ public extension Api.users {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.users.Users.users(users: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.users.Users.users(users: _1!)
}
public static func parse_usersSlice(_ reader: BufferReader) -> Users? {
var _1: Int32?
@@ -1022,12 +1134,9 @@ public extension Api.users {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.users.Users.usersSlice(count: _1!, users: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.users.Users.usersSlice(count: _1!, users: _2!)
}
}
diff --git a/submodules/TelegramApi/Sources/Api39.swift b/submodules/TelegramApi/Sources/Api39.swift
index d421b4d6..c9e087f8 100644
--- a/submodules/TelegramApi/Sources/Api39.swift
+++ b/submodules/TelegramApi/Sources/Api39.swift
@@ -6245,6 +6245,21 @@ public extension Api.functions.messages {
})
}
}
+public extension Api.functions.messages {
+ static func getEmojiGameInfo() -> (FunctionDescription, Buffer, DeserializeFunctionResponse) {
+ let buffer = Buffer()
+ buffer.appendInt32(-75592537)
+
+ return (FunctionDescription(name: "messages.getEmojiGameInfo", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.EmojiGameInfo? in
+ let reader = BufferReader(buffer)
+ var result: Api.messages.EmojiGameInfo?
+ if let signature = reader.readInt32() {
+ result = Api.parse(reader, signature: signature) as? Api.messages.EmojiGameInfo
+ }
+ return result
+ })
+ }
+}
public extension Api.functions.messages {
static func getEmojiGroups(hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) {
let buffer = Buffer()
@@ -8991,6 +9006,24 @@ public extension Api.functions.messages {
})
}
}
+public extension Api.functions.messages {
+ static func summarizeText(flags: Int32, peer: Api.InputPeer, id: Int32, toLang: String?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) {
+ let buffer = Buffer()
+ buffer.appendInt32(-1656683294)
+ serializeInt32(flags, buffer: buffer, boxed: false)
+ peer.serialize(buffer, true)
+ serializeInt32(id, buffer: buffer, boxed: false)
+ if Int(flags) & Int(1 << 0) != 0 {serializeString(toLang!, buffer: buffer, boxed: false)}
+ return (FunctionDescription(name: "messages.summarizeText", parameters: [("flags", String(describing: flags)), ("peer", String(describing: peer)), ("id", String(describing: id)), ("toLang", String(describing: toLang))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.TextWithEntities? in
+ let reader = BufferReader(buffer)
+ var result: Api.TextWithEntities?
+ if let signature = reader.readInt32() {
+ result = Api.parse(reader, signature: signature) as? Api.TextWithEntities
+ }
+ return result
+ })
+ }
+}
public extension Api.functions.messages {
static func toggleBotInAttachMenu(flags: Int32, bot: Api.InputUser, enabled: Api.Bool) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) {
let buffer = Buffer()
diff --git a/submodules/TelegramApi/Sources/Api4.swift b/submodules/TelegramApi/Sources/Api4.swift
index fad4416f..33c86e99 100644
--- a/submodules/TelegramApi/Sources/Api4.swift
+++ b/submodules/TelegramApi/Sources/Api4.swift
@@ -24,12 +24,8 @@ public extension Api {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.ChannelAdminLogEventsFilter.channelAdminLogEventsFilter(flags: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChannelAdminLogEventsFilter.channelAdminLogEventsFilter(flags: _1!)
}
}
@@ -75,12 +71,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChannelLocation.channelLocation(geoPoint: _1!, address: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChannelLocation.channelLocation(geoPoint: _1!, address: _2!)
}
public static func parse_channelLocationEmpty(_ reader: BufferReader) -> ChannelLocation? {
return Api.ChannelLocation.channelLocationEmpty
@@ -133,12 +126,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChannelMessagesFilter.channelMessagesFilter(flags: _1!, ranges: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChannelMessagesFilter.channelMessagesFilter(flags: _1!, ranges: _2!)
}
public static func parse_channelMessagesFilterEmpty(_ reader: BufferReader) -> ChannelMessagesFilter? {
return Api.ChannelMessagesFilter.channelMessagesFilterEmpty
@@ -246,12 +236,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.ChannelParticipant.channelParticipant(flags: _1!, userId: _2!, date: _3!, subscriptionUntilDate: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.ChannelParticipant.channelParticipant(flags: _1!, userId: _2!, date: _3!, subscriptionUntilDate: _4)
}
public static func parse_channelParticipantAdmin(_ reader: BufferReader) -> ChannelParticipant? {
var _1: Int32?
@@ -277,12 +266,14 @@ public extension Api {
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = (Int(_1!) & Int(1 << 2) == 0) || _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.ChannelParticipant.channelParticipantAdmin(flags: _1!, userId: _2!, inviterId: _3, promotedBy: _4!, date: _5!, adminRights: _6!, rank: _7)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.ChannelParticipant.channelParticipantAdmin(flags: _1!, userId: _2!, inviterId: _3, promotedBy: _4!, date: _5!, adminRights: _6!, rank: _7)
}
public static func parse_channelParticipantBanned(_ reader: BufferReader) -> ChannelParticipant? {
var _1: Int32?
@@ -304,12 +295,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.ChannelParticipant.channelParticipantBanned(flags: _1!, peer: _2!, kickedBy: _3!, date: _4!, bannedRights: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.ChannelParticipant.channelParticipantBanned(flags: _1!, peer: _2!, kickedBy: _3!, date: _4!, bannedRights: _5!)
}
public static func parse_channelParticipantCreator(_ reader: BufferReader) -> ChannelParticipant? {
var _1: Int32?
@@ -326,12 +317,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.ChannelParticipant.channelParticipantCreator(flags: _1!, userId: _2!, adminRights: _3!, rank: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.ChannelParticipant.channelParticipantCreator(flags: _1!, userId: _2!, adminRights: _3!, rank: _4)
}
public static func parse_channelParticipantLeft(_ reader: BufferReader) -> ChannelParticipant? {
var _1: Api.Peer?
@@ -339,12 +329,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.Peer
}
let _c1 = _1 != nil
- if _c1 {
- return Api.ChannelParticipant.channelParticipantLeft(peer: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChannelParticipant.channelParticipantLeft(peer: _1!)
}
public static func parse_channelParticipantSelf(_ reader: BufferReader) -> ChannelParticipant? {
var _1: Int32?
@@ -362,12 +348,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.ChannelParticipant.channelParticipantSelf(flags: _1!, userId: _2!, inviterId: _3!, date: _4!, subscriptionUntilDate: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.ChannelParticipant.channelParticipantSelf(flags: _1!, userId: _2!, inviterId: _3!, date: _4!, subscriptionUntilDate: _5)
}
}
@@ -466,12 +452,8 @@ public extension Api {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.ChannelParticipantsFilter.channelParticipantsBanned(q: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChannelParticipantsFilter.channelParticipantsBanned(q: _1!)
}
public static func parse_channelParticipantsBots(_ reader: BufferReader) -> ChannelParticipantsFilter? {
return Api.ChannelParticipantsFilter.channelParticipantsBots
@@ -480,23 +462,15 @@ public extension Api {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.ChannelParticipantsFilter.channelParticipantsContacts(q: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChannelParticipantsFilter.channelParticipantsContacts(q: _1!)
}
public static func parse_channelParticipantsKicked(_ reader: BufferReader) -> ChannelParticipantsFilter? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.ChannelParticipantsFilter.channelParticipantsKicked(q: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChannelParticipantsFilter.channelParticipantsKicked(q: _1!)
}
public static func parse_channelParticipantsMentions(_ reader: BufferReader) -> ChannelParticipantsFilter? {
var _1: Int32?
@@ -508,12 +482,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.ChannelParticipantsFilter.channelParticipantsMentions(flags: _1!, q: _2, topMsgId: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.ChannelParticipantsFilter.channelParticipantsMentions(flags: _1!, q: _2, topMsgId: _3)
}
public static func parse_channelParticipantsRecent(_ reader: BufferReader) -> ChannelParticipantsFilter? {
return Api.ChannelParticipantsFilter.channelParticipantsRecent
@@ -522,12 +494,8 @@ public extension Api {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.ChannelParticipantsFilter.channelParticipantsSearch(q: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChannelParticipantsFilter.channelParticipantsSearch(q: _1!)
}
}
@@ -724,12 +692,30 @@ public extension Api {
let _c21 = (Int(_2!) & Int(1 << 13) == 0) || _21 != nil
let _c22 = (Int(_2!) & Int(1 << 14) == 0) || _22 != nil
let _c23 = (Int(_2!) & Int(1 << 18) == 0) || _23 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 && _c19 && _c20 && _c21 && _c22 && _c23 {
- return Api.Chat.channel(flags: _1!, flags2: _2!, id: _3!, accessHash: _4, title: _5!, username: _6, photo: _7!, date: _8!, restrictionReason: _9, adminRights: _10, bannedRights: _11, defaultBannedRights: _12, participantsCount: _13, usernames: _14, storiesMaxId: _15, color: _16, profileColor: _17, emojiStatus: _18, level: _19, subscriptionUntilDate: _20, botVerificationIcon: _21, sendPaidMessagesStars: _22, linkedMonoforumId: _23)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ if !_c13 { return nil }
+ if !_c14 { return nil }
+ if !_c15 { return nil }
+ if !_c16 { return nil }
+ if !_c17 { return nil }
+ if !_c18 { return nil }
+ if !_c19 { return nil }
+ if !_c20 { return nil }
+ if !_c21 { return nil }
+ if !_c22 { return nil }
+ if !_c23 { return nil }
+ return Api.Chat.channel(flags: _1!, flags2: _2!, id: _3!, accessHash: _4, title: _5!, username: _6, photo: _7!, date: _8!, restrictionReason: _9, adminRights: _10, bannedRights: _11, defaultBannedRights: _12, participantsCount: _13, usernames: _14, storiesMaxId: _15, color: _16, profileColor: _17, emojiStatus: _18, level: _19, subscriptionUntilDate: _20, botVerificationIcon: _21, sendPaidMessagesStars: _22, linkedMonoforumId: _23)
}
public static func parse_channelForbidden(_ reader: BufferReader) -> Chat? {
var _1: Int32?
@@ -747,12 +733,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 16) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.Chat.channelForbidden(flags: _1!, id: _2!, accessHash: _3!, title: _4!, untilDate: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.Chat.channelForbidden(flags: _1!, id: _2!, accessHash: _3!, title: _4!, untilDate: _5)
}
public static func parse_chat(_ reader: BufferReader) -> Chat? {
var _1: Int32?
@@ -793,23 +779,24 @@ public extension Api {
let _c8 = (Int(_1!) & Int(1 << 6) == 0) || _8 != nil
let _c9 = (Int(_1!) & Int(1 << 14) == 0) || _9 != nil
let _c10 = (Int(_1!) & Int(1 << 18) == 0) || _10 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 {
- return Api.Chat.chat(flags: _1!, id: _2!, title: _3!, photo: _4!, participantsCount: _5!, date: _6!, version: _7!, migratedTo: _8, adminRights: _9, defaultBannedRights: _10)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ return Api.Chat.chat(flags: _1!, id: _2!, title: _3!, photo: _4!, participantsCount: _5!, date: _6!, version: _7!, migratedTo: _8, adminRights: _9, defaultBannedRights: _10)
}
public static func parse_chatEmpty(_ reader: BufferReader) -> Chat? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
- if _c1 {
- return Api.Chat.chatEmpty(id: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Chat.chatEmpty(id: _1!)
}
public static func parse_chatForbidden(_ reader: BufferReader) -> Chat? {
var _1: Int64?
@@ -818,12 +805,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Chat.chatForbidden(id: _1!, title: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Chat.chatForbidden(id: _1!, title: _2!)
}
}
@@ -854,12 +838,8 @@ public extension Api {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.ChatAdminRights.chatAdminRights(flags: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChatAdminRights.chatAdminRights(flags: _1!)
}
}
@@ -898,12 +878,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.ChatAdminWithInvites.chatAdminWithInvites(adminId: _1!, invitesCount: _2!, revokedInvitesCount: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.ChatAdminWithInvites.chatAdminWithInvites(adminId: _1!, invitesCount: _2!, revokedInvitesCount: _3!)
}
}
@@ -938,12 +916,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChatBannedRights.chatBannedRights(flags: _1!, untilDate: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChatBannedRights.chatBannedRights(flags: _1!, untilDate: _2!)
}
}
@@ -1238,12 +1213,54 @@ public extension Api {
let _c45 = (Int(_2!) & Int(1 << 18) == 0) || _45 != nil
let _c46 = (Int(_2!) & Int(1 << 21) == 0) || _46 != nil
let _c47 = (Int(_2!) & Int(1 << 22) == 0) || _47 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 && _c19 && _c20 && _c21 && _c22 && _c23 && _c24 && _c25 && _c26 && _c27 && _c28 && _c29 && _c30 && _c31 && _c32 && _c33 && _c34 && _c35 && _c36 && _c37 && _c38 && _c39 && _c40 && _c41 && _c42 && _c43 && _c44 && _c45 && _c46 && _c47 {
- return Api.ChatFull.channelFull(flags: _1!, flags2: _2!, id: _3!, about: _4!, participantsCount: _5, adminsCount: _6, kickedCount: _7, bannedCount: _8, onlineCount: _9, readInboxMaxId: _10!, readOutboxMaxId: _11!, unreadCount: _12!, chatPhoto: _13!, notifySettings: _14!, exportedInvite: _15, botInfo: _16!, migratedFromChatId: _17, migratedFromMaxId: _18, pinnedMsgId: _19, stickerset: _20, availableMinId: _21, folderId: _22, linkedChatId: _23, location: _24, slowmodeSeconds: _25, slowmodeNextSendDate: _26, statsDc: _27, pts: _28!, call: _29, ttlPeriod: _30, pendingSuggestions: _31, groupcallDefaultJoinAs: _32, themeEmoticon: _33, requestsPending: _34, recentRequesters: _35, defaultSendAs: _36, availableReactions: _37, reactionsLimit: _38, stories: _39, wallpaper: _40, boostsApplied: _41, boostsUnrestrict: _42, emojiset: _43, botVerification: _44, stargiftsCount: _45, sendPaidMessagesStars: _46, mainTab: _47)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ if !_c13 { return nil }
+ if !_c14 { return nil }
+ if !_c15 { return nil }
+ if !_c16 { return nil }
+ if !_c17 { return nil }
+ if !_c18 { return nil }
+ if !_c19 { return nil }
+ if !_c20 { return nil }
+ if !_c21 { return nil }
+ if !_c22 { return nil }
+ if !_c23 { return nil }
+ if !_c24 { return nil }
+ if !_c25 { return nil }
+ if !_c26 { return nil }
+ if !_c27 { return nil }
+ if !_c28 { return nil }
+ if !_c29 { return nil }
+ if !_c30 { return nil }
+ if !_c31 { return nil }
+ if !_c32 { return nil }
+ if !_c33 { return nil }
+ if !_c34 { return nil }
+ if !_c35 { return nil }
+ if !_c36 { return nil }
+ if !_c37 { return nil }
+ if !_c38 { return nil }
+ if !_c39 { return nil }
+ if !_c40 { return nil }
+ if !_c41 { return nil }
+ if !_c42 { return nil }
+ if !_c43 { return nil }
+ if !_c44 { return nil }
+ if !_c45 { return nil }
+ if !_c46 { return nil }
+ if !_c47 { return nil }
+ return Api.ChatFull.channelFull(flags: _1!, flags2: _2!, id: _3!, about: _4!, participantsCount: _5, adminsCount: _6, kickedCount: _7, bannedCount: _8, onlineCount: _9, readInboxMaxId: _10!, readOutboxMaxId: _11!, unreadCount: _12!, chatPhoto: _13!, notifySettings: _14!, exportedInvite: _15, botInfo: _16!, migratedFromChatId: _17, migratedFromMaxId: _18, pinnedMsgId: _19, stickerset: _20, availableMinId: _21, folderId: _22, linkedChatId: _23, location: _24, slowmodeSeconds: _25, slowmodeNextSendDate: _26, statsDc: _27, pts: _28!, call: _29, ttlPeriod: _30, pendingSuggestions: _31, groupcallDefaultJoinAs: _32, themeEmoticon: _33, requestsPending: _34, recentRequesters: _35, defaultSendAs: _36, availableReactions: _37, reactionsLimit: _38, stories: _39, wallpaper: _40, boostsApplied: _41, boostsUnrestrict: _42, emojiset: _43, botVerification: _44, stargiftsCount: _45, sendPaidMessagesStars: _46, mainTab: _47)
}
public static func parse_chatFull(_ reader: BufferReader) -> ChatFull? {
var _1: Int32?
@@ -1318,12 +1335,25 @@ public extension Api {
let _c16 = (Int(_1!) & Int(1 << 17) == 0) || _16 != nil
let _c17 = (Int(_1!) & Int(1 << 18) == 0) || _17 != nil
let _c18 = (Int(_1!) & Int(1 << 20) == 0) || _18 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 {
- return Api.ChatFull.chatFull(flags: _1!, id: _2!, about: _3!, participants: _4!, chatPhoto: _5, notifySettings: _6!, exportedInvite: _7, botInfo: _8, pinnedMsgId: _9, folderId: _10, call: _11, ttlPeriod: _12, groupcallDefaultJoinAs: _13, themeEmoticon: _14, requestsPending: _15, recentRequesters: _16, availableReactions: _17, reactionsLimit: _18)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ if !_c13 { return nil }
+ if !_c14 { return nil }
+ if !_c15 { return nil }
+ if !_c16 { return nil }
+ if !_c17 { return nil }
+ if !_c18 { return nil }
+ return Api.ChatFull.chatFull(flags: _1!, id: _2!, about: _3!, participants: _4!, chatPhoto: _5, notifySettings: _6!, exportedInvite: _7, botInfo: _8, pinnedMsgId: _9, folderId: _10, call: _11, ttlPeriod: _12, groupcallDefaultJoinAs: _13, themeEmoticon: _14, requestsPending: _15, recentRequesters: _16, availableReactions: _17, reactionsLimit: _18)
}
}
@@ -1421,12 +1451,17 @@ public extension Api {
let _c8 = (Int(_1!) & Int(1 << 10) == 0) || _8 != nil
let _c9 = (Int(_1!) & Int(1 << 12) == 0) || _9 != nil
let _c10 = (Int(_1!) & Int(1 << 13) == 0) || _10 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 {
- return Api.ChatInvite.chatInvite(flags: _1!, title: _2!, about: _3, photo: _4!, participantsCount: _5!, participants: _6, color: _7!, subscriptionPricing: _8, subscriptionFormId: _9, botVerification: _10)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ return Api.ChatInvite.chatInvite(flags: _1!, title: _2!, about: _3, photo: _4!, participantsCount: _5!, participants: _6, color: _7!, subscriptionPricing: _8, subscriptionFormId: _9, botVerification: _10)
}
public static func parse_chatInviteAlready(_ reader: BufferReader) -> ChatInvite? {
var _1: Api.Chat?
@@ -1434,12 +1469,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.Chat
}
let _c1 = _1 != nil
- if _c1 {
- return Api.ChatInvite.chatInviteAlready(chat: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChatInvite.chatInviteAlready(chat: _1!)
}
public static func parse_chatInvitePeek(_ reader: BufferReader) -> ChatInvite? {
var _1: Api.Chat?
@@ -1450,12 +1481,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChatInvite.chatInvitePeek(chat: _1!, expires: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChatInvite.chatInvitePeek(chat: _1!, expires: _2!)
}
}
diff --git a/submodules/TelegramApi/Sources/Api5.swift b/submodules/TelegramApi/Sources/Api5.swift
index 2ce916e3..87fba995 100644
--- a/submodules/TelegramApi/Sources/Api5.swift
+++ b/submodules/TelegramApi/Sources/Api5.swift
@@ -40,12 +40,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.ChatInviteImporter.chatInviteImporter(flags: _1!, userId: _2!, date: _3!, about: _4, approvedBy: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.ChatInviteImporter.chatInviteImporter(flags: _1!, userId: _2!, date: _3!, about: _4, approvedBy: _5)
}
}
@@ -76,12 +76,8 @@ public extension Api {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.ChatOnlines.chatOnlines(onlines: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChatOnlines.chatOnlines(onlines: _1!)
}
}
@@ -140,12 +136,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.ChatParticipant.chatParticipant(userId: _1!, inviterId: _2!, date: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.ChatParticipant.chatParticipant(userId: _1!, inviterId: _2!, date: _3!)
}
public static func parse_chatParticipantAdmin(_ reader: BufferReader) -> ChatParticipant? {
var _1: Int64?
@@ -157,23 +151,17 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.ChatParticipant.chatParticipantAdmin(userId: _1!, inviterId: _2!, date: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.ChatParticipant.chatParticipantAdmin(userId: _1!, inviterId: _2!, date: _3!)
}
public static func parse_chatParticipantCreator(_ reader: BufferReader) -> ChatParticipant? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
- if _c1 {
- return Api.ChatParticipant.chatParticipantCreator(userId: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChatParticipant.chatParticipantCreator(userId: _1!)
}
}
@@ -229,12 +217,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.ChatParticipants.chatParticipants(chatId: _1!, participants: _2!, version: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.ChatParticipants.chatParticipants(chatId: _1!, participants: _2!, version: _3!)
}
public static func parse_chatParticipantsForbidden(_ reader: BufferReader) -> ChatParticipants? {
var _1: Int32?
@@ -248,12 +234,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.ChatParticipants.chatParticipantsForbidden(flags: _1!, chatId: _2!, selfParticipant: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.ChatParticipants.chatParticipantsForbidden(flags: _1!, chatId: _2!, selfParticipant: _3)
}
}
@@ -305,12 +289,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.ChatPhoto.chatPhoto(flags: _1!, photoId: _2!, strippedThumb: _3, dcId: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.ChatPhoto.chatPhoto(flags: _1!, photoId: _2!, strippedThumb: _3, dcId: _4!)
}
public static func parse_chatPhotoEmpty(_ reader: BufferReader) -> ChatPhoto? {
return Api.ChatPhoto.chatPhotoEmpty
@@ -366,12 +349,8 @@ public extension Api {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.ChatReactions.chatReactionsAll(flags: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChatReactions.chatReactionsAll(flags: _1!)
}
public static func parse_chatReactionsNone(_ reader: BufferReader) -> ChatReactions? {
return Api.ChatReactions.chatReactionsNone
@@ -382,12 +361,8 @@ public extension Api {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Reaction.self)
}
let _c1 = _1 != nil
- if _c1 {
- return Api.ChatReactions.chatReactionsSome(reactions: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChatReactions.chatReactionsSome(reactions: _1!)
}
}
@@ -432,12 +407,8 @@ public extension Api {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.ChatTheme.chatTheme(emoticon: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ChatTheme.chatTheme(emoticon: _1!)
}
public static func parse_chatThemeUniqueGift(_ reader: BufferReader) -> ChatTheme? {
var _1: Api.StarGift?
@@ -450,12 +421,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ChatTheme.chatThemeUniqueGift(gift: _1!, themeSettings: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ChatTheme.chatThemeUniqueGift(gift: _1!, themeSettings: _2!)
}
}
@@ -506,12 +474,11 @@ public extension Api {
let _c2 = (Int(_1!) & Int(1 << 6) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 8) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 8) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.CodeSettings.codeSettings(flags: _1!, logoutTokens: _2, token: _3, appSandbox: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.CodeSettings.codeSettings(flags: _1!, logoutTokens: _2, token: _3, appSandbox: _4)
}
}
@@ -720,12 +687,50 @@ public extension Api {
let _c41 = (Int(_1!) & Int(1 << 2) == 0) || _41 != nil
let _c42 = (Int(_1!) & Int(1 << 15) == 0) || _42 != nil
let _c43 = (Int(_1!) & Int(1 << 16) == 0) || _43 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 && _c19 && _c20 && _c21 && _c22 && _c23 && _c24 && _c25 && _c26 && _c27 && _c28 && _c29 && _c30 && _c31 && _c32 && _c33 && _c34 && _c35 && _c36 && _c37 && _c38 && _c39 && _c40 && _c41 && _c42 && _c43 {
- return Api.Config.config(flags: _1!, date: _2!, expires: _3!, testMode: _4!, thisDc: _5!, dcOptions: _6!, dcTxtDomainName: _7!, chatSizeMax: _8!, megagroupSizeMax: _9!, forwardedCountMax: _10!, onlineUpdatePeriodMs: _11!, offlineBlurTimeoutMs: _12!, offlineIdleTimeoutMs: _13!, onlineCloudTimeoutMs: _14!, notifyCloudDelayMs: _15!, notifyDefaultDelayMs: _16!, pushChatPeriodMs: _17!, pushChatLimit: _18!, editTimeLimit: _19!, revokeTimeLimit: _20!, revokePmTimeLimit: _21!, ratingEDecay: _22!, stickersRecentLimit: _23!, channelsReadMediaPeriod: _24!, tmpSessions: _25, callReceiveTimeoutMs: _26!, callRingTimeoutMs: _27!, callConnectTimeoutMs: _28!, callPacketTimeoutMs: _29!, meUrlPrefix: _30!, autoupdateUrlPrefix: _31, gifSearchUsername: _32, venueSearchUsername: _33, imgSearchUsername: _34, staticMapsProvider: _35, captionLengthMax: _36!, messageLengthMax: _37!, webfileDcId: _38!, suggestedLangCode: _39, langPackVersion: _40, baseLangPackVersion: _41, reactionsDefault: _42, autologinToken: _43)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ if !_c13 { return nil }
+ if !_c14 { return nil }
+ if !_c15 { return nil }
+ if !_c16 { return nil }
+ if !_c17 { return nil }
+ if !_c18 { return nil }
+ if !_c19 { return nil }
+ if !_c20 { return nil }
+ if !_c21 { return nil }
+ if !_c22 { return nil }
+ if !_c23 { return nil }
+ if !_c24 { return nil }
+ if !_c25 { return nil }
+ if !_c26 { return nil }
+ if !_c27 { return nil }
+ if !_c28 { return nil }
+ if !_c29 { return nil }
+ if !_c30 { return nil }
+ if !_c31 { return nil }
+ if !_c32 { return nil }
+ if !_c33 { return nil }
+ if !_c34 { return nil }
+ if !_c35 { return nil }
+ if !_c36 { return nil }
+ if !_c37 { return nil }
+ if !_c38 { return nil }
+ if !_c39 { return nil }
+ if !_c40 { return nil }
+ if !_c41 { return nil }
+ if !_c42 { return nil }
+ if !_c43 { return nil }
+ return Api.Config.config(flags: _1!, date: _2!, expires: _3!, testMode: _4!, thisDc: _5!, dcOptions: _6!, dcTxtDomainName: _7!, chatSizeMax: _8!, megagroupSizeMax: _9!, forwardedCountMax: _10!, onlineUpdatePeriodMs: _11!, offlineBlurTimeoutMs: _12!, offlineIdleTimeoutMs: _13!, onlineCloudTimeoutMs: _14!, notifyCloudDelayMs: _15!, notifyDefaultDelayMs: _16!, pushChatPeriodMs: _17!, pushChatLimit: _18!, editTimeLimit: _19!, revokeTimeLimit: _20!, revokePmTimeLimit: _21!, ratingEDecay: _22!, stickersRecentLimit: _23!, channelsReadMediaPeriod: _24!, tmpSessions: _25, callReceiveTimeoutMs: _26!, callRingTimeoutMs: _27!, callConnectTimeoutMs: _28!, callPacketTimeoutMs: _29!, meUrlPrefix: _30!, autoupdateUrlPrefix: _31, gifSearchUsername: _32, venueSearchUsername: _33, imgSearchUsername: _34, staticMapsProvider: _35, captionLengthMax: _36!, messageLengthMax: _37!, webfileDcId: _38!, suggestedLangCode: _39, langPackVersion: _40, baseLangPackVersion: _41, reactionsDefault: _42, autologinToken: _43)
}
}
@@ -772,12 +777,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.ConnectedBot.connectedBot(flags: _1!, botId: _2!, recipients: _3!, rights: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.ConnectedBot.connectedBot(flags: _1!, botId: _2!, recipients: _3!, rights: _4!)
}
}
@@ -836,12 +840,15 @@ public extension Api {
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
let _c7 = _7 != nil
let _c8 = _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.ConnectedBotStarRef.connectedBotStarRef(flags: _1!, url: _2!, date: _3!, botId: _4!, commissionPermille: _5!, durationMonths: _6, participants: _7!, revenue: _8!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.ConnectedBotStarRef.connectedBotStarRef(flags: _1!, url: _2!, date: _3!, botId: _4!, commissionPermille: _5!, durationMonths: _6, participants: _7!, revenue: _8!)
}
}
@@ -878,12 +885,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.Contact.contact(userId: _1!, mutual: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.Contact.contact(userId: _1!, mutual: _2!)
}
}
@@ -920,12 +924,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ContactBirthday.contactBirthday(contactId: _1!, birthday: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ContactBirthday.contactBirthday(contactId: _1!, birthday: _2!)
}
}
@@ -962,12 +963,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ContactStatus.contactStatus(userId: _1!, status: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ContactStatus.contactStatus(userId: _1!, status: _2!)
}
}
@@ -998,12 +996,8 @@ public extension Api {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.DataJSON.dataJSON(data: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.DataJSON.dataJSON(data: _1!)
}
}
@@ -1050,12 +1044,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 10) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.DcOption.dcOption(flags: _1!, id: _2!, ipAddress: _3!, port: _4!, secret: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.DcOption.dcOption(flags: _1!, id: _2!, ipAddress: _3!, port: _4!, secret: _5)
}
}
@@ -1086,12 +1080,8 @@ public extension Api {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.DefaultHistoryTTL.defaultHistoryTTL(period: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.DefaultHistoryTTL.defaultHistoryTTL(period: _1!)
}
}
@@ -1192,12 +1182,20 @@ public extension Api {
let _c11 = (Int(_1!) & Int(1 << 1) == 0) || _11 != nil
let _c12 = (Int(_1!) & Int(1 << 4) == 0) || _12 != nil
let _c13 = (Int(_1!) & Int(1 << 5) == 0) || _13 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 {
- return Api.Dialog.dialog(flags: _1!, peer: _2!, topMessage: _3!, readInboxMaxId: _4!, readOutboxMaxId: _5!, unreadCount: _6!, unreadMentionsCount: _7!, unreadReactionsCount: _8!, notifySettings: _9!, pts: _10, draft: _11, folderId: _12, ttlPeriod: _13)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ if !_c13 { return nil }
+ return Api.Dialog.dialog(flags: _1!, peer: _2!, topMessage: _3!, readInboxMaxId: _4!, readOutboxMaxId: _5!, unreadCount: _6!, unreadMentionsCount: _7!, unreadReactionsCount: _8!, notifySettings: _9!, pts: _10, draft: _11, folderId: _12, ttlPeriod: _13)
}
public static func parse_dialogFolder(_ reader: BufferReader) -> Dialog? {
var _1: Int32?
@@ -1228,12 +1226,15 @@ public extension Api {
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.Dialog.dialogFolder(flags: _1!, folder: _2!, peer: _3!, topMessage: _4!, unreadMutedPeersCount: _5!, unreadUnmutedPeersCount: _6!, unreadMutedMessagesCount: _7!, unreadUnmutedMessagesCount: _8!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.Dialog.dialogFolder(flags: _1!, folder: _2!, peer: _3!, topMessage: _4!, unreadMutedPeersCount: _5!, unreadUnmutedPeersCount: _6!, unreadMutedMessagesCount: _7!, unreadUnmutedMessagesCount: _8!)
}
}
@@ -1344,12 +1345,15 @@ public extension Api {
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.DialogFilter.dialogFilter(flags: _1!, id: _2!, title: _3!, emoticon: _4, color: _5, pinnedPeers: _6!, includePeers: _7!, excludePeers: _8!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.DialogFilter.dialogFilter(flags: _1!, id: _2!, title: _3!, emoticon: _4, color: _5, pinnedPeers: _6!, includePeers: _7!, excludePeers: _8!)
}
public static func parse_dialogFilterChatlist(_ reader: BufferReader) -> DialogFilter? {
var _1: Int32?
@@ -1379,12 +1383,14 @@ public extension Api {
let _c5 = (Int(_1!) & Int(1 << 27) == 0) || _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.DialogFilter.dialogFilterChatlist(flags: _1!, id: _2!, title: _3!, emoticon: _4, color: _5, pinnedPeers: _6!, includePeers: _7!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.DialogFilter.dialogFilterChatlist(flags: _1!, id: _2!, title: _3!, emoticon: _4, color: _5, pinnedPeers: _6!, includePeers: _7!)
}
public static func parse_dialogFilterDefault(_ reader: BufferReader) -> DialogFilter? {
return Api.DialogFilter.dialogFilterDefault
@@ -1424,12 +1430,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.DialogFilterSuggested.dialogFilterSuggested(filter: _1!, description: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.DialogFilterSuggested.dialogFilterSuggested(filter: _1!, description: _2!)
}
}
@@ -1471,23 +1474,15 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.Peer
}
let _c1 = _1 != nil
- if _c1 {
- return Api.DialogPeer.dialogPeer(peer: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.DialogPeer.dialogPeer(peer: _1!)
}
public static func parse_dialogPeerFolder(_ reader: BufferReader) -> DialogPeer? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.DialogPeer.dialogPeerFolder(folderId: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.DialogPeer.dialogPeerFolder(folderId: _1!)
}
}
diff --git a/submodules/TelegramApi/Sources/Api6.swift b/submodules/TelegramApi/Sources/Api6.swift
index ca7545a0..5cb12927 100644
--- a/submodules/TelegramApi/Sources/Api6.swift
+++ b/submodules/TelegramApi/Sources/Api6.swift
@@ -24,12 +24,8 @@ public extension Api {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.DisallowedGiftsSettings.disallowedGiftsSettings(flags: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.DisallowedGiftsSettings.disallowedGiftsSettings(flags: _1!)
}
}
@@ -127,23 +123,25 @@ public extension Api {
let _c9 = (Int(_1!) & Int(1 << 1) == 0) || _9 != nil
let _c10 = _10 != nil
let _c11 = _11 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 {
- return Api.Document.document(flags: _1!, id: _2!, accessHash: _3!, fileReference: _4!, date: _5!, mimeType: _6!, size: _7!, thumbs: _8, videoThumbs: _9, dcId: _10!, attributes: _11!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ return Api.Document.document(flags: _1!, id: _2!, accessHash: _3!, fileReference: _4!, date: _5!, mimeType: _6!, size: _7!, thumbs: _8, videoThumbs: _9, dcId: _10!, attributes: _11!)
}
public static func parse_documentEmpty(_ reader: BufferReader) -> Document? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
- if _c1 {
- return Api.Document.documentEmpty(id: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.Document.documentEmpty(id: _1!)
}
}
@@ -268,12 +266,12 @@ public extension Api {
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.DocumentAttribute.documentAttributeAudio(flags: _1!, duration: _2!, title: _3, performer: _4, waveform: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.DocumentAttribute.documentAttributeAudio(flags: _1!, duration: _2!, title: _3, performer: _4, waveform: _5)
}
public static func parse_documentAttributeCustomEmoji(_ reader: BufferReader) -> DocumentAttribute? {
var _1: Int32?
@@ -287,23 +285,17 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.DocumentAttribute.documentAttributeCustomEmoji(flags: _1!, alt: _2!, stickerset: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.DocumentAttribute.documentAttributeCustomEmoji(flags: _1!, alt: _2!, stickerset: _3!)
}
public static func parse_documentAttributeFilename(_ reader: BufferReader) -> DocumentAttribute? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.DocumentAttribute.documentAttributeFilename(fileName: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.DocumentAttribute.documentAttributeFilename(fileName: _1!)
}
public static func parse_documentAttributeHasStickers(_ reader: BufferReader) -> DocumentAttribute? {
return Api.DocumentAttribute.documentAttributeHasStickers
@@ -315,12 +307,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.DocumentAttribute.documentAttributeImageSize(w: _1!, h: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.DocumentAttribute.documentAttributeImageSize(w: _1!, h: _2!)
}
public static func parse_documentAttributeSticker(_ reader: BufferReader) -> DocumentAttribute? {
var _1: Int32?
@@ -339,12 +328,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.DocumentAttribute.documentAttributeSticker(flags: _1!, alt: _2!, stickerset: _3!, maskCoords: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.DocumentAttribute.documentAttributeSticker(flags: _1!, alt: _2!, stickerset: _3!, maskCoords: _4)
}
public static func parse_documentAttributeVideo(_ reader: BufferReader) -> DocumentAttribute? {
var _1: Int32?
@@ -368,12 +356,14 @@ public extension Api {
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 4) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 5) == 0) || _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.DocumentAttribute.documentAttributeVideo(flags: _1!, duration: _2!, w: _3!, h: _4!, preloadPrefixSize: _5, videoStartTs: _6, videoCodec: _7)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.DocumentAttribute.documentAttributeVideo(flags: _1!, duration: _2!, w: _3!, h: _4!, preloadPrefixSize: _5, videoStartTs: _6, videoCodec: _7)
}
}
@@ -454,12 +444,15 @@ public extension Api {
let _c6 = _6 != nil
let _c7 = (Int(_1!) & Int(1 << 7) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 8) == 0) || _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.DraftMessage.draftMessage(flags: _1!, replyTo: _2, message: _3!, entities: _4, media: _5, date: _6!, effect: _7, suggestedPost: _8)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.DraftMessage.draftMessage(flags: _1!, replyTo: _2, message: _3!, entities: _4, media: _5, date: _6!, effect: _7, suggestedPost: _8)
}
public static func parse_draftMessageEmpty(_ reader: BufferReader) -> DraftMessage? {
var _1: Int32?
@@ -468,12 +461,9 @@ public extension Api {
if Int(_1!) & Int(1 << 0) != 0 {_2 = reader.readInt32() }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
- if _c1 && _c2 {
- return Api.DraftMessage.draftMessageEmpty(flags: _1!, date: _2)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.DraftMessage.draftMessageEmpty(flags: _1!, date: _2)
}
}
@@ -522,34 +512,22 @@ public extension Api {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.EmailVerification.emailVerificationApple(token: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.EmailVerification.emailVerificationApple(token: _1!)
}
public static func parse_emailVerificationCode(_ reader: BufferReader) -> EmailVerification? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.EmailVerification.emailVerificationCode(code: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.EmailVerification.emailVerificationCode(code: _1!)
}
public static func parse_emailVerificationGoogle(_ reader: BufferReader) -> EmailVerification? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.EmailVerification.emailVerificationGoogle(token: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.EmailVerification.emailVerificationGoogle(token: _1!)
}
}
@@ -605,12 +583,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.EmailVerifyPurpose.emailVerifyPurposeLoginSetup(phoneNumber: _1!, phoneCodeHash: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.EmailVerifyPurpose.emailVerifyPurposeLoginSetup(phoneNumber: _1!, phoneCodeHash: _2!)
}
public static func parse_emailVerifyPurposePassport(_ reader: BufferReader) -> EmailVerifyPurpose? {
return Api.EmailVerifyPurpose.emailVerifyPurposePassport
@@ -683,12 +658,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.EmojiGroup.emojiGroup(title: _1!, iconEmojiId: _2!, emoticons: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.EmojiGroup.emojiGroup(title: _1!, iconEmojiId: _2!, emoticons: _3!)
}
public static func parse_emojiGroupGreeting(_ reader: BufferReader) -> EmojiGroup? {
var _1: String?
@@ -702,12 +675,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.EmojiGroup.emojiGroupGreeting(title: _1!, iconEmojiId: _2!, emoticons: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.EmojiGroup.emojiGroupGreeting(title: _1!, iconEmojiId: _2!, emoticons: _3!)
}
public static func parse_emojiGroupPremium(_ reader: BufferReader) -> EmojiGroup? {
var _1: String?
@@ -716,12 +687,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.EmojiGroup.emojiGroupPremium(title: _1!, iconEmojiId: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.EmojiGroup.emojiGroupPremium(title: _1!, iconEmojiId: _2!)
}
}
@@ -776,12 +744,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.EmojiKeyword.emojiKeyword(keyword: _1!, emoticons: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.EmojiKeyword.emojiKeyword(keyword: _1!, emoticons: _2!)
}
public static func parse_emojiKeywordDeleted(_ reader: BufferReader) -> EmojiKeyword? {
var _1: String?
@@ -792,12 +757,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.EmojiKeyword.emojiKeywordDeleted(keyword: _1!, emoticons: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.EmojiKeyword.emojiKeywordDeleted(keyword: _1!, emoticons: _2!)
}
}
@@ -846,12 +808,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.EmojiKeywordsDifference.emojiKeywordsDifference(langCode: _1!, fromVersion: _2!, version: _3!, keywords: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.EmojiKeywordsDifference.emojiKeywordsDifference(langCode: _1!, fromVersion: _2!, version: _3!, keywords: _4!)
}
}
@@ -882,12 +843,8 @@ public extension Api {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.EmojiLanguage.emojiLanguage(langCode: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.EmojiLanguage.emojiLanguage(langCode: _1!)
}
}
@@ -937,12 +894,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.EmojiList.emojiList(hash: _1!, documentId: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.EmojiList.emojiList(hash: _1!, documentId: _2!)
}
public static func parse_emojiListNotModified(_ reader: BufferReader) -> EmojiList? {
return Api.EmojiList.emojiListNotModified
@@ -1023,12 +977,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.EmojiStatus.emojiStatus(flags: _1!, documentId: _2!, until: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.EmojiStatus.emojiStatus(flags: _1!, documentId: _2!, until: _3)
}
public static func parse_emojiStatusCollectible(_ reader: BufferReader) -> EmojiStatus? {
var _1: Int32?
@@ -1064,12 +1016,18 @@ public extension Api {
let _c9 = _9 != nil
let _c10 = _10 != nil
let _c11 = (Int(_1!) & Int(1 << 0) == 0) || _11 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 {
- return Api.EmojiStatus.emojiStatusCollectible(flags: _1!, collectibleId: _2!, documentId: _3!, title: _4!, slug: _5!, patternDocumentId: _6!, centerColor: _7!, edgeColor: _8!, patternColor: _9!, textColor: _10!, until: _11)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ return Api.EmojiStatus.emojiStatusCollectible(flags: _1!, collectibleId: _2!, documentId: _3!, title: _4!, slug: _5!, patternDocumentId: _6!, centerColor: _7!, edgeColor: _8!, patternColor: _9!, textColor: _10!, until: _11)
}
public static func parse_emojiStatusEmpty(_ reader: BufferReader) -> EmojiStatus? {
return Api.EmojiStatus.emojiStatusEmpty
@@ -1084,12 +1042,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.EmojiStatus.inputEmojiStatusCollectible(flags: _1!, collectibleId: _2!, until: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.EmojiStatus.inputEmojiStatusCollectible(flags: _1!, collectibleId: _2!, until: _3)
}
}
diff --git a/submodules/TelegramApi/Sources/Api7.swift b/submodules/TelegramApi/Sources/Api7.swift
index 1ad2e7de..2a85bd69 100644
--- a/submodules/TelegramApi/Sources/Api7.swift
+++ b/submodules/TelegramApi/Sources/Api7.swift
@@ -24,12 +24,8 @@ public extension Api {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.EmojiURL.emojiURL(url: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.EmojiURL.emojiURL(url: _1!)
}
}
@@ -132,12 +128,14 @@ public extension Api {
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.EncryptedChat.encryptedChat(id: _1!, accessHash: _2!, date: _3!, adminId: _4!, participantId: _5!, gAOrB: _6!, keyFingerprint: _7!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.EncryptedChat.encryptedChat(id: _1!, accessHash: _2!, date: _3!, adminId: _4!, participantId: _5!, gAOrB: _6!, keyFingerprint: _7!)
}
public static func parse_encryptedChatDiscarded(_ reader: BufferReader) -> EncryptedChat? {
var _1: Int32?
@@ -146,23 +144,16 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.EncryptedChat.encryptedChatDiscarded(flags: _1!, id: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.EncryptedChat.encryptedChatDiscarded(flags: _1!, id: _2!)
}
public static func parse_encryptedChatEmpty(_ reader: BufferReader) -> EncryptedChat? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.EncryptedChat.encryptedChatEmpty(id: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.EncryptedChat.encryptedChatEmpty(id: _1!)
}
public static func parse_encryptedChatRequested(_ reader: BufferReader) -> EncryptedChat? {
var _1: Int32?
@@ -189,12 +180,15 @@ public extension Api {
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.EncryptedChat.encryptedChatRequested(flags: _1!, folderId: _2, id: _3!, accessHash: _4!, date: _5!, adminId: _6!, participantId: _7!, gA: _8!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.EncryptedChat.encryptedChatRequested(flags: _1!, folderId: _2, id: _3!, accessHash: _4!, date: _5!, adminId: _6!, participantId: _7!, gA: _8!)
}
public static func parse_encryptedChatWaiting(_ reader: BufferReader) -> EncryptedChat? {
var _1: Int32?
@@ -212,12 +206,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.EncryptedChat.encryptedChatWaiting(id: _1!, accessHash: _2!, date: _3!, adminId: _4!, participantId: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.EncryptedChat.encryptedChatWaiting(id: _1!, accessHash: _2!, date: _3!, adminId: _4!, participantId: _5!)
}
}
@@ -273,12 +267,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.EncryptedFile.encryptedFile(id: _1!, accessHash: _2!, size: _3!, dcId: _4!, keyFingerprint: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.EncryptedFile.encryptedFile(id: _1!, accessHash: _2!, size: _3!, dcId: _4!, keyFingerprint: _5!)
}
public static func parse_encryptedFileEmpty(_ reader: BufferReader) -> EncryptedFile? {
return Api.EncryptedFile.encryptedFileEmpty
@@ -342,12 +336,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.EncryptedMessage.encryptedMessage(randomId: _1!, chatId: _2!, date: _3!, bytes: _4!, file: _5!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.EncryptedMessage.encryptedMessage(randomId: _1!, chatId: _2!, date: _3!, bytes: _4!, file: _5!)
}
public static func parse_encryptedMessageService(_ reader: BufferReader) -> EncryptedMessage? {
var _1: Int64?
@@ -362,12 +356,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.EncryptedMessage.encryptedMessageService(randomId: _1!, chatId: _2!, date: _3!, bytes: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.EncryptedMessage.encryptedMessageService(randomId: _1!, chatId: _2!, date: _3!, bytes: _4!)
}
}
@@ -453,12 +446,19 @@ public extension Api {
let _c10 = (Int(_1!) & Int(1 << 10) == 0) || _10 != nil
let _c11 = (Int(_1!) & Int(1 << 8) == 0) || _11 != nil
let _c12 = (Int(_1!) & Int(1 << 9) == 0) || _12 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 {
- return Api.ExportedChatInvite.chatInviteExported(flags: _1!, link: _2!, adminId: _3!, date: _4!, startDate: _5, expireDate: _6, usageLimit: _7, usage: _8, requested: _9, subscriptionExpired: _10, title: _11, subscriptionPricing: _12)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ return Api.ExportedChatInvite.chatInviteExported(flags: _1!, link: _2!, adminId: _3!, date: _4!, startDate: _5, expireDate: _6, usageLimit: _7, usage: _8, requested: _9, subscriptionExpired: _10, title: _11, subscriptionPricing: _12)
}
public static func parse_chatInvitePublicJoinRequests(_ reader: BufferReader) -> ExportedChatInvite? {
return Api.ExportedChatInvite.chatInvitePublicJoinRequests
@@ -510,12 +510,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.ExportedChatlistInvite.exportedChatlistInvite(flags: _1!, title: _2!, url: _3!, peers: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.ExportedChatlistInvite.exportedChatlistInvite(flags: _1!, title: _2!, url: _3!, peers: _4!)
}
}
@@ -550,12 +549,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ExportedContactToken.exportedContactToken(url: _1!, expires: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ExportedContactToken.exportedContactToken(url: _1!, expires: _2!)
}
}
@@ -590,12 +586,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ExportedMessageLink.exportedMessageLink(link: _1!, html: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ExportedMessageLink.exportedMessageLink(link: _1!, html: _2!)
}
}
@@ -626,12 +619,8 @@ public extension Api {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.ExportedStoryLink.exportedStoryLink(link: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ExportedStoryLink.exportedStoryLink(link: _1!)
}
}
@@ -676,12 +665,11 @@ public extension Api {
let _c2 = (Int(_1!) & Int(1 << 1) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.FactCheck.factCheck(flags: _1!, country: _2, text: _3, hash: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.FactCheck.factCheck(flags: _1!, country: _2, text: _3, hash: _4!)
}
}
@@ -720,12 +708,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.FileHash.fileHash(offset: _1!, limit: _2!, hash: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.FileHash.fileHash(offset: _1!, limit: _2!, hash: _3!)
}
}
@@ -770,12 +756,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 3) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.Folder.folder(flags: _1!, id: _2!, title: _3!, photo: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.Folder.folder(flags: _1!, id: _2!, title: _3!, photo: _4)
}
}
@@ -812,12 +797,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.FolderPeer.folderPeer(peer: _1!, folderId: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.FolderPeer.folderPeer(peer: _1!, folderId: _2!)
}
}
@@ -925,23 +907,30 @@ public extension Api {
let _c14 = _14 != nil
let _c15 = _15 != nil
let _c16 = (Int(_1!) & Int(1 << 4) == 0) || _16 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 {
- return Api.ForumTopic.forumTopic(flags: _1!, id: _2!, date: _3!, peer: _4!, title: _5!, iconColor: _6!, iconEmojiId: _7, topMessage: _8!, readInboxMaxId: _9!, readOutboxMaxId: _10!, unreadCount: _11!, unreadMentionsCount: _12!, unreadReactionsCount: _13!, fromId: _14!, notifySettings: _15!, draft: _16)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ if !_c13 { return nil }
+ if !_c14 { return nil }
+ if !_c15 { return nil }
+ if !_c16 { return nil }
+ return Api.ForumTopic.forumTopic(flags: _1!, id: _2!, date: _3!, peer: _4!, title: _5!, iconColor: _6!, iconEmojiId: _7, topMessage: _8!, readInboxMaxId: _9!, readOutboxMaxId: _10!, unreadCount: _11!, unreadMentionsCount: _12!, unreadReactionsCount: _13!, fromId: _14!, notifySettings: _15!, draft: _16)
}
public static func parse_forumTopicDeleted(_ reader: BufferReader) -> ForumTopic? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.ForumTopic.forumTopicDeleted(id: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.ForumTopic.forumTopicDeleted(id: _1!)
}
}
@@ -980,12 +969,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.FoundStory.foundStory(peer: _1!, story: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.FoundStory.foundStory(peer: _1!, story: _2!)
}
}
@@ -1048,12 +1034,15 @@ public extension Api {
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = (Int(_1!) & Int(1 << 0) == 0) || _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.Game.game(flags: _1!, id: _2!, accessHash: _3!, shortName: _4!, title: _5!, description: _6!, photo: _7!, document: _8)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.Game.game(flags: _1!, id: _2!, accessHash: _3!, shortName: _4!, title: _5!, description: _6!, photo: _7!, document: _8)
}
}
@@ -1109,12 +1098,12 @@ public extension Api {
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.GeoPoint.geoPoint(flags: _1!, long: _2!, lat: _3!, accessHash: _4!, accuracyRadius: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.GeoPoint.geoPoint(flags: _1!, long: _2!, lat: _3!, accessHash: _4!, accuracyRadius: _5)
}
public static func parse_geoPointEmpty(_ reader: BufferReader) -> GeoPoint? {
return Api.GeoPoint.geoPointEmpty
@@ -1164,12 +1153,12 @@ public extension Api {
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.GeoPointAddress.geoPointAddress(flags: _1!, countryIso2: _2!, state: _3, city: _4, street: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.GeoPointAddress.geoPointAddress(flags: _1!, countryIso2: _2!, state: _3, city: _4, street: _5)
}
}
@@ -1210,12 +1199,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 5) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 6) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.GlobalPrivacySettings.globalPrivacySettings(flags: _1!, noncontactPeersPaidStars: _2, disallowedGifts: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.GlobalPrivacySettings.globalPrivacySettings(flags: _1!, noncontactPeersPaidStars: _2, disallowedGifts: _3)
}
}
@@ -1311,12 +1298,21 @@ public extension Api {
let _c12 = (Int(_1!) & Int(1 << 16) == 0) || _12 != nil
let _c13 = (Int(_1!) & Int(1 << 20) == 0) || _13 != nil
let _c14 = (Int(_1!) & Int(1 << 21) == 0) || _14 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 {
- return Api.GroupCall.groupCall(flags: _1!, id: _2!, accessHash: _3!, participantsCount: _4!, title: _5, streamDcId: _6, recordStartDate: _7, scheduleDate: _8, unmutedVideoCount: _9, unmutedVideoLimit: _10!, version: _11!, inviteLink: _12, sendPaidMessagesStars: _13, defaultSendAs: _14)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ if !_c12 { return nil }
+ if !_c13 { return nil }
+ if !_c14 { return nil }
+ return Api.GroupCall.groupCall(flags: _1!, id: _2!, accessHash: _3!, participantsCount: _4!, title: _5, streamDcId: _6, recordStartDate: _7, scheduleDate: _8, unmutedVideoCount: _9, unmutedVideoLimit: _10!, version: _11!, inviteLink: _12, sendPaidMessagesStars: _13, defaultSendAs: _14)
}
public static func parse_groupCallDiscarded(_ reader: BufferReader) -> GroupCall? {
var _1: Int64?
@@ -1328,12 +1324,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.GroupCall.groupCallDiscarded(id: _1!, accessHash: _2!, duration: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.GroupCall.groupCallDiscarded(id: _1!, accessHash: _2!, duration: _3!)
}
}
@@ -1374,12 +1368,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 3) == 0) || _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.GroupCallDonor.groupCallDonor(flags: _1!, peerId: _2, stars: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.GroupCallDonor.groupCallDonor(flags: _1!, peerId: _2, stars: _3!)
}
}
@@ -1434,12 +1426,13 @@ public extension Api {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.GroupCallMessage.groupCallMessage(flags: _1!, id: _2!, fromId: _3!, date: _4!, message: _5!, paidMessageStars: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.GroupCallMessage.groupCallMessage(flags: _1!, id: _2!, fromId: _3!, date: _4!, message: _5!, paidMessageStars: _6)
}
}
diff --git a/submodules/TelegramApi/Sources/Api8.swift b/submodules/TelegramApi/Sources/Api8.swift
index 0b617cce..78862824 100644
--- a/submodules/TelegramApi/Sources/Api8.swift
+++ b/submodules/TelegramApi/Sources/Api8.swift
@@ -70,12 +70,18 @@ public extension Api {
let _c9 = (Int(_1!) & Int(1 << 6) == 0) || _9 != nil
let _c10 = (Int(_1!) & Int(1 << 14) == 0) || _10 != nil
let _c11 = (Int(_1!) & Int(1 << 16) == 0) || _11 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 {
- return Api.GroupCallParticipant.groupCallParticipant(flags: _1!, peer: _2!, date: _3!, activeDate: _4, source: _5!, volume: _6, about: _7, raiseHandRating: _8, video: _9, presentation: _10, paidStarsTotal: _11)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ if !_c10 { return nil }
+ if !_c11 { return nil }
+ return Api.GroupCallParticipant.groupCallParticipant(flags: _1!, peer: _2!, date: _3!, activeDate: _4, source: _5!, volume: _6, about: _7, raiseHandRating: _8, video: _9, presentation: _10, paidStarsTotal: _11)
}
}
@@ -124,12 +130,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.GroupCallParticipantVideo.groupCallParticipantVideo(flags: _1!, endpoint: _2!, sourceGroups: _3!, audioSource: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.GroupCallParticipantVideo.groupCallParticipantVideo(flags: _1!, endpoint: _2!, sourceGroups: _3!, audioSource: _4)
}
}
@@ -170,12 +175,9 @@ public extension Api {
}
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.GroupCallParticipantVideoSourceGroup.groupCallParticipantVideoSourceGroup(semantics: _1!, sources: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.GroupCallParticipantVideoSourceGroup.groupCallParticipantVideoSourceGroup(semantics: _1!, sources: _2!)
}
}
@@ -214,12 +216,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.GroupCallStreamChannel.groupCallStreamChannel(channel: _1!, scale: _2!, lastTimestampMs: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.GroupCallStreamChannel.groupCallStreamChannel(channel: _1!, scale: _2!, lastTimestampMs: _3!)
}
}
@@ -258,12 +258,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.HighScore.highScore(pos: _1!, userId: _2!, score: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.HighScore.highScore(pos: _1!, userId: _2!, score: _3!)
}
}
@@ -298,12 +296,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.ImportedContact.importedContact(userId: _1!, clientId: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.ImportedContact.importedContact(userId: _1!, clientId: _2!)
}
}
@@ -338,12 +333,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InlineBotSwitchPM.inlineBotSwitchPM(text: _1!, startParam: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InlineBotSwitchPM.inlineBotSwitchPM(text: _1!, startParam: _2!)
}
}
@@ -378,12 +370,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InlineBotWebView.inlineBotWebView(text: _1!, url: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InlineBotWebView.inlineBotWebView(text: _1!, url: _2!)
}
}
@@ -516,12 +505,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.InputAppEvent.inputAppEvent(time: _1!, type: _2!, peer: _3!, data: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.InputAppEvent.inputAppEvent(time: _1!, type: _2!, peer: _3!, data: _4!)
}
}
@@ -566,12 +554,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputBotApp.inputBotAppID(id: _1!, accessHash: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputBotApp.inputBotAppID(id: _1!, accessHash: _2!)
}
public static func parse_inputBotAppShortName(_ reader: BufferReader) -> InputBotApp? {
var _1: Api.InputUser?
@@ -582,12 +567,9 @@ public extension Api {
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputBotApp.inputBotAppShortName(botId: _1!, shortName: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputBotApp.inputBotAppShortName(botId: _1!, shortName: _2!)
}
}
@@ -734,12 +716,9 @@ public extension Api {
} }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 2) == 0) || _2 != nil
- if _c1 && _c2 {
- return Api.InputBotInlineMessage.inputBotInlineMessageGame(flags: _1!, replyMarkup: _2)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputBotInlineMessage.inputBotInlineMessageGame(flags: _1!, replyMarkup: _2)
}
public static func parse_inputBotInlineMessageMediaAuto(_ reader: BufferReader) -> InputBotInlineMessage? {
var _1: Int32?
@@ -758,12 +737,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.InputBotInlineMessage.inputBotInlineMessageMediaAuto(flags: _1!, message: _2!, entities: _3, replyMarkup: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.InputBotInlineMessage.inputBotInlineMessageMediaAuto(flags: _1!, message: _2!, entities: _3, replyMarkup: _4)
}
public static func parse_inputBotInlineMessageMediaContact(_ reader: BufferReader) -> InputBotInlineMessage? {
var _1: Int32?
@@ -786,12 +764,13 @@ public extension Api {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.InputBotInlineMessage.inputBotInlineMessageMediaContact(flags: _1!, phoneNumber: _2!, firstName: _3!, lastName: _4!, vcard: _5!, replyMarkup: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.InputBotInlineMessage.inputBotInlineMessageMediaContact(flags: _1!, phoneNumber: _2!, firstName: _3!, lastName: _4!, vcard: _5!, replyMarkup: _6)
}
public static func parse_inputBotInlineMessageMediaGeo(_ reader: BufferReader) -> InputBotInlineMessage? {
var _1: Int32?
@@ -816,12 +795,13 @@ public extension Api {
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.InputBotInlineMessage.inputBotInlineMessageMediaGeo(flags: _1!, geoPoint: _2!, heading: _3, period: _4, proximityNotificationRadius: _5, replyMarkup: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.InputBotInlineMessage.inputBotInlineMessageMediaGeo(flags: _1!, geoPoint: _2!, heading: _3, period: _4, proximityNotificationRadius: _5, replyMarkup: _6)
}
public static func parse_inputBotInlineMessageMediaInvoice(_ reader: BufferReader) -> InputBotInlineMessage? {
var _1: Int32?
@@ -859,12 +839,16 @@ public extension Api {
let _c7 = _7 != nil
let _c8 = _8 != nil
let _c9 = (Int(_1!) & Int(1 << 2) == 0) || _9 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
- return Api.InputBotInlineMessage.inputBotInlineMessageMediaInvoice(flags: _1!, title: _2!, description: _3!, photo: _4, invoice: _5!, payload: _6!, provider: _7!, providerData: _8!, replyMarkup: _9)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ return Api.InputBotInlineMessage.inputBotInlineMessageMediaInvoice(flags: _1!, title: _2!, description: _3!, photo: _4, invoice: _5!, payload: _6!, provider: _7!, providerData: _8!, replyMarkup: _9)
}
public static func parse_inputBotInlineMessageMediaVenue(_ reader: BufferReader) -> InputBotInlineMessage? {
var _1: Int32?
@@ -895,12 +879,15 @@ public extension Api {
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = (Int(_1!) & Int(1 << 2) == 0) || _8 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
- return Api.InputBotInlineMessage.inputBotInlineMessageMediaVenue(flags: _1!, geoPoint: _2!, title: _3!, address: _4!, provider: _5!, venueId: _6!, venueType: _7!, replyMarkup: _8)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ return Api.InputBotInlineMessage.inputBotInlineMessageMediaVenue(flags: _1!, geoPoint: _2!, title: _3!, address: _4!, provider: _5!, venueId: _6!, venueType: _7!, replyMarkup: _8)
}
public static func parse_inputBotInlineMessageMediaWebPage(_ reader: BufferReader) -> InputBotInlineMessage? {
var _1: Int32?
@@ -922,12 +909,12 @@ public extension Api {
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.InputBotInlineMessage.inputBotInlineMessageMediaWebPage(flags: _1!, message: _2!, entities: _3, url: _4!, replyMarkup: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.InputBotInlineMessage.inputBotInlineMessageMediaWebPage(flags: _1!, message: _2!, entities: _3, url: _4!, replyMarkup: _5)
}
public static func parse_inputBotInlineMessageText(_ reader: BufferReader) -> InputBotInlineMessage? {
var _1: Int32?
@@ -946,12 +933,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.InputBotInlineMessage.inputBotInlineMessageText(flags: _1!, message: _2!, entities: _3, replyMarkup: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.InputBotInlineMessage.inputBotInlineMessageText(flags: _1!, message: _2!, entities: _3, replyMarkup: _4)
}
}
@@ -1002,12 +988,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.InputBotInlineMessageID.inputBotInlineMessageID(dcId: _1!, id: _2!, accessHash: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.InputBotInlineMessageID.inputBotInlineMessageID(dcId: _1!, id: _2!, accessHash: _3!)
}
public static func parse_inputBotInlineMessageID64(_ reader: BufferReader) -> InputBotInlineMessageID? {
var _1: Int32?
@@ -1022,12 +1006,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.InputBotInlineMessageID.inputBotInlineMessageID64(dcId: _1!, ownerId: _2!, id: _3!, accessHash: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.InputBotInlineMessageID.inputBotInlineMessageID64(dcId: _1!, ownerId: _2!, id: _3!, accessHash: _4!)
}
}
@@ -1134,12 +1117,16 @@ public extension Api {
let _c7 = (Int(_1!) & Int(1 << 4) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 5) == 0) || _8 != nil
let _c9 = _9 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
- return Api.InputBotInlineResult.inputBotInlineResult(flags: _1!, id: _2!, type: _3!, title: _4, description: _5, url: _6, thumb: _7, content: _8, sendMessage: _9!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ if !_c8 { return nil }
+ if !_c9 { return nil }
+ return Api.InputBotInlineResult.inputBotInlineResult(flags: _1!, id: _2!, type: _3!, title: _4, description: _5, url: _6, thumb: _7, content: _8, sendMessage: _9!)
}
public static func parse_inputBotInlineResultDocument(_ reader: BufferReader) -> InputBotInlineResult? {
var _1: Int32?
@@ -1167,12 +1154,14 @@ public extension Api {
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
- return Api.InputBotInlineResult.inputBotInlineResultDocument(flags: _1!, id: _2!, type: _3!, title: _4, description: _5, document: _6!, sendMessage: _7!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ if !_c7 { return nil }
+ return Api.InputBotInlineResult.inputBotInlineResultDocument(flags: _1!, id: _2!, type: _3!, title: _4, description: _5, document: _6!, sendMessage: _7!)
}
public static func parse_inputBotInlineResultGame(_ reader: BufferReader) -> InputBotInlineResult? {
var _1: String?
@@ -1186,12 +1175,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.InputBotInlineResult.inputBotInlineResultGame(id: _1!, shortName: _2!, sendMessage: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.InputBotInlineResult.inputBotInlineResultGame(id: _1!, shortName: _2!, sendMessage: _3!)
}
public static func parse_inputBotInlineResultPhoto(_ reader: BufferReader) -> InputBotInlineResult? {
var _1: String?
@@ -1210,12 +1197,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.InputBotInlineResult.inputBotInlineResultPhoto(id: _1!, type: _2!, photo: _3!, sendMessage: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.InputBotInlineResult.inputBotInlineResultPhoto(id: _1!, type: _2!, photo: _3!, sendMessage: _4!)
}
}
@@ -1262,12 +1248,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.InputBusinessAwayMessage.inputBusinessAwayMessage(flags: _1!, shortcutId: _2!, schedule: _3!, recipients: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.InputBusinessAwayMessage.inputBusinessAwayMessage(flags: _1!, shortcutId: _2!, schedule: _3!, recipients: _4!)
}
}
diff --git a/submodules/TelegramApi/Sources/Api9.swift b/submodules/TelegramApi/Sources/Api9.swift
index a5bae125..2bdcfb3e 100644
--- a/submodules/TelegramApi/Sources/Api9.swift
+++ b/submodules/TelegramApi/Sources/Api9.swift
@@ -44,12 +44,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 4) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 6) == 0) || _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.InputBusinessBotRecipients.inputBusinessBotRecipients(flags: _1!, users: _2, excludeUsers: _3)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.InputBusinessBotRecipients.inputBusinessBotRecipients(flags: _1!, users: _2, excludeUsers: _3)
}
}
@@ -98,12 +96,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.InputBusinessChatLink.inputBusinessChatLink(flags: _1!, message: _2!, entities: _3, title: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.InputBusinessChatLink.inputBusinessChatLink(flags: _1!, message: _2!, entities: _3, title: _4)
}
}
@@ -144,12 +141,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.InputBusinessGreetingMessage.inputBusinessGreetingMessage(shortcutId: _1!, recipients: _2!, noActivityDays: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.InputBusinessGreetingMessage.inputBusinessGreetingMessage(shortcutId: _1!, recipients: _2!, noActivityDays: _3!)
}
}
@@ -194,12 +189,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.InputBusinessIntro.inputBusinessIntro(flags: _1!, title: _2!, description: _3!, sticker: _4)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.InputBusinessIntro.inputBusinessIntro(flags: _1!, title: _2!, description: _3!, sticker: _4)
}
}
@@ -240,12 +234,9 @@ public extension Api {
} }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 4) == 0) || _2 != nil
- if _c1 && _c2 {
- return Api.InputBusinessRecipients.inputBusinessRecipients(flags: _1!, users: _2)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputBusinessRecipients.inputBusinessRecipients(flags: _1!, users: _2)
}
}
@@ -300,12 +291,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputChannel.inputChannel(channelId: _1!, accessHash: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputChannel.inputChannel(channelId: _1!, accessHash: _2!)
}
public static func parse_inputChannelEmpty(_ reader: BufferReader) -> InputChannel? {
return Api.InputChannel.inputChannelEmpty
@@ -322,12 +310,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.InputChannel.inputChannelFromMessage(peer: _1!, msgId: _2!, channelId: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.InputChannel.inputChannelFromMessage(peer: _1!, msgId: _2!, channelId: _3!)
}
}
@@ -382,12 +368,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.InputPhoto
}
let _c1 = _1 != nil
- if _c1 {
- return Api.InputChatPhoto.inputChatPhoto(id: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputChatPhoto.inputChatPhoto(id: _1!)
}
public static func parse_inputChatPhotoEmpty(_ reader: BufferReader) -> InputChatPhoto? {
return Api.InputChatPhoto.inputChatPhotoEmpty
@@ -414,12 +396,12 @@ public extension Api {
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 {
- return Api.InputChatPhoto.inputChatUploadedPhoto(flags: _1!, file: _2, video: _3, videoStartTs: _4, videoEmojiMarkup: _5)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ return Api.InputChatPhoto.inputChatUploadedPhoto(flags: _1!, file: _2, video: _3, videoStartTs: _4, videoEmojiMarkup: _5)
}
}
@@ -468,12 +450,8 @@ public extension Api {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.InputChatTheme.inputChatTheme(emoticon: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputChatTheme.inputChatTheme(emoticon: _1!)
}
public static func parse_inputChatThemeEmpty(_ reader: BufferReader) -> InputChatTheme? {
return Api.InputChatTheme.inputChatThemeEmpty
@@ -482,12 +460,8 @@ public extension Api {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.InputChatTheme.inputChatThemeUniqueGift(slug: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputChatTheme.inputChatThemeUniqueGift(slug: _1!)
}
}
@@ -518,12 +492,8 @@ public extension Api {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.InputChatlist.inputChatlistDialogFilter(filterId: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputChatlist.inputChatlistDialogFilter(filterId: _1!)
}
}
@@ -574,12 +544,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.InputCheckPasswordSRP.inputCheckPasswordSRP(srpId: _1!, A: _2!, M1: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.InputCheckPasswordSRP.inputCheckPasswordSRP(srpId: _1!, A: _2!, M1: _3!)
}
}
@@ -614,12 +582,9 @@ public extension Api {
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputClientProxy.inputClientProxy(address: _1!, port: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputClientProxy.inputClientProxy(address: _1!, port: _2!)
}
}
@@ -659,23 +624,15 @@ public extension Api {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.InputCollectible.inputCollectiblePhone(phone: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputCollectible.inputCollectiblePhone(phone: _1!)
}
public static func parse_inputCollectibleUsername(_ reader: BufferReader) -> InputCollectible? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
- if _c1 {
- return Api.InputCollectible.inputCollectibleUsername(username: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputCollectible.inputCollectibleUsername(username: _1!)
}
}
@@ -728,12 +685,13 @@ public extension Api {
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
- if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
- return Api.InputContact.inputPhoneContact(flags: _1!, clientId: _2!, phone: _3!, firstName: _4!, lastName: _5!, note: _6)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ if !_c5 { return nil }
+ if !_c6 { return nil }
+ return Api.InputContact.inputPhoneContact(flags: _1!, clientId: _2!, phone: _3!, firstName: _4!, lastName: _5!, note: _6)
}
}
@@ -775,23 +733,15 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
}
let _c1 = _1 != nil
- if _c1 {
- return Api.InputDialogPeer.inputDialogPeer(peer: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputDialogPeer.inputDialogPeer(peer: _1!)
}
public static func parse_inputDialogPeerFolder(_ reader: BufferReader) -> InputDialogPeer? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
- if _c1 {
- return Api.InputDialogPeer.inputDialogPeerFolder(folderId: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputDialogPeer.inputDialogPeerFolder(folderId: _1!)
}
}
@@ -839,12 +789,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.InputDocument.inputDocument(id: _1!, accessHash: _2!, fileReference: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.InputDocument.inputDocument(id: _1!, accessHash: _2!, fileReference: _3!)
}
public static func parse_inputDocumentEmpty(_ reader: BufferReader) -> InputDocument? {
return Api.InputDocument.inputDocumentEmpty
@@ -882,12 +830,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputEncryptedChat.inputEncryptedChat(chatId: _1!, accessHash: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputEncryptedChat.inputEncryptedChat(chatId: _1!, accessHash: _2!)
}
}
@@ -954,12 +899,9 @@ public extension Api {
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
- if _c1 && _c2 {
- return Api.InputEncryptedFile.inputEncryptedFile(id: _1!, accessHash: _2!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ return Api.InputEncryptedFile.inputEncryptedFile(id: _1!, accessHash: _2!)
}
public static func parse_inputEncryptedFileBigUploaded(_ reader: BufferReader) -> InputEncryptedFile? {
var _1: Int64?
@@ -971,12 +913,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.InputEncryptedFile.inputEncryptedFileBigUploaded(id: _1!, parts: _2!, keyFingerprint: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.InputEncryptedFile.inputEncryptedFileBigUploaded(id: _1!, parts: _2!, keyFingerprint: _3!)
}
public static func parse_inputEncryptedFileEmpty(_ reader: BufferReader) -> InputEncryptedFile? {
return Api.InputEncryptedFile.inputEncryptedFileEmpty
@@ -994,12 +934,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.InputEncryptedFile.inputEncryptedFileUploaded(id: _1!, parts: _2!, md5Checksum: _3!, keyFingerprint: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.InputEncryptedFile.inputEncryptedFileUploaded(id: _1!, parts: _2!, md5Checksum: _3!, keyFingerprint: _4!)
}
}
@@ -1062,12 +1001,11 @@ public extension Api {
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
- if _c1 && _c2 && _c3 && _c4 {
- return Api.InputFile.inputFile(id: _1!, parts: _2!, name: _3!, md5Checksum: _4!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ if !_c4 { return nil }
+ return Api.InputFile.inputFile(id: _1!, parts: _2!, name: _3!, md5Checksum: _4!)
}
public static func parse_inputFileBig(_ reader: BufferReader) -> InputFile? {
var _1: Int64?
@@ -1079,12 +1017,10 @@ public extension Api {
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
- if _c1 && _c2 && _c3 {
- return Api.InputFile.inputFileBig(id: _1!, parts: _2!, name: _3!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ if !_c2 { return nil }
+ if !_c3 { return nil }
+ return Api.InputFile.inputFileBig(id: _1!, parts: _2!, name: _3!)
}
public static func parse_inputFileStoryDocument(_ reader: BufferReader) -> InputFile? {
var _1: Api.InputDocument?
@@ -1092,12 +1028,8 @@ public extension Api {
_1 = Api.parse(reader, signature: signature) as? Api.InputDocument
}
let _c1 = _1 != nil
- if _c1 {
- return Api.InputFile.inputFileStoryDocument(id: _1!)
- }
- else {
- return nil
- }
+ if !_c1 { return nil }
+ return Api.InputFile.inputFileStoryDocument(id: _1!)
}
}
diff --git a/submodules/TelegramBaseController/Sources/TelegramBaseController.swift b/submodules/TelegramBaseController/Sources/TelegramBaseController.swift
index 74588d00..87cad945 100644
--- a/submodules/TelegramBaseController/Sources/TelegramBaseController.swift
+++ b/submodules/TelegramBaseController/Sources/TelegramBaseController.swift
@@ -14,18 +14,6 @@ import PresentationDataUtils
import TelegramCallsUI
import UndoUI
-public enum MediaAccessoryPanelVisibility {
- case none
- case specific(size: ContainerViewLayoutSizeClass)
- case always
-}
-
-public enum LocationBroadcastPanelSource {
- case none
- case summary
- case peer(PeerId)
-}
-
private func presentLiveLocationController(context: AccountContext, peerId: PeerId, controller: ViewController) {
let presentImpl: (EngineMessage?) -> Void = { [weak controller] message in
if let message = message, let strongController = controller {
@@ -65,332 +53,31 @@ open class TelegramBaseController: ViewController, KeyShortcutResponder {
public var accessoryPanelContainer: ASDisplayNode?
public private(set) var accessoryPanelContainerHeight: CGFloat = 0.0
- public let mediaAccessoryPanelVisibility: MediaAccessoryPanelVisibility
public var tempHideAccessoryPanels: Bool = false
- public let locationBroadcastPanelSource: LocationBroadcastPanelSource
- public let groupCallPanelSource: GroupCallPanelSource
-
- private var mediaStatusDisposable: Disposable?
- private var locationBroadcastDisposable: Disposable?
- private var currentGroupCallDisposable: Disposable?
-
- public private(set) var playlistStateAndType: (SharedMediaPlaylistItem, SharedMediaPlaylistItem?, SharedMediaPlaylistItem?, MusicPlaybackSettingsOrder, MediaManagerPlayerType, Account)?
- private var playlistLocation: SharedMediaPlaylistLocation?
-
- public var tempVoicePlaylistEnded: (() -> Void)?
- public var tempVoicePlaylistItemChanged: ((SharedMediaPlaylistItem?, SharedMediaPlaylistItem?) -> Void)?
- public var tempVoicePlaylistCurrentItem: SharedMediaPlaylistItem?
-
- public private(set) var mediaAccessoryPanel: (MediaNavigationAccessoryPanel, MediaManagerPlayerType)?
-
- private var locationBroadcastMode: LocationBroadcastNavigationAccessoryPanelMode?
- private var locationBroadcastPeers: [EnginePeer]?
- private var locationBroadcastMessages: [EngineMessage.Id: EngineMessage]?
- private var locationBroadcastAccessoryPanel: LocationBroadcastNavigationAccessoryPanel?
-
private var giftAuctionAccessoryPanel: GiftAuctionAccessoryPanel?
private var giftAuctionStates: [GiftAuctionContext.State] = []
private var giftAuctionDisposable: Disposable?
- private var groupCallPanelData: GroupCallPanelData?
- public private(set) var groupCallAccessoryPanel: GroupCallNavigationAccessoryPanel?
-
private var dismissingPanel: ASDisplayNode?
- private weak var audioRateTooltipController: UndoOverlayController?
-
private var presentationData: PresentationData
private var presentationDataDisposable: Disposable?
- private var playlistPreloadDisposable: Disposable?
override open var additionalNavigationBarHeight: CGFloat {
- var height: CGFloat = 0.0
- if self.accessoryPanelContainer == nil {
- if let _ = self.groupCallAccessoryPanel {
- height += 50.0
- }
- if let _ = self.mediaAccessoryPanel {
- height += MediaNavigationAccessoryHeaderNode.minimizedHeight
- }
- if let _ = self.locationBroadcastAccessoryPanel {
- height += MediaNavigationAccessoryHeaderNode.minimizedHeight
- }
- }
- return height
+ return 0.0
}
- public init(context: AccountContext, navigationBarPresentationData: NavigationBarPresentationData?, mediaAccessoryPanelVisibility: MediaAccessoryPanelVisibility, locationBroadcastPanelSource: LocationBroadcastPanelSource, groupCallPanelSource: GroupCallPanelSource) {
+ public init(context: AccountContext, navigationBarPresentationData: NavigationBarPresentationData?) {
self.context = context
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
- self.mediaAccessoryPanelVisibility = mediaAccessoryPanelVisibility
- self.locationBroadcastPanelSource = locationBroadcastPanelSource
- self.groupCallPanelSource = groupCallPanelSource
super.init(navigationBarPresentationData: navigationBarPresentationData)
- if case .none = mediaAccessoryPanelVisibility {
- } else {
- self.mediaStatusDisposable = (context.sharedContext.mediaManager.globalMediaPlayerState
- |> mapToSignal { playlistStateAndType -> Signal<(Account, SharedMediaPlayerItemPlaybackState, MediaManagerPlayerType)?, NoError> in
- if let (account, state, type) = playlistStateAndType {
- switch state {
- case let .state(state):
- return .single((account, state, type))
- case .loading:
- return .single(nil) |> delay(0.2, queue: .mainQueue())
- }
- } else {
- return .single(nil)
- }
- }
- |> deliverOnMainQueue).start(next: { [weak self] playlistStateAndType in
- guard let strongSelf = self else {
- return
- }
- if !arePlaylistItemsEqual(strongSelf.playlistStateAndType?.0, playlistStateAndType?.1.item) ||
- !arePlaylistItemsEqual(strongSelf.playlistStateAndType?.1, playlistStateAndType?.1.previousItem) ||
- !arePlaylistItemsEqual(strongSelf.playlistStateAndType?.2, playlistStateAndType?.1.nextItem) ||
- strongSelf.playlistStateAndType?.3 != playlistStateAndType?.1.order || strongSelf.playlistStateAndType?.4 != playlistStateAndType?.2 {
- var previousVoiceItem: SharedMediaPlaylistItem?
- if let playlistStateAndType = strongSelf.playlistStateAndType, playlistStateAndType.4 == .voice {
- previousVoiceItem = playlistStateAndType.0
- }
-
- var updatedVoiceItem: SharedMediaPlaylistItem?
- if let playlistStateAndType = playlistStateAndType, playlistStateAndType.2 == .voice {
- updatedVoiceItem = playlistStateAndType.1.item
- }
-
- strongSelf.tempVoicePlaylistCurrentItem = updatedVoiceItem
- strongSelf.tempVoicePlaylistItemChanged?(previousVoiceItem, updatedVoiceItem)
- if let playlistStateAndType = playlistStateAndType {
- strongSelf.playlistStateAndType = (playlistStateAndType.1.item, playlistStateAndType.1.previousItem, playlistStateAndType.1.nextItem, playlistStateAndType.1.order, playlistStateAndType.2, playlistStateAndType.0)
- } else {
- var voiceEnded = false
- if strongSelf.playlistStateAndType?.4 == .voice {
- voiceEnded = true
- }
- strongSelf.playlistStateAndType = nil
- if voiceEnded {
- strongSelf.tempVoicePlaylistEnded?()
- }
- }
- strongSelf.requestLayout(transition: .animated(duration: 0.4, curve: .spring))
- }
- strongSelf.playlistLocation = playlistStateAndType?.1.playlistLocation
- })
- }
-
- if let liveLocationManager = context.liveLocationManager {
- switch locationBroadcastPanelSource {
- case .none:
- self.locationBroadcastMode = nil
- case .summary, .peer:
- let signal: Signal<([EnginePeer]?, [EngineMessage.Id: EngineMessage]?), NoError>
- switch locationBroadcastPanelSource {
- case let .peer(peerId):
- self.locationBroadcastMode = .peer
- signal = combineLatest(liveLocationManager.summaryManager.peersBroadcastingTo(peerId: peerId), liveLocationManager.summaryManager.broadcastingToMessages())
- |> map { peersAndMessages, outgoingMessages in
- var peers = peersAndMessages?.map { $0.0 }
- for message in outgoingMessages.values {
- if message.id.peerId == peerId, let author = message.author {
- if peers == nil {
- peers = []
- }
- peers?.append(author)
- }
- }
- return (peers, outgoingMessages)
- }
- default:
- self.locationBroadcastMode = .summary
- signal = liveLocationManager.summaryManager.broadcastingToMessages()
- |> map { messages -> ([EnginePeer]?, [EngineMessage.Id: EngineMessage]?) in
- if messages.isEmpty {
- return (nil, nil)
- } else {
- var peers: [EnginePeer] = []
- for message in messages.values.sorted(by: { $0.index < $1.index }) {
- if let peer = message.peers[message.id.peerId] {
- peers.append(EnginePeer(peer))
- }
- }
- return (peers, messages)
- }
- }
-
- }
-
- self.locationBroadcastDisposable = (signal
- |> deliverOnMainQueue).start(next: { [weak self] peers, messages in
- if let strongSelf = self {
- var updated = false
- if let current = strongSelf.locationBroadcastPeers, let peers = peers {
- updated = current != peers
- } else if (strongSelf.locationBroadcastPeers != nil) != (peers != nil) {
- updated = true
- }
-
- strongSelf.locationBroadcastMessages = messages
-
- if updated {
- let wasEmpty = strongSelf.locationBroadcastPeers == nil
- strongSelf.locationBroadcastPeers = peers
- if wasEmpty != (peers == nil) {
- strongSelf.requestLayout(transition: .animated(duration: 0.4, curve: .spring))
- } else if let peers = peers, let locationBroadcastMode = strongSelf.locationBroadcastMode {
- var canClose = true
- if case let .peer(peerId) = strongSelf.locationBroadcastPanelSource, let messages = messages {
- canClose = false
- for messageId in messages.keys {
- if messageId.peerId == peerId {
- canClose = true
- }
- }
- }
- strongSelf.locationBroadcastAccessoryPanel?.update(peers: peers, mode: locationBroadcastMode, canClose: canClose)
- }
- }
- }
- })
- }
- }
-
- if let callManager = context.sharedContext.callManager {
- switch groupCallPanelSource {
- case .none, .all:
- break
- case let .peer(peerId):
- let currentGroupCall: Signal = callManager.currentGroupCallSignal
- |> distinctUntilChanged(isEqual: { lhs, rhs in
- return lhs == rhs
- })
- |> map { call -> PresentationGroupCall? in
- guard case let .group(call) = call else {
- return nil
- }
- guard call.peerId == peerId && call.account.peerId == context.account.peerId else {
- return nil
- }
- return call
- }
-
- let availableGroupCall: Signal
- if case let .peer(peerId) = groupCallPanelSource {
- availableGroupCall = context.account.viewTracker.peerView(peerId)
- |> map { peerView -> (CachedChannelData.ActiveCall?, EnginePeer?) in
- let peer = peerView.peers[peerId].flatMap(EnginePeer.init)
- if let cachedData = peerView.cachedData as? CachedChannelData {
- return (cachedData.activeCall, peer)
- } else if let cachedData = peerView.cachedData as? CachedGroupData {
- return (cachedData.activeCall, peer)
- } else {
- return (nil, peer)
- }
- }
- |> distinctUntilChanged(isEqual: { lhs, rhs in
- return lhs.0 == rhs.0
- })
- |> mapToSignal { activeCall, peer -> Signal in
- guard let activeCall = activeCall else {
- return .single(nil)
- }
-
- var isChannel = false
- if let peer = peer, case let .channel(channel) = peer, case .broadcast = channel.info {
- isChannel = true
- }
-
- return Signal { [weak context] subscriber in
- guard let context = context, let callContextCache = context.cachedGroupCallContexts as? AccountGroupCallContextCacheImpl else {
- return EmptyDisposable
- }
-
- let disposable = MetaDisposable()
-
- callContextCache.impl.syncWith { impl in
- let callContext = impl.get(account: context.account, engine: context.engine, peerId: peerId, isChannel: isChannel, call: EngineGroupCallDescription(activeCall))
- disposable.set((callContext.context.panelData
- |> deliverOnMainQueue).start(next: { panelData in
- callContext.keep()
- var updatedPanelData = panelData
- if let panelData {
- var updatedInfo = panelData.info
- updatedInfo.subscribedToScheduled = activeCall.subscribedToScheduled
- updatedPanelData = panelData.withInfo(updatedInfo)
- }
- subscriber.putNext(updatedPanelData)
- }))
- }
-
- return ActionDisposable {
- disposable.dispose()
- }
- }
- |> runOn(.mainQueue())
- }
- } else {
- availableGroupCall = .single(nil)
- }
-
- let previousCurrentGroupCall = Atomic(value: nil)
- self.currentGroupCallDisposable = combineLatest(queue: .mainQueue(), availableGroupCall, currentGroupCall).start(next: { [weak self] availableState, currentGroupCall in
- guard let strongSelf = self else {
- return
- }
-
- let previousCurrentGroupCall = previousCurrentGroupCall.swap(currentGroupCall)
-
- let panelData: GroupCallPanelData?
- if previousCurrentGroupCall != nil && currentGroupCall == nil && availableState?.participantCount == 1 {
- panelData = nil
- } else {
- panelData = currentGroupCall != nil || (availableState?.participantCount == 0 && availableState?.info.scheduleTimestamp == nil && availableState?.info.isStream == false) ? nil : availableState
- }
-
- let wasEmpty = strongSelf.groupCallPanelData == nil
- strongSelf.groupCallPanelData = panelData
- let isEmpty = strongSelf.groupCallPanelData == nil
- if wasEmpty != isEmpty {
- strongSelf.requestLayout(transition: .animated(duration: 0.4, curve: .spring))
- } else if let groupCallPanelData = strongSelf.groupCallPanelData {
- strongSelf.groupCallAccessoryPanel?.update(data: groupCallPanelData)
- }
- })
- }
- }
-
- if let giftAuctionsManager = context.giftAuctionsManager, case .summary = locationBroadcastPanelSource {
- self.giftAuctionDisposable = (giftAuctionsManager.state
- |> deliverOnMainQueue).start(next: { [weak self] states in
- guard let self else {
- return
- }
- self.giftAuctionStates = states.filter { state in
- if case .ongoing = state.auctionState {
- return true
- } else {
- return false
- }
- }
- })
- }
-
self.presentationDataDisposable = (self.updatedPresentationData.1
|> deliverOnMainQueue).start(next: { [weak self] presentationData in
if let strongSelf = self {
- let previousTheme = strongSelf.presentationData.theme
- let previousStrings = strongSelf.presentationData.strings
-
strongSelf.presentationData = presentationData
-
- if previousTheme !== presentationData.theme || previousStrings !== presentationData.strings {
- strongSelf.mediaAccessoryPanel?.0.containerNode.updatePresentationData(presentationData)
- strongSelf.locationBroadcastAccessoryPanel?.updatePresentationData(presentationData)
- strongSelf.groupCallAccessoryPanel?.updatePresentationData(presentationData)
- }
}
})
}
@@ -400,11 +87,7 @@ open class TelegramBaseController: ViewController, KeyShortcutResponder {
}
deinit {
- self.mediaStatusDisposable?.dispose()
- self.locationBroadcastDisposable?.dispose()
- self.currentGroupCallDisposable?.dispose()
self.presentationDataDisposable?.dispose()
- self.playlistPreloadDisposable?.dispose()
}
required public init(coder aDecoder: NSCoder) {
@@ -429,118 +112,8 @@ open class TelegramBaseController: ViewController, KeyShortcutResponder {
super.containerLayoutUpdated(layout, transition: transition)
- let navigationHeight = super.navigationLayout(layout: layout).navigationFrame.height - self.additionalNavigationBarHeight
-
- let mediaAccessoryPanelHidden: Bool
- if self.tempHideAccessoryPanels {
- mediaAccessoryPanelHidden = true
- } else {
- switch self.mediaAccessoryPanelVisibility {
- case .always:
- mediaAccessoryPanelHidden = false
- case .none:
- mediaAccessoryPanelHidden = true
- case let .specific(size):
- mediaAccessoryPanelHidden = size != layout.metrics.widthClass
- }
- }
-
var additionalHeight: CGFloat = 0.0
var panelStartY: CGFloat = 0.0
- if self.accessoryPanelContainer == nil {
- var negativeHeight: CGFloat = 0.0
- if let _ = self.groupCallPanelData {
- negativeHeight += 50.0
- }
- if let _ = self.locationBroadcastPeers, let _ = self.locationBroadcastMode {
- negativeHeight += MediaNavigationAccessoryHeaderNode.minimizedHeight
- }
- if let _ = self.playlistStateAndType, !mediaAccessoryPanelHidden {
- negativeHeight += MediaNavigationAccessoryHeaderNode.minimizedHeight
- }
- panelStartY = navigationHeight.isZero ? (-negativeHeight) : (navigationHeight + additionalHeight + UIScreenPixel)
- }
-
- if let groupCallPanelData = self.groupCallPanelData {
- let panelHeight: CGFloat = 50.0
- let panelFrame = CGRect(origin: CGPoint(x: 0.0, y: panelStartY), size: CGSize(width: layout.size.width, height: panelHeight))
- additionalHeight += panelHeight
- panelStartY += panelHeight
-
- let groupCallAccessoryPanel: GroupCallNavigationAccessoryPanel
- if let current = self.groupCallAccessoryPanel {
- groupCallAccessoryPanel = current
- transition.updateFrame(node: groupCallAccessoryPanel, frame: panelFrame)
- groupCallAccessoryPanel.updateLayout(size: panelFrame.size, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, isHidden: !self.displayNavigationBar, transition: transition)
- } else {
- let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
- groupCallAccessoryPanel = GroupCallNavigationAccessoryPanel(context: self.context, presentationData: presentationData, tapAction: { [weak self] in
- guard let strongSelf = self, let groupCallPanelData = strongSelf.groupCallPanelData else {
- return
- }
- strongSelf.joinGroupCall(
- peerId: groupCallPanelData.peerId,
- invite: nil,
- activeCall: EngineGroupCallDescription(id: groupCallPanelData.info.id, accessHash: groupCallPanelData.info.accessHash, title: groupCallPanelData.info.title, scheduleTimestamp: groupCallPanelData.info.scheduleTimestamp, subscribedToScheduled: groupCallPanelData.info.subscribedToScheduled, isStream: groupCallPanelData.info.isStream)
- )
- }, notifyScheduledTapAction: { [weak self] in
- guard let self, let groupCallPanelData = self.groupCallPanelData else {
- return
- }
- if groupCallPanelData.info.scheduleTimestamp != nil && !groupCallPanelData.info.subscribedToScheduled {
- let _ = self.context.engine.calls.toggleScheduledGroupCallSubscription(peerId: groupCallPanelData.peerId, reference: .id(id: groupCallPanelData.info.id, accessHash: groupCallPanelData.info.accessHash), subscribe: true).startStandalone()
-
- let controller = UndoOverlayController(
- presentationData: presentationData,
- content: .universal(
- animation: "anim_set_notification",
- scale: 0.06,
- colors: [
- "Middle.Group 1.Fill 1": UIColor.white,
- "Top.Group 1.Fill 1": UIColor.white,
- "Bottom.Group 1.Fill 1": UIColor.white,
- "EXAMPLE.Group 1.Fill 1": UIColor.white,
- "Line.Group 1.Stroke 1": UIColor.white
- ],
- title: nil,
- text: presentationData.strings.Chat_ToastSubscribedToScheduledLiveStream_Text,
- customUndoText: nil,
- timeout: nil
- ),
- elevatedLayout: false,
- animateInAsReplacement: false,
- action: { _ in
- return true
- }
- )
- self.audioRateTooltipController = controller
- self.present(controller, in: .current)
- }
- })
- if let accessoryPanelContainer = self.accessoryPanelContainer {
- accessoryPanelContainer.addSubnode(groupCallAccessoryPanel)
- } else {
- self.navigationBar?.additionalContentNode.addSubnode(groupCallAccessoryPanel)
- }
- self.groupCallAccessoryPanel = groupCallAccessoryPanel
- groupCallAccessoryPanel.frame = panelFrame
-
- groupCallAccessoryPanel.update(data: groupCallPanelData)
- groupCallAccessoryPanel.updateLayout(size: panelFrame.size, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, isHidden: !self.displayNavigationBar, transition: .immediate)
- if transition.isAnimated {
- groupCallAccessoryPanel.animateIn(transition)
- }
- }
- } else if let groupCallAccessoryPanel = self.groupCallAccessoryPanel {
- self.groupCallAccessoryPanel = nil
- if transition.isAnimated {
- groupCallAccessoryPanel.animateOut(transition, completion: { [weak groupCallAccessoryPanel] in
- groupCallAccessoryPanel?.removeFromSupernode()
- })
- } else {
- groupCallAccessoryPanel.removeFromSupernode()
- }
- }
if !self.giftAuctionStates.isEmpty {
let panelHeight: CGFloat = 56.0
@@ -598,454 +171,6 @@ open class TelegramBaseController: ViewController, KeyShortcutResponder {
giftAuctionAccessoryPanel.removeFromSupernode()
}
}
-
- if let locationBroadcastPeers = self.locationBroadcastPeers, let locationBroadcastMode = self.locationBroadcastMode {
- let panelHeight = MediaNavigationAccessoryHeaderNode.minimizedHeight
- let panelFrame = CGRect(origin: CGPoint(x: 0.0, y: panelStartY), size: CGSize(width: layout.size.width, height: panelHeight))
- additionalHeight += panelHeight
- panelStartY += panelHeight
-
- let locationBroadcastAccessoryPanel: LocationBroadcastNavigationAccessoryPanel
- if let current = self.locationBroadcastAccessoryPanel {
- locationBroadcastAccessoryPanel = current
- transition.updateFrame(node: locationBroadcastAccessoryPanel, frame: panelFrame)
- locationBroadcastAccessoryPanel.updateLayout(size: panelFrame.size, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, isHidden: !self.displayNavigationBar, transition: transition)
- } else {
- let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
- locationBroadcastAccessoryPanel = LocationBroadcastNavigationAccessoryPanel(accountPeerId: self.context.account.peerId, theme: presentationData.theme, strings: presentationData.strings, nameDisplayOrder: presentationData.nameDisplayOrder, tapAction: { [weak self] in
- if let strongSelf = self {
- switch strongSelf.locationBroadcastPanelSource {
- case .none:
- break
- case .summary:
- if let locationBroadcastMessages = strongSelf.locationBroadcastMessages {
- let messages = locationBroadcastMessages.values.sorted(by: { $0.index > $1.index })
-
- if messages.count == 1 {
- presentLiveLocationController(context: strongSelf.context, peerId: messages[0].id.peerId, controller: strongSelf)
- } else {
- let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
- let controller = ActionSheetController(presentationData: presentationData)
- let dismissAction: () -> Void = { [weak controller] in
- controller?.dismissAnimated()
- }
- var items: [ActionSheetItem] = []
- if !messages.isEmpty {
- items.append(ActionSheetTextItem(title: presentationData.strings.LiveLocation_MenuChatsCount(Int32(messages.count))))
- for message in messages {
- if let peer = message.peers[message.id.peerId] {
- var beginTimeAndTimeout: (Double, Double)?
- for media in message.media {
- if let media = media as? TelegramMediaMap, let timeout = media.liveBroadcastingTimeout {
- beginTimeAndTimeout = (Double(message.timestamp), Double(timeout))
- }
- }
-
- if let beginTimeAndTimeout = beginTimeAndTimeout {
- items.append(LocationBroadcastActionSheetItem(context: strongSelf.context, peer: peer, title: EnginePeer(peer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), beginTimestamp: beginTimeAndTimeout.0, timeout: beginTimeAndTimeout.1, strings: presentationData.strings, action: {
- dismissAction()
- if let strongSelf = self {
- presentLiveLocationController(context: strongSelf.context, peerId: peer.id, controller: strongSelf)
- }
- }))
- }
- }
- }
- items.append(ActionSheetButtonItem(title: presentationData.strings.LiveLocation_MenuStopAll, color: .destructive, action: {
- dismissAction()
- if let locationBroadcastPeers = strongSelf.locationBroadcastPeers {
- for peer in locationBroadcastPeers {
- self?.context.liveLocationManager?.cancelLiveLocation(peerId: peer.id)
- }
- }
- }))
- }
- controller.setItemGroups([
- ActionSheetItemGroup(items: items),
- ActionSheetItemGroup(items: [ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, action: { dismissAction() })])
- ])
- strongSelf.view.endEditing(true)
- strongSelf.present(controller, in: .window(.root), with: ViewControllerPresentationArguments(presentationAnimation: .modalSheet))
- }
- }
- case let .peer(peerId):
- presentLiveLocationController(context: strongSelf.context, peerId: peerId, controller: strongSelf)
- }
- }
- }, close: { [weak self] in
- if let strongSelf = self {
- var closePeers: [EnginePeer]?
- var closePeerId: EnginePeer.Id?
- switch strongSelf.locationBroadcastPanelSource {
- case .none:
- break
- case .summary:
- if let locationBroadcastPeers = strongSelf.locationBroadcastPeers {
- if locationBroadcastPeers.count > 1 {
- closePeers = locationBroadcastPeers
- } else {
- closePeerId = locationBroadcastPeers.first?.id
- }
- }
- case let .peer(peerId):
- closePeerId = peerId
- }
- let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
- let controller = ActionSheetController(presentationData: presentationData)
- let dismissAction: () -> Void = { [weak controller] in
- controller?.dismissAnimated()
- }
- var items: [ActionSheetItem] = []
- if let closePeers = closePeers, !closePeers.isEmpty {
- items.append(ActionSheetTextItem(title: presentationData.strings.LiveLocation_MenuChatsCount(Int32(closePeers.count))))
- for peer in closePeers {
- items.append(ActionSheetButtonItem(title: peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), action: {
- dismissAction()
- if let strongSelf = self {
- presentLiveLocationController(context: strongSelf.context, peerId: peer.id, controller: strongSelf)
- }
- }))
- }
- items.append(ActionSheetButtonItem(title: presentationData.strings.LiveLocation_MenuStopAll, color: .destructive, action: {
- dismissAction()
- for peer in closePeers {
- self?.context.liveLocationManager?.cancelLiveLocation(peerId: peer.id)
- }
- }))
- } else if let closePeerId = closePeerId {
- items.append(ActionSheetButtonItem(title: presentationData.strings.Map_StopLiveLocation, color: .destructive, action: {
- dismissAction()
- self?.context.liveLocationManager?.cancelLiveLocation(peerId: closePeerId)
- }))
- }
- controller.setItemGroups([
- ActionSheetItemGroup(items: items),
- ActionSheetItemGroup(items: [ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, action: { dismissAction() })])
- ])
- strongSelf.view.endEditing(true)
- strongSelf.present(controller, in: .window(.root), with: ViewControllerPresentationArguments(presentationAnimation: .modalSheet))
- }
- })
- if let accessoryPanelContainer = self.accessoryPanelContainer {
- accessoryPanelContainer.addSubnode(locationBroadcastAccessoryPanel)
- } else {
- self.navigationBar?.additionalContentNode.addSubnode(locationBroadcastAccessoryPanel)
- }
- self.locationBroadcastAccessoryPanel = locationBroadcastAccessoryPanel
- locationBroadcastAccessoryPanel.frame = panelFrame
-
- var canClose = true
- if case let .peer(peerId) = self.locationBroadcastPanelSource, let messages = self.locationBroadcastMessages {
- canClose = false
- for messageId in messages.keys {
- if messageId.peerId == peerId {
- canClose = true
- }
- }
- }
-
- locationBroadcastAccessoryPanel.update(peers: locationBroadcastPeers, mode: locationBroadcastMode, canClose: canClose)
- locationBroadcastAccessoryPanel.updateLayout(size: panelFrame.size, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, isHidden: !self.displayNavigationBar, transition: .immediate)
- if transition.isAnimated {
- locationBroadcastAccessoryPanel.animateIn(transition)
- }
- }
- } else if let locationBroadcastAccessoryPanel = self.locationBroadcastAccessoryPanel {
- self.locationBroadcastAccessoryPanel = nil
- if transition.isAnimated {
- locationBroadcastAccessoryPanel.animateOut(transition, completion: { [weak locationBroadcastAccessoryPanel] in
- locationBroadcastAccessoryPanel?.removeFromSupernode()
- })
- } else {
- locationBroadcastAccessoryPanel.removeFromSupernode()
- }
- }
-
- var isViewOnceMessage = false
- if let (item, _, _, _, _, _) = self.playlistStateAndType, let source = item.playbackData?.source, case let .telegramFile(_, _, isViewOnce) = source, isViewOnce {
- isViewOnceMessage = true
- }
-
- if let (item, previousItem, nextItem, order, type, _) = self.playlistStateAndType, !mediaAccessoryPanelHidden && !isViewOnceMessage {
- let panelHeight = MediaNavigationAccessoryHeaderNode.minimizedHeight
- let panelFrame = CGRect(origin: CGPoint(x: 0.0, y: panelStartY), size: CGSize(width: layout.size.width, height: panelHeight))
- additionalHeight += panelHeight
- panelStartY += panelHeight
-
- if let (mediaAccessoryPanel, mediaType) = self.mediaAccessoryPanel, mediaType == type {
- transition.updateFrame(layer: mediaAccessoryPanel.layer, frame: panelFrame)
- mediaAccessoryPanel.updateLayout(size: panelFrame.size, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, isHidden: !self.displayNavigationBar, transition: transition)
- switch order {
- case .regular:
- mediaAccessoryPanel.containerNode.headerNode.playbackItems = (item, previousItem, nextItem)
- case .reversed:
- mediaAccessoryPanel.containerNode.headerNode.playbackItems = (item, nextItem, previousItem)
- case .random:
- mediaAccessoryPanel.containerNode.headerNode.playbackItems = (item, nil, nil)
- }
- let delayedStatus = self.context.sharedContext.mediaManager.globalMediaPlayerState
- |> mapToSignal { value -> Signal<(Account, SharedMediaPlayerItemPlaybackStateOrLoading, MediaManagerPlayerType)?, NoError> in
- guard let value = value else {
- return .single(nil)
- }
- switch value.1 {
- case .state:
- return .single(value)
- case .loading:
- return .single(value) |> delay(0.1, queue: .mainQueue())
- }
- }
-
- mediaAccessoryPanel.containerNode.headerNode.playbackStatus = delayedStatus
- |> map { state -> MediaPlayerStatus in
- if let stateOrLoading = state?.1, case let .state(state) = stateOrLoading {
- return state.status
- } else {
- return MediaPlayerStatus(generationTimestamp: 0.0, duration: 0.0, dimensions: CGSize(), timestamp: 0.0, baseRate: 1.0, seekId: 0, status: .paused, soundEnabled: true)
- }
- }
- } else {
- if let (mediaAccessoryPanel, _) = self.mediaAccessoryPanel {
- self.mediaAccessoryPanel = nil
- self.dismissingPanel = mediaAccessoryPanel
- self.audioRateTooltipController?.dismissWithCommitAction()
- mediaAccessoryPanel.animateOut(transition: transition, completion: { [weak self, weak mediaAccessoryPanel] in
- mediaAccessoryPanel?.removeFromSupernode()
- if let strongSelf = self, strongSelf.dismissingPanel === mediaAccessoryPanel {
- strongSelf.dismissingPanel = nil
- }
- })
- }
-
- let mediaAccessoryPanel = MediaNavigationAccessoryPanel(context: self.context, presentationData: self.updatedPresentationData.0)
- mediaAccessoryPanel.containerNode.headerNode.displayScrubber = item.playbackData?.type != .instantVideo
- mediaAccessoryPanel.getController = { [weak self] in
- return self
- }
- mediaAccessoryPanel.presentInGlobalOverlay = { [weak self] c in
- self?.presentInGlobalOverlay(c)
- }
- mediaAccessoryPanel.close = { [weak self] in
- if let strongSelf = self, let (_, _, _, _, type, _) = strongSelf.playlistStateAndType {
- strongSelf.context.sharedContext.mediaManager.setPlaylist(nil, type: type, control: SharedMediaPlayerControlAction.playback(.pause))
- }
- }
- mediaAccessoryPanel.setRate = { [weak self] rate, changeType in
- guard let strongSelf = self else {
- return
- }
- let _ = (strongSelf.context.sharedContext.accountManager.transaction { transaction -> AudioPlaybackRate in
- let settings = transaction.getSharedData(ApplicationSpecificSharedDataKeys.musicPlaybackSettings)?.get(MusicPlaybackSettings.self) ?? MusicPlaybackSettings.defaultSettings
-
- transaction.updateSharedData(ApplicationSpecificSharedDataKeys.musicPlaybackSettings, { _ in
- return PreferencesEntry(settings.withUpdatedVoicePlaybackRate(rate))
- })
- return rate
- }
- |> deliverOnMainQueue).start(next: { baseRate in
- guard let strongSelf = self, let (_, _, _, _, type, _) = strongSelf.playlistStateAndType else {
- return
- }
- strongSelf.context.sharedContext.mediaManager.playlistControl(.setBaseRate(baseRate), type: type)
-
- var hasTooltip = false
- strongSelf.forEachController({ controller in
- if let controller = controller as? UndoOverlayController {
- hasTooltip = true
- controller.dismissWithCommitAction()
- }
- return true
- })
-
- let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
- let text: String?
- let rate: CGFloat?
- if case let .sliderCommit(previousValue, newValue) = changeType {
- let value = String(format: "%0.1f", baseRate.doubleValue)
- if baseRate == .x1 {
- text = presentationData.strings.Conversation_AudioRateTooltipNormal
- } else {
- text = presentationData.strings.Conversation_AudioRateTooltipCustom(value).string
- }
- if newValue > previousValue {
- rate = .infinity
- } else if newValue < previousValue {
- rate = -.infinity
- } else {
- rate = nil
- }
- } else if baseRate == .x1 {
- text = presentationData.strings.Conversation_AudioRateTooltipNormal
- rate = 1.0
- } else if baseRate == .x1_5 {
- text = presentationData.strings.Conversation_AudioRateTooltip15X
- rate = 1.5
- } else if baseRate == .x2 {
- text = presentationData.strings.Conversation_AudioRateTooltipSpeedUp
- rate = 2.0
- } else {
- text = nil
- rate = nil
- }
- var showTooltip = true
- if case .sliderChange = changeType {
- showTooltip = false
- }
- if let rate, let text, showTooltip {
- let controller = UndoOverlayController(
- presentationData: presentationData,
- content: .audioRate(
- rate: rate,
- text: text
- ),
- elevatedLayout: false,
- animateInAsReplacement: hasTooltip,
- action: { action in
- return true
- }
- )
- strongSelf.audioRateTooltipController = controller
- strongSelf.present(controller, in: .current)
- }
- })
- }
- mediaAccessoryPanel.togglePlayPause = { [weak self] in
- if let strongSelf = self, let (_, _, _, _, type, _) = strongSelf.playlistStateAndType {
- strongSelf.context.sharedContext.mediaManager.playlistControl(.playback(.togglePlayPause), type: type)
- }
- }
- mediaAccessoryPanel.playPrevious = { [weak self] in
- if let strongSelf = self, let (_, _, _, _, type, _) = strongSelf.playlistStateAndType {
- strongSelf.context.sharedContext.mediaManager.playlistControl(.next, type: type)
- }
- }
- mediaAccessoryPanel.playNext = { [weak self] in
- if let strongSelf = self, let (_, _, _, _, type, _) = strongSelf.playlistStateAndType {
- strongSelf.context.sharedContext.mediaManager.playlistControl(.previous, type: type)
- }
- }
- mediaAccessoryPanel.tapAction = { [weak self] in
- guard let strongSelf = self, let _ = strongSelf.navigationController as? NavigationController, let (state, _, _, order, type, account) = strongSelf.playlistStateAndType else {
- return
- }
- if let id = state.id as? PeerMessagesMediaPlaylistItemId, let playlistLocation = strongSelf.playlistLocation as? PeerMessagesPlaylistLocation {
- if type == .music {
- switch playlistLocation {
- case .custom, .savedMusic:
- let controllerContext: AccountContext
- if account.id == strongSelf.context.account.id {
- controllerContext = strongSelf.context
- } else {
- controllerContext = strongSelf.context.sharedContext.makeTempAccountContext(account: account)
- }
- let controller = strongSelf.context.sharedContext.makeOverlayAudioPlayerController(context: controllerContext, chatLocation: .peer(id: id.messageId.peerId), type: type, initialMessageId: id.messageId, initialOrder: order, playlistLocation: playlistLocation, parentNavigationController: strongSelf.navigationController as? NavigationController)
- strongSelf.displayNode.view.window?.endEditing(true)
- strongSelf.present(controller, in: .window(.root))
- case let .messages(chatLocation, _, _):
- let signal = strongSelf.context.sharedContext.messageFromPreloadedChatHistoryViewForLocation(id: id.messageId, location: ChatHistoryLocationInput(content: .InitialSearch(subject: MessageHistoryInitialSearchSubject(location: .id(id.messageId)), count: 60, highlight: true, setupReply: false), id: 0), context: strongSelf.context, chatLocation: chatLocation, subject: nil, chatLocationContextHolder: Atomic(value: nil), tag: .tag(MessageTags.music))
-
- var cancelImpl: (() -> Void)?
- let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
- let progressSignal = Signal { subscriber in
- let controller = OverlayStatusController(theme: presentationData.theme, type: .loading(cancelled: {
- cancelImpl?()
- }))
- self?.present(controller, in: .window(.root))
- return ActionDisposable { [weak controller] in
- Queue.mainQueue().async() {
- controller?.dismiss()
- }
- }
- }
- |> runOn(Queue.mainQueue())
- |> delay(0.15, queue: Queue.mainQueue())
- let progressDisposable = MetaDisposable()
- var progressStarted = false
- strongSelf.playlistPreloadDisposable?.dispose()
- strongSelf.playlistPreloadDisposable = (signal
- |> afterDisposed {
- Queue.mainQueue().async {
- progressDisposable.dispose()
- }
- }
- |> deliverOnMainQueue).start(next: { index in
- guard let strongSelf = self else {
- return
- }
- if let _ = index.0 {
- let controllerContext: AccountContext
- if account.id == strongSelf.context.account.id {
- controllerContext = strongSelf.context
- } else {
- controllerContext = strongSelf.context.sharedContext.makeTempAccountContext(account: account)
- }
- let controller = strongSelf.context.sharedContext.makeOverlayAudioPlayerController(context: controllerContext, chatLocation: chatLocation, type: type, initialMessageId: id.messageId, initialOrder: order, playlistLocation: nil, parentNavigationController: strongSelf.navigationController as? NavigationController)
- strongSelf.displayNode.view.window?.endEditing(true)
- strongSelf.present(controller, in: .window(.root))
- } else if index.1 {
- if !progressStarted {
- progressStarted = true
- progressDisposable.set(progressSignal.start())
- }
- }
- }, completed: {
- })
- cancelImpl = {
- self?.playlistPreloadDisposable?.dispose()
- }
- default:
- break
- }
- } else {
- strongSelf.context.sharedContext.navigateToChat(accountId: strongSelf.context.account.id, peerId: id.messageId.peerId, messageId: id.messageId)
- }
- }
- }
- mediaAccessoryPanel.frame = panelFrame
- if let dismissingPanel = self.dismissingPanel {
- if let accessoryPanelContainer = self.accessoryPanelContainer {
- accessoryPanelContainer.insertSubnode(mediaAccessoryPanel, aboveSubnode: dismissingPanel)
- } else {
- self.navigationBar?.additionalContentNode.insertSubnode(mediaAccessoryPanel, aboveSubnode: dismissingPanel)
- }
- } else {
- if let accessoryPanelContainer = self.accessoryPanelContainer {
- accessoryPanelContainer.addSubnode(mediaAccessoryPanel)
- } else {
- self.navigationBar?.additionalContentNode.addSubnode(mediaAccessoryPanel)
- }
- }
- self.mediaAccessoryPanel = (mediaAccessoryPanel, type)
- mediaAccessoryPanel.updateLayout(size: panelFrame.size, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, isHidden: !self.displayNavigationBar, transition: .immediate)
- switch order {
- case .regular:
- mediaAccessoryPanel.containerNode.headerNode.playbackItems = (item, previousItem, nextItem)
- case .reversed:
- mediaAccessoryPanel.containerNode.headerNode.playbackItems = (item, nextItem, previousItem)
- case .random:
- mediaAccessoryPanel.containerNode.headerNode.playbackItems = (item, nil, nil)
- }
- mediaAccessoryPanel.containerNode.headerNode.playbackStatus = self.context.sharedContext.mediaManager.globalMediaPlayerState
- |> map { state -> MediaPlayerStatus in
- if let stateOrLoading = state?.1, case let .state(state) = stateOrLoading {
- return state.status
- } else {
- return MediaPlayerStatus(generationTimestamp: 0.0, duration: 0.0, dimensions: CGSize(), timestamp: 0.0, baseRate: 1.0, seekId: 0, status: .paused, soundEnabled: true)
- }
- }
- mediaAccessoryPanel.animateIn(transition: transition)
- }
- } else if let (mediaAccessoryPanel, _) = self.mediaAccessoryPanel {
- self.mediaAccessoryPanel = nil
- self.dismissingPanel = mediaAccessoryPanel
- self.audioRateTooltipController?.dismissWithCommitAction()
- mediaAccessoryPanel.animateOut(transition: transition, completion: { [weak self, weak mediaAccessoryPanel] in
- mediaAccessoryPanel?.removeFromSupernode()
- if let strongSelf = self, strongSelf.dismissingPanel === mediaAccessoryPanel {
- strongSelf.dismissingPanel = nil
- }
- })
- }
self.suspendNavigationBarLayout = false
if let suspendedNavigationBarLayout = self.suspendedNavigationBarLayout {
diff --git a/submodules/TelegramCallsUI/BUILD b/submodules/TelegramCallsUI/BUILD
index bad899d0..c771b6f4 100644
--- a/submodules/TelegramCallsUI/BUILD
+++ b/submodules/TelegramCallsUI/BUILD
@@ -115,7 +115,6 @@ swift_library(
"//submodules/TelegramUI/Components/LottieComponent",
"//submodules/TelegramUI/Components/Stories/PeerListItemComponent",
"//submodules/TelegramUI/Components/BackButtonComponent",
- "//submodules/TelegramUI/Components/AlertComponent",
"//submodules/Components/BlurredBackgroundComponent",
"//submodules/DirectMediaImageCache",
"//submodules/FastBlur",
@@ -131,6 +130,8 @@ swift_library(
"//submodules/TelegramUI/Components/EdgeEffect",
"//submodules/PremiumUI",
"//submodules/TelegramUI/Components/Calls/VideoChatMicButtonComponent",
+ "//submodules/TelegramUI/Components/AlertComponent",
+ "//submodules/TelegramUI/Components/AlertComponent/AlertInputFieldComponent",
],
visibility = [
"//visibility:public",
diff --git a/submodules/TelegramCallsUI/Sources/AccountGroupCallContextImpl.swift b/submodules/TelegramCallsUI/Sources/AccountGroupCallContextImpl.swift
index 5b348c93..44f7f27b 100644
--- a/submodules/TelegramCallsUI/Sources/AccountGroupCallContextImpl.swift
+++ b/submodules/TelegramCallsUI/Sources/AccountGroupCallContextImpl.swift
@@ -24,6 +24,46 @@ public final class AccountGroupCallContextImpl: AccountGroupCallContext {
var disposable: Disposable?
public var participantsContext: GroupCallParticipantsContext?
+ public final class GroupCallPanelData {
+ public let peerId: EnginePeer.Id
+ public let isChannel: Bool
+ public let info: GroupCallInfo
+ public let topParticipants: [GroupCallParticipantsContext.Participant]
+ public let participantCount: Int
+ public let activeSpeakers: Set
+ public let groupCall: PresentationGroupCall?
+
+ public init(
+ peerId: EnginePeer.Id,
+ isChannel: Bool,
+ info: GroupCallInfo,
+ topParticipants: [GroupCallParticipantsContext.Participant],
+ participantCount: Int,
+ activeSpeakers: Set,
+ groupCall: PresentationGroupCall?
+ ) {
+ self.peerId = peerId
+ self.isChannel = isChannel
+ self.info = info
+ self.topParticipants = topParticipants
+ self.participantCount = participantCount
+ self.activeSpeakers = activeSpeakers
+ self.groupCall = groupCall
+ }
+
+ public func withInfo(_ info: GroupCallInfo) -> GroupCallPanelData {
+ return GroupCallPanelData(
+ peerId: self.peerId,
+ isChannel: self.isChannel,
+ info: info,
+ topParticipants: self.topParticipants,
+ participantCount: self.participantCount,
+ activeSpeakers: self.activeSpeakers,
+ groupCall: self.groupCall
+ )
+ }
+ }
+
private let panelDataPromise = Promise()
public var panelData: Signal {
return self.panelDataPromise.get()
diff --git a/submodules/TelegramCallsUI/Sources/CallFeedbackController.swift b/submodules/TelegramCallsUI/Sources/CallFeedbackController.swift
index 4a47a8b8..9e8a0454 100644
--- a/submodules/TelegramCallsUI/Sources/CallFeedbackController.swift
+++ b/submodules/TelegramCallsUI/Sources/CallFeedbackController.swift
@@ -188,11 +188,11 @@ private enum CallFeedbackControllerEntry: ItemListNodeEntry {
case let .reasonsHeader(_, text):
return ItemListSectionHeaderItem(presentationData: presentationData, text: text, sectionId: self.section)
case let .reason(_, reason, title, value):
- return ItemListSwitchItem(presentationData: presentationData, title: title, value: value, maximumNumberOfLines: 2, sectionId: self.section, style: .blocks, updated: { value in
+ return ItemListSwitchItem(presentationData: presentationData, systemStyle: .glass, title: title, value: value, maximumNumberOfLines: 2, sectionId: self.section, style: .blocks, updated: { value in
arguments.toggleReason(reason, value)
})
case let .comment(_, text, placeholder):
- return ItemListMultilineInputItem(presentationData: presentationData, text: text, placeholder: placeholder, maxLength: nil, sectionId: self.section, style: .blocks, textUpdated: { updatedText in
+ return ItemListMultilineInputItem(presentationData: presentationData, systemStyle: .glass, text: text, placeholder: placeholder, maxLength: nil, sectionId: self.section, style: .blocks, textUpdated: { updatedText in
arguments.updateComment(updatedText)
}, updatedFocus: { focused in
if focused {
@@ -200,7 +200,7 @@ private enum CallFeedbackControllerEntry: ItemListNodeEntry {
}
}, tag: CallFeedbackControllerEntryTag.comment)
case let .includeLogs(_, title, value):
- return ItemListSwitchItem(presentationData: presentationData, title: title, value: value, sectionId: self.section, style: .blocks, updated: { value in
+ return ItemListSwitchItem(presentationData: presentationData, systemStyle: .glass, title: title, value: value, sectionId: self.section, style: .blocks, updated: { value in
arguments.toggleIncludeLogs(value)
})
case let .includeLogsInfo(_, text):
diff --git a/submodules/TelegramCallsUI/Sources/CallRatingController.swift b/submodules/TelegramCallsUI/Sources/CallRatingController.swift
index fa86baa0..7a086261 100644
--- a/submodules/TelegramCallsUI/Sources/CallRatingController.swift
+++ b/submodules/TelegramCallsUI/Sources/CallRatingController.swift
@@ -3,285 +3,13 @@ import UIKit
import SwiftSignalKit
import AsyncDisplayKit
import Display
+import ComponentFlow
import Postbox
import TelegramCore
import TelegramPresentationData
import TelegramVoip
import AccountContext
-import AppBundle
-
-private final class CallRatingAlertContentNode: AlertContentNode {
- private let strings: PresentationStrings
- private let apply: (Int) -> Void
-
- var rating: Int?
-
- private let titleNode: ASTextNode
- private var starContainerNode: ASDisplayNode
- private let starNodes: [ASButtonNode]
-
- private let actionNodesSeparator: ASDisplayNode
- private let actionNodes: [TextAlertContentActionNode]
- private let actionVerticalSeparators: [ASDisplayNode]
-
- private let disposable = MetaDisposable()
-
- private var validLayout: CGSize?
-
- override var dismissOnOutsideTap: Bool {
- return self.isUserInteractionEnabled
- }
-
- init(theme: AlertControllerTheme, ptheme: PresentationTheme, strings: PresentationStrings, actions: [TextAlertAction], dismiss: @escaping () -> Void, apply: @escaping (Int) -> Void) {
- self.strings = strings
- self.apply = apply
-
- self.titleNode = ASTextNode()
- self.titleNode.maximumNumberOfLines = 3
-
- self.starContainerNode = ASDisplayNode()
-
- var starNodes: [ASButtonNode] = []
- for _ in 0 ..< 5 {
- starNodes.append(ASButtonNode())
- }
- self.starNodes = starNodes
-
- self.actionNodesSeparator = ASDisplayNode()
- self.actionNodesSeparator.isLayerBacked = true
-
- self.actionNodes = actions.map { action -> TextAlertContentActionNode in
- return TextAlertContentActionNode(theme: theme, action: action)
- }
-
- var actionVerticalSeparators: [ASDisplayNode] = []
- if actions.count > 1 {
- for _ in 0 ..< actions.count - 1 {
- let separatorNode = ASDisplayNode()
- separatorNode.isLayerBacked = true
- actionVerticalSeparators.append(separatorNode)
- }
- }
- self.actionVerticalSeparators = actionVerticalSeparators
-
- super.init()
-
- self.addSubnode(self.titleNode)
-
- self.addSubnode(self.starContainerNode)
-
- for node in self.starNodes {
- node.addTarget(self, action: #selector(self.starPressed(_:)), forControlEvents: .touchDown)
- node.addTarget(self, action: #selector(self.starReleased(_:)), forControlEvents: .touchUpInside)
- self.starContainerNode.addSubnode(node)
- }
-
- self.addSubnode(self.actionNodesSeparator)
-
- for actionNode in self.actionNodes {
- self.addSubnode(actionNode)
- }
-
- for separatorNode in self.actionVerticalSeparators {
- self.addSubnode(separatorNode)
- }
-
- self.updateTheme(theme)
- }
-
- deinit {
- self.disposable.dispose()
- }
-
- override func didLoad() {
- super.didLoad()
-
- self.starContainerNode.view.addGestureRecognizer(UIPanGestureRecognizer(target: self, action: #selector(self.panGesture(_:))))
- }
-
- @objc func panGesture(_ gestureRecognizer: UIPanGestureRecognizer) {
- let location = gestureRecognizer.location(in: self.starContainerNode.view)
- var selectedNode: ASButtonNode?
- for node in self.starNodes {
- if node.frame.contains(location) {
- selectedNode = node
- break
- }
- }
- if let selectedNode = selectedNode {
- switch gestureRecognizer.state {
- case .began, .changed:
- self.starPressed(selectedNode)
- case .ended:
- self.starReleased(selectedNode)
- case .cancelled:
- self.resetStars()
- default:
- break
- }
- } else {
- self.resetStars()
- }
- }
-
- private func resetStars() {
- for i in 0 ..< self.starNodes.count {
- let node = self.starNodes[i]
- node.isSelected = false
- }
- }
-
- @objc func starPressed(_ sender: ASButtonNode) {
- if let index = self.starNodes.firstIndex(of: sender) {
- self.rating = index + 1
- for i in 0 ..< self.starNodes.count {
- let node = self.starNodes[i]
- node.isSelected = i <= index
- }
- }
- }
-
- @objc func starReleased(_ sender: ASButtonNode) {
- if let index = self.starNodes.firstIndex(of: sender) {
- self.rating = index + 1
- for i in 0 ..< self.starNodes.count {
- let node = self.starNodes[i]
- node.isSelected = i <= index
- }
- if let rating = self.rating {
- self.apply(rating)
- }
- }
- }
-
- override func updateTheme(_ theme: AlertControllerTheme) {
- self.titleNode.attributedText = NSAttributedString(string: self.strings.Calls_RatingTitle, font: Font.bold(17.0), textColor: theme.primaryColor, paragraphAlignment: .center)
-
- for node in self.starNodes {
- node.setImage(generateTintedImage(image: UIImage(bundleImageName: "Call/Star"), color: theme.accentColor), for: [])
- let highlighted = generateTintedImage(image: UIImage(bundleImageName: "Call/StarHighlighted"), color: theme.accentColor)
- node.setImage(highlighted, for: [.selected])
- node.setImage(highlighted, for: [.selected, .highlighted])
- }
-
- self.actionNodesSeparator.backgroundColor = theme.separatorColor
- for actionNode in self.actionNodes {
- actionNode.updateTheme(theme)
- }
- for separatorNode in self.actionVerticalSeparators {
- separatorNode.backgroundColor = theme.separatorColor
- }
-
- if let size = self.validLayout {
- _ = self.updateLayout(size: size, transition: .immediate)
- }
- }
-
- override func updateLayout(size: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
- var size = size
- size.width = min(size.width , 270.0)
-
- self.validLayout = size
-
- let actionButtonHeight: CGFloat = 44.0
- var minActionsWidth: CGFloat = 0.0
- let maxActionWidth: CGFloat = floor(size.width / CGFloat(self.actionNodes.count))
- let actionTitleInsets: CGFloat = 8.0
-
- var effectiveActionLayout = TextAlertContentActionLayout.horizontal
- for actionNode in self.actionNodes {
- let actionTitleSize = actionNode.titleNode.updateLayout(CGSize(width: maxActionWidth, height: actionButtonHeight))
- if case .horizontal = effectiveActionLayout, actionTitleSize.height > actionButtonHeight * 0.6667 {
- effectiveActionLayout = .vertical
- }
- switch effectiveActionLayout {
- case .horizontal:
- minActionsWidth += actionTitleSize.width + actionTitleInsets
- case .vertical:
- minActionsWidth = max(minActionsWidth, actionTitleSize.width + actionTitleInsets)
- }
- }
-
- let insets = UIEdgeInsets(top: 18.0, left: 18.0, bottom: 18.0, right: 18.0)
-
- var origin: CGPoint = CGPoint(x: 0.0, y: 20.0)
- let titleSize = self.titleNode.measure(CGSize(width: size.width - 32.0, height: size.height))
-
- var contentWidth = max(titleSize.width, minActionsWidth)
- contentWidth = max(contentWidth, 234.0)
-
- var actionsHeight: CGFloat = 0.0
- switch effectiveActionLayout {
- case .horizontal:
- actionsHeight = actionButtonHeight
- case .vertical:
- actionsHeight = actionButtonHeight * CGFloat(self.actionNodes.count)
- }
-
- let resultWidth = contentWidth + insets.left + insets.right
-
- transition.updateFrame(node: self.titleNode, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((resultWidth - titleSize.width) / 2.0), y: origin.y), size: titleSize))
- origin.y += titleSize.height + 13.0
-
- let starSize = CGSize(width: 42.0, height: 38.0)
- let starsOrigin = floorToScreenPixels((resultWidth - starSize.width * 5.0) / 2.0)
- self.starContainerNode.frame = CGRect(origin: CGPoint(x: starsOrigin, y: origin.y), size: CGSize(width: starSize.width * CGFloat(self.starNodes.count), height: starSize.height))
- for i in 0 ..< self.starNodes.count {
- let node = self.starNodes[i]
- transition.updateFrame(node: node, frame: CGRect(x: starSize.width * CGFloat(i), y: 0.0, width: starSize.width, height: starSize.height))
- }
- origin.y += titleSize.height
-
- let resultSize = CGSize(width: resultWidth, height: titleSize.height + actionsHeight + 56.0 + insets.top + insets.bottom)
-
- transition.updateFrame(node: self.actionNodesSeparator, frame: CGRect(origin: CGPoint(x: 0.0, y: resultSize.height - actionsHeight - UIScreenPixel), size: CGSize(width: resultSize.width, height: UIScreenPixel)))
-
- var actionOffset: CGFloat = 0.0
- let actionWidth: CGFloat = floor(resultSize.width / CGFloat(self.actionNodes.count))
- var separatorIndex = -1
- var nodeIndex = 0
- for actionNode in self.actionNodes {
- if separatorIndex >= 0 {
- let separatorNode = self.actionVerticalSeparators[separatorIndex]
- switch effectiveActionLayout {
- case .horizontal:
- transition.updateFrame(node: separatorNode, frame: CGRect(origin: CGPoint(x: actionOffset - UIScreenPixel, y: resultSize.height - actionsHeight), size: CGSize(width: UIScreenPixel, height: actionsHeight - UIScreenPixel)))
- case .vertical:
- transition.updateFrame(node: separatorNode, frame: CGRect(origin: CGPoint(x: 0.0, y: resultSize.height - actionsHeight + actionOffset - UIScreenPixel), size: CGSize(width: resultSize.width, height: UIScreenPixel)))
- }
- }
- separatorIndex += 1
-
- let currentActionWidth: CGFloat
- switch effectiveActionLayout {
- case .horizontal:
- if nodeIndex == self.actionNodes.count - 1 {
- currentActionWidth = resultSize.width - actionOffset
- } else {
- currentActionWidth = actionWidth
- }
- case .vertical:
- currentActionWidth = resultSize.width
- }
-
- let actionNodeFrame: CGRect
- switch effectiveActionLayout {
- case .horizontal:
- actionNodeFrame = CGRect(origin: CGPoint(x: actionOffset, y: resultSize.height - actionsHeight), size: CGSize(width: currentActionWidth, height: actionButtonHeight))
- actionOffset += currentActionWidth
- case .vertical:
- actionNodeFrame = CGRect(origin: CGPoint(x: 0.0, y: resultSize.height - actionsHeight + actionOffset), size: CGSize(width: currentActionWidth, height: actionButtonHeight))
- actionOffset += actionButtonHeight
- }
-
- transition.updateFrame(node: actionNode, frame: actionNodeFrame)
-
- nodeIndex += 1
- }
-
- return resultSize
- }
-}
+import AlertComponent
func rateCallAndSendLogs(engine: TelegramEngine, callId: CallId, starsCount: Int, comment: String, userInitiated: Bool, includeLogs: Bool) -> Signal {
let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(4244000))
@@ -309,35 +37,199 @@ func rateCallAndSendLogs(engine: TelegramEngine, callId: CallId, starsCount: Int
}
}
-public func callRatingController(sharedContext: SharedAccountContext, account: Account, callId: CallId, userInitiated: Bool, isVideo: Bool, present: @escaping (ViewController, Any) -> Void, push: @escaping (ViewController) -> Void) -> AlertController {
- let presentationData = sharedContext.currentPresentationData.with { $0 }
- let theme = presentationData.theme
- let strings = presentationData.strings
+public func callRatingController(
+ sharedContext: SharedAccountContext,
+ account: Account,
+ callId: CallId,
+ userInitiated: Bool,
+ isVideo: Bool,
+ present: @escaping (ViewController, Any) -> Void,
+ push: @escaping (ViewController) -> Void
+) -> ViewController {
+ let strings = sharedContext.currentPresentationData.with { $0 }.strings
- var dismissImpl: ((Bool) -> Void)?
- var contentNode: CallRatingAlertContentNode?
- let actions: [TextAlertAction] = [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_NotNow, action: {
- dismissImpl?(true)
- })]
+ var dismissImpl: (() -> Void)?
- contentNode = CallRatingAlertContentNode(theme: AlertControllerTheme(presentationData: presentationData), ptheme: theme, strings: strings, actions: actions, dismiss: {
- dismissImpl?(true)
- }, apply: { rating in
- dismissImpl?(true)
- if rating < 4 {
- push(callFeedbackController(sharedContext: sharedContext, account: account, callId: callId, rating: rating, userInitiated: userInitiated, isVideo: isVideo))
- } else {
- let _ = rateCallAndSendLogs(engine: TelegramEngine(account: account), callId: callId, starsCount: rating, comment: "", userInitiated: userInitiated, includeLogs: false).start()
+ var content: [AnyComponentWithIdentity] = []
+ content.append(AnyComponentWithIdentity(
+ id: "title",
+ component: AnyComponent(
+ AlertTitleComponent(
+ title: strings.Calls_RatingTitle,
+ alignment: .center
+ )
+ )
+ ))
+ content.append(AnyComponentWithIdentity(
+ id: "stars",
+ component: AnyComponent(
+ AlertCallRatingComponent(completion: { rating in
+ dismissImpl?()
+ if rating < 4 {
+ push(callFeedbackController(sharedContext: sharedContext, account: account, callId: callId, rating: rating, userInitiated: userInitiated, isVideo: isVideo))
+ } else {
+ let _ = rateCallAndSendLogs(engine: TelegramEngine(account: account), callId: callId, starsCount: rating, comment: "", userInitiated: userInitiated, includeLogs: false).start()
+ }
+ })
+ )
+ ))
+
+ let alertController = AlertScreen(
+ sharedContext: sharedContext,
+ content: content,
+ actions: [
+ .init(title: strings.Common_NotNow)
+ ]
+ )
+
+ dismissImpl = { [weak alertController] in
+ alertController?.dismiss(completion: nil)
+ }
+
+ return alertController
+}
+
+private final class AlertCallRatingComponent: Component {
+ public typealias EnvironmentType = AlertComponentEnvironment
+
+ private let completion: (Int) -> Void
+
+ public init(completion: @escaping (Int) -> Void) {
+ self.completion = completion
+ }
+
+ public static func ==(lhs: AlertCallRatingComponent, rhs: AlertCallRatingComponent) -> Bool {
+ return true
+ }
+
+ public final class View: UIView {
+ private var containerView: UIView
+ private let starButtons: [HighlightTrackingButton]
+
+ var rating: Int?
+
+ private var component: AlertCallRatingComponent?
+ private weak var state: EmptyComponentState?
+
+ public override init(frame: CGRect) {
+ self.containerView = UIView()
+
+ var starButtons: [HighlightTrackingButton] = []
+ for _ in 0 ..< 5 {
+ starButtons.append(HighlightTrackingButton())
+ }
+ self.starButtons = starButtons
+
+ super.init(frame: frame)
+
+ self.addSubview(self.containerView)
+
+ for button in self.starButtons {
+ button.addTarget(self, action: #selector(self.starPressed(_:)), for: .touchDown)
+ button.addTarget(self, action: #selector(self.starReleased(_:)), for: .touchUpInside)
+ self.containerView.addSubview(button)
+ }
+
+ self.containerView.addGestureRecognizer(UIPanGestureRecognizer(target: self, action: #selector(self.panGesture(_:))))
}
- })
-
- let controller = AlertController(theme: AlertControllerTheme(presentationData: presentationData), contentNode: contentNode!)
- dismissImpl = { [weak controller] animated in
- if animated {
- controller?.dismissAnimated()
- } else {
- controller?.dismiss()
+
+ public required init?(coder: NSCoder) {
+ preconditionFailure()
+ }
+
+ @objc func panGesture(_ gestureRecognizer: UIPanGestureRecognizer) {
+ let location = gestureRecognizer.location(in: self.containerView)
+ var selectedButton: HighlightTrackingButton?
+ for button in self.starButtons {
+ if button.frame.contains(location) {
+ selectedButton = button
+ break
+ }
+ }
+ if let selectedButton = selectedButton {
+ switch gestureRecognizer.state {
+ case .began, .changed:
+ self.starPressed(selectedButton)
+ case .ended:
+ self.starReleased(selectedButton)
+ case .cancelled:
+ self.resetStars()
+ default:
+ break
+ }
+ } else {
+ self.resetStars()
+ }
+ }
+
+ private func resetStars() {
+ for i in 0 ..< self.starButtons.count {
+ let node = self.starButtons[i]
+ node.isSelected = false
+ }
+ }
+
+ @objc func starPressed(_ sender: HighlightTrackingButton) {
+ if let index = self.starButtons.firstIndex(of: sender) {
+ self.rating = index + 1
+ for i in 0 ..< self.starButtons.count {
+ let node = self.starButtons[i]
+ node.isSelected = i <= index
+ }
+ }
+ }
+
+ @objc func starReleased(_ sender: HighlightTrackingButton) {
+ guard let component = self.component else {
+ return
+ }
+ if let index = self.starButtons.firstIndex(of: sender) {
+ self.rating = index + 1
+ for i in 0 ..< self.starButtons.count {
+ let node = self.starButtons[i]
+ node.isSelected = i <= index
+ }
+ if let rating = self.rating {
+ component.completion(rating)
+ }
+ }
+ }
+
+ func update(component: AlertCallRatingComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment, transition: ComponentTransition) -> CGSize {
+ if self.component == nil {
+ for i in 0 ..< self.starButtons.count {
+ let button = self.starButtons[i]
+ button.setImage(UIImage(bundleImageName: "Call/Star")?.withRenderingMode(.alwaysTemplate), for: .normal)
+ button.setImage(UIImage(bundleImageName: "Call/StarHighlighted")?.withRenderingMode(.alwaysTemplate), for: .selected)
+ button.setImage(UIImage(bundleImageName: "Call/StarHighlighted")?.withRenderingMode(.alwaysTemplate), for: [.selected, .highlighted])
+ }
+ }
+
+ self.component = component
+ self.state = state
+
+ let environment = environment[AlertComponentEnvironment.self]
+
+ let buttonCount = CGFloat(self.starButtons.count)
+ let starSize = CGSize(width: 42.0, height: 38.0)
+ let starsOrigin = floorToScreenPixels((availableSize.width - starSize.width * buttonCount) / 2.0)
+ self.containerView.frame = CGRect(origin: CGPoint(x: starsOrigin, y: 0.0), size: CGSize(width: starSize.width * buttonCount, height: starSize.height))
+ for i in 0 ..< self.starButtons.count {
+ let button = self.starButtons[i]
+ button.imageView?.tintColor = environment.theme.actionSheet.controlAccentColor
+
+ transition.setFrame(view: button, frame: CGRect(x: starSize.width * CGFloat(i), y: 0.0, width: starSize.width, height: starSize.height))
+ }
+
+ return CGSize(width: availableSize.width, height: 38.0)
}
}
- return controller
+
+ public func makeView() -> View {
+ return View(frame: CGRect())
+ }
+
+ public func update(view: View, availableSize: CGSize, state: EmptyComponentState, environment: Environment, transition: ComponentTransition) -> CGSize {
+ return view.update(component: self, availableSize: availableSize, state: state, environment: environment, transition: transition)
+ }
}
diff --git a/submodules/TelegramCallsUI/Sources/CallStatusBarNode.swift b/submodules/TelegramCallsUI/Sources/CallStatusBarNode.swift
index e40dafcf..04529dbe 100644
--- a/submodules/TelegramCallsUI/Sources/CallStatusBarNode.swift
+++ b/submodules/TelegramCallsUI/Sources/CallStatusBarNode.swift
@@ -22,6 +22,22 @@ private let pink = UIColor(rgb: 0xef436c)
private let latePurple = UIColor(rgb: 0xaa56a6)
private let latePink = UIColor(rgb: 0xef476f)
+private func textForTimeout(value: Int32) -> String {
+ if value < 3600 {
+ let minutes = value / 60
+ let seconds = value % 60
+ let secondsPadding = seconds < 10 ? "0" : ""
+ return "\(minutes):\(secondsPadding)\(seconds)"
+ } else {
+ let hours = value / 3600
+ let minutes = (value % 3600) / 60
+ let minutesPadding = minutes < 10 ? "0" : ""
+ let seconds = value % 60
+ let secondsPadding = seconds < 10 ? "0" : ""
+ return "\(hours):\(minutesPadding)\(minutes):\(secondsPadding)\(seconds)"
+ }
+}
+
private class CallStatusBarBackgroundNode: ASDisplayNode {
enum State {
case connecting
diff --git a/submodules/TelegramCallsUI/Sources/CallSuggestTabController.swift b/submodules/TelegramCallsUI/Sources/CallSuggestTabController.swift
index 2d3cfa22..cfb4c157 100644
--- a/submodules/TelegramCallsUI/Sources/CallSuggestTabController.swift
+++ b/submodules/TelegramCallsUI/Sources/CallSuggestTabController.swift
@@ -3,237 +3,117 @@ import UIKit
import SwiftSignalKit
import AsyncDisplayKit
import Display
-import Postbox
import TelegramCore
import TelegramPresentationData
import TelegramUIPreferences
import AccountContext
import AppBundle
+import ComponentFlow
+import AlertComponent
+import BundleIconComponent
-private final class CallSuggestTabAlertContentNode: AlertContentNode {
- private let strings: PresentationStrings
+public func callSuggestTabController(sharedContext: SharedAccountContext) -> ViewController {
+ let strings = sharedContext.currentPresentationData.with { $0 }.strings
+
+ var content: [AnyComponentWithIdentity] = []
+ content.append(AnyComponentWithIdentity(
+ id: "header",
+ component: AnyComponent(
+ AlertCallSuggestHeaderComponent()
+ )
+ ))
+ content.append(AnyComponentWithIdentity(
+ id: "title",
+ component: AnyComponent(
+ AlertTitleComponent(title: strings.Calls_CallTabTitle)
+ )
+ ))
+ content.append(AnyComponentWithIdentity(
+ id: "text",
+ component: AnyComponent(
+ AlertTextComponent(content: .plain(strings.Calls_CallTabDescription))
+ )
+ ))
- private let titleNode: ASTextNode
- private let textNode: ASTextNode
- private let iconNode: ASImageNode
- private let accentIconNode: ASImageNode
-
- private let actionNodesSeparator: ASDisplayNode
- private let actionNodes: [TextAlertContentActionNode]
- private let actionVerticalSeparators: [ASDisplayNode]
-
- private var validLayout: CGSize?
-
- override var dismissOnOutsideTap: Bool {
- return self.isUserInteractionEnabled
+ let alertController = AlertScreen(
+ sharedContext: sharedContext,
+ content: content,
+ actions: [
+ .init(title: strings.Common_NotNow),
+ .init(title: strings.Calls_AddTab, type: .default, action: {
+ let _ = updateCallListSettingsInteractively(accountManager: sharedContext.accountManager, {
+ $0.withUpdatedShowTab(true)
+ }).start()
+ })
+ ]
+ )
+ return alertController
+}
+
+private final class AlertCallSuggestHeaderComponent: Component {
+ public typealias EnvironmentType = AlertComponentEnvironment
+
+ public init() {
}
- init(theme: AlertControllerTheme, ptheme: PresentationTheme, strings: PresentationStrings, actions: [TextAlertAction]) {
- self.strings = strings
-
- self.titleNode = ASTextNode()
- self.titleNode.maximumNumberOfLines = 2
-
- self.textNode = ASTextNode()
- self.textNode.maximumNumberOfLines = 0
-
- self.iconNode = ASImageNode()
- self.iconNode.displaysAsynchronously = false
- self.iconNode.displayWithoutProcessing = true
-
- self.accentIconNode = ASImageNode()
- self.accentIconNode.displaysAsynchronously = false
- self.accentIconNode.displayWithoutProcessing = true
-
- self.actionNodesSeparator = ASDisplayNode()
- self.actionNodesSeparator.isLayerBacked = true
-
- self.actionNodes = actions.map { action -> TextAlertContentActionNode in
- return TextAlertContentActionNode(theme: theme, action: action)
- }
-
- var actionVerticalSeparators: [ASDisplayNode] = []
- if actions.count > 1 {
- for _ in 0 ..< actions.count - 1 {
- let separatorNode = ASDisplayNode()
- separatorNode.isLayerBacked = true
- actionVerticalSeparators.append(separatorNode)
- }
- }
- self.actionVerticalSeparators = actionVerticalSeparators
-
- super.init()
-
- self.addSubnode(self.titleNode)
- self.addSubnode(self.textNode)
- self.addSubnode(self.iconNode)
- self.addSubnode(self.accentIconNode)
-
- self.addSubnode(self.actionNodesSeparator)
-
- for actionNode in self.actionNodes {
- self.addSubnode(actionNode)
- }
-
- for separatorNode in self.actionVerticalSeparators {
- self.addSubnode(separatorNode)
- }
-
- self.updateTheme(theme)
+ public static func ==(lhs: AlertCallSuggestHeaderComponent, rhs: AlertCallSuggestHeaderComponent) -> Bool {
+ return true
}
- override func updateTheme(_ theme: AlertControllerTheme) {
- self.titleNode.attributedText = NSAttributedString(string: strings.Calls_CallTabTitle, font: Font.bold(17.0), textColor: theme.primaryColor, paragraphAlignment: .center)
- self.textNode.attributedText = NSAttributedString(string: strings.Calls_CallTabDescription, font: Font.regular(13.0), textColor: theme.primaryColor, paragraphAlignment: .center)
- self.iconNode.image = generateTintedImage(image: UIImage(bundleImageName: "Call List/AlertIcon"), color: theme.controlBorderColor)
- self.accentIconNode.image = generateTintedImage(image: UIImage(bundleImageName: "Call List/AlertAccentIcon"), color: theme.accentColor)
+ public final class View: UIView {
+ private let image = ComponentView()
+ private let accentImage = ComponentView()
- self.actionNodesSeparator.backgroundColor = theme.separatorColor
- for actionNode in self.actionNodes {
- actionNode.updateTheme(theme)
- }
- for separatorNode in self.actionVerticalSeparators {
- separatorNode.backgroundColor = theme.separatorColor
- }
+ private var component: AlertCallSuggestHeaderComponent?
+ private weak var state: EmptyComponentState?
- if let size = self.validLayout {
- _ = self.updateLayout(size: size, transition: .immediate)
- }
- }
-
- override func updateLayout(size: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
- var size = size
- size.width = min(size.width , 270.0)
-
- self.validLayout = size
-
- var origin: CGPoint = CGPoint(x: 0.0, y: 20.0)
-
- let titleSize = self.titleNode.measure(size)
- transition.updateFrame(node: self.titleNode, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - titleSize.width) / 2.0), y: origin.y), size: titleSize))
- origin.y += titleSize.height + 13.0
-
- var iconSize = CGSize()
- if let icon = self.iconNode.image {
- iconSize = icon.size
- let iconFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - iconSize.width) / 2.0), y: origin.y), size: iconSize)
- transition.updateFrame(node: self.iconNode, frame: iconFrame)
- transition.updateFrame(node: self.accentIconNode, frame: iconFrame)
- origin.y += iconSize.height + 16.0
- }
-
- let textSize = self.textNode.measure(size)
- transition.updateFrame(node: self.textNode, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - textSize.width) / 2.0), y: origin.y), size: textSize))
-
- let actionButtonHeight: CGFloat = 44.0
- var minActionsWidth: CGFloat = 0.0
- let maxActionWidth: CGFloat = floor(size.width / CGFloat(self.actionNodes.count))
- let actionTitleInsets: CGFloat = 8.0
-
- var effectiveActionLayout = TextAlertContentActionLayout.horizontal
- for actionNode in self.actionNodes {
- let actionTitleSize = actionNode.titleNode.updateLayout(CGSize(width: maxActionWidth, height: actionButtonHeight))
- if case .horizontal = effectiveActionLayout, actionTitleSize.height > actionButtonHeight * 0.6667 {
- effectiveActionLayout = .vertical
- }
- switch effectiveActionLayout {
- case .horizontal:
- minActionsWidth += actionTitleSize.width + actionTitleInsets
- case .vertical:
- minActionsWidth = max(minActionsWidth, actionTitleSize.width + actionTitleInsets)
- }
- }
-
- let insets = UIEdgeInsets(top: 18.0, left: 18.0, bottom: 18.0, right: 18.0)
-
- var contentWidth = max(titleSize.width, minActionsWidth)
- contentWidth = max(contentWidth, 234.0)
-
- var actionsHeight: CGFloat = 0.0
- switch effectiveActionLayout {
- case .horizontal:
- actionsHeight = actionButtonHeight
- case .vertical:
- actionsHeight = actionButtonHeight * CGFloat(self.actionNodes.count)
- }
-
- let resultWidth = contentWidth + insets.left + insets.right
- let resultSize = CGSize(width: resultWidth, height: titleSize.height + iconSize.height + textSize.height + actionsHeight + 34.0 + insets.top + insets.bottom)
-
- transition.updateFrame(node: self.actionNodesSeparator, frame: CGRect(origin: CGPoint(x: 0.0, y: resultSize.height - actionsHeight - UIScreenPixel), size: CGSize(width: resultSize.width, height: UIScreenPixel)))
-
- var actionOffset: CGFloat = 0.0
- let actionWidth: CGFloat = floor(resultSize.width / CGFloat(self.actionNodes.count))
- var separatorIndex = -1
- var nodeIndex = 0
- for actionNode in self.actionNodes {
- if separatorIndex >= 0 {
- let separatorNode = self.actionVerticalSeparators[separatorIndex]
- switch effectiveActionLayout {
- case .horizontal:
- transition.updateFrame(node: separatorNode, frame: CGRect(origin: CGPoint(x: actionOffset - UIScreenPixel, y: resultSize.height - actionsHeight), size: CGSize(width: UIScreenPixel, height: actionsHeight - UIScreenPixel)))
- case .vertical:
- transition.updateFrame(node: separatorNode, frame: CGRect(origin: CGPoint(x: 0.0, y: resultSize.height - actionsHeight + actionOffset - UIScreenPixel), size: CGSize(width: resultSize.width, height: UIScreenPixel)))
+ func update(component: AlertCallSuggestHeaderComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment, transition: ComponentTransition) -> CGSize {
+ self.component = component
+ self.state = state
+
+ let environment = environment[AlertComponentEnvironment.self]
+
+ let imageSize = self.image.update(
+ transition: .immediate,
+ component: AnyComponent(
+ BundleIconComponent(name: "Call List/AlertIcon", tintColor: environment.theme.actionSheet.primaryTextColor.withMultipliedAlpha(0.2))
+ ),
+ environment: {},
+ containerSize: availableSize
+ )
+ let imageFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((availableSize.width - imageSize.width) / 2.0), y: 0.0), size: imageSize)
+ if let imageView = self.image.view {
+ if imageView.superview == nil {
+ self.addSubview(imageView)
}
- }
- separatorIndex += 1
-
- let currentActionWidth: CGFloat
- switch effectiveActionLayout {
- case .horizontal:
- if nodeIndex == self.actionNodes.count - 1 {
- currentActionWidth = resultSize.width - actionOffset
- } else {
- currentActionWidth = actionWidth
- }
- case .vertical:
- currentActionWidth = resultSize.width
+ imageView.frame = imageFrame
}
- let actionNodeFrame: CGRect
- switch effectiveActionLayout {
- case .horizontal:
- actionNodeFrame = CGRect(origin: CGPoint(x: actionOffset, y: resultSize.height - actionsHeight), size: CGSize(width: currentActionWidth, height: actionButtonHeight))
- actionOffset += currentActionWidth
- case .vertical:
- actionNodeFrame = CGRect(origin: CGPoint(x: 0.0, y: resultSize.height - actionsHeight + actionOffset), size: CGSize(width: currentActionWidth, height: actionButtonHeight))
- actionOffset += actionButtonHeight
+ let _ = self.accentImage.update(
+ transition: .immediate,
+ component: AnyComponent(
+ BundleIconComponent(name: "Call List/AlertAccentIcon", tintColor: environment.theme.actionSheet.controlAccentColor)
+ ),
+ environment: {},
+ containerSize: availableSize
+ )
+ let accentImageFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((availableSize.width - imageSize.width) / 2.0), y: 0.0), size: imageSize)
+ if let accentImageView = self.accentImage.view {
+ if accentImageView.superview == nil {
+ self.addSubview(accentImageView)
+ }
+ accentImageView.frame = accentImageFrame
}
- transition.updateFrame(node: actionNode, frame: actionNodeFrame)
-
- nodeIndex += 1
- }
-
- return resultSize
- }
-}
-
-func callSuggestTabController(sharedContext: SharedAccountContext) -> AlertController {
- let presentationData = sharedContext.currentPresentationData.with { $0 }
- let theme = presentationData.theme
- let strings = presentationData.strings
-
- var dismissImpl: ((Bool) -> Void)?
- var contentNode: CallSuggestTabAlertContentNode?
- let actions: [TextAlertAction] = [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_NotNow, action: {
- dismissImpl?(true)
- }), TextAlertAction(type: .defaultAction, title: presentationData.strings.Calls_AddTab, action: {
- dismissImpl?(true)
- let _ = updateCallListSettingsInteractively(accountManager: sharedContext.accountManager, {
- $0.withUpdatedShowTab(true)
- }).start()
- })]
-
- contentNode = CallSuggestTabAlertContentNode(theme: AlertControllerTheme(presentationData: presentationData), ptheme: theme, strings: strings, actions: actions)
-
- let controller = AlertController(theme: AlertControllerTheme(presentationData: presentationData), contentNode: contentNode!)
- dismissImpl = { [weak controller] animated in
- if animated {
- controller?.dismissAnimated()
- } else {
- controller?.dismiss()
+ return CGSize(width: availableSize.width, height: imageSize.height)
}
}
- return controller
+
+ public func makeView() -> View {
+ return View(frame: CGRect())
+ }
+
+ public func update(view: View, availableSize: CGSize, state: EmptyComponentState, environment: Environment, transition: ComponentTransition) -> CGSize {
+ return view.update(component: self, availableSize: availableSize, state: state, environment: environment, transition: transition)
+ }
}
diff --git a/submodules/TelegramCallsUI/Sources/Components/MediaStreamComponent.swift b/submodules/TelegramCallsUI/Sources/Components/MediaStreamComponent.swift
index 5edc8d27..3a62b8af 100644
--- a/submodules/TelegramCallsUI/Sources/Components/MediaStreamComponent.swift
+++ b/submodules/TelegramCallsUI/Sources/Components/MediaStreamComponent.swift
@@ -508,7 +508,7 @@ public final class MediaStreamComponent: CombinedComponent {
let title: String = presentationData.strings.LiveStream_EditTitle
let text: String = presentationData.strings.LiveStream_EditTitleText
- let editController = voiceChatTitleEditController(sharedContext: call.accountContext.sharedContext, account: call.accountContext.account, forceTheme: defaultDarkPresentationTheme, title: title, text: text, placeholder: EnginePeer(chatPeer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), value: initialTitle, maxLength: 40, apply: { [weak call] title in
+ let editController = voiceChatTitleEditController(context: call.accountContext, forceTheme: defaultDarkPresentationTheme, title: title, text: text, placeholder: EnginePeer(chatPeer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), value: initialTitle, maxLength: 40, apply: { [weak call] title in
guard let call = call else {
return
}
@@ -574,7 +574,7 @@ public final class MediaStreamComponent: CombinedComponent {
title = presentationData.strings.LiveStream_StartRecordingTitle
text = presentationData.strings.LiveStream_StartRecordingTextVideo
- let editController = voiceChatTitleEditController(sharedContext: call.accountContext.sharedContext, account: call.accountContext.account, forceTheme: defaultDarkPresentationTheme, title: title, text: text, placeholder: placeholder, value: nil, maxLength: 40, apply: { [weak call, weak controller] title in
+ let editController = voiceChatTitleEditController(context: call.accountContext, forceTheme: defaultDarkPresentationTheme, title: title, text: text, placeholder: placeholder, value: nil, maxLength: 40, apply: { [weak call, weak controller] title in
guard let call = call, let controller = controller else {
return
}
diff --git a/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift b/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift
index fc1fac25..4cb912c6 100644
--- a/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift
+++ b/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift
@@ -10,6 +10,7 @@ import TelegramVoip
import TelegramAudio
import TelegramUIPreferences
import TelegramPresentationData
+import PresentationDataUtils
import DeviceAccess
import UniversalMediaPlayer
import AccountContext
@@ -2134,12 +2135,12 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
}
if case .anonymousNotAllowed = error {
let presentationData = self.accountContext.sharedContext.currentPresentationData.with { $0 }
- self.accountContext.sharedContext.mainWindow?.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: nil, text: self.isChannel ? presentationData.strings.LiveStream_AnonymousDisabledAlertText : presentationData.strings.VoiceChat_AnonymousDisabledAlertText, actions: [
+ self.accountContext.sharedContext.mainWindow?.present(textAlertController(context: self.accountContext, title: nil, text: self.isChannel ? presentationData.strings.LiveStream_AnonymousDisabledAlertText : presentationData.strings.VoiceChat_AnonymousDisabledAlertText, actions: [
TextAlertAction(type: .genericAction, title: presentationData.strings.Common_OK, action: {})
]), on: .root, blockInteraction: false, completion: {})
} else if case .tooManyParticipants = error {
let presentationData = self.accountContext.sharedContext.currentPresentationData.with { $0 }
- self.accountContext.sharedContext.mainWindow?.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: nil, text: self.isChannel ? presentationData.strings.LiveStream_ChatFullAlertText : presentationData.strings.VoiceChat_ChatFullAlertText, actions: [
+ self.accountContext.sharedContext.mainWindow?.present(textAlertController(context: self.accountContext, title: nil, text: self.isChannel ? presentationData.strings.LiveStream_ChatFullAlertText : presentationData.strings.VoiceChat_ChatFullAlertText, actions: [
TextAlertAction(type: .genericAction, title: presentationData.strings.Common_OK, action: {})
]), on: .root, blockInteraction: false, completion: {})
} else if case .invalidJoinAsPeer = error {
@@ -3805,7 +3806,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
break
}
- self.accountContext.sharedContext.mainWindow?.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: nil, text: errorText, actions: [
+ self.accountContext.sharedContext.mainWindow?.present(textAlertController(context: self.accountContext, title: nil, text: errorText, actions: [
TextAlertAction(type: .genericAction, title: presentationData.strings.Common_OK, action: {})
]), on: .root, blockInteraction: false, completion: {})
}
diff --git a/submodules/TelegramCallsUI/Sources/VideoChatScheduledInfoComponent.swift b/submodules/TelegramCallsUI/Sources/VideoChatScheduledInfoComponent.swift
index c9ae7d1d..1143f2ea 100644
--- a/submodules/TelegramCallsUI/Sources/VideoChatScheduledInfoComponent.swift
+++ b/submodules/TelegramCallsUI/Sources/VideoChatScheduledInfoComponent.swift
@@ -13,6 +13,22 @@ private let pink = UIColor(rgb: 0xef436c)
private let latePurple = UIColor(rgb: 0x974aa9)
private let latePink = UIColor(rgb: 0xf0436c)
+private func textForTimeout(value: Int32) -> String {
+ if value < 3600 {
+ let minutes = value / 60
+ let seconds = value % 60
+ let secondsPadding = seconds < 10 ? "0" : ""
+ return "\(minutes):\(secondsPadding)\(seconds)"
+ } else {
+ let hours = value / 3600
+ let minutes = (value % 3600) / 60
+ let minutesPadding = minutes < 10 ? "0" : ""
+ let seconds = value % 60
+ let secondsPadding = seconds < 10 ? "0" : ""
+ return "\(hours):\(minutesPadding)\(minutes):\(secondsPadding)\(seconds)"
+ }
+}
+
final class VideoChatScheduledInfoComponent: Component {
let timestamp: Int32
let strings: PresentationStrings
diff --git a/submodules/TelegramCallsUI/Sources/VideoChatScreen.swift b/submodules/TelegramCallsUI/Sources/VideoChatScreen.swift
index b5146f66..fcf96a12 100644
--- a/submodules/TelegramCallsUI/Sources/VideoChatScreen.swift
+++ b/submodules/TelegramCallsUI/Sources/VideoChatScreen.swift
@@ -691,7 +691,7 @@ final class VideoChatScreenComponent: Component {
text = environment.strings.VoiceChat_EditTitleText
}
- let controller = voiceChatTitleEditController(sharedContext: groupCall.accountContext.sharedContext, account: groupCall.accountContext.account, forceTheme: environment.theme, title: title, text: text, placeholder: EnginePeer(chatPeer).displayTitle(strings: environment.strings, displayOrder: groupCall.accountContext.sharedContext.currentPresentationData.with({ $0 }).nameDisplayOrder), value: initialTitle, maxLength: 40, apply: { [weak self] title in
+ let controller = voiceChatTitleEditController(context: groupCall.accountContext, forceTheme: environment.theme, title: title, text: text, placeholder: EnginePeer(chatPeer).displayTitle(strings: environment.strings, displayOrder: groupCall.accountContext.sharedContext.currentPresentationData.with({ $0 }).nameDisplayOrder), value: initialTitle, maxLength: 40, apply: { [weak self] title in
guard let self, let environment = self.environment, case let .group(groupCall) = self.currentCall else {
return
}
@@ -3448,7 +3448,6 @@ final class VideoChatScreenComponent: Component {
pendingUnpinnedAllMessages: false,
activeGroupCallInfo: nil,
hasActiveGroupCall: false,
- importState: nil,
threadData: nil,
isGeneralThreadClosed: nil,
replyMessage: nil,
diff --git a/submodules/TelegramCallsUI/Sources/VideoChatScreenMoreMenu.swift b/submodules/TelegramCallsUI/Sources/VideoChatScreenMoreMenu.swift
index e77e72bf..fed8bd66 100644
--- a/submodules/TelegramCallsUI/Sources/VideoChatScreenMoreMenu.swift
+++ b/submodules/TelegramCallsUI/Sources/VideoChatScreenMoreMenu.swift
@@ -469,7 +469,7 @@ extension VideoChatScreenComponent.View {
}
}
- let controller = voiceChatTitleEditController(sharedContext: currentCall.accountContext.sharedContext, account: currentCall.accountContext.account, forceTheme: environment.theme, title: title, text: text, placeholder: placeholder, value: nil, maxLength: 40, apply: { [weak self] title in
+ let controller = voiceChatTitleEditController(context: currentCall.accountContext, forceTheme: environment.theme, title: title, text: text, placeholder: placeholder, value: nil, maxLength: 40, apply: { [weak self] title in
guard let self, let environment = self.environment, case let .group(groupCall) = self.currentCall, let peer = self.peer, let title else {
return
}
diff --git a/submodules/TelegramCallsUI/Sources/VideoChatScreenParticipantContextMenu.swift b/submodules/TelegramCallsUI/Sources/VideoChatScreenParticipantContextMenu.swift
index dff33a3b..3b031887 100644
--- a/submodules/TelegramCallsUI/Sources/VideoChatScreenParticipantContextMenu.swift
+++ b/submodules/TelegramCallsUI/Sources/VideoChatScreenParticipantContextMenu.swift
@@ -117,7 +117,7 @@ extension VideoChatScreenComponent.View {
} else {
maxBioLength = 100
}
- let controller = voiceChatTitleEditController(sharedContext: currentCall.accountContext.sharedContext, account: currentCall.accountContext.account, forceTheme: environment.theme, title: environment.strings.VoiceChat_EditBioTitle, text: environment.strings.VoiceChat_EditBioText, placeholder: environment.strings.VoiceChat_EditBioPlaceholder, doneButtonTitle: environment.strings.VoiceChat_EditBioSave, value: participant.about, maxLength: maxBioLength, apply: { [weak self] bio in
+ let controller = voiceChatTitleEditController(context: currentCall.accountContext, forceTheme: environment.theme, title: environment.strings.VoiceChat_EditBioTitle, text: environment.strings.VoiceChat_EditBioText, placeholder: environment.strings.VoiceChat_EditBioPlaceholder, doneButtonTitle: environment.strings.VoiceChat_EditBioSave, value: participant.about, maxLength: maxBioLength, apply: { [weak self] bio in
guard let self, let environment = self.environment, let currentCall = self.currentCall, let bio else {
return
}
@@ -149,7 +149,7 @@ extension VideoChatScreenComponent.View {
guard let self, let environment = self.environment, let currentCall = self.currentCall else {
return
}
- let controller = voiceChatUserNameController(sharedContext: currentCall.accountContext.sharedContext, account: currentCall.accountContext.account, forceTheme: environment.theme, title: environment.strings.VoiceChat_ChangeNameTitle, firstNamePlaceholder: environment.strings.UserInfo_FirstNamePlaceholder, lastNamePlaceholder: environment.strings.UserInfo_LastNamePlaceholder, doneButtonTitle: environment.strings.VoiceChat_EditBioSave, firstName: peer.firstName, lastName: peer.lastName, maxLength: 128, apply: { [weak self] firstAndLastName in
+ let controller = voiceChatUserNameController(context: currentCall.accountContext, forceTheme: environment.theme, title: environment.strings.VoiceChat_ChangeNameTitle, firstNamePlaceholder: environment.strings.UserInfo_FirstNamePlaceholder, lastNamePlaceholder: environment.strings.UserInfo_LastNamePlaceholder, doneButtonTitle: environment.strings.VoiceChat_EditBioSave, firstName: peer.firstName, lastName: peer.lastName, maxLength: 128, apply: { [weak self] firstAndLastName in
guard let self, let environment = self.environment, let currentCall = self.currentCall, let (firstName, lastName) = firstAndLastName else {
return
}
diff --git a/submodules/TelegramCallsUI/Sources/VoiceChatActionItem.swift b/submodules/TelegramCallsUI/Sources/VoiceChatActionItem.swift
index 320041de..c2822f5f 100644
--- a/submodules/TelegramCallsUI/Sources/VoiceChatActionItem.swift
+++ b/submodules/TelegramCallsUI/Sources/VoiceChatActionItem.swift
@@ -129,7 +129,7 @@ class VoiceChatActionItemNode: ListViewItemNode {
self.activateArea = AccessibilityAreaNode()
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.highlightContainerNode.addSubnode(self.highlightedBackgroundNode)
diff --git a/submodules/TelegramCallsUI/Sources/VoiceChatFullscreenParticipantItem.swift b/submodules/TelegramCallsUI/Sources/VoiceChatFullscreenParticipantItem.swift
index 58367150..fc623650 100644
--- a/submodules/TelegramCallsUI/Sources/VoiceChatFullscreenParticipantItem.swift
+++ b/submodules/TelegramCallsUI/Sources/VoiceChatFullscreenParticipantItem.swift
@@ -259,7 +259,7 @@ class VoiceChatFullscreenParticipantItemNode: ItemListRevealOptionsItemNode {
self.actionContainerNode = ASDisplayNode()
self.actionButtonNode = HighlightableButtonNode()
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.isAccessibilityElement = true
diff --git a/submodules/TelegramCallsUI/Sources/VoiceChatMicrophoneNode.swift b/submodules/TelegramCallsUI/Sources/VoiceChatMicrophoneNode.swift
index c644942d..b296906e 100644
--- a/submodules/TelegramCallsUI/Sources/VoiceChatMicrophoneNode.swift
+++ b/submodules/TelegramCallsUI/Sources/VoiceChatMicrophoneNode.swift
@@ -23,15 +23,15 @@ private final class VoiceChatMicrophoneNodeDrawingState: NSObject {
}
}
-final class VoiceChatMicrophoneNode: ASDisplayNode {
- class State: Equatable {
- let muted: Bool
- let color: UIColor
- let filled: Bool
- let shadowColor: UIColor?
- let shadowBlur: CGFloat
+public final class VoiceChatMicrophoneNode: ASDisplayNode {
+ public class State: Equatable {
+ public let muted: Bool
+ public let color: UIColor
+ public let filled: Bool
+ public let shadowColor: UIColor?
+ public let shadowBlur: CGFloat
- init(muted: Bool, filled: Bool, color: UIColor, shadowColor: UIColor? = nil, shadowBlur: CGFloat = 0.0) {
+ public init(muted: Bool, filled: Bool, color: UIColor, shadowColor: UIColor? = nil, shadowBlur: CGFloat = 0.0) {
self.muted = muted
self.filled = filled
self.color = color
@@ -39,7 +39,7 @@ final class VoiceChatMicrophoneNode: ASDisplayNode {
self.shadowBlur = shadowBlur
}
- static func ==(lhs: State, rhs: State) -> Bool {
+ public static func ==(lhs: State, rhs: State) -> Bool {
if lhs.muted != rhs.muted {
return false
}
@@ -77,13 +77,13 @@ final class VoiceChatMicrophoneNode: ASDisplayNode {
private var state: State = State(muted: false, filled: false, color: .black)
private var transitionContext: TransitionContext?
- override init() {
+ override public init() {
super.init()
self.isOpaque = false
}
- func update(state: State, animated: Bool) {
+ public func update(state: State, animated: Bool) {
var animated = animated
if !self.hasState {
self.hasState = true
diff --git a/submodules/TelegramCallsUI/Sources/VoiceChatParticipantItem.swift b/submodules/TelegramCallsUI/Sources/VoiceChatParticipantItem.swift
index 81722b4d..820b98cd 100644
--- a/submodules/TelegramCallsUI/Sources/VoiceChatParticipantItem.swift
+++ b/submodules/TelegramCallsUI/Sources/VoiceChatParticipantItem.swift
@@ -344,7 +344,7 @@ class VoiceChatParticipantItemNode: ItemListRevealOptionsItemNode {
self.highlightedBackgroundNode = ASDisplayNode()
- super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
+ super.init(layerBacked: false, rotated: false, seeThrough: false)
self.isAccessibilityElement = true
diff --git a/submodules/TelegramCallsUI/Sources/VoiceChatTileGridNode.swift b/submodules/TelegramCallsUI/Sources/VoiceChatTileGridNode.swift
index 1b8b43df..037905bd 100644
--- a/submodules/TelegramCallsUI/Sources/VoiceChatTileGridNode.swift
+++ b/submodules/TelegramCallsUI/Sources/VoiceChatTileGridNode.swift
@@ -257,7 +257,7 @@ final class VoiceChatTilesGridItemNode: ListViewItemNode {
self.limitLabel = TextNode()
self.limitLabel.alpha = 0.0
- super.init(layerBacked: false, dynamicBounce: false)
+ super.init(layerBacked: false)
self.addSubnode(self.backgroundNode)
self.addSubnode(self.cornersNode)
diff --git a/submodules/TelegramCallsUI/Sources/VoiceChatTimerNode.swift b/submodules/TelegramCallsUI/Sources/VoiceChatTimerNode.swift
index 3fb3b29b..6f4abcd3 100644
--- a/submodules/TelegramCallsUI/Sources/VoiceChatTimerNode.swift
+++ b/submodules/TelegramCallsUI/Sources/VoiceChatTimerNode.swift
@@ -12,6 +12,22 @@ private let pink = UIColor(rgb: 0xef436c)
private let latePurple = UIColor(rgb: 0x974aa9)
private let latePink = UIColor(rgb: 0xf0436c)
+private func textForTimeout(value: Int32) -> String {
+ if value < 3600 {
+ let minutes = value / 60
+ let seconds = value % 60
+ let secondsPadding = seconds < 10 ? "0" : ""
+ return "\(minutes):\(secondsPadding)\(seconds)"
+ } else {
+ let hours = value / 3600
+ let minutes = (value % 3600) / 60
+ let minutesPadding = minutes < 10 ? "0" : ""
+ let seconds = value % 60
+ let secondsPadding = seconds < 10 ? "0" : ""
+ return "\(hours):\(minutesPadding)\(minutes):\(secondsPadding)\(seconds)"
+ }
+}
+
final class VoiceChatTimerNode: ASDisplayNode {
private let strings: PresentationStrings
private let dateTimeFormat: PresentationDateTimeFormat
diff --git a/submodules/TelegramCallsUI/Sources/VoiceChatTitleEditController.swift b/submodules/TelegramCallsUI/Sources/VoiceChatTitleEditController.swift
index 1ba276b3..505fb7d2 100644
--- a/submodules/TelegramCallsUI/Sources/VoiceChatTitleEditController.swift
+++ b/submodules/TelegramCallsUI/Sources/VoiceChatTitleEditController.swift
@@ -7,767 +7,179 @@ import TelegramCore
import TelegramPresentationData
import AccountContext
import UrlEscaping
+import ComponentFlow
+import AlertComponent
+import AlertInputFieldComponent
-private final class VoiceChatTitleEditInputFieldNode: ASDisplayNode, ASEditableTextNodeDelegate {
- private var theme: PresentationTheme
- private let backgroundNode: ASImageNode
- private let textInputNode: EditableTextNode
- private let placeholderNode: ASTextNode
- private let clearButton: HighlightableButtonNode
-
- var updateHeight: (() -> Void)?
- var complete: (() -> Void)?
- var textChanged: ((String) -> Void)?
-
- private let backgroundInsets = UIEdgeInsets(top: 8.0, left: 16.0, bottom: 15.0, right: 16.0)
- private let inputInsets = UIEdgeInsets(top: 5.0, left: 12.0, bottom: 5.0, right: 12.0)
-
- var text: String {
- get {
- return self.textInputNode.attributedText?.string ?? ""
- }
- set {
- self.textInputNode.attributedText = NSAttributedString(string: newValue, font: Font.regular(17.0), textColor: self.theme.actionSheet.inputTextColor)
- self.placeholderNode.isHidden = !newValue.isEmpty
- if self.textInputNode.isFirstResponder() {
- self.clearButton.isHidden = newValue.isEmpty
- } else {
- self.clearButton.isHidden = true
- }
- }
- }
-
- var placeholder: String = "" {
- didSet {
- self.placeholderNode.attributedText = NSAttributedString(string: self.placeholder, font: Font.regular(17.0), textColor: self.theme.actionSheet.inputPlaceholderColor)
- }
- }
-
- private let maxLength: Int
-
- init(theme: PresentationTheme, placeholder: String, maxLength: Int, returnKeyType: UIReturnKeyType = .done) {
- self.theme = theme
- self.maxLength = maxLength
-
- self.backgroundNode = ASImageNode()
- self.backgroundNode.isLayerBacked = true
- self.backgroundNode.displaysAsynchronously = false
- self.backgroundNode.displayWithoutProcessing = true
- self.backgroundNode.image = generateStretchableFilledCircleImage(diameter: 12.0, color: theme.actionSheet.inputHollowBackgroundColor, strokeColor: theme.actionSheet.inputBorderColor, strokeWidth: 1.0)
-
- self.textInputNode = EditableTextNode()
- self.textInputNode.typingAttributes = [NSAttributedString.Key.font.rawValue: Font.regular(17.0), NSAttributedString.Key.foregroundColor.rawValue: theme.actionSheet.inputTextColor]
- self.textInputNode.clipsToBounds = true
- self.textInputNode.hitTestSlop = UIEdgeInsets(top: -5.0, left: -5.0, bottom: -5.0, right: -5.0)
- self.textInputNode.textContainerInset = UIEdgeInsets(top: self.inputInsets.top, left: 0.0, bottom: self.inputInsets.bottom, right: 0.0)
- self.textInputNode.keyboardAppearance = theme.rootController.keyboardColor.keyboardAppearance
- self.textInputNode.keyboardType = .default
- self.textInputNode.autocapitalizationType = .sentences
- self.textInputNode.returnKeyType = returnKeyType
- self.textInputNode.autocorrectionType = .default
- self.textInputNode.tintColor = theme.actionSheet.controlAccentColor
-
- self.placeholderNode = ASTextNode()
- self.placeholderNode.isUserInteractionEnabled = false
- self.placeholderNode.displaysAsynchronously = false
- self.placeholderNode.attributedText = NSAttributedString(string: placeholder, font: Font.regular(17.0), textColor: self.theme.actionSheet.inputPlaceholderColor)
-
- self.clearButton = HighlightableButtonNode()
- self.clearButton.imageNode.displaysAsynchronously = false
- self.clearButton.imageNode.displayWithoutProcessing = true
- self.clearButton.displaysAsynchronously = false
- self.clearButton.setImage(generateTintedImage(image: UIImage(bundleImageName: "Components/Search Bar/Clear"), color: theme.actionSheet.inputClearButtonColor), for: [])
- self.clearButton.isHidden = true
-
- super.init()
-
- self.textInputNode.delegate = self
-
- self.addSubnode(self.backgroundNode)
- self.addSubnode(self.textInputNode)
- self.addSubnode(self.placeholderNode)
- self.addSubnode(self.clearButton)
-
- self.clearButton.addTarget(self, action: #selector(self.clearPressed), forControlEvents: .touchUpInside)
- }
-
- func updateTheme(_ theme: PresentationTheme) {
- self.theme = theme
-
- self.backgroundNode.image = generateStretchableFilledCircleImage(diameter: 12.0, color: self.theme.actionSheet.inputHollowBackgroundColor, strokeColor: self.theme.actionSheet.inputBorderColor, strokeWidth: 1.0)
- self.textInputNode.keyboardAppearance = self.theme.rootController.keyboardColor.keyboardAppearance
- self.placeholderNode.attributedText = NSAttributedString(string: self.placeholderNode.attributedText?.string ?? "", font: Font.regular(17.0), textColor: self.theme.actionSheet.inputPlaceholderColor)
- self.textInputNode.tintColor = self.theme.actionSheet.controlAccentColor
- self.clearButton.setImage(generateTintedImage(image: UIImage(bundleImageName: "Components/Search Bar/Clear"), color: theme.actionSheet.inputClearButtonColor), for: [])
- }
-
- func updateLayout(width: CGFloat, transition: ContainedViewLayoutTransition) -> CGFloat {
- let backgroundInsets = self.backgroundInsets
- let inputInsets = self.inputInsets
-
- let textFieldHeight = self.calculateTextFieldMetrics(width: width)
- let panelHeight = textFieldHeight + backgroundInsets.top + backgroundInsets.bottom
-
- let backgroundFrame = CGRect(origin: CGPoint(x: backgroundInsets.left, y: backgroundInsets.top), size: CGSize(width: width - backgroundInsets.left - backgroundInsets.right, height: panelHeight - backgroundInsets.top - backgroundInsets.bottom))
- transition.updateFrame(node: self.backgroundNode, frame: backgroundFrame)
-
- let placeholderSize = self.placeholderNode.measure(backgroundFrame.size)
- transition.updateFrame(node: self.placeholderNode, frame: CGRect(origin: CGPoint(x: backgroundFrame.minX + inputInsets.left, y: backgroundFrame.minY + floor((backgroundFrame.size.height - placeholderSize.height) / 2.0)), size: placeholderSize))
-
- transition.updateFrame(node: self.textInputNode, frame: CGRect(origin: CGPoint(x: backgroundFrame.minX + inputInsets.left, y: backgroundFrame.minY), size: CGSize(width: backgroundFrame.size.width - inputInsets.left - inputInsets.right - 20.0, height: backgroundFrame.size.height)))
-
- if let image = self.clearButton.image(for: []) {
- transition.updateFrame(node: self.clearButton, frame: CGRect(origin: CGPoint(x: backgroundFrame.maxX - 8.0 - image.size.width, y: backgroundFrame.minY + floor((backgroundFrame.size.height - image.size.height) / 2.0)), size: image.size))
- }
-
- return panelHeight
- }
-
- func activateInput() {
- self.textInputNode.becomeFirstResponder()
- }
-
- func deactivateInput() {
- self.textInputNode.resignFirstResponder()
- }
-
- @objc func editableTextNodeDidUpdateText(_ editableTextNode: ASEditableTextNode) {
- self.updateTextNodeText(animated: true)
- self.textChanged?(editableTextNode.textView.text)
- self.placeholderNode.isHidden = !(editableTextNode.textView.text ?? "").isEmpty
- self.clearButton.isHidden = !self.placeholderNode.isHidden
- }
-
- func editableTextNodeDidBeginEditing(_ editableTextNode: ASEditableTextNode) {
- self.clearButton.isHidden = (editableTextNode.textView.text ?? "").isEmpty
- }
-
- func editableTextNodeDidFinishEditing(_ editableTextNode: ASEditableTextNode) {
- self.clearButton.isHidden = true
- }
-
- func editableTextNode(_ editableTextNode: ASEditableTextNode, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
- let updatedText = (editableTextNode.textView.text as NSString).replacingCharacters(in: range, with: text)
- if updatedText.count > maxLength {
- self.textInputNode.layer.addShakeAnimation()
- return false
- }
- if text == "\n" {
- self.complete?()
- return false
- }
- return true
- }
-
- private func calculateTextFieldMetrics(width: CGFloat) -> CGFloat {
- let backgroundInsets = self.backgroundInsets
- let inputInsets = self.inputInsets
-
- let unboundTextFieldHeight = max(33.0, ceil(self.textInputNode.measure(CGSize(width: width - backgroundInsets.left - backgroundInsets.right - inputInsets.left - inputInsets.right - 20.0, height: CGFloat.greatestFiniteMagnitude)).height))
-
- return min(61.0, max(33.0, unboundTextFieldHeight))
- }
-
- private func updateTextNodeText(animated: Bool) {
- let backgroundInsets = self.backgroundInsets
-
- let textFieldHeight = self.calculateTextFieldMetrics(width: self.bounds.size.width)
-
- let panelHeight = textFieldHeight + backgroundInsets.top + backgroundInsets.bottom
- if !self.bounds.size.height.isEqual(to: panelHeight) {
- self.updateHeight?()
- }
- }
-
- @objc func clearPressed() {
- self.placeholderNode.isHidden = false
- self.clearButton.isHidden = true
-
- self.textInputNode.attributedText = nil
- self.updateHeight?()
- }
-}
-
-private final class VoiceChatTitleEditAlertContentNode: AlertContentNode {
- private let strings: PresentationStrings
- private let title: String
- private let text: String
-
- private let titleNode: ASTextNode
- private let textNode: ASTextNode
- let inputFieldNode: VoiceChatTitleEditInputFieldNode
-
- private let actionNodesSeparator: ASDisplayNode
- private let actionNodes: [TextAlertContentActionNode]
- private let actionVerticalSeparators: [ASDisplayNode]
-
- private let disposable = MetaDisposable()
-
- private var validLayout: CGSize?
-
- private let hapticFeedback = HapticFeedback()
-
- var complete: (() -> Void)? {
- didSet {
- self.inputFieldNode.complete = self.complete
- }
- }
-
- override var dismissOnOutsideTap: Bool {
- return self.isUserInteractionEnabled
- }
-
- init(theme: AlertControllerTheme, ptheme: PresentationTheme, strings: PresentationStrings, actions: [TextAlertAction], title: String, text: String, placeholder: String, value: String?, maxLength: Int) {
- self.strings = strings
- self.title = title
- self.text = text
-
- self.titleNode = ASTextNode()
- self.titleNode.maximumNumberOfLines = 2
- self.textNode = ASTextNode()
- self.textNode.maximumNumberOfLines = 8
-
- self.inputFieldNode = VoiceChatTitleEditInputFieldNode(theme: ptheme, placeholder: placeholder, maxLength: maxLength)
- self.inputFieldNode.text = value ?? ""
-
- self.actionNodesSeparator = ASDisplayNode()
- self.actionNodesSeparator.isLayerBacked = true
-
- self.actionNodes = actions.map { action -> TextAlertContentActionNode in
- return TextAlertContentActionNode(theme: theme, action: action)
- }
-
- var actionVerticalSeparators: [ASDisplayNode] = []
- if actions.count > 1 {
- for _ in 0 ..< actions.count - 1 {
- let separatorNode = ASDisplayNode()
- separatorNode.isLayerBacked = true
- actionVerticalSeparators.append(separatorNode)
- }
- }
- self.actionVerticalSeparators = actionVerticalSeparators
-
- super.init()
-
- self.addSubnode(self.titleNode)
- self.addSubnode(self.textNode)
-
- self.addSubnode(self.inputFieldNode)
-
- self.addSubnode(self.actionNodesSeparator)
-
- for actionNode in self.actionNodes {
- self.addSubnode(actionNode)
- }
-
- for separatorNode in self.actionVerticalSeparators {
- self.addSubnode(separatorNode)
- }
-
- self.inputFieldNode.updateHeight = { [weak self] in
- if let strongSelf = self {
- if let _ = strongSelf.validLayout {
- strongSelf.requestLayout?(.animated(duration: 0.15, curve: .spring))
- }
- }
- }
-
- self.updateTheme(theme)
- }
-
- deinit {
- self.disposable.dispose()
- }
-
- var value: String {
- return self.inputFieldNode.text
- }
-
- override func updateTheme(_ theme: AlertControllerTheme) {
- self.titleNode.attributedText = NSAttributedString(string: self.title, font: Font.bold(17.0), textColor: theme.primaryColor, paragraphAlignment: .center)
- self.textNode.attributedText = NSAttributedString(string: self.text, font: Font.regular(13.0), textColor: theme.primaryColor, paragraphAlignment: .center)
-
- self.actionNodesSeparator.backgroundColor = theme.separatorColor
- for actionNode in self.actionNodes {
- actionNode.updateTheme(theme)
- }
- for separatorNode in self.actionVerticalSeparators {
- separatorNode.backgroundColor = theme.separatorColor
- }
-
- if let size = self.validLayout {
- _ = self.updateLayout(size: size, transition: .immediate)
- }
- }
-
- override func updateLayout(size: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
- var size = size
- size.width = min(size.width, 270.0)
- let measureSize = CGSize(width: size.width - 16.0 * 2.0, height: CGFloat.greatestFiniteMagnitude)
-
- let hadValidLayout = self.validLayout != nil
-
- self.validLayout = size
-
- var origin: CGPoint = CGPoint(x: 0.0, y: 20.0)
- let spacing: CGFloat = 5.0
-
- let titleSize = self.titleNode.measure(measureSize)
- transition.updateFrame(node: self.titleNode, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - titleSize.width) / 2.0), y: origin.y), size: titleSize))
- origin.y += titleSize.height + 4.0
-
- let textSize = self.textNode.measure(measureSize)
- transition.updateFrame(node: self.textNode, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - textSize.width) / 2.0), y: origin.y), size: textSize))
- origin.y += textSize.height + 6.0 + spacing
-
- let actionButtonHeight: CGFloat = 44.0
- var minActionsWidth: CGFloat = 0.0
- let maxActionWidth: CGFloat = floor(size.width / CGFloat(self.actionNodes.count))
- let actionTitleInsets: CGFloat = 8.0
-
- var effectiveActionLayout = TextAlertContentActionLayout.horizontal
- for actionNode in self.actionNodes {
- let actionTitleSize = actionNode.titleNode.updateLayout(CGSize(width: maxActionWidth, height: actionButtonHeight))
- if case .horizontal = effectiveActionLayout, actionTitleSize.height > actionButtonHeight * 0.6667 {
- effectiveActionLayout = .vertical
- }
- switch effectiveActionLayout {
- case .horizontal:
- minActionsWidth += actionTitleSize.width + actionTitleInsets
- case .vertical:
- minActionsWidth = max(minActionsWidth, actionTitleSize.width + actionTitleInsets)
- }
- }
-
- let insets = UIEdgeInsets(top: 18.0, left: 18.0, bottom: 9.0, right: 18.0)
-
- var contentWidth = max(titleSize.width, minActionsWidth)
- contentWidth = max(contentWidth, 234.0)
-
- var actionsHeight: CGFloat = 0.0
- switch effectiveActionLayout {
- case .horizontal:
- actionsHeight = actionButtonHeight
- case .vertical:
- actionsHeight = actionButtonHeight * CGFloat(self.actionNodes.count)
- }
-
- let resultWidth = contentWidth + insets.left + insets.right
-
- let inputFieldWidth = resultWidth
- let inputFieldHeight = self.inputFieldNode.updateLayout(width: inputFieldWidth, transition: transition)
- let inputHeight = inputFieldHeight
- transition.updateFrame(node: self.inputFieldNode, frame: CGRect(x: 0.0, y: origin.y, width: resultWidth, height: inputFieldHeight))
- transition.updateAlpha(node: self.inputFieldNode, alpha: inputHeight > 0.0 ? 1.0 : 0.0)
-
- let resultSize = CGSize(width: resultWidth, height: titleSize.height + textSize.height + spacing + inputHeight + actionsHeight + insets.top + insets.bottom)
-
- transition.updateFrame(node: self.actionNodesSeparator, frame: CGRect(origin: CGPoint(x: 0.0, y: resultSize.height - actionsHeight - UIScreenPixel), size: CGSize(width: resultSize.width, height: UIScreenPixel)))
-
- var actionOffset: CGFloat = 0.0
- let actionWidth: CGFloat = floor(resultSize.width / CGFloat(self.actionNodes.count))
- var separatorIndex = -1
- var nodeIndex = 0
- for actionNode in self.actionNodes {
- if separatorIndex >= 0 {
- let separatorNode = self.actionVerticalSeparators[separatorIndex]
- switch effectiveActionLayout {
- case .horizontal:
- transition.updateFrame(node: separatorNode, frame: CGRect(origin: CGPoint(x: actionOffset - UIScreenPixel, y: resultSize.height - actionsHeight), size: CGSize(width: UIScreenPixel, height: actionsHeight - UIScreenPixel)))
- case .vertical:
- transition.updateFrame(node: separatorNode, frame: CGRect(origin: CGPoint(x: 0.0, y: resultSize.height - actionsHeight + actionOffset - UIScreenPixel), size: CGSize(width: resultSize.width, height: UIScreenPixel)))
- }
- }
- separatorIndex += 1
-
- let currentActionWidth: CGFloat
- switch effectiveActionLayout {
- case .horizontal:
- if nodeIndex == self.actionNodes.count - 1 {
- currentActionWidth = resultSize.width - actionOffset
- } else {
- currentActionWidth = actionWidth
- }
- case .vertical:
- currentActionWidth = resultSize.width
- }
-
- let actionNodeFrame: CGRect
- switch effectiveActionLayout {
- case .horizontal:
- actionNodeFrame = CGRect(origin: CGPoint(x: actionOffset, y: resultSize.height - actionsHeight), size: CGSize(width: currentActionWidth, height: actionButtonHeight))
- actionOffset += currentActionWidth
- case .vertical:
- actionNodeFrame = CGRect(origin: CGPoint(x: 0.0, y: resultSize.height - actionsHeight + actionOffset), size: CGSize(width: currentActionWidth, height: actionButtonHeight))
- actionOffset += actionButtonHeight
- }
-
- transition.updateFrame(node: actionNode, frame: actionNodeFrame)
-
- nodeIndex += 1
- }
-
- if !hadValidLayout {
- self.inputFieldNode.activateInput()
- }
-
- return resultSize
- }
-
- func animateError() {
- self.inputFieldNode.layer.addShakeAnimation()
- self.hapticFeedback.error()
- }
-}
-
-func voiceChatTitleEditController(sharedContext: SharedAccountContext, account: Account, forceTheme: PresentationTheme?, title: String, text: String, placeholder: String, doneButtonTitle: String? = nil, value: String?, maxLength: Int, apply: @escaping (String?) -> Void) -> AlertController {
- var presentationData = sharedContext.currentPresentationData.with { $0 }
- if let forceTheme = forceTheme {
+func voiceChatTitleEditController(
+ context: AccountContext,
+ forceTheme: PresentationTheme?,
+ title: String,
+ text: String,
+ placeholder: String,
+ doneButtonTitle: String? = nil,
+ value: String?,
+ maxLength: Int,
+ apply: @escaping (String?) -> Void
+) -> ViewController {
+ var presentationData = context.sharedContext.currentPresentationData.with { $0 }
+ if let forceTheme {
presentationData = presentationData.withUpdated(theme: forceTheme)
}
-
- var dismissImpl: ((Bool) -> Void)?
+ let strings = presentationData.strings
+
+ let inputState = AlertInputFieldComponent.ExternalState()
+
+ var content: [AnyComponentWithIdentity] = []
+ content.append(AnyComponentWithIdentity(
+ id: "title",
+ component: AnyComponent(
+ AlertTitleComponent(title: title)
+ )
+ ))
+ content.append(AnyComponentWithIdentity(
+ id: "text",
+ component: AnyComponent(
+ AlertTextComponent(content: .plain(text))
+ )
+ ))
+
var applyImpl: (() -> Void)?
-
- let actions: [TextAlertAction] = [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {
- dismissImpl?(true)
- }), TextAlertAction(type: .defaultAction, title: doneButtonTitle ?? presentationData.strings.Common_Done, action: {
- applyImpl?()
- })]
-
- let contentNode = VoiceChatTitleEditAlertContentNode(theme: AlertControllerTheme(presentationData: presentationData), ptheme: presentationData.theme, strings: presentationData.strings, actions: actions, title: title, text: text, placeholder: placeholder, value: value, maxLength: maxLength)
- contentNode.complete = {
- applyImpl?()
- }
- applyImpl = { [weak contentNode] in
- guard let contentNode = contentNode else {
- return
- }
- dismissImpl?(true)
-
+ content.append(AnyComponentWithIdentity(
+ id: "input",
+ component: AnyComponent(
+ AlertInputFieldComponent(
+ context: context,
+ initialValue: value,
+ placeholder: placeholder,
+ characterLimit: maxLength,
+ hasClearButton: true,
+ isInitiallyFocused: true,
+ externalState: inputState,
+ returnKeyAction: {
+ applyImpl?()
+ }
+ )
+ )
+ ))
+
+ let alertController = AlertScreen(
+ configuration: AlertScreen.Configuration(allowInputInset: true),
+ content: content,
+ actions: [
+ .init(title: strings.Common_Cancel),
+ .init(title: doneButtonTitle ?? strings.Common_Done, type: .default, action: {
+ applyImpl?()
+ })
+ ],
+ updatedPresentationData: (presentationData, .single(presentationData))
+ )
+ applyImpl = {
let previousValue = value ?? ""
- let newValue = contentNode.value.trimmingCharacters(in: .whitespacesAndNewlines)
+ let newValue = inputState.value.trimmingCharacters(in: .whitespacesAndNewlines)
apply(previousValue != newValue || value == nil ? newValue : nil)
}
-
- let controller = AlertController(theme: AlertControllerTheme(presentationData: presentationData), contentNode: contentNode)
- let presentationDataDisposable = sharedContext.presentationData.start(next: { [weak controller, weak contentNode] presentationData in
- var presentationData = presentationData
- if let forceTheme = forceTheme {
- presentationData = presentationData.withUpdated(theme: forceTheme)
- }
- controller?.theme = AlertControllerTheme(presentationData: presentationData)
- contentNode?.inputFieldNode.updateTheme(presentationData.theme)
- })
- controller.dismissed = { _ in
- presentationDataDisposable.dispose()
- }
- dismissImpl = { [weak controller, weak contentNode] animated in
- contentNode?.inputFieldNode.deactivateInput()
- if animated {
- controller?.dismissAnimated()
- } else {
- controller?.dismiss()
- }
- }
- return controller
+ return alertController
}
-private final class VoiceChatUserNameEditAlertContentNode: AlertContentNode {
- private let strings: PresentationStrings
- private let title: String
-
- private let titleNode: ASTextNode
- let firstNameInputFieldNode: VoiceChatTitleEditInputFieldNode
- let lastNameInputFieldNode: VoiceChatTitleEditInputFieldNode
-
- private let actionNodesSeparator: ASDisplayNode
- private let actionNodes: [TextAlertContentActionNode]
- private let actionVerticalSeparators: [ASDisplayNode]
-
- private let disposable = MetaDisposable()
-
- private var validLayout: CGSize?
-
- private let hapticFeedback = HapticFeedback()
-
- var complete: (() -> Void)? {
- didSet {
- self.lastNameInputFieldNode.complete = self.complete
- }
- }
-
- override var dismissOnOutsideTap: Bool {
- return self.isUserInteractionEnabled
- }
-
- init(theme: AlertControllerTheme, ptheme: PresentationTheme, strings: PresentationStrings, actions: [TextAlertAction], title: String, firstNamePlaceholder: String, lastNamePlaceholder: String, firstNameValue: String?, lastNameValue: String?, maxLength: Int) {
- self.strings = strings
- self.title = title
-
- self.titleNode = ASTextNode()
- self.titleNode.maximumNumberOfLines = 2
-
- self.firstNameInputFieldNode = VoiceChatTitleEditInputFieldNode(theme: ptheme, placeholder: firstNamePlaceholder, maxLength: maxLength, returnKeyType: .next)
- self.firstNameInputFieldNode.text = firstNameValue ?? ""
-
- self.lastNameInputFieldNode = VoiceChatTitleEditInputFieldNode(theme: ptheme, placeholder: lastNamePlaceholder, maxLength: maxLength)
- self.lastNameInputFieldNode.text = lastNameValue ?? ""
-
- self.actionNodesSeparator = ASDisplayNode()
- self.actionNodesSeparator.isLayerBacked = true
-
- self.actionNodes = actions.map { action -> TextAlertContentActionNode in
- return TextAlertContentActionNode(theme: theme, action: action)
- }
-
- var actionVerticalSeparators: [ASDisplayNode] = []
- if actions.count > 1 {
- for _ in 0 ..< actions.count - 1 {
- let separatorNode = ASDisplayNode()
- separatorNode.isLayerBacked = true
- actionVerticalSeparators.append(separatorNode)
- }
- }
- self.actionVerticalSeparators = actionVerticalSeparators
-
- super.init()
-
- self.addSubnode(self.titleNode)
-
- self.addSubnode(self.firstNameInputFieldNode)
- self.addSubnode(self.lastNameInputFieldNode)
-
- self.addSubnode(self.actionNodesSeparator)
-
- for actionNode in self.actionNodes {
- self.addSubnode(actionNode)
- }
-
- for separatorNode in self.actionVerticalSeparators {
- self.addSubnode(separatorNode)
- }
-
- self.updateTheme(theme)
-
- self.firstNameInputFieldNode.complete = { [weak self] in
- self?.lastNameInputFieldNode.activateInput()
- }
- }
-
- deinit {
- self.disposable.dispose()
- }
-
- var firstName: String {
- return self.firstNameInputFieldNode.text
- }
-
- var lastName: String {
- return self.lastNameInputFieldNode.text
- }
-
- override func updateTheme(_ theme: AlertControllerTheme) {
- self.titleNode.attributedText = NSAttributedString(string: self.title, font: Font.bold(17.0), textColor: theme.primaryColor, paragraphAlignment: .center)
-
- self.actionNodesSeparator.backgroundColor = theme.separatorColor
- for actionNode in self.actionNodes {
- actionNode.updateTheme(theme)
- }
- for separatorNode in self.actionVerticalSeparators {
- separatorNode.backgroundColor = theme.separatorColor
- }
-
- if let size = self.validLayout {
- _ = self.updateLayout(size: size, transition: .immediate)
- }
- }
-
- override func updateLayout(size: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
- var size = size
- size.width = min(size.width, 270.0)
- let measureSize = CGSize(width: size.width - 16.0 * 2.0, height: CGFloat.greatestFiniteMagnitude)
-
- let hadValidLayout = self.validLayout != nil
-
- self.validLayout = size
-
- var origin: CGPoint = CGPoint(x: 0.0, y: 20.0)
- let spacing: CGFloat = 0.0
-
- let titleSize = self.titleNode.measure(measureSize)
- transition.updateFrame(node: self.titleNode, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - titleSize.width) / 2.0), y: origin.y), size: titleSize))
- origin.y += titleSize.height + 4.0
-
- let actionButtonHeight: CGFloat = 44.0
- var minActionsWidth: CGFloat = 0.0
- let maxActionWidth: CGFloat = floor(size.width / CGFloat(self.actionNodes.count))
- let actionTitleInsets: CGFloat = 8.0
-
- var effectiveActionLayout = TextAlertContentActionLayout.horizontal
- for actionNode in self.actionNodes {
- let actionTitleSize = actionNode.titleNode.updateLayout(CGSize(width: maxActionWidth, height: actionButtonHeight))
- if case .horizontal = effectiveActionLayout, actionTitleSize.height > actionButtonHeight * 0.6667 {
- effectiveActionLayout = .vertical
- }
- switch effectiveActionLayout {
- case .horizontal:
- minActionsWidth += actionTitleSize.width + actionTitleInsets
- case .vertical:
- minActionsWidth = max(minActionsWidth, actionTitleSize.width + actionTitleInsets)
- }
- }
-
- let insets = UIEdgeInsets(top: 18.0, left: 18.0, bottom: 9.0, right: 18.0)
-
- var contentWidth = max(titleSize.width, minActionsWidth)
- contentWidth = max(contentWidth, 234.0)
-
- var actionsHeight: CGFloat = 0.0
- switch effectiveActionLayout {
- case .horizontal:
- actionsHeight = actionButtonHeight
- case .vertical:
- actionsHeight = actionButtonHeight * CGFloat(self.actionNodes.count)
- }
-
- let resultWidth = contentWidth + insets.left + insets.right
-
- let inputFieldWidth = resultWidth
- let firstInputFieldHeight = self.firstNameInputFieldNode.updateLayout(width: inputFieldWidth, transition: transition)
- transition.updateFrame(node: self.firstNameInputFieldNode, frame: CGRect(x: 0.0, y: origin.y, width: resultWidth, height: firstInputFieldHeight))
-
- origin.y += firstInputFieldHeight + spacing
-
- let lastInputFieldHeight = self.lastNameInputFieldNode.updateLayout(width: inputFieldWidth, transition: transition)
- transition.updateFrame(node: self.lastNameInputFieldNode, frame: CGRect(x: 0.0, y: origin.y, width: resultWidth, height: lastInputFieldHeight))
-
- let resultSize = CGSize(width: resultWidth, height: titleSize.height + firstInputFieldHeight + spacing + lastInputFieldHeight + actionsHeight + insets.top + insets.bottom)
-
- transition.updateFrame(node: self.actionNodesSeparator, frame: CGRect(origin: CGPoint(x: 0.0, y: resultSize.height - actionsHeight - UIScreenPixel), size: CGSize(width: resultSize.width, height: UIScreenPixel)))
-
- var actionOffset: CGFloat = 0.0
- let actionWidth: CGFloat = floor(resultSize.width / CGFloat(self.actionNodes.count))
- var separatorIndex = -1
- var nodeIndex = 0
- for actionNode in self.actionNodes {
- if separatorIndex >= 0 {
- let separatorNode = self.actionVerticalSeparators[separatorIndex]
- switch effectiveActionLayout {
- case .horizontal:
- transition.updateFrame(node: separatorNode, frame: CGRect(origin: CGPoint(x: actionOffset - UIScreenPixel, y: resultSize.height - actionsHeight), size: CGSize(width: UIScreenPixel, height: actionsHeight - UIScreenPixel)))
- case .vertical:
- transition.updateFrame(node: separatorNode, frame: CGRect(origin: CGPoint(x: 0.0, y: resultSize.height - actionsHeight + actionOffset - UIScreenPixel), size: CGSize(width: resultSize.width, height: UIScreenPixel)))
- }
- }
- separatorIndex += 1
-
- let currentActionWidth: CGFloat
- switch effectiveActionLayout {
- case .horizontal:
- if nodeIndex == self.actionNodes.count - 1 {
- currentActionWidth = resultSize.width - actionOffset
- } else {
- currentActionWidth = actionWidth
- }
- case .vertical:
- currentActionWidth = resultSize.width
- }
-
- let actionNodeFrame: CGRect
- switch effectiveActionLayout {
- case .horizontal:
- actionNodeFrame = CGRect(origin: CGPoint(x: actionOffset, y: resultSize.height - actionsHeight), size: CGSize(width: currentActionWidth, height: actionButtonHeight))
- actionOffset += currentActionWidth
- case .vertical:
- actionNodeFrame = CGRect(origin: CGPoint(x: 0.0, y: resultSize.height - actionsHeight + actionOffset), size: CGSize(width: currentActionWidth, height: actionButtonHeight))
- actionOffset += actionButtonHeight
- }
-
- transition.updateFrame(node: actionNode, frame: actionNodeFrame)
-
- nodeIndex += 1
- }
-
- if !hadValidLayout {
- self.firstNameInputFieldNode.activateInput()
- }
-
- return resultSize
- }
-
- func animateError() {
- if self.firstNameInputFieldNode.text.isEmpty {
- self.firstNameInputFieldNode.layer.addShakeAnimation()
- }
- self.hapticFeedback.error()
- }
-}
-
-func voiceChatUserNameController(sharedContext: SharedAccountContext, account: Account, forceTheme: PresentationTheme?, title: String, firstNamePlaceholder: String, lastNamePlaceholder: String, doneButtonTitle: String? = nil, firstName: String?, lastName: String?, maxLength: Int, apply: @escaping ((String, String)?) -> Void) -> AlertController {
- var presentationData = sharedContext.currentPresentationData.with { $0 }
- if let forceTheme = forceTheme {
+func voiceChatUserNameController(
+ context: AccountContext,
+ forceTheme: PresentationTheme?,
+ title: String,
+ firstNamePlaceholder: String,
+ lastNamePlaceholder: String,
+ doneButtonTitle: String? = nil,
+ firstName: String?,
+ lastName: String?,
+ maxLength: Int,
+ apply: @escaping ((String, String)?) -> Void
+) -> ViewController {
+ var presentationData = context.sharedContext.currentPresentationData.with { $0 }
+ if let forceTheme {
presentationData = presentationData.withUpdated(theme: forceTheme)
}
+ let strings = presentationData.strings
+
+ let firstNameState = AlertInputFieldComponent.ExternalState()
+ let lastNameState = AlertInputFieldComponent.ExternalState()
+
+ var content: [AnyComponentWithIdentity] = []
+ content.append(AnyComponentWithIdentity(
+ id: "title",
+ component: AnyComponent(
+ AlertTitleComponent(title: title)
+ )
+ ))
- var dismissImpl: ((Bool) -> Void)?
+ var nextImpl: (() -> Void)?
var applyImpl: (() -> Void)?
+ content.append(AnyComponentWithIdentity(
+ id: "firstName",
+ component: AnyComponent(
+ AlertInputFieldComponent(
+ context: context,
+ initialValue: firstName,
+ placeholder: firstNamePlaceholder,
+ characterLimit: maxLength,
+ hasClearButton: true,
+ returnKeyType: .next,
+ isInitiallyFocused: true,
+ externalState: firstNameState,
+ returnKeyAction: {
+ nextImpl?()
+ }
+ )
+ )
+ ))
- let actions: [TextAlertAction] = [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {
- dismissImpl?(true)
- }), TextAlertAction(type: .defaultAction, title: doneButtonTitle ?? presentationData.strings.Common_Done, action: {
- applyImpl?()
- })]
-
- let contentNode = VoiceChatUserNameEditAlertContentNode(theme: AlertControllerTheme(presentationData: presentationData), ptheme: presentationData.theme, strings: presentationData.strings, actions: actions, title: title, firstNamePlaceholder: firstNamePlaceholder, lastNamePlaceholder: lastNamePlaceholder, firstNameValue: firstName, lastNameValue: lastName, maxLength: maxLength)
- contentNode.complete = {
- applyImpl?()
+ content.append(AnyComponentWithIdentity(
+ id: "lastName",
+ component: AnyComponent(
+ AlertInputFieldComponent(
+ context: context,
+ initialValue: lastName,
+ placeholder: lastNamePlaceholder,
+ characterLimit: maxLength,
+ hasClearButton: true,
+ isInitiallyFocused: false,
+ externalState: lastNameState,
+ returnKeyAction: {
+ applyImpl?()
+ }
+ )
+ )
+ ))
+
+ let alertController = AlertScreen(
+ configuration: AlertScreen.Configuration(allowInputInset: true),
+ content: content,
+ actions: [
+ .init(title: strings.Common_Cancel),
+ .init(title: doneButtonTitle ?? strings.Common_Done, type: .default, action: {
+ applyImpl?()
+ })
+ ],
+ updatedPresentationData: (presentationData, .single(presentationData))
+ )
+ nextImpl = {
+ lastNameState.activateInput()
}
- applyImpl = { [weak contentNode] in
- guard let contentNode = contentNode else {
- return
- }
-
+ applyImpl = {
let previousFirstName = firstName ?? ""
let previousLastName = lastName ?? ""
- let newFirstName = contentNode.firstName.trimmingCharacters(in: .whitespacesAndNewlines)
- let newLastName = contentNode.lastName.trimmingCharacters(in: .whitespacesAndNewlines)
+ let newFirstName = firstNameState.value.trimmingCharacters(in: .whitespacesAndNewlines)
+ let newLastName = lastNameState.value.trimmingCharacters(in: .whitespacesAndNewlines)
if newFirstName.isEmpty {
- contentNode.animateError()
+ firstNameState.animateError()
return
}
-
- dismissImpl?(true)
-
+
if previousFirstName != newFirstName || previousLastName != newLastName {
apply((newFirstName, newLastName))
} else {
apply(nil)
}
}
-
- let controller = AlertController(theme: AlertControllerTheme(presentationData: presentationData), contentNode: contentNode)
- let presentationDataDisposable = sharedContext.presentationData.start(next: { [weak controller, weak contentNode] presentationData in
- var presentationData = presentationData
- if let forceTheme = forceTheme {
- presentationData = presentationData.withUpdated(theme: forceTheme)
- }
- controller?.theme = AlertControllerTheme(presentationData: presentationData)
- contentNode?.firstNameInputFieldNode.updateTheme(presentationData.theme)
- contentNode?.lastNameInputFieldNode.updateTheme(presentationData.theme)
- })
- controller.dismissed = { _ in
- presentationDataDisposable.dispose()
- }
- dismissImpl = { [weak controller, weak contentNode] animated in
- contentNode?.firstNameInputFieldNode.deactivateInput()
- contentNode?.lastNameInputFieldNode.deactivateInput()
- if animated {
- controller?.dismissAnimated()
- } else {
- controller?.dismiss()
- }
- }
- return controller
+ return alertController
}
diff --git a/submodules/TelegramCore/BUILD b/submodules/TelegramCore/BUILD
index fe9bc15d..53c9a721 100644
--- a/submodules/TelegramCore/BUILD
+++ b/submodules/TelegramCore/BUILD
@@ -25,6 +25,7 @@ swift_library(
"//submodules/Emoji",
"//submodules/TelegramCore/FlatBuffers",
"//submodules/TelegramCore/FlatSerialization",
+ "//submodules/MurMurHash32"
],
visibility = [
"//visibility:public",
diff --git a/submodules/TelegramCore/Sources/Account/AccountIntermediateState.swift b/submodules/TelegramCore/Sources/Account/AccountIntermediateState.swift
index 7c0a3db5..fbc85e9e 100644
--- a/submodules/TelegramCore/Sources/Account/AccountIntermediateState.swift
+++ b/submodules/TelegramCore/Sources/Account/AccountIntermediateState.swift
@@ -139,6 +139,7 @@ enum AccountStateMutationOperation {
case UpdateMonoForumNoPaidException(peerId: PeerId, threadId: Int64, isFree: Bool)
case UpdateStarGiftAuctionState(giftId: Int64, state: GiftAuctionContext.State.AuctionState)
case UpdateStarGiftAuctionMyState(giftId: Int64, state: GiftAuctionContext.State.MyState)
+ case UpdateEmojiGameInfo(info: EmojiGameInfo)
}
struct HoleFromPreviousState {
@@ -737,9 +738,13 @@ struct AccountMutableState {
self.addOperation(.UpdateStarGiftAuctionMyState(giftId: giftId, state: state))
}
+ mutating func updateEmojiGameInfo(info: EmojiGameInfo) {
+ self.addOperation(.UpdateEmojiGameInfo(info: info))
+ }
+
mutating func addOperation(_ operation: AccountStateMutationOperation) {
switch operation {
- case .DeleteMessages, .DeleteMessagesWithGlobalIds, .EditMessage, .UpdateMessagePoll, .UpdateMessageReactions, .UpdateMedia, .ReadOutbox, .ReadGroupFeedInbox, .MergePeerPresences, .UpdateSecretChat, .AddSecretMessages, .ReadSecretOutbox, .AddPeerInputActivity, .AddPeerLiveTypingDraftUpdate, .UpdateCachedPeerData, .UpdatePinnedItemIds, .UpdatePinnedSavedItemIds, .UpdatePinnedTopic, .UpdatePinnedTopicOrder, .ReadMessageContents, .UpdateMessageImpressionCount, .UpdateMessageForwardsCount, .UpdateInstalledStickerPacks, .UpdateRecentGifs, .UpdateChatInputState, .UpdateCall, .AddCallSignalingData, .UpdateLangPack, .UpdateMinAvailableMessage, .UpdatePeerChatUnreadMark, .UpdateIsContact, .UpdatePeerChatInclusion, .UpdatePeersNearby, .UpdateTheme, .UpdateWallpaper, .SyncChatListFilters, .UpdateChatListFilterOrder, .UpdateChatListFilter, .UpdateReadThread, .UpdateGroupCallParticipants, .UpdateGroupCall, .UpdateGroupCallChainBlocks, .UpdateGroupCallMessage, .UpdateGroupCallOpaqueMessage, .UpdateMessagesPinned, .UpdateAutoremoveTimeout, .UpdateAttachMenuBots, .UpdateAudioTranscription, .UpdateConfig, .UpdateExtendedMedia, .ResetForumTopic, .UpdateStory, .UpdateReadStories, .UpdateStoryStealthMode, .UpdateStorySentReaction, .UpdateNewAuthorization, .UpdateStarsBalance, .UpdateStarsRevenueStatus, .UpdateStarsReactionsDefaultPrivacy, .ReportMessageDelivery, .UpdateMonoForumNoPaidException, .UpdateStarGiftAuctionState, .UpdateStarGiftAuctionMyState:
+ case .DeleteMessages, .DeleteMessagesWithGlobalIds, .EditMessage, .UpdateMessagePoll, .UpdateMessageReactions, .UpdateMedia, .ReadOutbox, .ReadGroupFeedInbox, .MergePeerPresences, .UpdateSecretChat, .AddSecretMessages, .ReadSecretOutbox, .AddPeerInputActivity, .AddPeerLiveTypingDraftUpdate, .UpdateCachedPeerData, .UpdatePinnedItemIds, .UpdatePinnedSavedItemIds, .UpdatePinnedTopic, .UpdatePinnedTopicOrder, .ReadMessageContents, .UpdateMessageImpressionCount, .UpdateMessageForwardsCount, .UpdateInstalledStickerPacks, .UpdateRecentGifs, .UpdateChatInputState, .UpdateCall, .AddCallSignalingData, .UpdateLangPack, .UpdateMinAvailableMessage, .UpdatePeerChatUnreadMark, .UpdateIsContact, .UpdatePeerChatInclusion, .UpdatePeersNearby, .UpdateTheme, .UpdateWallpaper, .SyncChatListFilters, .UpdateChatListFilterOrder, .UpdateChatListFilter, .UpdateReadThread, .UpdateGroupCallParticipants, .UpdateGroupCall, .UpdateGroupCallChainBlocks, .UpdateGroupCallMessage, .UpdateGroupCallOpaqueMessage, .UpdateMessagesPinned, .UpdateAutoremoveTimeout, .UpdateAttachMenuBots, .UpdateAudioTranscription, .UpdateConfig, .UpdateExtendedMedia, .ResetForumTopic, .UpdateStory, .UpdateReadStories, .UpdateStoryStealthMode, .UpdateStorySentReaction, .UpdateNewAuthorization, .UpdateStarsBalance, .UpdateStarsRevenueStatus, .UpdateStarsReactionsDefaultPrivacy, .ReportMessageDelivery, .UpdateMonoForumNoPaidException, .UpdateStarGiftAuctionState, .UpdateStarGiftAuctionMyState, .UpdateEmojiGameInfo:
break
case let .AddMessages(messages, location):
for message in messages {
@@ -892,6 +897,7 @@ struct AccountReplayedFinalState {
let addedConferenceInvitationMessagesIds: [MessageId]
let updatedStarGiftAuctionState: [Int64: GiftAuctionContext.State.AuctionState]
let updatedStarGiftAuctionMyState: [Int64: GiftAuctionContext.State.MyState]
+ let updatedEmojiGameInfo: EmojiGameInfo?
}
struct AccountFinalStateEvents {
@@ -927,12 +933,13 @@ struct AccountFinalStateEvents {
let addedConferenceInvitationMessagesIds: [MessageId]
let updatedStarGiftAuctionState: [Int64: GiftAuctionContext.State.AuctionState]
let updatedStarGiftAuctionMyState: [Int64: GiftAuctionContext.State.MyState]
+ let updatedEmojiGameInfo: EmojiGameInfo?
var isEmpty: Bool {
- return self.addedIncomingMessageIds.isEmpty && self.addedReactionEvents.isEmpty && self.wasScheduledMessageIds.isEmpty && self.deletedMessageIds.isEmpty && self.sentScheduledMessageIds.isEmpty && self.updatedTypingActivities.isEmpty && self.updatedWebpages.isEmpty && self.updatedCalls.isEmpty && self.addedCallSignalingData.isEmpty && self.updatedGroupCallParticipants.isEmpty && self.groupCallMessageUpdates.isEmpty && self.storyUpdates.isEmpty && self.updatedPeersNearby?.isEmpty ?? true && self.isContactUpdates.isEmpty && self.displayAlerts.isEmpty && self.dismissBotWebViews.isEmpty && self.delayNotificatonsUntil == nil && self.updatedMaxMessageId == nil && self.updatedQts == nil && self.externallyUpdatedPeerId.isEmpty && !authorizationListUpdated && self.updatedIncomingThreadReadStates.isEmpty && self.updatedOutgoingThreadReadStates.isEmpty && !self.updateConfig && !self.isPremiumUpdated && self.updatedStarsBalance.isEmpty && self.updatedTonBalance.isEmpty && self.updatedStarsRevenueStatus.isEmpty && self.reportMessageDelivery.isEmpty && self.addedConferenceInvitationMessagesIds.isEmpty && self.updatedStarGiftAuctionState.isEmpty && self.updatedStarGiftAuctionMyState.isEmpty
+ return self.addedIncomingMessageIds.isEmpty && self.addedReactionEvents.isEmpty && self.wasScheduledMessageIds.isEmpty && self.deletedMessageIds.isEmpty && self.sentScheduledMessageIds.isEmpty && self.updatedTypingActivities.isEmpty && self.updatedWebpages.isEmpty && self.updatedCalls.isEmpty && self.addedCallSignalingData.isEmpty && self.updatedGroupCallParticipants.isEmpty && self.groupCallMessageUpdates.isEmpty && self.storyUpdates.isEmpty && self.updatedPeersNearby?.isEmpty ?? true && self.isContactUpdates.isEmpty && self.displayAlerts.isEmpty && self.dismissBotWebViews.isEmpty && self.delayNotificatonsUntil == nil && self.updatedMaxMessageId == nil && self.updatedQts == nil && self.externallyUpdatedPeerId.isEmpty && !authorizationListUpdated && self.updatedIncomingThreadReadStates.isEmpty && self.updatedOutgoingThreadReadStates.isEmpty && !self.updateConfig && !self.isPremiumUpdated && self.updatedStarsBalance.isEmpty && self.updatedTonBalance.isEmpty && self.updatedStarsRevenueStatus.isEmpty && self.reportMessageDelivery.isEmpty && self.addedConferenceInvitationMessagesIds.isEmpty && self.updatedStarGiftAuctionState.isEmpty && self.updatedStarGiftAuctionMyState.isEmpty && self.updatedEmojiGameInfo == nil
}
- init(addedIncomingMessageIds: [MessageId] = [], addedReactionEvents: [(reactionAuthor: Peer, reaction: MessageReaction.Reaction, message: Message, timestamp: Int32)] = [], wasScheduledMessageIds: [MessageId] = [], deletedMessageIds: [DeletedMessageId] = [], updatedTypingActivities: [PeerActivitySpace: [PeerId: PeerInputActivity?]] = [:], updatedWebpages: [MediaId: TelegramMediaWebpage] = [:], updatedCalls: [Api.PhoneCall] = [], addedCallSignalingData: [(Int64, Data)] = [], updatedGroupCallParticipants: [(Int64, GroupCallParticipantsContext.Update)] = [], groupCallMessageUpdates: [GroupCallMessageUpdate] = [], storyUpdates: [InternalStoryUpdate] = [], updatedPeersNearby: [PeerNearby]? = nil, isContactUpdates: [(PeerId, Bool)] = [], displayAlerts: [(text: String, isDropAuth: Bool)] = [], dismissBotWebViews: [Int64] = [], delayNotificatonsUntil: Int32? = nil, updatedMaxMessageId: Int32? = nil, updatedQts: Int32? = nil, externallyUpdatedPeerId: Set = Set(), authorizationListUpdated: Bool = false, updatedIncomingThreadReadStates: [PeerAndBoundThreadId: MessageId.Id] = [:], updatedOutgoingThreadReadStates: [PeerAndBoundThreadId: MessageId.Id] = [:], updateConfig: Bool = false, isPremiumUpdated: Bool = false, updatedStarsBalance: [PeerId: StarsAmount] = [:], updatedTonBalance: [PeerId: StarsAmount] = [:], updatedStarsRevenueStatus: [PeerId: StarsRevenueStats.Balances] = [:], sentScheduledMessageIds: Set = Set(), reportMessageDelivery: Set = Set(), addedConferenceInvitationMessagesIds: [MessageId] = [], updatedStarGiftAuctionState: [Int64: GiftAuctionContext.State.AuctionState] = [:], updatedStarGiftAuctionMyState: [Int64: GiftAuctionContext.State.MyState] = [:]) {
+ init(addedIncomingMessageIds: [MessageId] = [], addedReactionEvents: [(reactionAuthor: Peer, reaction: MessageReaction.Reaction, message: Message, timestamp: Int32)] = [], wasScheduledMessageIds: [MessageId] = [], deletedMessageIds: [DeletedMessageId] = [], updatedTypingActivities: [PeerActivitySpace: [PeerId: PeerInputActivity?]] = [:], updatedWebpages: [MediaId: TelegramMediaWebpage] = [:], updatedCalls: [Api.PhoneCall] = [], addedCallSignalingData: [(Int64, Data)] = [], updatedGroupCallParticipants: [(Int64, GroupCallParticipantsContext.Update)] = [], groupCallMessageUpdates: [GroupCallMessageUpdate] = [], storyUpdates: [InternalStoryUpdate] = [], updatedPeersNearby: [PeerNearby]? = nil, isContactUpdates: [(PeerId, Bool)] = [], displayAlerts: [(text: String, isDropAuth: Bool)] = [], dismissBotWebViews: [Int64] = [], delayNotificatonsUntil: Int32? = nil, updatedMaxMessageId: Int32? = nil, updatedQts: Int32? = nil, externallyUpdatedPeerId: Set = Set(), authorizationListUpdated: Bool = false, updatedIncomingThreadReadStates: [PeerAndBoundThreadId: MessageId.Id] = [:], updatedOutgoingThreadReadStates: [PeerAndBoundThreadId: MessageId.Id] = [:], updateConfig: Bool = false, isPremiumUpdated: Bool = false, updatedStarsBalance: [PeerId: StarsAmount] = [:], updatedTonBalance: [PeerId: StarsAmount] = [:], updatedStarsRevenueStatus: [PeerId: StarsRevenueStats.Balances] = [:], sentScheduledMessageIds: Set = Set(), reportMessageDelivery: Set = Set(), addedConferenceInvitationMessagesIds: [MessageId] = [], updatedStarGiftAuctionState: [Int64: GiftAuctionContext.State.AuctionState] = [:], updatedStarGiftAuctionMyState: [Int64: GiftAuctionContext.State.MyState] = [:], updatedEmojiGameInfo: EmojiGameInfo? = nil) {
self.addedIncomingMessageIds = addedIncomingMessageIds
self.addedReactionEvents = addedReactionEvents
self.wasScheduledMessageIds = wasScheduledMessageIds
@@ -965,6 +972,7 @@ struct AccountFinalStateEvents {
self.addedConferenceInvitationMessagesIds = addedConferenceInvitationMessagesIds
self.updatedStarGiftAuctionState = updatedStarGiftAuctionState
self.updatedStarGiftAuctionMyState = updatedStarGiftAuctionMyState
+ self.updatedEmojiGameInfo = updatedEmojiGameInfo
}
init(state: AccountReplayedFinalState) {
@@ -1000,6 +1008,7 @@ struct AccountFinalStateEvents {
self.addedConferenceInvitationMessagesIds = state.addedConferenceInvitationMessagesIds
self.updatedStarGiftAuctionState = state.updatedStarGiftAuctionState
self.updatedStarGiftAuctionMyState = state.updatedStarGiftAuctionMyState
+ self.updatedEmojiGameInfo = state.updatedEmojiGameInfo
}
func union(with other: AccountFinalStateEvents) -> AccountFinalStateEvents {
@@ -1068,7 +1077,8 @@ struct AccountFinalStateEvents {
reportMessageDelivery: reportMessageDelivery,
addedConferenceInvitationMessagesIds: addedConferenceInvitationMessagesIds,
updatedStarGiftAuctionState: self.updatedStarGiftAuctionState.merging(other.updatedStarGiftAuctionState, uniquingKeysWith: { lhs, _ in lhs }),
- updatedStarGiftAuctionMyState: self.updatedStarGiftAuctionMyState.merging(other.updatedStarGiftAuctionMyState, uniquingKeysWith: { lhs, _ in lhs })
+ updatedStarGiftAuctionMyState: self.updatedStarGiftAuctionMyState.merging(other.updatedStarGiftAuctionMyState, uniquingKeysWith: { lhs, _ in lhs }),
+ updatedEmojiGameInfo: self.updatedEmojiGameInfo
)
}
}
diff --git a/submodules/TelegramCore/Sources/Account/AccountManager.swift b/submodules/TelegramCore/Sources/Account/AccountManager.swift
index d2031258..9897b02c 100644
--- a/submodules/TelegramCore/Sources/Account/AccountManager.swift
+++ b/submodules/TelegramCore/Sources/Account/AccountManager.swift
@@ -240,6 +240,7 @@ private var declaredEncodables: Void = {
declareEncodable(PublishedSuggestedPostMessageAttribute.self, f: { PublishedSuggestedPostMessageAttribute(decoder: $0) })
declareEncodable(TelegramMediaLiveStream.self, f: { TelegramMediaLiveStream(decoder: $0) })
declareEncodable(ScheduledRepeatAttribute.self, f: { ScheduledRepeatAttribute(decoder: $0) })
+ declareEncodable(SummarizationMessageAttribute.self, f: { SummarizationMessageAttribute(decoder: $0) })
return
}()
diff --git a/submodules/TelegramCore/Sources/AntiDelete/LocalEditManager.swift b/submodules/TelegramCore/Sources/AntiDelete/LocalEditManager.swift
new file mode 100644
index 00000000..75f9af07
--- /dev/null
+++ b/submodules/TelegramCore/Sources/AntiDelete/LocalEditManager.swift
@@ -0,0 +1,85 @@
+import Foundation
+
+/// ะะตะฝะตะดะถะตั ะดะปั ะปะพะบะฐะปัะฝะพะณะพ ัะตะดะฐะบัะธัะพะฒะฐะฝะธั ัะพะพะฑัะตะฝะธะน (ัะพะปัะบะพ ะฝะฐ ััะพัะพะฝะต ะบะปะธะตะฝัะฐ)
+/// ะฅัะฐะฝะธั ัะตะดะฐะบัะธัะพะฒะฐะฝะธั ะฒ ะฟะฐะผััะธ - ัะฑัะฐััะฒะฐัััั ะฟัะธ ะฟะตัะตะทะฐะฟััะบะต ะฟัะธะปะพะถะตะฝะธั
+public final class LocalEditManager {
+
+ public static let shared = LocalEditManager()
+
+ // MARK: - Storage
+
+ /// ะฅัะฐะฝะธะปะธัะต ัะตะดะฐะบัะธัะพะฒะฐะฝะธะน: "peerId_messageId" -> ะฝะพะฒัะน ัะตะบัั
+ private var edits: [String: String] = [:]
+ private let lock = NSLock()
+
+ private init() {}
+
+ // MARK: - Public API
+
+ /// ะฃััะฐะฝะพะฒะธัั ะปะพะบะฐะปัะฝะพะต ัะตะดะฐะบัะธัะพะฒะฐะฝะธะต ะดะปั ัะพะพะฑัะตะฝะธั
+ /// - Parameters:
+ /// - peerId: ID ัะฐัะฐ
+ /// - messageId: ID ัะพะพะฑัะตะฝะธั
+ /// - newText: ะะพะฒัะน ัะตะบัั ัะพะพะฑัะตะฝะธั
+ public func setLocalEdit(peerId: Int64, messageId: Int32, newText: String) {
+ let key = makeKey(peerId: peerId, messageId: messageId)
+ lock.lock()
+ defer { lock.unlock() }
+ edits[key] = newText
+ }
+
+ /// ะะพะปััะธัั ะปะพะบะฐะปัะฝะพะต ัะตะดะฐะบัะธัะพะฒะฐะฝะธะต ะดะปั ัะพะพะฑัะตะฝะธั
+ /// - Parameters:
+ /// - peerId: ID ัะฐัะฐ
+ /// - messageId: ID ัะพะพะฑัะตะฝะธั
+ /// - Returns: ะััะตะดะฐะบัะธัะพะฒะฐะฝะฝัะน ัะตะบัั ะธะปะธ nil ะตัะปะธ ัะตะดะฐะบัะธัะพะฒะฐะฝะธั ะฝะตั
+ public func getLocalEdit(peerId: Int64, messageId: Int32) -> String? {
+ let key = makeKey(peerId: peerId, messageId: messageId)
+ lock.lock()
+ defer { lock.unlock() }
+ return edits[key]
+ }
+
+ /// ะฃะดะฐะปะธัั ะปะพะบะฐะปัะฝะพะต ัะตะดะฐะบัะธัะพะฒะฐะฝะธะต ะดะปั ัะพะพะฑัะตะฝะธั
+ /// - Parameters:
+ /// - peerId: ID ัะฐัะฐ
+ /// - messageId: ID ัะพะพะฑัะตะฝะธั
+ public func removeLocalEdit(peerId: Int64, messageId: Int32) {
+ let key = makeKey(peerId: peerId, messageId: messageId)
+ lock.lock()
+ defer { lock.unlock() }
+ edits.removeValue(forKey: key)
+ }
+
+ /// ะัะพะฒะตัะธัั ะฝะฐะปะธัะธะต ะปะพะบะฐะปัะฝะพะณะพ ัะตะดะฐะบัะธัะพะฒะฐะฝะธั
+ /// - Parameters:
+ /// - peerId: ID ัะฐัะฐ
+ /// - messageId: ID ัะพะพะฑัะตะฝะธั
+ /// - Returns: true ะตัะปะธ ะตััั ัะตะดะฐะบัะธัะพะฒะฐะฝะธะต
+ public func hasLocalEdit(peerId: Int64, messageId: Int32) -> Bool {
+ let key = makeKey(peerId: peerId, messageId: messageId)
+ lock.lock()
+ defer { lock.unlock() }
+ return edits[key] != nil
+ }
+
+ /// ะัะธััะธัั ะฒัะต ะปะพะบะฐะปัะฝัะต ัะตะดะฐะบัะธัะพะฒะฐะฝะธั
+ public func clearAllEdits() {
+ lock.lock()
+ defer { lock.unlock() }
+ edits.removeAll()
+ }
+
+ /// ะะพะปะธัะตััะฒะพ ะฐะบัะธะฒะฝัั
ัะตะดะฐะบัะธัะพะฒะฐะฝะธะน
+ public var editCount: Int {
+ lock.lock()
+ defer { lock.unlock() }
+ return edits.count
+ }
+
+ // MARK: - Private
+
+ private func makeKey(peerId: Int64, messageId: Int32) -> String {
+ return "\(peerId)_\(messageId)"
+ }
+}
diff --git a/submodules/TelegramCore/Sources/ApiUtils/StoreMessage_Telegram.swift b/submodules/TelegramCore/Sources/ApiUtils/StoreMessage_Telegram.swift
index f32fbbe7..ca8956b5 100644
--- a/submodules/TelegramCore/Sources/ApiUtils/StoreMessage_Telegram.swift
+++ b/submodules/TelegramCore/Sources/ApiUtils/StoreMessage_Telegram.swift
@@ -128,7 +128,7 @@ public func tagsForStoreMessage(incoming: Bool, attributes: [MessageAttribute],
func apiMessagePeerId(_ messsage: Api.Message) -> PeerId? {
switch messsage {
- case let .message(_, _, _, _, _, messagePeerId, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _):
+ case let .message(_, _, _, _, _, messagePeerId, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _):
let chatPeerId = messagePeerId
return chatPeerId.peerId
case let .messageEmpty(_, _, peerId):
@@ -144,7 +144,7 @@ func apiMessagePeerId(_ messsage: Api.Message) -> PeerId? {
func apiMessagePeerIds(_ message: Api.Message) -> [PeerId] {
switch message {
- case let .message(_, _, _, fromId, _, chatPeerId, savedPeerId, fwdHeader, viaBotId, viaBusinessBotId, replyTo, _, _, media, _, entities, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _):
+ case let .message(_, _, _, fromId, _, chatPeerId, savedPeerId, fwdHeader, viaBotId, viaBusinessBotId, replyTo, _, _, media, _, entities, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _):
let peerId: PeerId = chatPeerId.peerId
var result = [peerId]
@@ -279,7 +279,7 @@ func apiMessagePeerIds(_ message: Api.Message) -> [PeerId] {
func apiMessageAssociatedMessageIds(_ message: Api.Message) -> (replyIds: ReferencedReplyMessageIds, generalIds: [MessageId])? {
switch message {
- case let .message(_, _, id, _, _, chatPeerId, _, _, _, _, replyTo, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _):
+ case let .message(_, _, id, _, _, chatPeerId, _, _, _, _, replyTo, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _):
if let replyTo = replyTo {
let peerId: PeerId = chatPeerId.peerId
@@ -457,8 +457,17 @@ func textMediaAndExpirationTimerFromApiMedia(_ media: Api.MessageMedia?, _ peerI
}
return (TelegramMediaTodo(flags: flags, text: todoText, textEntities: todoEntities, items: list.map(TelegramMediaTodo.Item.init(apiItem:)), completions: todoCompletions), nil, nil, nil, nil, nil)
}
- case let .messageMediaDice(value, emoticon):
- return (TelegramMediaDice(emoji: emoticon, value: value), nil, nil, nil, nil, nil)
+ case let .messageMediaDice(_, value, emoticon, apiGameOutcome):
+ var gameOutcome: TelegramMediaDice.GameOutcome?
+ var tonAmount: Int64?
+ switch apiGameOutcome {
+ case let .emojiGameOutcome(seed, stakeTonAmount, outcomeTonAmount):
+ gameOutcome = TelegramMediaDice.GameOutcome(seed: seed.makeData(), tonAmount: outcomeTonAmount)
+ tonAmount = stakeTonAmount
+ default:
+ break
+ }
+ return (TelegramMediaDice(emoji: emoticon, tonAmount: tonAmount, value: value, gameOutcome: gameOutcome), nil, nil, nil, nil, nil)
case let .messageMediaStory(flags, peerId, id, _):
let isMention = (flags & (1 << 1)) != 0
return (TelegramMediaStory(storyId: StoryId(peerId: peerId.peerId, id: id), isMention: isMention), nil, nil, nil, nil, nil)
@@ -703,7 +712,7 @@ func messageTextEntitiesFromApiEntities(_ entities: [Api.MessageEntity]) -> [Mes
extension StoreMessage {
convenience init?(apiMessage: Api.Message, accountPeerId: PeerId, peerIsForum: Bool, namespace: MessageId.Namespace = Namespaces.Message.Cloud) {
switch apiMessage {
- case let .message(flags, flags2, id, fromId, boosts, chatPeerId, savedPeerId, fwdFrom, viaBotId, viaBusinessBotId, replyTo, date, message, media, replyMarkup, entities, views, forwards, replies, editDate, postAuthor, groupingId, reactions, restrictionReason, ttlPeriod, quickReplyShortcutId, messageEffectId, factCheck, reportDeliveryUntilDate, paidMessageStars, suggestedPost, scheduledRepeatPeriod):
+ case let .message(flags, flags2, id, fromId, boosts, chatPeerId, savedPeerId, fwdFrom, viaBotId, viaBusinessBotId, replyTo, date, message, media, replyMarkup, entities, views, forwards, replies, editDate, postAuthor, groupingId, reactions, restrictionReason, ttlPeriod, quickReplyShortcutId, messageEffectId, factCheck, reportDeliveryUntilDate, paidMessageStars, suggestedPost, scheduledRepeatPeriod, summaryFromLanguage):
var attributes: [MessageAttribute] = []
if (flags2 & (1 << 4)) != 0 {
@@ -964,6 +973,10 @@ extension StoreMessage {
attributes.append(ScheduledRepeatAttribute(repeatPeriod: scheduledRepeatPeriod))
}
+ if let summaryFromLanguage {
+ attributes.append(SummarizationMessageAttribute(fromLang: summaryFromLanguage))
+ }
+
var entitiesAttribute: TextEntitiesMessageAttribute?
if let entities = entities, !entities.isEmpty {
let attribute = TextEntitiesMessageAttribute(entities: messageTextEntitiesFromApiEntities(entities))
@@ -988,7 +1001,7 @@ extension StoreMessage {
}
}
- if (flags & (1 << 17)) != 0 {
+ if (flags & (1 << 19)) != 0 {
attributes.append(ContentRequiresValidationMessageAttribute())
}
@@ -1174,7 +1187,7 @@ extension StoreMessage {
threadId = 1
}
- if (flags & (1 << 17)) != 0 {
+ if (flags & (1 << 19)) != 0 {
attributes.append(ContentRequiresValidationMessageAttribute())
}
diff --git a/submodules/TelegramCore/Sources/PendingMessages/PendingMessageUploadedContent.swift b/submodules/TelegramCore/Sources/PendingMessages/PendingMessageUploadedContent.swift
index 1940b8d0..4f78188e 100644
--- a/submodules/TelegramCore/Sources/PendingMessages/PendingMessageUploadedContent.swift
+++ b/submodules/TelegramCore/Sources/PendingMessages/PendingMessageUploadedContent.swift
@@ -343,8 +343,26 @@ func mediaContentToUpload(accountPeerId: PeerId, network: Network, postbox: Post
let inputTodo = Api.InputMedia.inputMediaTodo(todo: .todoList(flags: flags, title: .textWithEntities(text: todo.text, entities: apiEntitiesFromMessageTextEntities(todo.textEntities, associatedPeers: SimpleDictionary())), list: todo.items.map { $0.apiItem }))
return .single(.content(PendingMessageUploadedContentAndReuploadInfo(content: .media(inputTodo, text), reuploadInfo: nil, cacheReferenceKey: nil)))
} else if let dice = media as? TelegramMediaDice {
- let inputDice = Api.InputMedia.inputMediaDice(emoticon: dice.emoji)
- return .single(.content(PendingMessageUploadedContentAndReuploadInfo(content: .media(inputDice, text), reuploadInfo: nil, cacheReferenceKey: nil)))
+ if let tonAmount = dice.tonAmount {
+ let seedBytes = malloc(32)!
+ let _ = SecRandomCopyBytes(nil, 32, seedBytes.assumingMemoryBound(to: UInt8.self))
+ let clientSeed = MemoryBuffer(memory: seedBytes, capacity: 32, length: 32, freeWhenDone: true)
+
+ return postbox.transaction { transaction -> Signal in
+ let gameInfo = currentEmojiGameInfo(transaction: transaction)
+ if case let .available(info) = gameInfo {
+ let inputStakeDice = Api.InputMedia.inputMediaStakeDice(gameHash: info.gameHash, tonAmount: tonAmount, clientSeed: Buffer(buffer: clientSeed))
+ return .single(.content(PendingMessageUploadedContentAndReuploadInfo(content: .media(inputStakeDice, text), reuploadInfo: nil, cacheReferenceKey: nil)))
+ } else {
+ return .fail(.generic)
+ }
+ }
+ |> castError(PendingMessageUploadError.self)
+ |> switchToLatest
+ } else {
+ let inputDice = Api.InputMedia.inputMediaDice(emoticon: dice.emoji)
+ return .single(.content(PendingMessageUploadedContentAndReuploadInfo(content: .media(inputDice, text), reuploadInfo: nil, cacheReferenceKey: nil)))
+ }
} else if let webPage = media as? TelegramMediaWebpage, case let .Loaded(content) = webPage.content {
var flags: Int32 = 0
flags |= 1 << 2
diff --git a/submodules/TelegramCore/Sources/State/AccountStateManagementUtils.swift b/submodules/TelegramCore/Sources/State/AccountStateManagementUtils.swift
index 4c823903..0f6e050e 100644
--- a/submodules/TelegramCore/Sources/State/AccountStateManagementUtils.swift
+++ b/submodules/TelegramCore/Sources/State/AccountStateManagementUtils.swift
@@ -1020,6 +1020,8 @@ private func finalStateWithUpdatesAndServerTime(accountPeerId: PeerId, postbox:
let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId))
updatedState.updateMinAvailableMessage(MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: minId))
case let .updateDeleteMessages(messages, _, _):
+ // Note: Actual archiving happens in DeleteMessagesWithGlobalIds handler
+ // where we have access to transaction and can get full message content
updatedState.deleteMessagesWithGlobalIds(messages)
case let .updatePinnedMessages(flags, peer, messages, _, _):
let peerId = peer.peerId
@@ -1906,6 +1908,8 @@ private func finalStateWithUpdatesAndServerTime(accountPeerId: PeerId, postbox:
}
case let .updateStarGiftAuctionUserState(giftId, userState):
updatedState.updateStarGiftAuctionMyState(giftId: giftId, state: GiftAuctionContext.State.MyState(apiAuctionUserState: userState))
+ case let .updateEmojiGameInfo(info):
+ updatedState.updateEmojiGameInfo(info: EmojiGameInfo(apiEmojiGameInfo: info))
default:
break
}
@@ -3629,7 +3633,7 @@ private func optimizedOperations(_ operations: [AccountStateMutationOperation])
var currentAddQuickReplyMessages: OptimizeAddMessagesState?
for operation in operations {
switch operation {
- case .DeleteMessages, .DeleteMessagesWithGlobalIds, .EditMessage, .UpdateMessagePoll, .UpdateMessageReactions, .UpdateMedia, .MergeApiChats, .MergeApiUsers, .MergePeerPresences, .UpdatePeer, .ReadInbox, .ReadOutbox, .ReadGroupFeedInbox, .ResetReadState, .ResetIncomingReadState, .UpdatePeerChatUnreadMark, .ResetMessageTagSummary, .UpdateNotificationSettings, .UpdateGlobalNotificationSettings, .UpdateSecretChat, .AddSecretMessages, .ReadSecretOutbox, .AddPeerInputActivity, .AddPeerLiveTypingDraftUpdate, .UpdateCachedPeerData, .UpdatePinnedItemIds, .UpdatePinnedSavedItemIds, .UpdatePinnedTopic, .UpdatePinnedTopicOrder, .ReadMessageContents, .UpdateMessageImpressionCount, .UpdateMessageForwardsCount, .UpdateInstalledStickerPacks, .UpdateRecentGifs, .UpdateChatInputState, .UpdateCall, .AddCallSignalingData, .UpdateLangPack, .UpdateMinAvailableMessage, .UpdateIsContact, .UpdatePeerChatInclusion, .UpdatePeersNearby, .UpdateTheme, .SyncChatListFilters, .UpdateChatListFilter, .UpdateChatListFilterOrder, .UpdateReadThread, .UpdateMessagesPinned, .UpdateGroupCallParticipants, .UpdateGroupCall, .UpdateGroupCallChainBlocks, .UpdateGroupCallMessage, .UpdateGroupCallOpaqueMessage, .UpdateAutoremoveTimeout, .UpdateAttachMenuBots, .UpdateAudioTranscription, .UpdateConfig, .UpdateExtendedMedia, .ResetForumTopic, .UpdateStory, .UpdateReadStories, .UpdateStoryStealthMode, .UpdateStorySentReaction, .UpdateNewAuthorization, .UpdateWallpaper, .UpdateStarsBalance, .UpdateStarsRevenueStatus, .UpdateStarsReactionsDefaultPrivacy, .ReportMessageDelivery, .UpdateMonoForumNoPaidException, .UpdateStarGiftAuctionState, .UpdateStarGiftAuctionMyState:
+ case .DeleteMessages, .DeleteMessagesWithGlobalIds, .EditMessage, .UpdateMessagePoll, .UpdateMessageReactions, .UpdateMedia, .MergeApiChats, .MergeApiUsers, .MergePeerPresences, .UpdatePeer, .ReadInbox, .ReadOutbox, .ReadGroupFeedInbox, .ResetReadState, .ResetIncomingReadState, .UpdatePeerChatUnreadMark, .ResetMessageTagSummary, .UpdateNotificationSettings, .UpdateGlobalNotificationSettings, .UpdateSecretChat, .AddSecretMessages, .ReadSecretOutbox, .AddPeerInputActivity, .AddPeerLiveTypingDraftUpdate, .UpdateCachedPeerData, .UpdatePinnedItemIds, .UpdatePinnedSavedItemIds, .UpdatePinnedTopic, .UpdatePinnedTopicOrder, .ReadMessageContents, .UpdateMessageImpressionCount, .UpdateMessageForwardsCount, .UpdateInstalledStickerPacks, .UpdateRecentGifs, .UpdateChatInputState, .UpdateCall, .AddCallSignalingData, .UpdateLangPack, .UpdateMinAvailableMessage, .UpdateIsContact, .UpdatePeerChatInclusion, .UpdatePeersNearby, .UpdateTheme, .SyncChatListFilters, .UpdateChatListFilter, .UpdateChatListFilterOrder, .UpdateReadThread, .UpdateMessagesPinned, .UpdateGroupCallParticipants, .UpdateGroupCall, .UpdateGroupCallChainBlocks, .UpdateGroupCallMessage, .UpdateGroupCallOpaqueMessage, .UpdateAutoremoveTimeout, .UpdateAttachMenuBots, .UpdateAudioTranscription, .UpdateConfig, .UpdateExtendedMedia, .ResetForumTopic, .UpdateStory, .UpdateReadStories, .UpdateStoryStealthMode, .UpdateStorySentReaction, .UpdateNewAuthorization, .UpdateWallpaper, .UpdateStarsBalance, .UpdateStarsRevenueStatus, .UpdateStarsReactionsDefaultPrivacy, .ReportMessageDelivery, .UpdateMonoForumNoPaidException, .UpdateStarGiftAuctionState, .UpdateStarGiftAuctionMyState, .UpdateEmojiGameInfo:
if let currentAddMessages = currentAddMessages, !currentAddMessages.messages.isEmpty {
result.append(.AddMessages(currentAddMessages.messages, currentAddMessages.location))
}
@@ -3772,6 +3776,7 @@ func replayFinalState(
var reportMessageDelivery = Set()
var updatedStarGiftAuctionState: [Int64: GiftAuctionContext.State.AuctionState] = [:]
var updatedStarGiftAuctionMyState: [Int64: GiftAuctionContext.State.MyState] = [:]
+ var updatedEmojiGameInfo: EmojiGameInfo?
var holesFromPreviousStateMessageIds: [MessageId] = []
var clearHolesFromPreviousStateForChannelMessagesWithPts: [PeerIdAndMessageNamespace: Int32] = [:]
@@ -4224,18 +4229,166 @@ func replayFinalState(
}
}
case let .DeleteMessagesWithGlobalIds(ids):
- var resourceIds: [MediaResourceId] = []
- transaction.deleteMessagesWithGlobalIds(ids, forEachMedia: { media in
- addMessageMediaResourceIdsToRemove(media: media, resourceIds: &resourceIds)
- })
- if !resourceIds.isEmpty {
- let _ = mediaBox.removeCachedResources(Array(Set(resourceIds)), force: true).start()
+ // ANTI-DELETE: Archive messages with full content before deletion
+ if AntiDeleteManager.shared.isEnabled {
+ let messageIds = transaction.messageIdsForGlobalIds(ids)
+ for (index, messageId) in messageIds.enumerated() {
+ if let message = transaction.getMessage(messageId) {
+ let globalId = index < ids.count ? ids[index] : 0
+
+ // Extract text content
+ let textContent = message.text
+
+ // Extract media description
+ var mediaDesc: String? = nil
+ for media in message.media {
+ switch media {
+ case let image as TelegramMediaImage:
+ mediaDesc = "๐ท Photo"
+ if let largest = image.representations.last {
+ mediaDesc = "๐ท Photo \(largest.dimensions.width)x\(largest.dimensions.height)"
+ }
+ case let file as TelegramMediaFile:
+ if file.isVideo {
+ mediaDesc = "๐ฌ Video"
+ } else if file.isVoice {
+ mediaDesc = "๐ค Voice Message"
+ } else if file.isInstantVideo {
+ mediaDesc = "๐น Video Message"
+ } else if file.isSticker {
+ mediaDesc = "๐ญ Sticker"
+ } else {
+ mediaDesc = "๐ \(file.fileName ?? "File")"
+ }
+ case is TelegramMediaContact:
+ mediaDesc = "๐ค Contact"
+ case is TelegramMediaMap:
+ mediaDesc = "๐ Location"
+ case let poll as TelegramMediaPoll:
+ mediaDesc = "๐ Poll: \(poll.text)"
+ default:
+ break
+ }
+ }
+
+ AntiDeleteManager.shared.archiveMessage(
+ globalId: globalId,
+ peerId: messageId.peerId.toInt64(),
+ messageId: messageId.id,
+ timestamp: message.timestamp,
+ authorId: message.author?.id.toInt64(),
+ text: textContent,
+ forwardAuthorId: message.forwardInfo?.author?.id.toInt64(),
+ mediaDescription: mediaDesc
+ )
+ }
+ }
+ }
+
+ // ANTI-DELETE: Mark messages as deleted instead of removing them
+ if AntiDeleteManager.shared.isEnabled {
+ let messageIds = transaction.messageIdsForGlobalIds(ids)
+ for messageId in messageIds {
+ // Mark as deleted for icon display
+ AntiDeleteManager.shared.markAsDeleted(peerId: messageId.peerId.toInt64(), messageId: messageId.id)
+
+ transaction.updateMessage(messageId, update: { currentMessage in
+ var attributes = currentMessage.attributes
+ // Don't add duplicate DeletedMessageAttribute
+ if !attributes.contains(where: { $0 is DeletedMessageAttribute }) {
+ attributes.append(DeletedMessageAttribute(deletedAt: Int32(Date().timeIntervalSince1970)))
+ }
+ let storeForwardInfo = currentMessage.forwardInfo.flatMap(StoreMessageForwardInfo.init)
+ // Keep original text, no prefix needed - icon will show deleted status
+ return .update(StoreMessage(id: currentMessage.id, customStableId: nil, globallyUniqueId: currentMessage.globallyUniqueId, groupingKey: currentMessage.groupingKey, threadId: currentMessage.threadId, timestamp: currentMessage.timestamp, flags: StoreMessageFlags(currentMessage.flags), tags: currentMessage.tags, globalTags: currentMessage.globalTags, localTags: currentMessage.localTags, forwardInfo: storeForwardInfo, authorId: currentMessage.author?.id, text: currentMessage.text, attributes: attributes, media: currentMessage.media))
+ })
+ }
+ } else {
+ var resourceIds: [MediaResourceId] = []
+ transaction.deleteMessagesWithGlobalIds(ids, forEachMedia: { media in
+ addMessageMediaResourceIdsToRemove(media: media, resourceIds: &resourceIds)
+ })
+ if !resourceIds.isEmpty {
+ let _ = mediaBox.removeCachedResources(Array(Set(resourceIds)), force: true).start()
+ }
}
deletedMessageIds.append(contentsOf: ids.map { .global($0) })
case let .DeleteMessages(ids):
- _internal_deleteMessages(transaction: transaction, mediaBox: mediaBox, ids: ids, manualAddMessageThreadStatsDifference: { id, add, remove in
- addMessageThreadStatsDifference(threadKey: id, remove: remove, addedMessagePeer: nil, addedMessageId: nil, isOutgoing: false)
- })
+ // ANTI-DELETE: Archive channel messages with full content before deletion
+ if AntiDeleteManager.shared.isEnabled {
+ for messageId in ids {
+ if let message = transaction.getMessage(messageId) {
+ // Extract text content
+ let textContent = message.text
+
+ // Extract media description
+ var mediaDesc: String? = nil
+ for media in message.media {
+ switch media {
+ case let image as TelegramMediaImage:
+ mediaDesc = "๐ท Photo"
+ if let largest = image.representations.last {
+ mediaDesc = "๐ท Photo \(largest.dimensions.width)x\(largest.dimensions.height)"
+ }
+ case let file as TelegramMediaFile:
+ if file.isVideo {
+ mediaDesc = "๐ฌ Video"
+ } else if file.isVoice {
+ mediaDesc = "๐ค Voice Message"
+ } else if file.isInstantVideo {
+ mediaDesc = "๐น Video Message"
+ } else if file.isSticker {
+ mediaDesc = "๐ญ Sticker"
+ } else {
+ mediaDesc = "๐ \(file.fileName ?? "File")"
+ }
+ case is TelegramMediaContact:
+ mediaDesc = "๐ค Contact"
+ case is TelegramMediaMap:
+ mediaDesc = "๐ Location"
+ case let poll as TelegramMediaPoll:
+ mediaDesc = "๐ Poll: \(poll.text)"
+ default:
+ break
+ }
+ }
+
+ AntiDeleteManager.shared.archiveMessage(
+ globalId: messageId.id, // Use message id as globalId for channel messages
+ peerId: messageId.peerId.toInt64(),
+ messageId: messageId.id,
+ timestamp: message.timestamp,
+ authorId: message.author?.id.toInt64(),
+ text: textContent,
+ forwardAuthorId: message.forwardInfo?.author?.id.toInt64(),
+ mediaDescription: mediaDesc
+ )
+ }
+ }
+ }
+
+ // ANTI-DELETE: Mark messages as deleted instead of removing them
+ if AntiDeleteManager.shared.isEnabled {
+ for messageId in ids {
+ // Mark as deleted for icon display
+ AntiDeleteManager.shared.markAsDeleted(peerId: messageId.peerId.toInt64(), messageId: messageId.id)
+
+ transaction.updateMessage(messageId, update: { currentMessage in
+ var attributes = currentMessage.attributes
+ // Don't add duplicate DeletedMessageAttribute
+ if !attributes.contains(where: { $0 is DeletedMessageAttribute }) {
+ attributes.append(DeletedMessageAttribute(deletedAt: Int32(Date().timeIntervalSince1970)))
+ }
+ let storeForwardInfo = currentMessage.forwardInfo.flatMap(StoreMessageForwardInfo.init)
+ // Keep original text, no prefix needed - icon will show deleted status
+ return .update(StoreMessage(id: currentMessage.id, customStableId: nil, globallyUniqueId: currentMessage.globallyUniqueId, groupingKey: currentMessage.groupingKey, threadId: currentMessage.threadId, timestamp: currentMessage.timestamp, flags: StoreMessageFlags(currentMessage.flags), tags: currentMessage.tags, globalTags: currentMessage.globalTags, localTags: currentMessage.localTags, forwardInfo: storeForwardInfo, authorId: currentMessage.author?.id, text: currentMessage.text, attributes: attributes, media: currentMessage.media))
+ })
+ }
+ } else {
+ _internal_deleteMessages(transaction: transaction, mediaBox: mediaBox, ids: ids, manualAddMessageThreadStatsDifference: { id, add, remove in
+ addMessageThreadStatsDifference(threadKey: id, remove: remove, addedMessagePeer: nil, addedMessageId: nil, isOutgoing: false)
+ })
+ }
deletedMessageIds.append(contentsOf: ids.map { .messageId($0) })
case let .UpdateMinAvailableMessage(id):
if let message = transaction.getMessage(id) {
@@ -4294,6 +4447,14 @@ func replayFinalState(
updatedAttributes.append(translation)
}
}
+ } else {
+ // GHOSTGRAM: Save original text before edit
+ EditHistoryManager.shared.saveOriginalText(
+ peerId: id.peerId.toInt64(),
+ messageId: id.id,
+ originalText: previousMessage.text,
+ editDate: Int32(Date().timeIntervalSince1970)
+ )
}
if let previousFactCheckAttribute = previousMessage.attributes.first(where: { $0 is FactCheckMessageAttribute }) as? FactCheckMessageAttribute, let updatedFactCheckAttribute = message.attributes.first(where: { $0 is FactCheckMessageAttribute }) as? FactCheckMessageAttribute {
@@ -5339,6 +5500,8 @@ func replayFinalState(
updatedStarGiftAuctionState[giftId] = state
case let .UpdateStarGiftAuctionMyState(giftId, state):
updatedStarGiftAuctionMyState[giftId] = state
+ case let .UpdateEmojiGameInfo(info):
+ updatedEmojiGameInfo = info
}
}
@@ -5889,6 +6052,7 @@ func replayFinalState(
reportMessageDelivery: reportMessageDelivery,
addedConferenceInvitationMessagesIds: addedConferenceInvitationMessagesIds,
updatedStarGiftAuctionState: updatedStarGiftAuctionState,
- updatedStarGiftAuctionMyState: updatedStarGiftAuctionMyState
+ updatedStarGiftAuctionMyState: updatedStarGiftAuctionMyState,
+ updatedEmojiGameInfo: updatedEmojiGameInfo
)
}
diff --git a/submodules/TelegramCore/Sources/State/AccountStateManager.swift b/submodules/TelegramCore/Sources/State/AccountStateManager.swift
index e9cce703..75c8b017 100644
--- a/submodules/TelegramCore/Sources/State/AccountStateManager.swift
+++ b/submodules/TelegramCore/Sources/State/AccountStateManager.swift
@@ -374,6 +374,7 @@ public final class AccountStateManager {
private let appliedQtsPromise = Promise(nil)
private let appliedQtsDisposable = MetaDisposable()
private let reportMessageDeliveryDisposable = DisposableSet()
+ private let updateEmojiGameInfoDisposable = MetaDisposable()
let updateConfigRequested: (() -> Void)?
let isPremiumUpdated: (() -> Void)?
@@ -414,6 +415,7 @@ public final class AccountStateManager {
self.appliedMaxMessageIdDisposable.dispose()
self.appliedQtsDisposable.dispose()
self.reportMessageDeliveryDisposable.dispose()
+ self.updateEmojiGameInfoDisposable.dispose()
}
public func reset() {
@@ -1137,6 +1139,11 @@ public final class AccountStateManager {
if !events.updatedStarGiftAuctionMyState.isEmpty {
strongSelf.notifyUpdatedStarGiftAuctionMyState(events.updatedStarGiftAuctionMyState)
}
+ if let updatedEmojiGameInfo = events.updatedEmojiGameInfo {
+ strongSelf.updateEmojiGameInfoDisposable.set(strongSelf.postbox.transaction({ transaction in
+ updateEmojiGameInfo(transaction: transaction, { _ in return updatedEmojiGameInfo })
+ }).start())
+ }
if !events.updatedCalls.isEmpty {
for call in events.updatedCalls {
strongSelf.callSessionManager?.updateSession(call, completion: { _ in })
diff --git a/submodules/TelegramCore/Sources/State/AccountTaskManager.swift b/submodules/TelegramCore/Sources/State/AccountTaskManager.swift
index d470168d..1b644084 100644
--- a/submodules/TelegramCore/Sources/State/AccountTaskManager.swift
+++ b/submodules/TelegramCore/Sources/State/AccountTaskManager.swift
@@ -125,6 +125,7 @@ final class AccountTaskManager {
tasks.add(managedPeerColorUpdates(postbox: self.stateManager.postbox, network: self.stateManager.network).start())
tasks.add(managedStarGiftsUpdates(postbox: self.stateManager.postbox, network: self.stateManager.network, accountPeerId: self.stateManager.accountPeerId).start())
tasks.add(managedSavedMusicIdsUpdates(postbox: self.stateManager.postbox, network: self.stateManager.network, accountPeerId: self.stateManager.accountPeerId).start())
+ tasks.add(managedEmojiGameUpdates(postbox: self.stateManager.postbox, network: self.stateManager.network).start())
self.managedTopReactionsDisposable.set(managedTopReactions(postbox: self.stateManager.postbox, network: self.stateManager.network).start())
diff --git a/submodules/TelegramCore/Sources/State/AccountViewTracker.swift b/submodules/TelegramCore/Sources/State/AccountViewTracker.swift
index e775e854..ae88fa3c 100644
--- a/submodules/TelegramCore/Sources/State/AccountViewTracker.swift
+++ b/submodules/TelegramCore/Sources/State/AccountViewTracker.swift
@@ -2173,7 +2173,7 @@ public final class AccountViewTracker {
fixedCombinedReadStates: .peer([peerId: CombinedPeerReadState(states: [
(Namespaces.Message.Cloud, PeerReadState.idBased(maxIncomingReadId: Int32.max - 1, maxOutgoingReadId: Int32.max - 1, maxKnownId: Int32.max - 1, count: 0, markedUnread: false))
])]),
- topTaggedMessageIdNamespaces: [],
+ topTaggedMessageIdNamespaces: [Namespaces.Message.Cloud],
tag: tag,
appendMessagesFromTheSameGroup: false,
namespaces: .not(Namespaces.Message.allNonRegular),
@@ -2201,7 +2201,7 @@ public final class AccountViewTracker {
count: count,
trackHoles: trackHoles,
fixedCombinedReadStates: nil,
- topTaggedMessageIdNamespaces: [],
+ topTaggedMessageIdNamespaces: [Namespaces.Message.Cloud],
tag: tag,
appendMessagesFromTheSameGroup: false,
namespaces: .not(Namespaces.Message.allNonRegular),
diff --git a/submodules/TelegramCore/Sources/State/ApplyUpdateMessage.swift b/submodules/TelegramCore/Sources/State/ApplyUpdateMessage.swift
index 185ed044..56c75694 100644
--- a/submodules/TelegramCore/Sources/State/ApplyUpdateMessage.swift
+++ b/submodules/TelegramCore/Sources/State/ApplyUpdateMessage.swift
@@ -104,7 +104,7 @@ func applyUpdateMessage(postbox: Postbox, stateManager: AccountStateManager, mes
var updatedTimestamp: Int32?
if let apiMessage = apiMessage {
switch apiMessage {
- case let .message(_, _, _, _, _, _, _, _, _, _, _, date, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _):
+ case let .message(_, _, _, _, _, _, _, _, _, _, _, date, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _):
updatedTimestamp = date
case .messageEmpty:
break
@@ -400,7 +400,7 @@ func applyUpdateGroupMessages(postbox: Postbox, stateManager: AccountStateManage
} else if let message = messages.first, let apiMessage = result.messages.first {
if message.scheduleTime != nil && message.scheduleTime == apiMessage.timestamp {
namespace = Namespaces.Message.ScheduledCloud
- } else if let apiMessage = result.messages.first, case let .message(_, flags2, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) = apiMessage, (flags2 & (1 << 4)) != 0 {
+ } else if let apiMessage = result.messages.first, case let .message(_, flags2, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) = apiMessage, (flags2 & (1 << 4)) != 0 {
namespace = Namespaces.Message.ScheduledCloud
}
}
diff --git a/submodules/TelegramCore/Sources/State/ManagedAccountPresence.swift b/submodules/TelegramCore/Sources/State/ManagedAccountPresence.swift
index 8c8a4fa3..620f1c31 100644
--- a/submodules/TelegramCore/Sources/State/ManagedAccountPresence.swift
+++ b/submodules/TelegramCore/Sources/State/ManagedAccountPresence.swift
@@ -43,8 +43,18 @@ private final class AccountPresenceManagerImpl {
}
private func updatePresence(_ isOnline: Bool) {
+ // GHOST MODE: Completely block status updates to freeze "last seen" time
+ if GhostModeManager.shared.shouldHideOnlineStatus {
+ self.onlineTimer?.invalidate()
+ self.onlineTimer = nil
+ return
+ }
+
+ // ALWAYS ONLINE: Force online status when enabled
+ let effectiveOnline = MiscSettingsManager.shared.shouldAlwaysBeOnline ? true : isOnline
+
let request: Signal
- if isOnline {
+ if effectiveOnline {
let timer = SignalKitTimer(timeout: 30.0, repeat: false, completion: { [weak self] in
guard let strongSelf = self else {
return
diff --git a/submodules/TelegramCore/Sources/State/ManagedCloudChatRemoveMessagesOperations.swift b/submodules/TelegramCore/Sources/State/ManagedCloudChatRemoveMessagesOperations.swift
index 70157349..ddca0d3f 100644
--- a/submodules/TelegramCore/Sources/State/ManagedCloudChatRemoveMessagesOperations.swift
+++ b/submodules/TelegramCore/Sources/State/ManagedCloudChatRemoveMessagesOperations.swift
@@ -479,6 +479,26 @@ private func _internal_clearHistory(transaction: Transaction, postbox: Postbox,
|> `catch` { _ -> Signal in
return .complete()
}
+ } else if let threadId = operation.threadId {
+ guard let inputPeer = apiInputPeer(peer) else {
+ return .complete()
+ }
+ return network.request(Api.functions.messages.deleteTopicHistory(peer: inputPeer, topMsgId: Int32(clamping: threadId)))
+ |> map(Optional.init)
+ |> `catch` { _ -> Signal in
+ return .single(nil)
+ }
+ |> mapToSignal { result -> Signal in
+ if let result = result {
+ switch result {
+ case let .affectedHistory(pts, ptsCount, _):
+ stateManager.addUpdateGroups([.updatePts(pts: pts, ptsCount: ptsCount)])
+ return .complete()
+ }
+ } else {
+ return .complete()
+ }
+ }
} else {
return requestClearHistory(postbox: postbox, network: network, stateManager: stateManager, inputPeer: inputPeer, maxId: operation.topMessageId.id, justClear: true, minTimestamp: operation.minTimestamp, maxTimestamp: operation.maxTimestamp, type: operation.type)
}
diff --git a/submodules/TelegramCore/Sources/State/ManagedEmojiGameUpdates.swift b/submodules/TelegramCore/Sources/State/ManagedEmojiGameUpdates.swift
new file mode 100644
index 00000000..710f7890
--- /dev/null
+++ b/submodules/TelegramCore/Sources/State/ManagedEmojiGameUpdates.swift
@@ -0,0 +1,104 @@
+import Foundation
+import Postbox
+import SwiftSignalKit
+import TelegramApi
+import MtProtoKit
+
+public enum EmojiGameInfo: Codable, Equatable {
+ private enum CodingKeys: String, CodingKey {
+ case type
+ case info
+ }
+
+ public struct Info: Codable, Equatable {
+ public let gameHash: String
+ public let previousStake: Int64
+ public let currentStreak: Int32
+ public let parameters: [Int32]
+ public let playsLeft: Int32?
+ }
+
+ case available(Info)
+ case unavailable
+
+ public init(from decoder: Decoder) throws {
+ let container = try decoder.container(keyedBy: CodingKeys.self)
+
+
+ let type = try container.decode(Int32.self, forKey: .type)
+ switch type {
+ case 1:
+ self = .available(try container.decode(Info.self, forKey: .info))
+ default:
+ self = .unavailable
+ }
+ }
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+
+ switch self {
+ case let .available(info):
+ try container.encode(Int32(1), forKey: .type)
+ try container.encode(info, forKey: .info)
+ case .unavailable:
+ try container.encode(Int32(0), forKey: .type)
+ }
+ }
+}
+
+extension EmojiGameInfo {
+ init(apiEmojiGameInfo: Api.messages.EmojiGameInfo) {
+ switch apiEmojiGameInfo {
+ case let .emojiGameDiceInfo(_, gameHash, prevStake, currentStreak, params, playsLeft):
+ self = .available(Info(gameHash: gameHash, previousStake: prevStake, currentStreak: currentStreak, parameters: params, playsLeft: playsLeft))
+ case .emojiGameUnavailable:
+ self = .unavailable
+ }
+ }
+}
+
+
+public func currentEmojiGameInfo(transaction: Transaction) -> EmojiGameInfo {
+ if let entry = transaction.getPreferencesEntry(key: PreferencesKeys.emojiGameInfo())?.get(EmojiGameInfo.self) {
+ return entry
+ } else {
+ return .unavailable
+ }
+}
+
+func updateEmojiGameInfo(transaction: Transaction, _ f: (EmojiGameInfo) -> EmojiGameInfo) {
+ let current = currentEmojiGameInfo(transaction: transaction)
+ let updated = f(current)
+ if updated != current {
+ transaction.setPreferencesEntry(key: PreferencesKeys.emojiGameInfo(), value: PreferencesEntry(updated))
+ }
+}
+
+func updateEmojiGameInfoOnce(postbox: Postbox, network: Network) -> Signal {
+ return network.request(Api.functions.messages.getEmojiGameInfo())
+ |> map(Optional.init)
+ |> `catch` { _ -> Signal in
+ return .single(nil)
+ }
+ |> mapToSignal { result -> Signal in
+ guard let result else {
+ return .complete()
+ }
+ return postbox.transaction { transaction -> Void in
+ let info = EmojiGameInfo(apiEmojiGameInfo: result)
+ updateEmojiGameInfo(transaction: transaction) { _ in
+ return info
+ }
+ }
+ }
+}
+
+func managedEmojiGameUpdates(postbox: Postbox, network: Network) -> Signal {
+ let poll = Signal { subscriber in
+ return updateEmojiGameInfoOnce(postbox: postbox, network: network).start(completed: {
+ subscriber.putCompletion()
+ })
+ }
+ return (poll |> then(.complete() |> suspendAwareDelay(1.0 * 60.0 * 60.0, queue: Queue.concurrentDefaultQueue()))) |> restart
+}
diff --git a/submodules/TelegramCore/Sources/State/ManagedLocalInputActivities.swift b/submodules/TelegramCore/Sources/State/ManagedLocalInputActivities.swift
index c2fa13e3..099d3c85 100644
--- a/submodules/TelegramCore/Sources/State/ManagedLocalInputActivities.swift
+++ b/submodules/TelegramCore/Sources/State/ManagedLocalInputActivities.swift
@@ -142,6 +142,11 @@ private func actionFromActivity(_ activity: PeerInputActivity?) -> Api.SendMessa
}
private func requestActivity(postbox: Postbox, network: Network, accountPeerId: PeerId, peerId: PeerId, threadId: Int64?, activity: PeerInputActivity?) -> Signal