Compare commits
456 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
36bb1d0cf3 | ||
|
|
c7c8e39e20 | ||
|
|
8e9630459b | ||
|
|
1c53fca925 | ||
|
|
7d78de0673 | ||
|
|
f8acc55365 | ||
|
|
c3157fe90d | ||
|
|
35b129287b | ||
|
|
d05155a403 | ||
|
|
f0aca45b11 | ||
|
|
d205e3b4a3 | ||
|
|
8b40a77297 | ||
|
|
a7e87cc722 | ||
|
|
09f106bd49 | ||
|
|
8a0869fb75 | ||
|
|
7ccf26310d | ||
|
|
e1420ba26c | ||
|
|
c693c9cd44 | ||
|
|
e698557092 | ||
|
|
1238c90450 | ||
|
|
e991dca5a0 | ||
|
|
37093c9f33 | ||
|
|
1dd4f62ece | ||
|
|
9ec27aad53 | ||
|
|
f1d3a946d5 | ||
|
|
fd24f7045e | ||
|
|
33671e7737 | ||
|
|
13ecc6a56b | ||
|
|
20815eecbc | ||
|
|
f2f5ffd861 | ||
|
|
b0971601b1 | ||
|
|
7253d764d2 | ||
|
|
71f3a1f7cf | ||
|
|
950659b29d | ||
|
|
b4392d0e3c | ||
|
|
4571302642 | ||
|
|
5121f04d66 | ||
|
|
77642d2876 | ||
|
|
ef69796798 | ||
|
|
869854fbc2 | ||
|
|
4584d912cc | ||
|
|
ddd3d38dac | ||
|
|
fcba6bc7d7 | ||
|
|
a147c0fb4f | ||
|
|
c3cc3fa9bd | ||
|
|
0f0e14132a | ||
|
|
a2c2ed0b4a | ||
|
|
8bebca4502 | ||
|
|
e9a550d458 | ||
|
|
bee567f2b1 | ||
|
|
0fd7061671 | ||
|
|
96951576c1 | ||
|
|
a665d7cc3c | ||
|
|
9b989329d4 | ||
|
|
eccfd75a83 | ||
|
|
7e8a152eef | ||
|
|
44810f95a5 | ||
|
|
bcd42dbb6a | ||
|
|
6e77126a65 | ||
|
|
735bbef655 | ||
|
|
7006a07dd3 | ||
|
|
7284926db4 | ||
|
|
b506bf9506 | ||
|
|
3fea28f8b0 | ||
|
|
cc6649667c | ||
|
|
24121fbbce | ||
|
|
ef280dae3e | ||
|
|
49f580a36b | ||
|
|
a56d2b1313 | ||
|
|
f083180401 | ||
|
|
7b870edefa | ||
|
|
a293fa1de6 | ||
|
|
3a8898dd24 | ||
|
|
b97c8b9a17 | ||
|
|
a0a8d76441 | ||
|
|
9199612cf7 | ||
|
|
abfd37c045 | ||
|
|
ac243136b9 | ||
|
|
c93e948bb3 | ||
|
|
388803ffdb | ||
|
|
a809ccf229 | ||
|
|
d1796a515e | ||
|
|
a11d3efed6 | ||
|
|
9d7aab4326 | ||
|
|
a3b76fed4c | ||
|
|
21f5f96d69 | ||
|
|
70d3061d59 | ||
|
|
8f7a66a21a | ||
|
|
cd8e944751 | ||
|
|
66e05594f6 | ||
|
|
d06a9e2e5c | ||
|
|
64df9222dd | ||
|
|
900ac46583 | ||
|
|
fda1c8399f | ||
|
|
c2cd4fc75f | ||
|
|
ef5a9eb777 | ||
|
|
8e3100acdd | ||
|
|
50d74fcf25 | ||
|
|
140862ce5a | ||
|
|
966453dd8f | ||
|
|
fcd37adc38 | ||
|
|
6a3989488e | ||
|
|
fbfdef8f9a | ||
|
|
b66c61573f | ||
|
|
9186b28b60 | ||
|
|
915a1b105c | ||
|
|
12b9b3ce71 | ||
|
|
deb4c48551 | ||
|
|
9dfaac8582 | ||
|
|
bd5b9f5347 | ||
|
|
ff4b9a3cfe | ||
|
|
e844d7ed89 | ||
|
|
f3ae8f7f75 | ||
|
|
f137eddbf9 | ||
|
|
c70f75b21a | ||
|
|
141fb875f9 | ||
|
|
344d47e7dd | ||
|
|
4840a9094b | ||
|
|
6f305c8974 | ||
|
|
c83bae3bb5 | ||
|
|
4c1b962486 | ||
|
|
b929e2a7b2 | ||
|
|
1ecd7aa7cf | ||
|
|
881aed50ea | ||
|
|
6272b79f70 | ||
|
|
0fa50f1951 | ||
|
|
dc19f2e76c | ||
|
|
498116c3f6 | ||
|
|
e29dcf7489 | ||
|
|
ec28eea7f0 | ||
|
|
ebce4d0f31 | ||
|
|
bf9492e083 | ||
|
|
cb987c1baf | ||
|
|
e4a4be1f53 | ||
|
|
f6d1fe6c04 | ||
|
|
7e5a29a5cc | ||
|
|
8dbc175c02 | ||
|
|
0473374d51 | ||
|
|
b2d7342b9e | ||
|
|
b965aecc6c | ||
|
|
9290c90bdc | ||
|
|
d83a80ec53 | ||
|
|
248fe1b53f | ||
|
|
bf217bf7aa | ||
|
|
e5de8e22b7 | ||
|
|
5666e84d92 | ||
|
|
a97d1b8669 | ||
|
|
06db13a0ab | ||
|
|
9832af7cce | ||
|
|
cf4a617f2b | ||
|
|
5a6a5fd4d1 | ||
|
|
e6ebc19b4f | ||
|
|
02dd0dbbef | ||
|
|
2e4a437d32 | ||
|
|
63e1d6dab6 | ||
|
|
23133499c7 | ||
|
|
67bd87b50c | ||
|
|
6d31a4246f | ||
|
|
d4f38b6d66 | ||
|
|
959229f143 | ||
|
|
22f9b1a0b1 | ||
|
|
a8fc5a722f | ||
|
|
6102119673 | ||
|
|
0c635a05ff | ||
|
|
307a7791df | ||
|
|
49b056a0ce | ||
|
|
af58ffadcb | ||
|
|
dcbda7b3af | ||
|
|
553cc0c6ae | ||
|
|
067dcbfbeb | ||
|
|
759258bb39 | ||
|
|
3667ef551c | ||
|
|
a3308087a5 | ||
|
|
bfb4652425 | ||
|
|
03c24e2906 | ||
|
|
dc61faace1 | ||
|
|
73ea86ceeb | ||
|
|
9a622ab466 | ||
|
|
65cfd6c81c | ||
|
|
08681ac1b9 | ||
|
|
f9acb5d19b | ||
|
|
e9e187c58b | ||
|
|
3bc20c3550 | ||
|
|
4b25406d14 | ||
|
|
265b7904a8 | ||
|
|
fb2274c58d | ||
|
|
3cfdc9d897 | ||
|
|
11986ac698 | ||
|
|
a08436ecd2 | ||
|
|
e92adf94a7 | ||
|
|
d25356917d | ||
|
|
0adb3b062f | ||
|
|
9316480884 | ||
|
|
4e5082f6c6 | ||
|
|
16d5dbe71c | ||
|
|
133d7874e3 | ||
|
|
4659d5db5d | ||
|
|
af061125dd | ||
|
|
5c4b1f6638 | ||
|
|
ee3d70f879 | ||
|
|
7dadaa1b28 | ||
|
|
a72782e232 | ||
|
|
8654ffb6fb | ||
|
|
90e445eec9 | ||
|
|
910b6d8879 | ||
|
|
8d1c2f832d | ||
|
|
158d2a4124 | ||
|
|
66473738d6 | ||
|
|
6a43107bb2 | ||
|
|
28e7afa412 | ||
|
|
8dc151e14d | ||
|
|
a330a3f2eb | ||
|
|
8f7195d3b2 | ||
|
|
a4e4502d50 | ||
|
|
902da90100 | ||
|
|
d775760f98 | ||
|
|
dfb6600104 | ||
|
|
41ed487d5e | ||
|
|
d156de05a5 | ||
|
|
f4582ddf36 | ||
|
|
7f7b764f7b | ||
|
|
dd8fdfc3d4 | ||
|
|
6c80d443b9 | ||
|
|
cd05586d51 | ||
|
|
dfc1ec3ccf | ||
|
|
ffe6786ad1 | ||
|
|
6068678fa1 | ||
|
|
50b761fab2 | ||
|
|
0d43f16db2 | ||
|
|
3278de9ba1 | ||
|
|
abe1962002 | ||
|
|
5b15f377cd | ||
|
|
d0e5ea78a5 | ||
|
|
853757e611 | ||
|
|
c3860cfe72 | ||
|
|
90b2c077a6 | ||
|
|
fdce4bada7 | ||
|
|
4c8ff1c7ec | ||
|
|
2a153214f6 | ||
|
|
d7c964afc5 | ||
|
|
5943052cd1 | ||
|
|
8512154b45 | ||
|
|
0e5419c60b | ||
|
|
1d26482298 | ||
|
|
126749f04c | ||
|
|
e0e69ce740 | ||
|
|
72b57924b7 | ||
|
|
fdbdeeb956 | ||
|
|
3dbdecf73d | ||
|
|
7dc8943840 | ||
|
|
646b852717 | ||
|
|
075f754a71 | ||
|
|
f65556acb7 | ||
|
|
b2c01991a6 | ||
|
|
4bc5e81513 | ||
|
|
2b24fe95c2 | ||
|
|
358e64f2cc | ||
|
|
5dc50b6d96 | ||
|
|
b91a040a32 | ||
|
|
76db55ff19 | ||
|
|
e17bf18350 | ||
|
|
43b4499125 | ||
|
|
c6d43a802c | ||
|
|
21f8403357 | ||
|
|
40053e3388 | ||
|
|
abcf7e3a47 | ||
|
|
f8913bf9b9 | ||
|
|
51878ab38e | ||
|
|
d3f9a84a0a | ||
|
|
23eedb468f | ||
|
|
9cb89fff45 | ||
|
|
79f0b22276 | ||
|
|
8b2a728a0d | ||
|
|
b4120b156e | ||
|
|
1ae3122c20 | ||
|
|
727acca217 | ||
|
|
5f8d662d67 | ||
|
|
81b432140c | ||
|
|
adc1ee71a9 | ||
|
|
5ac373d4aa | ||
|
|
5b9e24f3f4 | ||
|
|
0e44de2fe3 | ||
|
|
b0125e8165 | ||
|
|
a532067a93 | ||
|
|
f456071c08 | ||
|
|
3896f0995c | ||
|
|
56ff5808a3 | ||
|
|
15c817dd15 | ||
|
|
7246c3f304 | ||
|
|
e4f59f1ec4 | ||
|
|
5f0e9538cf | ||
|
|
73649128f3 | ||
|
|
edc84731ac | ||
|
|
108b116b06 | ||
|
|
dda587dc6f | ||
|
|
4a9dd43598 | ||
|
|
a64cfe661a | ||
|
|
7e418a16ae | ||
|
|
ecf1fa2bbd | ||
|
|
a6157a34bc | ||
|
|
8e37e66706 | ||
|
|
dd6a4931e5 | ||
|
|
2d000e826b | ||
|
|
c1028e7408 | ||
|
|
28b54fac37 | ||
|
|
845fddf5f2 | ||
|
|
e3e2a477c1 | ||
|
|
bf4442ecf5 | ||
|
|
ab6375ef2a | ||
|
|
2535b6e08c | ||
|
|
2f003d416a | ||
|
|
579b358f8b | ||
|
|
231a583bf7 | ||
|
|
f0cfbacb4f | ||
|
|
ae45189436 | ||
|
|
ff8292b863 | ||
|
|
ebe45f73a0 | ||
|
|
88ce676c46 | ||
|
|
426cc2798e | ||
|
|
1d2df63652 | ||
|
|
d22afa36c3 | ||
|
|
a7296f15ac | ||
|
|
b20caee548 | ||
|
|
519832edd7 | ||
|
|
a2cea1e5bc | ||
|
|
b3c198f0d2 | ||
|
|
b45a696b5d | ||
|
|
a2b3fe6411 | ||
|
|
13d4f37726 | ||
|
|
71f34f4e31 | ||
|
|
018f147de6 | ||
|
|
da012cbf8b | ||
|
|
3907a103fc | ||
|
|
efb566bcc7 | ||
|
|
53e8df3542 | ||
|
|
a00d262773 | ||
|
|
b64db54793 | ||
|
|
97c0e3d4a9 | ||
|
|
ba31bbace8 | ||
|
|
606dfd29d3 | ||
|
|
9411d0781b | ||
|
|
7aea200860 | ||
|
|
5d8ac95d07 | ||
|
|
cd0ebb41aa | ||
|
|
eb028b0dad | ||
|
|
61803f7516 | ||
|
|
50bfed79be | ||
|
|
1c77ae818e | ||
|
|
66ede6037d | ||
|
|
01452b7309 | ||
|
|
b5f2470b79 | ||
|
|
49403e9fee | ||
|
|
66d512f26f | ||
|
|
2ba0ebf3e8 | ||
|
|
bbcd27d3c2 | ||
|
|
837a3528cd | ||
|
|
f39662588f | ||
|
|
4b12f52029 | ||
|
|
f2920ddefb | ||
|
|
ce010653d5 | ||
|
|
ce764c862f | ||
|
|
60d821ae3e | ||
|
|
8f7f8fc0b5 | ||
|
|
ec45041a66 | ||
|
|
67a666b282 | ||
|
|
d9404fc566 | ||
|
|
bcd899c641 | ||
|
|
ec61ac29ea | ||
|
|
180e663a43 | ||
|
|
ae1711a685 | ||
|
|
9c3b62574d | ||
|
|
a3637c12d6 | ||
|
|
cae192682b | ||
|
|
6c68bacaef | ||
|
|
ee7a2b564b | ||
|
|
fb25d90b48 | ||
|
|
9075a521f0 | ||
|
|
00a0e595ff | ||
|
|
694ff32b01 | ||
|
|
a74635ff56 | ||
|
|
8c6f3d66b5 | ||
|
|
a49cb06d77 | ||
|
|
f96f478470 | ||
|
|
1d2f713673 | ||
|
|
57d24d0fbf | ||
|
|
584e55a89c | ||
|
|
4560a83441 | ||
|
|
f4658728e8 | ||
|
|
54825dc66f | ||
|
|
d4056ac10a | ||
|
|
8f409a8fe2 | ||
|
|
d369d988b0 | ||
|
|
2a74736761 | ||
|
|
6bd0bf6e69 | ||
|
|
53cee177e8 | ||
|
|
a8afc62db7 | ||
|
|
14328eb601 | ||
|
|
2184755fdf | ||
|
|
3a3cd1f856 | ||
|
|
24a3a41cd6 | ||
|
|
197f6b05ae | ||
|
|
c2e887a86e | ||
|
|
dc1459438c | ||
|
|
00e6da9d64 | ||
|
|
68b3d75705 | ||
|
|
3e538b732a | ||
|
|
833341dea7 | ||
|
|
bc3efe2f4c | ||
|
|
10e4c59f2e | ||
|
|
d9016b7979 | ||
|
|
d975610ecd | ||
|
|
5d1251f6d8 | ||
|
|
bdf802e64a | ||
|
|
f2b888f9ae | ||
|
|
9583007769 | ||
|
|
eb81c33308 | ||
|
|
8d734f5cc4 | ||
|
|
3375ff6152 | ||
|
|
80fc58f83e | ||
|
|
17c0124747 | ||
|
|
c220d4dd17 | ||
|
|
15146725e3 | ||
|
|
ddfab824c3 | ||
|
|
8b5a00ca27 | ||
|
|
04a7f14c0e | ||
|
|
18f14b828c | ||
|
|
0a92e12a62 | ||
|
|
5b71281ec4 | ||
|
|
08fdc4f1fc | ||
|
|
c726bef740 | ||
|
|
94e0ac3f54 | ||
|
|
284f7fc4f7 | ||
|
|
e629460942 | ||
|
|
904e531113 | ||
|
|
ca2f2adc90 | ||
|
|
78a3e329f5 | ||
|
|
5938e0f821 | ||
|
|
4a6ae3b46c | ||
|
|
2327d661b9 | ||
|
|
9790e37154 | ||
|
|
f97d751343 | ||
|
|
81c1f6bd8e | ||
|
|
e3a5a4239b | ||
|
|
fcec85881f | ||
|
|
cfefb8b2e0 | ||
|
|
e81a2a5011 | ||
|
|
d62b488459 | ||
|
|
932bd92b95 | ||
|
|
9fd1f95ab8 | ||
|
|
cf414cb9cb | ||
|
|
f676d32f96 | ||
|
|
7d88c48c39 | ||
|
|
26337a6bd4 | ||
|
|
1263a5bfc0 | ||
|
|
fe21ca5b95 | ||
|
|
0fe9dad515 |
@@ -1,8 +1,13 @@
|
||||
---
|
||||
description: For tasks requiring sending Telegram server API requests or working with generated API types.
|
||||
globs:
|
||||
alwaysApply: false
|
||||
---
|
||||
# Telegram Desktop API Usage
|
||||
|
||||
## API Schema
|
||||
|
||||
The API definitions are described using [TL Language](https://core.telegram.org/mtproto/TL) in two main schema files:
|
||||
The API definitions are described using [TL Language]\(https:/core.telegram.org/mtproto/TL) in two main schema files:
|
||||
|
||||
1. **`Telegram/SourceFiles/mtproto/scheme/mtproto.tl`**
|
||||
* Defines the core MTProto protocol types and methods used for basic communication, encryption, authorization, service messages, etc.
|
||||
@@ -39,7 +44,7 @@ api().request(MTPnamespace_MethodName(
|
||||
MTP_long(randomId),
|
||||
// ... other arguments matching the TL definition
|
||||
MTP_vector<MTPMessageEntity>() // Example for a vector argument
|
||||
)).done([=](const MTPResponseType &result) {
|
||||
)).done([=]\(const MTPResponseType &result) {
|
||||
// Handle the successful response (result).
|
||||
// 'result' will be of the C++ type corresponding to the TL type
|
||||
// specified after the '=' in the api.tl method definition.
|
||||
@@ -47,9 +52,9 @@ api().request(MTPnamespace_MethodName(
|
||||
|
||||
// 1. Multiple Constructors (e.g., User = User | UserEmpty):
|
||||
// Use .match() with lambdas for each constructor:
|
||||
result.match([&](const MTPDuser &data) {
|
||||
result.match([&]\(const MTPDuser &data) {
|
||||
/* use data.vfirst_name().v, etc. */
|
||||
}, [&](const MTPDuserEmpty &data) {
|
||||
}, [&]\(const MTPDuserEmpty &data) {
|
||||
/* handle empty user */
|
||||
});
|
||||
|
||||
@@ -64,7 +69,7 @@ api().request(MTPnamespace_MethodName(
|
||||
|
||||
// 2. Single Constructor (e.g., Messages = messages { msgs: vector<Message> }):
|
||||
// Use .match() with a single lambda:
|
||||
result.match([&](const MTPDmessages &data) { /* use data.vmessages().v */ });
|
||||
result.match([&]\(const MTPDmessages &data) { /* use data.vmessages().v */ });
|
||||
|
||||
// Or check the type explicitly and use the constructor getter:
|
||||
if (result.type() == mtpc_messages) {
|
||||
@@ -76,7 +81,7 @@ api().request(MTPnamespace_MethodName(
|
||||
const auto &data = result.data(); // Only works for single-constructor types!
|
||||
// use data.vmessages().v
|
||||
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=]\(const MTP::Error &error) {
|
||||
// Handle the API error (error).
|
||||
// 'error' is an MTP::Error object containing the error code (error.type())
|
||||
// and description (error.description()). Check for specific error strings.
|
||||
@@ -93,8 +98,8 @@ api().request(MTPnamespace_MethodName(
|
||||
* Always refer to `Telegram/SourceFiles/mtproto/scheme/api.tl` for the correct method names, parameters (names and types), and response types.
|
||||
* Use the generated `MTP...` types/classes for request parameters (e.g., `MTP_int`, `MTP_string`, `MTP_bool`, `MTP_vector`, `MTPInputUser`, etc.) and response handling.
|
||||
* The `.done()` lambda receives the specific C++ `MTP...` type corresponding to the TL return type.
|
||||
* For types with **multiple constructors** (e.g., `User = User | UserEmpty`), use `result.match([&](const MTPDuser &d){ ... }, [&](const MTPDuserEmpty &d){ ... })` to handle each case, or check `result.type() == mtpc_user` / `mtpc_userEmpty` and call the specific `result.c_user()` / `result.c_userEmpty()` getter (which asserts on type mismatch).
|
||||
* For types with a **single constructor** (e.g., `Messages = messages{...}`), you can use `result.match([&](const MTPDmessages &d){ ... })` with one lambda, or check `type()` and call `c_messages()`, or use the shortcut `result.data()` to access the fields directly.
|
||||
* For types with **multiple constructors** (e.g., `User = User | UserEmpty`), use `result.match([&]\(const MTPDuser &d){ ... }, [&]\(const MTPDuserEmpty &d){ ... })` to handle each case, or check `result.type() == mtpc_user` / `mtpc_userEmpty` and call the specific `result.c_user()` / `result.c_userEmpty()` getter (which asserts on type mismatch).
|
||||
* For types with a **single constructor** (e.g., `Messages = messages{...}`), you can use `result.match([&]\(const MTPDmessages &d){ ... })` with one lambda, or check `type()` and call `c_messages()`, or use the shortcut `result.data()` to access the fields directly.
|
||||
* The `.fail()` lambda receives an `MTP::Error` object. Check `error.type()` against known error strings (often defined as constants or using `u"..."_q` literals).
|
||||
* Directly construct the `MTPnamespace_MethodName(...)` object inside `request()`.
|
||||
* Include `.handleFloodErrors()` before `.send()` for standard flood wait handling.
|
||||
* Include `.handleFloodErrors()` before `.send()` for standard flood wait handling.
|
||||
@@ -1,3 +1,8 @@
|
||||
---
|
||||
description: For tasks requiring changing or adding user facing phrases and text parts.
|
||||
globs:
|
||||
alwaysApply: false
|
||||
---
|
||||
# Telegram Desktop Localization
|
||||
|
||||
## Coding Style Note
|
||||
@@ -156,4 +161,4 @@ auto messageProducer = tr::lng_user_posted_photo( // Type: rpl::producer<TextWit
|
||||
* Immediate: Pass `int` or `float64`.
|
||||
* Reactive: Pass `rpl::producer<float64>`, typically by converting an `int` producer using `| tr::to_count()`.
|
||||
* Optional projector function as the last argument modifies the output type and required placeholder types.
|
||||
* Actual translations are loaded at runtime from the API.
|
||||
* Actual translations are loaded at runtime from the API.
|
||||
@@ -1,3 +1,8 @@
|
||||
---
|
||||
description:
|
||||
globs:
|
||||
alwaysApply: true
|
||||
---
|
||||
# RPL (Reactive Programming Library) Guide
|
||||
|
||||
## Coding Style Note
|
||||
@@ -64,7 +69,7 @@ rpl::lifetime lifetime;
|
||||
// Counter is consumed here, use std::move if it's an l-value.
|
||||
std::move(
|
||||
counter
|
||||
) | rpl::start_with_next([=](int nextValue) {
|
||||
) | rpl::start_with_next([=]\(int nextValue) {
|
||||
// Process the next integer value emitted by the producer.
|
||||
qDebug() << "Received: " << nextValue;
|
||||
}, lifetime); // Pass the lifetime to manage the subscription.
|
||||
@@ -77,7 +82,7 @@ std::move(
|
||||
auto counter2 = /* ... */; // Type: rpl::producer<int>
|
||||
rpl::lifetime subscriptionLifetime = std::move(
|
||||
counter2
|
||||
) | rpl::start_with_next([=](int nextValue) { /* ... */ });
|
||||
) | rpl::start_with_next([=]\(int nextValue) { /* ... */ });
|
||||
// The returned lifetime MUST be stored. If it's discarded immediately,
|
||||
// the subscription stops instantly.
|
||||
// `counter2` is also moved-from here.
|
||||
@@ -93,7 +98,7 @@ rpl::lifetime lifetime;
|
||||
// If it's the only use, std::move(dataStream) would be preferred.
|
||||
rpl::duplicate(
|
||||
dataStream
|
||||
) | rpl::start_with_error([=](Error &&error) {
|
||||
) | rpl::start_with_error([=]\(Error &&error) {
|
||||
// Handle the error signaled by the producer.
|
||||
qDebug() << "Error: " << error.text();
|
||||
}, lifetime);
|
||||
@@ -101,7 +106,7 @@ rpl::duplicate(
|
||||
// Using dataStream again, perhaps duplicated again or moved if last use.
|
||||
rpl::duplicate(
|
||||
dataStream
|
||||
) | rpl::start_with_done([=]() {
|
||||
) | rpl::start_with_done([=] {
|
||||
// Execute when the producer signals it's finished emitting values.
|
||||
qDebug() << "Stream finished.";
|
||||
}, lifetime);
|
||||
@@ -110,9 +115,9 @@ rpl::duplicate(
|
||||
std::move(
|
||||
dataStream
|
||||
) | rpl::start_with_next_error_done(
|
||||
[=](QString &&value) { /* handle next value */ },
|
||||
[=](Error &&error) { /* handle error */ },
|
||||
[=]() { /* handle done */ },
|
||||
[=]\(QString &&value) { /* handle next value */ },
|
||||
[=]\(Error &&error) { /* handle error */ },
|
||||
[=] { /* handle done */ },
|
||||
lifetime);
|
||||
```
|
||||
|
||||
@@ -164,7 +169,7 @@ You can combine multiple producers into one:
|
||||
// The lambda receives unpacked arguments, not the tuple itself.
|
||||
std::move(
|
||||
combined
|
||||
) | rpl::start_with_next([=](int count, const QString &text) {
|
||||
) | rpl::start_with_next([=]\(int count, const QString &text) {
|
||||
// No need for std::get<0>(latest), etc.
|
||||
qDebug() << "Combined: Count=" << count << ", Text=" << text;
|
||||
}, lifetime);
|
||||
@@ -172,11 +177,11 @@ You can combine multiple producers into one:
|
||||
// This also works with map, filter, etc.
|
||||
std::move(
|
||||
combined
|
||||
) | rpl::filter([=](int count, const QString &text) {
|
||||
) | rpl::filter([=]\(int count, const QString &text) {
|
||||
return count > 0 && !text.isEmpty();
|
||||
}) | rpl::map([=](int count, const QString &text) {
|
||||
}) | rpl::map([=]\(int count, const QString &text) {
|
||||
return text.repeated(count);
|
||||
}) | rpl::start_with_next([=](const QString &result) {
|
||||
}) | rpl::start_with_next([=]\(const QString &result) {
|
||||
qDebug() << "Mapped & Filtered: " << result;
|
||||
}, lifetime);
|
||||
```
|
||||
@@ -192,7 +197,7 @@ You can combine multiple producers into one:
|
||||
// Starting the merged producer consumes it.
|
||||
std::move(
|
||||
merged
|
||||
) | rpl::start_with_next([=](QString &&value) {
|
||||
) | rpl::start_with_next([=]\(QString &&value) {
|
||||
// Receives values from either sourceA or sourceB as they arrive.
|
||||
qDebug() << "Merged value: " << value;
|
||||
}, lifetime);
|
||||
@@ -208,4 +213,4 @@ You can combine multiple producers into one:
|
||||
* Use `rpl::combine` or `rpl::merge` to combine streams.
|
||||
* When starting a chain (`std::move(producer) | rpl::map(...)`), explicitly move the initial producer.
|
||||
* These functions typically duplicate their input producers internally.
|
||||
* Starting a pipeline consumes the producer; use `
|
||||
* Starting a pipeline consumes the producer; use `
|
||||
@@ -1,3 +1,8 @@
|
||||
---
|
||||
description: For tasks requiring working with user facing UI components.
|
||||
globs:
|
||||
alwaysApply: false
|
||||
---
|
||||
# Telegram Desktop UI Styling
|
||||
|
||||
## Style Definition Files
|
||||
@@ -146,4 +151,4 @@ void MyWidget::paintEvent(QPaintEvent *e) {
|
||||
* Icons are defined inline using `name: icon{{ "path_stem", color }};` or `name: icon{ { "path1", c1 }, ... };` syntax, with optional path modifiers.
|
||||
* Code generation creates `struct` definitions in the `style` namespace for custom types and objects/structs in the `st` namespace for defined variables/groups.
|
||||
* Generated headers are in `styles/` with a `style_` prefix and must be included.
|
||||
* Access style properties via the generated `st::` objects (e.g., `st::primaryButton.height`, `st::chatInput.backgroundColor`).
|
||||
* Access style properties via the generated `st::` objects (e.g., `st::primaryButton.height`, `st::chatInput.backgroundColor`).
|
||||
@@ -5,11 +5,9 @@
|
||||
"vscode": {
|
||||
"settings": {
|
||||
"C_Cpp.intelliSenseEngine": "disabled",
|
||||
"clangd.arguments": [
|
||||
"--compile-commands-dir=${workspaceFolder}/out"
|
||||
],
|
||||
"cmake.generator": "Ninja Multi-Config",
|
||||
"cmake.buildDirectory": "${workspaceFolder}/out"
|
||||
"cmake.buildDirectory": "${workspaceFolder}/out",
|
||||
"cmake.copyCompileCommands": "${workspaceFolder}/compile_commands.json"
|
||||
},
|
||||
"extensions": [
|
||||
"ms-vscode.cpptools-extension-pack",
|
||||
|
||||
6
.github/workflows/docker.yml
vendored
@@ -5,15 +5,12 @@ on:
|
||||
paths:
|
||||
- '.github/workflows/docker.yml'
|
||||
- 'Telegram/build/docker/centos_env/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- '.github/workflows/docker.yml'
|
||||
- 'Telegram/build/docker/centos_env/**'
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
name: Ubuntu
|
||||
runs-on: ubuntu-latest
|
||||
if: github.ref_name == github.event.repository.default_branch
|
||||
|
||||
env:
|
||||
IMAGE_TAG: ghcr.io/${{ github.repository }}/centos_env:latest
|
||||
@@ -42,5 +39,4 @@ jobs:
|
||||
DEBUG= LTO= poetry run gen_dockerfile | DOCKER_BUILDKIT=1 docker build -t $IMAGE_TAG -
|
||||
|
||||
- name: Push the Docker image.
|
||||
if: ${{ github.ref_name == github.event.repository.default_branch }}
|
||||
run: docker push $IMAGE_TAG
|
||||
|
||||
67
.github/workflows/linux.yml
vendored
@@ -12,6 +12,7 @@ on:
|
||||
- '!.github/workflows/linux.yml'
|
||||
- 'snap/**'
|
||||
- 'Telegram/build/**'
|
||||
- '!Telegram/build/docker/centos_env/**'
|
||||
- 'Telegram/Resources/uwp/**'
|
||||
- 'Telegram/Resources/winrc/**'
|
||||
- 'Telegram/SourceFiles/platform/win/**'
|
||||
@@ -30,6 +31,7 @@ on:
|
||||
- '!.github/workflows/linux.yml'
|
||||
- 'snap/**'
|
||||
- 'Telegram/build/**'
|
||||
- '!Telegram/build/docker/centos_env/**'
|
||||
- 'Telegram/Resources/uwp/**'
|
||||
- 'Telegram/Resources/winrc/**'
|
||||
- 'Telegram/SourceFiles/platform/win/**'
|
||||
@@ -52,27 +54,56 @@ jobs:
|
||||
|
||||
env:
|
||||
UPLOAD_ARTIFACT: "true"
|
||||
ONLY_CACHE: "false"
|
||||
IMAGE_TAG: tdesktop:centos_env
|
||||
|
||||
steps:
|
||||
- name: Get repository name.
|
||||
run: echo "REPO_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
|
||||
|
||||
- name: Clone.
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
path: ${{ env.REPO_NAME }}
|
||||
|
||||
- name: First set up.
|
||||
run: |
|
||||
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
|
||||
docker pull ghcr.io/$GITHUB_REPOSITORY/centos_env
|
||||
docker tag ghcr.io/$GITHUB_REPOSITORY/centos_env tdesktop:centos_env
|
||||
sudo apt update
|
||||
curl -sSL https://install.python-poetry.org | python3 -
|
||||
cd Telegram/build/docker/centos_env
|
||||
poetry install
|
||||
DOCKERFILE=$(DEBUG= LTO= poetry run gen_dockerfile)
|
||||
echo "$DOCKERFILE" > Dockerfile
|
||||
|
||||
- name: Free up some disk space.
|
||||
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
|
||||
with:
|
||||
tool-cache: true
|
||||
|
||||
- name: Set up Docker Buildx.
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Libraries cache.
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ runner.temp }}/.buildx-cache
|
||||
key: ${{ runner.OS }}-libs-${{ hashFiles('Telegram/build/docker/centos_env/**') }}
|
||||
restore-keys: ${{ runner.OS }}-libs-
|
||||
|
||||
- name: Libraries.
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: Telegram/build/docker/centos_env
|
||||
load: ${{ env.ONLY_CACHE == 'false' }}
|
||||
tags: ${{ env.IMAGE_TAG }}
|
||||
cache-from: type=local,src=${{ runner.temp }}/.buildx-cache
|
||||
cache-to: type=local,dest=${{ runner.temp }}/.buildx-cache-new,mode=max
|
||||
|
||||
- name: Move cache.
|
||||
run: |
|
||||
rm -rf ${{ runner.temp }}/.buildx-cache
|
||||
mv ${{ runner.temp }}/.buildx-cache{-new,}
|
||||
|
||||
- name: Telegram Desktop build.
|
||||
if: env.ONLY_CACHE == 'false'
|
||||
run: |
|
||||
cd $REPO_NAME
|
||||
|
||||
DEFINE=""
|
||||
if [ -n "${{ matrix.defines }}" ]; then
|
||||
DEFINE="-D ${{ matrix.defines }}=ON"
|
||||
@@ -86,21 +117,21 @@ jobs:
|
||||
-u $(id -u) \
|
||||
-v $PWD:/usr/src/tdesktop \
|
||||
-e CONFIG=Debug \
|
||||
tdesktop:centos_env \
|
||||
$IMAGE_TAG \
|
||||
/usr/src/tdesktop/Telegram/build/docker/centos_env/build.sh \
|
||||
-D CMAKE_C_FLAGS_DEBUG="" \
|
||||
-D CMAKE_CXX_FLAGS_DEBUG="" \
|
||||
-D CMAKE_C_FLAGS="-Werror" \
|
||||
-D CMAKE_CXX_FLAGS="-Werror" \
|
||||
-D CMAKE_EXE_LINKER_FLAGS="-s" \
|
||||
-D CMAKE_CONFIGURATION_TYPES=Debug \
|
||||
-D CMAKE_C_FLAGS_DEBUG="-O0" \
|
||||
-D CMAKE_CXX_FLAGS_DEBUG="-O0" \
|
||||
-D CMAKE_COMPILE_WARNING_AS_ERROR=ON \
|
||||
-D TDESKTOP_API_TEST=ON \
|
||||
-D DESKTOP_APP_DISABLE_AUTOUPDATE=OFF \
|
||||
-D DESKTOP_APP_DISABLE_CRASH_REPORTS=OFF \
|
||||
$DEFINE
|
||||
|
||||
- name: Check.
|
||||
if: env.ONLY_CACHE == 'false'
|
||||
run: |
|
||||
filePath="$REPO_NAME/out/Debug/Telegram"
|
||||
filePath="out/Debug/Telegram"
|
||||
if test -f "$filePath"; then
|
||||
echo "Build successfully done! :)"
|
||||
|
||||
@@ -114,7 +145,7 @@ jobs:
|
||||
- name: Move artifact.
|
||||
if: env.UPLOAD_ARTIFACT == 'true'
|
||||
run: |
|
||||
cd $REPO_NAME/out/Debug
|
||||
cd out/Debug
|
||||
mkdir artifact
|
||||
mv {Telegram,Updater} artifact/
|
||||
- uses: actions/upload-artifact@v4
|
||||
@@ -122,4 +153,4 @@ jobs:
|
||||
name: Upload artifact.
|
||||
with:
|
||||
name: ${{ env.ARTIFACT_NAME }}
|
||||
path: ${{ env.REPO_NAME }}/out/Debug/artifact/
|
||||
path: out/Debug/artifact/
|
||||
|
||||
9
.github/workflows/mac.yml
vendored
@@ -114,18 +114,15 @@ jobs:
|
||||
fi
|
||||
|
||||
./configure.sh \
|
||||
-D CMAKE_C_FLAGS="-Werror" \
|
||||
-D CMAKE_CXX_FLAGS="-Werror" \
|
||||
-D CMAKE_CONFIGURATION_TYPES=Debug \
|
||||
-D CMAKE_COMPILE_WARNING_AS_ERROR=ON \
|
||||
-D CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO \
|
||||
-D TDESKTOP_API_TEST=ON \
|
||||
-D DESKTOP_APP_DISABLE_AUTOUPDATE=OFF \
|
||||
-D DESKTOP_APP_DISABLE_CRASH_REPORTS=OFF \
|
||||
$DEFINE
|
||||
|
||||
cd ../out
|
||||
|
||||
xcoderun='xcodebuild build -project Telegram.xcodeproj -scheme Telegram -destination "platform=macOS,arch=x86_64" -configuration Debug'
|
||||
bash -c "$xcoderun" || bash -c "$xcoderun" || bash -c "$xcoderun"
|
||||
cmake --build ../out --config Debug --parallel
|
||||
|
||||
- name: Move artifact.
|
||||
if: env.UPLOAD_ARTIFACT == 'true'
|
||||
|
||||
32
.github/workflows/mac_packaged.yml
vendored
@@ -69,7 +69,7 @@ jobs:
|
||||
run: |
|
||||
brew update
|
||||
brew upgrade || true
|
||||
brew install ada-url autoconf automake boost cmake ffmpeg libtool openal-soft openh264 openssl opus ninja pkg-config python qt yasm xz
|
||||
brew install ada-url autoconf automake boost cmake ffmpeg jpeg-xl libavif libheif libtool openal-soft openh264 openssl opus ninja pkg-config python qt yasm xz
|
||||
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
|
||||
|
||||
xcodebuild -version > CACHE_KEY.txt
|
||||
@@ -118,10 +118,38 @@ jobs:
|
||||
|
||||
cmake --build build --parallel
|
||||
|
||||
- name: TDE2E cache.
|
||||
id: cache-tde2e
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.LibrariesPath }}/tde2e
|
||||
key: ${{ runner.OS }}-tde2e-${{ env.CACHE_KEY }}
|
||||
- name: TDE2E.
|
||||
if: steps.cache-tde2e.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
cd $LibrariesPath
|
||||
|
||||
git init tde2e
|
||||
cd tde2e
|
||||
git remote add origin $GIT/tdlib/td.git
|
||||
git fetch --depth=1 origin 51743dfd01dff6179e2d8f7095729caa4e2222e9
|
||||
git reset --hard FETCH_HEAD
|
||||
|
||||
cmake -Bbuild -GNinja . \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DCMAKE_INSTALL_PREFIX=$PWD/build/prefix \
|
||||
-DCMAKE_C_FLAGS_DEBUG="" \
|
||||
-DCMAKE_CXX_FLAGS_DEBUG="" \
|
||||
-DTD_E2E_ONLY=ON
|
||||
|
||||
cmake --build build --parallel
|
||||
cmake --install build
|
||||
|
||||
- name: Telegram Desktop build.
|
||||
if: env.ONLY_CACHE == 'false'
|
||||
env:
|
||||
tg_owt_DIR: ${{ env.LibrariesPath }}/tg_owt/build
|
||||
tde2e_DIR: ${{ env.LibrariesPath }}/tde2e/build/prefix
|
||||
run: |
|
||||
cd $REPO_NAME
|
||||
|
||||
@@ -138,9 +166,7 @@ jobs:
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DCMAKE_C_FLAGS_DEBUG="" \
|
||||
-DCMAKE_CXX_FLAGS_DEBUG="" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="-s" \
|
||||
-DTDESKTOP_API_TEST=ON \
|
||||
-DDESKTOP_APP_USE_PACKAGED_LAZY=ON \
|
||||
$DEFINE
|
||||
|
||||
cmake --build build --parallel
|
||||
|
||||
6
.github/workflows/win.yml
vendored
@@ -177,11 +177,11 @@ jobs:
|
||||
%TDESKTOP_BUILD_GENERATOR% ^
|
||||
%TDESKTOP_BUILD_ARCH% ^
|
||||
%TDESKTOP_BUILD_API% ^
|
||||
-D CMAKE_C_FLAGS="/WX" ^
|
||||
-D CMAKE_CXX_FLAGS="/WX" ^
|
||||
-D CMAKE_CONFIGURATION_TYPES=Debug ^
|
||||
-D CMAKE_COMPILE_WARNING_AS_ERROR=ON ^
|
||||
-D CMAKE_MSVC_DEBUG_INFORMATION_FORMAT= ^
|
||||
-D DESKTOP_APP_DISABLE_AUTOUPDATE=OFF ^
|
||||
-D DESKTOP_APP_DISABLE_CRASH_REPORTS=OFF ^
|
||||
-D DESKTOP_APP_NO_PDB=ON ^
|
||||
%TDESKTOP_BUILD_DEFINE%
|
||||
|
||||
cmake --build ..\out --config Debug --parallel
|
||||
|
||||
1
.gitignore
vendored
@@ -20,6 +20,7 @@ ipch/
|
||||
.vs/
|
||||
.vscode/
|
||||
.cache/
|
||||
compile_commands.json
|
||||
|
||||
/Telegram/log.txt
|
||||
/Telegram/data
|
||||
|
||||
6
.gitmodules
vendored
@@ -1,6 +1,3 @@
|
||||
[submodule "Telegram/ThirdParty/libtgvoip"]
|
||||
path = Telegram/ThirdParty/libtgvoip
|
||||
url = https://github.com/telegramdesktop/libtgvoip
|
||||
[submodule "Telegram/ThirdParty/GSL"]
|
||||
path = Telegram/ThirdParty/GSL
|
||||
url = https://github.com/Microsoft/GSL.git
|
||||
@@ -76,9 +73,6 @@
|
||||
[submodule "Telegram/lib_webview"]
|
||||
path = Telegram/lib_webview
|
||||
url = https://github.com/desktop-app/lib_webview.git
|
||||
[submodule "Telegram/ThirdParty/jemalloc"]
|
||||
path = Telegram/ThirdParty/jemalloc
|
||||
url = https://github.com/jemalloc/jemalloc
|
||||
[submodule "Telegram/ThirdParty/dispatch"]
|
||||
path = Telegram/ThirdParty/dispatch
|
||||
url = https://github.com/apple/swift-corelibs-libdispatch
|
||||
|
||||
@@ -4,15 +4,7 @@
|
||||
# For license and copyright information please follow this link:
|
||||
# https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
if (APPLE)
|
||||
# target_precompile_headers with COMPILE_LANGUAGE restriction.
|
||||
cmake_minimum_required(VERSION 3.23)
|
||||
else()
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
endif()
|
||||
if (POLICY CMP0149)
|
||||
cmake_policy(SET CMP0149 NEW)
|
||||
endif()
|
||||
cmake_minimum_required(VERSION 3.25...3.31)
|
||||
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
@@ -20,19 +12,17 @@ include(cmake/validate_special_target.cmake)
|
||||
include(cmake/version.cmake)
|
||||
desktop_app_parse_version(Telegram/build/version)
|
||||
|
||||
set(project_langs C CXX)
|
||||
if (APPLE)
|
||||
list(APPEND project_langs OBJC OBJCXX)
|
||||
elseif (LINUX)
|
||||
list(APPEND project_langs ASM)
|
||||
endif()
|
||||
|
||||
project(Telegram
|
||||
LANGUAGES ${project_langs}
|
||||
LANGUAGES C CXX
|
||||
VERSION ${desktop_app_version_cmake}
|
||||
DESCRIPTION "Official Telegram Desktop messenger"
|
||||
HOMEPAGE_URL "https://desktop.telegram.org"
|
||||
)
|
||||
|
||||
if (APPLE)
|
||||
enable_language(OBJC OBJCXX)
|
||||
endif()
|
||||
|
||||
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT Telegram)
|
||||
|
||||
get_filename_component(third_party_loc "Telegram/ThirdParty" REALPATH)
|
||||
@@ -47,9 +37,7 @@ include(cmake/variables.cmake)
|
||||
include(cmake/nice_target_sources.cmake)
|
||||
include(cmake/target_compile_options_if_exists.cmake)
|
||||
include(cmake/target_link_frameworks.cmake)
|
||||
include(cmake/target_link_optional_libraries.cmake)
|
||||
include(cmake/target_link_options_if_exists.cmake)
|
||||
include(cmake/target_link_static_libraries.cmake)
|
||||
include(cmake/init_target.cmake)
|
||||
include(cmake/generate_target.cmake)
|
||||
include(cmake/nuget.cmake)
|
||||
|
||||
@@ -53,9 +53,7 @@ set_target_properties(Telegram PROPERTIES AUTOMOC ON)
|
||||
|
||||
target_link_libraries(Telegram
|
||||
PRIVATE
|
||||
# tdesktop::lib_tgcalls_legacy
|
||||
tdesktop::lib_tgcalls
|
||||
# tdesktop::lib_tgvoip
|
||||
|
||||
# Order in this list defines the order of include paths in command line.
|
||||
# We need to place desktop-app::external_minizip this early to have its
|
||||
@@ -127,6 +125,8 @@ PRIVATE
|
||||
api/api_confirm_phone.h
|
||||
api/api_credits.cpp
|
||||
api/api_credits.h
|
||||
api/api_credits_history_entry.cpp
|
||||
api/api_credits_history_entry.h
|
||||
api/api_earn.cpp
|
||||
api/api_earn.h
|
||||
api/api_editing.cpp
|
||||
@@ -176,8 +176,12 @@ PRIVATE
|
||||
api/api_statistics_data_deserialize.h
|
||||
api/api_statistics_sender.cpp
|
||||
api/api_statistics_sender.h
|
||||
api/api_suggest_post.cpp
|
||||
api/api_suggest_post.h
|
||||
api/api_text_entities.cpp
|
||||
api/api_text_entities.h
|
||||
api/api_todo_lists.cpp
|
||||
api/api_todo_lists.h
|
||||
api/api_toggling_media.cpp
|
||||
api/api_toggling_media.h
|
||||
api/api_transcribes.cpp
|
||||
@@ -214,8 +218,8 @@ PRIVATE
|
||||
boxes/peers/edit_contact_box.h
|
||||
boxes/peers/edit_forum_topic_box.cpp
|
||||
boxes/peers/edit_forum_topic_box.h
|
||||
boxes/peers/edit_linked_chat_box.cpp
|
||||
boxes/peers/edit_linked_chat_box.h
|
||||
boxes/peers/edit_discussion_link_box.cpp
|
||||
boxes/peers/edit_discussion_link_box.h
|
||||
boxes/peers/edit_members_visible.cpp
|
||||
boxes/peers/edit_members_visible.h
|
||||
boxes/peers/edit_participant_box.cpp
|
||||
@@ -281,6 +285,8 @@ PRIVATE
|
||||
boxes/edit_caption_box.h
|
||||
boxes/edit_privacy_box.cpp
|
||||
boxes/edit_privacy_box.h
|
||||
boxes/edit_todo_list_box.cpp
|
||||
boxes/edit_todo_list_box.h
|
||||
boxes/gift_credits_box.cpp
|
||||
boxes/gift_credits_box.h
|
||||
boxes/gift_premium_box.cpp
|
||||
@@ -446,6 +452,8 @@ PRIVATE
|
||||
chat_helpers/ttl_media_layer_widget.h
|
||||
core/application.cpp
|
||||
core/application.h
|
||||
core/bank_card_click_handler.cpp
|
||||
core/bank_card_click_handler.h
|
||||
core/base_integration.cpp
|
||||
core/base_integration.h
|
||||
core/changelogs.cpp
|
||||
@@ -462,6 +470,7 @@ PRIVATE
|
||||
core/crash_report_window.h
|
||||
core/crash_reports.cpp
|
||||
core/crash_reports.h
|
||||
core/credits_amount.h
|
||||
core/deadlock_detector.h
|
||||
core/file_utilities.cpp
|
||||
core/file_utilities.h
|
||||
@@ -475,7 +484,6 @@ PRIVATE
|
||||
core/sandbox.h
|
||||
core/shortcuts.cpp
|
||||
core/shortcuts.h
|
||||
core/stars_amount.h
|
||||
core/ui_integration.cpp
|
||||
core/ui_integration.h
|
||||
core/update_checker.cpp
|
||||
@@ -499,8 +507,12 @@ PRIVATE
|
||||
data/components/factchecks.h
|
||||
data/components/location_pickers.cpp
|
||||
data/components/location_pickers.h
|
||||
data/components/promo_suggestions.cpp
|
||||
data/components/promo_suggestions.h
|
||||
data/components/recent_peers.cpp
|
||||
data/components/recent_peers.h
|
||||
data/components/recent_shared_media_gifts.cpp
|
||||
data/components/recent_shared_media_gifts.h
|
||||
data/components/scheduled_messages.cpp
|
||||
data/components/scheduled_messages.h
|
||||
data/components/sponsored_messages.cpp
|
||||
@@ -645,6 +657,8 @@ PRIVATE
|
||||
data/data_streaming.h
|
||||
data/data_thread.cpp
|
||||
data/data_thread.h
|
||||
data/data_todo_list.cpp
|
||||
data/data_todo_list.h
|
||||
data/data_types.cpp
|
||||
data/data_types.h
|
||||
data/data_unread_value.cpp
|
||||
@@ -745,6 +759,8 @@ PRIVATE
|
||||
history/view/controls/history_view_draft_options.h
|
||||
history/view/controls/history_view_forward_panel.cpp
|
||||
history/view/controls/history_view_forward_panel.h
|
||||
history/view/controls/history_view_suggest_options.cpp
|
||||
history/view/controls/history_view_suggest_options.h
|
||||
history/view/controls/history_view_ttl_button.cpp
|
||||
history/view/controls/history_view_ttl_button.h
|
||||
history/view/controls/history_view_voice_record_bar.cpp
|
||||
@@ -806,8 +822,12 @@ PRIVATE
|
||||
history/view/media/history_view_sticker_player_abstract.h
|
||||
history/view/media/history_view_story_mention.cpp
|
||||
history/view/media/history_view_story_mention.h
|
||||
history/view/media/history_view_suggest_decision.cpp
|
||||
history/view/media/history_view_suggest_decision.h
|
||||
history/view/media/history_view_theme_document.cpp
|
||||
history/view/media/history_view_theme_document.h
|
||||
history/view/media/history_view_todo_list.cpp
|
||||
history/view/media/history_view_todo_list.h
|
||||
history/view/media/history_view_unique_gift.cpp
|
||||
history/view/media/history_view_unique_gift.h
|
||||
history/view/media/history_view_userpic_suggestion.cpp
|
||||
@@ -832,6 +852,8 @@ PRIVATE
|
||||
history/view/history_view_bottom_info.h
|
||||
history/view/history_view_chat_preview.cpp
|
||||
history/view/history_view_chat_preview.h
|
||||
history/view/history_view_chat_section.cpp
|
||||
history/view/history_view_chat_section.h
|
||||
history/view/history_view_contact_status.cpp
|
||||
history/view/history_view_contact_status.h
|
||||
history/view/history_view_context_menu.cpp
|
||||
@@ -866,8 +888,6 @@ PRIVATE
|
||||
history/view/history_view_pinned_tracker.h
|
||||
history/view/history_view_quick_action.cpp
|
||||
history/view/history_view_quick_action.h
|
||||
history/view/history_view_replies_section.cpp
|
||||
history/view/history_view_replies_section.h
|
||||
history/view/history_view_reply.cpp
|
||||
history/view/history_view_reply.h
|
||||
history/view/history_view_requests_bar.cpp
|
||||
@@ -884,8 +904,8 @@ PRIVATE
|
||||
history/view/history_view_sponsored_click_handler.h
|
||||
history/view/history_view_sticker_toast.cpp
|
||||
history/view/history_view_sticker_toast.h
|
||||
history/view/history_view_sublist_section.cpp
|
||||
history/view/history_view_sublist_section.h
|
||||
history/view/history_view_subsection_tabs.cpp
|
||||
history/view/history_view_subsection_tabs.h
|
||||
history/view/history_view_text_helper.cpp
|
||||
history/view/history_view_text_helper.h
|
||||
history/view/history_view_transcribe_button.cpp
|
||||
@@ -1442,6 +1462,8 @@ PRIVATE
|
||||
settings/cloud_password/settings_cloud_password_start.h
|
||||
settings/cloud_password/settings_cloud_password_step.cpp
|
||||
settings/cloud_password/settings_cloud_password_step.h
|
||||
settings/cloud_password/settings_cloud_password_validate_icon.cpp
|
||||
settings/cloud_password/settings_cloud_password_validate_icon.h
|
||||
settings/settings_active_sessions.cpp
|
||||
settings/settings_active_sessions.h
|
||||
settings/settings_advanced.cpp
|
||||
@@ -1860,11 +1882,7 @@ else()
|
||||
set(bundle_identifier "com.tdesktop.Telegram")
|
||||
endif()
|
||||
set(bundle_entitlements "Telegram.entitlements")
|
||||
if (LINUX AND DESKTOP_APP_USE_PACKAGED)
|
||||
set(output_name "telegram-desktop")
|
||||
else()
|
||||
set(output_name "Telegram")
|
||||
endif()
|
||||
set(output_name "Telegram")
|
||||
endif()
|
||||
|
||||
if (CMAKE_GENERATOR STREQUAL Xcode)
|
||||
@@ -1906,8 +1924,9 @@ PRIVATE
|
||||
G_LOG_DOMAIN="Telegram"
|
||||
)
|
||||
|
||||
get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
if (APPLE
|
||||
OR "${CMAKE_GENERATOR}" STREQUAL "Ninja Multi-Config"
|
||||
OR is_multi_config
|
||||
OR NOT CMAKE_EXECUTABLE_SUFFIX STREQUAL ""
|
||||
OR NOT "${output_name}" STREQUAL "Telegram")
|
||||
set(output_folder ${CMAKE_BINARY_DIR})
|
||||
@@ -1917,6 +1936,76 @@ endif()
|
||||
|
||||
set_target_properties(Telegram PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${output_folder})
|
||||
|
||||
if (MSVC)
|
||||
target_link_libraries(Telegram
|
||||
PRIVATE
|
||||
delayimp
|
||||
)
|
||||
target_link_options(Telegram
|
||||
PRIVATE
|
||||
/DELAYLOAD:secur32.dll
|
||||
/DELAYLOAD:winmm.dll
|
||||
/DELAYLOAD:ws2_32.dll
|
||||
/DELAYLOAD:user32.dll
|
||||
/DELAYLOAD:gdi32.dll
|
||||
/DELAYLOAD:advapi32.dll
|
||||
/DELAYLOAD:avrt.dll
|
||||
/DELAYLOAD:shell32.dll
|
||||
/DELAYLOAD:ole32.dll
|
||||
/DELAYLOAD:oleaut32.dll
|
||||
/DELAYLOAD:shlwapi.dll
|
||||
/DELAYLOAD:iphlpapi.dll
|
||||
/DELAYLOAD:gdiplus.dll
|
||||
/DELAYLOAD:version.dll
|
||||
/DELAYLOAD:dwmapi.dll
|
||||
/DELAYLOAD:uxtheme.dll
|
||||
/DELAYLOAD:crypt32.dll
|
||||
/DELAYLOAD:bcrypt.dll
|
||||
/DELAYLOAD:netapi32.dll
|
||||
/DELAYLOAD:imm32.dll
|
||||
/DELAYLOAD:userenv.dll
|
||||
/DELAYLOAD:wtsapi32.dll
|
||||
/DELAYLOAD:propsys.dll
|
||||
)
|
||||
if (QT_VERSION GREATER 6)
|
||||
if (NOT build_winarm)
|
||||
target_link_options(Telegram PRIVATE
|
||||
/DELAYLOAD:API-MS-Win-EventLog-Legacy-l1-1-0.dll
|
||||
)
|
||||
endif()
|
||||
|
||||
target_link_options(Telegram
|
||||
PRIVATE
|
||||
/DELAYLOAD:API-MS-Win-Core-Console-l1-1-0.dll
|
||||
/DELAYLOAD:API-MS-Win-Core-Fibers-l2-1-0.dll
|
||||
/DELAYLOAD:API-MS-Win-Core-Fibers-l2-1-1.dll
|
||||
/DELAYLOAD:API-MS-Win-Core-File-l1-1-0.dll
|
||||
/DELAYLOAD:API-MS-Win-Core-LibraryLoader-l1-2-0.dll
|
||||
/DELAYLOAD:API-MS-Win-Core-Localization-l1-2-0.dll
|
||||
/DELAYLOAD:API-MS-Win-Core-Memory-l1-1-0.dll
|
||||
/DELAYLOAD:API-MS-Win-Core-Memory-l1-1-1.dll
|
||||
/DELAYLOAD:API-MS-Win-Core-ProcessThreads-l1-1-0.dll
|
||||
/DELAYLOAD:API-MS-Win-Core-Synch-l1-2-0.dll # Synchronization.lib
|
||||
/DELAYLOAD:API-MS-Win-Core-SysInfo-l1-1-0.dll
|
||||
/DELAYLOAD:API-MS-Win-Core-Timezone-l1-1-0.dll
|
||||
/DELAYLOAD:API-MS-Win-Core-WinRT-l1-1-0.dll
|
||||
/DELAYLOAD:API-MS-Win-Core-WinRT-Error-l1-1-0.dll
|
||||
/DELAYLOAD:API-MS-Win-Core-WinRT-String-l1-1-0.dll
|
||||
/DELAYLOAD:API-MS-Win-Security-CryptoAPI-l1-1-0.dll
|
||||
# /DELAYLOAD:API-MS-Win-Shcore-Scaling-l1-1-1.dll # We shadowed GetDpiForMonitor
|
||||
/DELAYLOAD:authz.dll # Authz.lib
|
||||
/DELAYLOAD:comdlg32.dll
|
||||
/DELAYLOAD:dwrite.dll # DWrite.lib
|
||||
/DELAYLOAD:dxgi.dll # DXGI.lib
|
||||
/DELAYLOAD:d3d9.dll # D3D9.lib
|
||||
/DELAYLOAD:d3d11.dll # D3D11.lib
|
||||
/DELAYLOAD:d3d12.dll # D3D12.lib
|
||||
/DELAYLOAD:setupapi.dll # SetupAPI.lib
|
||||
/DELAYLOAD:winhttp.dll
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_prepare_qrc(Telegram)
|
||||
|
||||
if (NOT DESKTOP_APP_DISABLE_AUTOUPDATE AND NOT build_macstore AND NOT build_winstore)
|
||||
@@ -1945,6 +2034,22 @@ if (NOT DESKTOP_APP_DISABLE_AUTOUPDATE AND NOT build_macstore AND NOT build_wins
|
||||
base/platform/win/base_windows_safe_library.h
|
||||
)
|
||||
target_include_directories(Updater PRIVATE ${lib_base_loc})
|
||||
if (MSVC)
|
||||
target_link_libraries(Updater
|
||||
PRIVATE
|
||||
delayimp
|
||||
)
|
||||
target_link_options(Updater
|
||||
PRIVATE
|
||||
/DELAYLOAD:user32.dll
|
||||
/DELAYLOAD:advapi32.dll
|
||||
/DELAYLOAD:shell32.dll
|
||||
/DELAYLOAD:ole32.dll
|
||||
/DELAYLOAD:shlwapi.dll
|
||||
)
|
||||
else()
|
||||
target_link_options(Updater PRIVATE -municode)
|
||||
endif()
|
||||
elseif (APPLE)
|
||||
add_custom_command(TARGET Updater
|
||||
PRE_LINK
|
||||
@@ -1973,6 +2078,10 @@ if (NOT DESKTOP_APP_DISABLE_AUTOUPDATE AND NOT build_macstore AND NOT build_wins
|
||||
desktop-app::external_openssl
|
||||
)
|
||||
|
||||
if (DESKTOP_APP_USE_PACKAGED)
|
||||
target_compile_definitions(Packer PRIVATE PACKER_USE_PACKAGED)
|
||||
endif()
|
||||
|
||||
set_target_properties(Packer PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${output_folder})
|
||||
endif()
|
||||
elseif (build_winstore)
|
||||
|
||||
BIN
Telegram/Resources/animations/cloud_password/validate.tgs
Normal file
BIN
Telegram/Resources/animations/diamond.tgs
Normal file
BIN
Telegram/Resources/animations/edit_peers/direct_messages.tgs
Normal file
BIN
Telegram/Resources/animations/edit_peers/topics.tgs
Normal file
BIN
Telegram/Resources/animations/edit_peers/topics_list.tgs
Normal file
BIN
Telegram/Resources/animations/edit_peers/topics_tabs.tgs
Normal file
8
Telegram/Resources/icons/chat/input_paid.svg
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Icon / Input / input_paid</title>
|
||||
<g id="Icon-/-Input-/-input_paid" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<path d="M20,9.8 C25.6299826,9.8 30.2,14.2730045 30.2,19.7983329 C30.2,25.3236612 25.6299826,29.7966657 20,29.7966657 C18.7457032,29.7966657 17.522531,29.57429 16.3765194,29.1472418 L16.049,29.018 L15.8675895,29.1274403 L15.6273764,29.2612632 C14.545782,29.8404011 13.0955737,30.1473058 11.2731839,30.1996583 C10.8153842,30.2127839 10.4336239,29.8523042 10.4204985,29.3945045 C10.4177264,29.2978179 10.4318913,29.2013918 10.4663408,29.0979123 C10.9468917,27.7307176 11.2958938,26.5818971 11.5130707,25.6565167 L11.566,25.42 L11.5361505,25.3785138 C10.4824637,23.8473989 9.87852612,22.0565089 9.80714989,20.1756532 L9.8,19.7983329 C9.8,14.2730045 14.3700174,9.8 20,9.8 Z M20,11.2 C15.1365724,11.2 11.2,15.0530063 11.2,19.7983329 C11.2,21.6384229 11.7922255,23.3893508 12.8759186,24.8453165 L13.0610907,25.0940992 L13.001223,25.3983974 C12.8243697,26.2973155 12.5137714,27.4099145 12.0719423,28.73207 L12.064,28.754 L12.2244984,28.7405395 C13.2682683,28.6413859 14.1190062,28.4334572 14.7754263,28.1231964 L14.9665215,28.0270547 C15.164827,27.9208723 15.3780604,27.7932923 15.605736,27.6441968 L15.9287098,27.4326945 L16.2799121,27.5930136 C17.4341359,28.1199012 18.6962936,28.3966657 20,28.3966657 C24.8634276,28.3966657 28.8,24.5436594 28.8,19.7983329 C28.8,15.0530063 24.8634276,11.2 20,11.2 Z" id="Shape---" fill="#FFFFFF" fill-rule="nonzero"></path>
|
||||
<path d="M20.2258661,25.6815247 C20.5071894,25.6815247 20.874026,25.4574745 20.874026,25.0631159 L20.874026,24.4093038 C22.5557139,24.2186972 23.4454545,23.1802196 23.4454545,21.6685117 C23.4454545,20.3671283 22.7015108,19.5784112 21.1573587,19.2234884 L19.8882782,18.9211469 C19.0943214,18.7371128 18.7067205,18.3558996 18.7067205,17.7972249 C18.7067205,17.1268153 19.2568638,16.6404397 20.1195884,16.6404397 C20.8197708,16.6404397 21.3073978,16.8902001 21.8512894,17.5277465 C22.126361,17.8300881 22.3389164,17.941823 22.6264913,17.941823 C22.9765824,17.941823 23.2454024,17.68549 23.2454024,17.3042767 C23.2454024,16.9362087 23.0390987,16.5352774 22.6890076,16.1737821 C22.2263871,15.713697 21.7022327,15.4113555 20.9207792,15.3061932 L20.9207792,14.6509738 C20.9207792,14.2631879 20.5009377,13.9363049 20.2133629,13.9363049 C19.9320396,13.9363049 19.5493506,14.2566152 19.5493506,14.6509738 L19.5493506,15.2864752 C17.930179,15.4442187 17.0312842,16.4629784 17.0312842,17.9221051 C17.0312842,19.1971979 17.7752279,20.0450688 19.2005991,20.3802736 L20.4696796,20.6891878 C21.3949206,20.9192303 21.7762699,21.2610078 21.7762699,21.8394004 C21.7762699,22.5886817 21.219875,23.061912 20.2258661,23.061912 C19.4819224,23.061912 18.8630112,22.766143 18.3003647,22.1285967 C17.9815316,21.7933919 17.8064861,21.7210928 17.5689242,21.7210928 C17.1875749,21.7210928 16.9,21.9774259 16.9,22.417793 C16.9,22.8055789 17.1125554,23.2065101 17.4939047,23.5548602 C17.9940349,24.0346632 18.7115432,24.3238594 19.5805195,24.4093038 L19.5805195,25.0565432 C19.5805195,25.4509018 19.9382912,25.6815247 20.2258661,25.6815247 Z" id="Path" fill="#FFFFFF" fill-rule="nonzero"></path>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.3 KiB |
BIN
Telegram/Resources/icons/chat/large_messages.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
Telegram/Resources/icons/chat/large_messages@2x.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
Telegram/Resources/icons/chat/large_messages@3x.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
7
Telegram/Resources/icons/chat/paid_approve.svg
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Icon / Filled / paid_approve</title>
|
||||
<g id="Icon-/-Filled-/-paid_approve" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<path d="M12,4.5 C16.14,4.5 19.5,7.86 19.5,12 C19.5,16.14 16.14,19.5 12,19.5 C7.86,19.5 4.5,16.14 4.5,12 C4.5,7.86 7.86,4.5 12,4.5 Z M15.7577636,9.89127556 C15.4992394,9.62810439 15.0763217,9.62433727 14.8131506,9.88286145 L10.7479688,13.8761719 L9.18684944,12.3424898 C8.92367827,12.0839656 8.50076063,12.0877327 8.24223645,12.3509039 C7.98371227,12.6140751 7.98747939,13.0369927 8.25065056,13.2955169 L10.204967,15.2153247 C10.5064723,15.5115061 10.9896874,15.5115061 11.2911927,15.2153247 L15.7493494,10.8358886 C16.0125206,10.5773644 16.0162877,10.1544467 15.7577636,9.89127556 Z" id="Shape" fill="#FFFFFF" fill-rule="nonzero"></path>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 999 B |
7
Telegram/Resources/icons/chat/paid_decline.svg
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Icon / Filled / paid_decline</title>
|
||||
<g id="Icon-/-Filled-/-paid_decline" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<path d="M12,4.5 C16.1421356,4.5 19.5,7.85786438 19.5,12 C19.5,16.1421356 16.1421356,19.5 12,19.5 C7.85786438,19.5 4.5,16.1421356 4.5,12 C4.5,7.85786438 7.85786438,4.5 12,4.5 Z M9.73375908,8.63964245 C9.43162712,8.33751049 8.94177442,8.33751049 8.63964245,8.63964245 L8.59853606,8.68404063 C8.33819559,8.98800138 8.35189772,9.44601435 8.63964245,9.73375908 L10.9059783,12 L8.63964245,14.2662409 C8.33751049,14.5683729 8.33751049,15.0582256 8.63964245,15.3603575 L8.68404063,15.4014639 C8.98800138,15.6618044 9.44601435,15.6481023 9.73375908,15.3603575 L12,13.0936701 L14.2662409,15.3603575 C14.5683729,15.6624895 15.0582256,15.6624895 15.3603575,15.3603575 L15.4014639,15.3159594 C15.6618044,15.0119986 15.6481023,14.5539856 15.3603575,14.2662409 L13.0936701,12 L15.3603575,9.73375908 C15.6624895,9.43162712 15.6624895,8.94177442 15.3603575,8.63964245 L15.3159594,8.59853606 C15.0119986,8.33819559 14.5539856,8.35189772 14.2662409,8.63964245 L12,10.9059783 L9.73375908,8.63964245 Z" id="Shape" fill="#FFFFFF"></path>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
7
Telegram/Resources/icons/chat/paid_edit.svg
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Icon / Filled / paid_edit</title>
|
||||
<g id="Icon-/-Filled-/-paid_edit" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<path d="M13.5029106,7.64699152 C13.6056531,7.5472623 13.7697888,7.549705 13.869518,7.65244745 L16.2610253,10.1162122 C16.3593492,10.2175069 16.3585592,10.3788499 16.259248,10.4791768 L7.97687653,18.8462593 C7.87948817,18.9446437 7.74680196,19 7.6083679,19 L5.51851849,19 C5.23214864,19 5,18.7678513 5,18.4814815 L5,16.3683223 C5,16.2308422 5.05459809,16.0989896 5.15178971,16.0017551 L13.5029106,7.64699152 Z M16.0299869,5.19856593 C16.3408365,4.91998643 16.8161619,4.93645109 17.1069903,5.23587194 L18.7801411,6.95845528 C19.073802,7.26079221 19.0732123,7.74202152 18.7788114,8.04363789 L17.6449122,9.20518682 C17.5421105,9.3048549 17.3779763,9.30231456 17.2783082,9.19951281 L14.8031149,6.64621027 C14.707554,6.53957983 14.7165277,6.3756714 14.8231582,6.28011055 L16.0299869,5.19856593 Z" id="Shape" fill="#FFFFFF"></path>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
BIN
Telegram/Resources/icons/menu/cancel_fee.png
Normal file
|
After Width: | Height: | Size: 865 B |
BIN
Telegram/Resources/icons/menu/cancel_fee@2x.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
Telegram/Resources/icons/menu/cancel_fee@3x.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
Telegram/Resources/icons/menu/order_date.png
Normal file
|
After Width: | Height: | Size: 585 B |
BIN
Telegram/Resources/icons/menu/order_date@2x.png
Normal file
|
After Width: | Height: | Size: 1015 B |
BIN
Telegram/Resources/icons/menu/order_date@3x.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
Telegram/Resources/icons/menu/order_number.png
Normal file
|
After Width: | Height: | Size: 680 B |
BIN
Telegram/Resources/icons/menu/order_number@2x.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
Telegram/Resources/icons/menu/order_number@3x.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
Telegram/Resources/icons/menu/order_price.png
Normal file
|
After Width: | Height: | Size: 813 B |
BIN
Telegram/Resources/icons/menu/order_price@2x.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
Telegram/Resources/icons/menu/order_price@3x.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
Telegram/Resources/icons/menu/tag_sell.png
Normal file
|
After Width: | Height: | Size: 377 B |
BIN
Telegram/Resources/icons/menu/tag_sell@2x.png
Normal file
|
After Width: | Height: | Size: 675 B |
BIN
Telegram/Resources/icons/menu/tag_sell@3x.png
Normal file
|
After Width: | Height: | Size: 930 B |
BIN
Telegram/Resources/icons/settings/earn.png
Normal file
|
After Width: | Height: | Size: 889 B |
BIN
Telegram/Resources/icons/settings/earn@2x.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
Telegram/Resources/icons/settings/earn@3x.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
Telegram/Resources/icons/settings/gift.png
Normal file
|
After Width: | Height: | Size: 574 B |
BIN
Telegram/Resources/icons/settings/gift@2x.png
Normal file
|
After Width: | Height: | Size: 1016 B |
BIN
Telegram/Resources/icons/settings/gift@3x.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
12
Telegram/Resources/icons/settings/mini_gift_order_date.svg
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="48px" height="48px" viewBox="0 0 48 48" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Mini / mini_gift_sorting2</title>
|
||||
<g id="Mini-/-mini_gift_sorting2" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<path d="M39.7913043,28.3413043 C40.9234881,28.3413043 41.8413043,29.2591206 41.8413043,30.3913043 L41.8413043,45 C41.8413043,46.1321837 40.9234881,47.05 39.7913043,47.05 C38.6591206,47.05 37.7413043,46.1321837 37.7413043,45 L37.7413043,30.3913043 C37.7413043,29.2591206 38.6591206,28.3413043 39.7913043,28.3413043 Z" id="Path" fill="#FFFFFF" fill-rule="nonzero"></path>
|
||||
<path d="M32.1330398,38.0495689 C32.9336146,38.8501437 34.2316028,38.8501437 35.0321776,38.0495689 L39.7906087,33.291 L44.5504311,38.0495689 C45.3088704,38.8080082 46.5137416,38.847926 47.3191738,38.1693225 L47.4495689,38.0495689 C48.2501437,37.2489941 48.2501437,35.9510059 47.4495689,35.1504311 L41.7573686,29.4582308 C40.6715413,28.3724035 38.9110674,28.3724035 37.8252401,29.4582308 L32.1330398,35.1504311 C31.332465,35.9510059 31.332465,37.2489941 32.1330398,38.0495689 Z" id="Path" fill="#FFFFFF" fill-rule="nonzero"></path>
|
||||
<path d="M36.5217391,5.3326087 C40.4153466,5.3326087 43.5717391,8.48900121 43.5717391,12.3826087 L43.5717391,21.7217391 C43.5717391,22.8539229 42.6539229,23.7717391 41.5217391,23.7717391 C40.3895554,23.7717391 39.4717391,22.8539229 39.4717391,21.7217391 L39.4717391,12.3826087 C39.4717391,10.7533687 38.1509791,9.4326087 36.5217391,9.4326087 L10,9.4326087 C8.37075999,9.4326087 7.05,10.7533687 7.05,12.3826087 L7.05,35.9826087 C7.05,37.6118487 8.37075999,38.9326087 10,38.9326087 L27.373913,38.9326087 C28.5060968,38.9326087 29.423913,39.850425 29.423913,40.9826087 C29.423913,42.1147924 28.5060968,43.0326087 27.373913,43.0326087 L10,43.0326087 C6.10639251,43.0326087 2.95,39.8762162 2.95,35.9826087 L2.95,12.3826087 C2.95,8.48900121 6.10639251,5.3326087 10,5.3326087 L36.5217391,5.3326087 Z" id="Path" fill="#FFFFFF" fill-rule="nonzero"></path>
|
||||
<polygon id="Path" fill="#FFFFFF" fill-rule="nonzero" points="6.09565217 20.3891304 40.426087 20.3891304 40.426087 16.2891304 6.09565217 16.2891304"></polygon>
|
||||
<path d="M11.8434783,0.95 C12.975662,0.95 13.8934783,1.86781626 13.8934783,3 L13.8934783,6.65217391 C13.8934783,7.78435765 12.975662,8.70217391 11.8434783,8.70217391 C10.7112945,8.70217391 9.79347826,7.78435765 9.79347826,6.65217391 L9.79347826,3 C9.79347826,1.86781626 10.7112945,0.95 11.8434783,0.95 Z" id="Path" fill="#FFFFFF" fill-rule="nonzero"></path>
|
||||
<path d="M34.6782609,0.95 C35.8104446,0.95 36.7282609,1.86781626 36.7282609,3 L36.7282609,6.65217391 C36.7282609,7.78435765 35.8104446,8.70217391 34.6782609,8.70217391 C33.5460771,8.70217391 32.6282609,7.78435765 32.6282609,6.65217391 L32.6282609,3 C32.6282609,1.86781626 33.5460771,0.95 34.6782609,0.95 Z" id="Path" fill="#FFFFFF" fill-rule="nonzero"></path>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.0 KiB |
12
Telegram/Resources/icons/settings/mini_gift_order_number.svg
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="48px" height="48px" viewBox="0 0 48 48" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Mini / mini_gift_sorting3</title>
|
||||
<g id="Mini-/-mini_gift_sorting3" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<path d="M34.4778761,13.749192 C35.6376741,13.749192 36.5778761,14.689394 36.5778761,15.849192 C36.5778761,17.00899 35.6376741,17.949192 34.4778761,17.949192 L7.57258674,17.949192 C6.41278876,17.949192 5.47258674,17.00899 5.47258674,15.849192 C5.47258674,14.689394 6.41278876,13.749192 7.57258674,13.749192 L34.4778761,13.749192 Z" id="Path" fill="#FFFFFF" fill-rule="nonzero"></path>
|
||||
<path d="M30.923367,27.509546 C32.083165,27.509546 33.023367,28.4497481 33.023367,29.609546 C33.023367,30.769344 32.083165,31.709546 30.923367,31.709546 L4,31.709546 C2.84020203,31.709546 1.9,30.769344 1.9,29.609546 C1.9,28.4497481 2.84020203,27.509546 4,27.509546 L30.923367,27.509546 Z" id="Path" fill="#FFFFFF" fill-rule="nonzero"></path>
|
||||
<path d="M14.7584617,4.53380965 C15.0159315,3.40295129 16.1413939,2.69492999 17.2722522,2.9523998 C18.4031106,3.20986962 19.1111319,4.33533198 18.8536621,5.46619035 L10.9056841,40.3752813 C10.6482143,41.5061396 9.52275197,42.2141609 8.39189361,41.9566911 C7.26103524,41.6992213 6.55301394,40.5737589 6.81048375,39.4429006 L14.7584617,4.53380965 Z" id="Path" fill="#FFFFFF" fill-rule="nonzero"></path>
|
||||
<path d="M28.1811642,4.55038432 C28.4294801,3.41748072 29.5491797,2.70038069 30.6820833,2.94869657 C31.8149869,3.19701246 32.532087,4.31671208 32.2837711,5.44961568 L24.6322095,40.3587066 C24.3838936,41.4916102 23.264194,42.2087102 22.1312904,41.9603943 C20.9983868,41.7120785 20.2812868,40.5923788 20.5296027,39.4594752 L28.1811642,4.55038432 Z" id="Path" fill="#FFFFFF" fill-rule="nonzero"></path>
|
||||
<path d="M39.7913043,28.3413043 C40.9234881,28.3413043 41.8413043,29.2591206 41.8413043,30.3913043 L41.8413043,45 C41.8413043,46.1321837 40.9234881,47.05 39.7913043,47.05 C38.6591206,47.05 37.7413043,46.1321837 37.7413043,45 L37.7413043,30.3913043 C37.7413043,29.2591206 38.6591206,28.3413043 39.7913043,28.3413043 Z" id="Path" fill="#FFFFFF" fill-rule="nonzero"></path>
|
||||
<path d="M32.1330398,38.0495689 C32.9336146,38.8501437 34.2316028,38.8501437 35.0321776,38.0495689 L39.7906087,33.291 L44.5504311,38.0495689 C45.3088704,38.8080082 46.5137416,38.847926 47.3191738,38.1693225 L47.4495689,38.0495689 C48.2501437,37.2489941 48.2501437,35.9510059 47.4495689,35.1504311 L41.7573686,29.4582308 C40.6715413,28.3724035 38.9110674,28.3724035 37.8252401,29.4582308 L32.1330398,35.1504311 C31.332465,35.9510059 31.332465,37.2489941 32.1330398,38.0495689 Z" id="Path" fill="#FFFFFF" fill-rule="nonzero"></path>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.8 KiB |
10
Telegram/Resources/icons/settings/mini_gift_order_price.svg
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="48px" height="48px" viewBox="0 0 48 48" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Mini / mini_gift_sorting1</title>
|
||||
<g id="Mini-/-mini_gift_sorting1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<path d="M23.4380165,1.95 C35.3025073,1.95 44.9260331,11.510317 44.9260331,23.3103448 C44.9260331,23.5919731 44.9205389,23.8730129 44.9095753,24.1533571 C44.8653322,25.2846761 43.9123508,26.1659251 42.7810319,26.121682 C41.6497129,26.0774389 40.7684638,25.1244576 40.812707,23.9931386 C40.8215831,23.7661706 40.8260331,23.5385471 40.8260331,23.3103448 C40.8260331,13.7807547 33.0441659,6.05 23.4380165,6.05 C13.8318671,6.05 6.05,13.7807547 6.05,23.3103448 C6.05,32.839935 13.8318671,40.5706897 23.4380165,40.5706897 C25.2657432,40.5706897 27.0529516,40.2914087 28.7555206,39.7492213 C29.8343232,39.4056738 30.9873658,40.0017158 31.3309133,41.0805185 C31.6744608,42.1593211 31.0784187,43.3123637 29.9996161,43.6559112 C27.8959061,44.3258431 25.6891219,44.6706897 23.4380165,44.6706897 C11.5735257,44.6706897 1.95,35.1103726 1.95,23.3103448 C1.95,11.510317 11.5735257,1.95 23.4380165,1.95 Z" id="Path" fill="#FFFFFF" fill-rule="nonzero"></path>
|
||||
<path d="M39.7913043,28.3413043 C40.9234881,28.3413043 41.8413043,29.2591206 41.8413043,30.3913043 L41.8413043,45 C41.8413043,46.1321837 40.9234881,47.05 39.7913043,47.05 C38.6591206,47.05 37.7413043,46.1321837 37.7413043,45 L37.7413043,30.3913043 C37.7413043,29.2591206 38.6591206,28.3413043 39.7913043,28.3413043 Z" id="Path" fill="#FFFFFF" fill-rule="nonzero"></path>
|
||||
<path d="M32.1330398,38.0495689 C32.9336146,38.8501437 34.2316028,38.8501437 35.0321776,38.0495689 L39.7906087,33.291 L44.5504311,38.0495689 C45.3088704,38.8080082 46.5137416,38.847926 47.3191738,38.1693225 L47.4495689,38.0495689 C48.2501437,37.2489941 48.2501437,35.9510059 47.4495689,35.1504311 L41.7573686,29.4582308 C40.6715413,28.3724035 38.9110674,28.3724035 37.8252401,29.4582308 L32.1330398,35.1504311 C31.332465,35.9510059 31.332465,37.2489941 32.1330398,38.0495689 Z" id="Path" fill="#FFFFFF" fill-rule="nonzero"></path>
|
||||
<path d="M23.8366211,35.9195313 C24.4958008,35.9195313 25.281738,35.5533203 25.281738,34.6744141 L25.281738,33.5025391 C29.2221677,33.0777344 31.4831055,30.7632813 31.4831055,27.3941406 C31.4831055,24.49375 29.7399414,22.7359375 26.1217773,21.9449219 L23.1481445,21.2710938 C21.287793,20.8609375 20.3795898,20.0113281 20.3795898,18.7662109 C20.3795898,17.2720703 21.6686523,16.1880859 23.6901367,16.1880859 C25.3307617,16.1880859 26.4733398,16.7447266 27.7477539,18.165625 C28.3922852,18.8394531 28.890332,19.0884766 29.5641602,19.0884766 C30.3844727,19.0884766 31.0143555,18.5171875 31.0143555,17.6675781 C31.0143555,16.8472656 30.530957,15.9537109 29.7106445,15.1480469 C28.6266602,14.1226563 27.2006837,13.4488281 25.369629,13.2144531 L25.369629,11.9986328 C25.369629,11.134375 24.5836914,10.7681641 23.9098633,10.7681641 C23.2506836,10.7681641 22.464746,11.1197266 22.464746,11.9986328 L22.464746,13.1705078 C18.6708007,13.5220703 16.4538086,15.7925781 16.4538086,19.0445313 C16.4538086,21.8863281 18.1969727,23.7759766 21.5368164,24.5230469 L24.5104492,25.2115234 C26.678418,25.7242188 27.5719727,26.4859375 27.5719727,27.775 C27.5719727,29.4449219 26.2682617,30.4996094 23.9391602,30.4996094 C22.1959961,30.4996094 20.7458008,29.8404297 19.4274414,28.4195313 C18.6803711,27.6724609 18.2702148,27.5113281 17.7135742,27.5113281 C16.8200195,27.5113281 16.1461914,28.0826172 16.1461914,29.0640625 C16.1461914,29.9283203 16.6442383,30.821875 17.537793,31.5982422 C18.709668,32.6675781 20.3407222,33.3267578 22.376855,33.5171875 L22.376855,34.6744141 C22.376855,35.5533203 23.162793,35.9195313 23.8366211,35.9195313 Z" id="Path" fill="#FFFFFF" fill-rule="nonzero"></path>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.8 KiB |
7
Telegram/Resources/icons/settings/premium/checklist.svg
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Icon / Filled / checklist</title>
|
||||
<g id="Icon-/-Filled-/-checklist" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<path d="M12,4 C16.416,4 20,7.584 20,12 C20,16.416 16.416,20 12,20 C7.584,20 4,16.416 4,12 C4,7.584 7.584,4 12,4 Z M16.4818432,9.54348643 C16.1872637,9.22288416 15.7053635,9.21829494 15.4054889,9.53323613 L10.7733532,14.3979954 L8.99451107,12.5296222 C8.69463652,12.2146811 8.21273632,12.2192703 7.91815685,12.5398725 C7.62357737,12.8604748 7.62786989,13.3756846 7.92774444,13.6906258 L10.1546212,16.0293878 C10.4981762,16.3902041 11.0487833,16.3902041 11.3923383,16.0293878 L16.4722556,10.6942397 C16.7721301,10.3792985 16.7764226,9.8640887 16.4818432,9.54348643 Z" id="Shape" fill="#FFFFFF" fill-rule="nonzero"></path>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 975 B |
@@ -16,7 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"cloud_lng_passport_in_ar" = "Arabic";
|
||||
"cloud_lng_passport_in_az" = "Azerbaijani";
|
||||
"cloud_lng_passport_in_bg" = "Bulgarian";
|
||||
"cloud_lng_passport_in_bn" = "Bangla";
|
||||
"cloud_lng_passport_in_bn" = "Bengali";
|
||||
"cloud_lng_passport_in_cs" = "Czech";
|
||||
"cloud_lng_passport_in_da" = "Danish";
|
||||
"cloud_lng_passport_in_de" = "German";
|
||||
@@ -64,7 +64,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"cloud_lng_translate_to_ar" = "Arabic";
|
||||
"cloud_lng_translate_to_az" = "Azerbaijani";
|
||||
"cloud_lng_translate_to_bg" = "Bulgarian";
|
||||
// "cloud_lng_translate_to_bn" = "Bangla";
|
||||
// "cloud_lng_translate_to_bn" = "Bengali";
|
||||
"cloud_lng_translate_to_cs" = "Czech";
|
||||
"cloud_lng_translate_to_da" = "Danish";
|
||||
"cloud_lng_translate_to_de" = "German";
|
||||
@@ -109,50 +109,116 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"cloud_lng_translate_to_uz" = "Uzbek";
|
||||
"cloud_lng_translate_to_vi" = "Vietnamese";
|
||||
|
||||
"cloud_lng_language_af" = "Afrikaans";
|
||||
"cloud_lng_language_am" = "Amharic";
|
||||
"cloud_lng_language_ar" = "Arabic";
|
||||
"cloud_lng_language_az" = "Azerbaijani";
|
||||
"cloud_lng_language_be" = "Belarusian";
|
||||
"cloud_lng_language_bg" = "Bulgarian";
|
||||
// "cloud_lng_language_bn" = "Bangla";
|
||||
"cloud_lng_language_bn" = "Bengali";
|
||||
"cloud_lng_language_bs" = "Bosnian";
|
||||
"cloud_lng_language_ca" = "Catalan";
|
||||
// "cloud_lng_language_ceb" = "Cebuano";
|
||||
"cloud_lng_language_co" = "Corsican";
|
||||
"cloud_lng_language_cs" = "Czech";
|
||||
"cloud_lng_language_cy" = "Welsh";
|
||||
"cloud_lng_language_da" = "Danish";
|
||||
"cloud_lng_language_de" = "German";
|
||||
// "cloud_lng_language_dv" = "Divehi";
|
||||
// "cloud_lng_language_dz" = "Dzongkha";
|
||||
"cloud_lng_language_dv" = "Divehi";
|
||||
"cloud_lng_language_dz" = "Dzongkha";
|
||||
"cloud_lng_language_el" = "Greek";
|
||||
"cloud_lng_language_en" = "English";
|
||||
"cloud_lng_language_eo" = "Esperanto";
|
||||
"cloud_lng_language_es" = "Spanish";
|
||||
"cloud_lng_language_et" = "Estonian";
|
||||
"cloud_lng_language_eu" = "Basque";
|
||||
"cloud_lng_language_fa" = "Persian";
|
||||
"cloud_lng_language_fi" = "Finnish";
|
||||
"cloud_lng_language_fr" = "French";
|
||||
"cloud_lng_language_fy" = "Frisian";
|
||||
"cloud_lng_language_ga" = "Irish";
|
||||
"cloud_lng_language_gd" = "Scots Gaelic";
|
||||
"cloud_lng_language_gl" = "Galician";
|
||||
"cloud_lng_language_gu" = "Gujarati";
|
||||
"cloud_lng_language_ha" = "Hausa";
|
||||
"cloud_lng_language_haw" = "Hawaiian";
|
||||
"cloud_lng_language_he" = "Hebrew";
|
||||
"cloud_lng_language_hi" = "Hindi";
|
||||
// "cloud_lng_language_hmn" = "Hmong";
|
||||
"cloud_lng_language_hr" = "Croatian";
|
||||
"cloud_lng_language_ht" = "Haitian Creole";
|
||||
"cloud_lng_language_hu" = "Hungarian";
|
||||
"cloud_lng_language_hy" = "Armenian";
|
||||
"cloud_lng_language_id" = "Indonesian";
|
||||
"cloud_lng_language_ig" = "Igbo";
|
||||
"cloud_lng_language_is" = "Icelandic";
|
||||
"cloud_lng_language_it" = "Italian";
|
||||
"cloud_lng_language_iw" = "Hebrew (Obsolete code)";
|
||||
"cloud_lng_language_ja" = "Japanese";
|
||||
"cloud_lng_language_jv" = "Javanese";
|
||||
"cloud_lng_language_ka" = "Georgian";
|
||||
// "cloud_lng_language_km" = "Khmer";
|
||||
"cloud_lng_language_kk" = "Kazakh";
|
||||
"cloud_lng_language_km" = "Khmer";
|
||||
"cloud_lng_language_kn" = "Kannada";
|
||||
"cloud_lng_language_ko" = "Korean";
|
||||
"cloud_lng_language_ku" = "Kurdish";
|
||||
"cloud_lng_language_ky" = "Kyrgyz";
|
||||
"cloud_lng_language_la" = "Latin";
|
||||
"cloud_lng_language_lb" = "Luxembourgish";
|
||||
"cloud_lng_language_lo" = "Lao";
|
||||
"cloud_lng_language_lt" = "Lithuanian";
|
||||
"cloud_lng_language_lv" = "Latvian";
|
||||
"cloud_lng_language_mg" = "Malagasy";
|
||||
"cloud_lng_language_mi" = "Maori";
|
||||
"cloud_lng_language_mk" = "Macedonian";
|
||||
"cloud_lng_language_ml" = "Malayalam";
|
||||
"cloud_lng_language_mn" = "Mongolian";
|
||||
"cloud_lng_language_mr" = "Marathi";
|
||||
"cloud_lng_language_ms" = "Malay";
|
||||
"cloud_lng_language_mt" = "Maltese";
|
||||
"cloud_lng_language_my" = "Burmese";
|
||||
"cloud_lng_language_ne" = "Nepali";
|
||||
"cloud_lng_language_nl" = "Dutch";
|
||||
"cloud_lng_language_no" = "Norwegian";
|
||||
"cloud_lng_language_ny" = "Nyanja";
|
||||
"cloud_lng_language_or" = "Odia (Oriya)";
|
||||
"cloud_lng_language_pa" = "Punjabi";
|
||||
"cloud_lng_language_pl" = "Polish";
|
||||
"cloud_lng_language_ps" = "Pashto";
|
||||
"cloud_lng_language_pt" = "Portuguese";
|
||||
"cloud_lng_language_ro" = "Romanian";
|
||||
"cloud_lng_language_ru" = "Russian";
|
||||
"cloud_lng_language_rw" = "Kinyarwanda";
|
||||
"cloud_lng_language_sd" = "Sindhi";
|
||||
"cloud_lng_language_si" = "Sinhala";
|
||||
"cloud_lng_language_sk" = "Slovak";
|
||||
"cloud_lng_language_sl" = "Slovenian";
|
||||
"cloud_lng_language_sm" = "Samoan";
|
||||
"cloud_lng_language_sn" = "Shona";
|
||||
"cloud_lng_language_so" = "Somali";
|
||||
"cloud_lng_language_sq" = "Albanian";
|
||||
"cloud_lng_language_sr" = "Serbian";
|
||||
"cloud_lng_language_st" = "Sesotho";
|
||||
"cloud_lng_language_su" = "Sundanese";
|
||||
"cloud_lng_language_sv" = "Swedish";
|
||||
"cloud_lng_language_sw" = "Swahili";
|
||||
"cloud_lng_language_ta" = "Tamil";
|
||||
"cloud_lng_language_te" = "Telugu";
|
||||
"cloud_lng_language_tg" = "Tajik";
|
||||
"cloud_lng_language_th" = "Thai";
|
||||
"cloud_lng_language_tk" = "Turkmen";
|
||||
"cloud_lng_language_tl" = "Tagalog";
|
||||
"cloud_lng_language_tr" = "Turkish";
|
||||
"cloud_lng_language_tt" = "Tatar";
|
||||
"cloud_lng_language_ug" = "Uyghur";
|
||||
"cloud_lng_language_uk" = "Ukrainian";
|
||||
"cloud_lng_language_ur" = "Urdu";
|
||||
"cloud_lng_language_uz" = "Uzbek";
|
||||
"cloud_lng_language_vi" = "Vietnamese";
|
||||
"cloud_lng_language_xh" = "Xhosa";
|
||||
"cloud_lng_language_yi" = "Yiddish";
|
||||
"cloud_lng_language_yo" = "Yoruba";
|
||||
"cloud_lng_language_zh" = "Chinese";
|
||||
// "cloud_lng_language_zh-CN" = "Chinese (Simplified)";
|
||||
// "cloud_lng_language_zh-TW" = "Chinese (Traditional)";
|
||||
"cloud_lng_language_zu" = "Zulu";
|
||||
|
||||
@@ -164,11 +164,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_chat_status_members_online" = "{members_count}, {online_count}";
|
||||
"lng_chat_status_subscribers#one" = "{count} subscriber";
|
||||
"lng_chat_status_subscribers#other" = "{count} subscribers";
|
||||
"lng_chat_status_direct" = "Direct messages";
|
||||
|
||||
"lng_channel_status" = "channel";
|
||||
"lng_group_status" = "group";
|
||||
"lng_scam_badge" = "SCAM";
|
||||
"lng_fake_badge" = "FAKE";
|
||||
"lng_direct_badge" = "DIRECT";
|
||||
|
||||
"lng_remember" = "Remember this choice";
|
||||
|
||||
@@ -836,6 +838,19 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_settings_disconnect" = "Disconnect";
|
||||
"lng_settings_connected_title" = "Connected websites";
|
||||
|
||||
"lng_settings_suggestion_phone_number_title" = "Is {phone} still your number?";
|
||||
"lng_settings_suggestion_phone_number_about" = "Keep your number up to date to ensure you can always log into Telegram. {link}";
|
||||
"lng_settings_suggestion_phone_number_about_link" = "https://telegram.org/faq#q-i-have-a-new-phone-number-what-do-i-do";
|
||||
"lng_settings_suggestion_phone_number_change" = "Please change your phone number in the official Telegram app on your phone as soon as possible. {emoji}";
|
||||
"lng_settings_suggestion_password_title" = "Your password";
|
||||
"lng_settings_suggestion_password_about" = "Your account is protected by 2-Step Veritifaction. Do you still remember your password?";
|
||||
"lng_settings_suggestion_password_yes" = "Yes, definitely";
|
||||
"lng_settings_suggestion_password_no" = "Not sure";
|
||||
"lng_settings_suggestion_password_step_input_title" = "Enter your password";
|
||||
"lng_settings_suggestion_password_step_input_about" = "Do you still remember your password?";
|
||||
"lng_settings_suggestion_password_step_finish_title" = "Perfect!";
|
||||
"lng_settings_suggestion_password_step_finish_about" = "You still remember your password.";
|
||||
|
||||
"lng_settings_power_menu" = "Battery and Animations";
|
||||
"lng_settings_power_title" = "Power Usage";
|
||||
"lng_settings_power_subtitle" = "Power saving options";
|
||||
@@ -1147,6 +1162,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_proxy_menu_delete" = "Delete";
|
||||
"lng_proxy_menu_restore" = "Restore";
|
||||
"lng_proxy_edit_share" = "Share";
|
||||
"lng_proxy_edit_share_qr_box_title" = "Share proxy with QR code";
|
||||
"lng_proxy_edit_share_list_button" = "Share Proxy List";
|
||||
"lng_proxy_edit_share_list_toast" = "Proxy List copied to clipboard.";
|
||||
"lng_proxy_address_label" = "Socket address";
|
||||
"lng_proxy_credentials_optional" = "Credentials (optional)";
|
||||
"lng_proxy_credentials" = "Credentials";
|
||||
@@ -1185,6 +1203,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_settings_faq_link" = "https://telegram.org/faq#general-questions";
|
||||
"lng_settings_features" = "Telegram Features";
|
||||
"lng_settings_credits" = "My Stars";
|
||||
"lng_settings_currency" = "My TON";
|
||||
"lng_settings_logout" = "Log out";
|
||||
"lng_sure_logout" = "Are you sure you want to log out?";
|
||||
|
||||
@@ -1476,6 +1495,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_profile_hide_participants_about" = "Switch this on to hide the list of members in this group. Admins will remain visible.";
|
||||
"lng_profile_view_channel" = "View Channel";
|
||||
"lng_profile_view_discussion" = "View discussion";
|
||||
"lng_profile_direct_messages" = "Direct messages";
|
||||
"lng_profile_join_channel" = "Join Channel";
|
||||
"lng_profile_join_group" = "Join Group";
|
||||
"lng_profile_apply_to_join_group" = "Apply to Join Group";
|
||||
@@ -1873,6 +1893,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_manage_linked_channel_posted" = "All new posts from this channel are forwarded to the group.";
|
||||
"lng_manage_discussion_group_warning" = "\"Chat history for new members\" will be switched to **Visible**.";
|
||||
|
||||
"lng_manage_monoforum" = "Direct Messages";
|
||||
"lng_manage_monoforum_off" = "Off";
|
||||
"lng_manage_monoforum_free" = "Free";
|
||||
"lng_manage_monoforum_allow" = "Allow Channel Messages";
|
||||
"lng_manage_monoforum_price" = "Price for each message";
|
||||
"lng_manage_monoforum_about" = "Allow users to send messages to your channel, with the option to charge a fee for each message.";
|
||||
"lng_manage_monoforum_price_about" = "Your channel will receive {percent} of the selected fee ({amount}) for each incoming message.";
|
||||
|
||||
"lng_manage_history_visibility_title" = "Chat history for new members";
|
||||
"lng_manage_history_visibility_shown" = "Visible";
|
||||
"lng_manage_history_visibility_shown_about" = "New members will see messages that were sent before they joined.";
|
||||
@@ -2056,6 +2084,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_action_changed_title" = "{from} changed group name to «{title}»";
|
||||
"lng_action_changed_title_channel" = "Channel name was changed to «{title}»";
|
||||
"lng_action_created_chat" = "{from} created the group «{title}»";
|
||||
"lng_action_created_monoforum" = "Direct messages were enabled in this channel.";
|
||||
"lng_action_ttl_changed" = "{from} set messages to auto-delete in {duration}";
|
||||
"lng_action_ttl_changed_you" = "You set messages to auto-delete in {duration}";
|
||||
"lng_action_ttl_changed_channel" = "Messages in this channel will be automatically deleted after {duration}";
|
||||
@@ -2163,6 +2192,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_action_gift_premium_months#other" = "{count} Months Premium";
|
||||
"lng_action_gift_premium_about" = "Subscription for exclusive Telegram features.";
|
||||
"lng_action_gift_refunded" = "This gift was downgraded because a request to refund the payment related to this gift was made, and the money was returned.";
|
||||
"lng_action_gift_got_ton" = "Use TON to suggest posts to channels.";
|
||||
"lng_action_suggested_photo_me" = "You suggested this photo for {user}'s Telegram profile.";
|
||||
"lng_action_suggested_photo" = "{user} suggests this photo for your Telegram profile.";
|
||||
"lng_action_suggested_photo_button" = "View Photo";
|
||||
@@ -2230,6 +2260,28 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_action_message_price_free" = "Messages are now free in this group.";
|
||||
"lng_action_message_price_paid#one" = "Messages now cost {count} Star each in this group.";
|
||||
"lng_action_message_price_paid#other" = "Messages now cost {count} Stars each in this group.";
|
||||
"lng_action_direct_messages_enabled" = "Channel enabled Direct Messages.";
|
||||
"lng_action_direct_messages_paid#one" = "Channel allows Direct Messages for {count} Star each.";
|
||||
"lng_action_direct_messages_paid#other" = "Channel allows Direct Messages for {count} Stars each.";
|
||||
"lng_action_direct_messages_disabled" = "Channel disabled Direct Messages.";
|
||||
"lng_action_todo_marked_done" = "{from} marked {tasks} as done.";
|
||||
"lng_action_todo_marked_done_self" = "You marked {tasks} as done.";
|
||||
"lng_action_todo_marked_not_done" = "{from} marked {tasks} as not done.";
|
||||
"lng_action_todo_marked_not_done_self" = "You marked {tasks} as not done.";
|
||||
"lng_action_todo_added" = "{from} added {tasks} to the list.";
|
||||
"lng_action_todo_added_self" = "You added {tasks} to the list.";
|
||||
"lng_action_todo_tasks_fallback#one" = "task";
|
||||
"lng_action_todo_tasks_fallback#other" = "{count} tasks";
|
||||
"lng_action_todo_tasks_and_one" = "{tasks}, {task}";
|
||||
"lng_action_todo_tasks_and_last" = "{tasks} and {task}";
|
||||
"lng_action_suggest_success_stars#one" = "{from} has received {count} Star for publishing post.";
|
||||
"lng_action_suggest_success_stars#other" = "{from} has received {count} Stars for publishing post.";
|
||||
"lng_action_suggest_success_ton#one" = "{from} has received {count} TON for publishing post.";
|
||||
"lng_action_suggest_success_ton#other" = "{from} has received {count} TON for publishing post.";
|
||||
"lng_action_suggest_refund_user" = "User refunded the Stars so that post was deleted.";
|
||||
"lng_action_suggest_refund_admin" = "Admin deleted the post early so that the price was refunded to the user.";
|
||||
"lng_action_post_rejected" = "The post was rejected.";
|
||||
"lng_action_not_enough_funds" = "Transaction failed.";
|
||||
"lng_you_paid_stars#one" = "You paid {count} Star.";
|
||||
"lng_you_paid_stars#other" = "You paid {count} Stars.";
|
||||
|
||||
@@ -2251,6 +2303,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_peer_gifts_title" = "Gifts";
|
||||
"lng_peer_gifts_about" = "These gifts were sent to {user} by other users.";
|
||||
"lng_peer_gifts_about_mine" = "These gifts were sent to you by other users. Click on a gift to convert it to Stars or change its privacy settings.";
|
||||
"lng_peer_gifts_empty_search" = "No matching gifts";
|
||||
"lng_peer_gifts_view_all" = "View All Gifts";
|
||||
"lng_peer_gifts_notify" = "Notify About New Gifts";
|
||||
"lng_peer_gifts_notify_enabled" = "You will receive a message from Telegram when your channel receives a gift.";
|
||||
"lng_peer_gifts_filter_by_value" = "Sort by Value";
|
||||
@@ -2595,6 +2649,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_premium_summary_about_effects" = "Add over 500 animated effects to private messages.";
|
||||
"lng_premium_summary_subtitle_filter_tags" = "Tag Your Chats";
|
||||
"lng_premium_summary_about_filter_tags" = "Display folder names for each chat in the chat list.";
|
||||
"lng_premium_summary_subtitle_todo_lists" = "Checklists";
|
||||
"lng_premium_summary_about_todo_lists" = "Plan, assign, and complete tasks - seamlessly and efficiently.";
|
||||
"lng_premium_summary_bottom_subtitle" = "About Telegram Premium";
|
||||
"lng_premium_summary_bottom_about" = "While the free version of Telegram already gives its users more than any other messaging application, **Telegram Premium** pushes its capabilities even further.\n\n**Telegram Premium** is a paid option, because most Premium Features require additional expenses from Telegram to third parties such as data center providers and server manufacturers. Contributions from **Telegram Premium** users allow us to cover such costs and also help Telegram stay free for everyone.";
|
||||
"lng_premium_summary_button" = "Subscribe for {cost} per month";
|
||||
@@ -2725,6 +2781,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
"lng_credits_summary_title" = "Telegram Stars";
|
||||
"lng_credits_summary_about" = "Buy Stars to unlock content and services in miniapps on Telegram.";
|
||||
"lng_credits_currency_summary_title" = "TON Balance";
|
||||
"lng_credits_currency_summary_about" = "Offer TON to submit post suggestions to channels on Telegram.";
|
||||
"lng_credits_currency_summary_subtitle" = "You can withdraw your TON using Fragment.";
|
||||
"lng_credits_currency_summary_in_button" = "Top-up via Fragment";
|
||||
"lng_credits_currency_summary_in_subtitle" = "You can top-up your TON balance via Fragment.";
|
||||
"lng_credits_summary_options_subtitle" = "Choose package";
|
||||
"lng_credits_summary_options_credits#one" = "{count} Star";
|
||||
"lng_credits_summary_options_credits#other" = "{count} Stars";
|
||||
@@ -2748,8 +2809,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_credits_premium_gift_duration" = "Duration";
|
||||
"lng_credits_more_options" = "More Options";
|
||||
"lng_credits_balance_me" = "your balance";
|
||||
"lng_credits_buy_button" = "Buy More Stars";
|
||||
"lng_credits_balance_me_count" = "Your balance: {emoji} {amount}";
|
||||
"lng_credits_buy_button" = "Top Up Balance";
|
||||
"lng_credits_topup_button" = "{emoji} Top Up Balance";
|
||||
"lng_credits_buy_button_short" = "Top Up";
|
||||
"lng_credits_stats_button_short" = "Stats";
|
||||
"lng_credits_stats_button" = "View Statistics";
|
||||
"lng_credits_gift_button" = "Gift Stars to Friends";
|
||||
"lng_credits_earn_button" = "Earn Stars from Mini Apps";
|
||||
"lng_credits_box_out_title" = "Confirm Your Purchase";
|
||||
"lng_credits_box_out_sure#one" = "Do you want to buy **\"{text}\"** in **{bot}** for **{count} Star**?";
|
||||
"lng_credits_box_out_sure#other" = "Do you want to buy **\"{text}\"** in **{bot}** for **{count} Stars**?";
|
||||
@@ -2796,6 +2863,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_credits_box_history_entry_gift_converted" = "Converted Gift";
|
||||
"lng_credits_box_history_entry_gift_transfer" = "Gift Transfer";
|
||||
"lng_credits_box_history_entry_gift_unavailable" = "Unavailable";
|
||||
"lng_credits_box_history_entry_gift_released" = "released by {name}";
|
||||
"lng_credits_box_history_entry_gift_sold_out" = "This gift has sold out";
|
||||
"lng_credits_box_history_entry_gift_out_about" = "With Stars, **{user}** will be able to unlock content and services on Telegram.\n{link}";
|
||||
"lng_credits_box_history_entry_gift_in_about" = "Use Stars to unlock content and services on Telegram. {link}";
|
||||
@@ -2803,6 +2871,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_credits_box_history_entry_gift_examples" = "Examples";
|
||||
"lng_credits_box_history_entry_ads" = "Ads Platform";
|
||||
"lng_credits_box_history_entry_premium_bot" = "Stars Top-Up";
|
||||
"lng_credits_box_history_entry_currency_in" = "TON Top-Up";
|
||||
"lng_credits_box_history_entry_api" = "Paid Broadcast";
|
||||
"lng_credits_box_history_entry_floodskip_about#one" = "{count} Message";
|
||||
"lng_credits_box_history_entry_floodskip_about#other" = "{count} Messages";
|
||||
@@ -2823,6 +2892,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_credits_box_history_entry_reaction_name" = "Star Reaction";
|
||||
"lng_credits_box_history_entry_subscription" = "Monthly subscription fee";
|
||||
"lng_credits_box_history_entry_gift_upgrade" = "Collectible Upgrade";
|
||||
"lng_credits_box_history_entry_gift_sold" = "Gift Sale";
|
||||
"lng_credits_box_history_entry_gift_bought" = "Gift Purchase";
|
||||
"lng_credits_box_history_entry_gift_sold_to" = "To";
|
||||
"lng_credits_box_history_entry_gift_full_price" = "Full Price";
|
||||
"lng_credits_box_history_entry_gift_bought_from" = "From";
|
||||
|
||||
"lng_credits_subscription_section" = "My subscriptions";
|
||||
"lng_credits_box_subscription_title" = "Subscription";
|
||||
@@ -2861,6 +2935,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_credits_small_balance_star_gift" = "Buy **Stars** to send gifts to {user} and other contacts.";
|
||||
"lng_credits_small_balance_for_message" = "Buy **Stars** to send messages to {user}.";
|
||||
"lng_credits_small_balance_for_messages" = "Buy **Stars** to send messages.";
|
||||
"lng_credits_small_balance_for_suggest" = "Buy **Stars** to suggest post to {channel}.";
|
||||
"lng_credits_small_balance_fallback" = "Buy **Stars** to unlock content and services on Telegram.";
|
||||
"lng_credits_purchase_blocked" = "Sorry, you can't purchase this item with Telegram Stars.";
|
||||
"lng_credits_enough" = "You have enough stars at the moment. {link}";
|
||||
@@ -2965,6 +3040,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_chatbots_include_button" = "Select Chats";
|
||||
"lng_chatbots_exclude_about" = "Select chats or entire chat categories which the bot will not have access to.";
|
||||
"lng_chatbots_permissions_title" = "Bot permissions";
|
||||
"lng_chatbots_warning_title" = "Warning";
|
||||
"lng_chatbots_warning_both_text" = "The bot {bot} will be able to **manage your gifts and stars**, including giving them away to other users.";
|
||||
"lng_chatbots_warning_gifts_text" = "The bot {bot} will be able to **manage your gifts**, including giving them away to other users.";
|
||||
"lng_chatbots_warning_stars_text" = "The bot {bot} will be able to **transfer your stars**.";
|
||||
"lng_chatbots_warning_username_text" = "The bot {bot} will be able to **set and remove usernames** for your account, which may result in the loss of your current username.";
|
||||
|
||||
"lng_chatbots_manage_messages" = "Manage Messages";
|
||||
"lng_chatbots_read" = "Read Messages";
|
||||
@@ -3155,6 +3235,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_boost_group_ask" = "Ask your **Premium** members to boost your group with this link:";
|
||||
//"lng_boost_group_gifting" = "Boost your group by gifting your members Telegram Premium. {link}";
|
||||
|
||||
"lng_boost_channel_title_autotranslate" = "Autotranslation of Messages";
|
||||
"lng_boost_channel_needs_level_autotranslate#one" = "Your channel needs to reach **Level {count}** to enable autotranslation of messages.";
|
||||
"lng_boost_channel_needs_level_autotranslate#other" = "Your channel needs to reach **Level {count}** to enable autotranslation of messages.";
|
||||
|
||||
"lng_feature_stories#one" = "**{count}** Story Per Day";
|
||||
"lng_feature_stories#other" = "**{count}** Stories Per Day";
|
||||
"lng_feature_reactions#one" = "**{count}** Custom Reaction";
|
||||
@@ -3173,6 +3257,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_feature_custom_background_group" = "Custom Group Background";
|
||||
"lng_feature_custom_emoji_pack" = "Custom Emoji Pack";
|
||||
"lng_feature_transcribe" = "Voice-to-Text Conversion";
|
||||
"lng_feature_autotranslate" = "Autotranslation of Messages";
|
||||
|
||||
"lng_edit_topics_enable" = "Enable Topics";
|
||||
"lng_edit_topics_about" = "The group chat will be divided into topics created by admins or users.";
|
||||
"lng_edit_topics_layout" = "Topics layout";
|
||||
"lng_edit_topics_layout_about" = "Choose how topics appear for all members.";
|
||||
"lng_edit_topics_tabs" = "Tabs";
|
||||
"lng_edit_topics_list" = "List";
|
||||
|
||||
"lng_giveaway_new_title" = "Boosts via Gifts";
|
||||
"lng_giveaway_new_about" = "Get more boosts for your channel by gifting Premium to your subscribers.";
|
||||
@@ -3410,6 +3502,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_gift_stars_incoming" = "Use Stars to unlock content and services on Telegram.";
|
||||
"lng_gift_until" = "Until";
|
||||
|
||||
"lng_gift_ton_amount#one" = "{count} TON";
|
||||
"lng_gift_ton_amount#other" = "{count} TON";
|
||||
|
||||
"lng_gift_premium_or_stars" = "Gift Premium or Stars";
|
||||
"lng_gift_premium_subtitle" = "Gift Premium";
|
||||
"lng_gift_premium_about" = "Give {name} access to exclusive features with Telegram Premium. {features}";
|
||||
@@ -3421,10 +3516,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_gift_stars_link" = "What are Stars >";
|
||||
"lng_gift_stars_limited" = "limited";
|
||||
"lng_gift_stars_sold_out" = "sold out";
|
||||
"lng_gift_stars_resale" = "resale";
|
||||
"lng_gift_stars_on_sale" = "on sale";
|
||||
"lng_gift_stars_tabs_all" = "All Gifts";
|
||||
"lng_gift_stars_tabs_my" = "My Gifts";
|
||||
"lng_gift_stars_tabs_limited" = "Limited";
|
||||
"lng_gift_stars_tabs_in_stock" = "In Stock";
|
||||
"lng_gift_stars_tabs_resale" = "Resale";
|
||||
"lng_gift_send_title" = "Send a Gift";
|
||||
"lng_gift_send_message" = "Enter Message";
|
||||
"lng_gift_send_anonymous" = "Hide My Name";
|
||||
@@ -3446,7 +3544,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_gift_send_limited_left#other" = "{count} left";
|
||||
"lng_gift_send_button" = "Send a Gift for {cost}";
|
||||
"lng_gift_send_button_self" = "Buy a Gift for {cost}";
|
||||
"lng_gift_buy_resale_title" = "Buy {name}";
|
||||
"lng_gift_buy_resale_button" = "Buy for {cost}";
|
||||
"lng_gift_buy_resale_confirm" = "Do you want to buy {name} for {price} and gift it to {user}?";
|
||||
"lng_gift_buy_resale_confirm_self" = "Do you want to buy {name} for {price}?";
|
||||
"lng_gift_buy_price_change_title" = "Price change!";
|
||||
"lng_gift_buy_price_change_text" = "This gift price was changed and now is {price}. Do you still want to buy?";
|
||||
"lng_gift_sent_title" = "Gift Sent!";
|
||||
"lng_gift_sent_resale_done" = "{user} has been notified about your gift.";
|
||||
"lng_gift_sent_resale_done_self" = "{gift} is now yours.";
|
||||
"lng_gift_sent_about#one" = "You spent **{count}** Star from your balance.";
|
||||
"lng_gift_sent_about#other" = "You spent **{count}** Stars from your balance.";
|
||||
"lng_gift_limited_of_one" = "unique";
|
||||
@@ -3476,12 +3582,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_gift_self_about" = "Buy yourself a gift to display on your page or reserve for later.\n\nLimited-edition gifts upgraded to collectibles can be gifted to others later.";
|
||||
"lng_gift_channel_title" = "Send a Gift";
|
||||
"lng_gift_channel_about" = "Select a gift to show appreciation for {name}.";
|
||||
"lng_gift_released_by" = "Released by {name}";
|
||||
"lng_gift_unique_owner" = "Owner";
|
||||
"lng_gift_unique_address_copied" = "Address copied to clipboard.";
|
||||
"lng_gift_unique_status" = "Status";
|
||||
"lng_gift_unique_status_non" = "Non-Unique";
|
||||
"lng_gift_unique_status_upgrade" = "upgrade";
|
||||
"lng_gift_unique_number" = "Collectible #{index}";
|
||||
"lng_gift_unique_number_by" = "Collectible #{index} by {name}";
|
||||
"lng_gift_unique_model" = "Model";
|
||||
"lng_gift_unique_backdrop" = "Backdrop";
|
||||
"lng_gift_unique_symbol" = "Symbol";
|
||||
@@ -3573,6 +3681,23 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_gift_transfer_button_for" = "Transfer for {price}";
|
||||
"lng_gift_transfer_wear" = "Wear";
|
||||
"lng_gift_transfer_take_off" = "Take Off";
|
||||
"lng_gift_transfer_sell" = "Sell";
|
||||
"lng_gift_transfer_update" = "Change Price";
|
||||
"lng_gift_transfer_unlist" = "Unlist";
|
||||
"lng_gift_sell_unlist_title" = "Unlist {name}";
|
||||
"lng_gift_sell_unlist_sure" = "Are you sure you want to unlist your gift?";
|
||||
"lng_gift_sell_title" = "Price in Stars";
|
||||
"lng_gift_sell_placeholder" = "Enter price in Stars";
|
||||
"lng_gift_sell_about" = "You will receive {percent} of the selected amount.";
|
||||
"lng_gift_sell_amount#one" = "You will receive **{count}** Star.";
|
||||
"lng_gift_sell_amount#other" = "You will receive **{count}** Stars.";
|
||||
"lng_gift_sell_min_price#one" = "Minimum price is {count} Star.";
|
||||
"lng_gift_sell_min_price#other" = "Minimum price is {count} Stars.";
|
||||
"lng_gift_sell_put" = "Put for Sale";
|
||||
"lng_gift_sell_update" = "Update the Price";
|
||||
"lng_gift_sell_toast" = "{name} is now for sale!";
|
||||
"lng_gift_sell_updated" = "Sale price for {name} was updated.";
|
||||
"lng_gift_sell_removed" = "{name} is removed from sale.";
|
||||
"lng_gift_menu_show" = "Show";
|
||||
"lng_gift_menu_hide" = "Hide";
|
||||
"lng_gift_wear_title" = "Wear {name}";
|
||||
@@ -3589,6 +3714,27 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_gift_wear_end_toast" = "You took off {name}";
|
||||
"lng_gift_many_pinned_title" = "Too Many Pinned Gifts";
|
||||
"lng_gift_many_pinned_choose" = "Select a gift to unpin below";
|
||||
"lng_gift_resale_price" = "Price";
|
||||
"lng_gift_resale_number" = "Number";
|
||||
"lng_gift_resale_date" = "Date";
|
||||
"lng_gift_resale_count#one" = "{count} gift in resale";
|
||||
"lng_gift_resale_count#other" = "{count} gifts in resale";
|
||||
"lng_gift_resale_sort_price" = "Sort by Price";
|
||||
"lng_gift_resale_sort_date" = "Sort by Date";
|
||||
"lng_gift_resale_sort_number" = "Sort by Number";
|
||||
"lng_gift_resale_filter_all" = "Select All";
|
||||
"lng_gift_resale_model" = "Model";
|
||||
"lng_gift_resale_models#one" = "{count} Model";
|
||||
"lng_gift_resale_models#other" = "{count} Models";
|
||||
"lng_gift_resale_backdrop" = "Backdrop";
|
||||
"lng_gift_resale_backdrops#one" = "{count} Backdrop";
|
||||
"lng_gift_resale_backdrops#other" = "{count} Backdrops";
|
||||
"lng_gift_resale_symbol" = "Symbol";
|
||||
"lng_gift_resale_symbols#one" = "{count} Symbol";
|
||||
"lng_gift_resale_symbols#other" = "{count} Symbols";
|
||||
"lng_gift_resale_early" = "You will be able to resell this gift in {duration}.";
|
||||
"lng_gift_transfer_early" = "You will be able to transfer this gift in {duration}.";
|
||||
"lng_gift_resale_transfer_early_title" = "Try Later";
|
||||
|
||||
"lng_accounts_limit_title" = "Limit Reached";
|
||||
"lng_accounts_limit1#one" = "You have reached the limit of **{count}** connected account.";
|
||||
@@ -3687,6 +3833,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_in_dlg_sticker_emoji" = "{emoji} Sticker";
|
||||
"lng_in_dlg_poll" = "Poll";
|
||||
"lng_in_dlg_story" = "Story";
|
||||
"lng_in_dlg_todo_list" = "Checklist";
|
||||
"lng_in_dlg_story_expired" = "Expired story";
|
||||
"lng_in_dlg_media_count#one" = "{count} media";
|
||||
"lng_in_dlg_media_count#other" = "{count} media";
|
||||
@@ -3776,7 +3923,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_send_anonymous_ph" = "Send anonymously...";
|
||||
"lng_story_reply_ph" = "Reply privately...";
|
||||
"lng_story_comment_ph" = "Comment story...";
|
||||
"lng_message_paid_ph" = "Message for {amount}";
|
||||
"lng_message_stars_ph#one" = "Message for {count} Star";
|
||||
"lng_message_stars_ph#other" = "Message for {count} Stars";
|
||||
"lng_send_text_no" = "Text not allowed.";
|
||||
"lng_send_text_no_about" = "The admins of this group only allow sending {types}.";
|
||||
"lng_send_text_type_and_last" = "{types} and {last}";
|
||||
@@ -4115,6 +4263,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_context_edit_msg" = "Edit";
|
||||
"lng_context_add_factcheck" = "Add Fact Check";
|
||||
"lng_context_edit_factcheck" = "Edit Fact Check";
|
||||
"lng_context_add_offer" = "Add Offer";
|
||||
"lng_context_forward_msg" = "Forward";
|
||||
"lng_context_send_now_msg" = "Send Now";
|
||||
"lng_context_reschedule" = "Reschedule";
|
||||
@@ -4126,6 +4275,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_context_pin_msg" = "Pin";
|
||||
"lng_context_unpin_msg" = "Unpin";
|
||||
"lng_context_cancel_upload" = "Cancel Upload";
|
||||
"lng_context_upload_edit_caption" = "Edit Caption";
|
||||
"lng_context_copy_selected" = "Copy Selected Text";
|
||||
"lng_context_copy_selected_items" = "Copy Selected as Text";
|
||||
"lng_context_forward_selected" = "Forward Selected";
|
||||
@@ -4149,6 +4299,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_context_seen_reacted#other" = "{count} Reacted";
|
||||
"lng_context_seen_reacted_none" = "Nobody Reacted";
|
||||
"lng_context_seen_reacted_all" = "Show All Reactions";
|
||||
"lng_context_sent_by" = "Sent by {user}";
|
||||
"lng_context_set_as_quick" = "Set As Quick";
|
||||
"lng_context_filter_by_tag" = "Filter by Tag";
|
||||
"lng_context_tag_add_name" = "Add Name";
|
||||
@@ -4164,6 +4315,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_context_edit_shortcut" = "Edit Shortcut";
|
||||
"lng_context_delete_shortcut" = "Delete Quick Reply";
|
||||
"lng_context_gift_send" = "Send Another Gift";
|
||||
"lng_context_charge_fee" = "Charge Fee";
|
||||
"lng_context_remove_fee" = "Remove Fee";
|
||||
"lng_context_fee_now" = "{name} pays {amount} per message.";
|
||||
"lng_context_fee_free" = "{name} can send messages for free.";
|
||||
|
||||
"lng_add_tag_about" = "Tag this message with an emoji for quick search.";
|
||||
"lng_subscribe_tag_about" = "Organize your Saved Messages with tags. {link}";
|
||||
@@ -4242,6 +4397,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_sensitive_toast" = "You can update the visibility of sensitive media in **Settings > Chat Settings > Sensitive content**";
|
||||
|
||||
"lng_translate_show_original" = "Show Original";
|
||||
"lng_translate_return_original" = "View Original ({language})";
|
||||
"lng_translate_bar_to" = "Translate to {name}";
|
||||
"lng_translate_bar_to_other" = "Translate to {name}";
|
||||
"lng_translate_menu_to" = "Translate To";
|
||||
@@ -4295,6 +4451,113 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_preview_reply_to" = "Reply to {name}";
|
||||
"lng_preview_reply_to_quote" = "Reply to quote from {name}";
|
||||
|
||||
"lng_suggest_bar_title" = "Suggest a Post Below";
|
||||
"lng_suggest_bar_text" = "Click to offer a price for publishing.";
|
||||
"lng_suggest_bar_priced" = "{amount} for publishing anytime.";
|
||||
"lng_suggest_bar_dated" = "Publish on {date}";
|
||||
"lng_suggest_options_title" = "Suggest a Message";
|
||||
"lng_suggest_options_change" = "Suggest Changes";
|
||||
"lng_suggest_options_stars_offer" = "Offer Stars";
|
||||
"lng_suggest_options_stars_request" = "Request Stars";
|
||||
"lng_suggest_options_stars_price" = "Enter Price in Stars";
|
||||
"lng_suggest_options_stars_price_about" = "Choose how many Stars to pay to publish this message.";
|
||||
"lng_suggest_options_ton_offer" = "Offer TON";
|
||||
"lng_suggest_options_ton_request" = "Request TON";
|
||||
"lng_suggest_options_ton_price" = "Enter Price in TON";
|
||||
"lng_suggest_options_ton_price_about" = "Choose how many TON to pay to publish this message.";
|
||||
"lng_suggest_options_date" = "Time";
|
||||
"lng_suggest_options_date_any" = "Anytime";
|
||||
"lng_suggest_options_date_publish" = "Publish";
|
||||
"lng_suggest_options_date_now" = "Publish Now";
|
||||
"lng_suggest_options_date_about" = "Select the date and time you want the message to be published. The post will remain available for at least 24 hours from this date.";
|
||||
"lng_suggest_options_you_get_stars#one" = "You will receive {count} Star ({percent}) for publishing this post.";
|
||||
"lng_suggest_options_you_get_stars#other" = "You will receive {count} Stars ({percent}) for publishing this post.";
|
||||
"lng_suggest_options_you_get_ton#one" = "You will receive {count} TON ({percent}) for publishing this post.";
|
||||
"lng_suggest_options_you_get_ton#other" = "You will receive {count} TON ({percent}) for publishing this post.";
|
||||
"lng_suggest_options_stars_warning" = "Transactions in **Stars** may be reversed by the payment provider within **21** days. Only accept Stars from people you trust.";
|
||||
"lng_suggest_options_offer" = "Offer {amount}";
|
||||
"lng_suggest_options_offer_free" = "Offer for Free";
|
||||
"lng_suggest_options_update" = "Update Terms";
|
||||
"lng_suggest_options_update_date" = "Update Time";
|
||||
|
||||
"lng_suggest_action_decline" = "Decline";
|
||||
"lng_suggest_action_accept" = "Accept";
|
||||
"lng_suggest_action_change" = "Suggest Changes";
|
||||
"lng_suggest_action_your" = "You suggest to post this message.";
|
||||
"lng_suggest_action_his" = "{from} suggests to post this message.";
|
||||
"lng_suggest_action_price_label" = "Price";
|
||||
"lng_suggest_action_price_free" = "Free";
|
||||
"lng_suggest_action_time_label" = "Time";
|
||||
"lng_suggest_action_time_any" = "Anytime";
|
||||
"lng_suggest_action_agreement" = "Agreement reached!";
|
||||
"lng_suggest_action_agree_date" = "The post will be automatically published on {channel} {date}.";
|
||||
"lng_suggest_action_your_charged_stars#one" = "You have been charged **{count} Star**.";
|
||||
"lng_suggest_action_your_charged_stars#other" = "You have been charged **{count} Stars**.";
|
||||
"lng_suggest_action_your_charged_ton#one" = "You have been charged **{count} TON**.";
|
||||
"lng_suggest_action_your_charged_ton#other" = "You have been charged **{count} TON**.";
|
||||
"lng_suggest_action_his_charged_stars#one" = "{from} has been charged **{count} Star**.";
|
||||
"lng_suggest_action_his_charged_stars#other" = "{from} has been charged **{count} Stars**.";
|
||||
"lng_suggest_action_his_charged_ton#one" = "{from} has been charged **{count} TON**.";
|
||||
"lng_suggest_action_his_charged_ton#other" = "{from} has been charged **{count} TON**.";
|
||||
"lng_suggest_action_agree_receive_stars" = "{channel} will receive the Stars once the post has been live for 24 hours.";
|
||||
"lng_suggest_action_agree_receive_ton" = "{channel} will receive TON once the post has been live for 24 hours.";
|
||||
"lng_suggest_action_agree_removed_stars" = "If {channel} removes the post before it has been live for 24 hours, the Stars will be refunded.";
|
||||
"lng_suggest_action_agree_removed_ton" = "If {channel} removes the post before it has been live for 24 hours, TON will be refunded.";
|
||||
"lng_suggest_action_your_not_enough_stars" = "**Transaction failed** because you didn't have enough Stars.";
|
||||
"lng_suggest_action_your_not_enough_ton" = "**Transaction failed** because you didn't have enough TON.";
|
||||
"lng_suggest_action_his_not_enough_stars" = "**Transaction failed** because the user didn't have enough Stars.";
|
||||
"lng_suggest_action_his_not_enough_ton" = "**Transaction failed** because the user didn't have enough TON.";
|
||||
"lng_suggest_action_declined" = "{from} rejected the message.";
|
||||
"lng_suggest_action_declined_reason" = "{from} rejected the message with the comment.";
|
||||
"lng_suggest_change_price" = "{from} suggests a new price for the message.";
|
||||
"lng_suggest_change_time" = "{from} suggests a new time for the message.";
|
||||
"lng_suggest_change_price_time" = "{from} suggests a new price and time for the message.";
|
||||
"lng_suggest_change_content" = "{from} suggests changes for the message.";
|
||||
"lng_suggest_change_price_label" = "New Price";
|
||||
"lng_suggest_change_time_label" = "New Time";
|
||||
"lng_suggest_change_text_label" = "Check the suggested message below";
|
||||
"lng_suggest_menu_edit_message" = "Edit Message";
|
||||
"lng_suggest_menu_edit_price" = "Edit Price";
|
||||
"lng_suggest_menu_edit_time" = "Edit Time";
|
||||
"lng_suggest_decline_title" = "Decline";
|
||||
"lng_suggest_decline_text" = "Do you want to decline publishing this post from {from}?";
|
||||
"lng_suggest_decline_text_to" = "Do you want to decline publishing this post to {channel}?";
|
||||
"lng_suggest_decline_reason" = "Add a reason (optional)";
|
||||
"lng_suggest_accept_title" = "Accept Terms";
|
||||
"lng_suggest_accept_text" = "Do you want to publish this post from {from}?";
|
||||
"lng_suggest_accept_text_to" = "Do you want to publish this post to {channel}?";
|
||||
"lng_suggest_accept_receive_stars#one" = "{channel} will receive **{count} Star** ({percent}) for publishing {date}.";
|
||||
"lng_suggest_accept_receive_stars#other" = "{channel} will receive **{count} Stars** ({percent}) for publishing {date}.";
|
||||
"lng_suggest_accept_receive_ton#one" = "{channel} will receive **{count} TON** ({percent}) for publishing {date}.";
|
||||
"lng_suggest_accept_receive_ton#other" = "{channel} will receive **{count} TON** ({percent}) for publishing {date}.";
|
||||
"lng_suggest_accept_receive_now_stars#one" = "{channel} will receive **{count} Star** ({percent}) for publishing right now.";
|
||||
"lng_suggest_accept_receive_now_stars#other" = "{channel} will receive **{count} Stars** ({percent}) for publishing right now.";
|
||||
"lng_suggest_accept_receive_now_ton#one" = "{channel} will receive **{count} TON** ({percent}) for publishing right now.";
|
||||
"lng_suggest_accept_receive_now_ton#other" = "{channel} will receive **{count} TON** ({percent}) for publishing right now.";
|
||||
"lng_suggest_accept_receive_if" = "It must remain visible for at least **24** hours after publication.";
|
||||
"lng_suggest_accept_pay_stars#one" = "You will pay **{count} Star** for publishing {date}.";
|
||||
"lng_suggest_accept_pay_stars#other" = "You will pay **{count} Stars** for publishing {date}.";
|
||||
"lng_suggest_accept_pay_ton#one" = "You will pay **{count} TON** for publishing {date}.";
|
||||
"lng_suggest_accept_pay_ton#other" = "You will pay **{count} TON** for publishing {date}.";
|
||||
"lng_suggest_accept_pay_now_stars#one" = "You will pay **{count} Star** for publishing right now.";
|
||||
"lng_suggest_accept_pay_now_stars#other" = "You will pay **{count} Stars** for publishing right now.";
|
||||
"lng_suggest_accept_pay_now_ton#one" = "You will pay **{count} TON** for publishing right now.";
|
||||
"lng_suggest_accept_pay_now_ton#other" = "You will pay **{count} TON** for publishing right now.";
|
||||
"lng_suggest_accept_send" = "Publish";
|
||||
"lng_suggest_stars_amount#one" = "{count} Star";
|
||||
"lng_suggest_stars_amount#other" = "{count} Stars";
|
||||
"lng_suggest_ton_amount#one" = "{count} TON";
|
||||
"lng_suggest_ton_amount#other" = "{count} TON";
|
||||
"lng_suggest_warn_title_stars" = "Stars will be lost";
|
||||
"lng_suggest_warn_title_ton" = "TON will be lost";
|
||||
"lng_suggest_warn_text_stars" = "You won't receive **Stars** for the post if you delete it now. The post must remain visible for at least **24 hours** after it was published.";
|
||||
"lng_suggest_warn_text_ton" = "You won't receive **TON** for the post if you delete it now. The post must remain visible for at least **24 hours** after it was published.";
|
||||
"lng_suggest_warn_delete_anyway" = "Delete Anyway";
|
||||
"lng_suggest_low_ton_title" = "{amount} TON Needed";
|
||||
"lng_suggest_low_ton_text" = "You can add funds to your balance via the third-party platform Fragment.";
|
||||
"lng_suggest_low_ton_fragment" = "Add Funds via Fragment";
|
||||
"lng_suggest_low_ton_fragment_url" = "https://fragment.com/ads/topup";
|
||||
|
||||
"lng_reply_in_another_title" = "Reply in...";
|
||||
"lng_reply_in_another_chat" = "Reply in Another Chat";
|
||||
"lng_reply_in_author" = "Message author";
|
||||
@@ -4349,6 +4612,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_edit_contact_title" = "Edit contact";
|
||||
"lng_edit_channel_title" = "Edit channel";
|
||||
"lng_edit_bot_title" = "Edit bot";
|
||||
"lng_edit_autotranslate" = "Auto-translate messages";
|
||||
"lng_edit_sign_messages" = "Sign messages";
|
||||
"lng_edit_sign_messages_about" = "Add names of admins to the messages they post.";
|
||||
"lng_edit_sign_profiles" = "Show authors' profiles";
|
||||
@@ -5057,6 +5321,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_payment_bar_button" = "Remove Fee";
|
||||
"lng_payment_refund_title" = "Remove Fee";
|
||||
"lng_payment_refund_text" = "Are you sure you want to allow {name} to message you for free?";
|
||||
"lng_payment_refund_channel" = "Do you want to allow {name} to message the channel for free?";
|
||||
"lng_payment_refund_also#one" = "Refund already paid {count} Star";
|
||||
"lng_payment_refund_also#other" = "Refund already paid {count} Stars";
|
||||
"lng_payment_refund_confirm" = "Confirm";
|
||||
@@ -5086,6 +5351,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_rights_channel_edit_stories" = "Edit stories of others";
|
||||
"lng_rights_channel_delete_stories" = "Delete stories of others";
|
||||
"lng_rights_channel_manage_calls" = "Manage live streams";
|
||||
"lng_rights_channel_manage_direct" = "Manage direct messages";
|
||||
"lng_rights_group_info" = "Change group info";
|
||||
"lng_rights_group_ban" = "Ban users";
|
||||
"lng_rights_group_invite_link" = "Invite users via link";
|
||||
@@ -5178,6 +5444,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_restricted_send_polls_all" = "Sorry, sending polls is not allowed in this group.";
|
||||
|
||||
"lng_restricted_send_public_polls" = "Sorry, polls with visible votes can't be forwarded to channels.";
|
||||
"lng_restricted_send_todo_lists" = "Sorry, Checklists can't be forwarded to channels.";
|
||||
"lng_restricted_send_paid_media" = "Sorry, paid media can't be sent to this channel.";
|
||||
|
||||
"lng_restricted_send_voice_messages" = "{user} doesn't accept voice messages.";
|
||||
@@ -5192,6 +5459,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_send_non_premium_message_toast" = "**{user}** only accepts messages from contacts and {link} subscribers.";
|
||||
"lng_send_non_premium_message_toast_link" = "Telegram Premium";
|
||||
|
||||
"lng_send_charges_stars_channel" = "{channel} charges {amount} per message to its admin.";
|
||||
"lng_send_free_channel" = "Send a direct message to the administrator of {channel}.";
|
||||
"lng_send_charges_stars_text" = "{user} charges {amount} for each message.";
|
||||
"lng_send_charges_stars_go" = "Buy Stars";
|
||||
|
||||
@@ -5205,10 +5474,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_admin_log_filter_all_actions" = "All actions";
|
||||
"lng_admin_log_filter_actions_type_subtitle" = "Filter actions by type";
|
||||
"lng_admin_log_filter_actions_member_section" = "Members And Admins";
|
||||
"lng_admin_log_filter_actions_subscriber_section" = "Subscribers And Admins";
|
||||
"lng_admin_log_filter_restrictions" = "New restrictions";
|
||||
"lng_admin_log_filter_admins_new" = "Admin rights";
|
||||
"lng_admin_log_filter_members_new" = "New members";
|
||||
"lng_admin_log_filter_subscribers_new" = "New subscribers";
|
||||
"lng_admin_log_filter_actions_settings_section" = "Group Settings";
|
||||
"lng_admin_log_filter_actions_channel_settings_section" = "Channel Settings";
|
||||
"lng_admin_log_filter_info_group" = "Group info";
|
||||
"lng_admin_log_filter_info_channel" = "Channel info";
|
||||
"lng_admin_log_filter_actions_messages_section" = "Messages";
|
||||
@@ -5219,6 +5491,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_admin_log_filter_voice_chats_channel" = "Live stream";
|
||||
"lng_admin_log_filter_invite_links" = "Invite links";
|
||||
"lng_admin_log_filter_members_removed" = "Members leaving";
|
||||
"lng_admin_log_filter_subscribers_removed" = "Subscribers leaving";
|
||||
"lng_admin_log_filter_topics" = "Topics";
|
||||
"lng_admin_log_filter_sub_extend" = "Subscription Renewals";
|
||||
"lng_admin_log_filter_all_admins" = "All users and admins";
|
||||
@@ -5329,6 +5602,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_admin_log_participant_volume_channel" = "{from} changed live stream volume for {user} to {percent}";
|
||||
"lng_admin_log_antispam_enabled" = "{from} enabled aggressive anti-spam";
|
||||
"lng_admin_log_antispam_disabled" = "{from} disabled aggressive anti-spam";
|
||||
"lng_admin_log_autotranslate_enabled" = "{from} enabled automatic translation";
|
||||
"lng_admin_log_autotranslate_disabled" = "{from} disabled automatic translation";
|
||||
"lng_admin_log_change_color" = "{from} changed channel color from {previous} to {color}";
|
||||
"lng_admin_log_set_background_emoji" = "{from} set channel background emoji to {emoji}";
|
||||
"lng_admin_log_change_background_emoji" = "{from} changed channel background emoji from {previous} to {emoji}";
|
||||
@@ -5401,6 +5676,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_admin_log_admin_create_topics" = "Create topics";
|
||||
"lng_admin_log_admin_manage_calls" = "Manage video chats";
|
||||
"lng_admin_log_admin_manage_calls_channel" = "Manage live streams";
|
||||
"lng_admin_log_admin_manage_direct" = "Manage direct messages";
|
||||
"lng_admin_log_admin_add_admins" = "Add new admins";
|
||||
"lng_admin_log_subscription_extend" = "{name} renewed subscription until {date}";
|
||||
|
||||
@@ -5700,6 +5976,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_polls_stop" = "Stop poll";
|
||||
"lng_polls_stop_warning" = "If you stop this poll now, nobody will be able to vote in it anymore. This action cannot be undone.";
|
||||
"lng_polls_stop_sure" = "Stop";
|
||||
"lng_polls_menu_item" = "Poll";
|
||||
"lng_polls_create" = "Create poll";
|
||||
"lng_polls_create_title" = "New poll";
|
||||
"lng_polls_create_question" = "Question";
|
||||
@@ -5728,6 +6005,35 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_polls_show_more#other" = "Show more ({count})";
|
||||
"lng_polls_votes_collapse" = "Collapse";
|
||||
|
||||
"lng_todo_title" = "Checklist";
|
||||
"lng_todo_title_group" = "Group Checklist";
|
||||
"lng_todo_completed#one" = "{count} of {total} completed";
|
||||
"lng_todo_completed#other" = "{count} of {total} completed";
|
||||
"lng_todo_completed_none" = "None of {total} completed";
|
||||
"lng_todo_menu_item" = "Checklist";
|
||||
"lng_todo_create" = "Create Checklist";
|
||||
"lng_todo_create_title" = "New Checklist";
|
||||
"lng_todo_create_title_placeholder" = "Title";
|
||||
"lng_todo_create_list" = "Tasks List";
|
||||
"lng_todo_create_list_add" = "Add a task...";
|
||||
"lng_todo_create_limit#one" = "You can add {count} more task.";
|
||||
"lng_todo_create_limit#other" = "You can add {count} more tasks.";
|
||||
"lng_todo_create_maximum" = "You have added the maximum number of tasks.";
|
||||
"lng_todo_create_settings" = "Settings";
|
||||
"lng_todo_create_allow_add" = "Allow Others to Add Tasks";
|
||||
"lng_todo_create_allow_mark" = "Allow Others to Mark As Done";
|
||||
"lng_todo_create_button" = "Create";
|
||||
"lng_todo_choose_title" = "Please enter a title.";
|
||||
"lng_todo_choose_tasks" = "Please enter at least one task.";
|
||||
|
||||
"lng_todo_add_title" = "Add Tasks";
|
||||
"lng_todo_create_premium" = "Only subscribers of {link} can create Checklists.";
|
||||
"lng_todo_add_premium" = "Only subscribers of {link} can add tasks.";
|
||||
"lng_todo_mark_premium" = "Only subscribers of {link} can mark tasks as done.";
|
||||
"lng_todo_premium_link" = "Telegram Premium";
|
||||
"lng_todo_mark_restricted" = "{user} has restricted others from marking tasks as done.";
|
||||
"lng_todo_mark_forwarded" = "You can't change forwarded checklists.";
|
||||
|
||||
"lng_outdated_title" = "PLEASE UPDATE YOUR OPERATING SYSTEM.";
|
||||
"lng_outdated_title_bits" = "PLEASE SWITCH TO A 64-BIT OPERATING SYSTEM.";
|
||||
"lng_outdated_soon" = "Otherwise, Telegram Desktop will stop updating on {date}.";
|
||||
@@ -5992,6 +6298,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_forum_messages#other" = "{count} messages";
|
||||
"lng_forum_show_topics_list" = "Show Topics List";
|
||||
|
||||
"lng_monoforum_choose_to_reply" = "Choose a message to reply.";
|
||||
|
||||
"lng_request_peer_requirements" = "Requirements";
|
||||
"lng_request_peer_rights" = "You must have these admin rights: {rights}.";
|
||||
"lng_request_peer_rights_and" = "{rights} and {last}";
|
||||
@@ -6038,6 +6346,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_request_channel_delete_messages" = "delete messages";
|
||||
"lng_request_channel_add_subscribers" = "add subscribers";
|
||||
"lng_request_channel_manage_livestreams" = "manage live streams";
|
||||
"lng_request_channel_manage_direct" = "manage direct messages";
|
||||
"lng_request_channel_add_admins" = "add new admins";
|
||||
"lng_request_channel_create" = "Create a New Channel for This";
|
||||
|
||||
@@ -6315,7 +6624,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_bot_earn_balance_button_locked" = "Withdraw";
|
||||
"lng_bot_earn_balance_button_buy_ads" = "Buy Ads";
|
||||
"lng_bot_earn_learn_credits_out_about" = "You can withdraw Stars using Fragment, or use Stars to advertise your bot. {link}";
|
||||
"lng_self_earn_learn_credits_out_about" = "You can withdraw from 10 Stars using Fragment. {link}";
|
||||
"lng_bot_earn_out_ph" = "Enter amount to withdraw";
|
||||
"lng_bot_earn_out_ph_max" = "Enter amount to withdraw (max. {amount})";
|
||||
"lng_bot_earn_balance_password_title" = "Two-step verification";
|
||||
"lng_bot_earn_balance_password_description" = "Please enter your password to collect.";
|
||||
"lng_bot_earn_credits_out_minimal" = "You cannot withdraw less than {link}.";
|
||||
@@ -6440,6 +6751,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_frozen_text3" = "Appeal via {link} before {date}, or your account will be deleted.";
|
||||
"lng_frozen_appeal_button" = "Submit an Appeal";
|
||||
|
||||
"lng_context_bank_card_copy" = "Copy Card Number";
|
||||
"lng_context_bank_card_copied" = "Card number copied to clipboard.";
|
||||
|
||||
// Wnd specific
|
||||
|
||||
"lng_wnd_choose_program_menu" = "Choose Default Program...";
|
||||
@@ -6494,6 +6808,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_mac_menu_new_channel" = "New Channel";
|
||||
"lng_mac_menu_show" = "Show Telegram";
|
||||
"lng_mac_menu_emoji_and_symbols" = "Emoji & Symbols";
|
||||
"lng_mac_menu_fullscreen" = "Toggle Full Screen";
|
||||
|
||||
"lng_mac_menu_player_pause" = "Pause";
|
||||
"lng_mac_menu_player_resume" = "Resume";
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<RCC>
|
||||
<qresource prefix="/animations">
|
||||
<file alias="blocked_peers_empty.tgs">../../animations/blocked_peers_empty.tgs</file>
|
||||
<file alias="change_number.tgs">../../animations/change_number.tgs</file>
|
||||
<file alias="filters.tgs">../../animations/filters.tgs</file>
|
||||
<file alias="cloud_filters.tgs">../../animations/cloud_filters.tgs</file>
|
||||
<file alias="local_passcode_enter.tgs">../../animations/local_passcode_enter.tgs</file>
|
||||
@@ -8,6 +9,7 @@
|
||||
<file alias="cloud_password/password_input.tgs">../../animations/cloud_password/password_input.tgs</file>
|
||||
<file alias="cloud_password/hint.tgs">../../animations/cloud_password/hint.tgs</file>
|
||||
<file alias="cloud_password/email.tgs">../../animations/cloud_password/email.tgs</file>
|
||||
<file alias="cloud_password/validate.tgs">../../animations/cloud_password/validate.tgs</file>
|
||||
<file alias="ttl.tgs">../../animations/ttl.tgs</file>
|
||||
<file alias="discussion.tgs">../../animations/discussion.tgs</file>
|
||||
<file alias="stats.tgs">../../animations/stats.tgs</file>
|
||||
@@ -24,6 +26,7 @@
|
||||
<file alias="hours.tgs">../../animations/hours.tgs</file>
|
||||
<file alias="phone.tgs">../../animations/phone.tgs</file>
|
||||
<file alias="chat_link.tgs">../../animations/chat_link.tgs</file>
|
||||
<file alias="diamond.tgs">../../animations/diamond.tgs</file>
|
||||
<file alias="collectible_username.tgs">../../animations/collectible_username.tgs</file>
|
||||
<file alias="collectible_phone.tgs">../../animations/collectible_phone.tgs</file>
|
||||
<file alias="search.tgs">../../animations/search.tgs</file>
|
||||
@@ -31,6 +34,10 @@
|
||||
<file alias="hello_status.tgs">../../animations/hello_status.tgs</file>
|
||||
<file alias="starref_link.tgs">../../animations/starref_link.tgs</file>
|
||||
<file alias="media_forbidden.tgs">../../animations/media_forbidden.tgs</file>
|
||||
<file alias="topics.tgs">../../animations/edit_peers/topics.tgs</file>
|
||||
<file alias="topics_tabs.tgs">../../animations/edit_peers/topics_tabs.tgs</file>
|
||||
<file alias="topics_list.tgs">../../animations/edit_peers/topics_list.tgs</file>
|
||||
<file alias="direct_messages.tgs">../../animations/edit_peers/direct_messages.tgs</file>
|
||||
|
||||
<file alias="dice_idle.tgs">../../animations/dice/dice_idle.tgs</file>
|
||||
<file alias="dart_idle.tgs">../../animations/dice/dart_idle.tgs</file>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<Identity Name="TelegramMessengerLLP.TelegramDesktop"
|
||||
ProcessorArchitecture="ARCHITECTURE"
|
||||
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
|
||||
Version="5.14.0.0" />
|
||||
Version="5.16.3.0" />
|
||||
<Properties>
|
||||
<DisplayName>Telegram Desktop</DisplayName>
|
||||
<PublisherDisplayName>Telegram Messenger LLP</PublisherDisplayName>
|
||||
|
||||
@@ -44,8 +44,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 5,14,0,0
|
||||
PRODUCTVERSION 5,14,0,0
|
||||
FILEVERSION 5,16,3,0
|
||||
PRODUCTVERSION 5,16,3,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -62,10 +62,10 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Telegram FZ-LLC"
|
||||
VALUE "FileDescription", "Telegram Desktop"
|
||||
VALUE "FileVersion", "5.14.0.0"
|
||||
VALUE "FileVersion", "5.16.3.0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2014-2025"
|
||||
VALUE "ProductName", "Telegram Desktop"
|
||||
VALUE "ProductVersion", "5.14.0.0"
|
||||
VALUE "ProductVersion", "5.16.3.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -35,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 5,14,0,0
|
||||
PRODUCTVERSION 5,14,0,0
|
||||
FILEVERSION 5,16,3,0
|
||||
PRODUCTVERSION 5,16,3,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -53,10 +53,10 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Telegram FZ-LLC"
|
||||
VALUE "FileDescription", "Telegram Desktop Updater"
|
||||
VALUE "FileVersion", "5.14.0.0"
|
||||
VALUE "FileVersion", "5.16.3.0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2014-2025"
|
||||
VALUE "ProductName", "Telegram Desktop"
|
||||
VALUE "ProductVersion", "5.14.0.0"
|
||||
VALUE "ProductVersion", "5.16.3.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -283,7 +283,7 @@ int main(int argc, char *argv[])
|
||||
cout << "Compression start, size: " << resultSize << "\n";
|
||||
|
||||
QByteArray compressed, resultCheck;
|
||||
#if defined Q_OS_WIN && !defined TDESKTOP_USE_PACKAGED // use Lzma SDK for win
|
||||
#if defined Q_OS_WIN && !defined PACKER_USE_PACKAGED // use Lzma SDK for win
|
||||
const int32 hSigLen = 128, hShaLen = 20, hPropsLen = LZMA_PROPS_SIZE, hOriginalSizeLen = sizeof(int32), hSize = hSigLen + hShaLen + hPropsLen + hOriginalSizeLen; // header
|
||||
|
||||
compressed.resize(hSize + resultSize + 1024 * 1024); // rsa signature + sha1 + lzma props + max compressed size
|
||||
|
||||
@@ -27,7 +27,7 @@ extern "C" {
|
||||
#include <openssl/evp.h>
|
||||
} // extern "C"
|
||||
|
||||
#if defined Q_OS_WIN && !defined TDESKTOP_USE_PACKAGED // use Lzma SDK for win
|
||||
#if defined Q_OS_WIN && !defined PACKER_USE_PACKAGED // use Lzma SDK for win
|
||||
#include <LzmaLib.h>
|
||||
#else
|
||||
#include <lzma.h>
|
||||
|
||||
@@ -5,6 +5,7 @@ the official desktop application for the Telegram messaging service.
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#define _GLIBCXX_USE_CXX11_ABI 0
|
||||
#include <cstdio>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
@@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "apiwrap.h"
|
||||
#include "api/api_cloud_password.h"
|
||||
#include "api/api_send_progress.h"
|
||||
#include "api/api_suggest_post.h"
|
||||
#include "boxes/share_box.h"
|
||||
#include "boxes/passcode_box.h"
|
||||
#include "boxes/url_auth_box.h"
|
||||
@@ -399,10 +400,12 @@ void ActivateBotCommand(ClickHandlerContext context, int row, int column) {
|
||||
}
|
||||
}
|
||||
const auto replyTo = FullReplyTo();
|
||||
const auto suggest = SuggestPostOptions();
|
||||
Window::PeerMenuCreatePoll(
|
||||
controller,
|
||||
item->history()->peer,
|
||||
replyTo,
|
||||
suggest,
|
||||
chosen,
|
||||
disabled);
|
||||
} break;
|
||||
@@ -519,6 +522,27 @@ void ActivateBotCommand(ClickHandlerContext context, int row, int column) {
|
||||
controller->showToast(tr::lng_text_copied(tr::now));
|
||||
}
|
||||
} break;
|
||||
|
||||
case ButtonType::SuggestAccept: {
|
||||
Api::AcceptClickHandler(item)->onClick(ClickContext{
|
||||
Qt::LeftButton,
|
||||
QVariant::fromValue(context),
|
||||
});
|
||||
} break;
|
||||
|
||||
case ButtonType::SuggestDecline: {
|
||||
Api::DeclineClickHandler(item)->onClick(ClickContext{
|
||||
Qt::LeftButton,
|
||||
QVariant::fromValue(context),
|
||||
});
|
||||
} break;
|
||||
|
||||
case ButtonType::SuggestChange: {
|
||||
Api::SuggestChangesClickHandler(item)->onClick(ClickContext{
|
||||
Qt::LeftButton,
|
||||
QVariant::fromValue(context),
|
||||
});
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -256,6 +256,7 @@ void ConfirmSubscriptionBox(
|
||||
{
|
||||
const auto balance = Settings::AddBalanceWidget(
|
||||
content,
|
||||
session,
|
||||
session->credits().balanceValue(),
|
||||
true);
|
||||
session->credits().load(true);
|
||||
@@ -436,6 +437,12 @@ void CheckChatInvite(
|
||||
}
|
||||
});
|
||||
}, [=](const MTP::Error &error) {
|
||||
if (MTP::IsFloodError(error)) {
|
||||
if (const auto strong = weak.get()) {
|
||||
strong->show(Ui::MakeInformBox(tr::lng_flood_error()));
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (error.code() != 400) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ class ChannelData;
|
||||
|
||||
namespace Info::Profile {
|
||||
class Badge;
|
||||
enum class BadgeType;
|
||||
enum class BadgeType : uchar;
|
||||
} // namespace Info::Profile
|
||||
|
||||
namespace Main {
|
||||
|
||||
@@ -494,8 +494,15 @@ void ChatParticipants::requestBots(not_null<ChannelData*> channel) {
|
||||
LOG(("API Error: "
|
||||
"channels.channelParticipantsNotModified received!"));
|
||||
});
|
||||
}).fail([=] {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_botsRequests.remove(channel);
|
||||
if (error.type() == u"CHANNEL_MONOFORUM_UNSUPPORTED"_q) {
|
||||
channel->mgInfo->bots.clear();
|
||||
channel->mgInfo->botStatus = -1;
|
||||
channel->session().changes().peerUpdated(
|
||||
channel,
|
||||
Data::PeerUpdate::Flag::FullInfo);
|
||||
}
|
||||
}).send();
|
||||
|
||||
_botsRequests[channel] = requestId;
|
||||
@@ -648,10 +655,7 @@ void ChatParticipants::Restrict(
|
||||
channel->session().api().request(MTPchannels_EditBanned(
|
||||
channel->inputChannel,
|
||||
participant->input,
|
||||
MTP_chatBannedRights(
|
||||
MTP_flags(MTPDchatBannedRights::Flags::from_raw(
|
||||
uint32(newRights.flags))),
|
||||
MTP_int(newRights.until))
|
||||
RestrictionsToMTP(newRights)
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
channel->session().api().applyUpdates(result);
|
||||
channel->applyEditBanned(participant, oldRights, newRights);
|
||||
@@ -756,10 +760,7 @@ void ChatParticipants::kick(
|
||||
const auto requestId = _api.request(MTPchannels_EditBanned(
|
||||
channel->inputChannel,
|
||||
participant->input,
|
||||
MTP_chatBannedRights(
|
||||
MTP_flags(
|
||||
MTPDchatBannedRights::Flags::from_raw(uint32(rights.flags))),
|
||||
MTP_int(rights.until))
|
||||
RestrictionsToMTP(rights)
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
channel->session().api().applyUpdates(result);
|
||||
|
||||
|
||||
@@ -14,6 +14,17 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
namespace Api {
|
||||
|
||||
MTPSuggestedPost SuggestToMTP(SuggestPostOptions suggest) {
|
||||
using Flag = MTPDsuggestedPost::Flag;
|
||||
return suggest.exists
|
||||
? MTP_suggestedPost(
|
||||
MTP_flags((suggest.date ? Flag::f_schedule_date : Flag())
|
||||
| (suggest.price().empty() ? Flag() : Flag::f_price)),
|
||||
StarsAmountToTL(suggest.price()),
|
||||
MTP_int(suggest.date))
|
||||
: MTPSuggestedPost();
|
||||
}
|
||||
|
||||
SendAction::SendAction(
|
||||
not_null<Data::Thread*> thread,
|
||||
SendOptions options)
|
||||
|
||||
@@ -19,6 +19,8 @@ namespace Api {
|
||||
|
||||
inline constexpr auto kScheduledUntilOnlineTimestamp = TimeId(0x7FFFFFFE);
|
||||
|
||||
[[nodiscard]] MTPSuggestedPost SuggestToMTP(SuggestPostOptions suggest);
|
||||
|
||||
struct SendOptions {
|
||||
uint64 price = 0;
|
||||
PeerData *sendAs = nullptr;
|
||||
@@ -31,6 +33,7 @@ struct SendOptions {
|
||||
bool invertCaption = false;
|
||||
bool hideViaBot = false;
|
||||
crl::time ttlSeconds = 0;
|
||||
SuggestPostOptions suggest;
|
||||
|
||||
friend inline bool operator==(
|
||||
const SendOptions &,
|
||||
|
||||
@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "api/api_credits.h"
|
||||
|
||||
#include "api/api_credits_history_entry.h"
|
||||
#include "api/api_premium.h"
|
||||
#include "api/api_statistics_data_deserialize.h"
|
||||
#include "api/api_updates.h"
|
||||
@@ -27,145 +28,6 @@ namespace {
|
||||
|
||||
constexpr auto kTransactionsLimit = 100;
|
||||
|
||||
[[nodiscard]] Data::CreditsHistoryEntry HistoryFromTL(
|
||||
const MTPStarsTransaction &tl,
|
||||
not_null<PeerData*> peer) {
|
||||
using HistoryPeerTL = MTPDstarsTransactionPeer;
|
||||
using namespace Data;
|
||||
const auto owner = &peer->owner();
|
||||
const auto photo = tl.data().vphoto()
|
||||
? owner->photoFromWeb(*tl.data().vphoto(), ImageLocation())
|
||||
: nullptr;
|
||||
auto extended = std::vector<CreditsHistoryMedia>();
|
||||
if (const auto list = tl.data().vextended_media()) {
|
||||
extended.reserve(list->v.size());
|
||||
for (const auto &media : list->v) {
|
||||
media.match([&](const MTPDmessageMediaPhoto &data) {
|
||||
if (const auto inner = data.vphoto()) {
|
||||
const auto photo = owner->processPhoto(*inner);
|
||||
if (!photo->isNull()) {
|
||||
extended.push_back(CreditsHistoryMedia{
|
||||
.type = CreditsHistoryMediaType::Photo,
|
||||
.id = photo->id,
|
||||
});
|
||||
}
|
||||
}
|
||||
}, [&](const MTPDmessageMediaDocument &data) {
|
||||
if (const auto inner = data.vdocument()) {
|
||||
const auto document = owner->processDocument(
|
||||
*inner,
|
||||
data.valt_documents());
|
||||
if (document->isAnimation()
|
||||
|| document->isVideoFile()
|
||||
|| document->isGifv()) {
|
||||
extended.push_back(CreditsHistoryMedia{
|
||||
.type = CreditsHistoryMediaType::Video,
|
||||
.id = document->id,
|
||||
});
|
||||
}
|
||||
}
|
||||
}, [&](const auto &) {});
|
||||
}
|
||||
}
|
||||
const auto barePeerId = tl.data().vpeer().match([](
|
||||
const HistoryPeerTL &p) {
|
||||
return peerFromMTP(p.vpeer());
|
||||
}, [](const auto &) {
|
||||
return PeerId(0);
|
||||
}).value;
|
||||
const auto stargift = tl.data().vstargift();
|
||||
const auto nonUniqueGift = stargift
|
||||
? stargift->match([&](const MTPDstarGift &data) {
|
||||
return &data;
|
||||
}, [](const auto &) { return (const MTPDstarGift*)nullptr; })
|
||||
: nullptr;
|
||||
const auto reaction = tl.data().is_reaction();
|
||||
const auto amount = Data::FromTL(tl.data().vstars());
|
||||
const auto starrefAmount = tl.data().vstarref_amount()
|
||||
? Data::FromTL(*tl.data().vstarref_amount())
|
||||
: StarsAmount();
|
||||
const auto starrefCommission
|
||||
= tl.data().vstarref_commission_permille().value_or_empty();
|
||||
const auto starrefBarePeerId = tl.data().vstarref_peer()
|
||||
? peerFromMTP(*tl.data().vstarref_peer()).value
|
||||
: 0;
|
||||
const auto incoming = (amount >= StarsAmount());
|
||||
const auto paidMessagesCount
|
||||
= tl.data().vpaid_messages().value_or_empty();
|
||||
const auto premiumMonthsForStars
|
||||
= tl.data().vpremium_gift_months().value_or_empty();
|
||||
const auto saveActorId = (reaction
|
||||
|| !extended.empty()
|
||||
|| paidMessagesCount) && incoming;
|
||||
const auto parsedGift = stargift
|
||||
? FromTL(&peer->session(), *stargift)
|
||||
: std::optional<Data::StarGift>();
|
||||
const auto giftStickerId = parsedGift ? parsedGift->document->id : 0;
|
||||
return Data::CreditsHistoryEntry{
|
||||
.id = qs(tl.data().vid()),
|
||||
.title = qs(tl.data().vtitle().value_or_empty()),
|
||||
.description = { qs(tl.data().vdescription().value_or_empty()) },
|
||||
.date = base::unixtime::parse(tl.data().vdate().v),
|
||||
.photoId = photo ? photo->id : 0,
|
||||
.extended = std::move(extended),
|
||||
.credits = Data::FromTL(tl.data().vstars()),
|
||||
.bareMsgId = uint64(tl.data().vmsg_id().value_or_empty()),
|
||||
.barePeerId = saveActorId ? peer->id.value : barePeerId,
|
||||
.bareGiveawayMsgId = uint64(
|
||||
tl.data().vgiveaway_post_id().value_or_empty()),
|
||||
.bareGiftStickerId = giftStickerId,
|
||||
.bareActorId = saveActorId ? barePeerId : uint64(0),
|
||||
.uniqueGift = parsedGift ? parsedGift->unique : nullptr,
|
||||
.starrefAmount = paidMessagesCount ? StarsAmount() : starrefAmount,
|
||||
.starrefCommission = paidMessagesCount ? 0 : starrefCommission,
|
||||
.starrefRecipientId = paidMessagesCount ? 0 : starrefBarePeerId,
|
||||
.peerType = tl.data().vpeer().match([](const HistoryPeerTL &) {
|
||||
return Data::CreditsHistoryEntry::PeerType::Peer;
|
||||
}, [](const MTPDstarsTransactionPeerPlayMarket &) {
|
||||
return Data::CreditsHistoryEntry::PeerType::PlayMarket;
|
||||
}, [](const MTPDstarsTransactionPeerFragment &) {
|
||||
return Data::CreditsHistoryEntry::PeerType::Fragment;
|
||||
}, [](const MTPDstarsTransactionPeerAppStore &) {
|
||||
return Data::CreditsHistoryEntry::PeerType::AppStore;
|
||||
}, [](const MTPDstarsTransactionPeerUnsupported &) {
|
||||
return Data::CreditsHistoryEntry::PeerType::Unsupported;
|
||||
}, [](const MTPDstarsTransactionPeerPremiumBot &) {
|
||||
return Data::CreditsHistoryEntry::PeerType::PremiumBot;
|
||||
}, [](const MTPDstarsTransactionPeerAds &) {
|
||||
return Data::CreditsHistoryEntry::PeerType::Ads;
|
||||
}, [](const MTPDstarsTransactionPeerAPI &) {
|
||||
return Data::CreditsHistoryEntry::PeerType::API;
|
||||
}),
|
||||
.subscriptionUntil = tl.data().vsubscription_period()
|
||||
? base::unixtime::parse(base::unixtime::now()
|
||||
+ tl.data().vsubscription_period()->v)
|
||||
: QDateTime(),
|
||||
.successDate = tl.data().vtransaction_date()
|
||||
? base::unixtime::parse(tl.data().vtransaction_date()->v)
|
||||
: QDateTime(),
|
||||
.successLink = qs(tl.data().vtransaction_url().value_or_empty()),
|
||||
.paidMessagesCount = paidMessagesCount,
|
||||
.paidMessagesAmount = (paidMessagesCount
|
||||
? starrefAmount
|
||||
: StarsAmount()),
|
||||
.paidMessagesCommission = paidMessagesCount ? starrefCommission : 0,
|
||||
.starsConverted = int(nonUniqueGift
|
||||
? nonUniqueGift->vconvert_stars().v
|
||||
: 0),
|
||||
.premiumMonthsForStars = premiumMonthsForStars,
|
||||
.floodSkip = int(tl.data().vfloodskip_number().value_or(0)),
|
||||
.converted = stargift && incoming,
|
||||
.stargift = stargift.has_value(),
|
||||
.giftUpgraded = tl.data().is_stargift_upgrade(),
|
||||
.reaction = tl.data().is_reaction(),
|
||||
.refunded = tl.data().is_refund(),
|
||||
.pending = tl.data().is_pending(),
|
||||
.failed = tl.data().is_failed(),
|
||||
.in = incoming,
|
||||
.gift = tl.data().is_gift() || stargift.has_value(),
|
||||
};
|
||||
}
|
||||
|
||||
[[nodiscard]] Data::SubscriptionEntry SubscriptionFromTL(
|
||||
const MTPStarsSubscription &tl,
|
||||
not_null<PeerData*> peer) {
|
||||
@@ -202,7 +64,7 @@ constexpr auto kTransactionsLimit = 100;
|
||||
if (const auto history = data.vhistory()) {
|
||||
entries.reserve(history->v.size());
|
||||
for (const auto &tl : history->v) {
|
||||
entries.push_back(HistoryFromTL(tl, peer));
|
||||
entries.push_back(CreditsHistoryEntryFromTL(tl, peer));
|
||||
}
|
||||
}
|
||||
auto subscriptions = std::vector<Data::SubscriptionEntry>();
|
||||
@@ -215,7 +77,7 @@ constexpr auto kTransactionsLimit = 100;
|
||||
return Data::CreditsStatusSlice{
|
||||
.list = std::move(entries),
|
||||
.subscriptions = std::move(subscriptions),
|
||||
.balance = Data::FromTL(status.data().vbalance()),
|
||||
.balance = CreditsAmountFromTL(status.data().vbalance()),
|
||||
.subscriptionsMissingBalance
|
||||
= status.data().vsubscriptions_missing_balance().value_or_empty(),
|
||||
.allLoaded = !status.data().vnext_offset().has_value()
|
||||
@@ -299,11 +161,14 @@ void CreditsStatus::request(
|
||||
using TLResult = MTPpayments_StarsStatus;
|
||||
|
||||
_requestId = _api.request(MTPpayments_GetStarsStatus(
|
||||
MTP_flags(0),
|
||||
_peer->isSelf() ? MTP_inputPeerSelf() : _peer->input
|
||||
)).done([=](const TLResult &result) {
|
||||
_requestId = 0;
|
||||
const auto &balance = result.data().vbalance();
|
||||
_peer->session().credits().apply(_peer->id, Data::FromTL(balance));
|
||||
_peer->session().credits().apply(
|
||||
_peer->id,
|
||||
CreditsAmountFromTL(balance));
|
||||
if (const auto onstack = done) {
|
||||
onstack(StatusFromTL(result, _peer));
|
||||
}
|
||||
@@ -315,13 +180,18 @@ void CreditsStatus::request(
|
||||
}).send();
|
||||
}
|
||||
|
||||
CreditsHistory::CreditsHistory(not_null<PeerData*> peer, bool in, bool out)
|
||||
CreditsHistory::CreditsHistory(
|
||||
not_null<PeerData*> peer,
|
||||
bool in,
|
||||
bool out,
|
||||
bool currency)
|
||||
: _peer(peer)
|
||||
, _flags((in == out)
|
||||
, _flags(((in == out)
|
||||
? HistoryTL::Flags(0)
|
||||
: HistoryTL::Flags(0)
|
||||
| (in ? HistoryTL::Flag::f_inbound : HistoryTL::Flags(0))
|
||||
| (out ? HistoryTL::Flag::f_outbound : HistoryTL::Flags(0)))
|
||||
| (currency ? HistoryTL::Flag::f_ton : HistoryTL::Flags(0)))
|
||||
, _api(&peer->session().api().instance()) {
|
||||
}
|
||||
|
||||
@@ -413,19 +283,21 @@ rpl::producer<rpl::no_value, QString> CreditsEarnStatistics::request() {
|
||||
auto lifetime = rpl::lifetime();
|
||||
|
||||
const auto finish = [=](const QString &url) {
|
||||
makeRequest(MTPpayments_GetStarsRevenueStats(
|
||||
api().request(MTPpayments_GetStarsRevenueStats(
|
||||
MTP_flags(0),
|
||||
(_isUser ? user()->input : channel()->input)
|
||||
)).done([=](const MTPpayments_StarsRevenueStats &result) {
|
||||
const auto &data = result.data();
|
||||
const auto &status = data.vstatus().data();
|
||||
using Data::FromTL;
|
||||
_data = Data::CreditsEarnStatistics{
|
||||
.revenueGraph = StatisticalGraphFromTL(
|
||||
data.vrevenue_graph()),
|
||||
.currentBalance = FromTL(status.vcurrent_balance()),
|
||||
.availableBalance = FromTL(status.vavailable_balance()),
|
||||
.overallRevenue = FromTL(status.voverall_revenue()),
|
||||
.currentBalance = CreditsAmountFromTL(
|
||||
status.vcurrent_balance()),
|
||||
.availableBalance = CreditsAmountFromTL(
|
||||
status.vavailable_balance()),
|
||||
.overallRevenue = CreditsAmountFromTL(
|
||||
status.voverall_revenue()),
|
||||
.usdRate = data.vusd_rate().v,
|
||||
.isWithdrawalEnabled = status.is_withdrawal_enabled(),
|
||||
.nextWithdrawalAt = status.vnext_withdrawal_at()
|
||||
@@ -441,7 +313,7 @@ rpl::producer<rpl::no_value, QString> CreditsEarnStatistics::request() {
|
||||
}).send();
|
||||
};
|
||||
|
||||
makeRequest(
|
||||
api().request(
|
||||
MTPpayments_GetStarsRevenueAdsAccountUrl(
|
||||
(_isUser ? user()->input : channel()->input))
|
||||
).done([=](const MTPpayments_StarsRevenueAdsAccountUrl &result) {
|
||||
@@ -528,8 +400,12 @@ void EditCreditsSubscription(
|
||||
)).done(done).fail([=](const MTP::Error &e) { fail(e.type()); }).send();
|
||||
}
|
||||
|
||||
MTPInputSavedStarGift InputSavedStarGiftId(const Data::SavedStarGiftId &id) {
|
||||
return id.isUser()
|
||||
MTPInputSavedStarGift InputSavedStarGiftId(
|
||||
const Data::SavedStarGiftId &id,
|
||||
const std::shared_ptr<Data::UniqueGift> &unique) {
|
||||
return (!id && unique)
|
||||
? MTP_inputSavedStarGiftSlug(MTP_string(unique->slug))
|
||||
: id.isUser()
|
||||
? MTP_inputSavedStarGiftUser(MTP_int(id.userMessageId().bare))
|
||||
: MTP_inputSavedStarGiftChat(
|
||||
id.chat()->input,
|
||||
|
||||
@@ -75,7 +75,11 @@ private:
|
||||
|
||||
class CreditsHistory final {
|
||||
public:
|
||||
CreditsHistory(not_null<PeerData*> peer, bool in, bool out);
|
||||
CreditsHistory(
|
||||
not_null<PeerData*> peer,
|
||||
bool in,
|
||||
bool out,
|
||||
bool currency = false);
|
||||
|
||||
void request(
|
||||
const Data::CreditsStatusSlice::OffsetToken &token,
|
||||
@@ -122,6 +126,7 @@ void EditCreditsSubscription(
|
||||
Fn<void(QString)> fail);
|
||||
|
||||
[[nodiscard]] MTPInputSavedStarGift InputSavedStarGiftId(
|
||||
const Data::SavedStarGiftId &id);
|
||||
const Data::SavedStarGiftId &id,
|
||||
const std::shared_ptr<Data::UniqueGift> &unique = nullptr);
|
||||
|
||||
} // namespace Api
|
||||
|
||||
167
Telegram/SourceFiles/api/api_credits_history_entry.cpp
Normal file
@@ -0,0 +1,167 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "api/api_credits_history_entry.h"
|
||||
|
||||
#include "api/api_premium.h"
|
||||
#include "base/unixtime.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_credits.h"
|
||||
#include "data/data_document.h"
|
||||
#include "data/data_peer.h"
|
||||
#include "data/data_photo.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_user.h"
|
||||
#include "main/main_session.h"
|
||||
|
||||
namespace Api {
|
||||
|
||||
Data::CreditsHistoryEntry CreditsHistoryEntryFromTL(
|
||||
const MTPStarsTransaction &tl,
|
||||
not_null<PeerData*> peer) {
|
||||
using HistoryPeerTL = MTPDstarsTransactionPeer;
|
||||
using namespace Data;
|
||||
const auto owner = &peer->owner();
|
||||
const auto photo = tl.data().vphoto()
|
||||
? owner->photoFromWeb(*tl.data().vphoto(), ImageLocation())
|
||||
: nullptr;
|
||||
auto extended = std::vector<CreditsHistoryMedia>();
|
||||
if (const auto list = tl.data().vextended_media()) {
|
||||
extended.reserve(list->v.size());
|
||||
for (const auto &media : list->v) {
|
||||
media.match([&](const MTPDmessageMediaPhoto &data) {
|
||||
if (const auto inner = data.vphoto()) {
|
||||
const auto photo = owner->processPhoto(*inner);
|
||||
if (!photo->isNull()) {
|
||||
extended.push_back(CreditsHistoryMedia{
|
||||
.type = CreditsHistoryMediaType::Photo,
|
||||
.id = photo->id,
|
||||
});
|
||||
}
|
||||
}
|
||||
}, [&](const MTPDmessageMediaDocument &data) {
|
||||
if (const auto inner = data.vdocument()) {
|
||||
const auto document = owner->processDocument(
|
||||
*inner,
|
||||
data.valt_documents());
|
||||
if (document->isAnimation()
|
||||
|| document->isVideoFile()
|
||||
|| document->isGifv()) {
|
||||
extended.push_back(CreditsHistoryMedia{
|
||||
.type = CreditsHistoryMediaType::Video,
|
||||
.id = document->id,
|
||||
});
|
||||
}
|
||||
}
|
||||
}, [&](const auto &) {});
|
||||
}
|
||||
}
|
||||
const auto barePeerId = tl.data().vpeer().match([](
|
||||
const HistoryPeerTL &p) {
|
||||
return peerFromMTP(p.vpeer());
|
||||
}, [](const auto &) {
|
||||
return PeerId(0);
|
||||
}).value;
|
||||
const auto stargift = tl.data().vstargift();
|
||||
const auto nonUniqueGift = stargift
|
||||
? stargift->match([&](const MTPDstarGift &data) {
|
||||
return &data;
|
||||
}, [](const auto &) { return (const MTPDstarGift*)nullptr; })
|
||||
: nullptr;
|
||||
const auto reaction = tl.data().is_reaction();
|
||||
const auto amount = CreditsAmountFromTL(tl.data().vamount());
|
||||
const auto starrefAmount = CreditsAmountFromTL(
|
||||
tl.data().vstarref_amount());
|
||||
const auto starrefCommission
|
||||
= tl.data().vstarref_commission_permille().value_or_empty();
|
||||
const auto starrefBarePeerId = tl.data().vstarref_peer()
|
||||
? peerFromMTP(*tl.data().vstarref_peer()).value
|
||||
: 0;
|
||||
const auto incoming = (amount >= CreditsAmount());
|
||||
const auto paidMessagesCount
|
||||
= tl.data().vpaid_messages().value_or_empty();
|
||||
const auto premiumMonthsForStars
|
||||
= tl.data().vpremium_gift_months().value_or_empty();
|
||||
const auto saveActorId = (reaction
|
||||
|| !extended.empty()
|
||||
|| paidMessagesCount) && incoming;
|
||||
const auto parsedGift = stargift
|
||||
? FromTL(&peer->session(), *stargift)
|
||||
: std::optional<Data::StarGift>();
|
||||
const auto giftStickerId = parsedGift ? parsedGift->document->id : 0;
|
||||
return Data::CreditsHistoryEntry{
|
||||
.id = qs(tl.data().vid()),
|
||||
.title = qs(tl.data().vtitle().value_or_empty()),
|
||||
.description = { qs(tl.data().vdescription().value_or_empty()) },
|
||||
.date = base::unixtime::parse(
|
||||
tl.data().vads_proceeds_from_date().value_or(
|
||||
tl.data().vdate().v)),
|
||||
.photoId = photo ? photo->id : 0,
|
||||
.extended = std::move(extended),
|
||||
.credits = CreditsAmountFromTL(tl.data().vamount()),
|
||||
.bareMsgId = uint64(tl.data().vmsg_id().value_or_empty()),
|
||||
.barePeerId = saveActorId ? peer->id.value : barePeerId,
|
||||
.bareGiveawayMsgId = uint64(
|
||||
tl.data().vgiveaway_post_id().value_or_empty()),
|
||||
.bareGiftStickerId = giftStickerId,
|
||||
.bareActorId = saveActorId ? barePeerId : uint64(0),
|
||||
.uniqueGift = parsedGift ? parsedGift->unique : nullptr,
|
||||
.starrefAmount = paidMessagesCount ? CreditsAmount() : starrefAmount,
|
||||
.starrefCommission = paidMessagesCount ? 0 : starrefCommission,
|
||||
.starrefRecipientId = paidMessagesCount ? 0 : starrefBarePeerId,
|
||||
.peerType = tl.data().vpeer().match([](const HistoryPeerTL &) {
|
||||
return Data::CreditsHistoryEntry::PeerType::Peer;
|
||||
}, [](const MTPDstarsTransactionPeerPlayMarket &) {
|
||||
return Data::CreditsHistoryEntry::PeerType::PlayMarket;
|
||||
}, [](const MTPDstarsTransactionPeerFragment &) {
|
||||
return Data::CreditsHistoryEntry::PeerType::Fragment;
|
||||
}, [](const MTPDstarsTransactionPeerAppStore &) {
|
||||
return Data::CreditsHistoryEntry::PeerType::AppStore;
|
||||
}, [](const MTPDstarsTransactionPeerUnsupported &) {
|
||||
return Data::CreditsHistoryEntry::PeerType::Unsupported;
|
||||
}, [](const MTPDstarsTransactionPeerPremiumBot &) {
|
||||
return Data::CreditsHistoryEntry::PeerType::PremiumBot;
|
||||
}, [](const MTPDstarsTransactionPeerAds &) {
|
||||
return Data::CreditsHistoryEntry::PeerType::Ads;
|
||||
}, [](const MTPDstarsTransactionPeerAPI &) {
|
||||
return Data::CreditsHistoryEntry::PeerType::API;
|
||||
}),
|
||||
.subscriptionUntil = tl.data().vsubscription_period()
|
||||
? base::unixtime::parse(base::unixtime::now()
|
||||
+ tl.data().vsubscription_period()->v)
|
||||
: QDateTime(),
|
||||
.adsProceedsToDate = tl.data().vads_proceeds_to_date()
|
||||
? base::unixtime::parse(tl.data().vads_proceeds_to_date()->v)
|
||||
: QDateTime(),
|
||||
.successDate = tl.data().vtransaction_date()
|
||||
? base::unixtime::parse(tl.data().vtransaction_date()->v)
|
||||
: QDateTime(),
|
||||
.successLink = qs(tl.data().vtransaction_url().value_or_empty()),
|
||||
.paidMessagesCount = paidMessagesCount,
|
||||
.paidMessagesAmount = (paidMessagesCount
|
||||
? starrefAmount
|
||||
: CreditsAmount()),
|
||||
.paidMessagesCommission = paidMessagesCount ? starrefCommission : 0,
|
||||
.starsConverted = int(nonUniqueGift
|
||||
? nonUniqueGift->vconvert_stars().v
|
||||
: 0),
|
||||
.premiumMonthsForStars = premiumMonthsForStars,
|
||||
.floodSkip = int(tl.data().vfloodskip_number().value_or(0)),
|
||||
.converted = stargift && incoming,
|
||||
.stargift = stargift.has_value(),
|
||||
.giftUpgraded = tl.data().is_stargift_upgrade(),
|
||||
.giftResale = tl.data().is_stargift_resale(),
|
||||
.reaction = tl.data().is_reaction(),
|
||||
.refunded = tl.data().is_refund(),
|
||||
.pending = tl.data().is_pending(),
|
||||
.failed = tl.data().is_failed(),
|
||||
.in = incoming,
|
||||
.gift = tl.data().is_gift() || stargift.has_value(),
|
||||
};
|
||||
}
|
||||
|
||||
} // namespace Api
|
||||
22
Telegram/SourceFiles/api/api_credits_history_entry.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
class PeerData;
|
||||
|
||||
namespace Data {
|
||||
struct CreditsHistoryEntry;
|
||||
} // namespace Data
|
||||
|
||||
namespace Api {
|
||||
|
||||
[[nodiscard]] Data::CreditsHistoryEntry CreditsHistoryEntryFromTL(
|
||||
const MTPStarsTransaction &tl,
|
||||
not_null<PeerData*> peer);
|
||||
|
||||
} // namespace Api
|
||||
@@ -46,20 +46,23 @@ void HandleWithdrawalButton(
|
||||
bool loading = false;
|
||||
};
|
||||
|
||||
const auto channel = receiver.currencyReceiver;
|
||||
const auto peer = receiver.creditsReceiver;
|
||||
const auto currencyReceiver = receiver.currencyReceiver;
|
||||
const auto creditsReceiver = receiver.creditsReceiver;
|
||||
const auto isChannel = receiver.currencyReceiver
|
||||
&& receiver.currencyReceiver->isChannel();
|
||||
|
||||
const auto state = button->lifetime().make_state<State>();
|
||||
const auto session = (channel ? &channel->session() : &peer->session());
|
||||
const auto session = (currencyReceiver
|
||||
? ¤cyReceiver->session()
|
||||
: &creditsReceiver->session());
|
||||
|
||||
using ChannelOutUrl = MTPstats_BroadcastRevenueWithdrawalUrl;
|
||||
using CreditsOutUrl = MTPpayments_StarsRevenueWithdrawalUrl;
|
||||
|
||||
session->api().cloudPassword().reload();
|
||||
const auto processOut = [=] {
|
||||
if (state->loading) {
|
||||
return;
|
||||
} else if (peer && !receiver.creditsAmount()) {
|
||||
} else if (creditsReceiver && !receiver.creditsAmount()) {
|
||||
return;
|
||||
}
|
||||
state->loading = true;
|
||||
@@ -70,10 +73,10 @@ void HandleWithdrawalButton(
|
||||
state->loading = false;
|
||||
|
||||
auto fields = PasscodeBox::CloudFields::From(pass);
|
||||
fields.customTitle = channel
|
||||
fields.customTitle = isChannel
|
||||
? tr::lng_channel_earn_balance_password_title()
|
||||
: tr::lng_bot_earn_balance_password_title();
|
||||
fields.customDescription = channel
|
||||
fields.customDescription = isChannel
|
||||
? tr::lng_channel_earn_balance_password_description(tr::now)
|
||||
: tr::lng_bot_earn_balance_password_description(tr::now);
|
||||
fields.customSubmitButton = tr::lng_passcode_submit();
|
||||
@@ -94,19 +97,19 @@ void HandleWithdrawalButton(
|
||||
show->showToast(message);
|
||||
}
|
||||
};
|
||||
if (channel) {
|
||||
session->api().request(
|
||||
MTPstats_GetBroadcastRevenueWithdrawalUrl(
|
||||
channel->input,
|
||||
result.result
|
||||
)).done([=](const ChannelOutUrl &r) {
|
||||
done(qs(r.data().vurl()));
|
||||
}).fail(fail).send();
|
||||
} else if (peer) {
|
||||
if (currencyReceiver || creditsReceiver) {
|
||||
using F = MTPpayments_getStarsRevenueWithdrawalUrl::Flag;
|
||||
session->api().request(
|
||||
MTPpayments_GetStarsRevenueWithdrawalUrl(
|
||||
peer->input,
|
||||
MTP_long(receiver.creditsAmount()),
|
||||
MTP_flags(currencyReceiver
|
||||
? F::f_ton
|
||||
: F::f_amount),
|
||||
currencyReceiver
|
||||
? currencyReceiver->input
|
||||
: creditsReceiver->input,
|
||||
MTP_long(creditsReceiver
|
||||
? receiver.creditsAmount()
|
||||
: 0),
|
||||
result.result
|
||||
)).done([=](const CreditsOutUrl &r) {
|
||||
done(qs(r.data().vurl()));
|
||||
@@ -134,17 +137,19 @@ void HandleWithdrawalButton(
|
||||
processOut();
|
||||
}
|
||||
};
|
||||
if (channel) {
|
||||
session->api().request(
|
||||
MTPstats_GetBroadcastRevenueWithdrawalUrl(
|
||||
channel->input,
|
||||
MTP_inputCheckPasswordEmpty()
|
||||
)).fail(fail).send();
|
||||
} else if (peer) {
|
||||
if (currencyReceiver || creditsReceiver) {
|
||||
using F = MTPpayments_getStarsRevenueWithdrawalUrl::Flag;
|
||||
session->api().request(
|
||||
MTPpayments_GetStarsRevenueWithdrawalUrl(
|
||||
peer->input,
|
||||
MTP_long(std::numeric_limits<int64_t>::max()),
|
||||
MTP_flags(currencyReceiver
|
||||
? F::f_ton
|
||||
: F::f_amount),
|
||||
currencyReceiver
|
||||
? currencyReceiver->input
|
||||
: creditsReceiver->input,
|
||||
MTP_long(creditsReceiver
|
||||
? receiver.creditsAmount()
|
||||
: 0),
|
||||
MTP_inputCheckPasswordEmpty()
|
||||
)).fail(fail).send();
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ void RestrictSponsored(
|
||||
Fn<void(QString)> failed);
|
||||
|
||||
struct RewardReceiver final {
|
||||
ChannelData *currencyReceiver = nullptr;
|
||||
PeerData *currencyReceiver = nullptr;
|
||||
PeerData *creditsReceiver = nullptr;
|
||||
Fn<uint64()> creditsAmount;
|
||||
};
|
||||
|
||||
@@ -10,15 +10,19 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "apiwrap.h"
|
||||
#include "api/api_media.h"
|
||||
#include "api/api_text_entities.h"
|
||||
#include "base/random.h"
|
||||
#include "ui/boxes/confirm_box.h"
|
||||
#include "data/business/data_shortcut_messages.h"
|
||||
#include "data/components/scheduled_messages.h"
|
||||
#include "data/data_file_origin.h"
|
||||
#include "data/data_histories.h"
|
||||
#include "data/data_saved_sublist.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_todo_list.h"
|
||||
#include "data/data_web_page.h"
|
||||
#include "history/view/controls/history_view_compose_media_edit_manager.h"
|
||||
#include "history/history.h"
|
||||
#include "history/history_item_components.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "main/main_session.h"
|
||||
#include "mtproto/mtproto_response.h"
|
||||
@@ -45,6 +49,193 @@ template <typename T>
|
||||
constexpr auto ErrorWithoutId
|
||||
= is_callable_plain_v<T, QString>;
|
||||
|
||||
template <typename DoneCallback, typename FailCallback>
|
||||
mtpRequestId SuggestMessage(
|
||||
not_null<HistoryItem*> item,
|
||||
const TextWithEntities &textWithEntities,
|
||||
Data::WebPageDraft webpage,
|
||||
SendOptions options,
|
||||
DoneCallback &&done,
|
||||
FailCallback &&fail) {
|
||||
Expects(options.suggest.exists);
|
||||
Expects(!options.scheduled);
|
||||
|
||||
const auto session = &item->history()->session();
|
||||
const auto api = &session->api();
|
||||
|
||||
const auto thread = item->history()->amMonoforumAdmin()
|
||||
? item->savedSublist()
|
||||
: (Data::Thread*)item->history();
|
||||
auto action = SendAction(thread, options);
|
||||
action.replyTo = FullReplyTo{
|
||||
.messageId = item->fullId(),
|
||||
.monoforumPeerId = (item->history()->amMonoforumAdmin()
|
||||
? item->sublistPeerId()
|
||||
: PeerId()),
|
||||
};
|
||||
|
||||
auto message = MessageToSend(std::move(action));
|
||||
message.textWithTags = TextWithTags{
|
||||
textWithEntities.text,
|
||||
TextUtilities::ConvertEntitiesToTextTags(textWithEntities.entities)
|
||||
};
|
||||
message.webPage = webpage;
|
||||
api->sendMessage(std::move(message));
|
||||
|
||||
const auto requestId = -1;
|
||||
crl::on_main(session, [=] {
|
||||
const auto type = u"MESSAGE_NOT_MODIFIED"_q;
|
||||
if constexpr (ErrorWithId<FailCallback>) {
|
||||
fail(type, requestId);
|
||||
} else if constexpr (ErrorWithoutId<FailCallback>) {
|
||||
fail(type);
|
||||
} else if constexpr (WithoutCallback<FailCallback>) {
|
||||
fail();
|
||||
} else {
|
||||
t_bad_callback(fail);
|
||||
}
|
||||
});
|
||||
return requestId;
|
||||
}
|
||||
|
||||
template <typename DoneCallback, typename FailCallback>
|
||||
mtpRequestId SuggestMedia(
|
||||
not_null<HistoryItem*> item,
|
||||
const TextWithEntities &textWithEntities,
|
||||
Data::WebPageDraft webpage,
|
||||
SendOptions options,
|
||||
DoneCallback &&done,
|
||||
FailCallback &&fail,
|
||||
std::optional<MTPInputMedia> inputMedia) {
|
||||
Expects(options.suggest.exists);
|
||||
Expects(!options.scheduled);
|
||||
|
||||
const auto session = &item->history()->session();
|
||||
const auto api = &session->api();
|
||||
|
||||
const auto text = textWithEntities.text;
|
||||
const auto sentEntities = EntitiesToMTP(
|
||||
session,
|
||||
textWithEntities.entities,
|
||||
ConvertOption::SkipLocal);
|
||||
|
||||
const auto updateRecentStickers = inputMedia
|
||||
? Api::HasAttachedStickers(*inputMedia)
|
||||
: false;
|
||||
|
||||
const auto emptyFlag = MTPmessages_SendMedia::Flag(0);
|
||||
auto replyTo = FullReplyTo{
|
||||
.messageId = item->fullId(),
|
||||
.monoforumPeerId = (item->history()->amMonoforumAdmin()
|
||||
? item->sublistPeerId()
|
||||
: PeerId()),
|
||||
};
|
||||
const auto flags = emptyFlag
|
||||
| MTPmessages_SendMedia::Flag::f_reply_to
|
||||
| MTPmessages_SendMedia::Flag::f_suggested_post
|
||||
| (((!webpage.removed && !webpage.url.isEmpty() && webpage.invert)
|
||||
|| options.invertCaption)
|
||||
? MTPmessages_SendMedia::Flag::f_invert_media
|
||||
: emptyFlag)
|
||||
| (!sentEntities.v.isEmpty()
|
||||
? MTPmessages_SendMedia::Flag::f_entities
|
||||
: emptyFlag)
|
||||
| (options.starsApproved
|
||||
? MTPmessages_SendMedia::Flag::f_allow_paid_stars
|
||||
: emptyFlag);
|
||||
const auto randomId = base::RandomValue<uint64>();
|
||||
return api->request(MTPmessages_SendMedia(
|
||||
MTP_flags(flags),
|
||||
item->history()->peer->input,
|
||||
ReplyToForMTP(item->history(), replyTo),
|
||||
inputMedia.value_or(Data::WebPageForMTP(webpage, text.isEmpty())),
|
||||
MTP_string(text),
|
||||
MTP_long(randomId),
|
||||
MTPReplyMarkup(),
|
||||
sentEntities,
|
||||
MTPint(), // schedule_date
|
||||
MTPInputPeer(), // send_as
|
||||
MTPInputQuickReplyShortcut(), // quick_reply_shortcut
|
||||
MTPlong(), // effect
|
||||
MTP_long(options.starsApproved),
|
||||
Api::SuggestToMTP(options.suggest)
|
||||
)).done([=](
|
||||
const MTPUpdates &result,
|
||||
[[maybe_unused]] mtpRequestId requestId) {
|
||||
const auto apply = [=] { api->applyUpdates(result); };
|
||||
|
||||
if constexpr (WithId<DoneCallback>) {
|
||||
done(apply, requestId);
|
||||
} else if constexpr (WithoutId<DoneCallback>) {
|
||||
done(apply);
|
||||
} else if constexpr (WithoutCallback<DoneCallback>) {
|
||||
done();
|
||||
apply();
|
||||
} else {
|
||||
t_bad_callback(done);
|
||||
}
|
||||
|
||||
if (updateRecentStickers) {
|
||||
api->requestSpecialStickersForce(false, false, true);
|
||||
}
|
||||
}).fail([=](const MTP::Error &error, mtpRequestId requestId) {
|
||||
if constexpr (ErrorWithId<FailCallback>) {
|
||||
fail(error.type(), requestId);
|
||||
} else if constexpr (ErrorWithoutId<FailCallback>) {
|
||||
fail(error.type());
|
||||
} else if constexpr (WithoutCallback<FailCallback>) {
|
||||
fail();
|
||||
} else {
|
||||
t_bad_callback(fail);
|
||||
}
|
||||
}).send();
|
||||
}
|
||||
|
||||
template <typename DoneCallback, typename FailCallback>
|
||||
mtpRequestId SuggestMessageOrMedia(
|
||||
not_null<HistoryItem*> item,
|
||||
const TextWithEntities &textWithEntities,
|
||||
Data::WebPageDraft webpage,
|
||||
SendOptions options,
|
||||
DoneCallback &&done,
|
||||
FailCallback &&fail,
|
||||
std::optional<MTPInputMedia> inputMedia) {
|
||||
const auto wasMedia = item->media();
|
||||
if (!inputMedia && wasMedia && wasMedia->allowsEditCaption()) {
|
||||
if (const auto photo = wasMedia->photo()) {
|
||||
inputMedia = MTP_inputMediaPhoto(
|
||||
MTP_flags(0),
|
||||
photo->mtpInput(),
|
||||
MTPint()); // ttl_seconds
|
||||
} else if (const auto document = wasMedia->document()) {
|
||||
inputMedia = MTP_inputMediaDocument(
|
||||
MTP_flags(0),
|
||||
document->mtpInput(),
|
||||
MTPInputPhoto(), // video_cover
|
||||
MTPint(), // video_timestamp
|
||||
MTPint(), // ttl_seconds
|
||||
MTPstring()); // query
|
||||
}
|
||||
}
|
||||
if (inputMedia) {
|
||||
return SuggestMedia(
|
||||
item,
|
||||
textWithEntities,
|
||||
webpage,
|
||||
options,
|
||||
std::move(done),
|
||||
std::move(fail),
|
||||
inputMedia);
|
||||
}
|
||||
return SuggestMessage(
|
||||
item,
|
||||
textWithEntities,
|
||||
webpage,
|
||||
options,
|
||||
std::move(done),
|
||||
std::move(fail));
|
||||
}
|
||||
|
||||
template <typename DoneCallback, typename FailCallback>
|
||||
mtpRequestId EditMessage(
|
||||
not_null<HistoryItem*> item,
|
||||
@@ -54,6 +245,18 @@ mtpRequestId EditMessage(
|
||||
DoneCallback &&done,
|
||||
FailCallback &&fail,
|
||||
std::optional<MTPInputMedia> inputMedia = std::nullopt) {
|
||||
if (item->computeSuggestionActions()
|
||||
== SuggestionActions::AcceptAndDecline) {
|
||||
return SuggestMessageOrMedia(
|
||||
item,
|
||||
textWithEntities,
|
||||
webpage,
|
||||
options,
|
||||
std::move(done),
|
||||
std::move(fail),
|
||||
inputMedia);
|
||||
}
|
||||
|
||||
const auto session = &item->history()->session();
|
||||
const auto api = &session->api();
|
||||
|
||||
@@ -70,31 +273,31 @@ mtpRequestId EditMessage(
|
||||
|
||||
const auto emptyFlag = MTPmessages_EditMessage::Flag(0);
|
||||
const auto flags = emptyFlag
|
||||
| ((!text.isEmpty() || media)
|
||||
? MTPmessages_EditMessage::Flag::f_message
|
||||
: emptyFlag)
|
||||
| ((media && inputMedia.has_value())
|
||||
? MTPmessages_EditMessage::Flag::f_media
|
||||
: emptyFlag)
|
||||
| (webpage.removed
|
||||
? MTPmessages_EditMessage::Flag::f_no_webpage
|
||||
: emptyFlag)
|
||||
| ((!webpage.removed && !webpage.url.isEmpty())
|
||||
? MTPmessages_EditMessage::Flag::f_media
|
||||
: emptyFlag)
|
||||
| (((!webpage.removed && !webpage.url.isEmpty() && webpage.invert)
|
||||
|| options.invertCaption)
|
||||
? MTPmessages_EditMessage::Flag::f_invert_media
|
||||
: emptyFlag)
|
||||
| (!sentEntities.v.isEmpty()
|
||||
? MTPmessages_EditMessage::Flag::f_entities
|
||||
: emptyFlag)
|
||||
| (options.scheduled
|
||||
? MTPmessages_EditMessage::Flag::f_schedule_date
|
||||
: emptyFlag)
|
||||
| (item->isBusinessShortcut()
|
||||
? MTPmessages_EditMessage::Flag::f_quick_reply_shortcut_id
|
||||
: emptyFlag);
|
||||
| ((!text.isEmpty() || media)
|
||||
? MTPmessages_EditMessage::Flag::f_message
|
||||
: emptyFlag)
|
||||
| ((media && inputMedia.has_value())
|
||||
? MTPmessages_EditMessage::Flag::f_media
|
||||
: emptyFlag)
|
||||
| (webpage.removed
|
||||
? MTPmessages_EditMessage::Flag::f_no_webpage
|
||||
: emptyFlag)
|
||||
| ((!webpage.removed && !webpage.url.isEmpty())
|
||||
? MTPmessages_EditMessage::Flag::f_media
|
||||
: emptyFlag)
|
||||
| (((!webpage.removed && !webpage.url.isEmpty() && webpage.invert)
|
||||
|| options.invertCaption)
|
||||
? MTPmessages_EditMessage::Flag::f_invert_media
|
||||
: emptyFlag)
|
||||
| (!sentEntities.v.isEmpty()
|
||||
? MTPmessages_EditMessage::Flag::f_entities
|
||||
: emptyFlag)
|
||||
| (options.scheduled
|
||||
? MTPmessages_EditMessage::Flag::f_schedule_date
|
||||
: emptyFlag)
|
||||
| (item->isBusinessShortcut()
|
||||
? MTPmessages_EditMessage::Flag::f_quick_reply_shortcut_id
|
||||
: emptyFlag);
|
||||
|
||||
const auto id = item->isScheduled()
|
||||
? session->scheduledMessages().lookupId(item)
|
||||
@@ -358,4 +561,22 @@ mtpRequestId EditTextMessage(
|
||||
std::nullopt);
|
||||
}
|
||||
|
||||
void EditTodoList(
|
||||
not_null<HistoryItem*> item,
|
||||
const TodoListData &data,
|
||||
SendOptions options,
|
||||
Fn<void(mtpRequestId requestId)> done,
|
||||
Fn<void(const QString &error, mtpRequestId requestId)> fail) {
|
||||
const auto callback = [=](Fn<void()> applyUpdates, mtpRequestId id) {
|
||||
applyUpdates();
|
||||
done(id);
|
||||
};
|
||||
EditMessage(
|
||||
item,
|
||||
options,
|
||||
callback,
|
||||
fail,
|
||||
MTP_inputMediaTodo(TodoListDataToMTP(&data)));
|
||||
}
|
||||
|
||||
} // namespace Api
|
||||
|
||||
@@ -58,4 +58,11 @@ mtpRequestId EditTextMessage(
|
||||
Fn<void(const QString &error, mtpRequestId requestId)> fail,
|
||||
bool spoilered);
|
||||
|
||||
void EditTodoList(
|
||||
not_null<HistoryItem*> item,
|
||||
const TodoListData &data,
|
||||
SendOptions options,
|
||||
Fn<void(mtpRequestId requestId)> done,
|
||||
Fn<void(const QString &error, mtpRequestId requestId)> fail);
|
||||
|
||||
} // namespace Api
|
||||
|
||||
@@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "api/api_global_privacy.h"
|
||||
|
||||
#include "apiwrap.h"
|
||||
#include "data/components/promo_suggestions.h"
|
||||
#include "data/data_user.h"
|
||||
#include "main/main_session.h"
|
||||
#include "main/main_app_config.h"
|
||||
@@ -101,13 +102,11 @@ rpl::producer<bool> GlobalPrivacy::showArchiveAndMute() const {
|
||||
}
|
||||
|
||||
rpl::producer<> GlobalPrivacy::suggestArchiveAndMute() const {
|
||||
return _session->appConfig().suggestionRequested(
|
||||
u"AUTOARCHIVE_POPULAR"_q);
|
||||
return _session->promoSuggestions().requested(u"AUTOARCHIVE_POPULAR"_q);
|
||||
}
|
||||
|
||||
void GlobalPrivacy::dismissArchiveAndMuteSuggestion() {
|
||||
_session->appConfig().dismissSuggestion(
|
||||
u"AUTOARCHIVE_POPULAR"_q);
|
||||
_session->promoSuggestions().dismiss(u"AUTOARCHIVE_POPULAR"_q);
|
||||
}
|
||||
|
||||
void GlobalPrivacy::updateHideReadTime(bool hide) {
|
||||
|
||||
@@ -47,6 +47,7 @@ void Polls::create(
|
||||
const auto topicRootId = action.replyTo.messageId
|
||||
? action.replyTo.topicRootId
|
||||
: 0;
|
||||
const auto monoforumPeerId = action.replyTo.monoforumPeerId;
|
||||
auto sendFlags = MTPmessages_SendMedia::Flags(0);
|
||||
if (action.replyTo) {
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_reply_to;
|
||||
@@ -54,9 +55,9 @@ void Polls::create(
|
||||
const auto clearCloudDraft = action.clearDraft;
|
||||
if (clearCloudDraft) {
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_clear_draft;
|
||||
history->clearLocalDraft(topicRootId);
|
||||
history->clearCloudDraft(topicRootId);
|
||||
history->startSavingCloudDraft(topicRootId);
|
||||
history->clearLocalDraft(topicRootId, monoforumPeerId);
|
||||
history->clearCloudDraft(topicRootId, monoforumPeerId);
|
||||
history->startSavingCloudDraft(topicRootId, monoforumPeerId);
|
||||
}
|
||||
const auto silentPost = ShouldSendSilent(peer, action.options);
|
||||
const auto starsPaid = std::min(
|
||||
@@ -74,6 +75,9 @@ void Polls::create(
|
||||
if (action.options.effectId) {
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_effect;
|
||||
}
|
||||
if (action.options.suggest) {
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_suggested_post;
|
||||
}
|
||||
if (starsPaid) {
|
||||
action.options.starsApproved -= starsPaid;
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_allow_paid_stars;
|
||||
@@ -101,11 +105,13 @@ void Polls::create(
|
||||
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
|
||||
Data::ShortcutIdToMTP(_session, action.options.shortcutId),
|
||||
MTP_long(action.options.effectId),
|
||||
MTP_long(starsPaid)
|
||||
MTP_long(starsPaid),
|
||||
SuggestToMTP(action.options.suggest)
|
||||
), [=](const MTPUpdates &result, const MTP::Response &response) {
|
||||
if (clearCloudDraft) {
|
||||
history->finishSavingCloudDraft(
|
||||
topicRootId,
|
||||
monoforumPeerId,
|
||||
UnixtimeFromMsgId(response.outerMsgId));
|
||||
}
|
||||
_session->changes().historyUpdated(
|
||||
@@ -118,6 +124,7 @@ void Polls::create(
|
||||
if (clearCloudDraft) {
|
||||
history->finishSavingCloudDraft(
|
||||
topicRootId,
|
||||
monoforumPeerId,
|
||||
UnixtimeFromMsgId(response.outerMsgId));
|
||||
}
|
||||
fail();
|
||||
|
||||
@@ -424,7 +424,7 @@ void Premium::requestPremiumRequiredSlice() {
|
||||
constexpr auto hasPrem = Flag::HasRequirePremiumToWrite;
|
||||
constexpr auto hasStars = Flag::HasStarsPerMessage;
|
||||
user->setStarsPerMessage(stars);
|
||||
user->setFlags((user->flags() & ~(me | hasPrem | hasStars))
|
||||
user->setFlags((user->flags() & ~me)
|
||||
| known
|
||||
| (requirePremium ? (me | hasPrem) : Flag())
|
||||
| (stars ? hasStars : Flag()));
|
||||
@@ -619,6 +619,8 @@ auto PremiumGiftCodeOptions::requestStarGifts()
|
||||
MTP_int(0)
|
||||
)).done([=](const MTPpayments_StarGifts &result) {
|
||||
result.match([&](const MTPDpayments_starGifts &data) {
|
||||
_peer->owner().processUsers(data.vusers());
|
||||
_peer->owner().processChats(data.vchats());
|
||||
_giftsHash = data.vhash().v;
|
||||
const auto &list = data.vgifts().v;
|
||||
const auto session = &_peer->session();
|
||||
@@ -799,17 +801,28 @@ std::optional<Data::StarGift> FromTL(
|
||||
return gift.match([&](const MTPDstarGift &data) {
|
||||
const auto document = session->data().processDocument(
|
||||
data.vsticker());
|
||||
const auto resellPrice = data.vresell_min_stars().value_or_empty();
|
||||
const auto remaining = data.vavailability_remains();
|
||||
const auto total = data.vavailability_total();
|
||||
if (!document->sticker()) {
|
||||
return std::optional<Data::StarGift>();
|
||||
}
|
||||
const auto releasedById = data.vreleased_by()
|
||||
? peerFromMTP(*data.vreleased_by())
|
||||
: PeerId();
|
||||
const auto releasedBy = releasedById
|
||||
? session->data().peer(releasedById).get()
|
||||
: nullptr;
|
||||
return std::optional<Data::StarGift>(Data::StarGift{
|
||||
.id = uint64(data.vid().v),
|
||||
.stars = int64(data.vstars().v),
|
||||
.starsConverted = int64(data.vconvert_stars().v),
|
||||
.starsToUpgrade = int64(data.vupgrade_stars().value_or_empty()),
|
||||
.starsResellMin = int64(resellPrice),
|
||||
.document = document,
|
||||
.releasedBy = releasedBy,
|
||||
.resellTitle = qs(data.vtitle().value_or_empty()),
|
||||
.resellCount = int(data.vavailability_resale().value_or_empty()),
|
||||
.limitedLeft = remaining.value_or_empty(),
|
||||
.limitedCount = total.value_or_empty(),
|
||||
.firstSaleDate = data.vfirst_sale_date().value_or_empty(),
|
||||
@@ -837,6 +850,12 @@ std::optional<Data::StarGift> FromTL(
|
||||
|| !pattern->document->sticker()) {
|
||||
return std::optional<Data::StarGift>();
|
||||
}
|
||||
const auto releasedById = data.vreleased_by()
|
||||
? peerFromMTP(*data.vreleased_by())
|
||||
: PeerId();
|
||||
const auto releasedBy = releasedById
|
||||
? session->data().peer(releasedById).get()
|
||||
: nullptr;
|
||||
auto result = Data::StarGift{
|
||||
.id = uint64(data.vid().v),
|
||||
.unique = std::make_shared<Data::UniqueGift>(Data::UniqueGift{
|
||||
@@ -848,11 +867,14 @@ std::optional<Data::StarGift> FromTL(
|
||||
.ownerId = (data.vowner_id()
|
||||
? peerFromMTP(*data.vowner_id())
|
||||
: PeerId()),
|
||||
.releasedBy = releasedBy,
|
||||
.number = data.vnum().v,
|
||||
.starsForResale = int(data.vresell_stars().value_or_empty()),
|
||||
.model = *model,
|
||||
.pattern = *pattern,
|
||||
}),
|
||||
.document = model->document,
|
||||
.releasedBy = releasedBy,
|
||||
.limitedLeft = (total - data.vavailability_issued().v),
|
||||
.limitedCount = total,
|
||||
};
|
||||
@@ -881,6 +903,8 @@ std::optional<Data::SavedStarGift> FromTL(
|
||||
} else if (const auto unique = parsed->unique.get()) {
|
||||
unique->starsForTransfer = data.vtransfer_stars().value_or(-1);
|
||||
unique->exportAt = data.vcan_export_at().value_or_empty();
|
||||
unique->canTransferAt = data.vcan_transfer_at().value_or_empty();
|
||||
unique->canResellAt = data.vcan_resell_at().value_or_empty();
|
||||
}
|
||||
using Id = Data::SavedStarGiftId;
|
||||
const auto hasUnique = parsed->unique != nullptr;
|
||||
@@ -936,7 +960,7 @@ Data::UniqueGiftPattern FromTL(
|
||||
}
|
||||
|
||||
Data::UniqueGiftBackdrop FromTL(const MTPDstarGiftAttributeBackdrop &data) {
|
||||
auto result = Data::UniqueGiftBackdrop();
|
||||
auto result = Data::UniqueGiftBackdrop{ .id = data.vbackdrop_id().v };
|
||||
result.name = qs(data.vname());
|
||||
result.rarityPermille = data.vrarity_permille().v;
|
||||
result.centerColor = Ui::ColorFromSerialized(
|
||||
|
||||
@@ -109,6 +109,9 @@ void SendSimpleMedia(SendAction action, MTPInputMedia inputMedia) {
|
||||
if (action.options.effectId) {
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_effect;
|
||||
}
|
||||
if (action.options.suggest) {
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_suggested_post;
|
||||
}
|
||||
if (action.options.invertCaption) {
|
||||
flags |= MessageFlag::InvertMedia;
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_invert_media;
|
||||
@@ -136,7 +139,8 @@ void SendSimpleMedia(SendAction action, MTPInputMedia inputMedia) {
|
||||
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
|
||||
Data::ShortcutIdToMTP(session, action.options.shortcutId),
|
||||
MTP_long(action.options.effectId),
|
||||
MTP_long(starsPaid)
|
||||
MTP_long(starsPaid),
|
||||
SuggestToMTP(action.options.suggest)
|
||||
), [=](const MTPUpdates &result, const MTP::Response &response) {
|
||||
}, [=](const MTP::Error &error, const MTP::Response &response) {
|
||||
api->sendMessageFail(error, peer, randomId);
|
||||
@@ -211,6 +215,9 @@ void SendExistingMedia(
|
||||
if (action.options.effectId) {
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_effect;
|
||||
}
|
||||
if (action.options.suggest) {
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_suggested_post;
|
||||
}
|
||||
if (action.options.invertCaption) {
|
||||
flags |= MessageFlag::InvertMedia;
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_invert_media;
|
||||
@@ -232,6 +239,7 @@ void SendExistingMedia(
|
||||
.starsPaid = starsPaid,
|
||||
.postAuthor = NewMessagePostAuthor(action),
|
||||
.effectId = action.options.effectId,
|
||||
.suggest = HistoryMessageSuggestInfo(action.options),
|
||||
}, media, caption);
|
||||
|
||||
const auto performRequest = [=](const auto &repeatRequest) -> void {
|
||||
@@ -255,7 +263,8 @@ void SendExistingMedia(
|
||||
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
|
||||
Data::ShortcutIdToMTP(session, action.options.shortcutId),
|
||||
MTP_long(action.options.effectId),
|
||||
MTP_long(starsPaid)
|
||||
MTP_long(starsPaid),
|
||||
SuggestToMTP(action.options.suggest)
|
||||
), [=](const MTPUpdates &result, const MTP::Response &response) {
|
||||
}, [=](const MTP::Error &error, const MTP::Response &response) {
|
||||
if (error.code() == 400
|
||||
@@ -391,6 +400,9 @@ bool SendDice(MessageToSend &message) {
|
||||
if (action.options.effectId) {
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_effect;
|
||||
}
|
||||
if (action.options.suggest) {
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_suggested_post;
|
||||
}
|
||||
if (action.options.invertCaption) {
|
||||
flags |= MessageFlag::InvertMedia;
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_invert_media;
|
||||
@@ -415,6 +427,7 @@ bool SendDice(MessageToSend &message) {
|
||||
.starsPaid = starsPaid,
|
||||
.postAuthor = NewMessagePostAuthor(action),
|
||||
.effectId = action.options.effectId,
|
||||
.suggest = HistoryMessageSuggestInfo(action.options),
|
||||
}, TextWithEntities(), MTP_messageMediaDice(
|
||||
MTP_int(0),
|
||||
MTP_string(emoji)));
|
||||
@@ -435,7 +448,8 @@ bool SendDice(MessageToSend &message) {
|
||||
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
|
||||
Data::ShortcutIdToMTP(session, action.options.shortcutId),
|
||||
MTP_long(action.options.effectId),
|
||||
MTP_long(starsPaid)
|
||||
MTP_long(starsPaid),
|
||||
SuggestToMTP(action.options.suggest)
|
||||
), [=](const MTPUpdates &result, const MTP::Response &response) {
|
||||
}, [=](const MTP::Error &error, const MTP::Response &response) {
|
||||
api->sendMessageFail(error, peer, randomId, newId);
|
||||
@@ -624,6 +638,7 @@ void SendConfirmedFile(
|
||||
edition.useSameMarkup = true;
|
||||
edition.useSameReplies = true;
|
||||
edition.useSameReactions = true;
|
||||
edition.useSameSuggest = true;
|
||||
edition.savePreviousMedia = true;
|
||||
itemToEdit->applyEdition(std::move(edition));
|
||||
} else {
|
||||
@@ -640,6 +655,7 @@ void SendConfirmedFile(
|
||||
.postAuthor = NewMessagePostAuthor(action),
|
||||
.groupedId = groupId,
|
||||
.effectId = file->to.options.effectId,
|
||||
.suggest = HistoryMessageSuggestInfo(file->to.options),
|
||||
}, caption, media);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "api/api_statistics.h"
|
||||
|
||||
#include "api/api_credits_history_entry.h"
|
||||
#include "api/api_statistics_data_deserialize.h"
|
||||
#include "apiwrap.h"
|
||||
#include "base/unixtime.h"
|
||||
@@ -695,19 +696,23 @@ rpl::producer<rpl::no_value, QString> EarnStatistics::request() {
|
||||
return [=](auto consumer) {
|
||||
auto lifetime = rpl::lifetime();
|
||||
|
||||
makeRequest(MTPstats_GetBroadcastRevenueStats(
|
||||
MTP_flags(0),
|
||||
api().request(MTPpayments_GetStarsRevenueStats(
|
||||
MTP_flags(MTPpayments_getStarsRevenueStats::Flag::f_ton),
|
||||
(_isUser ? user()->input : channel()->input)
|
||||
)).done([=](const MTPstats_BroadcastRevenueStats &result) {
|
||||
)).done([=](const MTPpayments_StarsRevenueStats &result) {
|
||||
const auto &data = result.data();
|
||||
const auto &balances = data.vbalances().data();
|
||||
const auto &balances = data.vstatus().data();
|
||||
const auto amount = [](const auto &a) {
|
||||
return CreditsAmountFromTL(a);
|
||||
};
|
||||
_data = Data::EarnStatistics{
|
||||
.topHoursGraph = StatisticalGraphFromTL(
|
||||
data.vtop_hours_graph()),
|
||||
.topHoursGraph = data.vtop_hours_graph()
|
||||
? StatisticalGraphFromTL(*data.vtop_hours_graph())
|
||||
: Data::StatisticalGraph(),
|
||||
.revenueGraph = StatisticalGraphFromTL(data.vrevenue_graph()),
|
||||
.currentBalance = balances.vcurrent_balance().v,
|
||||
.availableBalance = balances.vavailable_balance().v,
|
||||
.overallRevenue = balances.voverall_revenue().v,
|
||||
.currentBalance = amount(balances.vcurrent_balance()),
|
||||
.availableBalance = amount(balances.vavailable_balance()),
|
||||
.overallRevenue = amount(balances.voverall_revenue()),
|
||||
.usdRate = data.vusd_rate().v,
|
||||
};
|
||||
|
||||
@@ -745,62 +750,35 @@ void EarnStatistics::requestHistory(
|
||||
if (_requestId) {
|
||||
return;
|
||||
}
|
||||
|
||||
constexpr auto kTlFirstSlice = tl::make_int(kFirstSlice);
|
||||
constexpr auto kTlLimit = tl::make_int(kLimit);
|
||||
_requestId = api().request(MTPstats_GetBroadcastRevenueTransactions(
|
||||
|
||||
_requestId = api().request(MTPpayments_GetStarsTransactions(
|
||||
MTP_flags(MTPpayments_getStarsTransactions::Flag::f_ton),
|
||||
MTP_string(), // Subscription ID.
|
||||
(_isUser ? user()->input : channel()->input),
|
||||
MTP_int(token),
|
||||
(!token) ? kTlFirstSlice : kTlLimit
|
||||
)).done([=](const MTPstats_BroadcastRevenueTransactions &result) {
|
||||
MTP_string(token),
|
||||
token.isEmpty() ? kTlFirstSlice : kTlLimit
|
||||
)).done([=](const MTPpayments_StarsStatus &result) {
|
||||
_requestId = 0;
|
||||
|
||||
const auto &tlTransactions = result.data().vtransactions().v;
|
||||
const auto nextToken = result.data().vnext_offset().value_or_empty();
|
||||
|
||||
auto list = std::vector<Data::EarnHistoryEntry>();
|
||||
list.reserve(tlTransactions.size());
|
||||
for (const auto &tlTransaction : tlTransactions) {
|
||||
list.push_back(tlTransaction.match([&](
|
||||
const MTPDbroadcastRevenueTransactionProceeds &d) {
|
||||
return Data::EarnHistoryEntry{
|
||||
.type = Data::EarnHistoryEntry::Type::In,
|
||||
.amount = d.vamount().v,
|
||||
.date = base::unixtime::parse(d.vfrom_date().v),
|
||||
.dateTo = base::unixtime::parse(d.vto_date().v),
|
||||
};
|
||||
}, [&](const MTPDbroadcastRevenueTransactionWithdrawal &d) {
|
||||
return Data::EarnHistoryEntry{
|
||||
.type = Data::EarnHistoryEntry::Type::Out,
|
||||
.status = d.is_pending()
|
||||
? Data::EarnHistoryEntry::Status::Pending
|
||||
: d.is_failed()
|
||||
? Data::EarnHistoryEntry::Status::Failed
|
||||
: Data::EarnHistoryEntry::Status::Success,
|
||||
.amount = (std::numeric_limits<Data::EarnInt>::max()
|
||||
- d.vamount().v
|
||||
+ 1),
|
||||
.date = base::unixtime::parse(d.vdate().v),
|
||||
// .provider = qs(d.vprovider()),
|
||||
.successDate = d.vtransaction_date()
|
||||
? base::unixtime::parse(d.vtransaction_date()->v)
|
||||
: QDateTime(),
|
||||
.successLink = d.vtransaction_url()
|
||||
? qs(*d.vtransaction_url())
|
||||
: QString(),
|
||||
};
|
||||
}, [&](const MTPDbroadcastRevenueTransactionRefund &d) {
|
||||
return Data::EarnHistoryEntry{
|
||||
.type = Data::EarnHistoryEntry::Type::Return,
|
||||
.amount = d.vamount().v,
|
||||
.date = base::unixtime::parse(d.vdate().v),
|
||||
// .provider = qs(d.vprovider()),
|
||||
};
|
||||
}));
|
||||
}
|
||||
const auto nextToken = token + tlTransactions.size();
|
||||
const auto tlTransactions
|
||||
= result.data().vhistory().value_or_empty();
|
||||
|
||||
const auto peer = _isUser ? (PeerData*)user() : (PeerData*)channel();
|
||||
auto list = ranges::views::all(
|
||||
tlTransactions
|
||||
) | ranges::views::transform([=](const auto &d) {
|
||||
return CreditsHistoryEntryFromTL(d, peer);
|
||||
}) | ranges::to_vector;
|
||||
done(Data::EarnHistorySlice{
|
||||
.list = std::move(list),
|
||||
.total = result.data().vcount().v,
|
||||
.allLoaded = (result.data().vcount().v == nextToken),
|
||||
.total = int(tlTransactions.size()),
|
||||
// .total = result.data().vcount().v,
|
||||
.allLoaded = nextToken.isEmpty(),
|
||||
.token = Data::EarnHistorySlice::OffsetToken(nextToken),
|
||||
});
|
||||
}).fail([=] {
|
||||
|
||||
638
Telegram/SourceFiles/api/api_suggest_post.cpp
Normal file
@@ -0,0 +1,638 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "api/api_suggest_post.h"
|
||||
|
||||
#include "apiwrap.h"
|
||||
#include "base/unixtime.h"
|
||||
#include "chat_helpers/message_field.h"
|
||||
#include "core/click_handler_types.h"
|
||||
#include "data/components/credits.h"
|
||||
#include "data/data_changes.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_saved_sublist.h"
|
||||
#include "history/view/controls/history_view_suggest_options.h"
|
||||
#include "history/history.h"
|
||||
#include "history/history_item.h"
|
||||
#include "history/history_item_components.h"
|
||||
#include "history/history_item_helpers.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "main/main_session.h"
|
||||
#include "mainwindow.h"
|
||||
#include "settings/settings_credits_graphics.h"
|
||||
#include "ui/boxes/choose_date_time.h"
|
||||
#include "ui/layers/generic_box.h"
|
||||
#include "ui/boxes/confirm_box.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/widgets/fields/input_field.h"
|
||||
#include "ui/widgets/popup_menu.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "styles/style_chat.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_menu_icons.h"
|
||||
|
||||
namespace Api {
|
||||
namespace {
|
||||
|
||||
void SendApproval(
|
||||
std::shared_ptr<Main::SessionShow> show,
|
||||
not_null<HistoryItem*> item,
|
||||
TimeId scheduleDate = 0) {
|
||||
using Flag = MTPmessages_ToggleSuggestedPostApproval::Flag;
|
||||
const auto suggestion = item->Get<HistoryMessageSuggestedPost>();
|
||||
if (!suggestion
|
||||
|| suggestion->accepted
|
||||
|| suggestion->rejected
|
||||
|| suggestion->requestId) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto id = item->fullId();
|
||||
const auto session = &show->session();
|
||||
const auto finish = [=] {
|
||||
if (const auto item = session->data().message(id)) {
|
||||
const auto suggestion = item->Get<HistoryMessageSuggestedPost>();
|
||||
if (suggestion) {
|
||||
suggestion->requestId = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
suggestion->requestId = session->api().request(
|
||||
MTPmessages_ToggleSuggestedPostApproval(
|
||||
MTP_flags(scheduleDate ? Flag::f_schedule_date : Flag()),
|
||||
item->history()->peer->input,
|
||||
MTP_int(item->id.bare),
|
||||
MTP_int(scheduleDate),
|
||||
MTPstring()) // reject_comment
|
||||
).done([=](const MTPUpdates &result) {
|
||||
session->api().applyUpdates(result);
|
||||
finish();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
show->showToast(error.type());
|
||||
finish();
|
||||
}).send();
|
||||
}
|
||||
|
||||
void ConfirmApproval(
|
||||
std::shared_ptr<Main::SessionShow> show,
|
||||
not_null<HistoryItem*> item,
|
||||
TimeId scheduleDate = 0,
|
||||
Fn<void()> accepted = nullptr) {
|
||||
const auto suggestion = item->Get<HistoryMessageSuggestedPost>();
|
||||
if (!suggestion
|
||||
|| suggestion->accepted
|
||||
|| suggestion->rejected
|
||||
|| suggestion->requestId) {
|
||||
return;
|
||||
}
|
||||
const auto id = item->fullId();
|
||||
const auto price = suggestion->price;
|
||||
const auto admin = item->history()->amMonoforumAdmin();
|
||||
if (!admin && !price.empty()) {
|
||||
const auto credits = &item->history()->session().credits();
|
||||
if (price.ton()) {
|
||||
if (!credits->tonLoaded()) {
|
||||
credits->tonLoad();
|
||||
return;
|
||||
} else if (price > credits->tonBalance()) {
|
||||
const auto peer = item->history()->peer;
|
||||
show->show(
|
||||
Box(HistoryView::InsufficientTonBox, peer, price));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!credits->loaded()) {
|
||||
credits->load();
|
||||
return;
|
||||
} else if (price > credits->balance()) {
|
||||
using namespace Settings;
|
||||
const auto peer = item->history()->peer;
|
||||
const auto broadcast = peer->monoforumBroadcast();
|
||||
const auto broadcastId = (broadcast ? broadcast : peer)->id;
|
||||
const auto done = [=](SmallBalanceResult result) {
|
||||
if (result == SmallBalanceResult::Success
|
||||
|| result == SmallBalanceResult::Already) {
|
||||
const auto item = peer->owner().message(id);
|
||||
if (item) {
|
||||
ConfirmApproval(
|
||||
show,
|
||||
item,
|
||||
scheduleDate,
|
||||
accepted);
|
||||
}
|
||||
}
|
||||
};
|
||||
MaybeRequestBalanceIncrease(
|
||||
show,
|
||||
int(base::SafeRound(price.value())),
|
||||
SmallBalanceForSuggest{ broadcastId },
|
||||
done);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
const auto peer = item->history()->peer;
|
||||
const auto session = &peer->session();
|
||||
const auto broadcast = peer->monoforumBroadcast();
|
||||
const auto channelName = (broadcast ? broadcast : peer)->name();
|
||||
const auto amount = admin
|
||||
? HistoryView::PriceAfterCommission(session, price)
|
||||
: price;
|
||||
const auto commission = HistoryView::FormatAfterCommissionPercent(
|
||||
session,
|
||||
price);
|
||||
const auto date = langDateTime(base::unixtime::parse(scheduleDate));
|
||||
show->show(Box([=](not_null<Ui::GenericBox*> box) {
|
||||
const auto callback = std::make_shared<Fn<void()>>();
|
||||
auto text = admin
|
||||
? tr::lng_suggest_accept_text(
|
||||
tr::now,
|
||||
lt_from,
|
||||
Ui::Text::Bold(item->from()->shortName()),
|
||||
Ui::Text::WithEntities)
|
||||
: tr::lng_suggest_accept_text_to(
|
||||
tr::now,
|
||||
lt_channel,
|
||||
Ui::Text::Bold(channelName),
|
||||
Ui::Text::WithEntities);
|
||||
if (price) {
|
||||
text.append("\n\n").append(admin
|
||||
? (scheduleDate
|
||||
? (amount.stars()
|
||||
? tr::lng_suggest_accept_receive_stars
|
||||
: tr::lng_suggest_accept_receive_ton)(
|
||||
tr::now,
|
||||
lt_count_decimal,
|
||||
amount.value(),
|
||||
lt_channel,
|
||||
Ui::Text::Bold(channelName),
|
||||
lt_percent,
|
||||
TextWithEntities{ commission },
|
||||
lt_date,
|
||||
Ui::Text::Bold(date),
|
||||
Ui::Text::RichLangValue)
|
||||
: (amount.stars()
|
||||
? tr::lng_suggest_accept_receive_now_stars
|
||||
: tr::lng_suggest_accept_receive_now_ton)(
|
||||
tr::now,
|
||||
lt_count_decimal,
|
||||
amount.value(),
|
||||
lt_channel,
|
||||
Ui::Text::Bold(channelName),
|
||||
lt_percent,
|
||||
TextWithEntities{ commission },
|
||||
Ui::Text::RichLangValue))
|
||||
: (scheduleDate
|
||||
? (amount.stars()
|
||||
? tr::lng_suggest_accept_pay_stars
|
||||
: tr::lng_suggest_accept_pay_ton)(
|
||||
tr::now,
|
||||
lt_count_decimal,
|
||||
amount.value(),
|
||||
lt_date,
|
||||
Ui::Text::Bold(date),
|
||||
Ui::Text::RichLangValue)
|
||||
: (amount.stars()
|
||||
? tr::lng_suggest_accept_pay_now_stars
|
||||
: tr::lng_suggest_accept_pay_now_ton)(
|
||||
tr::now,
|
||||
lt_count_decimal,
|
||||
amount.value(),
|
||||
Ui::Text::RichLangValue)));
|
||||
if (admin) {
|
||||
text.append(' ').append(
|
||||
tr::lng_suggest_accept_receive_if(
|
||||
tr::now,
|
||||
Ui::Text::RichLangValue));
|
||||
if (price.stars()) {
|
||||
text.append("\n\n").append(
|
||||
tr::lng_suggest_options_stars_warning(
|
||||
tr::now,
|
||||
Ui::Text::RichLangValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
Ui::ConfirmBox(box, {
|
||||
.text = text,
|
||||
.confirmed = [=](Fn<void()> close) { (*callback)(); close(); },
|
||||
.confirmText = tr::lng_suggest_accept_send(),
|
||||
.title = tr::lng_suggest_accept_title(),
|
||||
});
|
||||
*callback = [=, weak = Ui::MakeWeak(box)] {
|
||||
if (const auto onstack = accepted) {
|
||||
onstack();
|
||||
}
|
||||
const auto item = show->session().data().message(id);
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
SendApproval(show, item, scheduleDate);
|
||||
if (const auto strong = weak.data()) {
|
||||
strong->closeBox();
|
||||
}
|
||||
};
|
||||
}));
|
||||
}
|
||||
|
||||
void SendDecline(
|
||||
std::shared_ptr<Main::SessionShow> show,
|
||||
not_null<HistoryItem*> item,
|
||||
const QString &comment) {
|
||||
using Flag = MTPmessages_ToggleSuggestedPostApproval::Flag;
|
||||
const auto suggestion = item->Get<HistoryMessageSuggestedPost>();
|
||||
if (!suggestion
|
||||
|| suggestion->accepted
|
||||
|| suggestion->rejected
|
||||
|| suggestion->requestId) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto id = item->fullId();
|
||||
const auto session = &show->session();
|
||||
const auto finish = [=] {
|
||||
if (const auto item = session->data().message(id)) {
|
||||
const auto suggestion = item->Get<HistoryMessageSuggestedPost>();
|
||||
if (suggestion) {
|
||||
suggestion->requestId = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
suggestion->requestId = session->api().request(
|
||||
MTPmessages_ToggleSuggestedPostApproval(
|
||||
MTP_flags(Flag::f_reject
|
||||
| (comment.isEmpty() ? Flag() : Flag::f_reject_comment)),
|
||||
item->history()->peer->input,
|
||||
MTP_int(item->id.bare),
|
||||
MTPint(), // schedule_date
|
||||
MTP_string(comment))
|
||||
).done([=](const MTPUpdates &result) {
|
||||
session->api().applyUpdates(result);
|
||||
finish();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
show->showToast(error.type());
|
||||
finish();
|
||||
}).send();
|
||||
}
|
||||
|
||||
void RequestApprovalDate(
|
||||
std::shared_ptr<Main::SessionShow> show,
|
||||
not_null<HistoryItem*> item) {
|
||||
const auto id = item->fullId();
|
||||
const auto weak = std::make_shared<QPointer<Ui::BoxContent>>();
|
||||
const auto close = [=] {
|
||||
if (const auto strong = weak->data()) {
|
||||
strong->closeBox();
|
||||
}
|
||||
};
|
||||
const auto done = [=](TimeId result) {
|
||||
if (const auto item = show->session().data().message(id)) {
|
||||
ConfirmApproval(show, item, result, close);
|
||||
} else {
|
||||
close();
|
||||
}
|
||||
};
|
||||
using namespace HistoryView;
|
||||
auto dateBox = Box(ChooseSuggestTimeBox, SuggestTimeBoxArgs{
|
||||
.session = &show->session(),
|
||||
.done = done,
|
||||
.mode = SuggestMode::Publish,
|
||||
});
|
||||
*weak = dateBox.data();
|
||||
show->show(std::move(dateBox));
|
||||
}
|
||||
|
||||
void RequestDeclineComment(
|
||||
std::shared_ptr<Main::SessionShow> show,
|
||||
not_null<HistoryItem*> item) {
|
||||
const auto id = item->fullId();
|
||||
const auto admin = item->history()->amMonoforumAdmin();
|
||||
const auto peer = item->history()->peer;
|
||||
const auto broadcast = peer->monoforumBroadcast();
|
||||
const auto channelName = (broadcast ? broadcast : peer)->name();
|
||||
show->show(Box([=](not_null<Ui::GenericBox*> box) {
|
||||
const auto callback = std::make_shared<Fn<void()>>();
|
||||
Ui::ConfirmBox(box, {
|
||||
.text = (admin
|
||||
? tr::lng_suggest_decline_text(
|
||||
lt_from,
|
||||
rpl::single(Ui::Text::Bold(item->from()->shortName())),
|
||||
Ui::Text::WithEntities)
|
||||
: tr::lng_suggest_decline_text_to(
|
||||
lt_channel,
|
||||
rpl::single(Ui::Text::Bold(channelName)),
|
||||
Ui::Text::WithEntities)),
|
||||
.confirmed = [=](Fn<void()> close) { (*callback)(); close(); },
|
||||
.confirmText = tr::lng_suggest_action_decline(),
|
||||
.confirmStyle = &st::attentionBoxButton,
|
||||
.title = tr::lng_suggest_decline_title(),
|
||||
});
|
||||
const auto reason = box->addRow(object_ptr<Ui::InputField>(
|
||||
box,
|
||||
st::factcheckField,
|
||||
Ui::InputField::Mode::NoNewlines,
|
||||
tr::lng_suggest_decline_reason()));
|
||||
box->setFocusCallback([=] {
|
||||
reason->setFocusFast();
|
||||
});
|
||||
*callback = [=, weak = Ui::MakeWeak(box)] {
|
||||
const auto item = show->session().data().message(id);
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
SendDecline(show, item, reason->getLastText().trimmed());
|
||||
if (const auto strong = weak.data()) {
|
||||
strong->closeBox();
|
||||
}
|
||||
};
|
||||
reason->submits(
|
||||
) | rpl::start_with_next([=](Qt::KeyboardModifiers modifiers) {
|
||||
if (!(modifiers & Qt::ShiftModifier)) {
|
||||
(*callback)();
|
||||
}
|
||||
}, box->lifetime());
|
||||
}));
|
||||
}
|
||||
|
||||
struct SendSuggestState {
|
||||
SendPaymentHelper sendPayment;
|
||||
};
|
||||
void SendSuggest(
|
||||
std::shared_ptr<Main::SessionShow> show,
|
||||
not_null<HistoryItem*> item,
|
||||
std::shared_ptr<SendSuggestState> state,
|
||||
Fn<void(SuggestPostOptions&)> modify,
|
||||
Fn<void()> done = nullptr,
|
||||
int starsApproved = 0) {
|
||||
const auto suggestion = item->Get<HistoryMessageSuggestedPost>();
|
||||
const auto id = item->fullId();
|
||||
const auto withPaymentApproved = [=](int stars) {
|
||||
if (const auto item = show->session().data().message(id)) {
|
||||
SendSuggest(show, item, state, modify, done, stars);
|
||||
}
|
||||
};
|
||||
const auto isForward = item->Get<HistoryMessageForwarded>();
|
||||
auto action = SendAction(item->history());
|
||||
action.options.suggest.exists = 1;
|
||||
if (suggestion) {
|
||||
action.options.suggest.date = suggestion->date;
|
||||
action.options.suggest.priceWhole = suggestion->price.whole();
|
||||
action.options.suggest.priceNano = suggestion->price.nano();
|
||||
action.options.suggest.ton = suggestion->price.ton() ? 1 : 0;
|
||||
}
|
||||
modify(action.options.suggest);
|
||||
action.options.starsApproved = starsApproved;
|
||||
action.replyTo.monoforumPeerId = item->history()->amMonoforumAdmin()
|
||||
? item->sublistPeerId()
|
||||
: PeerId();
|
||||
action.replyTo.messageId = item->fullId();
|
||||
|
||||
const auto checked = state->sendPayment.check(
|
||||
show,
|
||||
item->history()->peer,
|
||||
action.options,
|
||||
1,
|
||||
withPaymentApproved);
|
||||
if (!checked) {
|
||||
return;
|
||||
}
|
||||
|
||||
show->session().api().sendAction(action);
|
||||
show->session().api().forwardMessages({
|
||||
.items = { item },
|
||||
.options = (isForward
|
||||
? Data::ForwardOptions::PreserveInfo
|
||||
: Data::ForwardOptions::NoSenderNames),
|
||||
}, action);
|
||||
if (const auto onstack = done) {
|
||||
onstack();
|
||||
}
|
||||
}
|
||||
|
||||
void SuggestApprovalDate(
|
||||
std::shared_ptr<Main::SessionShow> show,
|
||||
not_null<HistoryItem*> item) {
|
||||
const auto suggestion = item->Get<HistoryMessageSuggestedPost>();
|
||||
if (!suggestion) {
|
||||
return;
|
||||
}
|
||||
const auto id = item->fullId();
|
||||
const auto state = std::make_shared<SendSuggestState>();
|
||||
const auto weak = std::make_shared<QPointer<Ui::BoxContent>>();
|
||||
const auto done = [=](TimeId result) {
|
||||
const auto item = show->session().data().message(id);
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
const auto close = [=] {
|
||||
if (const auto strong = weak->data()) {
|
||||
strong->closeBox();
|
||||
}
|
||||
};
|
||||
SendSuggest(
|
||||
show,
|
||||
item,
|
||||
state,
|
||||
[=](SuggestPostOptions &options) { options.date = result; },
|
||||
close);
|
||||
};
|
||||
using namespace HistoryView;
|
||||
auto dateBox = Box(ChooseSuggestTimeBox, SuggestTimeBoxArgs{
|
||||
.session = &show->session(),
|
||||
.done = done,
|
||||
.value = suggestion->date,
|
||||
.mode = SuggestMode::Change,
|
||||
});
|
||||
*weak = dateBox.data();
|
||||
show->show(std::move(dateBox));
|
||||
}
|
||||
|
||||
void SuggestOfferForMessage(
|
||||
std::shared_ptr<Main::SessionShow> show,
|
||||
not_null<HistoryItem*> item,
|
||||
SuggestPostOptions values,
|
||||
HistoryView::SuggestMode mode) {
|
||||
const auto id = item->fullId();
|
||||
const auto state = std::make_shared<SendSuggestState>();
|
||||
const auto weak = std::make_shared<QPointer<Ui::BoxContent>>();
|
||||
const auto done = [=](SuggestPostOptions result) {
|
||||
const auto item = show->session().data().message(id);
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
const auto close = [=] {
|
||||
if (const auto strong = weak->data()) {
|
||||
strong->closeBox();
|
||||
}
|
||||
};
|
||||
SendSuggest(
|
||||
show,
|
||||
item,
|
||||
state,
|
||||
[=](SuggestPostOptions &options) { options = result; },
|
||||
close);
|
||||
};
|
||||
using namespace HistoryView;
|
||||
auto priceBox = Box(ChooseSuggestPriceBox, SuggestPriceBoxArgs{
|
||||
.peer = item->history()->peer,
|
||||
.done = done,
|
||||
.value = values,
|
||||
.mode = mode,
|
||||
});
|
||||
*weak = priceBox.data();
|
||||
show->show(std::move(priceBox));
|
||||
}
|
||||
|
||||
void SuggestApprovalPrice(
|
||||
std::shared_ptr<Main::SessionShow> show,
|
||||
not_null<HistoryItem*> item) {
|
||||
const auto suggestion = item->Get<HistoryMessageSuggestedPost>();
|
||||
if (!suggestion) {
|
||||
return;
|
||||
}
|
||||
using namespace HistoryView;
|
||||
SuggestOfferForMessage(show, item, {
|
||||
.exists = uint32(1),
|
||||
.priceWhole = uint32(suggestion->price.whole()),
|
||||
.priceNano = uint32(suggestion->price.nano()),
|
||||
.ton = uint32(suggestion->price.ton() ? 1 : 0),
|
||||
.date = suggestion->date,
|
||||
}, SuggestMode::Change);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
std::shared_ptr<ClickHandler> AcceptClickHandler(
|
||||
not_null<HistoryItem*> item) {
|
||||
const auto session = &item->history()->session();
|
||||
const auto id = item->fullId();
|
||||
return std::make_shared<LambdaClickHandler>([=](ClickContext context) {
|
||||
const auto my = context.other.value<ClickHandlerContext>();
|
||||
const auto controller = my.sessionWindow.get();
|
||||
if (!controller || &controller->session() != session) {
|
||||
return;
|
||||
}
|
||||
const auto item = session->data().message(id);
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
const auto show = controller->uiShow();
|
||||
const auto suggestion = item->Get<HistoryMessageSuggestedPost>();
|
||||
if (!suggestion) {
|
||||
return;
|
||||
} else if (!suggestion->date) {
|
||||
RequestApprovalDate(show, item);
|
||||
} else {
|
||||
ConfirmApproval(show, item);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
std::shared_ptr<ClickHandler> DeclineClickHandler(
|
||||
not_null<HistoryItem*> item) {
|
||||
const auto session = &item->history()->session();
|
||||
const auto id = item->fullId();
|
||||
return std::make_shared<LambdaClickHandler>([=](ClickContext context) {
|
||||
const auto my = context.other.value<ClickHandlerContext>();
|
||||
const auto controller = my.sessionWindow.get();
|
||||
if (!controller || &controller->session() != session) {
|
||||
return;
|
||||
}
|
||||
const auto item = session->data().message(id);
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
RequestDeclineComment(controller->uiShow(), item);
|
||||
});
|
||||
}
|
||||
|
||||
std::shared_ptr<ClickHandler> SuggestChangesClickHandler(
|
||||
not_null<HistoryItem*> item) {
|
||||
const auto session = &item->history()->session();
|
||||
const auto id = item->fullId();
|
||||
return std::make_shared<LambdaClickHandler>([=](ClickContext context) {
|
||||
const auto my = context.other.value<ClickHandlerContext>();
|
||||
const auto window = my.sessionWindow.get();
|
||||
if (!window || &window->session() != session) {
|
||||
return;
|
||||
}
|
||||
const auto item = session->data().message(id);
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
const auto menu = Ui::CreateChild<Ui::PopupMenu>(
|
||||
window->widget(),
|
||||
st::popupMenuWithIcons);
|
||||
if (HistoryView::CanEditSuggestedMessage(item)) {
|
||||
menu->addAction(tr::lng_suggest_menu_edit_message(tr::now), [=] {
|
||||
const auto item = session->data().message(id);
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
const auto suggestion = item->Get<HistoryMessageSuggestedPost>();
|
||||
if (!suggestion) {
|
||||
return;
|
||||
}
|
||||
const auto history = item->history();
|
||||
const auto editData = PrepareEditText(item);
|
||||
const auto cursor = MessageCursor{
|
||||
int(editData.text.size()),
|
||||
int(editData.text.size()),
|
||||
Ui::kQFixedMax
|
||||
};
|
||||
const auto monoforumPeerId = history->amMonoforumAdmin()
|
||||
? item->sublistPeerId()
|
||||
: PeerId();
|
||||
const auto previewDraft = Data::WebPageDraft::FromItem(item);
|
||||
history->setLocalEditDraft(std::make_unique<Data::Draft>(
|
||||
editData,
|
||||
FullReplyTo{
|
||||
.messageId = FullMsgId(history->peer->id, item->id),
|
||||
.monoforumPeerId = monoforumPeerId,
|
||||
},
|
||||
SuggestPostOptions{
|
||||
.exists = uint32(1),
|
||||
.priceWhole = uint32(suggestion->price.whole()),
|
||||
.priceNano = uint32(suggestion->price.nano()),
|
||||
.ton = uint32(suggestion->price.ton() ? 1 : 0),
|
||||
.date = suggestion->date,
|
||||
},
|
||||
cursor,
|
||||
previewDraft));
|
||||
history->session().changes().entryUpdated(
|
||||
(monoforumPeerId
|
||||
? item->savedSublist()
|
||||
: (Data::Thread*)history.get()),
|
||||
Data::EntryUpdate::Flag::LocalDraftSet);
|
||||
}, &st::menuIconEdit);
|
||||
}
|
||||
menu->addAction(tr::lng_suggest_menu_edit_price(tr::now), [=] {
|
||||
if (const auto item = session->data().message(id)) {
|
||||
SuggestApprovalPrice(window->uiShow(), item);
|
||||
}
|
||||
}, &st::menuIconTagSell);
|
||||
menu->addAction(tr::lng_suggest_menu_edit_time(tr::now), [=] {
|
||||
if (const auto item = session->data().message(id)) {
|
||||
SuggestApprovalDate(window->uiShow(), item);
|
||||
}
|
||||
}, &st::menuIconSchedule);
|
||||
menu->popup(QCursor::pos());
|
||||
});
|
||||
}
|
||||
|
||||
void AddOfferToMessage(
|
||||
std::shared_ptr<Main::SessionShow> show,
|
||||
FullMsgId itemId) {
|
||||
const auto session = &show->session();
|
||||
const auto item = session->data().message(itemId);
|
||||
if (!item || !HistoryView::CanAddOfferToMessage(item)) {
|
||||
return;
|
||||
}
|
||||
SuggestOfferForMessage(show, item, {}, HistoryView::SuggestMode::New);
|
||||
}
|
||||
|
||||
} // namespace Api
|
||||
29
Telegram/SourceFiles/api/api_suggest_post.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
class ClickHandler;
|
||||
|
||||
namespace Main {
|
||||
class SessionShow;
|
||||
} // namespace Main
|
||||
|
||||
namespace Api {
|
||||
|
||||
[[nodiscard]] std::shared_ptr<ClickHandler> AcceptClickHandler(
|
||||
not_null<HistoryItem*> item);
|
||||
[[nodiscard]] std::shared_ptr<ClickHandler> DeclineClickHandler(
|
||||
not_null<HistoryItem*> item);
|
||||
[[nodiscard]] std::shared_ptr<ClickHandler> SuggestChangesClickHandler(
|
||||
not_null<HistoryItem*> item);
|
||||
|
||||
void AddOfferToMessage(
|
||||
std::shared_ptr<Main::SessionShow> show,
|
||||
FullMsgId itemId);
|
||||
|
||||
} // namespace Api
|
||||
@@ -202,7 +202,11 @@ EntitiesInText EntitiesFromMTP(
|
||||
d.vlength().v,
|
||||
});
|
||||
}, [&](const MTPDmessageEntityBankCard &d) {
|
||||
// Skipping cards. // #TODO entities
|
||||
result.push_back({
|
||||
EntityType::BankCard,
|
||||
d.voffset().v,
|
||||
d.vlength().v,
|
||||
});
|
||||
}, [&](const MTPDmessageEntitySpoiler &d) {
|
||||
result.push_back({
|
||||
EntityType::Spoiler,
|
||||
@@ -273,6 +277,9 @@ MTPVector<MTPMessageEntity> EntitiesToMTP(
|
||||
case EntityType::Phone: {
|
||||
v.push_back(MTP_messageEntityPhone(offset, length));
|
||||
} break;
|
||||
case EntityType::BankCard: {
|
||||
v.push_back(MTP_messageEntityBankCard(offset, length));
|
||||
} break;
|
||||
case EntityType::Hashtag: {
|
||||
v.push_back(MTP_messageEntityHashtag(offset, length));
|
||||
} break;
|
||||
|
||||
257
Telegram/SourceFiles/api/api_todo_lists.cpp
Normal file
@@ -0,0 +1,257 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "api/api_todo_lists.h"
|
||||
|
||||
#include "api/api_editing.h"
|
||||
#include "apiwrap.h"
|
||||
#include "base/random.h"
|
||||
#include "data/business/data_shortcut_messages.h" // ShortcutIdToMTP
|
||||
#include "data/data_changes.h"
|
||||
#include "data/data_histories.h"
|
||||
#include "data/data_todo_list.h"
|
||||
#include "data/data_session.h"
|
||||
#include "history/history.h"
|
||||
#include "history/history_item.h"
|
||||
#include "history/history_item_helpers.h" // ShouldSendSilent
|
||||
#include "main/main_session.h"
|
||||
|
||||
namespace Api {
|
||||
namespace {
|
||||
|
||||
constexpr auto kSendTogglesDelay = 3 * crl::time(1000);
|
||||
|
||||
[[nodiscard]] TimeId UnixtimeFromMsgId(mtpMsgId msgId) {
|
||||
return TimeId(msgId >> 32);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
TodoLists::TodoLists(not_null<ApiWrap*> api)
|
||||
: _session(&api->session())
|
||||
, _api(&api->instance())
|
||||
, _sendTimer([=] { sendAccumulatedToggles(false); }) {
|
||||
}
|
||||
|
||||
void TodoLists::create(
|
||||
const TodoListData &data,
|
||||
SendAction action,
|
||||
Fn<void()> done,
|
||||
Fn<void(QString)> fail) {
|
||||
_session->api().sendAction(action);
|
||||
|
||||
const auto history = action.history;
|
||||
const auto peer = history->peer;
|
||||
const auto topicRootId = action.replyTo.messageId
|
||||
? action.replyTo.topicRootId
|
||||
: 0;
|
||||
const auto monoforumPeerId = action.replyTo.monoforumPeerId;
|
||||
auto sendFlags = MTPmessages_SendMedia::Flags(0);
|
||||
if (action.replyTo) {
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_reply_to;
|
||||
}
|
||||
const auto clearCloudDraft = action.clearDraft;
|
||||
if (clearCloudDraft) {
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_clear_draft;
|
||||
history->clearLocalDraft(topicRootId, monoforumPeerId);
|
||||
history->clearCloudDraft(topicRootId, monoforumPeerId);
|
||||
history->startSavingCloudDraft(topicRootId, monoforumPeerId);
|
||||
}
|
||||
const auto silentPost = ShouldSendSilent(peer, action.options);
|
||||
const auto starsPaid = std::min(
|
||||
peer->starsPerMessageChecked(),
|
||||
action.options.starsApproved);
|
||||
if (silentPost) {
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_silent;
|
||||
}
|
||||
if (action.options.scheduled) {
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_schedule_date;
|
||||
}
|
||||
if (action.options.shortcutId) {
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_quick_reply_shortcut;
|
||||
}
|
||||
if (action.options.effectId) {
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_effect;
|
||||
}
|
||||
if (action.options.suggest) {
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_suggested_post;
|
||||
}
|
||||
if (starsPaid) {
|
||||
action.options.starsApproved -= starsPaid;
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_allow_paid_stars;
|
||||
}
|
||||
const auto sendAs = action.options.sendAs;
|
||||
if (sendAs) {
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_send_as;
|
||||
}
|
||||
auto &histories = history->owner().histories();
|
||||
const auto randomId = base::RandomValue<uint64>();
|
||||
histories.sendPreparedMessage(
|
||||
history,
|
||||
action.replyTo,
|
||||
randomId,
|
||||
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
|
||||
MTP_flags(sendFlags),
|
||||
peer->input,
|
||||
Data::Histories::ReplyToPlaceholder(),
|
||||
TodoListDataToInputMedia(&data),
|
||||
MTP_string(),
|
||||
MTP_long(randomId),
|
||||
MTPReplyMarkup(),
|
||||
MTPVector<MTPMessageEntity>(),
|
||||
MTP_int(action.options.scheduled),
|
||||
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
|
||||
Data::ShortcutIdToMTP(_session, action.options.shortcutId),
|
||||
MTP_long(action.options.effectId),
|
||||
MTP_long(starsPaid),
|
||||
SuggestToMTP(action.options.suggest)
|
||||
), [=](const MTPUpdates &result, const MTP::Response &response) {
|
||||
if (clearCloudDraft) {
|
||||
history->finishSavingCloudDraft(
|
||||
topicRootId,
|
||||
monoforumPeerId,
|
||||
UnixtimeFromMsgId(response.outerMsgId));
|
||||
}
|
||||
_session->changes().historyUpdated(
|
||||
history,
|
||||
(action.options.scheduled
|
||||
? Data::HistoryUpdate::Flag::ScheduledSent
|
||||
: Data::HistoryUpdate::Flag::MessageSent));
|
||||
if (const auto onstack = done) {
|
||||
onstack();
|
||||
}
|
||||
}, [=](const MTP::Error &error, const MTP::Response &response) {
|
||||
if (clearCloudDraft) {
|
||||
history->finishSavingCloudDraft(
|
||||
topicRootId,
|
||||
monoforumPeerId,
|
||||
UnixtimeFromMsgId(response.outerMsgId));
|
||||
}
|
||||
if (const auto onstack = fail) {
|
||||
onstack(error.type());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void TodoLists::edit(
|
||||
not_null<HistoryItem*> item,
|
||||
const TodoListData &data,
|
||||
SendOptions options,
|
||||
Fn<void()> done,
|
||||
Fn<void(QString)> fail) {
|
||||
EditTodoList(item, data, options, [=](mtpRequestId) {
|
||||
if (const auto onstack = done) {
|
||||
onstack();
|
||||
}
|
||||
}, [=](const QString &error, mtpRequestId) {
|
||||
if (const auto onstack = fail) {
|
||||
onstack(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void TodoLists::add(
|
||||
not_null<HistoryItem*> item,
|
||||
const std::vector<TodoListItem> &items,
|
||||
Fn<void()> done,
|
||||
Fn<void(QString)> fail) {
|
||||
if (items.empty()) {
|
||||
return;
|
||||
}
|
||||
const auto session = _session;
|
||||
_session->api().request(MTPmessages_AppendTodoList(
|
||||
item->history()->peer->input,
|
||||
MTP_int(item->id.bare),
|
||||
TodoListItemsToMTP(&item->history()->session(), items)
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
session->api().applyUpdates(result);
|
||||
if (const auto onstack = done) {
|
||||
onstack();
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
if (const auto onstack = fail) {
|
||||
onstack(error.type());
|
||||
}
|
||||
}).send();
|
||||
}
|
||||
|
||||
void TodoLists::toggleCompletion(FullMsgId itemId, int id, bool completed) {
|
||||
auto &entry = _toggles[itemId];
|
||||
if (completed) {
|
||||
const auto changed1 = entry.completed.emplace(id).second;
|
||||
const auto changed2 = entry.incompleted.remove(id);
|
||||
if (!changed1 && !changed2) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
const auto changed1 = entry.incompleted.emplace(id).second;
|
||||
const auto changed2 = entry.completed.remove(id);
|
||||
if (!changed1 && !changed2) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
entry.scheduled = crl::now();
|
||||
if (!entry.requestId && !_sendTimer.isActive()) {
|
||||
_sendTimer.callOnce(kSendTogglesDelay);
|
||||
}
|
||||
}
|
||||
|
||||
void TodoLists::sendAccumulatedToggles(bool force) {
|
||||
const auto now = crl::now();
|
||||
auto nearest = crl::time(0);
|
||||
for (auto &[itemId, entry] : _toggles) {
|
||||
if (entry.requestId) {
|
||||
continue;
|
||||
}
|
||||
const auto wait = entry.scheduled + kSendTogglesDelay - now;
|
||||
if (wait <= 0) {
|
||||
entry.scheduled = 0;
|
||||
send(itemId, entry);
|
||||
} else if (!nearest || nearest > wait) {
|
||||
nearest = wait;
|
||||
}
|
||||
}
|
||||
if (nearest > 0) {
|
||||
_sendTimer.callOnce(nearest);
|
||||
}
|
||||
}
|
||||
|
||||
void TodoLists::send(FullMsgId itemId, Accumulated &entry) {
|
||||
const auto item = _session->data().message(itemId);
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
auto completed = entry.completed
|
||||
| ranges::views::transform([](int id) { return MTP_int(id); });
|
||||
auto incompleted = entry.incompleted
|
||||
| ranges::views::transform([](int id) { return MTP_int(id); });
|
||||
entry.requestId = _api.request(MTPmessages_ToggleTodoCompleted(
|
||||
item->history()->peer->input,
|
||||
MTP_int(item->id),
|
||||
MTP_vector_from_range(completed),
|
||||
MTP_vector_from_range(incompleted)
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
_session->api().applyUpdates(result);
|
||||
finishRequest(itemId);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
finishRequest(itemId);
|
||||
}).send();
|
||||
entry.completed.clear();
|
||||
entry.incompleted.clear();
|
||||
}
|
||||
|
||||
void TodoLists::finishRequest(FullMsgId itemId) {
|
||||
auto &entry = _toggles[itemId];
|
||||
entry.requestId = 0;
|
||||
if (entry.completed.empty() && entry.incompleted.empty()) {
|
||||
_toggles.remove(itemId);
|
||||
} else {
|
||||
sendAccumulatedToggles(false);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Api
|
||||
69
Telegram/SourceFiles/api/api_todo_lists.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "base/timer.h"
|
||||
#include "mtproto/sender.h"
|
||||
|
||||
class ApiWrap;
|
||||
class HistoryItem;
|
||||
struct TodoListItem;
|
||||
struct TodoListData;
|
||||
|
||||
namespace Main {
|
||||
class Session;
|
||||
} // namespace Main
|
||||
|
||||
namespace Api {
|
||||
|
||||
struct SendAction;
|
||||
struct SendOptions;
|
||||
|
||||
class TodoLists final {
|
||||
public:
|
||||
explicit TodoLists(not_null<ApiWrap*> api);
|
||||
|
||||
void create(
|
||||
const TodoListData &data,
|
||||
SendAction action,
|
||||
Fn<void()> done,
|
||||
Fn<void(QString)> fail);
|
||||
void edit(
|
||||
not_null<HistoryItem*> item,
|
||||
const TodoListData &data,
|
||||
SendOptions options,
|
||||
Fn<void()> done,
|
||||
Fn<void(QString)> fail);
|
||||
void add(
|
||||
not_null<HistoryItem*> item,
|
||||
const std::vector<TodoListItem> &items,
|
||||
Fn<void()> done,
|
||||
Fn<void(QString)> fail);
|
||||
void toggleCompletion(FullMsgId itemId, int id, bool completed);
|
||||
|
||||
private:
|
||||
struct Accumulated {
|
||||
base::flat_set<int> completed;
|
||||
base::flat_set<int> incompleted;
|
||||
crl::time scheduled = 0;
|
||||
mtpRequestId requestId = 0;
|
||||
};
|
||||
|
||||
void sendAccumulatedToggles(bool force);
|
||||
void send(FullMsgId itemId, Accumulated &entry);
|
||||
void finishRequest(FullMsgId itemId);
|
||||
|
||||
const not_null<Main::Session*> _session;
|
||||
MTP::Sender _api;
|
||||
|
||||
base::flat_map<FullMsgId, Accumulated> _toggles;
|
||||
base::Timer _sendTimer;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Api
|
||||
@@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_peer.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_forum_topic.h"
|
||||
#include "data/data_saved_sublist.h"
|
||||
#include "data/data_session.h"
|
||||
#include "main/main_session.h"
|
||||
#include "history/history.h"
|
||||
@@ -31,7 +32,9 @@ UnreadThings::UnreadThings(not_null<ApiWrap*> api) : _api(api) {
|
||||
|
||||
bool UnreadThings::trackMentions(Data::Thread *thread) const {
|
||||
const auto peer = thread ? thread->peer().get() : nullptr;
|
||||
return peer && (peer->isChat() || peer->isMegagroup());
|
||||
return peer
|
||||
&& (peer->isChat() || peer->isMegagroup())
|
||||
&& !peer->isMonoforum();
|
||||
}
|
||||
|
||||
bool UnreadThings::trackReactions(Data::Thread *thread) const {
|
||||
@@ -93,7 +96,7 @@ void UnreadThings::cancelRequests(not_null<Data::Thread*> thread) {
|
||||
void UnreadThings::requestMentions(
|
||||
not_null<Data::Thread*> thread,
|
||||
int loaded) {
|
||||
if (_mentionsRequests.contains(thread)) {
|
||||
if (_mentionsRequests.contains(thread) || thread->asSublist()) {
|
||||
return;
|
||||
}
|
||||
const auto offsetId = std::max(
|
||||
@@ -138,12 +141,15 @@ void UnreadThings::requestReactions(
|
||||
const auto maxId = 0;
|
||||
const auto minId = 0;
|
||||
const auto history = thread->owningHistory();
|
||||
const auto sublist = thread->asSublist();
|
||||
const auto topic = thread->asTopic();
|
||||
using Flag = MTPmessages_GetUnreadReactions::Flag;
|
||||
const auto requestId = _api->request(MTPmessages_GetUnreadReactions(
|
||||
MTP_flags(topic ? Flag::f_top_msg_id : Flag()),
|
||||
MTP_flags((topic ? Flag::f_top_msg_id : Flag())
|
||||
| (sublist ? Flag::f_saved_peer_id : Flag())),
|
||||
history->peer->input,
|
||||
MTP_int(topic ? topic->rootId() : 0),
|
||||
(sublist ? sublist->sublistPeer()->input : MTPInputPeer()),
|
||||
MTP_int(offsetId),
|
||||
MTP_int(addOffset),
|
||||
MTP_int(limit),
|
||||
|
||||
@@ -23,6 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "mtproto/mtproto_dc_options.h"
|
||||
#include "data/business/data_shortcut_messages.h"
|
||||
#include "data/components/credits.h"
|
||||
#include "data/components/promo_suggestions.h"
|
||||
#include "data/components/scheduled_messages.h"
|
||||
#include "data/components/top_peers.h"
|
||||
#include "data/notify/data_notify_settings.h"
|
||||
@@ -1227,7 +1228,8 @@ void Updates::applyUpdatesNoPtsCheck(const MTPUpdates &updates) {
|
||||
MTPlong(), // effect
|
||||
MTPFactCheck(),
|
||||
MTPint(), // report_delivery_until_date
|
||||
MTPlong()), // paid_message_stars
|
||||
MTPlong(), // paid_message_stars
|
||||
MTPSuggestedPost()),
|
||||
MessageFlags(),
|
||||
NewMessageType::Unread);
|
||||
} break;
|
||||
@@ -1266,7 +1268,8 @@ void Updates::applyUpdatesNoPtsCheck(const MTPUpdates &updates) {
|
||||
MTPlong(), // effect
|
||||
MTPFactCheck(),
|
||||
MTPint(), // report_delivery_until_date
|
||||
MTPlong()), // paid_message_stars
|
||||
MTPlong(), // paid_message_stars
|
||||
MTPSuggestedPost()),
|
||||
MessageFlags(),
|
||||
NewMessageType::Unread);
|
||||
} break;
|
||||
@@ -1915,7 +1918,7 @@ void Updates::feedUpdate(const MTPUpdate &update) {
|
||||
|
||||
// Update web page anyway.
|
||||
session().data().processWebpage(d.vwebpage());
|
||||
session().data().sendWebPageGamePollNotifications();
|
||||
session().data().sendWebPageGamePollTodoListNotifications();
|
||||
|
||||
updateAndApply(d.vpts().v, d.vpts_count().v, update);
|
||||
} break;
|
||||
@@ -1925,7 +1928,7 @@ void Updates::feedUpdate(const MTPUpdate &update) {
|
||||
|
||||
// Update web page anyway.
|
||||
session().data().processWebpage(d.vwebpage());
|
||||
session().data().sendWebPageGamePollNotifications();
|
||||
session().data().sendWebPageGamePollTodoListNotifications();
|
||||
|
||||
auto channel = session().data().channelLoaded(d.vchannel_id());
|
||||
if (channel && !_handlingChannelDifference) {
|
||||
@@ -2068,6 +2071,7 @@ void Updates::feedUpdate(const MTPUpdate &update) {
|
||||
|
||||
case mtpc_updateConfig: {
|
||||
session().mtp().requestConfig();
|
||||
session().promoSuggestions().invalidate();
|
||||
} break;
|
||||
|
||||
case mtpc_updateUserPhone: {
|
||||
@@ -2440,6 +2444,32 @@ void Updates::feedUpdate(const MTPUpdate &update) {
|
||||
session().data().updateRepliesReadTill({ id, readTillId, true });
|
||||
} break;
|
||||
|
||||
case mtpc_updateReadMonoForumInbox: {
|
||||
const auto &d = update.c_updateReadMonoForumInbox();
|
||||
const auto parentChatId = ChannelId(d.vchannel_id());
|
||||
const auto sublistPeerId = peerFromMTP(d.vsaved_peer_id());
|
||||
const auto readTillId = d.vread_max_id().v;
|
||||
session().data().updateSublistReadTill({
|
||||
parentChatId,
|
||||
sublistPeerId,
|
||||
readTillId,
|
||||
false,
|
||||
});
|
||||
} break;
|
||||
|
||||
case mtpc_updateReadMonoForumOutbox: {
|
||||
const auto &d = update.c_updateReadMonoForumOutbox();
|
||||
const auto parentChatId = ChannelId(d.vchannel_id());
|
||||
const auto sublistPeerId = peerFromMTP(d.vsaved_peer_id());
|
||||
const auto readTillId = d.vread_max_id().v;
|
||||
session().data().updateSublistReadTill({
|
||||
parentChatId,
|
||||
sublistPeerId,
|
||||
readTillId,
|
||||
true,
|
||||
});
|
||||
} break;
|
||||
|
||||
case mtpc_updateChannelAvailableMessages: {
|
||||
auto &d = update.c_updateChannelAvailableMessages();
|
||||
if (const auto channel = session().data().channelLoaded(d.vchannel_id())) {
|
||||
@@ -2659,13 +2689,22 @@ void Updates::feedUpdate(const MTPUpdate &update) {
|
||||
const auto &data = update.c_updateDraftMessage();
|
||||
const auto peerId = peerFromMTP(data.vpeer());
|
||||
const auto topicRootId = data.vtop_msg_id().value_or_empty();
|
||||
const auto monoforumPeerId = data.vsaved_peer_id()
|
||||
? peerFromMTP(*data.vsaved_peer_id())
|
||||
: PeerId();
|
||||
data.vdraft().match([&](const MTPDdraftMessage &data) {
|
||||
Data::ApplyPeerCloudDraft(&session(), peerId, topicRootId, data);
|
||||
Data::ApplyPeerCloudDraft(
|
||||
&session(),
|
||||
peerId,
|
||||
topicRootId,
|
||||
monoforumPeerId,
|
||||
data);
|
||||
}, [&](const MTPDdraftMessageEmpty &data) {
|
||||
Data::ClearPeerCloudDraft(
|
||||
&session(),
|
||||
peerId,
|
||||
topicRootId,
|
||||
monoforumPeerId,
|
||||
data.vdate().value_or_empty());
|
||||
});
|
||||
} break;
|
||||
|
||||
@@ -712,7 +712,8 @@ bool WhoReadExists(not_null<HistoryItem*> item) {
|
||||
const auto megagroup = peer->asMegagroup();
|
||||
if ((!chat && !megagroup)
|
||||
|| (megagroup
|
||||
&& (megagroup->flags() & ChannelDataFlag::ParticipantsHidden))) {
|
||||
&& (megagroup->flags() & ChannelDataFlag::ParticipantsHidden))
|
||||
|| (megagroup && megagroup->isMonoforum())) {
|
||||
return false;
|
||||
}
|
||||
const auto &appConfig = peer->session().appConfig();
|
||||
|
||||
@@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "api/api_polls.h"
|
||||
#include "api/api_sending.h"
|
||||
#include "api/api_text_entities.h"
|
||||
#include "api/api_todo_lists.h"
|
||||
#include "api/api_self_destruct.h"
|
||||
#include "api/api_sensitive_content.h"
|
||||
#include "api/api_global_privacy.h"
|
||||
@@ -42,6 +43,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_folder.h"
|
||||
#include "data/data_forum_topic.h"
|
||||
#include "data/data_forum.h"
|
||||
#include "data/data_saved_messages.h"
|
||||
#include "data/data_saved_sublist.h"
|
||||
#include "data/data_search_controller.h"
|
||||
#include "data/data_session.h"
|
||||
@@ -91,8 +93,6 @@ namespace {
|
||||
// Save draft to the cloud with 1 sec extra delay.
|
||||
constexpr auto kSaveCloudDraftTimeout = 1000;
|
||||
|
||||
constexpr auto kTopPromotionInterval = TimeId(60 * 60);
|
||||
constexpr auto kTopPromotionMinDelay = TimeId(10);
|
||||
constexpr auto kSmallDelayMs = 5;
|
||||
constexpr auto kReadFeaturedSetsTimeout = crl::time(1000);
|
||||
constexpr auto kFileLoaderQueueStopTimeout = crl::time(5000);
|
||||
@@ -163,7 +163,6 @@ ApiWrap::ApiWrap(not_null<Main::Session*> session)
|
||||
, _featuredSetsReadTimer([=] { readFeaturedSets(); })
|
||||
, _dialogsLoadState(std::make_unique<DialogsLoadState>())
|
||||
, _fileLoader(std::make_unique<TaskQueue>(kFileLoaderQueueStopTimeout))
|
||||
, _topPromotionTimer([=] { refreshTopPromotion(); })
|
||||
, _updateNotifyTimer([=] { sendNotifySettingsUpdates(); })
|
||||
, _statsSessionKillTimer([=] { checkStatsSessions(); })
|
||||
, _authorizations(std::make_unique<Api::Authorizations>(this))
|
||||
@@ -180,6 +179,7 @@ ApiWrap::ApiWrap(not_null<Main::Session*> session)
|
||||
, _confirmPhone(std::make_unique<Api::ConfirmPhone>(this))
|
||||
, _peerPhoto(std::make_unique<Api::PeerPhoto>(this))
|
||||
, _polls(std::make_unique<Api::Polls>(this))
|
||||
, _todoLists(std::make_unique<Api::TodoLists>(this))
|
||||
, _chatParticipants(std::make_unique<Api::ChatParticipants>(this))
|
||||
, _unreadThings(std::make_unique<Api::UnreadThings>(this))
|
||||
, _ringtones(std::make_unique<Api::Ringtones>(this))
|
||||
@@ -199,11 +199,6 @@ ApiWrap::ApiWrap(not_null<Main::Session*> session)
|
||||
}, _session->lifetime());
|
||||
|
||||
setupSupportMode();
|
||||
|
||||
Core::App().settings().proxy().connectionTypeValue(
|
||||
) | rpl::start_with_next([=] {
|
||||
refreshTopPromotion();
|
||||
}, _session->lifetime());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -243,73 +238,6 @@ void ApiWrap::requestChangelog(
|
||||
//).send();
|
||||
}
|
||||
|
||||
void ApiWrap::refreshTopPromotion() {
|
||||
const auto now = base::unixtime::now();
|
||||
const auto next = (_topPromotionNextRequestTime != 0)
|
||||
? _topPromotionNextRequestTime
|
||||
: now;
|
||||
if (_topPromotionRequestId) {
|
||||
getTopPromotionDelayed(now, next);
|
||||
return;
|
||||
}
|
||||
const auto key = [&]() -> std::pair<QString, uint32> {
|
||||
if (!Core::App().settings().proxy().isEnabled()) {
|
||||
return {};
|
||||
}
|
||||
const auto &proxy = Core::App().settings().proxy().selected();
|
||||
if (proxy.type != MTP::ProxyData::Type::Mtproto) {
|
||||
return {};
|
||||
}
|
||||
return { proxy.host, proxy.port };
|
||||
}();
|
||||
if (_topPromotionKey == key && now < next) {
|
||||
getTopPromotionDelayed(now, next);
|
||||
return;
|
||||
}
|
||||
_topPromotionKey = key;
|
||||
_topPromotionRequestId = request(MTPhelp_GetPromoData(
|
||||
)).done([=](const MTPhelp_PromoData &result) {
|
||||
_topPromotionRequestId = 0;
|
||||
topPromotionDone(result);
|
||||
}).fail([=] {
|
||||
_topPromotionRequestId = 0;
|
||||
const auto now = base::unixtime::now();
|
||||
const auto next = _topPromotionNextRequestTime = now
|
||||
+ kTopPromotionInterval;
|
||||
if (!_topPromotionTimer.isActive()) {
|
||||
getTopPromotionDelayed(now, next);
|
||||
}
|
||||
}).send();
|
||||
}
|
||||
|
||||
void ApiWrap::getTopPromotionDelayed(TimeId now, TimeId next) {
|
||||
_topPromotionTimer.callOnce(std::min(
|
||||
std::max(next - now, kTopPromotionMinDelay),
|
||||
kTopPromotionInterval) * crl::time(1000));
|
||||
};
|
||||
|
||||
void ApiWrap::topPromotionDone(const MTPhelp_PromoData &proxy) {
|
||||
_topPromotionNextRequestTime = proxy.match([&](const auto &data) {
|
||||
return data.vexpires().v;
|
||||
});
|
||||
getTopPromotionDelayed(
|
||||
base::unixtime::now(),
|
||||
_topPromotionNextRequestTime);
|
||||
|
||||
proxy.match([&](const MTPDhelp_promoDataEmpty &data) {
|
||||
_session->data().setTopPromoted(nullptr, QString(), QString());
|
||||
}, [&](const MTPDhelp_promoData &data) {
|
||||
_session->data().processChats(data.vchats());
|
||||
_session->data().processUsers(data.vusers());
|
||||
const auto peerId = peerFromMTP(data.vpeer());
|
||||
const auto history = _session->data().history(peerId);
|
||||
_session->data().setTopPromoted(
|
||||
history,
|
||||
data.vpsa_type().value_or_empty(),
|
||||
data.vpsa_message().value_or_empty());
|
||||
});
|
||||
}
|
||||
|
||||
void ApiWrap::requestDeepLinkInfo(
|
||||
const QString &path,
|
||||
Fn<void(TextWithEntities message, bool updateRequired)> callback) {
|
||||
@@ -396,7 +324,7 @@ void ApiWrap::checkChatInvite(
|
||||
request(base::take(_checkInviteRequestId)).cancel();
|
||||
_checkInviteRequestId = request(MTPmessages_CheckChatInvite(
|
||||
MTP_string(hash)
|
||||
)).done(std::move(done)).fail(std::move(fail)).send();
|
||||
)).done(std::move(done)).fail(std::move(fail)).handleFloodErrors().send();
|
||||
}
|
||||
|
||||
void ApiWrap::checkFilterInvite(
|
||||
@@ -456,10 +384,13 @@ void ApiWrap::savePinnedOrder(not_null<Data::Forum*> forum) {
|
||||
}
|
||||
|
||||
void ApiWrap::savePinnedOrder(not_null<Data::SavedMessages*> saved) {
|
||||
if (saved->parentChat()) {
|
||||
return;
|
||||
}
|
||||
const auto &order = _session->data().pinnedChatsOrder(saved);
|
||||
const auto input = [](Dialogs::Key key) {
|
||||
if (const auto sublist = key.sublist()) {
|
||||
return MTP_inputDialogPeer(sublist->peer()->input);
|
||||
return MTP_inputDialogPeer(sublist->sublistPeer()->input);
|
||||
}
|
||||
Unexpected("Key type in pinnedDialogsOrder().");
|
||||
};
|
||||
@@ -1444,6 +1375,32 @@ void ApiWrap::deleteAllFromParticipantSend(
|
||||
}).send();
|
||||
}
|
||||
|
||||
void ApiWrap::deleteSublistHistory(
|
||||
not_null<ChannelData*> channel,
|
||||
not_null<PeerData*> sublistPeer) {
|
||||
deleteSublistHistorySend(channel, sublistPeer);
|
||||
}
|
||||
|
||||
void ApiWrap::deleteSublistHistorySend(
|
||||
not_null<ChannelData*> parentChat,
|
||||
not_null<PeerData*> sublistPeer) {
|
||||
request(MTPmessages_DeleteSavedHistory(
|
||||
MTP_flags(MTPmessages_DeleteSavedHistory::Flag::f_parent_peer),
|
||||
parentChat->input,
|
||||
sublistPeer->input,
|
||||
MTP_int(0), // max_id
|
||||
MTP_int(0), // min_date
|
||||
MTP_int(0) // max_date
|
||||
)).done([=](const MTPmessages_AffectedHistory &result) {
|
||||
const auto offset = applyAffectedHistory(parentChat, result);
|
||||
if (offset > 0) {
|
||||
deleteSublistHistorySend(parentChat, sublistPeer);
|
||||
} else if (const auto monoforum = parentChat->monoforum()) {
|
||||
monoforum->applySublistDeleted(sublistPeer);
|
||||
}
|
||||
}).send();
|
||||
}
|
||||
|
||||
void ApiWrap::scheduleStickerSetRequest(uint64 setId, uint64 access) {
|
||||
if (!_stickerSetRequests.contains(setId)) {
|
||||
_stickerSetRequests.emplace(setId, StickerSetRequest{ access });
|
||||
@@ -2135,8 +2092,13 @@ void ApiWrap::saveCurrentDraftToCloud() {
|
||||
_session->local().writeDrafts(history);
|
||||
|
||||
const auto topicRootId = thread->topicRootId();
|
||||
const auto localDraft = history->localDraft(topicRootId);
|
||||
const auto cloudDraft = history->cloudDraft(topicRootId);
|
||||
const auto monoforumPeerId = thread->monoforumPeerId();
|
||||
const auto localDraft = history->localDraft(
|
||||
topicRootId,
|
||||
monoforumPeerId);
|
||||
const auto cloudDraft = history->cloudDraft(
|
||||
topicRootId,
|
||||
monoforumPeerId);
|
||||
if (!Data::DraftsAreEqual(localDraft, cloudDraft)
|
||||
&& !_session->supportMode()) {
|
||||
saveDraftToCloudDelayed(thread);
|
||||
@@ -2159,15 +2121,22 @@ void ApiWrap::saveDraftsToCloud() {
|
||||
|
||||
const auto history = thread->owningHistory();
|
||||
const auto topicRootId = thread->topicRootId();
|
||||
auto cloudDraft = history->cloudDraft(topicRootId);
|
||||
auto localDraft = history->localDraft(topicRootId);
|
||||
const auto monoforumPeerId = thread->monoforumPeerId();
|
||||
auto cloudDraft = history->cloudDraft(topicRootId, monoforumPeerId);
|
||||
auto localDraft = history->localDraft(topicRootId, monoforumPeerId);
|
||||
if (cloudDraft && cloudDraft->saveRequestId) {
|
||||
request(base::take(cloudDraft->saveRequestId)).cancel();
|
||||
}
|
||||
if (!_session->supportMode()) {
|
||||
cloudDraft = history->createCloudDraft(topicRootId, localDraft);
|
||||
cloudDraft = history->createCloudDraft(
|
||||
topicRootId,
|
||||
monoforumPeerId,
|
||||
localDraft);
|
||||
} else if (!cloudDraft) {
|
||||
cloudDraft = history->createCloudDraft(topicRootId, nullptr);
|
||||
cloudDraft = history->createCloudDraft(
|
||||
topicRootId,
|
||||
monoforumPeerId,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
auto flags = MTPmessages_SaveDraft::Flags(0);
|
||||
@@ -2177,18 +2146,23 @@ void ApiWrap::saveDraftsToCloud() {
|
||||
} else if (!cloudDraft->webpage.url.isEmpty()) {
|
||||
flags |= MTPmessages_SaveDraft::Flag::f_media;
|
||||
}
|
||||
if (cloudDraft->reply.messageId || cloudDraft->reply.topicRootId) {
|
||||
if (cloudDraft->reply.messageId
|
||||
|| cloudDraft->reply.topicRootId
|
||||
|| cloudDraft->reply.monoforumPeerId) {
|
||||
flags |= MTPmessages_SaveDraft::Flag::f_reply_to;
|
||||
}
|
||||
if (!textWithTags.tags.isEmpty()) {
|
||||
flags |= MTPmessages_SaveDraft::Flag::f_entities;
|
||||
}
|
||||
if (cloudDraft->suggest) {
|
||||
flags |= MTPmessages_SaveDraft::Flag::f_suggested_post;
|
||||
}
|
||||
auto entities = Api::EntitiesToMTP(
|
||||
_session,
|
||||
TextUtilities::ConvertTextTagsToEntities(textWithTags.tags),
|
||||
Api::ConvertOption::SkipLocal);
|
||||
|
||||
history->startSavingCloudDraft(topicRootId);
|
||||
history->startSavingCloudDraft(topicRootId, monoforumPeerId);
|
||||
cloudDraft->saveRequestId = request(MTPmessages_SaveDraft(
|
||||
MTP_flags(flags),
|
||||
ReplyToForMTP(history, cloudDraft->reply),
|
||||
@@ -2198,16 +2172,21 @@ void ApiWrap::saveDraftsToCloud() {
|
||||
Data::WebPageForMTP(
|
||||
cloudDraft->webpage,
|
||||
textWithTags.text.isEmpty()),
|
||||
MTP_long(0) // effect
|
||||
MTP_long(0), // effect
|
||||
Api::SuggestToMTP(cloudDraft->suggest)
|
||||
)).done([=](const MTPBool &result, const MTP::Response &response) {
|
||||
const auto requestId = response.requestId;
|
||||
history->finishSavingCloudDraft(
|
||||
topicRootId,
|
||||
monoforumPeerId,
|
||||
UnixtimeFromMsgId(response.outerMsgId));
|
||||
if (const auto cloudDraft = history->cloudDraft(topicRootId)) {
|
||||
const auto cloudDraft = history->cloudDraft(
|
||||
topicRootId,
|
||||
monoforumPeerId);
|
||||
if (cloudDraft) {
|
||||
if (cloudDraft->saveRequestId == requestId) {
|
||||
cloudDraft->saveRequestId = 0;
|
||||
history->draftSavedToCloud(topicRootId);
|
||||
history->draftSavedToCloud(topicRootId, monoforumPeerId);
|
||||
}
|
||||
}
|
||||
const auto i = _draftsSaveRequestIds.find(weak);
|
||||
@@ -2220,10 +2199,14 @@ void ApiWrap::saveDraftsToCloud() {
|
||||
const auto requestId = response.requestId;
|
||||
history->finishSavingCloudDraft(
|
||||
topicRootId,
|
||||
monoforumPeerId,
|
||||
UnixtimeFromMsgId(response.outerMsgId));
|
||||
if (const auto cloudDraft = history->cloudDraft(topicRootId)) {
|
||||
const auto cloudDraft = history->cloudDraft(
|
||||
topicRootId,
|
||||
monoforumPeerId);
|
||||
if (cloudDraft) {
|
||||
if (cloudDraft->saveRequestId == requestId) {
|
||||
history->clearCloudDraft(topicRootId);
|
||||
history->clearCloudDraft(topicRootId, monoforumPeerId);
|
||||
}
|
||||
}
|
||||
const auto i = _draftsSaveRequestIds.find(weak);
|
||||
@@ -2597,7 +2580,10 @@ void ApiWrap::refreshFileReference(
|
||||
});
|
||||
}
|
||||
|
||||
void ApiWrap::gotWebPages(ChannelData *channel, const MTPmessages_Messages &result, mtpRequestId req) {
|
||||
void ApiWrap::gotWebPages(
|
||||
ChannelData *channel,
|
||||
const MTPmessages_Messages &result,
|
||||
mtpRequestId req) {
|
||||
WebPageData::ApplyChanges(_session, channel, result);
|
||||
for (auto i = _webPagesPending.begin(); i != _webPagesPending.cend();) {
|
||||
if (i->second == req) {
|
||||
@@ -2611,7 +2597,7 @@ void ApiWrap::gotWebPages(ChannelData *channel, const MTPmessages_Messages &resu
|
||||
++i;
|
||||
}
|
||||
}
|
||||
_session->data().sendWebPageGamePollNotifications();
|
||||
_session->data().sendWebPageGamePollTodoListNotifications();
|
||||
}
|
||||
|
||||
void ApiWrap::updateStickers() {
|
||||
@@ -3001,17 +2987,27 @@ void ApiWrap::resolveJumpToDate(
|
||||
Fn<void(not_null<PeerData*>, MsgId)> callback) {
|
||||
if (const auto peer = chat.peer()) {
|
||||
const auto topic = chat.topic();
|
||||
const auto rootId = topic ? topic->rootId() : 0;
|
||||
resolveJumpToHistoryDate(peer, rootId, date, std::move(callback));
|
||||
const auto sublist = chat.sublist();
|
||||
const auto rootId = topic ? topic->rootId() : MsgId();
|
||||
const auto monoforumPeerId = sublist
|
||||
? sublist->sublistPeer()->id
|
||||
: PeerId();
|
||||
resolveJumpToHistoryDate(
|
||||
peer,
|
||||
rootId,
|
||||
monoforumPeerId,
|
||||
date,
|
||||
std::move(callback));
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Callback>
|
||||
void ApiWrap::requestMessageAfterDate(
|
||||
not_null<PeerData*> peer,
|
||||
MsgId topicRootId,
|
||||
const QDate &date,
|
||||
Callback &&callback) {
|
||||
not_null<PeerData*> peer,
|
||||
MsgId topicRootId,
|
||||
PeerId monoforumPeerId,
|
||||
const QDate &date,
|
||||
Callback &&callback) {
|
||||
// API returns a message with date <= offset_date.
|
||||
// So we request a message with offset_date = desired_date - 1 and add_offset = -1.
|
||||
// This should give us the first message with date >= desired_date.
|
||||
@@ -3034,7 +3030,7 @@ void ApiWrap::requestMessageAfterDate(
|
||||
return &messages.vmessages().v;
|
||||
};
|
||||
const auto list = result.match([&](
|
||||
const MTPDmessages_messages &data) {
|
||||
const MTPDmessages_messages &data) {
|
||||
return handleMessages(data);
|
||||
}, [&](const MTPDmessages_messagesSlice &data) {
|
||||
return handleMessages(data);
|
||||
@@ -3077,6 +3073,18 @@ void ApiWrap::requestMessageAfterDate(
|
||||
MTP_int(maxId),
|
||||
MTP_int(minId),
|
||||
MTP_long(historyHash)));
|
||||
} else if (monoforumPeerId) {
|
||||
send(MTPmessages_GetSavedHistory(
|
||||
MTP_flags(MTPmessages_GetSavedHistory::Flag::f_parent_peer),
|
||||
peer->input,
|
||||
session().data().peer(monoforumPeerId)->input,
|
||||
MTP_int(offsetId),
|
||||
MTP_int(offsetDate),
|
||||
MTP_int(addOffset),
|
||||
MTP_int(limit),
|
||||
MTP_int(maxId),
|
||||
MTP_int(minId),
|
||||
MTP_long(historyHash)));
|
||||
} else {
|
||||
send(MTPmessages_GetHistory(
|
||||
peer->input,
|
||||
@@ -3093,28 +3101,41 @@ void ApiWrap::requestMessageAfterDate(
|
||||
void ApiWrap::resolveJumpToHistoryDate(
|
||||
not_null<PeerData*> peer,
|
||||
MsgId topicRootId,
|
||||
PeerId monoforumPeerId,
|
||||
const QDate &date,
|
||||
Fn<void(not_null<PeerData*>, MsgId)> callback) {
|
||||
if (const auto channel = peer->migrateTo()) {
|
||||
return resolveJumpToHistoryDate(
|
||||
channel,
|
||||
topicRootId,
|
||||
monoforumPeerId,
|
||||
date,
|
||||
std::move(callback));
|
||||
}
|
||||
const auto jumpToDateInPeer = [=] {
|
||||
requestMessageAfterDate(peer, topicRootId, date, [=](MsgId itemId) {
|
||||
callback(peer, itemId);
|
||||
});
|
||||
requestMessageAfterDate(
|
||||
peer,
|
||||
topicRootId,
|
||||
monoforumPeerId,
|
||||
date,
|
||||
[=](MsgId itemId) { callback(peer, itemId); });
|
||||
};
|
||||
if (const auto chat = topicRootId ? nullptr : peer->migrateFrom()) {
|
||||
requestMessageAfterDate(chat, 0, date, [=](MsgId itemId) {
|
||||
if (itemId) {
|
||||
callback(chat, itemId);
|
||||
} else {
|
||||
jumpToDateInPeer();
|
||||
}
|
||||
});
|
||||
const auto migrated = (topicRootId || monoforumPeerId)
|
||||
? nullptr
|
||||
: peer->migrateFrom();
|
||||
if (migrated) {
|
||||
requestMessageAfterDate(
|
||||
migrated,
|
||||
MsgId(),
|
||||
PeerId(),
|
||||
date,
|
||||
[=](MsgId itemId) {
|
||||
if (itemId) {
|
||||
callback(migrated, itemId);
|
||||
} else {
|
||||
jumpToDateInPeer();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
jumpToDateInPeer();
|
||||
}
|
||||
@@ -3163,12 +3184,14 @@ void ApiWrap::requestHistory(
|
||||
void ApiWrap::requestSharedMedia(
|
||||
not_null<PeerData*> peer,
|
||||
MsgId topicRootId,
|
||||
PeerId monoforumPeerId,
|
||||
SharedMediaType type,
|
||||
MsgId messageId,
|
||||
SliceType slice) {
|
||||
const auto key = SharedMediaRequest{
|
||||
peer,
|
||||
topicRootId,
|
||||
monoforumPeerId,
|
||||
type,
|
||||
messageId,
|
||||
slice,
|
||||
@@ -3180,6 +3203,7 @@ void ApiWrap::requestSharedMedia(
|
||||
const auto prepared = Api::PrepareSearchRequest(
|
||||
peer,
|
||||
topicRootId,
|
||||
monoforumPeerId,
|
||||
type,
|
||||
QString(),
|
||||
messageId,
|
||||
@@ -3202,7 +3226,12 @@ void ApiWrap::requestSharedMedia(
|
||||
messageId,
|
||||
slice,
|
||||
result);
|
||||
sharedMediaDone(peer, topicRootId, type, std::move(parsed));
|
||||
sharedMediaDone(
|
||||
peer,
|
||||
topicRootId,
|
||||
monoforumPeerId,
|
||||
type,
|
||||
std::move(parsed));
|
||||
finish();
|
||||
}).fail([=] {
|
||||
_sharedMediaRequests.remove(key);
|
||||
@@ -3215,16 +3244,19 @@ void ApiWrap::requestSharedMedia(
|
||||
void ApiWrap::sharedMediaDone(
|
||||
not_null<PeerData*> peer,
|
||||
MsgId topicRootId,
|
||||
PeerId monoforumPeerId,
|
||||
SharedMediaType type,
|
||||
Api::SearchResult &&parsed) {
|
||||
const auto topic = peer->forumTopicFor(topicRootId);
|
||||
if (topicRootId && !topic) {
|
||||
const auto sublist = peer->monoforumSublistFor(monoforumPeerId);
|
||||
if ((topicRootId && !topic) || (monoforumPeerId && !sublist)) {
|
||||
return;
|
||||
}
|
||||
const auto hasMessages = !parsed.messageIds.empty();
|
||||
_session->storage().add(Storage::SharedMediaAddSlice(
|
||||
peer->id,
|
||||
topicRootId,
|
||||
monoforumPeerId,
|
||||
type,
|
||||
std::move(parsed.messageIds),
|
||||
parsed.noSkipRange,
|
||||
@@ -3235,6 +3267,9 @@ void ApiWrap::sharedMediaDone(
|
||||
if (topic) {
|
||||
topic->setHasPinnedMessages(true);
|
||||
}
|
||||
if (sublist) {
|
||||
sublist->setHasPinnedMessages(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3271,8 +3306,14 @@ void ApiWrap::sendAction(const SendAction &action) {
|
||||
const auto topic = topicRootId
|
||||
? action.history->peer->forumTopicFor(topicRootId)
|
||||
: nullptr;
|
||||
const auto monoforumPeerId = action.replyTo.monoforumPeerId;
|
||||
const auto sublist = monoforumPeerId
|
||||
? action.history->peer->monoforumSublistFor(monoforumPeerId)
|
||||
: nullptr;
|
||||
if (topic) {
|
||||
topic->readTillEnd();
|
||||
} else if (sublist) {
|
||||
sublist->readTillEnd();
|
||||
} else {
|
||||
_session->data().histories().readInbox(action.history);
|
||||
}
|
||||
@@ -3284,7 +3325,10 @@ void ApiWrap::sendAction(const SendAction &action) {
|
||||
void ApiWrap::finishForwarding(const SendAction &action) {
|
||||
const auto history = action.history;
|
||||
const auto topicRootId = action.replyTo.topicRootId;
|
||||
auto toForward = history->resolveForwardDraft(topicRootId);
|
||||
const auto monoforumPeerId = action.replyTo.monoforumPeerId;
|
||||
auto toForward = history->resolveForwardDraft(
|
||||
topicRootId,
|
||||
monoforumPeerId);
|
||||
if (!toForward.items.empty()) {
|
||||
const auto error = GetErrorForSending(
|
||||
history->peer,
|
||||
@@ -3297,7 +3341,7 @@ void ApiWrap::finishForwarding(const SendAction &action) {
|
||||
}
|
||||
|
||||
forwardMessages(std::move(toForward), action);
|
||||
history->setForwardDraft(topicRootId, {});
|
||||
history->setForwardDraft(topicRootId, monoforumPeerId, {});
|
||||
}
|
||||
|
||||
_session->data().sendHistoryChangeNotifications();
|
||||
@@ -3366,6 +3410,9 @@ void ApiWrap::forwardMessages(
|
||||
if (sendAs) {
|
||||
sendFlags |= SendFlag::f_send_as;
|
||||
}
|
||||
if (action.options.suggest) {
|
||||
sendFlags |= SendFlag::f_suggested_post;
|
||||
}
|
||||
const auto kGeneralId = Data::ForumTopic::kGeneralId;
|
||||
const auto topicRootId = action.replyTo.topicRootId;
|
||||
const auto topMsgId = (topicRootId == kGeneralId)
|
||||
@@ -3374,6 +3421,13 @@ void ApiWrap::forwardMessages(
|
||||
if (topMsgId) {
|
||||
sendFlags |= SendFlag::f_top_msg_id;
|
||||
}
|
||||
const auto monoforumPeerId = action.replyTo.monoforumPeerId;
|
||||
const auto monoforumPeer = monoforumPeerId
|
||||
? session().data().peer(monoforumPeerId).get()
|
||||
: nullptr;
|
||||
if (monoforumPeer || (action.options.suggest && action.replyTo)) {
|
||||
sendFlags |= SendFlag::f_reply_to;
|
||||
}
|
||||
|
||||
auto forwardFrom = draft.items.front()->history()->peer;
|
||||
auto ids = QVector<MTPint>();
|
||||
@@ -3403,11 +3457,17 @@ void ApiWrap::forwardMessages(
|
||||
MTP_vector<MTPlong>(randomIds),
|
||||
peer->input,
|
||||
MTP_int(topMsgId),
|
||||
(action.options.suggest
|
||||
? ReplyToForMTP(history, action.replyTo)
|
||||
: monoforumPeer
|
||||
? MTP_inputReplyToMonoForum(monoforumPeer->input)
|
||||
: MTPInputReplyTo()),
|
||||
MTP_int(action.options.scheduled),
|
||||
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
|
||||
Data::ShortcutIdToMTP(_session, action.options.shortcutId),
|
||||
MTPint(), // video_timestamp
|
||||
MTP_long(starsPaid)
|
||||
MTP_long(starsPaid),
|
||||
Api::SuggestToMTP(action.options.suggest)
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
if (!scheduled) {
|
||||
this->updates().checkForSentToScheduled(result);
|
||||
@@ -3449,12 +3509,15 @@ void ApiWrap::forwardMessages(
|
||||
.id = newId.msg,
|
||||
.flags = flags,
|
||||
.from = NewMessageFromId(action),
|
||||
.replyTo = { .topicRootId = topMsgId },
|
||||
.replyTo = {
|
||||
.topicRootId = topMsgId,
|
||||
.monoforumPeerId = monoforumPeerId,
|
||||
},
|
||||
.date = NewMessageDate(action.options),
|
||||
.shortcutId = action.options.shortcutId,
|
||||
.starsPaid = action.options.starsApproved,
|
||||
.postAuthor = NewMessagePostAuthor(action),
|
||||
|
||||
.suggest = HistoryMessageSuggestInfo(action.options),
|
||||
// forwarded messages don't have effects
|
||||
//.effectId = action.options.effectId,
|
||||
}, item);
|
||||
@@ -3549,6 +3612,7 @@ void ApiWrap::sendSharedContact(
|
||||
.starsPaid = action.options.starsApproved,
|
||||
.postAuthor = NewMessagePostAuthor(action),
|
||||
.effectId = action.options.effectId,
|
||||
.suggest = HistoryMessageSuggestInfo(action.options),
|
||||
}, TextWithEntities(), MTP_messageMediaContact(
|
||||
MTP_string(phone),
|
||||
MTP_string(firstName),
|
||||
@@ -3597,7 +3661,19 @@ void ApiWrap::editMedia(
|
||||
if (list.files.empty()) return;
|
||||
|
||||
auto &file = list.files.front();
|
||||
const auto to = FileLoadTaskOptions(action);
|
||||
auto to = FileLoadTaskOptions(action);
|
||||
const auto existing = to.replaceMediaOf
|
||||
? session().data().message(action.history->peer, to.replaceMediaOf)
|
||||
: nullptr;
|
||||
if (existing && existing->computeSuggestionActions()
|
||||
== SuggestionActions::AcceptAndDecline) {
|
||||
to.replyTo.messageId = {
|
||||
action.history->peer->id,
|
||||
to.replaceMediaOf
|
||||
};
|
||||
to.replyTo.monoforumPeerId = existing->sublistPeerId();
|
||||
to.replaceMediaOf = MsgId();
|
||||
}
|
||||
_fileLoader->addTask(std::make_unique<FileLoadTask>(
|
||||
&session(),
|
||||
file.path,
|
||||
@@ -3776,6 +3852,7 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
|
||||
|
||||
const auto clearCloudDraft = action.clearDraft;
|
||||
const auto draftTopicRootId = action.replyTo.topicRootId;
|
||||
const auto draftMonoforumPeerId = action.replyTo.monoforumPeerId;
|
||||
const auto replyTo = action.replyTo.messageId
|
||||
? peer->owner().message(action.replyTo.messageId)
|
||||
: nullptr;
|
||||
@@ -3885,8 +3962,10 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
|
||||
if (clearCloudDraft) {
|
||||
sendFlags |= MTPmessages_SendMessage::Flag::f_clear_draft;
|
||||
mediaFlags |= MTPmessages_SendMedia::Flag::f_clear_draft;
|
||||
history->clearCloudDraft(draftTopicRootId);
|
||||
history->startSavingCloudDraft(draftTopicRootId);
|
||||
history->clearCloudDraft(draftTopicRootId, draftMonoforumPeerId);
|
||||
history->startSavingCloudDraft(
|
||||
draftTopicRootId,
|
||||
draftMonoforumPeerId);
|
||||
}
|
||||
const auto sendAs = action.options.sendAs;
|
||||
if (sendAs) {
|
||||
@@ -3907,6 +3986,10 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
|
||||
sendFlags |= MTPmessages_SendMessage::Flag::f_effect;
|
||||
mediaFlags |= MTPmessages_SendMedia::Flag::f_effect;
|
||||
}
|
||||
if (action.options.suggest) {
|
||||
sendFlags |= MTPmessages_SendMessage::Flag::f_suggested_post;
|
||||
mediaFlags |= MTPmessages_SendMedia::Flag::f_suggested_post;
|
||||
}
|
||||
const auto starsPaid = std::min(
|
||||
peer->starsPerMessageChecked(),
|
||||
action.options.starsApproved);
|
||||
@@ -3925,6 +4008,7 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
|
||||
.starsPaid = starsPaid,
|
||||
.postAuthor = NewMessagePostAuthor(action),
|
||||
.effectId = action.options.effectId,
|
||||
.suggest = HistoryMessageSuggestInfo(action.options),
|
||||
}, sending, media);
|
||||
const auto done = [=](
|
||||
const MTPUpdates &result,
|
||||
@@ -3932,6 +4016,7 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
|
||||
if (clearCloudDraft) {
|
||||
history->finishSavingCloudDraft(
|
||||
draftTopicRootId,
|
||||
draftMonoforumPeerId,
|
||||
UnixtimeFromMsgId(response.outerMsgId));
|
||||
}
|
||||
};
|
||||
@@ -3946,6 +4031,7 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
|
||||
if (clearCloudDraft) {
|
||||
history->finishSavingCloudDraft(
|
||||
draftTopicRootId,
|
||||
draftMonoforumPeerId,
|
||||
UnixtimeFromMsgId(response.outerMsgId));
|
||||
}
|
||||
};
|
||||
@@ -3972,7 +4058,8 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
|
||||
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
|
||||
mtpShortcut,
|
||||
MTP_long(action.options.effectId),
|
||||
MTP_long(starsPaid)
|
||||
MTP_long(starsPaid),
|
||||
Api::SuggestToMTP(action.options.suggest)
|
||||
), done, fail);
|
||||
} else {
|
||||
histories.sendPreparedMessage(
|
||||
@@ -3991,7 +4078,8 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
|
||||
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
|
||||
mtpShortcut,
|
||||
MTP_long(action.options.effectId),
|
||||
MTP_long(starsPaid)
|
||||
MTP_long(starsPaid),
|
||||
Api::SuggestToMTP(action.options.suggest)
|
||||
), done, fail);
|
||||
}
|
||||
isFirst = false;
|
||||
@@ -4064,6 +4152,7 @@ void ApiWrap::sendInlineResult(
|
||||
const auto topicRootId = action.replyTo.messageId
|
||||
? action.replyTo.topicRootId
|
||||
: 0;
|
||||
const auto monoforumPeerId = action.replyTo.monoforumPeerId;
|
||||
|
||||
using SendFlag = MTPmessages_SendInlineBotResult::Flag;
|
||||
auto flags = NewMessageFlags(peer);
|
||||
@@ -4116,8 +4205,8 @@ void ApiWrap::sendInlineResult(
|
||||
.postAuthor = NewMessagePostAuthor(action),
|
||||
});
|
||||
|
||||
history->clearCloudDraft(topicRootId);
|
||||
history->startSavingCloudDraft(topicRootId);
|
||||
history->clearCloudDraft(topicRootId, monoforumPeerId);
|
||||
history->startSavingCloudDraft(topicRootId, monoforumPeerId);
|
||||
|
||||
auto &histories = history->owner().histories();
|
||||
histories.sendPreparedMessage(
|
||||
@@ -4138,6 +4227,7 @@ void ApiWrap::sendInlineResult(
|
||||
), [=](const MTPUpdates &result, const MTP::Response &response) {
|
||||
history->finishSavingCloudDraft(
|
||||
topicRootId,
|
||||
monoforumPeerId,
|
||||
UnixtimeFromMsgId(response.outerMsgId));
|
||||
if (done) {
|
||||
done(true);
|
||||
@@ -4146,6 +4236,7 @@ void ApiWrap::sendInlineResult(
|
||||
sendMessageFail(error, peer, randomId, newId);
|
||||
history->finishSavingCloudDraft(
|
||||
topicRootId,
|
||||
monoforumPeerId,
|
||||
UnixtimeFromMsgId(response.outerMsgId));
|
||||
if (done) {
|
||||
done(false);
|
||||
@@ -4294,6 +4385,7 @@ void ApiWrap::sendMediaWithRandomId(
|
||||
| (options.sendAs ? Flag::f_send_as : Flag(0))
|
||||
| (options.shortcutId ? Flag::f_quick_reply_shortcut : Flag(0))
|
||||
| (options.effectId ? Flag::f_effect : Flag(0))
|
||||
| (options.suggest ? Flag::f_suggested_post : Flag(0))
|
||||
| (options.invertCaption ? Flag::f_invert_media : Flag(0))
|
||||
| (starsPaid ? Flag::f_allow_paid_stars : Flag(0));
|
||||
|
||||
@@ -4322,7 +4414,8 @@ void ApiWrap::sendMediaWithRandomId(
|
||||
(options.sendAs ? options.sendAs->input : MTP_inputPeerEmpty()),
|
||||
Data::ShortcutIdToMTP(_session, options.shortcutId),
|
||||
MTP_long(options.effectId),
|
||||
MTP_long(starsPaid)
|
||||
MTP_long(starsPaid),
|
||||
Api::SuggestToMTP(options.suggest)
|
||||
), [=](const MTPUpdates &result, const MTP::Response &response) {
|
||||
if (done) done(true);
|
||||
if (updateRecentStickers) {
|
||||
@@ -4377,6 +4470,7 @@ void ApiWrap::sendMultiPaidMedia(
|
||||
| (options.sendAs ? Flag::f_send_as : Flag(0))
|
||||
| (options.shortcutId ? Flag::f_quick_reply_shortcut : Flag(0))
|
||||
| (options.effectId ? Flag::f_effect : Flag(0))
|
||||
| (options.suggest ? Flag::f_suggested_post : Flag(0))
|
||||
| (options.invertCaption ? Flag::f_invert_media : Flag(0))
|
||||
| (starsPaid ? Flag::f_allow_paid_stars : Flag(0));
|
||||
|
||||
@@ -4404,7 +4498,8 @@ void ApiWrap::sendMultiPaidMedia(
|
||||
(options.sendAs ? options.sendAs->input : MTP_inputPeerEmpty()),
|
||||
Data::ShortcutIdToMTP(_session, options.shortcutId),
|
||||
MTP_long(options.effectId),
|
||||
MTP_long(starsPaid)
|
||||
MTP_long(starsPaid),
|
||||
Api::SuggestToMTP(options.suggest)
|
||||
), [=](const MTPUpdates &result, const MTP::Response &response) {
|
||||
if (const auto album = _sendingAlbums.take(groupId)) {
|
||||
const auto copy = (*album)->items;
|
||||
@@ -4736,6 +4831,10 @@ Api::Polls &ApiWrap::polls() {
|
||||
return *_polls;
|
||||
}
|
||||
|
||||
Api::TodoLists &ApiWrap::todoLists() {
|
||||
return *_todoLists;
|
||||
}
|
||||
|
||||
Api::ChatParticipants &ApiWrap::chatParticipants() {
|
||||
return *_chatParticipants;
|
||||
}
|
||||
|
||||
@@ -77,6 +77,7 @@ class ConfirmPhone;
|
||||
class PeerPhoto;
|
||||
class PeerColors;
|
||||
class Polls;
|
||||
class TodoLists;
|
||||
class ChatParticipants;
|
||||
class UnreadThings;
|
||||
class Ringtones;
|
||||
@@ -200,7 +201,6 @@ public:
|
||||
void requestChangelog(
|
||||
const QString &sinceVersion,
|
||||
Fn<void(const MTPUpdates &result)> callback);
|
||||
void refreshTopPromotion();
|
||||
void requestDeepLinkInfo(
|
||||
const QString &path,
|
||||
Fn<void(TextWithEntities message, bool updateRequired)> callback);
|
||||
@@ -232,6 +232,9 @@ public:
|
||||
void deleteAllFromParticipant(
|
||||
not_null<ChannelData*> channel,
|
||||
not_null<PeerData*> from);
|
||||
void deleteSublistHistory(
|
||||
not_null<ChannelData*> parentChat,
|
||||
not_null<PeerData*> sublistPeer);
|
||||
|
||||
void requestWebPageDelayed(not_null<WebPageData*> page);
|
||||
void clearWebPageRequest(not_null<WebPageData*> page);
|
||||
@@ -287,6 +290,7 @@ public:
|
||||
void requestSharedMedia(
|
||||
not_null<PeerData*> peer,
|
||||
MsgId topicRootId,
|
||||
PeerId monoforumPeerId,
|
||||
Storage::SharedMediaType type,
|
||||
MsgId messageId,
|
||||
SliceType slice);
|
||||
@@ -410,6 +414,7 @@ public:
|
||||
[[nodiscard]] Api::ConfirmPhone &confirmPhone();
|
||||
[[nodiscard]] Api::PeerPhoto &peerPhoto();
|
||||
[[nodiscard]] Api::Polls &polls();
|
||||
[[nodiscard]] Api::TodoLists &todoLists();
|
||||
[[nodiscard]] Api::ChatParticipants &chatParticipants();
|
||||
[[nodiscard]] Api::UnreadThings &unreadThings();
|
||||
[[nodiscard]] Api::Ringtones &ringtones();
|
||||
@@ -503,18 +508,21 @@ private:
|
||||
void resolveJumpToHistoryDate(
|
||||
not_null<PeerData*> peer,
|
||||
MsgId topicRootId,
|
||||
PeerId monoforumPeerId,
|
||||
const QDate &date,
|
||||
Fn<void(not_null<PeerData*>, MsgId)> callback);
|
||||
template <typename Callback>
|
||||
void requestMessageAfterDate(
|
||||
not_null<PeerData*> peer,
|
||||
MsgId topicRootId,
|
||||
PeerId monoforumPeerId,
|
||||
const QDate &date,
|
||||
Callback &&callback);
|
||||
|
||||
void sharedMediaDone(
|
||||
not_null<PeerData*> peer,
|
||||
MsgId topicRootId,
|
||||
PeerId monoforumPeerId,
|
||||
SharedMediaType type,
|
||||
Api::SearchResult &&parsed);
|
||||
void globalMediaDone(
|
||||
@@ -540,6 +548,9 @@ private:
|
||||
void deleteAllFromParticipantSend(
|
||||
not_null<ChannelData*> channel,
|
||||
not_null<PeerData*> from);
|
||||
void deleteSublistHistorySend(
|
||||
not_null<ChannelData*> parentChat,
|
||||
not_null<PeerData*> sublistPeer);
|
||||
|
||||
void uploadAlbumMedia(
|
||||
not_null<HistoryItem*> item,
|
||||
@@ -569,9 +580,6 @@ private:
|
||||
not_null<SendingAlbum*> album,
|
||||
Fn<void(bool)> done = nullptr);
|
||||
|
||||
void getTopPromotionDelayed(TimeId now, TimeId next);
|
||||
void topPromotionDone(const MTPhelp_PromoData &proxy);
|
||||
|
||||
void sendNotifySettingsUpdates();
|
||||
|
||||
template <typename Request>
|
||||
@@ -663,6 +671,7 @@ private:
|
||||
struct SharedMediaRequest {
|
||||
not_null<PeerData*> peer;
|
||||
MsgId topicRootId = 0;
|
||||
PeerId monoforumPeerId = 0;
|
||||
SharedMediaType mediaType = {};
|
||||
MsgId aroundId = 0;
|
||||
SliceType sliceType = {};
|
||||
@@ -709,11 +718,6 @@ private:
|
||||
std::unique_ptr<TaskQueue> _fileLoader;
|
||||
base::flat_map<uint64, std::shared_ptr<SendingAlbum>> _sendingAlbums;
|
||||
|
||||
mtpRequestId _topPromotionRequestId = 0;
|
||||
std::pair<QString, uint32> _topPromotionKey;
|
||||
TimeId _topPromotionNextRequestTime = TimeId(0);
|
||||
base::Timer _topPromotionTimer;
|
||||
|
||||
base::flat_set<not_null<const Data::ForumTopic*>> _updateNotifyTopics;
|
||||
base::flat_set<not_null<const PeerData*>> _updateNotifyPeers;
|
||||
base::flat_set<Data::DefaultNotify> _updateNotifyDefaults;
|
||||
@@ -762,6 +766,7 @@ private:
|
||||
const std::unique_ptr<Api::ConfirmPhone> _confirmPhone;
|
||||
const std::unique_ptr<Api::PeerPhoto> _peerPhoto;
|
||||
const std::unique_ptr<Api::Polls> _polls;
|
||||
const std::unique_ptr<Api::TodoLists> _todoLists;
|
||||
const std::unique_ptr<Api::ChatParticipants> _chatParticipants;
|
||||
const std::unique_ptr<Api::UnreadThings> _unreadThings;
|
||||
const std::unique_ptr<Api::Ringtones> _ringtones;
|
||||
|
||||
@@ -7,18 +7,16 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "boxes/about_box.h"
|
||||
|
||||
#include "lang/lang_keys.h"
|
||||
#include "mainwidget.h"
|
||||
#include "mainwindow.h"
|
||||
#include "ui/boxes/confirm_box.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "base/platform/base_platform_info.h"
|
||||
#include "core/file_utilities.h"
|
||||
#include "core/click_handler_types.h"
|
||||
#include "core/update_checker.h"
|
||||
#include "core/application.h"
|
||||
#include "core/file_utilities.h"
|
||||
#include "core/update_checker.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "ui/boxes/confirm_box.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/vertical_list.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
@@ -57,78 +55,73 @@ rpl::producer<TextWithEntities> Text3() {
|
||||
|
||||
} // namespace
|
||||
|
||||
AboutBox::AboutBox(QWidget *parent)
|
||||
: _version(this, tr::lng_about_version(tr::now, lt_version, currentVersionText()), st::aboutVersionLink)
|
||||
, _text1(this, Text1(), st::aboutLabel)
|
||||
, _text2(this, Text2(), st::aboutLabel)
|
||||
, _text3(this, Text3(), st::aboutLabel) {
|
||||
}
|
||||
void AboutBox(not_null<Ui::GenericBox*> box) {
|
||||
box->setTitle(rpl::single(u"Telegram Desktop"_q));
|
||||
|
||||
void AboutBox::prepare() {
|
||||
setTitle(rpl::single(u"Telegram Desktop"_q));
|
||||
auto layout = box->verticalLayout();
|
||||
|
||||
addButton(tr::lng_close(), [this] { closeBox(); });
|
||||
const auto version = layout->add(
|
||||
object_ptr<Ui::LinkButton>(
|
||||
box,
|
||||
tr::lng_about_version(
|
||||
tr::now,
|
||||
lt_version,
|
||||
currentVersionText()),
|
||||
st::aboutVersionLink),
|
||||
QMargins(
|
||||
st::boxRowPadding.left(),
|
||||
-st::lineWidth * 3,
|
||||
st::boxRowPadding.right(),
|
||||
st::boxRowPadding.bottom()));
|
||||
version->setClickedCallback([=] {
|
||||
if (cRealAlphaVersion()) {
|
||||
auto url = u"https://tdesktop.com/"_q;
|
||||
if (Platform::IsWindows32Bit()) {
|
||||
url += u"win/%1.zip"_q;
|
||||
} else if (Platform::IsWindows64Bit()) {
|
||||
url += u"win64/%1.zip"_q;
|
||||
} else if (Platform::IsWindowsARM64()) {
|
||||
url += u"winarm/%1.zip"_q;
|
||||
} else if (Platform::IsMac()) {
|
||||
url += u"mac/%1.zip"_q;
|
||||
} else if (Platform::IsLinux()) {
|
||||
url += u"linux/%1.tar.xz"_q;
|
||||
} else {
|
||||
Unexpected("Platform value.");
|
||||
}
|
||||
url = url.arg(u"talpha%1_%2"_q
|
||||
.arg(cRealAlphaVersion())
|
||||
.arg(Core::countAlphaVersionSignature(cRealAlphaVersion())));
|
||||
|
||||
_text1->setLinksTrusted();
|
||||
_text2->setLinksTrusted();
|
||||
_text3->setLinksTrusted();
|
||||
QGuiApplication::clipboard()->setText(url);
|
||||
|
||||
_version->setClickedCallback([this] { showVersionHistory(); });
|
||||
|
||||
setDimensions(st::aboutWidth, st::aboutTextTop + _text1->height() + st::aboutSkip + _text2->height() + st::aboutSkip + _text3->height());
|
||||
}
|
||||
|
||||
void AboutBox::resizeEvent(QResizeEvent *e) {
|
||||
BoxContent::resizeEvent(e);
|
||||
|
||||
const auto available = width()
|
||||
- st::boxPadding.left()
|
||||
- st::boxPadding.right();
|
||||
_version->moveToLeft(st::boxPadding.left(), st::aboutVersionTop);
|
||||
_text1->resizeToWidth(available);
|
||||
_text1->moveToLeft(st::boxPadding.left(), st::aboutTextTop);
|
||||
_text2->resizeToWidth(available);
|
||||
_text2->moveToLeft(st::boxPadding.left(), _text1->y() + _text1->height() + st::aboutSkip);
|
||||
_text3->resizeToWidth(available);
|
||||
_text3->moveToLeft(st::boxPadding.left(), _text2->y() + _text2->height() + st::aboutSkip);
|
||||
}
|
||||
|
||||
void AboutBox::showVersionHistory() {
|
||||
if (cRealAlphaVersion()) {
|
||||
auto url = u"https://tdesktop.com/"_q;
|
||||
if (Platform::IsWindows32Bit()) {
|
||||
url += u"win/%1.zip"_q;
|
||||
} else if (Platform::IsWindows64Bit()) {
|
||||
url += u"win64/%1.zip"_q;
|
||||
} else if (Platform::IsWindowsARM64()) {
|
||||
url += u"winarm/%1.zip"_q;
|
||||
} else if (Platform::IsMac()) {
|
||||
url += u"mac/%1.zip"_q;
|
||||
} else if (Platform::IsLinux()) {
|
||||
url += u"linux/%1.tar.xz"_q;
|
||||
box->getDelegate()->show(
|
||||
Ui::MakeInformBox(
|
||||
"The link to the current private alpha "
|
||||
"version of Telegram Desktop was copied "
|
||||
"to the clipboard."));
|
||||
} else {
|
||||
Unexpected("Platform value.");
|
||||
File::OpenUrl(Core::App().changelogLink());
|
||||
}
|
||||
url = url.arg(u"talpha%1_%2"_q.arg(cRealAlphaVersion()).arg(Core::countAlphaVersionSignature(cRealAlphaVersion())));
|
||||
});
|
||||
|
||||
QGuiApplication::clipboard()->setText(url);
|
||||
Ui::AddSkip(layout, st::aboutTopSkip);
|
||||
|
||||
getDelegate()->show(
|
||||
Ui::MakeInformBox(
|
||||
"The link to the current private alpha "
|
||||
"version of Telegram Desktop was copied to the clipboard."),
|
||||
Ui::LayerOption::CloseOther);
|
||||
} else {
|
||||
File::OpenUrl(Core::App().changelogLink());
|
||||
}
|
||||
}
|
||||
const auto addText = [&](rpl::producer<TextWithEntities> text) {
|
||||
const auto label = layout->add(
|
||||
object_ptr<Ui::FlatLabel>(box, std::move(text), st::aboutLabel),
|
||||
st::boxRowPadding);
|
||||
label->setLinksTrusted();
|
||||
Ui::AddSkip(layout, st::aboutSkip);
|
||||
};
|
||||
|
||||
void AboutBox::keyPressEvent(QKeyEvent *e) {
|
||||
if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) {
|
||||
closeBox();
|
||||
} else {
|
||||
BoxContent::keyPressEvent(e);
|
||||
}
|
||||
addText(Text1());
|
||||
addText(Text2());
|
||||
addText(Text3());
|
||||
|
||||
box->addButton(tr::lng_close(), [=] { box->closeBox(); });
|
||||
|
||||
box->setWidth(st::aboutWidth);
|
||||
}
|
||||
|
||||
QString telegramFaqLink() {
|
||||
@@ -160,5 +153,8 @@ QString currentVersionText() {
|
||||
} else if (Platform::IsWindowsARM64()) {
|
||||
result += " arm64";
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
result += " DEBUG";
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -7,32 +7,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "ui/layers/box_content.h"
|
||||
#include "ui/layers/generic_box.h"
|
||||
|
||||
namespace Ui {
|
||||
class LinkButton;
|
||||
class FlatLabel;
|
||||
} // namespace Ui
|
||||
|
||||
class AboutBox : public Ui::BoxContent {
|
||||
public:
|
||||
AboutBox(QWidget*);
|
||||
|
||||
protected:
|
||||
void prepare() override;
|
||||
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
void keyPressEvent(QKeyEvent *e) override;
|
||||
|
||||
private:
|
||||
void showVersionHistory();
|
||||
|
||||
object_ptr<Ui::LinkButton> _version;
|
||||
object_ptr<Ui::FlatLabel> _text1;
|
||||
object_ptr<Ui::FlatLabel> _text2;
|
||||
object_ptr<Ui::FlatLabel> _text3;
|
||||
|
||||
};
|
||||
void AboutBox(not_null<Ui::GenericBox*> box);
|
||||
|
||||
QString telegramFaqLink();
|
||||
QString currentVersionText();
|
||||
|
||||
@@ -559,7 +559,7 @@ void GroupInfoBox::prepare() {
|
||||
&_navigation->parentController()->window(),
|
||||
Ui::UserpicButton::Role::ChoosePhoto,
|
||||
st::defaultUserpicButton,
|
||||
(_type == Type::Forum));
|
||||
(_type == Type::Forum) ? Ui::PeerUserpicShape::Forum : Ui::PeerUserpicShape::Auto);
|
||||
_photo->showCustomOnChosen();
|
||||
_title.create(
|
||||
this,
|
||||
|
||||
@@ -349,7 +349,7 @@ aboutVersionLink: LinkButton(defaultLinkButton) {
|
||||
color: windowSubTextFg;
|
||||
overColor: windowSubTextFg;
|
||||
}
|
||||
aboutTextTop: 34px;
|
||||
aboutTopSkip: 19px;
|
||||
aboutSkip: 14px;
|
||||
aboutLabel: FlatLabel(defaultFlatLabel) {
|
||||
minWidth: 300px;
|
||||
|
||||
@@ -316,16 +316,23 @@ void FillChooseFilterMenu(
|
||||
return;
|
||||
}
|
||||
const auto session = &strong->session();
|
||||
const auto count = session->data().chatsFilters().list().size();
|
||||
if ((count - 1) >= limit()) {
|
||||
const auto &list = session->data().chatsFilters().list();
|
||||
if ((list.size() - 1) >= limit()) {
|
||||
return;
|
||||
}
|
||||
const auto chooseNextId = [&] {
|
||||
auto id = 2;
|
||||
while (ranges::contains(list, id, &Data::ChatFilter::id)) {
|
||||
++id;
|
||||
}
|
||||
return id;
|
||||
};
|
||||
auto filter =
|
||||
Data::ChatFilter({}, {}, {}, {}, {}, { history }, {}, {});
|
||||
const auto send = [=](const Data::ChatFilter &filter) {
|
||||
session->api().request(MTPmessages_UpdateDialogFilter(
|
||||
MTP_flags(MTPmessages_UpdateDialogFilter::Flag::f_filter),
|
||||
MTP_int(count),
|
||||
MTP_int(chooseNextId()),
|
||||
filter.tl()
|
||||
)).done([=] {
|
||||
session->data().chatsFilters().reload();
|
||||
|
||||
@@ -16,9 +16,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "lang/lang_keys.h"
|
||||
#include "main/main_account.h"
|
||||
#include "mtproto/facade.h"
|
||||
#include "settings/settings_common.h"
|
||||
#include "storage/localstorage.h"
|
||||
#include "ui/basic_click_handlers.h"
|
||||
#include "ui/boxes/confirm_box.h"
|
||||
#include "ui/boxes/peer_qr_box.h"
|
||||
#include "ui/effects/animations.h"
|
||||
#include "ui/effects/radial_animation.h"
|
||||
#include "ui/painter.h"
|
||||
@@ -32,6 +34,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/widgets/fields/number_input.h"
|
||||
#include "ui/widgets/fields/password_input.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/widgets/menu/menu_add_action_callback.h"
|
||||
#include "ui/widgets/menu/menu_add_action_callback_factory.h"
|
||||
#include "ui/widgets/popup_menu.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
@@ -44,6 +48,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "styles/style_chat_helpers.h"
|
||||
#include "styles/style_info.h"
|
||||
#include "styles/style_menu_icons.h"
|
||||
#include "styles/style_settings.h"
|
||||
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtGui/QClipboard>
|
||||
@@ -54,6 +59,31 @@ constexpr auto kSaveSettingsDelayedTimeout = crl::time(1000);
|
||||
|
||||
using ProxyData = MTP::ProxyData;
|
||||
|
||||
[[nodiscard]] std::vector<QString> ExtractUrlsSimple(const QString &input) {
|
||||
auto urls = std::vector<QString>();
|
||||
static auto urlRegex = QRegularExpression(R"((https?:\/\/[^\s]+))");
|
||||
|
||||
auto it = urlRegex.globalMatch(input);
|
||||
while (it.hasNext()) {
|
||||
urls.push_back(it.next().captured(1));
|
||||
}
|
||||
|
||||
return urls;
|
||||
}
|
||||
|
||||
[[nodiscard]] QString ProxyDataToString(const ProxyData &proxy) {
|
||||
using Type = ProxyData::Type;
|
||||
return u"https://t.me/"_q
|
||||
+ (proxy.type == Type::Socks5 ? "socks" : "proxy")
|
||||
+ "?server=" + proxy.host + "&port=" + QString::number(proxy.port)
|
||||
+ ((proxy.type == Type::Socks5 && !proxy.user.isEmpty())
|
||||
? "&user=" + qthelp::url_encode(proxy.user) : "")
|
||||
+ ((proxy.type == Type::Socks5 && !proxy.password.isEmpty())
|
||||
? "&pass=" + qthelp::url_encode(proxy.password) : "")
|
||||
+ ((proxy.type == Type::Mtproto && !proxy.password.isEmpty())
|
||||
? "&secret=" + proxy.password : "");
|
||||
}
|
||||
|
||||
[[nodiscard]] ProxyData ProxyDataFromFields(
|
||||
ProxyData::Type type,
|
||||
const QMap<QString, QString> &fields) {
|
||||
@@ -70,6 +100,80 @@ using ProxyData = MTP::ProxyData;
|
||||
return proxy;
|
||||
};
|
||||
|
||||
void AddProxyFromClipboard(
|
||||
not_null<ProxiesBoxController*> controller,
|
||||
std::shared_ptr<Ui::Show> show) {
|
||||
const auto proxyString = u"proxy"_q;
|
||||
const auto socksString = u"socks"_q;
|
||||
const auto protocol = u"tg://"_q;
|
||||
|
||||
const auto maybeUrls = ExtractUrlsSimple(
|
||||
QGuiApplication::clipboard()->text());
|
||||
const auto isSingle = maybeUrls.size() == 1;
|
||||
|
||||
const auto proceedUrl = [=](const auto &local) {
|
||||
const auto command = base::StringViewMid(
|
||||
local,
|
||||
protocol.size(),
|
||||
8192);
|
||||
|
||||
if (local.startsWith(protocol + proxyString)
|
||||
|| local.startsWith(protocol + socksString)) {
|
||||
|
||||
using namespace qthelp;
|
||||
const auto options = RegExOption::CaseInsensitive;
|
||||
for (const auto &[expression, _] : Core::LocalUrlHandlers()) {
|
||||
const auto midExpression = base::StringViewMid(
|
||||
expression,
|
||||
1);
|
||||
const auto isSocks = midExpression.startsWith(
|
||||
socksString);
|
||||
if (!midExpression.startsWith(proxyString)
|
||||
&& !isSocks) {
|
||||
continue;
|
||||
}
|
||||
const auto match = regex_match(
|
||||
expression,
|
||||
command,
|
||||
options);
|
||||
if (!match) {
|
||||
continue;
|
||||
}
|
||||
const auto type = isSocks
|
||||
? ProxyData::Type::Socks5
|
||||
: ProxyData::Type::Mtproto;
|
||||
const auto fields = url_parse_params(
|
||||
match->captured(1),
|
||||
qthelp::UrlParamNameTransform::ToLower);
|
||||
const auto proxy = ProxyDataFromFields(type, fields);
|
||||
const auto contains = controller->contains(proxy);
|
||||
const auto toast = (contains
|
||||
? tr::lng_proxy_add_from_clipboard_existing_toast
|
||||
: tr::lng_proxy_add_from_clipboard_good_toast)(tr::now);
|
||||
if (isSingle) {
|
||||
show->showToast(toast);
|
||||
}
|
||||
if (!contains) {
|
||||
controller->addNewItem(proxy);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
auto success = false;
|
||||
for (const auto &maybeUrl : maybeUrls) {
|
||||
success |= proceedUrl(Core::TryConvertUrlToLocal(maybeUrl));
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
show->showToast(
|
||||
tr::lng_proxy_add_from_clipboard_failed_toast(tr::now));
|
||||
}
|
||||
}
|
||||
|
||||
class HostInput : public Ui::MaskedInputField {
|
||||
public:
|
||||
HostInput(
|
||||
@@ -177,6 +281,7 @@ public:
|
||||
rpl::producer<> restoreClicks() const;
|
||||
rpl::producer<> editClicks() const;
|
||||
rpl::producer<> shareClicks() const;
|
||||
rpl::producer<> showQrClicks() const;
|
||||
|
||||
protected:
|
||||
int resizeGetHeight(int newWidth) override;
|
||||
@@ -198,6 +303,7 @@ private:
|
||||
rpl::event_stream<> _restoreClicks;
|
||||
rpl::event_stream<> _editClicks;
|
||||
rpl::event_stream<> _shareClicks;
|
||||
rpl::event_stream<> _showQrClicks;
|
||||
base::unique_qptr<Ui::DropdownMenu> _menu;
|
||||
|
||||
bool _set = false;
|
||||
@@ -222,6 +328,7 @@ public:
|
||||
|
||||
protected:
|
||||
void prepare() override;
|
||||
void keyPressEvent(QKeyEvent *e) override;
|
||||
|
||||
private:
|
||||
void setupContent();
|
||||
@@ -319,6 +426,10 @@ rpl::producer<> ProxyRow::shareClicks() const {
|
||||
return _shareClicks.events();
|
||||
}
|
||||
|
||||
rpl::producer<> ProxyRow::showQrClicks() const {
|
||||
return _showQrClicks.events();
|
||||
}
|
||||
|
||||
void ProxyRow::setupControls(View &&view) {
|
||||
updateFields(std::move(view));
|
||||
_toggled.stop();
|
||||
@@ -563,6 +674,9 @@ void ProxyRow::showMenu() {
|
||||
addAction(tr::lng_proxy_edit_share(tr::now), [=] {
|
||||
_shareClicks.fire({});
|
||||
}, &st::menuIconShare);
|
||||
addAction(tr::lng_group_invite_context_qr(tr::now), [=] {
|
||||
_showQrClicks.fire({});
|
||||
}, &st::menuIconQrCode);
|
||||
}
|
||||
if (_view.deleted) {
|
||||
addAction(tr::lng_proxy_menu_restore(tr::now), [=] {
|
||||
@@ -617,6 +731,18 @@ ProxiesBox::ProxiesBox(
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
void ProxiesBox::keyPressEvent(QKeyEvent *e) {
|
||||
if (e->key() == Qt::Key_Copy
|
||||
|| (e->key() == Qt::Key_C && e->modifiers() == Qt::ControlModifier)) {
|
||||
_controller->shareItems();
|
||||
} else if (e->key() == Qt::Key_Paste
|
||||
|| (e->key() == Qt::Key_V && e->modifiers() == Qt::ControlModifier)) {
|
||||
AddProxyFromClipboard(_controller, uiShow());
|
||||
} else {
|
||||
BoxContent::keyPressEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
void ProxiesBox::prepare() {
|
||||
setTitle(tr::lng_proxy_settings());
|
||||
|
||||
@@ -631,67 +757,23 @@ void ProxiesBox::setupTopButton() {
|
||||
const auto top = addTopButton(st::infoTopBarMenu);
|
||||
const auto menu
|
||||
= top->lifetime().make_state<base::unique_qptr<Ui::PopupMenu>>();
|
||||
const auto callback = [=] {
|
||||
const auto maybeUrl = QGuiApplication::clipboard()->text();
|
||||
const auto local = Core::TryConvertUrlToLocal(maybeUrl);
|
||||
|
||||
const auto proxyString = u"proxy"_q;
|
||||
const auto socksString = u"socks"_q;
|
||||
const auto protocol = u"tg://"_q;
|
||||
const auto command = base::StringViewMid(
|
||||
local,
|
||||
protocol.size(),
|
||||
8192);
|
||||
|
||||
if (local.startsWith(protocol + proxyString)
|
||||
|| local.startsWith(protocol + socksString)) {
|
||||
|
||||
using namespace qthelp;
|
||||
const auto options = RegExOption::CaseInsensitive;
|
||||
for (const auto &[expression, _] : Core::LocalUrlHandlers()) {
|
||||
const auto midExpression = base::StringViewMid(
|
||||
expression,
|
||||
1);
|
||||
const auto isSocks = midExpression.startsWith(
|
||||
socksString);
|
||||
if (!midExpression.startsWith(proxyString)
|
||||
&& !isSocks) {
|
||||
continue;
|
||||
}
|
||||
const auto match = regex_match(
|
||||
expression,
|
||||
command,
|
||||
options);
|
||||
if (!match) {
|
||||
continue;
|
||||
}
|
||||
const auto type = isSocks
|
||||
? ProxyData::Type::Socks5
|
||||
: ProxyData::Type::Mtproto;
|
||||
const auto fields = url_parse_params(
|
||||
match->captured(1),
|
||||
qthelp::UrlParamNameTransform::ToLower);
|
||||
const auto proxy = ProxyDataFromFields(type, fields);
|
||||
const auto contains = _controller->contains(proxy);
|
||||
const auto toast = (contains
|
||||
? tr::lng_proxy_add_from_clipboard_existing_toast
|
||||
: tr::lng_proxy_add_from_clipboard_good_toast)(tr::now);
|
||||
uiShow()->showToast(toast);
|
||||
if (!contains) {
|
||||
_controller->addNewItem(proxy);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
uiShow()->showToast(
|
||||
tr::lng_proxy_add_from_clipboard_failed_toast(tr::now));
|
||||
}
|
||||
};
|
||||
top->setClickedCallback([=] {
|
||||
*menu = base::make_unique_q<Ui::PopupMenu>(top, st::defaultPopupMenu);
|
||||
(*menu)->addAction(
|
||||
tr::lng_proxy_add_from_clipboard(tr::now),
|
||||
callback);
|
||||
*menu = base::make_unique_q<Ui::PopupMenu>(
|
||||
top,
|
||||
st::popupMenuWithIcons);
|
||||
const auto addAction = Ui::Menu::CreateAddActionCallback(*menu);
|
||||
addAction({
|
||||
.text = tr::lng_proxy_add_from_clipboard(tr::now),
|
||||
.handler = [=] { AddProxyFromClipboard(_controller, uiShow()); },
|
||||
.icon = &st::menuIconImportTheme,
|
||||
});
|
||||
addAction({
|
||||
.text = tr::lng_group_invite_context_delete_all(tr::now),
|
||||
.handler = [=] { _controller->deleteItems(); },
|
||||
.icon = &st::menuIconDeleteAttention,
|
||||
.isAttention = true,
|
||||
});
|
||||
(*menu)->popup(QCursor::pos());
|
||||
return true;
|
||||
});
|
||||
@@ -791,6 +873,23 @@ void ProxiesBox::setupContent() {
|
||||
refreshProxyForCalls();
|
||||
_proxyForCalls->finishAnimating();
|
||||
|
||||
{
|
||||
const auto wrap = inner->add(
|
||||
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
||||
inner,
|
||||
object_ptr<Ui::VerticalLayout>(inner)));
|
||||
const auto shareList = Settings::AddButtonWithIcon(
|
||||
wrap->entity(),
|
||||
tr::lng_proxy_edit_share_list_button(),
|
||||
st::settingsButton,
|
||||
{ &st::menuIconCopy });
|
||||
shareList->setClickedCallback([=] {
|
||||
_controller->shareItems();
|
||||
});
|
||||
wrap->toggleOn(_controller->listShareableChanges());
|
||||
wrap->finishAnimating();
|
||||
}
|
||||
|
||||
inner->resizeToWidth(st::boxWideWidth);
|
||||
|
||||
inner->heightValue(
|
||||
@@ -898,9 +997,11 @@ void ProxiesBox::setupButtons(int id, not_null<ProxyRow*> button) {
|
||||
getDelegate()->show(_controller->editItemBox(id));
|
||||
}, button->lifetime());
|
||||
|
||||
button->shareClicks(
|
||||
) | rpl::start_with_next([=] {
|
||||
_controller->shareItem(id);
|
||||
rpl::merge(
|
||||
button->shareClicks() | rpl::map_to(false),
|
||||
button->showQrClicks() | rpl::map_to(true)
|
||||
) | rpl::start_with_next([=](bool qr) {
|
||||
_controller->shareItem(id, qr);
|
||||
}, button->lifetime());
|
||||
|
||||
button->clicks(
|
||||
@@ -1407,12 +1508,32 @@ void ProxiesBoxController::deleteItem(int id) {
|
||||
setDeleted(id, true);
|
||||
}
|
||||
|
||||
void ProxiesBoxController::deleteItems() {
|
||||
for (const auto &item : _list) {
|
||||
setDeleted(item.id, true);
|
||||
}
|
||||
}
|
||||
|
||||
void ProxiesBoxController::restoreItem(int id) {
|
||||
setDeleted(id, false);
|
||||
}
|
||||
|
||||
void ProxiesBoxController::shareItem(int id) {
|
||||
share(findById(id)->data);
|
||||
void ProxiesBoxController::shareItem(int id, bool qr) {
|
||||
share(findById(id)->data, qr);
|
||||
}
|
||||
|
||||
void ProxiesBoxController::shareItems() {
|
||||
auto result = QString();
|
||||
for (const auto &item : _list) {
|
||||
if (!item.deleted) {
|
||||
result += ProxyDataToString(item.data) + '\n' + '\n';
|
||||
}
|
||||
}
|
||||
if (result.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
QGuiApplication::clipboard()->setText(result);
|
||||
_show->showToast(tr::lng_proxy_edit_share_list_toast(tr::now));
|
||||
}
|
||||
|
||||
void ProxiesBoxController::applyItem(int id) {
|
||||
@@ -1621,6 +1742,17 @@ auto ProxiesBoxController::views() const -> rpl::producer<ItemView> {
|
||||
return _views.events();
|
||||
}
|
||||
|
||||
rpl::producer<bool> ProxiesBoxController::listShareableChanges() const {
|
||||
return _views.events_starting_with(ItemView()) | rpl::map([=] {
|
||||
for (const auto &item : _list) {
|
||||
if (!item.deleted) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
void ProxiesBoxController::updateView(const Item &item) {
|
||||
const auto selected = (_settings.selected() == item.data);
|
||||
const auto deleted = item.deleted;
|
||||
@@ -1653,22 +1785,22 @@ void ProxiesBoxController::updateView(const Item &item) {
|
||||
deleted,
|
||||
!deleted && supportsShare,
|
||||
supportsCalls,
|
||||
state });
|
||||
state,
|
||||
});
|
||||
}
|
||||
|
||||
void ProxiesBoxController::share(const ProxyData &proxy) {
|
||||
void ProxiesBoxController::share(const ProxyData &proxy, bool qr) {
|
||||
if (proxy.type == Type::Http) {
|
||||
return;
|
||||
}
|
||||
const auto link = u"https://t.me/"_q
|
||||
+ (proxy.type == Type::Socks5 ? "socks" : "proxy")
|
||||
+ "?server=" + proxy.host + "&port=" + QString::number(proxy.port)
|
||||
+ ((proxy.type == Type::Socks5 && !proxy.user.isEmpty())
|
||||
? "&user=" + qthelp::url_encode(proxy.user) : "")
|
||||
+ ((proxy.type == Type::Socks5 && !proxy.password.isEmpty())
|
||||
? "&pass=" + qthelp::url_encode(proxy.password) : "")
|
||||
+ ((proxy.type == Type::Mtproto && !proxy.password.isEmpty())
|
||||
? "&secret=" + proxy.password : "");
|
||||
const auto link = ProxyDataToString(proxy);
|
||||
if (qr) {
|
||||
_show->showBox(Box([=](not_null<Ui::GenericBox*> box) {
|
||||
Ui::FillPeerQrBox(box, nullptr, link, rpl::single(QString()));
|
||||
box->setTitle(tr::lng_proxy_edit_share_qr_box_title());
|
||||
}));
|
||||
return;
|
||||
}
|
||||
QGuiApplication::clipboard()->setText(link);
|
||||
_show->showToast(tr::lng_username_copied(tr::now));
|
||||
}
|
||||
|
||||
@@ -72,8 +72,10 @@ public:
|
||||
};
|
||||
|
||||
void deleteItem(int id);
|
||||
void deleteItems();
|
||||
void restoreItem(int id);
|
||||
void shareItem(int id);
|
||||
void shareItem(int id, bool qr);
|
||||
void shareItems();
|
||||
void applyItem(int id);
|
||||
object_ptr<Ui::BoxContent> editItemBox(int id);
|
||||
object_ptr<Ui::BoxContent> addNewItemBox();
|
||||
@@ -87,6 +89,8 @@ public:
|
||||
|
||||
rpl::producer<ItemView> views() const;
|
||||
|
||||
rpl::producer<bool> listShareableChanges() const;
|
||||
|
||||
~ProxiesBoxController();
|
||||
|
||||
private:
|
||||
@@ -106,7 +110,7 @@ private:
|
||||
std::vector<Item>::iterator findByProxy(const ProxyData &proxy);
|
||||
void setDeleted(int id, bool deleted);
|
||||
void updateView(const Item &item);
|
||||
void share(const ProxyData &proxy);
|
||||
void share(const ProxyData &proxy, bool qr = false);
|
||||
void saveDelayed();
|
||||
void refreshChecker(Item &item);
|
||||
void setupChecker(int id, const Checker &checker);
|
||||
|
||||
@@ -22,6 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/stickers/data_custom_emoji.h"
|
||||
#include "history/view/history_view_schedule_box.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "main/main_app_config.h"
|
||||
#include "main/main_session.h"
|
||||
#include "menu/menu_send.h"
|
||||
#include "ui/controls/emoji_button.h"
|
||||
@@ -113,7 +114,7 @@ private:
|
||||
void setPlaceholder() const;
|
||||
void removePlaceholder() const;
|
||||
|
||||
not_null<Ui::InputField*> field() const;
|
||||
[[nodiscard]] not_null<Ui::InputField*> field() const;
|
||||
|
||||
[[nodiscard]] PollAnswer toPollAnswer(int index) const;
|
||||
|
||||
@@ -510,7 +511,8 @@ Options::Options(
|
||||
}
|
||||
|
||||
bool Options::full() const {
|
||||
return (_list.size() == kMaxOptionsCount);
|
||||
const auto limit = _controller->session().appConfig().pollOptionsLimit();
|
||||
return (_list.size() >= limit);
|
||||
}
|
||||
|
||||
bool Options::hasOptions() const {
|
||||
@@ -1028,8 +1030,10 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
|
||||
setCloseByEscape(!count);
|
||||
setCloseByOutsideClick(!count);
|
||||
}) | rpl::map([=](int count) {
|
||||
return (count < kMaxOptionsCount)
|
||||
? tr::lng_polls_create_limit(tr::now, lt_count, kMaxOptionsCount - count)
|
||||
const auto appConfig = &_controller->session().appConfig();
|
||||
const auto max = appConfig->pollOptionsLimit();
|
||||
return (count < max)
|
||||
? tr::lng_polls_create_limit(tr::now, lt_count, max - count)
|
||||
: tr::lng_polls_create_maximum(tr::now);
|
||||
}) | rpl::after_next([=] {
|
||||
container->resizeToWidth(container->widthNoMargins());
|
||||
|
||||
@@ -21,8 +21,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "history/history.h"
|
||||
#include "history/history_item.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "main/main_app_config.h"
|
||||
#include "main/main_session.h"
|
||||
#include "menu/menu_ttl_validator.h"
|
||||
#include "ui/boxes/confirm_box.h"
|
||||
#include "ui/layers/generic_box.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
@@ -492,7 +494,58 @@ void DeleteMessagesBox::keyPressEvent(QKeyEvent *e) {
|
||||
}
|
||||
}
|
||||
|
||||
PaidPostType DeleteMessagesBox::paidPostType() const {
|
||||
auto result = PaidPostType::None;
|
||||
const auto now = base::unixtime::now();
|
||||
for (const auto &id : _ids) {
|
||||
if (const auto item = _session->data().message(id)) {
|
||||
const auto type = item->paidType();
|
||||
if (type != PaidPostType::None) {
|
||||
const auto date = item->date();
|
||||
const auto config = &item->history()->session().appConfig();
|
||||
const auto limit = config->suggestedPostAgeMin();
|
||||
if (now < date || now - date <= limit) {
|
||||
if (type == PaidPostType::Ton) {
|
||||
return type;
|
||||
} else if (type == PaidPostType::Stars) {
|
||||
result = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void DeleteMessagesBox::deleteAndClear() {
|
||||
const auto warnPaidType = _confirmedDeletePaidSuggestedPosts
|
||||
? PaidPostType::None
|
||||
: paidPostType();
|
||||
if (warnPaidType != PaidPostType::None) {
|
||||
const auto weak = Ui::MakeWeak(this);
|
||||
const auto callback = [=](Fn<void()> close) {
|
||||
close();
|
||||
if (const auto strong = weak.data()) {
|
||||
strong->_confirmedDeletePaidSuggestedPosts = true;
|
||||
strong->deleteAndClear();
|
||||
}
|
||||
};
|
||||
const auto ton = (warnPaidType == PaidPostType::Ton);
|
||||
uiShow()->show(Ui::MakeConfirmBox({
|
||||
.text = (ton
|
||||
? tr::lng_suggest_warn_text_ton
|
||||
: tr::lng_suggest_warn_text_stars)(
|
||||
tr::now,
|
||||
Ui::Text::RichLangValue),
|
||||
.confirmed = callback,
|
||||
.confirmText = tr::lng_suggest_warn_delete_anyway(tr::now),
|
||||
.confirmStyle = &st::attentionBoxButton,
|
||||
.title = (ton
|
||||
? tr::lng_suggest_warn_title_ton
|
||||
: tr::lng_suggest_warn_title_stars)(tr::now),
|
||||
}));
|
||||
return;
|
||||
}
|
||||
if (_revoke
|
||||
&& _revokeRemember
|
||||
&& _revokeRemember->toggled()
|
||||
|
||||