Compare commits
136 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5739a37c7f | ||
|
|
8639936e45 | ||
|
|
89d9270ea6 | ||
|
|
e52aa98a9f | ||
|
|
af24830233 | ||
|
|
bece15eaac | ||
|
|
e762ec4631 | ||
|
|
7341c05d36 | ||
|
|
b1bf68b830 | ||
|
|
1a071c5c6b | ||
|
|
6de7e7f4a8 | ||
|
|
632a14e65a | ||
|
|
321576658f | ||
|
|
fac241b87e | ||
|
|
39bd52c1e2 | ||
|
|
e55f394db5 | ||
|
|
00d7eeb742 | ||
|
|
bcfa106959 | ||
|
|
fe3c545455 | ||
|
|
885d431d65 | ||
|
|
a103047e03 | ||
|
|
b04866a2fc | ||
|
|
28434f4bee | ||
|
|
53324d5494 | ||
|
|
66645ce523 | ||
|
|
06caf65a6a | ||
|
|
5026b07626 | ||
|
|
8cfa722966 | ||
|
|
f31337ecb5 | ||
|
|
f468666973 | ||
|
|
590421daaa | ||
|
|
e1248ba0b2 | ||
|
|
89b15142ef | ||
|
|
57b22d2ad2 | ||
|
|
d51dd1cdb5 | ||
|
|
6418af0ada | ||
|
|
08d6e8c7eb | ||
|
|
cf7ae1adf2 | ||
|
|
691f796df6 | ||
|
|
2775074113 | ||
|
|
bf9014342c | ||
|
|
fb9a456b59 | ||
|
|
e36e52fd9e | ||
|
|
f076793fa6 | ||
|
|
0116f098f8 | ||
|
|
fc728e7a13 | ||
|
|
5114c9a58e | ||
|
|
3bd896b8fa | ||
|
|
dddefc3904 | ||
|
|
fc0cbaadd5 | ||
|
|
6b862688cb | ||
|
|
767eedaa76 | ||
|
|
1578c3c09d | ||
|
|
9496ebd19e | ||
|
|
1ea2d936b5 | ||
|
|
6ce7641971 | ||
|
|
98f5247126 | ||
|
|
bf36718c93 | ||
|
|
11c193b699 | ||
|
|
5c1604fc53 | ||
|
|
4c545181ad | ||
|
|
5ee8100274 | ||
|
|
86351f48d6 | ||
|
|
6996e410d5 | ||
|
|
5d6994f170 | ||
|
|
beb4fafdf3 | ||
|
|
3e22cb6d0a | ||
|
|
849def7e75 | ||
|
|
1a4195f7e2 | ||
|
|
0b4a718afe | ||
|
|
b53ca51d37 | ||
|
|
60c9707a64 | ||
|
|
08a979e638 | ||
|
|
629158fedb | ||
|
|
f15e99ce1d | ||
|
|
18f9c040e0 | ||
|
|
7f6baa0fdc | ||
|
|
bb9a112677 | ||
|
|
7952d2688e | ||
|
|
0f41fd1356 | ||
|
|
8c3a8a7d20 | ||
|
|
dbbe4b9398 | ||
|
|
e0b0f00621 | ||
|
|
516d6cf11e | ||
|
|
673db168ac | ||
|
|
496e96d00a | ||
|
|
88fdc16070 | ||
|
|
df98cdb127 | ||
|
|
68b245c3d6 | ||
|
|
0248c8d8c0 | ||
|
|
3ac517b716 | ||
|
|
8414c3e382 | ||
|
|
9f8dc1d7d3 | ||
|
|
56927d2780 | ||
|
|
a027284826 | ||
|
|
e0159c32cc | ||
|
|
9cc30741d9 | ||
|
|
863752e974 | ||
|
|
cb76031165 | ||
|
|
c45cf07b06 | ||
|
|
d35d425918 | ||
|
|
d4a3a53484 | ||
|
|
5d90b12a08 | ||
|
|
e3ce190f4e | ||
|
|
ffd50c5582 | ||
|
|
c758f05a7a | ||
|
|
9263c08068 | ||
|
|
703f77ac93 | ||
|
|
32bdb5a519 | ||
|
|
d8484a7b2b | ||
|
|
eca8dfb0ec | ||
|
|
29b714dd5f | ||
|
|
3f3b2cb2ba | ||
|
|
c31d9ded27 | ||
|
|
03df5b8546 | ||
|
|
03e1e5cca9 | ||
|
|
10d5cc0d24 | ||
|
|
506c8ff73c | ||
|
|
924e9a21b5 | ||
|
|
2f528a9853 | ||
|
|
7f58650794 | ||
|
|
b9a109c146 | ||
|
|
9fb4f4b556 | ||
|
|
52d78ef724 | ||
|
|
7ce7b88a40 | ||
|
|
4a43dfd091 | ||
|
|
52cc76636c | ||
|
|
f0a3ddb184 | ||
|
|
b172c9a3b2 | ||
|
|
6cfda1dd43 | ||
|
|
2ae31f7285 | ||
|
|
412c06160a | ||
|
|
c27c47dd52 | ||
|
|
6ea30feb18 | ||
|
|
a7be550550 | ||
|
|
a279f0a296 |
@@ -60,7 +60,7 @@ rpl::lifetime &parentLifetime = /* ... get lifetime from context ... */;
|
||||
|
||||
To consume values from a producer, you start a pipeline using one of the `rpl::start_...` methods. These methods subscribe to the producer and execute callbacks for the events they handle.
|
||||
|
||||
The most common method is `rpl::start_with_next`:
|
||||
The most common method is `rpl::on_next`:
|
||||
|
||||
```cpp
|
||||
auto counter = /* ... */; // Type: rpl::producer<int>
|
||||
@@ -69,20 +69,20 @@ 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::on_next([=]\(int nextValue) {
|
||||
// Process the next integer value emitted by the producer.
|
||||
qDebug() << "Received: " << nextValue;
|
||||
}, lifetime); // Pass the lifetime to manage the subscription.
|
||||
// Note: `counter` is now in a moved-from state and likely invalid.
|
||||
|
||||
// If you need to start the same producer multiple times, duplicate it:
|
||||
// rpl::duplicate(counter) | rpl::start_with_next(...);
|
||||
// rpl::duplicate(counter) | rpl::on_next(...);
|
||||
|
||||
// If you DON'T pass a lifetime to a start_... method:
|
||||
auto counter2 = /* ... */; // Type: rpl::producer<int>
|
||||
rpl::lifetime subscriptionLifetime = std::move(
|
||||
counter2
|
||||
) | rpl::start_with_next([=]\(int nextValue) { /* ... */ });
|
||||
) | rpl::on_next([=]\(int nextValue) { /* ... */ });
|
||||
// The returned lifetime MUST be stored. If it's discarded immediately,
|
||||
// the subscription stops instantly.
|
||||
// `counter2` is also moved-from here.
|
||||
@@ -98,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::on_error([=]\(Error &&error) {
|
||||
// Handle the error signaled by the producer.
|
||||
qDebug() << "Error: " << error.text();
|
||||
}, lifetime);
|
||||
@@ -106,7 +106,7 @@ rpl::duplicate(
|
||||
// Using dataStream again, perhaps duplicated again or moved if last use.
|
||||
rpl::duplicate(
|
||||
dataStream
|
||||
) | rpl::start_with_done([=] {
|
||||
) | rpl::on_done([=] {
|
||||
// Execute when the producer signals it's finished emitting values.
|
||||
qDebug() << "Stream finished.";
|
||||
}, lifetime);
|
||||
@@ -114,7 +114,7 @@ rpl::duplicate(
|
||||
// Last use of dataStream, so we move it.
|
||||
std::move(
|
||||
dataStream
|
||||
) | rpl::start_with_next_error_done(
|
||||
) | rpl::on_next_error_done(
|
||||
[=]\(QString &&value) { /* handle next value */ },
|
||||
[=]\(Error &&error) { /* handle error */ },
|
||||
[=] { /* handle done */ },
|
||||
@@ -169,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::on_next([=]\(int count, const QString &text) {
|
||||
// No need for std::get<0>(latest), etc.
|
||||
qDebug() << "Combined: Count=" << count << ", Text=" << text;
|
||||
}, lifetime);
|
||||
@@ -181,7 +181,7 @@ You can combine multiple producers into one:
|
||||
return count > 0 && !text.isEmpty();
|
||||
}) | rpl::map([=]\(int count, const QString &text) {
|
||||
return text.repeated(count);
|
||||
}) | rpl::start_with_next([=]\(const QString &result) {
|
||||
}) | rpl::on_next([=]\(const QString &result) {
|
||||
qDebug() << "Mapped & Filtered: " << result;
|
||||
}, lifetime);
|
||||
```
|
||||
@@ -197,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::on_next([=]\(QString &&value) {
|
||||
// Receives values from either sourceA or sourceB as they arrive.
|
||||
qDebug() << "Merged value: " << value;
|
||||
}, lifetime);
|
||||
|
||||
2
.github/workflows/cant-reproduce.yml
vendored
2
.github/workflows/cant-reproduce.yml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
|
||||
jobs:
|
||||
cant-reproduce:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-slim
|
||||
steps:
|
||||
- uses: lee-dohm/no-response@v0.5.0
|
||||
with:
|
||||
|
||||
2
.github/workflows/copyright_year_updater.yml
vendored
2
.github/workflows/copyright_year_updater.yml
vendored
@@ -9,7 +9,7 @@ on:
|
||||
|
||||
jobs:
|
||||
Copyright-year:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-slim
|
||||
steps:
|
||||
- uses: desktop-app/action_code_updater@master
|
||||
with:
|
||||
|
||||
2
.github/workflows/issue_closer.yml
vendored
2
.github/workflows/issue_closer.yml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
|
||||
jobs:
|
||||
comment:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-slim
|
||||
steps:
|
||||
- name: Process an issue.
|
||||
uses: desktop-app/action_issue_closer@master
|
||||
|
||||
7
.github/workflows/linux.yml
vendored
7
.github/workflows/linux.yml
vendored
@@ -71,6 +71,7 @@ jobs:
|
||||
poetry install
|
||||
DOCKERFILE=$(DEBUG= LTO= poetry run gen_dockerfile)
|
||||
echo "$DOCKERFILE" > Dockerfile
|
||||
rm -rf __pycache__
|
||||
|
||||
- name: Free up some disk space.
|
||||
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
|
||||
@@ -81,7 +82,7 @@ jobs:
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Libraries cache.
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: ${{ runner.temp }}/.buildx-cache
|
||||
key: ${{ runner.OS }}-libs-${{ hashFiles('Telegram/build/docker/centos_env/**') }}
|
||||
@@ -108,7 +109,7 @@ jobs:
|
||||
if [ -n "${{ matrix.defines }}" ]; then
|
||||
DEFINE="-D ${{ matrix.defines }}=ON"
|
||||
echo Define from matrix: $DEFINE
|
||||
echo "ARTIFACT_NAME=Telegram_${{ matrix.defines }}" >> $GITHUB_ENV
|
||||
echo "ARTIFACT_NAME=Telegram ${{ matrix.defines }}" >> $GITHUB_ENV
|
||||
else
|
||||
echo "ARTIFACT_NAME=Telegram" >> $GITHUB_ENV
|
||||
fi
|
||||
@@ -148,7 +149,7 @@ jobs:
|
||||
cd out/Debug
|
||||
mkdir artifact
|
||||
mv {Telegram,Updater} artifact/
|
||||
- uses: actions/upload-artifact@v5
|
||||
- uses: actions/upload-artifact@v6
|
||||
if: env.UPLOAD_ARTIFACT == 'true'
|
||||
name: Upload artifact.
|
||||
with:
|
||||
|
||||
4
.github/workflows/lock.yml
vendored
4
.github/workflows/lock.yml
vendored
@@ -6,9 +6,9 @@ on:
|
||||
|
||||
jobs:
|
||||
lock:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-slim
|
||||
steps:
|
||||
- uses: dessant/lock-threads@v5
|
||||
- uses: dessant/lock-threads@v6
|
||||
with:
|
||||
github-token: ${{ github.token }}
|
||||
issue-inactive-days: 45
|
||||
|
||||
29
.github/workflows/mac.yml
vendored
29
.github/workflows/mac.yml
vendored
@@ -74,28 +74,15 @@ jobs:
|
||||
|
||||
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
|
||||
|
||||
- name: Free up some disk space.
|
||||
uses: hugoalh/disk-space-optimizer-ghaction@271735125a1b35180620eae7e45c2e9d470c31b0
|
||||
with:
|
||||
general_include: ".+"
|
||||
homebrew_prune: "True"
|
||||
homebrew_clean: "True"
|
||||
npm_prune: "True"
|
||||
npm_clean: "True"
|
||||
|
||||
- name: ThirdParty cache.
|
||||
id: cache-third-party
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ThirdParty
|
||||
key: ${{ runner.OS }}-third-party-${{ hashFiles(format('{0}/{1}', env.REPO_NAME, env.PREPARE_PATH)) }}
|
||||
restore-keys: ${{ runner.OS }}-third-party-
|
||||
sudo sed -i '' '/CMAKE_${lang}_FLAGS_DEBUG_INIT/s/ -g//' /opt/homebrew/share/cmake/Modules/Compiler/GNU.cmake
|
||||
|
||||
- name: Libraries cache.
|
||||
id: cache-libs
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: Libraries
|
||||
path: |
|
||||
Libraries
|
||||
ThirdParty
|
||||
key: ${{ runner.OS }}-libs-${{ hashFiles(format('{0}/{1}', env.REPO_NAME, env.PREPARE_PATH)) }}
|
||||
restore-keys: ${{ runner.OS }}-libs-
|
||||
|
||||
@@ -104,7 +91,7 @@ jobs:
|
||||
./$REPO_NAME/Telegram/build/prepare/mac.sh skip-release silent
|
||||
|
||||
- name: Free up some disk space.
|
||||
run: find Libraries -iwholename "*.dir/*" -delete
|
||||
run: find Libraries '(' '(' ! '(' -name '*.a' -o -name '*.h' -o -name '*.hpp' -o -name '*.inc' -o -name '*.cmake' -o -path '*/include/*' -o -path '*/objects-*' -o -path '*/cache_keys/*' -o -path '*/patches/*' -o -perm +111 ')' -type f ')' -o -empty ')' -delete
|
||||
|
||||
- name: Telegram Desktop build.
|
||||
if: env.ONLY_CACHE == 'false'
|
||||
@@ -115,7 +102,7 @@ jobs:
|
||||
if [ -n "${{ matrix.defines }}" ]; then
|
||||
DEFINE="-D ${{ matrix.defines }}=ON"
|
||||
echo Define from matrix: $DEFINE
|
||||
echo "ARTIFACT_NAME=Telegram_${{ matrix.defines }}" >> $GITHUB_ENV
|
||||
echo "ARTIFACT_NAME=Telegram ${{ matrix.defines }}" >> $GITHUB_ENV
|
||||
else
|
||||
echo "ARTIFACT_NAME=Telegram" >> $GITHUB_ENV
|
||||
fi
|
||||
@@ -138,7 +125,7 @@ jobs:
|
||||
mkdir artifact
|
||||
mv Telegram.app artifact/
|
||||
mv Updater artifact/
|
||||
- uses: actions/upload-artifact@v5
|
||||
- uses: actions/upload-artifact@v6
|
||||
if: env.UPLOAD_ARTIFACT == 'true'
|
||||
name: Upload artifact.
|
||||
with:
|
||||
|
||||
12
.github/workflows/mac_packaged.yml
vendored
12
.github/workflows/mac_packaged.yml
vendored
@@ -85,7 +85,7 @@ jobs:
|
||||
echo "MACOSX_DEPLOYMENT_TARGET=$(grep 'set(QT_SUPPORTED_MIN_MACOS_VERSION' /opt/homebrew/Cellar/qtbase/*/lib/cmake/Qt6/Qt6ConfigExtras.cmake | sed -E 's/^.*"(.*)"\)$/\1/')" >> $GITHUB_ENV
|
||||
echo "LibrariesPath=`pwd`" >> $GITHUB_ENV
|
||||
|
||||
curl -o tg_owt-version.json https://api.github.com/repos/desktop-app/tg_owt/git/refs/heads/master
|
||||
echo "WEBRTC=`curl -sSL --header 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/desktop-app/tg_owt/git/refs/heads/master | jq -r .object.sha`" >> $GITHUB_ENV
|
||||
|
||||
- name: RNNoise.
|
||||
run: |
|
||||
@@ -100,10 +100,10 @@ jobs:
|
||||
|
||||
- name: WebRTC cache.
|
||||
id: cache-webrtc
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: ${{ env.LibrariesPath }}/tg_owt
|
||||
key: ${{ runner.OS }}-webrtc-${{ env.CACHE_KEY }}-${{ hashFiles('**/tg_owt-version.json') }}
|
||||
key: ${{ runner.OS }}-webrtc-${{ env.WEBRTC }}-${{ env.CACHE_KEY }}
|
||||
- name: WebRTC.
|
||||
if: steps.cache-webrtc.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
@@ -122,7 +122,7 @@ jobs:
|
||||
|
||||
- name: TDE2E cache.
|
||||
id: cache-tde2e
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: ${{ env.LibrariesPath }}/tde2e
|
||||
key: ${{ runner.OS }}-tde2e-${{ env.CACHE_KEY }}
|
||||
@@ -159,7 +159,7 @@ jobs:
|
||||
if [ -n "${{ matrix.defines }}" ]; then
|
||||
DEFINE="-D ${{ matrix.defines }}=ON"
|
||||
echo Define from matrix: $DEFINE
|
||||
echo "ARTIFACT_NAME=Telegram_${{ matrix.defines }}" >> $GITHUB_ENV
|
||||
echo "ARTIFACT_NAME=Telegram ${{ matrix.defines }}" >> $GITHUB_ENV
|
||||
else
|
||||
echo "ARTIFACT_NAME=Telegram" >> $GITHUB_ENV
|
||||
fi
|
||||
@@ -187,7 +187,7 @@ jobs:
|
||||
cd $REPO_NAME/build
|
||||
mkdir artifact
|
||||
mv Telegram.dmg artifact/
|
||||
- uses: actions/upload-artifact@v5
|
||||
- uses: actions/upload-artifact@v6
|
||||
if: env.UPLOAD_ARTIFACT == 'true'
|
||||
name: Upload artifact.
|
||||
with:
|
||||
|
||||
2
.github/workflows/master_updater.yml
vendored
2
.github/workflows/master_updater.yml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
|
||||
jobs:
|
||||
User-agent:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-slim
|
||||
steps:
|
||||
- uses: desktop-app/action_code_updater@master
|
||||
with:
|
||||
|
||||
2
.github/workflows/needs-user-action.yml
vendored
2
.github/workflows/needs-user-action.yml
vendored
@@ -8,7 +8,7 @@ on:
|
||||
|
||||
jobs:
|
||||
needs-user-action:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-slim
|
||||
steps:
|
||||
- uses: lee-dohm/no-response@v0.5.0
|
||||
with:
|
||||
|
||||
2
.github/workflows/snap.yml
vendored
2
.github/workflows/snap.yml
vendored
@@ -79,7 +79,7 @@ jobs:
|
||||
mkdir artifact
|
||||
mv $artifact_name artifact
|
||||
|
||||
- uses: actions/upload-artifact@v5
|
||||
- uses: actions/upload-artifact@v6
|
||||
if: env.UPLOAD_ARTIFACT == 'true'
|
||||
name: Upload artifact.
|
||||
with:
|
||||
|
||||
2
.github/workflows/stale.yml
vendored
2
.github/workflows/stale.yml
vendored
@@ -5,7 +5,7 @@ on:
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-slim
|
||||
steps:
|
||||
- uses: actions/stale@v10
|
||||
with:
|
||||
|
||||
2
.github/workflows/user_agent_updater.yml
vendored
2
.github/workflows/user_agent_updater.yml
vendored
@@ -9,7 +9,7 @@ on:
|
||||
|
||||
jobs:
|
||||
User-agent:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-slim
|
||||
steps:
|
||||
- uses: desktop-app/action_code_updater@master
|
||||
with:
|
||||
|
||||
2
.github/workflows/waiting-for-answer.yml
vendored
2
.github/workflows/waiting-for-answer.yml
vendored
@@ -8,7 +8,7 @@ on:
|
||||
|
||||
jobs:
|
||||
waiting-for-answer:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-slim
|
||||
steps:
|
||||
- uses: lee-dohm/no-response@v0.5.0
|
||||
with:
|
||||
|
||||
21
.github/workflows/win.yml
vendored
21
.github/workflows/win.yml
vendored
@@ -85,6 +85,8 @@ jobs:
|
||||
SDK="$(grep "SDK version" $DOCPATH | sed -r 's/.*\*\*(.*)\*\* SDK version.*/\1/')"
|
||||
echo "SDK=$SDK" >> $GITHUB_ENV
|
||||
|
||||
sed -i '/CMAKE_${lang}_FLAGS_DEBUG_INIT/s/${_Zi}//' "$PROGRAMFILES"/CMake/share/cmake*/Modules/Platform/Windows-MSVC.cmake
|
||||
|
||||
echo "$(sha256sum $TBUILD/$REPO_NAME/$PREPARE_PATH | awk '{ print $1 }')" >> CACHE_KEY.txt
|
||||
echo "$SDK" >> CACHE_KEY.txt
|
||||
echo "CACHE_KEY=$(sha256sum CACHE_KEY.txt | awk '{ print $1 }')" >> $GITHUB_ENV
|
||||
@@ -106,7 +108,7 @@ jobs:
|
||||
|
||||
- name: ThirdParty cache.
|
||||
id: cache-third-party
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: ${{ env.TBUILD }}\ThirdParty
|
||||
key: ${{ runner.OS }}-${{ matrix.arch }}-third-party-${{ env.CACHE_KEY }}
|
||||
@@ -114,7 +116,7 @@ jobs:
|
||||
|
||||
- name: Libraries cache.
|
||||
id: cache-libs
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: ${{ env.TBUILD }}\Libraries
|
||||
key: ${{ runner.OS }}-${{ matrix.arch }}-libs-${{ env.CACHE_KEY }}
|
||||
@@ -140,14 +142,14 @@ jobs:
|
||||
*) ARCH="${{ matrix.arch }}";;
|
||||
esac
|
||||
echo "Architecture from matrix: $ARCH"
|
||||
ARTIFACT_NAME="${ARTIFACT_NAME}_${{ matrix.arch }}"
|
||||
ARTIFACT_NAME="${ARTIFACT_NAME} ${{ matrix.arch }}"
|
||||
fi
|
||||
|
||||
GENERATOR=""
|
||||
if [ -n "${{ matrix.generator }}" ]; then
|
||||
GENERATOR="-G \"${{ matrix.generator }}\""
|
||||
echo "Generator from matrix: $GENERATOR"
|
||||
ARTIFACT_NAME="${ARTIFACT_NAME}_${{ matrix.generator }}"
|
||||
ARTIFACT_NAME="${ARTIFACT_NAME} ${{ matrix.generator }}"
|
||||
fi
|
||||
echo "TDESKTOP_BUILD_GENERATOR=$GENERATOR" >> $GITHUB_ENV
|
||||
|
||||
@@ -158,7 +160,7 @@ jobs:
|
||||
if [ -n "${{ matrix.defines }}" ]; then
|
||||
DEFINE="-D ${{ matrix.defines }}=ON"
|
||||
echo "Define from matrix: $DEFINE"
|
||||
ARTIFACT_NAME="${ARTIFACT_NAME}_${{ matrix.defines }}"
|
||||
ARTIFACT_NAME="${ARTIFACT_NAME} ${{ matrix.defines }}"
|
||||
fi
|
||||
echo "TDESKTOP_BUILD_DEFINE=$DEFINE" >> $GITHUB_ENV
|
||||
|
||||
@@ -172,11 +174,8 @@ jobs:
|
||||
echo "TDESKTOP_BUILD_API=$API" >> $GITHUB_ENV
|
||||
|
||||
- name: Free up some disk space.
|
||||
run: |
|
||||
cd %TBUILD%
|
||||
del /S Libraries\*.pdb
|
||||
del /S Libraries\*.pch
|
||||
del /S Libraries\*.obj
|
||||
shell: bash
|
||||
run: find TBuild/Libraries '(' '(' ! '(' -name '*.lib' -o -name '*.a' -o -name '*.exe' -o -name '*.h' -o -name '*.hpp' -o -name '*.inc' -o -name '*.cmake' -o -path '*/include/*' -o -path '*/objects-*' -o -path '*/cache_keys/*' -o -path '*/patches/*' ')' -type f ')' -o -empty ')' -delete
|
||||
|
||||
- name: Telegram Desktop build.
|
||||
if: env.ONLY_CACHE == 'false'
|
||||
@@ -203,7 +202,7 @@ jobs:
|
||||
mkdir artifact
|
||||
move %OUT%\Telegram.exe artifact/
|
||||
move %OUT%\Updater.exe artifact/
|
||||
- uses: actions/upload-artifact@v5
|
||||
- uses: actions/upload-artifact@v6
|
||||
name: Upload artifact.
|
||||
if: (env.UPLOAD_ARTIFACT == 'true') || (github.ref == 'refs/heads/nightly')
|
||||
with:
|
||||
|
||||
@@ -407,6 +407,8 @@ PRIVATE
|
||||
calls/calls_instance.h
|
||||
calls/calls_panel.cpp
|
||||
calls/calls_panel.h
|
||||
calls/calls_panel_background.cpp
|
||||
calls/calls_panel_background.h
|
||||
calls/calls_signal_bars.cpp
|
||||
calls/calls_signal_bars.h
|
||||
calls/calls_top_bar.cpp
|
||||
@@ -922,6 +924,8 @@ 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_reaction_preview.cpp
|
||||
history/view/history_view_reaction_preview.h
|
||||
history/view/history_view_reply.cpp
|
||||
history/view/history_view_reply.h
|
||||
history/view/history_view_requests_bar.cpp
|
||||
@@ -1910,15 +1914,17 @@ elseif (APPLE)
|
||||
COMMAND cp ${CMAKE_BINARY_DIR}/lib_spellcheck.rcc $<TARGET_FILE_DIR:Telegram>/../Resources
|
||||
)
|
||||
if (NOT build_macstore AND NOT DESKTOP_APP_DISABLE_CRASH_REPORTS)
|
||||
if (DESKTOP_APP_MAC_ARCH STREQUAL "x86_64" OR DESKTOP_APP_MAC_ARCH STREQUAL "arm64")
|
||||
set(crashpad_dir_part ".${DESKTOP_APP_MAC_ARCH}")
|
||||
if (DESKTOP_APP_USE_PACKAGED)
|
||||
find_program(CRASHPAD_HANDLER crashpad_handler REQUIRED)
|
||||
elseif (DESKTOP_APP_MAC_ARCH STREQUAL "x86_64" OR DESKTOP_APP_MAC_ARCH STREQUAL "arm64")
|
||||
set(CRASHPAD_HANDLER "${libs_loc}/crashpad/out/$<IF:$<CONFIG:Debug>,Debug,Release>.${DESKTOP_APP_MAC_ARCH}/crashpad_handler")
|
||||
else()
|
||||
set(crashpad_dir_part "")
|
||||
set(CRASHPAD_HANDLER "${libs_loc}/crashpad/out/$<IF:$<CONFIG:Debug>,Debug,Release>/crashpad_handler")
|
||||
endif()
|
||||
add_custom_command(TARGET Telegram
|
||||
PRE_LINK
|
||||
COMMAND mkdir -p $<TARGET_FILE_DIR:Telegram>/../Helpers
|
||||
COMMAND cp ${libs_loc}/crashpad/out/$<IF:$<CONFIG:Debug>,Debug,Release>${crashpad_dir_part}/crashpad_handler $<TARGET_FILE_DIR:Telegram>/../Helpers/
|
||||
COMMAND cp ${CRASHPAD_HANDLER} $<TARGET_FILE_DIR:Telegram>/../Helpers/
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
@@ -1938,8 +1944,9 @@ if (build_macstore)
|
||||
set(bundle_identifier "org.telegram.desktop")
|
||||
set(bundle_entitlements "Telegram Lite.entitlements")
|
||||
set(output_name "Telegram Lite")
|
||||
set_target_properties(Telegram PROPERTIES
|
||||
XCODE_ATTRIBUTE_FRAMEWORK_SEARCH_PATHS ${libs_loc}/breakpad/src/client/mac/build/Release
|
||||
target_link_options(Telegram
|
||||
PRIVATE
|
||||
-F${libs_loc}/breakpad/src/client/mac/build/Release
|
||||
)
|
||||
target_link_frameworks(Telegram PRIVATE Breakpad)
|
||||
add_custom_command(TARGET Telegram
|
||||
@@ -2127,7 +2134,7 @@ if (NOT DESKTOP_APP_DISABLE_AUTOUPDATE AND NOT build_macstore AND NOT build_wins
|
||||
endif()
|
||||
elseif (APPLE)
|
||||
add_custom_command(TARGET Updater
|
||||
PRE_LINK
|
||||
POST_BUILD
|
||||
COMMAND mkdir -p $<TARGET_FILE_DIR:Telegram>/../Frameworks
|
||||
COMMAND cp $<TARGET_FILE:Updater> $<TARGET_FILE_DIR:Telegram>/../Frameworks/
|
||||
)
|
||||
|
||||
BIN
Telegram/Resources/animations/ban.tgs
Normal file
BIN
Telegram/Resources/animations/ban.tgs
Normal file
Binary file not shown.
@@ -22,7 +22,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_menu_my_stories" = "My Stories";
|
||||
"lng_menu_my_groups" = "My Groups";
|
||||
"lng_menu_my_channels" = "My Channels";
|
||||
"lng_open_menu" = "Open navigation menu";
|
||||
"lng_main_menu" = "Main menu";
|
||||
"lng_filter_unread_chats#one" = "{text} ({count} unread chat)";
|
||||
"lng_filter_unread_chats#other" = "{text} ({count} unread chats)";
|
||||
|
||||
"lng_disable_notifications_from_tray" = "Disable notifications";
|
||||
"lng_enable_notifications_from_tray" = "Enable notifications";
|
||||
@@ -795,6 +797,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_settings_channel_label" = "Personal channel";
|
||||
"lng_settings_channel_add" = "Add";
|
||||
"lng_settings_channel_remove" = "Remove";
|
||||
"lng_settings_channel_menu_remove" = "Remove Personal Channel";
|
||||
"lng_settings_channel_no_yet" = "You don't have any public channels yet.";
|
||||
"lng_settings_channel_start" = "Start a Channel";
|
||||
"lng_settings_channel_saved" = "Your personal channel was updated.";
|
||||
@@ -1270,10 +1273,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_settings_passkeys_none_info3_title" = "Store Passkey securely";
|
||||
"lng_settings_passkeys_none_info3_about" = "Your passkey is stored safely in the cloud service you choose.";
|
||||
"lng_settings_passkeys_none_button" = "Create Passkey";
|
||||
"lng_settings_passkeys_none_button_unsupported" = "Unsupported";
|
||||
"lng_settings_passkeys_created" = "Created {date}";
|
||||
"lng_settings_passkeys_last_used" = "Last used {date}";
|
||||
"lng_settings_passkeys_unsigned_error" = "Passkeys are not available in unsigned builds. Please use an official signed version of Telegram Desktop.";
|
||||
|
||||
"lng_settings_passkey_unknown" = "Passkey";
|
||||
|
||||
"lng_settings_quick_dialog_action_title" = "Chat list quick action";
|
||||
"lng_settings_quick_dialog_action_about" = "Choose the action you want to perform when you middle-click or swipe left in the chat list.";
|
||||
@@ -2659,6 +2663,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_forwarded_story" = "Story from {user}";
|
||||
"lng_forwarded_story_expired" = "This story has expired.";
|
||||
"lng_forwarded_date" = "Original: {date}";
|
||||
"lng_forwarded_saved_date" = "Saved date: {date}";
|
||||
"lng_forwarded_channel" = "Forwarded from {channel}";
|
||||
"lng_forwarded_psa_default" = "Forwarded from {channel}";
|
||||
"lng_forwarded_via" = "Forwarded from {user} via {inline_bot}";
|
||||
@@ -3831,6 +3836,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_gift_unique_backdrop" = "Backdrop";
|
||||
"lng_gift_unique_symbol" = "Symbol";
|
||||
"lng_gift_unique_rarity" = "Only {percent} of such collectibles have this attribute.";
|
||||
"lng_gift_unique_sender" = "{from} sent you this gift on {date}";
|
||||
"lng_gift_unique_sender_you" = "You bought this gift on {date}";
|
||||
"lng_gift_unique_availability_label" = "Quantity";
|
||||
"lng_gift_unique_availability#one" = "{count} of {amount} issued";
|
||||
"lng_gift_unique_availability#other" = "{count} of {amount} issued";
|
||||
@@ -4094,8 +4101,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_auction_rounds_label" = "Rounds";
|
||||
"lng_auction_rounds_exact" = "Round {n}";
|
||||
"lng_auction_rounds_range" = "Rounds {n}-{last}";
|
||||
"lng_auction_rounds_seconds#one" = "{count} minute each";
|
||||
"lng_auction_rounds_seconds#other" = "{count} minutes each";
|
||||
"lng_auction_rounds_seconds#one" = "{count} second each";
|
||||
"lng_auction_rounds_seconds#other" = "{count} seconds each";
|
||||
"lng_auction_rounds_minutes#one" = "{count} minute each";
|
||||
"lng_auction_rounds_minutes#other" = "{count} minutes each";
|
||||
"lng_auction_rounds_hours#one" = "{count} hour each";
|
||||
@@ -5175,6 +5182,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_edit_channel_status_about" = "Choose a status that will be shown next to the channel's name.";
|
||||
"lng_edit_channel_status_group" = "Set Group Emoji Status";
|
||||
"lng_edit_channel_status_about_group" = "Choose a status that will be shown next to the group's name.";
|
||||
"lng_edit_channel_personal_channel" = "Set as Personal Channel";
|
||||
"lng_edit_self_title" = "Edit your name";
|
||||
"lng_confirm_contact_data" = "New Contact";
|
||||
"lng_add_contact" = "Create";
|
||||
@@ -7427,6 +7435,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_mac_menu_player_resume" = "Resume";
|
||||
"lng_mac_menu_player_next" = "Next";
|
||||
"lng_mac_menu_player_previous" = "Previous";
|
||||
"lng_mac_menu_profiles" = "Profiles";
|
||||
|
||||
"lng_mac_touchbar_favorite_stickers" = "Favorite stickers";
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
<file alias="show_or_premium_lastseen.tgs">../../animations/show_or_premium_lastseen.tgs</file>
|
||||
<file alias="show_or_premium_readtime.tgs">../../animations/show_or_premium_readtime.tgs</file>
|
||||
<file alias="passkeys.tgs">../../animations/passkeys.tgs</file>
|
||||
<file alias="ban.tgs">../../animations/ban.tgs</file>
|
||||
|
||||
<file alias="profile_muting.tgs">../../animations/profile/profile_muting.tgs</file>
|
||||
<file alias="profile_unmuting.tgs">../../animations/profile/profile_unmuting.tgs</file>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<Identity Name="TelegramMessengerLLP.TelegramDesktop"
|
||||
ProcessorArchitecture="ARCHITECTURE"
|
||||
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
|
||||
Version="6.3.6.0" />
|
||||
Version="6.3.10.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 6,3,6,0
|
||||
PRODUCTVERSION 6,3,6,0
|
||||
FILEVERSION 6,3,10,0
|
||||
PRODUCTVERSION 6,3,10,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -62,10 +62,10 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Telegram FZ-LLC"
|
||||
VALUE "FileDescription", "Telegram Desktop"
|
||||
VALUE "FileVersion", "6.3.6.0"
|
||||
VALUE "FileVersion", "6.3.10.0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2014-2025"
|
||||
VALUE "ProductName", "Telegram Desktop"
|
||||
VALUE "ProductVersion", "6.3.6.0"
|
||||
VALUE "ProductVersion", "6.3.10.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -35,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 6,3,6,0
|
||||
PRODUCTVERSION 6,3,6,0
|
||||
FILEVERSION 6,3,10,0
|
||||
PRODUCTVERSION 6,3,10,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", "6.3.6.0"
|
||||
VALUE "FileVersion", "6.3.10.0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2014-2025"
|
||||
VALUE "ProductName", "Telegram Desktop"
|
||||
VALUE "ProductVersion", "6.3.6.0"
|
||||
VALUE "ProductVersion", "6.3.10.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -100,7 +100,7 @@ Authorizations::Authorizations(not_null<ApiWrap*> api)
|
||||
_unreviewed = api->session().settings().unreviewed();
|
||||
crl::on_main(&api->session(), [=] { removeExpiredUnreviewed(); });
|
||||
Core::App().settings().deviceModelChanges(
|
||||
) | rpl::start_with_next([=](const QString &model) {
|
||||
) | rpl::on_next([=](const QString &model) {
|
||||
auto changed = false;
|
||||
for (auto &entry : _list) {
|
||||
if (!entry.hash) {
|
||||
|
||||
@@ -83,7 +83,7 @@ void BlockedPeers::block(not_null<PeerData*> peer) {
|
||||
}
|
||||
const auto requestId = _api.request(MTPcontacts_Block(
|
||||
MTP_flags(0),
|
||||
peer->input
|
||||
peer->input()
|
||||
)).done([=] {
|
||||
const auto data = _blockRequests.take(peer);
|
||||
peer->setIsBlocked(true);
|
||||
@@ -127,7 +127,7 @@ void BlockedPeers::unblock(
|
||||
}
|
||||
const auto requestId = _api.request(MTPcontacts_Unblock(
|
||||
MTP_flags(0),
|
||||
peer->input
|
||||
peer->input()
|
||||
)).done([=] {
|
||||
const auto data = _blockRequests.take(peer);
|
||||
peer->setIsBlocked(false);
|
||||
@@ -204,7 +204,7 @@ auto BlockedPeers::slice() -> rpl::producer<BlockedPeers::Slice> {
|
||||
}
|
||||
return _slice
|
||||
? _changes.events_starting_with_copy(*_slice)
|
||||
: (_changes.events() | rpl::type_erased());
|
||||
: (_changes.events() | rpl::type_erased);
|
||||
}
|
||||
|
||||
void BlockedPeers::request(int offset, Fn<void(BlockedPeers::Slice)> done) {
|
||||
|
||||
@@ -91,7 +91,7 @@ void SendBotCallbackData(
|
||||
const auto show = controller->uiShow();
|
||||
button->requestId = api->request(MTPmessages_GetBotCallbackAnswer(
|
||||
MTP_flags(flags),
|
||||
history->peer->input,
|
||||
history->peer->input(),
|
||||
MTP_int(item->id),
|
||||
MTP_bytes(sendData),
|
||||
password ? password->result : MTP_inputCheckPasswordEmpty()
|
||||
@@ -218,7 +218,7 @@ void SendBotCallbackDataWithPassword(
|
||||
session,
|
||||
tr::lng_bots_password_confirm_check_about(
|
||||
tr::now,
|
||||
Ui::Text::WithEntities));
|
||||
tr::marked));
|
||||
if (box) {
|
||||
show->showBox(std::move(box), Ui::LayerOption::CloseOther);
|
||||
} else {
|
||||
@@ -227,7 +227,7 @@ void SendBotCallbackDataWithPassword(
|
||||
api->cloudPassword().state(
|
||||
) | rpl::take(
|
||||
1
|
||||
) | rpl::start_with_next([=](const Core::CloudPasswordState &state) mutable {
|
||||
) | rpl::on_next([=](const Core::CloudPasswordState &state) mutable {
|
||||
if (lifetime) {
|
||||
base::take(lifetime)->destroy();
|
||||
}
|
||||
@@ -421,13 +421,13 @@ void ActivateBotCommand(ClickHandlerContext context, int row, int column) {
|
||||
const auto id = int32(button->buttonId);
|
||||
const auto chosen = [=](std::vector<not_null<PeerData*>> result) {
|
||||
peer->session().api().request(MTPmessages_SendBotRequestedPeer(
|
||||
peer->input,
|
||||
peer->input(),
|
||||
MTP_int(itemId),
|
||||
MTP_int(id),
|
||||
MTP_vector_from_range(
|
||||
result | ranges::views::transform([](
|
||||
not_null<PeerData*> peer) {
|
||||
return MTPInputPeer(peer->input);
|
||||
return MTPInputPeer(peer->input());
|
||||
}))
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
peer->session().api().applyUpdates(result);
|
||||
|
||||
@@ -116,24 +116,24 @@ private:
|
||||
tr::now,
|
||||
lt_folder,
|
||||
std::move(boldTitle),
|
||||
Ui::Text::WithEntities)
|
||||
tr::marked)
|
||||
: (type == Type::AddingChats)
|
||||
? tr::lng_filters_by_link_more_sure(
|
||||
tr::now,
|
||||
lt_folder,
|
||||
std::move(boldTitle),
|
||||
Ui::Text::WithEntities)
|
||||
tr::marked)
|
||||
: (type == Type::AllAdded)
|
||||
? tr::lng_filters_by_link_already_about(
|
||||
tr::now,
|
||||
lt_folder,
|
||||
std::move(boldTitle),
|
||||
Ui::Text::WithEntities)
|
||||
tr::marked)
|
||||
: tr::lng_filters_by_link_remove_sure(
|
||||
tr::now,
|
||||
lt_folder,
|
||||
std::move(boldTitle),
|
||||
Ui::Text::WithEntities);
|
||||
tr::marked);
|
||||
}
|
||||
|
||||
void InitFilterLinkHeader(
|
||||
@@ -174,13 +174,13 @@ void InitFilterLinkHeader(
|
||||
box->setAddedTopScrollSkip(max);
|
||||
std::move(
|
||||
header.wheelEvents
|
||||
) | rpl::start_with_next([=](not_null<QWheelEvent*> e) {
|
||||
) | rpl::on_next([=](not_null<QWheelEvent*> e) {
|
||||
box->sendScrollViewportEvent(e);
|
||||
}, widget->lifetime());
|
||||
|
||||
std::move(
|
||||
header.closeRequests
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
box->closeBox();
|
||||
}, widget->lifetime());
|
||||
|
||||
@@ -193,7 +193,7 @@ void InitFilterLinkHeader(
|
||||
box->scrolls(
|
||||
) | rpl::filter([=] {
|
||||
return !state->processing;
|
||||
}) | rpl::start_with_next([=] {
|
||||
}) | rpl::on_next([=] {
|
||||
state->processing = true;
|
||||
const auto guard = gsl::finally([&] { state->processing = false; });
|
||||
|
||||
@@ -237,7 +237,7 @@ void ImportInvite(
|
||||
fail(error.type());
|
||||
};
|
||||
auto inputs = peers | ranges::views::transform([](auto peer) {
|
||||
return MTPInputPeer(peer->input);
|
||||
return MTPInputPeer(peer->input());
|
||||
}) | ranges::to<QVector<MTPInputPeer>>();
|
||||
if (!slug.isEmpty()) {
|
||||
api->request(MTPchatlists_JoinChatlistInvite(
|
||||
@@ -470,7 +470,7 @@ void ToggleChatsController::adjust(
|
||||
void ToggleChatsController::setRealContentHeight(rpl::producer<int> value) {
|
||||
std::move(
|
||||
value
|
||||
) | rpl::start_with_next([=](int height) {
|
||||
) | rpl::on_next([=](int height) {
|
||||
const auto desired = _desiredHeight.current();
|
||||
if (height <= computeListSt().item.height) {
|
||||
return;
|
||||
@@ -547,7 +547,7 @@ void ShowImportToast(
|
||||
? tr::lng_filters_added_title
|
||||
: tr::lng_filters_updated_title;
|
||||
auto text = Ui::Text::Wrapped(
|
||||
phrase(tr::now, lt_folder, title.text, Ui::Text::WithEntities),
|
||||
phrase(tr::now, lt_folder, title.text, tr::marked),
|
||||
EntityType::Bold);
|
||||
if (added > 0) {
|
||||
const auto phrase = created
|
||||
@@ -644,7 +644,7 @@ void ProcessFilterInvite(
|
||||
|
||||
const auto button = owned.data();
|
||||
box->widthValue(
|
||||
) | rpl::start_with_next([=](int width) {
|
||||
) | rpl::on_next([=](int width) {
|
||||
const auto &padding = st::filterInviteBox.buttonPadding;
|
||||
button->resizeToWidth(width
|
||||
- padding.left()
|
||||
@@ -662,7 +662,7 @@ void ProcessFilterInvite(
|
||||
const auto state = box->lifetime().make_state<State>();
|
||||
|
||||
raw->selectedValue(
|
||||
) | rpl::start_with_next([=](
|
||||
) | rpl::on_next([=](
|
||||
base::flat_set<not_null<PeerData*>> &&peers) {
|
||||
button->setClickedCallback([=] {
|
||||
if (peers.empty()) {
|
||||
@@ -777,7 +777,7 @@ void CheckFilterInvite(
|
||||
if (notLoaded) {
|
||||
const auto lifetime = std::make_shared<rpl::lifetime>();
|
||||
owner.chatsFilters().changed(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
lifetime->destroy();
|
||||
ProcessFilterInvite(
|
||||
weak,
|
||||
@@ -873,7 +873,7 @@ void ProcessFilterRemove(
|
||||
|
||||
const auto button = owned.data();
|
||||
box->widthValue(
|
||||
) | rpl::start_with_next([=](int width) {
|
||||
) | rpl::on_next([=](int width) {
|
||||
const auto &padding = st::filterInviteBox.buttonPadding;
|
||||
button->resizeToWidth(width
|
||||
- padding.left()
|
||||
@@ -886,7 +886,7 @@ void ProcessFilterRemove(
|
||||
HandleEnterInBox(box);
|
||||
|
||||
raw->selectedValue(
|
||||
) | rpl::start_with_next([=](
|
||||
) | rpl::on_next([=](
|
||||
base::flat_set<not_null<PeerData*>> &&peers) {
|
||||
button->setClickedCallback([=] {
|
||||
done(peers | ranges::to_vector);
|
||||
|
||||
@@ -44,7 +44,7 @@ void RemoveChatFilter(
|
||||
MTP_vector<MTPInputPeer>(ranges::views::all(
|
||||
leave
|
||||
) | ranges::views::transform([](not_null<PeerData*> peer) {
|
||||
return MTPInputPeer(peer->input);
|
||||
return MTPInputPeer(peer->input());
|
||||
}) | ranges::to<QVector<MTPInputPeer>>())
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
api->applyUpdates(result);
|
||||
|
||||
@@ -159,7 +159,7 @@ void ConfirmSubscriptionBox(
|
||||
state->frame.setDevicePixelRatio(style::DevicePixelRatio());
|
||||
const auto options = Images::Option::RoundCircle;
|
||||
userpic->paintRequest(
|
||||
) | rpl::start_with_next([=, small = Data::PhotoSize::Small] {
|
||||
) | rpl::on_next([=, small = Data::PhotoSize::Small] {
|
||||
state->frame.fill(Qt::transparent);
|
||||
{
|
||||
auto p = QPainter(&state->frame);
|
||||
@@ -194,7 +194,7 @@ void ConfirmSubscriptionBox(
|
||||
state->photoMedia->wanted(Data::PhotoSize::Small, Data::FileOrigin());
|
||||
if (!state->photoMedia->image(Data::PhotoSize::Small)) {
|
||||
session->downloaderTaskFinished(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
userpic->update();
|
||||
}, userpic->lifetime());
|
||||
}
|
||||
@@ -224,13 +224,13 @@ void ConfirmSubscriptionBox(
|
||||
box,
|
||||
tr::lng_channel_invite_subscription_about(
|
||||
lt_channel,
|
||||
rpl::single(Ui::Text::Bold(name)),
|
||||
rpl::single(tr::bold(name)),
|
||||
lt_price,
|
||||
tr::lng_credits_summary_options_credits(
|
||||
lt_count,
|
||||
rpl::single(amount) | tr::to_count(),
|
||||
Ui::Text::Bold),
|
||||
Ui::Text::WithEntities),
|
||||
tr::bold),
|
||||
tr::marked),
|
||||
st::inviteLinkSubscribeBoxAbout),
|
||||
style::al_top);
|
||||
Ui::AddSkip(content);
|
||||
@@ -243,9 +243,9 @@ void ConfirmSubscriptionBox(
|
||||
tr::lng_paid_react_agree_link(),
|
||||
tr::lng_group_invite_subscription_about_url()
|
||||
) | rpl::map([](const QString &text, const QString &url) {
|
||||
return Ui::Text::Link(text, url);
|
||||
return tr::link(text, url);
|
||||
}),
|
||||
Ui::Text::RichLangValue),
|
||||
tr::rich),
|
||||
st::inviteLinkSubscribeBoxTerms),
|
||||
style::al_top);
|
||||
|
||||
@@ -260,7 +260,7 @@ void ConfirmSubscriptionBox(
|
||||
rpl::combine(
|
||||
balance->sizeValue(),
|
||||
content->sizeValue()
|
||||
) | rpl::start_with_next([=](const QSize &, const QSize &) {
|
||||
) | rpl::on_next([=](const QSize &, const QSize &) {
|
||||
balance->moveToRight(
|
||||
st::creditsHistoryRightSkip * 2,
|
||||
st::creditsHistoryRightSkip);
|
||||
@@ -408,7 +408,7 @@ void CheckChatInvite(
|
||||
box->boxClosing(
|
||||
) | rpl::filter([=] {
|
||||
return !invitePeekChannel->amIn();
|
||||
}) | rpl::start_with_next([=] {
|
||||
}) | rpl::on_next([=] {
|
||||
if (const auto strong = weak.get()) {
|
||||
strong->clearSectionStack(Window::SectionShow(
|
||||
Window::SectionShow::Way::ClearStack,
|
||||
@@ -527,7 +527,7 @@ ConfirmInviteBox::ConfirmInviteBox(
|
||||
_photo->wanted(Data::PhotoSize::Small, Data::FileOrigin());
|
||||
if (!_photo->image(Data::PhotoSize::Small)) {
|
||||
_session->downloaderTaskFinished(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
update();
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
@@ -422,7 +422,7 @@ void ChatParticipants::requestForAdd(
|
||||
|
||||
_forAdd.channel = channel;
|
||||
_forAdd.requestId = _api.request(MTPchannels_GetParticipants(
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
MTP_channelParticipantsRecent(),
|
||||
MTP_int(offset),
|
||||
MTP_int(channel->session().serverConfig().chatSizeMax),
|
||||
@@ -450,7 +450,7 @@ void ChatParticipants::requestLast(not_null<ChannelData*> channel) {
|
||||
const auto offset = 0;
|
||||
const auto participantsHash = uint64(0);
|
||||
const auto requestId = _api.request(MTPchannels_GetParticipants(
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
MTP_channelParticipantsRecent(),
|
||||
MTP_int(offset),
|
||||
MTP_int(channel->session().serverConfig().chatSizeMax),
|
||||
@@ -480,7 +480,7 @@ void ChatParticipants::requestBots(not_null<ChannelData*> channel) {
|
||||
const auto offset = 0;
|
||||
const auto participantsHash = uint64(0);
|
||||
const auto requestId = _api.request(MTPchannels_GetParticipants(
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
MTP_channelParticipantsBots(),
|
||||
MTP_int(offset),
|
||||
MTP_int(channel->session().serverConfig().chatSizeMax),
|
||||
@@ -516,7 +516,7 @@ void ChatParticipants::requestAdmins(not_null<ChannelData*> channel) {
|
||||
const auto offset = 0;
|
||||
const auto participantsHash = uint64(0);
|
||||
const auto requestId = _api.request(MTPchannels_GetParticipants(
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
MTP_channelParticipantsAdmins(),
|
||||
MTP_int(offset),
|
||||
MTP_int(channel->session().serverConfig().chatSizeMax),
|
||||
@@ -555,8 +555,8 @@ void ChatParticipants::add(
|
||||
if (const auto chat = peer->asChat()) {
|
||||
for (const auto &user : users) {
|
||||
_api.request(MTPmessages_AddChatUser(
|
||||
chat->inputChat,
|
||||
user->inputUser,
|
||||
chat->inputChat(),
|
||||
user->inputUser(),
|
||||
MTP_int(passGroupHistory ? kForwardMessagesOnAdd : 0)
|
||||
)).done([=](const MTPmessages_InvitedUsers &result) {
|
||||
const auto &data = result.data();
|
||||
@@ -587,7 +587,7 @@ void ChatParticipants::add(
|
||||
const auto send = [&] {
|
||||
const auto callback = base::take(done);
|
||||
_api.request(MTPchannels_InviteToChannel(
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
MTP_vector<MTPInputUser>(list)
|
||||
)).done([=](const MTPmessages_InvitedUsers &result) {
|
||||
const auto &data = result.data();
|
||||
@@ -606,7 +606,7 @@ void ChatParticipants::add(
|
||||
}).afterDelay(kSmallDelayMs).send();
|
||||
};
|
||||
for (const auto &user : users) {
|
||||
list.push_back(user->inputUser);
|
||||
list.push_back(user->inputUser());
|
||||
if (list.size() == kMaxUsersPerInvite) {
|
||||
send();
|
||||
list.clear();
|
||||
@@ -653,8 +653,8 @@ void ChatParticipants::Restrict(
|
||||
Fn<void()> onDone,
|
||||
Fn<void()> onFail) {
|
||||
channel->session().api().request(MTPchannels_EditBanned(
|
||||
channel->inputChannel,
|
||||
participant->input,
|
||||
channel->inputChannel(),
|
||||
participant->input(),
|
||||
RestrictionsToMTP(newRights)
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
channel->session().api().applyUpdates(result);
|
||||
@@ -692,7 +692,7 @@ void ChatParticipants::requestSelf(not_null<ChannelData*> channel) {
|
||||
};
|
||||
_selfParticipantRequests.emplace(channel);
|
||||
_api.request(MTPchannels_GetParticipant(
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
MTP_inputPeerSelf()
|
||||
)).done([=](const MTPchannels_ChannelParticipant &result) {
|
||||
_selfParticipantRequests.erase(channel);
|
||||
@@ -742,8 +742,8 @@ void ChatParticipants::kick(
|
||||
|
||||
_api.request(MTPmessages_DeleteChatUser(
|
||||
MTP_flags(0),
|
||||
chat->inputChat,
|
||||
participant->asUser()->inputUser
|
||||
chat->inputChat(),
|
||||
participant->asUser()->inputUser()
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
chat->session().api().applyUpdates(result);
|
||||
}).send();
|
||||
@@ -758,8 +758,8 @@ void ChatParticipants::kick(
|
||||
|
||||
const auto rights = ChannelData::KickedRestrictedRights(participant);
|
||||
const auto requestId = _api.request(MTPchannels_EditBanned(
|
||||
channel->inputChannel,
|
||||
participant->input,
|
||||
channel->inputChannel(),
|
||||
participant->input(),
|
||||
RestrictionsToMTP(rights)
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
channel->session().api().applyUpdates(result);
|
||||
@@ -782,8 +782,8 @@ void ChatParticipants::unblock(
|
||||
}
|
||||
|
||||
const auto requestId = _api.request(MTPchannels_EditBanned(
|
||||
channel->inputChannel,
|
||||
participant->input,
|
||||
channel->inputChannel(),
|
||||
participant->input(),
|
||||
MTP_chatBannedRights(MTP_flags(0), MTP_int(0))
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
channel->session().api().applyUpdates(result);
|
||||
@@ -814,7 +814,7 @@ void ChatParticipants::loadSimilarPeers(not_null<PeerData*> peer) {
|
||||
_similar[peer].requestId = _api.request(
|
||||
MTPchannels_GetChannelRecommendations(
|
||||
MTP_flags(Flag::f_channel),
|
||||
channel->inputChannel)
|
||||
channel->inputChannel())
|
||||
).done([=](const MTPmessages_Chats &result) {
|
||||
auto &similar = _similar[channel];
|
||||
similar.requestId = 0;
|
||||
@@ -832,7 +832,7 @@ void ChatParticipants::loadSimilarPeers(not_null<PeerData*> peer) {
|
||||
}).send();
|
||||
} else if (const auto bot = peer->asBot()) {
|
||||
_similar[peer].requestId = _api.request(
|
||||
MTPbots_GetBotRecommendations(bot->inputUser)
|
||||
MTPbots_GetBotRecommendations(bot->inputUser())
|
||||
).done([=](const MTPusers_Users &result) {
|
||||
auto &similar = _similar[peer];
|
||||
similar.requestId = 0;
|
||||
|
||||
@@ -68,7 +68,7 @@ void CloudPassword::clearUnconfirmedPassword() {
|
||||
rpl::producer<Core::CloudPasswordState> CloudPassword::state() const {
|
||||
return _state
|
||||
? _stateChanges.events_starting_with_copy(*_state)
|
||||
: (_stateChanges.events() | rpl::type_erased());
|
||||
: (_stateChanges.events() | rpl::type_erased);
|
||||
}
|
||||
|
||||
auto CloudPassword::stateCurrent() const
|
||||
|
||||
@@ -95,7 +95,7 @@ void ConfirmPhone::resolve(
|
||||
codeHandles->fire_copy(code);
|
||||
});
|
||||
box->resendRequests(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
_api.request(MTPauth_ResendCode(
|
||||
MTP_flags(0),
|
||||
MTP_string(phone),
|
||||
@@ -110,7 +110,7 @@ void ConfirmPhone::resolve(
|
||||
rpl::merge(
|
||||
codeHandles->events(),
|
||||
box->checkRequests()
|
||||
) | rpl::start_with_next([=](const QString &code) {
|
||||
) | rpl::on_next([=](const QString &code) {
|
||||
if (_checkRequestId) {
|
||||
return;
|
||||
}
|
||||
@@ -142,7 +142,7 @@ void ConfirmPhone::resolve(
|
||||
}).handleFloodErrors().send();
|
||||
}, box->lifetime());
|
||||
box->boxClosing(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
controller->session().account().setHandleLoginCode(nullptr);
|
||||
}, box->lifetime());
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ rpl::producer<rpl::no_value, QString> CreditsTopupOptions::request() {
|
||||
using TLOption = MTPStarsGiftOption;
|
||||
_api.request(MTPpayments_GetStarsGiftOptions(
|
||||
MTP_flags(MTPpayments_GetStarsGiftOptions::Flag::f_user_id),
|
||||
user->inputUser
|
||||
user->inputUser()
|
||||
)).done([=](const MTPVector<TLOption> &result) {
|
||||
_options = optionsFromTL(result.v);
|
||||
consumer.put_done();
|
||||
@@ -162,7 +162,7 @@ void CreditsStatus::request(
|
||||
|
||||
_requestId = _api.request(MTPpayments_GetStarsStatus(
|
||||
MTP_flags(0),
|
||||
_peer->isSelf() ? MTP_inputPeerSelf() : _peer->input
|
||||
_peer->isSelf() ? MTP_inputPeerSelf() : _peer->input()
|
||||
)).done([=](const TLResult &result) {
|
||||
_requestId = 0;
|
||||
const auto &balance = result.data().vbalance();
|
||||
@@ -204,7 +204,7 @@ void CreditsHistory::request(
|
||||
_requestId = _api.request(MTPpayments_GetStarsTransactions(
|
||||
MTP_flags(_flags),
|
||||
MTPstring(), // subscription_id
|
||||
_peer->isSelf() ? MTP_inputPeerSelf() : _peer->input,
|
||||
_peer->isSelf() ? MTP_inputPeerSelf() : _peer->input(),
|
||||
MTP_string(token),
|
||||
MTP_int(kTransactionsLimit)
|
||||
)).done([=](const MTPpayments_StarsStatus &result) {
|
||||
@@ -227,7 +227,7 @@ void CreditsHistory::requestSubscriptions(
|
||||
MTP_flags(missingBalance
|
||||
? MTPpayments_getStarsSubscriptions::Flag::f_missing_balance
|
||||
: MTPpayments_getStarsSubscriptions::Flags(0)),
|
||||
_peer->isSelf() ? MTP_inputPeerSelf() : _peer->input,
|
||||
_peer->isSelf() ? MTP_inputPeerSelf() : _peer->input(),
|
||||
MTP_string(token)
|
||||
)).done([=](const MTPpayments_StarsStatus &result) {
|
||||
_requestId = 0;
|
||||
@@ -285,7 +285,7 @@ rpl::producer<rpl::no_value, QString> CreditsEarnStatistics::request() {
|
||||
const auto finish = [=](const QString &url) {
|
||||
api().request(MTPpayments_GetStarsRevenueStats(
|
||||
MTP_flags(0),
|
||||
(_isUser ? user()->input : channel()->input)
|
||||
(_isUser ? user()->input() : channel()->input())
|
||||
)).done([=](const MTPpayments_StarsRevenueStats &result) {
|
||||
const auto &data = result.data();
|
||||
const auto &status = data.vstatus().data();
|
||||
@@ -315,7 +315,7 @@ rpl::producer<rpl::no_value, QString> CreditsEarnStatistics::request() {
|
||||
|
||||
api().request(
|
||||
MTPpayments_GetStarsRevenueAdsAccountUrl(
|
||||
(_isUser ? user()->input : channel()->input))
|
||||
(_isUser ? user()->input() : channel()->input()))
|
||||
).done([=](const MTPpayments_StarsRevenueAdsAccountUrl &result) {
|
||||
finish(qs(result.data().vurl()));
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
@@ -408,7 +408,7 @@ MTPInputSavedStarGift InputSavedStarGiftId(
|
||||
: id.isUser()
|
||||
? MTP_inputSavedStarGiftUser(MTP_int(id.userMessageId().bare))
|
||||
: MTP_inputSavedStarGiftChat(
|
||||
id.chat()->input,
|
||||
id.chat()->input(),
|
||||
MTP_long(id.chatSavedId()));
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ void RestrictSponsored(
|
||||
bool restricted,
|
||||
Fn<void(QString)> failed) {
|
||||
channel->session().api().request(MTPchannels_RestrictSponsoredMessages(
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
MTP_bool(restricted))
|
||||
).done([=](const MTPUpdates &updates) {
|
||||
channel->session().api().applyUpdates(updates);
|
||||
@@ -69,7 +69,7 @@ void HandleWithdrawalButton(
|
||||
state->lifetime = session->api().cloudPassword().state(
|
||||
) | rpl::take(
|
||||
1
|
||||
) | rpl::start_with_next([=](const Core::CloudPasswordState &pass) {
|
||||
) | rpl::on_next([=](const Core::CloudPasswordState &pass) {
|
||||
state->loading = false;
|
||||
|
||||
auto fields = PasscodeBox::CloudFields::From(pass);
|
||||
@@ -105,8 +105,8 @@ void HandleWithdrawalButton(
|
||||
? F::f_ton
|
||||
: F::f_amount),
|
||||
currencyReceiver
|
||||
? currencyReceiver->input
|
||||
: creditsReceiver->input,
|
||||
? currencyReceiver->input()
|
||||
: creditsReceiver->input(),
|
||||
MTP_long(creditsReceiver
|
||||
? receiver.creditsAmount()
|
||||
: 0),
|
||||
@@ -145,8 +145,8 @@ void HandleWithdrawalButton(
|
||||
? F::f_ton
|
||||
: F::f_amount),
|
||||
currencyReceiver
|
||||
? currencyReceiver->input
|
||||
: creditsReceiver->input,
|
||||
? currencyReceiver->input()
|
||||
: creditsReceiver->input(),
|
||||
MTP_long(creditsReceiver
|
||||
? receiver.creditsAmount()
|
||||
: 0),
|
||||
|
||||
@@ -146,7 +146,7 @@ mtpRequestId SuggestMedia(
|
||||
const auto randomId = base::RandomValue<uint64>();
|
||||
return api->request(MTPmessages_SendMedia(
|
||||
MTP_flags(flags),
|
||||
item->history()->peer->input,
|
||||
item->history()->peer->input(),
|
||||
ReplyToForMTP(item->history(), replyTo),
|
||||
inputMedia.value_or(Data::WebPageForMTP(webpage, text.isEmpty())),
|
||||
MTP_string(text),
|
||||
@@ -310,7 +310,7 @@ mtpRequestId EditMessage(
|
||||
: item->id;
|
||||
return api->request(MTPmessages_EditMessage(
|
||||
MTP_flags(flags),
|
||||
item->history()->peer->input,
|
||||
item->history()->peer->input(),
|
||||
MTP_int(id),
|
||||
MTP_string(text),
|
||||
inputMedia.value_or(Data::WebPageForMTP(webpage, text.isEmpty())),
|
||||
|
||||
@@ -68,7 +68,7 @@ void GlobalPrivacy::reload(Fn<void()> callback) {
|
||||
}).send();
|
||||
|
||||
_session->appConfig().value(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
_showArchiveAndMute = _session->appConfig().get<bool>(
|
||||
u"autoarchive_setting_available"_q,
|
||||
false);
|
||||
|
||||
@@ -101,7 +101,7 @@ void InviteLinks::performCreate(
|
||||
: Flag(0))
|
||||
| (requestApproval ? Flag::f_request_needed : Flag(0))
|
||||
| (args.subscription ? Flag::f_subscription_pricing : Flag(0))),
|
||||
args.peer->input,
|
||||
args.peer->input(),
|
||||
MTP_int(args.expireDate),
|
||||
MTP_int(args.usageLimit),
|
||||
MTP_string(args.label),
|
||||
@@ -270,7 +270,7 @@ void InviteLinks::performEdit(
|
||||
: Flag(0));
|
||||
_api->request(MTPmessages_EditExportedChatInvite(
|
||||
MTP_flags(editOnlyTitle ? Flag::f_title : flags),
|
||||
peer->input,
|
||||
peer->input(),
|
||||
MTP_string(link),
|
||||
MTP_int(expireDate),
|
||||
MTP_int(usageLimit),
|
||||
@@ -365,7 +365,7 @@ void InviteLinks::destroy(
|
||||
callbacks.push_back(std::move(done));
|
||||
}
|
||||
_api->request(MTPmessages_DeleteExportedChatInvite(
|
||||
peer->input,
|
||||
peer->input(),
|
||||
MTP_string(link)
|
||||
)).done([=] {
|
||||
const auto callbacks = _deleteCallbacks.take(key);
|
||||
@@ -400,8 +400,8 @@ void InviteLinks::destroyAllRevoked(
|
||||
callbacks.push_back(std::move(done));
|
||||
}
|
||||
_api->request(MTPmessages_DeleteRevokedExportedChatInvites(
|
||||
peer->input,
|
||||
admin->inputUser
|
||||
peer->input(),
|
||||
admin->inputUser()
|
||||
)).done([=] {
|
||||
if (const auto callbacks = _deleteRevokedCallbacks.take(peer)) {
|
||||
for (const auto &callback : *callbacks) {
|
||||
@@ -418,7 +418,7 @@ void InviteLinks::requestMyLinks(not_null<PeerData*> peer) {
|
||||
}
|
||||
const auto requestId = _api->request(MTPmessages_GetExportedChatInvites(
|
||||
MTP_flags(0),
|
||||
peer->input,
|
||||
peer->input(),
|
||||
MTP_inputUserSelf(),
|
||||
MTPint(), // offset_date
|
||||
MTPstring(), // offset_link
|
||||
@@ -471,8 +471,8 @@ void InviteLinks::processRequest(
|
||||
using Flag = MTPmessages_HideChatJoinRequest::Flag;
|
||||
_api->request(MTPmessages_HideChatJoinRequest(
|
||||
MTP_flags(approved ? Flag::f_approved : Flag(0)),
|
||||
peer->input,
|
||||
user->inputUser
|
||||
peer->input(),
|
||||
user->inputUser()
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
if (const auto chat = peer->asChat()) {
|
||||
if (chat->count > 0) {
|
||||
@@ -601,7 +601,7 @@ void InviteLinks::requestJoinedFirstSlice(LinkKey key) {
|
||||
}
|
||||
const auto requestId = _api->request(MTPmessages_GetChatInviteImporters(
|
||||
MTP_flags(MTPmessages_GetChatInviteImporters::Flag::f_link),
|
||||
key.peer->input,
|
||||
key.peer->input(),
|
||||
MTP_string(key.link),
|
||||
MTPstring(), // q
|
||||
MTP_int(0), // offset_date
|
||||
@@ -780,8 +780,8 @@ void InviteLinks::requestMoreLinks(
|
||||
_api->request(MTPmessages_GetExportedChatInvites(
|
||||
MTP_flags(Flag::f_offset_link
|
||||
| (revoked ? Flag::f_revoked : Flag(0))),
|
||||
peer->input,
|
||||
admin->inputUser,
|
||||
peer->input(),
|
||||
admin->inputUser(),
|
||||
MTP_int(lastDate),
|
||||
MTP_string(lastLink),
|
||||
MTP_int(kPerPage)
|
||||
|
||||
@@ -105,10 +105,10 @@ void MessagesSearch::searchRequest() {
|
||||
| (savedPeer ? Flag::f_saved_peer_id : Flag())
|
||||
| (_request.topMsgId ? Flag::f_top_msg_id : Flag())
|
||||
| (_request.tags.empty() ? Flag() : Flag::f_saved_reaction)),
|
||||
_history->peer->input,
|
||||
_history->peer->input(),
|
||||
MTP_string(_request.query),
|
||||
(fromPeer ? fromPeer->input : MTP_inputPeerEmpty()),
|
||||
(savedPeer ? savedPeer->input : MTP_inputPeerEmpty()),
|
||||
(fromPeer ? fromPeer->input() : MTP_inputPeerEmpty()),
|
||||
(savedPeer ? savedPeer->input() : MTP_inputPeerEmpty()),
|
||||
MTP_vector_from_range(_request.tags | ranges::views::transform(
|
||||
Data::ReactionToMTP
|
||||
)),
|
||||
|
||||
@@ -36,7 +36,7 @@ MessagesSearchMerged::MessagesSearchMerged(not_null<History*> history)
|
||||
};
|
||||
|
||||
_apiSearch.messagesFounds(
|
||||
) | rpl::start_with_next([=](const FoundMessages &data) {
|
||||
) | rpl::on_next([=](const FoundMessages &data) {
|
||||
if (data.nextToken == _concatedFound.nextToken) {
|
||||
addFound(data);
|
||||
checkFull(data);
|
||||
@@ -50,7 +50,7 @@ MessagesSearchMerged::MessagesSearchMerged(not_null<History*> history)
|
||||
|
||||
if (_migratedSearch) {
|
||||
_migratedSearch->messagesFounds(
|
||||
) | rpl::start_with_next([=](const FoundMessages &data) {
|
||||
) | rpl::on_next([=](const FoundMessages &data) {
|
||||
if (_isFull) {
|
||||
addFound(data);
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ PeerPhoto::PeerPhoto(not_null<ApiWrap*> api)
|
||||
// You can't use _session->lifetime() in the constructor,
|
||||
// only queued, because it is not constructed yet.
|
||||
_session->uploader().photoReady(
|
||||
) | rpl::start_with_next([=](const Storage::UploadedMedia &data) {
|
||||
) | rpl::on_next([=](const Storage::UploadedMedia &data) {
|
||||
ready(data.fullId, data.info.file, std::nullopt);
|
||||
}, _session->lifetime());
|
||||
});
|
||||
@@ -243,12 +243,16 @@ void PeerPhoto::suggest(not_null<PeerData*> peer, UserPhoto &&photo) {
|
||||
void PeerPhoto::clear(not_null<PhotoData*> photo) {
|
||||
const auto self = _session->user();
|
||||
if (self->userpicPhotoId() == photo->id) {
|
||||
const auto photoId = photo->id;
|
||||
const auto peerId = self->id;
|
||||
_api.request(MTPphotos_UpdateProfilePhoto(
|
||||
MTP_flags(0),
|
||||
MTPInputUser(), // bot
|
||||
MTP_inputPhotoEmpty()
|
||||
)).done([=](const MTPphotos_Photo &result) {
|
||||
self->setPhoto(MTP_userProfilePhotoEmpty());
|
||||
_session->storage().remove(
|
||||
Storage::UserPhotosRemoveOne(peerToUser(peerId), photoId));
|
||||
}).send();
|
||||
} else if (photo->peer && photo->peer->userpicPhotoId() == photo->id) {
|
||||
const auto applier = [=](const MTPUpdates &result) {
|
||||
@@ -256,12 +260,12 @@ void PeerPhoto::clear(not_null<PhotoData*> photo) {
|
||||
};
|
||||
if (const auto chat = photo->peer->asChat()) {
|
||||
_api.request(MTPmessages_EditChatPhoto(
|
||||
chat->inputChat,
|
||||
chat->inputChat(),
|
||||
MTP_inputChatPhotoEmpty()
|
||||
)).done(applier).send();
|
||||
} else if (const auto channel = photo->peer->asChannel()) {
|
||||
_api.request(MTPchannels_EditPhoto(
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
MTP_inputChatPhotoEmpty()
|
||||
)).done(applier).send();
|
||||
}
|
||||
@@ -290,7 +294,7 @@ void PeerPhoto::clear(not_null<PhotoData*> photo) {
|
||||
void PeerPhoto::clearPersonal(not_null<UserData*> user) {
|
||||
_api.request(MTPphotos_UploadContactProfilePhoto(
|
||||
MTP_flags(MTPphotos_UploadContactProfilePhoto::Flag::f_save),
|
||||
user->inputUser,
|
||||
user->inputUser(),
|
||||
MTPInputFile(),
|
||||
MTPInputFile(), // video
|
||||
MTPdouble(), // video_start_ts
|
||||
@@ -314,15 +318,20 @@ void PeerPhoto::set(not_null<PeerData*> peer, not_null<PhotoData*> photo) {
|
||||
return;
|
||||
}
|
||||
if (peer == _session->user()) {
|
||||
const auto photoId = photo->id;
|
||||
const auto peerId = peer->id;
|
||||
_api.request(MTPphotos_UpdateProfilePhoto(
|
||||
MTP_flags(0),
|
||||
MTPInputUser(), // bot
|
||||
photo->mtpInput()
|
||||
)).done([=](const MTPphotos_Photo &result) {
|
||||
result.match([&](const MTPDphotos_photo &data) {
|
||||
_session->data().processPhoto(data.vphoto());
|
||||
_session->data().processUsers(data.vusers());
|
||||
});
|
||||
const auto newPhoto = _session->data().processPhoto(
|
||||
result.data().vphoto());
|
||||
_session->data().processUsers(result.data().vusers());
|
||||
_session->storage().replace(Storage::UserPhotosReplace(
|
||||
peerToUser(peerId),
|
||||
photoId,
|
||||
newPhoto->id));
|
||||
}).send();
|
||||
} else {
|
||||
const auto applier = [=](const MTPUpdates &result) {
|
||||
@@ -330,12 +339,12 @@ void PeerPhoto::set(not_null<PeerData*> peer, not_null<PhotoData*> photo) {
|
||||
};
|
||||
if (const auto chat = peer->asChat()) {
|
||||
_api.request(MTPmessages_EditChatPhoto(
|
||||
chat->inputChat,
|
||||
chat->inputChat(),
|
||||
MTP_inputChatPhoto(photo->mtpInput())
|
||||
)).done(applier).send();
|
||||
} else if (const auto channel = peer->asChannel()) {
|
||||
_api.request(MTPchannels_EditPhoto(
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
MTP_inputChatPhoto(photo->mtpInput())
|
||||
)).done(applier).send();
|
||||
}
|
||||
@@ -362,7 +371,7 @@ void PeerPhoto::ready(
|
||||
const auto botUserInput = [&] {
|
||||
const auto user = peer->asUser();
|
||||
return (user && user->botInfo && user->botInfo->canEditInformation)
|
||||
? std::make_optional<MTPInputUser>(user->inputUser)
|
||||
? std::make_optional<MTPInputUser>(user->inputUser())
|
||||
: std::nullopt;
|
||||
}();
|
||||
if (peer->isSelf() || botUserInput) {
|
||||
@@ -386,6 +395,10 @@ void PeerPhoto::ready(
|
||||
_session->storage().add(Storage::UserPhotosSetBack(
|
||||
peerToUser(peer->id),
|
||||
photoId));
|
||||
} else {
|
||||
_session->storage().add(Storage::UserPhotosAddNew(
|
||||
peerToUser(peer->id),
|
||||
photoId));
|
||||
}
|
||||
if (done) {
|
||||
done();
|
||||
@@ -396,7 +409,7 @@ void PeerPhoto::ready(
|
||||
using Flag = MTPDinputChatUploadedPhoto::Flag;
|
||||
const auto none = MTPDinputChatUploadedPhoto::Flags(0);
|
||||
history->sendRequestId = _api.request(MTPmessages_EditChatPhoto(
|
||||
chat->inputChat,
|
||||
chat->inputChat(),
|
||||
MTP_inputChatUploadedPhoto(
|
||||
MTP_flags((file ? Flag::f_file : none)
|
||||
| (videoSize ? Flag::f_video_emoji_markup : none)),
|
||||
@@ -410,7 +423,7 @@ void PeerPhoto::ready(
|
||||
const auto none = MTPDinputChatUploadedPhoto::Flags(0);
|
||||
const auto history = _session->data().history(channel);
|
||||
history->sendRequestId = _api.request(MTPchannels_EditPhoto(
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
MTP_inputChatUploadedPhoto(
|
||||
MTP_flags((file ? Flag::f_file : none)
|
||||
| (videoSize ? Flag::f_video_emoji_markup : none)),
|
||||
@@ -428,7 +441,7 @@ void PeerPhoto::ready(
|
||||
| ((type == UploadType::Suggestion)
|
||||
? Flag::f_suggest
|
||||
: Flag::f_save)),
|
||||
user->inputUser,
|
||||
user->inputUser(),
|
||||
file ? (*file) : MTPInputFile(),
|
||||
MTPInputFile(), // video
|
||||
MTPdouble(), // video_start_ts
|
||||
@@ -456,7 +469,7 @@ void PeerPhoto::requestUserPhotos(
|
||||
}
|
||||
|
||||
const auto requestId = _api.request(MTPphotos_GetUserPhotos(
|
||||
user->inputUser,
|
||||
user->inputUser(),
|
||||
MTP_int(0),
|
||||
MTP_long(afterId),
|
||||
MTP_int(kSharedMediaLimit)
|
||||
|
||||
@@ -90,7 +90,7 @@ void Polls::create(
|
||||
randomId,
|
||||
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
|
||||
MTP_flags(sendFlags),
|
||||
peer->input,
|
||||
peer->input(),
|
||||
Data::Histories::ReplyToPlaceholder(),
|
||||
PollDataToInputMedia(&data),
|
||||
MTP_string(),
|
||||
@@ -99,7 +99,7 @@ void Polls::create(
|
||||
MTPVector<MTPMessageEntity>(),
|
||||
MTP_int(action.options.scheduled),
|
||||
MTP_int(action.options.scheduleRepeatPeriod),
|
||||
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
|
||||
(sendAs ? sendAs->input() : MTP_inputPeerEmpty()),
|
||||
Data::ShortcutIdToMTP(_session, action.options.shortcutId),
|
||||
MTP_long(action.options.effectId),
|
||||
MTP_long(starsPaid),
|
||||
@@ -162,7 +162,7 @@ void Polls::sendVotes(
|
||||
ranges::back_inserter(prepared),
|
||||
[](const QByteArray &option) { return MTP_bytes(option); });
|
||||
const auto requestId = _api.request(MTPmessages_SendVote(
|
||||
item->history()->peer->input,
|
||||
item->history()->peer->input(),
|
||||
MTP_int(item->id),
|
||||
MTP_vector<MTPbytes>(prepared)
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
@@ -188,7 +188,7 @@ void Polls::close(not_null<HistoryItem*> item) {
|
||||
}
|
||||
const auto requestId = _api.request(MTPmessages_EditMessage(
|
||||
MTP_flags(MTPmessages_EditMessage::Flag::f_media),
|
||||
item->history()->peer->input,
|
||||
item->history()->peer->input(),
|
||||
MTP_int(item->id),
|
||||
MTPstring(),
|
||||
PollDataToInputMedia(poll, true),
|
||||
@@ -212,7 +212,7 @@ void Polls::reloadResults(not_null<HistoryItem*> item) {
|
||||
return;
|
||||
}
|
||||
const auto requestId = _api.request(MTPmessages_GetPollResults(
|
||||
item->history()->peer->input,
|
||||
item->history()->peer->input(),
|
||||
MTP_int(item->id)
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
_pollReloadRequestIds.erase(itemId);
|
||||
|
||||
@@ -95,7 +95,7 @@ Premium::Premium(not_null<ApiWrap*> api)
|
||||
// only queued, because it is not constructed yet.
|
||||
Data::AmPremiumValue(
|
||||
_session
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
reload();
|
||||
if (_session->premium()) {
|
||||
reloadCloudSet();
|
||||
@@ -365,7 +365,7 @@ void Premium::resolveGiveawayInfo(
|
||||
_giveawayInfoPeer = peer;
|
||||
_giveawayInfoMessageId = messageId;
|
||||
_giveawayInfoRequestId = _api.request(MTPpayments_GetGiveawayInfo(
|
||||
_giveawayInfoPeer->input,
|
||||
_giveawayInfoPeer->input(),
|
||||
MTP_int(_giveawayInfoMessageId.bare)
|
||||
)).done([=](const MTPpayments_GiveawayInfo &result) {
|
||||
_giveawayInfoRequestId = 0;
|
||||
@@ -500,7 +500,7 @@ rpl::producer<rpl::no_value, QString> PremiumGiftCodeOptions::request() {
|
||||
MTP_flags(_peer->isChannel()
|
||||
? MTPpayments_GetPremiumGiftCodeOptions::Flag::f_boost_peer
|
||||
: MTPpayments_GetPremiumGiftCodeOptions::Flag(0)),
|
||||
_peer->input
|
||||
_peer->input()
|
||||
)).done([=](const MTPVector<TLOption> &result) {
|
||||
auto tlMapOptions = base::flat_map<Amount, QVector<TLOption>>();
|
||||
for (const auto &tlOption : result.v) {
|
||||
@@ -554,7 +554,7 @@ rpl::producer<rpl::no_value, QString> PremiumGiftCodeOptions::applyPrepaid(
|
||||
}
|
||||
|
||||
_api.request(MTPpayments_LaunchPrepaidGiveaway(
|
||||
_peer->input,
|
||||
_peer->input(),
|
||||
MTP_long(prepaidId),
|
||||
invoice.giveawayCredits
|
||||
? Payments::InvoiceCreditsGiveawayToTL(invoice)
|
||||
|
||||
@@ -47,7 +47,7 @@ void SendPhotoReport(
|
||||
const QString &comment,
|
||||
not_null<PhotoData*> photo) {
|
||||
peer->session().api().request(MTPaccount_ReportProfilePhoto(
|
||||
peer->input,
|
||||
peer->input(),
|
||||
photo->mtpInput(),
|
||||
ReasonToTL(reason),
|
||||
MTP_string(comment)
|
||||
@@ -125,7 +125,7 @@ auto CreateReportMessagesOrStoriesCallback(
|
||||
if (!reportInput.stories.empty()) {
|
||||
state->requestId = peer->session().api().request(
|
||||
MTPstories_Report(
|
||||
peer->input,
|
||||
peer->input(),
|
||||
MTP_vector<MTPint>(apiIds),
|
||||
MTP_bytes(reportInput.optionId),
|
||||
MTP_string(reportInput.comment))
|
||||
@@ -133,7 +133,7 @@ auto CreateReportMessagesOrStoriesCallback(
|
||||
} else {
|
||||
state->requestId = peer->session().api().request(
|
||||
MTPmessages_Report(
|
||||
peer->input,
|
||||
peer->input(),
|
||||
MTP_vector<MTPint>(apiIds),
|
||||
MTP_bytes(reportInput.optionId),
|
||||
MTP_string(reportInput.comment))
|
||||
|
||||
@@ -66,7 +66,7 @@ Ringtones::Ringtones(not_null<ApiWrap*> api)
|
||||
// You can't use _session->lifetime() in the constructor,
|
||||
// only queued, because it is not constructed yet.
|
||||
_session->uploader().documentReady(
|
||||
) | rpl::start_with_next([=](const Storage::UploadedMedia &data) {
|
||||
) | rpl::on_next([=](const Storage::UploadedMedia &data) {
|
||||
ready(data.fullId, data.info.file);
|
||||
}, _session->lifetime());
|
||||
});
|
||||
|
||||
@@ -137,7 +137,7 @@ void SendProgressManager::send(const Key &key, int progress) {
|
||||
MTP_flags(key.topMsgId
|
||||
? MTPmessages_SetTyping::Flag::f_top_msg_id
|
||||
: MTPmessages_SetTyping::Flag(0)),
|
||||
key.history->peer->input,
|
||||
key.history->peer->input(),
|
||||
MTP_int(key.topMsgId),
|
||||
action
|
||||
)).done([=](const MTPBool &result, mtpRequestId requestId) {
|
||||
|
||||
@@ -131,7 +131,7 @@ void SendSimpleMedia(SendAction action, MTPInputMedia inputMedia) {
|
||||
randomId,
|
||||
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
|
||||
MTP_flags(sendFlags),
|
||||
peer->input,
|
||||
peer->input(),
|
||||
Data::Histories::ReplyToPlaceholder(),
|
||||
std::move(inputMedia),
|
||||
MTPstring(),
|
||||
@@ -140,7 +140,7 @@ void SendSimpleMedia(SendAction action, MTPInputMedia inputMedia) {
|
||||
MTPvector<MTPMessageEntity>(),
|
||||
MTP_int(action.options.scheduled),
|
||||
MTP_int(action.options.scheduleRepeatPeriod),
|
||||
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
|
||||
(sendAs ? sendAs->input() : MTP_inputPeerEmpty()),
|
||||
Data::ShortcutIdToMTP(session, action.options.shortcutId),
|
||||
MTP_long(action.options.effectId),
|
||||
MTP_long(starsPaid),
|
||||
@@ -259,7 +259,7 @@ void SendExistingMedia(
|
||||
randomId,
|
||||
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
|
||||
MTP_flags(sendFlags),
|
||||
peer->input,
|
||||
peer->input(),
|
||||
Data::Histories::ReplyToPlaceholder(),
|
||||
inputMedia(),
|
||||
MTP_string(captionText),
|
||||
@@ -268,7 +268,7 @@ void SendExistingMedia(
|
||||
sentEntities,
|
||||
MTP_int(action.options.scheduled),
|
||||
MTP_int(action.options.scheduleRepeatPeriod),
|
||||
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
|
||||
(sendAs ? sendAs->input() : MTP_inputPeerEmpty()),
|
||||
Data::ShortcutIdToMTP(session, action.options.shortcutId),
|
||||
MTP_long(action.options.effectId),
|
||||
MTP_long(starsPaid),
|
||||
@@ -448,7 +448,7 @@ bool SendDice(MessageToSend &message) {
|
||||
randomId,
|
||||
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
|
||||
MTP_flags(sendFlags),
|
||||
peer->input,
|
||||
peer->input(),
|
||||
Data::Histories::ReplyToPlaceholder(),
|
||||
MTP_inputMediaDice(MTP_string(emoji)),
|
||||
MTP_string(),
|
||||
@@ -457,7 +457,7 @@ bool SendDice(MessageToSend &message) {
|
||||
MTP_vector<MTPMessageEntity>(),
|
||||
MTP_int(action.options.scheduled),
|
||||
MTP_int(action.options.scheduleRepeatPeriod),
|
||||
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
|
||||
(sendAs ? sendAs->input() : MTP_inputPeerEmpty()),
|
||||
Data::ShortcutIdToMTP(session, action.options.shortcutId),
|
||||
MTP_long(action.options.effectId),
|
||||
MTP_long(starsPaid),
|
||||
|
||||
@@ -99,7 +99,7 @@ std::optional<HistoryItem*> SingleMessageSearch::performLookupByChannel(
|
||||
ready();
|
||||
};
|
||||
_requestId = _session->api().request(MTPchannels_GetMessages(
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
MTP_vector<MTPInputMessage>(1, MTP_inputMessageID(MTP_int(postId)))
|
||||
)).done([=](const MTPmessages_Messages &result) {
|
||||
const auto received = Api::ParseSearchResult(
|
||||
|
||||
@@ -210,7 +210,7 @@ rpl::producer<rpl::no_value, QString> Statistics::request() {
|
||||
if (!channel()->isMegagroup()) {
|
||||
makeRequest(MTPstats_GetBroadcastStats(
|
||||
MTP_flags(MTPstats_GetBroadcastStats::Flags(0)),
|
||||
channel()->inputChannel
|
||||
channel()->inputChannel()
|
||||
)).done([=](const MTPstats_BroadcastStats &result) {
|
||||
_channelStats = ChannelStatisticsFromTL(result.data());
|
||||
consumer.put_done();
|
||||
@@ -220,7 +220,7 @@ rpl::producer<rpl::no_value, QString> Statistics::request() {
|
||||
} else {
|
||||
makeRequest(MTPstats_GetMegagroupStats(
|
||||
MTP_flags(MTPstats_GetMegagroupStats::Flags(0)),
|
||||
channel()->inputChannel
|
||||
channel()->inputChannel()
|
||||
)).done([=](const MTPstats_MegagroupStats &result) {
|
||||
const auto &data = result.data();
|
||||
_supergroupStats = SupergroupStatisticsFromTL(data);
|
||||
@@ -351,14 +351,14 @@ void PublicForwards::request(
|
||||
constexpr auto kLimit = tl::make_int(100);
|
||||
if (_fullId.messageId) {
|
||||
_requestId = makeRequest(MTPstats_GetMessagePublicForwards(
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
MTP_int(_fullId.messageId.msg),
|
||||
MTP_string(token),
|
||||
kLimit
|
||||
)).done(processResult).fail(processFail).send();
|
||||
} else if (_fullId.storyId) {
|
||||
_requestId = makeRequest(MTPstats_GetStoryPublicForwards(
|
||||
channel->input,
|
||||
channel->input(),
|
||||
MTP_int(_fullId.storyId.story),
|
||||
MTP_string(token),
|
||||
kLimit
|
||||
@@ -413,7 +413,7 @@ void MessageStatistics::request(Fn<void(Data::MessageStatistics)> done) {
|
||||
const Data::StatisticalGraph &messageGraph,
|
||||
const Data::StatisticalGraph &reactionsGraph) {
|
||||
api().request(MTPchannels_GetMessages(
|
||||
channel()->inputChannel,
|
||||
channel()->inputChannel(),
|
||||
MTP_vector<MTPInputMessage>(
|
||||
1,
|
||||
MTP_inputMessageID(MTP_int(_fullId.msg))))
|
||||
@@ -468,7 +468,7 @@ void MessageStatistics::request(Fn<void(Data::MessageStatistics)> done) {
|
||||
const Data::StatisticalGraph &messageGraph,
|
||||
const Data::StatisticalGraph &reactionsGraph) {
|
||||
api().request(MTPstories_GetStoriesByID(
|
||||
channel()->input,
|
||||
channel()->input(),
|
||||
MTP_vector<MTPint>(1, MTP_int(_storyId.story)))
|
||||
).done([=](const MTPstories_Stories &result) {
|
||||
const auto &storyItem = result.data().vstories().v.front();
|
||||
@@ -499,7 +499,7 @@ void MessageStatistics::request(Fn<void(Data::MessageStatistics)> done) {
|
||||
if (_storyId) {
|
||||
makeRequest(MTPstats_GetStoryStats(
|
||||
MTP_flags(MTPstats_GetStoryStats::Flags(0)),
|
||||
channel()->input,
|
||||
channel()->input(),
|
||||
MTP_int(_storyId.story)
|
||||
)).done([=](const MTPstats_StoryStats &result) {
|
||||
const auto &data = result.data();
|
||||
@@ -512,7 +512,7 @@ void MessageStatistics::request(Fn<void(Data::MessageStatistics)> done) {
|
||||
} else {
|
||||
makeRequest(MTPstats_GetMessageStats(
|
||||
MTP_flags(MTPstats_GetMessageStats::Flags(0)),
|
||||
channel()->inputChannel,
|
||||
channel()->inputChannel(),
|
||||
MTP_int(_fullId.msg.bare)
|
||||
)).done([=](const MTPstats_MessageStats &result) {
|
||||
const auto &data = result.data();
|
||||
@@ -539,7 +539,7 @@ rpl::producer<rpl::no_value, QString> Boosts::request() {
|
||||
}
|
||||
|
||||
_api.request(MTPpremium_GetBoostsStatus(
|
||||
_peer->input
|
||||
_peer->input()
|
||||
)).done([=](const MTPpremium_BoostsStatus &result) {
|
||||
const auto &data = result.data();
|
||||
channel->updateLevelHint(data.vlevel().v);
|
||||
@@ -625,7 +625,7 @@ void Boosts::requestBoosts(
|
||||
gifts
|
||||
? MTP_flags(MTPpremium_GetBoostsList::Flag::f_gifts)
|
||||
: MTP_flags(0),
|
||||
_peer->input,
|
||||
_peer->input(),
|
||||
MTP_string(token.next),
|
||||
token.next.isEmpty() ? kTlFirstSlice : kTlLimit
|
||||
)).done([=](const MTPpremium_BoostsList &result) {
|
||||
@@ -698,7 +698,7 @@ rpl::producer<rpl::no_value, QString> EarnStatistics::request() {
|
||||
|
||||
api().request(MTPpayments_GetStarsRevenueStats(
|
||||
MTP_flags(MTPpayments_getStarsRevenueStats::Flag::f_ton),
|
||||
(_isUser ? user()->input : channel()->input)
|
||||
(_isUser ? user()->input() : channel()->input())
|
||||
)).done([=](const MTPpayments_StarsRevenueStats &result) {
|
||||
const auto &data = result.data();
|
||||
const auto &balances = data.vstatus().data();
|
||||
@@ -721,7 +721,7 @@ rpl::producer<rpl::no_value, QString> EarnStatistics::request() {
|
||||
|
||||
if (!_isUser) {
|
||||
api().request(
|
||||
MTPchannels_GetFullChannel(channel()->inputChannel)
|
||||
MTPchannels_GetFullChannel(channel()->inputChannel())
|
||||
).done([=](const MTPmessages_ChatFull &result) {
|
||||
result.data().vfull_chat().match([&](
|
||||
const MTPDchannelFull &d) {
|
||||
@@ -757,7 +757,7 @@ void EarnStatistics::requestHistory(
|
||||
_requestId = api().request(MTPpayments_GetStarsTransactions(
|
||||
MTP_flags(MTPpayments_getStarsTransactions::Flag::f_ton),
|
||||
MTP_string(), // Subscription ID.
|
||||
(_isUser ? user()->input : channel()->input),
|
||||
(_isUser ? user()->input() : channel()->input()),
|
||||
MTP_string(token),
|
||||
token.isEmpty() ? kTlFirstSlice : kTlLimit
|
||||
)).done([=](const MTPpayments_StarsStatus &result) {
|
||||
|
||||
@@ -66,7 +66,7 @@ void SendApproval(
|
||||
suggestion->requestId = session->api().request(
|
||||
MTPmessages_ToggleSuggestedPostApproval(
|
||||
MTP_flags(scheduleDate ? Flag::f_schedule_date : Flag()),
|
||||
item->history()->peer->input,
|
||||
item->history()->peer->input(),
|
||||
MTP_int(item->id.bare),
|
||||
MTP_int(scheduleDate),
|
||||
MTPstring()) // reject_comment
|
||||
@@ -154,13 +154,13 @@ void ConfirmApproval(
|
||||
? tr::lng_suggest_accept_text(
|
||||
tr::now,
|
||||
lt_from,
|
||||
Ui::Text::Bold(item->from()->shortName()),
|
||||
Ui::Text::WithEntities)
|
||||
tr::bold(item->from()->shortName()),
|
||||
tr::marked)
|
||||
: tr::lng_suggest_accept_text_to(
|
||||
tr::now,
|
||||
lt_channel,
|
||||
Ui::Text::Bold(channelName),
|
||||
Ui::Text::WithEntities);
|
||||
tr::bold(channelName),
|
||||
tr::marked);
|
||||
if (price) {
|
||||
text.append("\n\n").append(admin
|
||||
? (scheduleDate
|
||||
@@ -171,12 +171,12 @@ void ConfirmApproval(
|
||||
lt_count_decimal,
|
||||
amount.value(),
|
||||
lt_channel,
|
||||
Ui::Text::Bold(channelName),
|
||||
tr::bold(channelName),
|
||||
lt_percent,
|
||||
TextWithEntities{ commission },
|
||||
lt_date,
|
||||
Ui::Text::Bold(date),
|
||||
Ui::Text::RichLangValue)
|
||||
tr::bold(date),
|
||||
tr::rich)
|
||||
: (amount.stars()
|
||||
? tr::lng_suggest_accept_receive_now_stars
|
||||
: tr::lng_suggest_accept_receive_now_ton)(
|
||||
@@ -184,10 +184,10 @@ void ConfirmApproval(
|
||||
lt_count_decimal,
|
||||
amount.value(),
|
||||
lt_channel,
|
||||
Ui::Text::Bold(channelName),
|
||||
tr::bold(channelName),
|
||||
lt_percent,
|
||||
TextWithEntities{ commission },
|
||||
Ui::Text::RichLangValue))
|
||||
tr::rich))
|
||||
: (scheduleDate
|
||||
? (amount.stars()
|
||||
? tr::lng_suggest_accept_pay_stars
|
||||
@@ -196,25 +196,25 @@ void ConfirmApproval(
|
||||
lt_count_decimal,
|
||||
amount.value(),
|
||||
lt_date,
|
||||
Ui::Text::Bold(date),
|
||||
Ui::Text::RichLangValue)
|
||||
tr::bold(date),
|
||||
tr::rich)
|
||||
: (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)));
|
||||
tr::rich)));
|
||||
if (admin) {
|
||||
text.append(' ').append(
|
||||
tr::lng_suggest_accept_receive_if(
|
||||
tr::now,
|
||||
Ui::Text::RichLangValue));
|
||||
tr::rich));
|
||||
if (price.stars()) {
|
||||
text.append("\n\n").append(
|
||||
tr::lng_suggest_options_stars_warning(
|
||||
tr::now,
|
||||
Ui::Text::RichLangValue));
|
||||
tr::rich));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -267,7 +267,7 @@ void SendDecline(
|
||||
MTPmessages_ToggleSuggestedPostApproval(
|
||||
MTP_flags(Flag::f_reject
|
||||
| (comment.isEmpty() ? Flag() : Flag::f_reject_comment)),
|
||||
item->history()->peer->input,
|
||||
item->history()->peer->input(),
|
||||
MTP_int(item->id.bare),
|
||||
MTPint(), // schedule_date
|
||||
MTP_string(comment))
|
||||
@@ -321,12 +321,12 @@ void RequestDeclineComment(
|
||||
.text = (admin
|
||||
? tr::lng_suggest_decline_text(
|
||||
lt_from,
|
||||
rpl::single(Ui::Text::Bold(item->from()->shortName())),
|
||||
Ui::Text::WithEntities)
|
||||
rpl::single(tr::bold(item->from()->shortName())),
|
||||
tr::marked)
|
||||
: tr::lng_suggest_decline_text_to(
|
||||
lt_channel,
|
||||
rpl::single(Ui::Text::Bold(channelName)),
|
||||
Ui::Text::WithEntities)),
|
||||
rpl::single(tr::bold(channelName)),
|
||||
tr::marked)),
|
||||
.confirmed = [=](Fn<void()> close) { (*callback)(); close(); },
|
||||
.confirmText = tr::lng_suggest_action_decline(),
|
||||
.confirmStyle = &st::attentionBoxButton,
|
||||
@@ -351,7 +351,7 @@ void RequestDeclineComment(
|
||||
}
|
||||
};
|
||||
reason->submits(
|
||||
) | rpl::start_with_next([=](Qt::KeyboardModifiers modifiers) {
|
||||
) | rpl::on_next([=](Qt::KeyboardModifiers modifiers) {
|
||||
if (!(modifiers & Qt::ShiftModifier)) {
|
||||
(*callback)();
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_user.h"
|
||||
#include "data/stickers/data_custom_emoji.h"
|
||||
#include "data/stickers/data_stickers_set.h"
|
||||
#include "history/history.h"
|
||||
#include "history/history_item.h"
|
||||
#include "main/main_session.h"
|
||||
|
||||
namespace Api {
|
||||
@@ -47,14 +49,23 @@ using namespace TextUtilities;
|
||||
if (!parsed.userId || parsed.selfId != session->userId().bare) {
|
||||
return {};
|
||||
}
|
||||
return MTP_inputMessageEntityMentionName(
|
||||
offset,
|
||||
length,
|
||||
(parsed.userId == parsed.selfId
|
||||
? MTP_inputUserSelf()
|
||||
: MTP_inputUser(
|
||||
MTP_long(parsed.userId),
|
||||
MTP_long(parsed.accessHash))));
|
||||
const auto user = session->data().user(UserId(parsed.userId));
|
||||
const auto item = user->isLoaded()
|
||||
? nullptr
|
||||
: user->owner().messageWithPeer(user->id);
|
||||
const auto input = item
|
||||
? MTP_inputUserFromMessage(
|
||||
item->history()->peer->input(),
|
||||
MTP_int(item->id.bare),
|
||||
MTP_long(parsed.userId))
|
||||
: (parsed.userId == parsed.selfId)
|
||||
? MTP_inputUserSelf()
|
||||
: user->isLoaded()
|
||||
? user->inputUser()
|
||||
: MTP_inputUser(
|
||||
MTP_long(parsed.userId),
|
||||
MTP_long(parsed.accessHash));
|
||||
return MTP_inputMessageEntityMentionName(offset, length, input);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -95,7 +95,7 @@ void TodoLists::create(
|
||||
randomId,
|
||||
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
|
||||
MTP_flags(sendFlags),
|
||||
peer->input,
|
||||
peer->input(),
|
||||
Data::Histories::ReplyToPlaceholder(),
|
||||
TodoListDataToInputMedia(&data),
|
||||
MTP_string(),
|
||||
@@ -104,7 +104,7 @@ void TodoLists::create(
|
||||
MTPVector<MTPMessageEntity>(),
|
||||
MTP_int(action.options.scheduled),
|
||||
MTP_int(action.options.scheduleRepeatPeriod),
|
||||
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
|
||||
(sendAs ? sendAs->input() : MTP_inputPeerEmpty()),
|
||||
Data::ShortcutIdToMTP(_session, action.options.shortcutId),
|
||||
MTP_long(action.options.effectId),
|
||||
MTP_long(starsPaid),
|
||||
@@ -164,7 +164,7 @@ void TodoLists::add(
|
||||
}
|
||||
const auto session = _session;
|
||||
_session->api().request(MTPmessages_AppendTodoList(
|
||||
item->history()->peer->input,
|
||||
item->history()->peer->input(),
|
||||
MTP_int(item->id.bare),
|
||||
TodoListItemsToMTP(&item->history()->session(), items)
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
@@ -230,7 +230,7 @@ void TodoLists::send(FullMsgId itemId, Accumulated &entry) {
|
||||
auto incompleted = entry.incompleted
|
||||
| ranges::views::transform([](int id) { return MTP_int(id); });
|
||||
entry.requestId = _api.request(MTPmessages_ToggleTodoCompleted(
|
||||
item->history()->peer->input,
|
||||
item->history()->peer->input(),
|
||||
MTP_int(item->id),
|
||||
MTP_vector_from_range(completed),
|
||||
MTP_vector_from_range(incompleted)
|
||||
|
||||
@@ -41,7 +41,7 @@ void Transcribes::rate(not_null<HistoryItem*> item, bool isGood) {
|
||||
for (const auto &[transcribeId, id] : _ids) {
|
||||
if (id == fullId) {
|
||||
_api.request(MTPmessages_RateTranscribedAudio(
|
||||
item->history()->peer->input,
|
||||
item->history()->peer->input(),
|
||||
MTP_int(item->id),
|
||||
MTP_long(transcribeId),
|
||||
MTP_bool(isGood))).send();
|
||||
@@ -158,7 +158,7 @@ void Transcribes::load(not_null<HistoryItem*> item) {
|
||||
};
|
||||
const auto id = item->fullId();
|
||||
const auto requestId = _api.request(MTPmessages_TranscribeAudio(
|
||||
item->history()->peer->input,
|
||||
item->history()->peer->input(),
|
||||
MTP_int(item->id)
|
||||
)).done([=](const MTPmessages_TranscribedAudio &result) {
|
||||
const auto &data = result.data();
|
||||
|
||||
@@ -111,7 +111,7 @@ void UnreadThings::requestMentions(
|
||||
using Flag = MTPmessages_GetUnreadMentions::Flag;
|
||||
const auto requestId = _api->request(MTPmessages_GetUnreadMentions(
|
||||
MTP_flags(topic ? Flag::f_top_msg_id : Flag()),
|
||||
history->peer->input,
|
||||
history->peer->input(),
|
||||
MTP_int(topic ? topic->rootId() : 0),
|
||||
MTP_int(offsetId),
|
||||
MTP_int(addOffset),
|
||||
@@ -147,9 +147,9 @@ void UnreadThings::requestReactions(
|
||||
const auto requestId = _api->request(MTPmessages_GetUnreadReactions(
|
||||
MTP_flags((topic ? Flag::f_top_msg_id : Flag())
|
||||
| (sublist ? Flag::f_saved_peer_id : Flag())),
|
||||
history->peer->input,
|
||||
history->peer->input(),
|
||||
MTP_int(topic ? topic->rootId() : 0),
|
||||
(sublist ? sublist->sublistPeer()->input : MTPInputPeer()),
|
||||
(sublist ? sublist->sublistPeer()->input() : MTPInputPeer()),
|
||||
MTP_int(offsetId),
|
||||
MTP_int(addOffset),
|
||||
MTP_int(limit),
|
||||
|
||||
@@ -137,100 +137,6 @@ bool HasForceLogoutNotification(const MTPUpdates &updates) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ForwardedInfoDataLoaded(
|
||||
not_null<Main::Session*> session,
|
||||
const MTPMessageFwdHeader &header) {
|
||||
return header.match([&](const MTPDmessageFwdHeader &data) {
|
||||
if (const auto fromId = data.vfrom_id()) {
|
||||
// Fully loaded is required in this case.
|
||||
if (!session->data().peerLoaded(peerFromMTP(*fromId))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
bool MentionUsersLoaded(
|
||||
not_null<Main::Session*> session,
|
||||
const MTPVector<MTPMessageEntity> &entities) {
|
||||
for (const auto &entity : entities.v) {
|
||||
auto type = entity.type();
|
||||
if (type == mtpc_messageEntityMentionName) {
|
||||
if (!session->data().userLoaded(entity.c_messageEntityMentionName().vuser_id())) {
|
||||
return false;
|
||||
}
|
||||
} else if (type == mtpc_inputMessageEntityMentionName) {
|
||||
auto &inputUser = entity.c_inputMessageEntityMentionName().vuser_id();
|
||||
if (inputUser.type() == mtpc_inputUser) {
|
||||
if (!session->data().userLoaded(inputUser.c_inputUser().vuser_id())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
DataIsLoadedResult AllDataLoadedForMessage(
|
||||
not_null<Main::Session*> session,
|
||||
const MTPMessage &message) {
|
||||
return message.match([&](const MTPDmessage &message) {
|
||||
if (const auto fromId = message.vfrom_id()) {
|
||||
if (!message.is_post()
|
||||
&& !session->data().peerLoaded(peerFromMTP(*fromId))) {
|
||||
return DataIsLoadedResult::FromNotLoaded;
|
||||
}
|
||||
}
|
||||
if (const auto viaBotId = message.vvia_bot_id()) {
|
||||
if (!session->data().userLoaded(*viaBotId)) {
|
||||
return DataIsLoadedResult::NotLoaded;
|
||||
}
|
||||
}
|
||||
if (const auto fwd = message.vfwd_from()) {
|
||||
if (!ForwardedInfoDataLoaded(session, *fwd)) {
|
||||
return DataIsLoadedResult::NotLoaded;
|
||||
}
|
||||
}
|
||||
if (const auto entities = message.ventities()) {
|
||||
if (!MentionUsersLoaded(session, *entities)) {
|
||||
return DataIsLoadedResult::MentionNotLoaded;
|
||||
}
|
||||
}
|
||||
return DataIsLoadedResult::Ok;
|
||||
}, [&](const MTPDmessageService &message) {
|
||||
if (const auto fromId = message.vfrom_id()) {
|
||||
if (!message.is_post()
|
||||
&& !session->data().peerLoaded(peerFromMTP(*fromId))) {
|
||||
return DataIsLoadedResult::FromNotLoaded;
|
||||
}
|
||||
}
|
||||
return message.vaction().match(
|
||||
[&](const MTPDmessageActionChatAddUser &action) {
|
||||
for (const auto &userId : action.vusers().v) {
|
||||
if (!session->data().userLoaded(userId)) {
|
||||
return DataIsLoadedResult::NotLoaded;
|
||||
}
|
||||
}
|
||||
return DataIsLoadedResult::Ok;
|
||||
}, [&](const MTPDmessageActionChatJoinedByLink &action) {
|
||||
if (!session->data().userLoaded(action.vinviter_id())) {
|
||||
return DataIsLoadedResult::NotLoaded;
|
||||
}
|
||||
return DataIsLoadedResult::Ok;
|
||||
}, [&](const MTPDmessageActionChatDeleteUser &action) {
|
||||
if (!session->data().userLoaded(action.vuser_id())) {
|
||||
return DataIsLoadedResult::NotLoaded;
|
||||
}
|
||||
return DataIsLoadedResult::Ok;
|
||||
}, [](const auto &) {
|
||||
return DataIsLoadedResult::Ok;
|
||||
});
|
||||
}, [](const MTPDmessageEmpty &message) {
|
||||
return DataIsLoadedResult::Ok;
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Updates::Updates(not_null<Main::Session*> session)
|
||||
@@ -246,12 +152,12 @@ Updates::Updates(not_null<Main::Session*> session)
|
||||
_ptsWaiter.setRequesting(true);
|
||||
|
||||
session->account().mtpUpdates(
|
||||
) | rpl::start_with_next([=](const MTPUpdates &updates) {
|
||||
) | rpl::on_next([=](const MTPUpdates &updates) {
|
||||
mtpUpdateReceived(updates);
|
||||
}, _lifetime);
|
||||
|
||||
session->account().mtpNewSessionCreated(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
mtpNewSessionCreated();
|
||||
}, _lifetime);
|
||||
|
||||
@@ -265,7 +171,7 @@ Updates::Updates(not_null<Main::Session*> session)
|
||||
Data::PeerUpdate::Flag::FullInfo
|
||||
) | rpl::filter([](const Data::PeerUpdate &update) {
|
||||
return update.peer->isChat() || update.peer->isMegagroup();
|
||||
}) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
|
||||
}) | rpl::on_next([=](const Data::PeerUpdate &update) {
|
||||
const auto peer = update.peer;
|
||||
if (const auto list = _pendingSpeakingCallParticipants.take(peer)) {
|
||||
if (const auto call = peer->groupCall()) {
|
||||
@@ -747,7 +653,7 @@ void Updates::getChannelDifference(
|
||||
}
|
||||
api().request(MTPupdates_GetChannelDifference(
|
||||
MTP_flags(flags),
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
filter,
|
||||
MTP_int(channel->pts()),
|
||||
MTP_int(kChannelGetDifferenceLimit)
|
||||
@@ -766,7 +672,7 @@ void Updates::addActiveChat(rpl::producer<PeerData*> chat) {
|
||||
const auto key = _activeChats.empty() ? 0 : _activeChats.back().first + 1;
|
||||
std::move(
|
||||
chat
|
||||
) | rpl::start_with_next_done([=](PeerData *peer) {
|
||||
) | rpl::on_next_done([=](PeerData *peer) {
|
||||
auto &active = _activeChats[key];
|
||||
const auto was = active.peer;
|
||||
if (was != peer) {
|
||||
@@ -826,7 +732,7 @@ void Updates::channelRangeDifferenceSend(
|
||||
MTP_int(range.till - 1))));
|
||||
const auto requestId = api().request(MTPupdates_GetChannelDifference(
|
||||
MTP_flags(MTPupdates_GetChannelDifference::Flag::f_force),
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
filter,
|
||||
MTP_int(pts),
|
||||
MTP_int(limit)
|
||||
@@ -1513,18 +1419,13 @@ void Updates::applyUpdates(
|
||||
|
||||
case mtpc_updateShortMessage: {
|
||||
auto &d = updates.c_updateShortMessage();
|
||||
const auto viaBotId = d.vvia_bot_id();
|
||||
const auto entities = d.ventities();
|
||||
const auto fwd = d.vfwd_from();
|
||||
if (!session().data().userLoaded(d.vuser_id())
|
||||
|| (viaBotId && !session().data().userLoaded(*viaBotId))
|
||||
|| (entities && !MentionUsersLoaded(&session(), *entities))
|
||||
|| (fwd && !ForwardedInfoDataLoaded(&session(), *fwd))) {
|
||||
if (!session().data().userLoaded(d.vuser_id())) {
|
||||
MTP_LOG(0, ("getDifference "
|
||||
"{ good - getting user for updateShortMessage }%1"
|
||||
).arg(_session->mtp().isTestMode() ? " TESTMODE" : ""));
|
||||
).arg(_session->mtp().isTestMode() ? " TESTMODE" : ""));
|
||||
return getDifference();
|
||||
}
|
||||
_session->data().fillMessagePeers(d);
|
||||
if (updateAndApply(d.vpts().v, d.vpts_count().v, updates)) {
|
||||
// Update date as well.
|
||||
setState(0, d.vdate().v, _updatesQts, _updatesSeq);
|
||||
@@ -1533,24 +1434,14 @@ void Updates::applyUpdates(
|
||||
|
||||
case mtpc_updateShortChatMessage: {
|
||||
auto &d = updates.c_updateShortChatMessage();
|
||||
const auto noFrom = !session().data().userLoaded(d.vfrom_id());
|
||||
const auto chat = session().data().chatLoaded(d.vchat_id());
|
||||
const auto viaBotId = d.vvia_bot_id();
|
||||
const auto entities = d.ventities();
|
||||
const auto fwd = d.vfwd_from();
|
||||
if (!chat
|
||||
|| noFrom
|
||||
|| (viaBotId && !session().data().userLoaded(*viaBotId))
|
||||
|| (entities && !MentionUsersLoaded(&session(), *entities))
|
||||
|| (fwd && !ForwardedInfoDataLoaded(&session(), *fwd))) {
|
||||
if (!chat) {
|
||||
MTP_LOG(0, ("getDifference "
|
||||
"{ good - getting user for updateShortChatMessage }%1"
|
||||
).arg(_session->mtp().isTestMode() ? " TESTMODE" : ""));
|
||||
if (chat && noFrom) {
|
||||
session().api().requestFullPeer(chat);
|
||||
}
|
||||
"{ good - getting chat for updateShortChatMessage }%1"
|
||||
).arg(_session->mtp().isTestMode() ? " TESTMODE" : ""));
|
||||
return getDifference();
|
||||
}
|
||||
_session->data().fillMessagePeers(d);
|
||||
if (updateAndApply(d.vpts().v, d.vpts_count().v, updates)) {
|
||||
// Update date as well.
|
||||
setState(0, d.vdate().v, _updatesQts, _updatesSeq);
|
||||
@@ -1580,13 +1471,7 @@ void Updates::applyUpdates(
|
||||
const auto wasAlready = (lookupMessage() != nullptr);
|
||||
feedUpdate(MTP_updateMessageID(d.vid(), MTP_long(randomId))); // ignore real date
|
||||
if (const auto item = lookupMessage()) {
|
||||
const auto list = d.ventities();
|
||||
if (list && !MentionUsersLoaded(&session(), *list)) {
|
||||
session().api().requestMessageData(
|
||||
item->history()->peer,
|
||||
item->id,
|
||||
nullptr);
|
||||
}
|
||||
_session->data().fillMessagePeers(item->fullId(), d);
|
||||
item->applySentMessage(sent.text, d, wasAlready);
|
||||
}
|
||||
}
|
||||
@@ -1613,25 +1498,22 @@ void Updates::feedUpdate(const MTPUpdate &update) {
|
||||
// New messages.
|
||||
case mtpc_updateNewMessage: {
|
||||
auto &d = update.c_updateNewMessage();
|
||||
|
||||
const auto isDataLoaded = AllDataLoadedForMessage(&session(), d.vmessage());
|
||||
if (!requestingDifference() && isDataLoaded != DataIsLoadedResult::Ok) {
|
||||
MTP_LOG(0, ("getDifference "
|
||||
"{ good - after not all data loaded in updateNewMessage }%1"
|
||||
if (!requestingDifference()) {
|
||||
const auto peerId = PeerFromMessage(d.vmessage());
|
||||
const auto peer = session().data().peerLoaded(peerId);
|
||||
if (peerId && !peer) {
|
||||
MTP_LOG(0, ("getDifference "
|
||||
"{ good - getting peer for updateNewMessage }%1"
|
||||
).arg(_session->mtp().isTestMode() ? " TESTMODE" : ""));
|
||||
|
||||
// This can be if this update was created by grouping
|
||||
// some short message update into an updates vector.
|
||||
return getDifference();
|
||||
return getDifference();
|
||||
}
|
||||
}
|
||||
|
||||
updateAndApply(d.vpts().v, d.vpts_count().v, update);
|
||||
} break;
|
||||
|
||||
case mtpc_updateNewChannelMessage: {
|
||||
auto &d = update.c_updateNewChannelMessage();
|
||||
auto channel = session().data().channelLoaded(peerToChannel(PeerFromMessage(d.vmessage())));
|
||||
const auto isDataLoaded = AllDataLoadedForMessage(&session(), d.vmessage());
|
||||
{
|
||||
// Todo delete.
|
||||
const auto messageId = IdFromMessage(d.vmessage());
|
||||
@@ -1643,22 +1525,10 @@ void Updates::feedUpdate(const MTPUpdate &update) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!requestingDifference() && (!channel || isDataLoaded != DataIsLoadedResult::Ok)) {
|
||||
if (!requestingDifference() && !channel) {
|
||||
MTP_LOG(0, ("getDifference "
|
||||
"{ good - after not all data loaded in updateNewChannelMessage }%1"
|
||||
).arg(_session->mtp().isTestMode() ? " TESTMODE" : ""));
|
||||
|
||||
// Request last active supergroup participants if the 'from' user was not loaded yet.
|
||||
// This will optimize similar getDifference() calls for almost all next messages.
|
||||
if (isDataLoaded == DataIsLoadedResult::FromNotLoaded && channel && channel->isMegagroup()) {
|
||||
if (channel->canViewMembers()
|
||||
&& channel->mgInfo->lastParticipants.size() < _session->serverConfig().chatSizeMax
|
||||
&& (channel->mgInfo->lastParticipants.empty()
|
||||
|| channel->mgInfo->lastParticipants.size() < channel->membersCount())) {
|
||||
session().api().chatParticipants().requestLast(channel);
|
||||
}
|
||||
}
|
||||
|
||||
if (!_byMinChannelTimer.isActive()) { // getDifference after timeout
|
||||
_byMinChannelTimer.callOnce(PtsWaiter::kWaitForSkippedTimeout);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace {
|
||||
not_null<PeerData*> peer) {
|
||||
const auto user = peer->asUser();
|
||||
return (user && user->botInfo && user->botInfo->canEditInformation)
|
||||
? std::make_optional<MTPInputUser>(user->inputUser)
|
||||
? std::make_optional<MTPInputUser>(user->inputUser())
|
||||
: std::nullopt;
|
||||
}
|
||||
|
||||
@@ -98,9 +98,9 @@ rpl::producer<Data::Usernames> Usernames::loadUsernames(
|
||||
if (peer->isSelf()) {
|
||||
requestUser(MTP_inputUserSelf());
|
||||
} else if (const auto user = peer->asUser()) {
|
||||
requestUser(user->inputUser);
|
||||
requestUser(user->inputUser());
|
||||
} else if (const auto channel = peer->asChannel()) {
|
||||
requestChannel(channel->inputChannel);
|
||||
requestChannel(channel->inputChannel());
|
||||
}
|
||||
return lifetime;
|
||||
};
|
||||
@@ -163,7 +163,7 @@ rpl::producer<rpl::no_value, Usernames::Error> Usernames::toggle(
|
||||
)).done(done).fail(fail).handleFloodErrors().send();
|
||||
} else if (const auto channel = peer->asChannel()) {
|
||||
_api.request(MTPchannels_ToggleUsername(
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
MTP_string(username),
|
||||
MTP_bool(active)
|
||||
)).done(done).fail(fail).handleFloodErrors().send();
|
||||
@@ -216,7 +216,7 @@ rpl::producer<> Usernames::reorder(
|
||||
_reorderRequests.emplace(peerId, requestId);
|
||||
} else if (const auto channel = peer->asChannel()) {
|
||||
const auto requestId = _api.request(MTPchannels_ReorderUsernames(
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
MTP_vector<MTPstring>(std::move(tlUsernames))
|
||||
)).done(finish).fail(finish).send();
|
||||
_reorderRequests.emplace(peerId, requestId);
|
||||
@@ -251,7 +251,7 @@ void Usernames::requestToCache(not_null<PeerData*> peer) {
|
||||
const auto lifetime = std::make_shared<rpl::lifetime>();
|
||||
*lifetime = loadUsernames(
|
||||
peer
|
||||
) | rpl::start_with_next([=, id = peer->id](Data::Usernames usernames) {
|
||||
) | rpl::on_next([=, id = peer->id](Data::Usernames usernames) {
|
||||
_tinyCache = std::make_pair(id, std::move(usernames));
|
||||
lifetime->destroy();
|
||||
});
|
||||
|
||||
@@ -33,7 +33,7 @@ TLInputRules RulesToTL(const UserPrivacy::Rule &rule) {
|
||||
result.reserve(peers.size());
|
||||
for (const auto &peer : peers) {
|
||||
if (const auto user = peer->asUser()) {
|
||||
result.push_back(user->inputUser);
|
||||
result.push_back(user->inputUser());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -95,7 +95,7 @@ void ViewsManager::viewsIncrement() {
|
||||
ids.push_back(MTP_int(msgId));
|
||||
}
|
||||
const auto requestId = _api.request(MTPmessages_GetMessagesViews(
|
||||
i->first->input,
|
||||
i->first->input(),
|
||||
MTP_vector<MTPint>(ids),
|
||||
MTP_bool(true)
|
||||
)).done([=](
|
||||
@@ -183,7 +183,7 @@ void ViewsManager::sendPollRequests(
|
||||
}
|
||||
};
|
||||
const auto requestId = _api.request(MTPmessages_GetExtendedMedia(
|
||||
peer->input,
|
||||
peer->input(),
|
||||
MTP_vector<MTPint>(list)
|
||||
)).done([=](const MTPUpdates &result, mtpRequestId id) {
|
||||
_session->api().applyUpdates(result);
|
||||
|
||||
@@ -174,7 +174,7 @@ struct State {
|
||||
}
|
||||
session->changes().messageUpdates(
|
||||
Data::MessageUpdate::Flag::Destroyed
|
||||
) | rpl::start_with_next([=](const Data::MessageUpdate &update) {
|
||||
) | rpl::on_next([=](const Data::MessageUpdate &update) {
|
||||
const auto i = context->cachedRead.find(update.item);
|
||||
if (i != end(context->cachedRead)) {
|
||||
session->api().request(i->second.requestId).cancel();
|
||||
@@ -192,7 +192,7 @@ struct State {
|
||||
session
|
||||
) | rpl::skip(1) | rpl::filter(
|
||||
rpl::mappers::_1
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
for (auto &[item, cache] : context->cachedRead) {
|
||||
if (cache.data.current().state == Ui::WhoReadState::MyHidden) {
|
||||
cache.data = Peers{ .state = Ui::WhoReadState::Unknown };
|
||||
@@ -202,7 +202,7 @@ struct State {
|
||||
session->api().globalPrivacy().hideReadTime(
|
||||
) | rpl::skip(1) | rpl::filter(
|
||||
!rpl::mappers::_1
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
for (auto &[item, cache] : context->cachedRead) {
|
||||
if (cache.data.current().state == Ui::WhoReadState::MyHidden) {
|
||||
cache.data = Peers{ .state = Ui::WhoReadState::Unknown };
|
||||
@@ -252,7 +252,7 @@ struct State {
|
||||
} else if (const auto user = item->history()->peer->asUser()) {
|
||||
entry.requestId = session->api().request(
|
||||
MTPmessages_GetOutboxReadDate(
|
||||
user->input,
|
||||
user->input(),
|
||||
MTP_int(item->id)
|
||||
)
|
||||
).done([=](const MTPOutboxReadDate &result) {
|
||||
@@ -282,7 +282,7 @@ struct State {
|
||||
} else {
|
||||
entry.requestId = session->api().request(
|
||||
MTPmessages_GetMessageReadParticipants(
|
||||
item->history()->peer->input,
|
||||
item->history()->peer->input(),
|
||||
MTP_int(item->id)
|
||||
)
|
||||
).done([=](const MTPVector<MTPReadParticipantDate> &result) {
|
||||
@@ -340,7 +340,7 @@ struct State {
|
||||
MTP_flags(reaction.empty()
|
||||
? Flag(0)
|
||||
: Flag::f_reaction),
|
||||
item->history()->peer->input,
|
||||
item->history()->peer->input(),
|
||||
MTP_int(item->id),
|
||||
ReactionToMTP(reaction),
|
||||
MTPstring(), // offset
|
||||
@@ -590,7 +590,7 @@ rpl::producer<Ui::WhoReadContent> WhoReacted(
|
||||
}
|
||||
std::move(
|
||||
idsWithReactions
|
||||
) | rpl::start_with_next([=](PeersWithReactions &&peers) {
|
||||
) | rpl::on_next([=](PeersWithReactions &&peers) {
|
||||
if (peers.state == WhoReadState::Unknown) {
|
||||
state->userpics.clear();
|
||||
consumer.put_next(Ui::WhoReadContent{
|
||||
@@ -624,7 +624,7 @@ rpl::producer<Ui::WhoReadContent> WhoReacted(
|
||||
item->history()->session().downloaderTaskFinished(
|
||||
) | rpl::filter([=] {
|
||||
return state->someUserpicsNotLoaded && !state->scheduled;
|
||||
}) | rpl::start_with_next([=] {
|
||||
}) | rpl::on_next([=] {
|
||||
for (const auto &userpic : state->userpics) {
|
||||
if (userpic.peer->userpicUniqueKey(userpic.view)
|
||||
!= userpic.uniqueKey) {
|
||||
|
||||
@@ -199,7 +199,7 @@ ApiWrap::ApiWrap(not_null<Main::Session*> session)
|
||||
_session->data().chatsFilters().changed(
|
||||
) | rpl::filter([=] {
|
||||
return _session->data().chatsFilters().archiveNeeded();
|
||||
}) | rpl::start_with_next([=] {
|
||||
}) | rpl::on_next([=] {
|
||||
requestMoreDialogsIfNeeded();
|
||||
}, _session->lifetime());
|
||||
|
||||
@@ -248,7 +248,7 @@ void ApiWrap::setupSupportMode() {
|
||||
}
|
||||
|
||||
_session->settings().supportChatsTimeSliceValue(
|
||||
) | rpl::start_with_next([=](int seconds) {
|
||||
) | rpl::on_next([=](int seconds) {
|
||||
_dialogsLoadTill = seconds ? std::max(base::unixtime::now() - seconds, 0) : 0;
|
||||
refreshDialogsLoadBlocked();
|
||||
}, _session->lifetime());
|
||||
@@ -367,7 +367,7 @@ void ApiWrap::savePinnedOrder(Data::Folder *folder) {
|
||||
const auto &order = _session->data().pinnedChatsOrder(folder);
|
||||
const auto input = [](Dialogs::Key key) {
|
||||
if (const auto history = key.history()) {
|
||||
return MTP_inputDialogPeer(history->peer->input);
|
||||
return MTP_inputDialogPeer(history->peer->input());
|
||||
} else if (const auto folder = key.folder()) {
|
||||
return MTP_inputDialogPeerFolder(MTP_int(folder->id()));
|
||||
}
|
||||
@@ -402,7 +402,7 @@ void ApiWrap::savePinnedOrder(not_null<Data::Forum*> forum) {
|
||||
input);
|
||||
request(MTPmessages_ReorderPinnedForumTopics(
|
||||
MTP_flags(MTPmessages_ReorderPinnedForumTopics::Flag::f_force),
|
||||
forum->peer()->input,
|
||||
forum->peer()->input(),
|
||||
MTP_vector(topics)
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
applyUpdates(result);
|
||||
@@ -416,7 +416,7 @@ void ApiWrap::savePinnedOrder(not_null<Data::SavedMessages*> saved) {
|
||||
const auto &order = _session->data().pinnedChatsOrder(saved);
|
||||
const auto input = [](Dialogs::Key key) {
|
||||
if (const auto sublist = key.sublist()) {
|
||||
return MTP_inputDialogPeer(sublist->sublistPeer()->input);
|
||||
return MTP_inputDialogPeer(sublist->sublistPeer()->input());
|
||||
}
|
||||
Unexpected("Key type in pinnedDialogsOrder().");
|
||||
};
|
||||
@@ -445,7 +445,7 @@ void ApiWrap::toggleHistoryArchived(
|
||||
MTP_vector<MTPInputFolderPeer>(
|
||||
1,
|
||||
MTP_inputFolderPeer(
|
||||
history->peer->input,
|
||||
history->peer->input(),
|
||||
MTP_int(archived ? archiveId : 0)))
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
applyUpdates(result);
|
||||
@@ -487,7 +487,7 @@ void ApiWrap::sendMessageFail(
|
||||
PeerFloodErrorText(&session(), PeerFloodType::Send)),
|
||||
Ui::LayerOption::CloseOther);
|
||||
} else if (show && error == u"USER_BANNED_IN_CHANNEL"_q) {
|
||||
const auto link = Ui::Text::Link(
|
||||
const auto link = tr::link(
|
||||
tr::lng_cant_more_info(tr::now),
|
||||
session().createInternalLinkFull(u"spambot"_q));
|
||||
show->showBox(
|
||||
@@ -496,7 +496,7 @@ void ApiWrap::sendMessageFail(
|
||||
tr::now,
|
||||
lt_more_info,
|
||||
link,
|
||||
Ui::Text::WithEntities)),
|
||||
tr::marked)),
|
||||
Ui::LayerOption::CloseOther);
|
||||
} else if (error.startsWith(u"SLOWMODE_WAIT_"_q)) {
|
||||
const auto chop = u"SLOWMODE_WAIT_"_q.size();
|
||||
@@ -641,7 +641,7 @@ void ApiWrap::resolveMessageDatas() {
|
||||
if (!ids.isEmpty()) {
|
||||
const auto channel = j->first;
|
||||
const auto requestId = request(MTPchannels_GetMessages(
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
MTP_vector<MTPInputMessage>(ids)
|
||||
)).done([=](
|
||||
const MTPmessages_Messages &result,
|
||||
@@ -764,7 +764,7 @@ QString ApiWrap::exportDirectMessageLink(
|
||||
MTP_flags(inRepliesContext
|
||||
? MTPchannels_ExportMessageLink::Flag::f_thread
|
||||
: MTPchannels_ExportMessageLink::Flag(0)),
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
MTP_int(item->id)
|
||||
)).done([=](const MTPExportedMessageLink &result) {
|
||||
const auto link = qs(result.data().vlink());
|
||||
@@ -798,7 +798,7 @@ QString ApiWrap::exportDirectStoryLink(not_null<Data::Story*> story) {
|
||||
? i->second
|
||||
: fallback();
|
||||
request(MTPstories_ExportStoryLink(
|
||||
peer->input,
|
||||
peer->input(),
|
||||
MTP_int(story->id())
|
||||
)).done([=](const MTPExportedStoryLink &result) {
|
||||
const auto link = qs(result.data().vlink());
|
||||
@@ -865,7 +865,7 @@ void ApiWrap::requestMoreDialogs(Data::Folder *folder) {
|
||||
MTP_int(state->offsetDate),
|
||||
MTP_int(state->offsetId),
|
||||
(state->offsetPeer
|
||||
? state->offsetPeer->input
|
||||
? state->offsetPeer->input()
|
||||
: MTP_inputPeerEmpty()),
|
||||
MTP_int(loadCount),
|
||||
MTP_long(hash)
|
||||
@@ -1130,7 +1130,7 @@ void ApiWrap::requestFullPeer(not_null<PeerData*> peer) {
|
||||
_session->supportHelper().refreshInfo(user);
|
||||
}
|
||||
return request(MTPusers_GetFullUser(
|
||||
user->inputUser
|
||||
user->inputUser()
|
||||
)).done([=](const MTPusers_UserFull &result) {
|
||||
result.match([&](const MTPDusers_userFull &data) {
|
||||
_session->data().processUsers(data.vusers());
|
||||
@@ -1140,13 +1140,13 @@ void ApiWrap::requestFullPeer(not_null<PeerData*> peer) {
|
||||
}).fail(failHandler).send();
|
||||
} else if (const auto chat = peer->asChat()) {
|
||||
return request(MTPmessages_GetFullChat(
|
||||
chat->inputChat
|
||||
chat->inputChat()
|
||||
)).done([=](const MTPmessages_ChatFull &result) {
|
||||
gotChatFull(peer, result);
|
||||
}).fail(failHandler).send();
|
||||
} else if (const auto channel = peer->asChannel()) {
|
||||
return request(MTPchannels_GetFullChannel(
|
||||
channel->inputChannel
|
||||
channel->inputChannel()
|
||||
)).done([=](const MTPmessages_ChatFull &result) {
|
||||
gotChatFull(peer, result);
|
||||
migrateDone(channel, channel);
|
||||
@@ -1224,7 +1224,7 @@ void ApiWrap::requestPeerSettings(not_null<PeerData*> peer) {
|
||||
return;
|
||||
}
|
||||
request(MTPmessages_GetPeerSettings(
|
||||
peer->input
|
||||
peer->input()
|
||||
)).done([=](const MTPmessages_PeerSettings &result) {
|
||||
result.match([&](const MTPDmessages_peerSettings &data) {
|
||||
_session->data().processUsers(data.vusers());
|
||||
@@ -1279,7 +1279,7 @@ void ApiWrap::migrateChat(
|
||||
}
|
||||
|
||||
request(MTPmessages_MigrateChat(
|
||||
chat->inputChat
|
||||
chat->inputChat()
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
applyUpdates(result);
|
||||
session().changes().sendNotifications();
|
||||
@@ -1351,7 +1351,7 @@ void ApiWrap::markContentsRead(
|
||||
}
|
||||
for (const auto &channelIds : channelMarkedIds) {
|
||||
request(MTPchannels_ReadMessageContents(
|
||||
channelIds.first->inputChannel,
|
||||
channelIds.first->inputChannel(),
|
||||
MTP_vector<MTPint>(channelIds.second)
|
||||
)).send();
|
||||
}
|
||||
@@ -1364,7 +1364,7 @@ void ApiWrap::markContentsRead(not_null<HistoryItem*> item) {
|
||||
const auto ids = MTP_vector<MTPint>(1, MTP_int(item->id));
|
||||
if (const auto channel = item->history()->peer->asChannel()) {
|
||||
request(MTPchannels_ReadMessageContents(
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
ids
|
||||
)).send();
|
||||
} else {
|
||||
@@ -1398,8 +1398,8 @@ void ApiWrap::deleteAllFromParticipantSend(
|
||||
not_null<ChannelData*> channel,
|
||||
not_null<PeerData*> from) {
|
||||
request(MTPchannels_DeleteParticipantHistory(
|
||||
channel->inputChannel,
|
||||
from->input
|
||||
channel->inputChannel(),
|
||||
from->input()
|
||||
)).done([=](const MTPmessages_AffectedHistory &result) {
|
||||
const auto offset = applyAffectedHistory(channel, result);
|
||||
if (offset > 0) {
|
||||
@@ -1421,8 +1421,8 @@ void ApiWrap::deleteSublistHistorySend(
|
||||
not_null<PeerData*> sublistPeer) {
|
||||
request(MTPmessages_DeleteSavedHistory(
|
||||
MTP_flags(MTPmessages_DeleteSavedHistory::Flag::f_parent_peer),
|
||||
parentChat->input,
|
||||
sublistPeer->input,
|
||||
parentChat->input(),
|
||||
sublistPeer->input(),
|
||||
MTP_int(0), // max_id
|
||||
MTP_int(0), // min_date
|
||||
MTP_int(0) // max_date
|
||||
@@ -1743,7 +1743,7 @@ void ApiWrap::joinChannel(not_null<ChannelData*> channel) {
|
||||
Data::PeerUpdate::Flag::ChannelAmIn);
|
||||
} else if (!_channelAmInRequests.contains(channel)) {
|
||||
const auto requestId = request(MTPchannels_JoinChannel(
|
||||
channel->inputChannel
|
||||
channel->inputChannel()
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
_channelAmInRequests.remove(channel);
|
||||
applyUpdates(result);
|
||||
@@ -1800,7 +1800,7 @@ void ApiWrap::leaveChannel(not_null<ChannelData*> channel) {
|
||||
Data::PeerUpdate::Flag::ChannelAmIn);
|
||||
} else if (!_channelAmInRequests.contains(channel)) {
|
||||
auto requestId = request(MTPchannels_LeaveChannel(
|
||||
channel->inputChannel
|
||||
channel->inputChannel()
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
_channelAmInRequests.remove(channel);
|
||||
applyUpdates(result);
|
||||
@@ -1902,7 +1902,7 @@ void ApiWrap::updateNotifySettingsDelayed(
|
||||
}
|
||||
if (_updateNotifyTopics.emplace(topic).second) {
|
||||
topic->destroyed(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
_updateNotifyTopics.remove(topic);
|
||||
}, _updateNotifyQueueLifetime);
|
||||
_updateNotifyTimer.callOnce(kNotifySettingSaveTimeout);
|
||||
@@ -1926,14 +1926,14 @@ void ApiWrap::sendNotifySettingsUpdates() {
|
||||
for (const auto topic : base::take(_updateNotifyTopics)) {
|
||||
request(MTPaccount_UpdateNotifySettings(
|
||||
MTP_inputNotifyForumTopic(
|
||||
topic->peer()->input,
|
||||
topic->peer()->input(),
|
||||
MTP_int(topic->rootId())),
|
||||
topic->notify().serialize()
|
||||
)).afterDelay(kSmallDelayMs).send();
|
||||
}
|
||||
for (const auto peer : base::take(_updateNotifyPeers)) {
|
||||
request(MTPaccount_UpdateNotifySettings(
|
||||
MTP_inputNotifyPeer(peer->input),
|
||||
MTP_inputNotifyPeer(peer->input()),
|
||||
peer->notify().serialize()
|
||||
)).afterDelay(kSmallDelayMs).send();
|
||||
}
|
||||
@@ -2012,8 +2012,8 @@ void ApiWrap::deleteConversation(not_null<PeerData*> peer, bool revoke) {
|
||||
if (const auto chat = peer->asChat()) {
|
||||
request(MTPmessages_DeleteChatUser(
|
||||
MTP_flags(0),
|
||||
chat->inputChat,
|
||||
_session->user()->inputUser
|
||||
chat->inputChat(),
|
||||
_session->user()->inputUser()
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
applyUpdates(result);
|
||||
deleteHistory(peer, false, revoke);
|
||||
@@ -2206,7 +2206,7 @@ void ApiWrap::saveDraftsToCloud() {
|
||||
cloudDraft->saveRequestId = request(MTPmessages_SaveDraft(
|
||||
MTP_flags(flags),
|
||||
ReplyToForMTP(history, cloudDraft->reply),
|
||||
history->peer->input,
|
||||
history->peer->input(),
|
||||
MTP_string(textWithTags.text),
|
||||
entities,
|
||||
Data::WebPageForMTP(
|
||||
@@ -2382,7 +2382,7 @@ void ApiWrap::resolveWebPages() {
|
||||
QVector<mtpRequestId> reqsByIndex(idsByChannel.size(), 0);
|
||||
for (auto i = idsByChannel.cbegin(), e = idsByChannel.cend(); i != e; ++i) {
|
||||
reqsByIndex[i->second.first] = request(MTPchannels_GetMessages(
|
||||
i->first->inputChannel,
|
||||
i->first->inputChannel(),
|
||||
MTP_vector<MTPInputMessage>(i->second.second)
|
||||
)).done([=, channel = i->first](
|
||||
const MTPmessages_Messages &result,
|
||||
@@ -2511,13 +2511,13 @@ void ApiWrap::refreshFileReference(
|
||||
};
|
||||
if (storyId) {
|
||||
request(MTPstories_GetStoriesByID(
|
||||
_session->data().peer(storyId.peer)->input,
|
||||
_session->data().peer(storyId.peer)->input(),
|
||||
MTP_vector<MTPint>(1, MTP_int(storyId.story))));
|
||||
} else if (item->isScheduled()) {
|
||||
const auto realId = _session->scheduledMessages().lookupId(
|
||||
item);
|
||||
request(MTPmessages_GetScheduledMessages(
|
||||
item->history()->peer->input,
|
||||
item->history()->peer->input(),
|
||||
MTP_vector<MTPint>(1, MTP_int(realId))));
|
||||
} else if (item->isSavedMusicItem()) {
|
||||
const auto user = item->history()->peer->asUser();
|
||||
@@ -2525,7 +2525,7 @@ void ApiWrap::refreshFileReference(
|
||||
const auto document = media ? media->document() : nullptr;
|
||||
if (user && document) {
|
||||
request(MTPusers_GetSavedMusicByID(
|
||||
user->inputUser,
|
||||
user->inputUser(),
|
||||
MTP_vector<MTPInputDocument>(1, document->mtpInput())));
|
||||
} else {
|
||||
fail();
|
||||
@@ -2540,7 +2540,7 @@ void ApiWrap::refreshFileReference(
|
||||
MTP_long(0)));
|
||||
} else if (const auto channel = item->history()->peer->asChannel()) {
|
||||
request(MTPchannels_GetMessages(
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
MTP_vector<MTPInputMessage>(
|
||||
1,
|
||||
MTP_inputMessageID(MTP_int(item->id)))));
|
||||
@@ -2556,7 +2556,7 @@ void ApiWrap::refreshFileReference(
|
||||
}, [&](Data::FileOriginUserPhoto data) {
|
||||
if (const auto user = _session->data().user(data.userId)) {
|
||||
request(MTPphotos_GetUserPhotos(
|
||||
user->inputUser,
|
||||
user->inputUser(),
|
||||
MTP_int(-1),
|
||||
MTP_long(data.photoId),
|
||||
MTP_int(1)));
|
||||
@@ -2565,7 +2565,7 @@ void ApiWrap::refreshFileReference(
|
||||
}
|
||||
}, [&](Data::FileOriginFullUser data) {
|
||||
if (const auto user = _session->data().user(data.userId)) {
|
||||
request(MTPusers_GetFullUser(user->inputUser));
|
||||
request(MTPusers_GetFullUser(user->inputUser()));
|
||||
} else {
|
||||
fail();
|
||||
}
|
||||
@@ -2634,7 +2634,7 @@ void ApiWrap::refreshFileReference(
|
||||
MTP_int(0)));
|
||||
}, [&](Data::FileOriginStory data) {
|
||||
request(MTPstories_GetStoriesByID(
|
||||
_session->data().peer(data.peer)->input,
|
||||
_session->data().peer(data.peer)->input(),
|
||||
MTP_vector<MTPint>(1, MTP_int(data.story))));
|
||||
}, [&](v::null_t) {
|
||||
fail();
|
||||
@@ -2704,7 +2704,7 @@ void ApiWrap::setGroupStickerSet(
|
||||
|
||||
megagroup->mgInfo->stickerSet = set;
|
||||
request(MTPchannels_SetStickers(
|
||||
megagroup->inputChannel,
|
||||
megagroup->inputChannel(),
|
||||
Data::InputStickerSet(set)
|
||||
)).send();
|
||||
_session->data().stickers().notifyUpdated(Data::StickersType::Stickers);
|
||||
@@ -2717,7 +2717,7 @@ void ApiWrap::setGroupEmojiSet(
|
||||
|
||||
megagroup->mgInfo->emojiSet = set;
|
||||
request(MTPchannels_SetEmojiStickers(
|
||||
megagroup->inputChannel,
|
||||
megagroup->inputChannel(),
|
||||
Data::InputStickerSet(set)
|
||||
)).send();
|
||||
_session->changes().peerUpdated(
|
||||
@@ -3127,7 +3127,7 @@ void ApiWrap::requestMessageAfterDate(
|
||||
};
|
||||
if (topicRootId) {
|
||||
send(MTPmessages_GetReplies(
|
||||
peer->input,
|
||||
peer->input(),
|
||||
MTP_int(topicRootId),
|
||||
MTP_int(offsetId),
|
||||
MTP_int(offsetDate),
|
||||
@@ -3139,8 +3139,8 @@ void ApiWrap::requestMessageAfterDate(
|
||||
} else if (monoforumPeerId) {
|
||||
send(MTPmessages_GetSavedHistory(
|
||||
MTP_flags(MTPmessages_GetSavedHistory::Flag::f_parent_peer),
|
||||
peer->input,
|
||||
session().data().peer(monoforumPeerId)->input,
|
||||
peer->input(),
|
||||
session().data().peer(monoforumPeerId)->input(),
|
||||
MTP_int(offsetId),
|
||||
MTP_int(offsetDate),
|
||||
MTP_int(addOffset),
|
||||
@@ -3150,7 +3150,7 @@ void ApiWrap::requestMessageAfterDate(
|
||||
MTP_long(historyHash)));
|
||||
} else {
|
||||
send(MTPmessages_GetHistory(
|
||||
peer->input,
|
||||
peer->input(),
|
||||
MTP_int(offsetId),
|
||||
MTP_int(offsetDate),
|
||||
MTP_int(addOffset),
|
||||
@@ -3537,19 +3537,19 @@ void ApiWrap::forwardMessages(
|
||||
histories.sendRequest(history, requestType, [=](Fn<void()> finish) {
|
||||
history->sendRequestId = request(MTPmessages_ForwardMessages(
|
||||
MTP_flags(oneFlags),
|
||||
forwardFrom->input,
|
||||
forwardFrom->input(),
|
||||
MTP_vector<MTPint>(ids),
|
||||
MTP_vector<MTPlong>(randomIds),
|
||||
peer->input,
|
||||
peer->input(),
|
||||
MTP_int(topMsgId),
|
||||
(action.options.suggest
|
||||
? ReplyToForMTP(history, action.replyTo)
|
||||
: monoforumPeer
|
||||
? MTP_inputReplyToMonoForum(monoforumPeer->input)
|
||||
? MTP_inputReplyToMonoForum(monoforumPeer->input())
|
||||
: MTPInputReplyTo()),
|
||||
MTP_int(action.options.scheduled),
|
||||
MTP_int(action.options.scheduleRepeatPeriod),
|
||||
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
|
||||
(sendAs ? sendAs->input() : MTP_inputPeerEmpty()),
|
||||
Data::ShortcutIdToMTP(_session, action.options.shortcutId),
|
||||
MTP_long(action.options.effectId),
|
||||
MTPint(), // video_timestamp
|
||||
@@ -3925,7 +3925,7 @@ void ApiWrap::sendShortcutMessages(
|
||||
auto ids = QVector<MTPint>();
|
||||
auto randomIds = QVector<MTPlong>();
|
||||
request(MTPmessages_SendQuickReplyMessages(
|
||||
peer->input,
|
||||
peer->input(),
|
||||
MTP_int(id),
|
||||
MTP_vector<MTPint>(ids),
|
||||
MTP_vector<MTPlong>(randomIds)
|
||||
@@ -4150,7 +4150,7 @@ void ApiWrap::sendMessage(
|
||||
randomId,
|
||||
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
|
||||
MTP_flags(mediaFlags),
|
||||
peer->input,
|
||||
peer->input(),
|
||||
Data::Histories::ReplyToPlaceholder(),
|
||||
Data::WebPageForMTP(message.webPage, true),
|
||||
msgText,
|
||||
@@ -4159,7 +4159,7 @@ void ApiWrap::sendMessage(
|
||||
sentEntities,
|
||||
MTP_int(action.options.scheduled),
|
||||
MTP_int(action.options.scheduleRepeatPeriod),
|
||||
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
|
||||
(sendAs ? sendAs->input() : MTP_inputPeerEmpty()),
|
||||
mtpShortcut,
|
||||
MTP_long(action.options.effectId),
|
||||
MTP_long(starsPaid),
|
||||
@@ -4172,7 +4172,7 @@ void ApiWrap::sendMessage(
|
||||
randomId,
|
||||
Data::Histories::PrepareMessage<MTPmessages_SendMessage>(
|
||||
MTP_flags(sendFlags),
|
||||
peer->input,
|
||||
peer->input(),
|
||||
Data::Histories::ReplyToPlaceholder(),
|
||||
msgText,
|
||||
MTP_long(randomId),
|
||||
@@ -4180,7 +4180,7 @@ void ApiWrap::sendMessage(
|
||||
sentEntities,
|
||||
MTP_int(action.options.scheduled),
|
||||
MTP_int(action.options.scheduleRepeatPeriod),
|
||||
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
|
||||
(sendAs ? sendAs->input() : MTP_inputPeerEmpty()),
|
||||
mtpShortcut,
|
||||
MTP_long(action.options.effectId),
|
||||
MTP_long(starsPaid),
|
||||
@@ -4224,8 +4224,8 @@ void ApiWrap::sendBotStart(
|
||||
info->startToken = QString();
|
||||
}
|
||||
request(MTPmessages_StartBot(
|
||||
bot->inputUser,
|
||||
chat ? chat->input : MTP_inputPeerEmpty(),
|
||||
bot->inputUser(),
|
||||
chat ? chat->input() : MTP_inputPeerEmpty(),
|
||||
MTP_long(randomId),
|
||||
MTP_string(token)
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
@@ -4320,13 +4320,13 @@ void ApiWrap::sendInlineResult(
|
||||
randomId,
|
||||
Data::Histories::PrepareMessage<MTPmessages_SendInlineBotResult>(
|
||||
MTP_flags(sendFlags),
|
||||
peer->input,
|
||||
peer->input(),
|
||||
Data::Histories::ReplyToPlaceholder(),
|
||||
MTP_long(randomId),
|
||||
MTP_long(data->getQueryId()),
|
||||
MTP_string(data->getId()),
|
||||
MTP_int(action.options.scheduled),
|
||||
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
|
||||
(sendAs ? sendAs->input() : MTP_inputPeerEmpty()),
|
||||
Data::ShortcutIdToMTP(_session, action.options.shortcutId),
|
||||
MTP_long(starsPaid)
|
||||
), [=](const MTPUpdates &result, const MTP::Response &response) {
|
||||
@@ -4361,7 +4361,7 @@ void ApiWrap::uploadAlbumMedia(
|
||||
request(MTPmessages_UploadMedia(
|
||||
MTP_flags(0),
|
||||
MTPstring(), // business_connection_id
|
||||
item->history()->peer->input,
|
||||
item->history()->peer->input(),
|
||||
media
|
||||
)).done([=](const MTPMessageMedia &result) {
|
||||
const auto item = _session->data().message(localId);
|
||||
@@ -4505,7 +4505,7 @@ void ApiWrap::sendMediaWithRandomId(
|
||||
randomId,
|
||||
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
|
||||
MTP_flags(flags),
|
||||
peer->input,
|
||||
peer->input(),
|
||||
Data::Histories::ReplyToPlaceholder(),
|
||||
(options.price
|
||||
? MTPInputMedia(MTP_inputMediaPaidMedia(
|
||||
@@ -4520,7 +4520,7 @@ void ApiWrap::sendMediaWithRandomId(
|
||||
sentEntities,
|
||||
MTP_int(options.scheduled),
|
||||
MTP_int(options.scheduleRepeatPeriod),
|
||||
(options.sendAs ? options.sendAs->input : MTP_inputPeerEmpty()),
|
||||
(options.sendAs ? options.sendAs->input() : MTP_inputPeerEmpty()),
|
||||
Data::ShortcutIdToMTP(_session, options.shortcutId),
|
||||
MTP_long(options.effectId),
|
||||
MTP_long(starsPaid),
|
||||
@@ -4595,7 +4595,7 @@ void ApiWrap::sendMultiPaidMedia(
|
||||
randomId,
|
||||
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
|
||||
MTP_flags(flags),
|
||||
peer->input,
|
||||
peer->input(),
|
||||
Data::Histories::ReplyToPlaceholder(),
|
||||
MTP_inputMediaPaidMedia(
|
||||
MTP_flags(0),
|
||||
@@ -4608,7 +4608,7 @@ void ApiWrap::sendMultiPaidMedia(
|
||||
sentEntities,
|
||||
MTP_int(options.scheduled),
|
||||
MTP_int(options.scheduleRepeatPeriod),
|
||||
(options.sendAs ? options.sendAs->input : MTP_inputPeerEmpty()),
|
||||
(options.sendAs ? options.sendAs->input() : MTP_inputPeerEmpty()),
|
||||
Data::ShortcutIdToMTP(_session, options.shortcutId),
|
||||
MTP_long(options.effectId),
|
||||
MTP_long(starsPaid),
|
||||
@@ -4734,12 +4734,12 @@ void ApiWrap::sendAlbumIfReady(not_null<SendingAlbum*> album) {
|
||||
uint64(0), // randomId
|
||||
Data::Histories::PrepareMessage<MTPmessages_SendMultiMedia>(
|
||||
MTP_flags(flags),
|
||||
peer->input,
|
||||
peer->input(),
|
||||
Data::Histories::ReplyToPlaceholder(),
|
||||
MTP_vector<MTPInputSingleMedia>(medias),
|
||||
MTP_int(album->options.scheduled),
|
||||
//MTP_int(album->options.scheduleRepeatPeriod),
|
||||
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
|
||||
(sendAs ? sendAs->input() : MTP_inputPeerEmpty()),
|
||||
Data::ShortcutIdToMTP(_session, album->options.shortcutId),
|
||||
MTP_long(album->options.effectId),
|
||||
MTP_long(starsPaid)
|
||||
@@ -4776,7 +4776,7 @@ rpl::producer<bool> ApiWrap::contactSignupSilent() const {
|
||||
return _contactSignupSilent
|
||||
? _contactSignupSilentChanges.events_starting_with_copy(
|
||||
*_contactSignupSilent)
|
||||
: (_contactSignupSilentChanges.events() | rpl::type_erased());
|
||||
: (_contactSignupSilentChanges.events() | rpl::type_erased);
|
||||
}
|
||||
|
||||
std::optional<bool> ApiWrap::contactSignupSilentCurrent() const {
|
||||
@@ -4821,7 +4821,7 @@ void ApiWrap::requestBotCommonGroups(
|
||||
};
|
||||
const auto limit = 100;
|
||||
request(MTPmessages_GetCommonChats(
|
||||
bot->inputUser,
|
||||
bot->inputUser(),
|
||||
MTP_long(0), // max_id
|
||||
MTP_int(limit)
|
||||
)).done([=](const MTPmessages_Chats &result) {
|
||||
|
||||
@@ -36,29 +36,28 @@ namespace {
|
||||
rpl::producer<TextWithEntities> Text1() {
|
||||
return tr::lng_about_text1(
|
||||
lt_api_link,
|
||||
tr::lng_about_text1_api(
|
||||
) | Ui::Text::ToLink("https://core.telegram.org/api"),
|
||||
Ui::Text::WithEntities);
|
||||
tr::lng_about_text1_api(tr::url(u"https://core.telegram.org/api"_q)),
|
||||
tr::marked);
|
||||
}
|
||||
|
||||
rpl::producer<TextWithEntities> Text2() {
|
||||
return tr::lng_about_text2(
|
||||
lt_gpl_link,
|
||||
rpl::single(Ui::Text::Link(
|
||||
rpl::single(tr::link(
|
||||
"GNU GPL",
|
||||
"https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE")),
|
||||
lt_github_link,
|
||||
rpl::single(Ui::Text::Link(
|
||||
rpl::single(tr::link(
|
||||
"GitHub",
|
||||
"https://github.com/telegramdesktop/tdesktop")),
|
||||
Ui::Text::WithEntities);
|
||||
tr::marked);
|
||||
}
|
||||
|
||||
rpl::producer<TextWithEntities> Text3() {
|
||||
return tr::lng_about_text3(
|
||||
lt_faq_link,
|
||||
tr::lng_about_text3_faq() | Ui::Text::ToLink(telegramFaqLink()),
|
||||
Ui::Text::WithEntities);
|
||||
tr::lng_about_text3_faq(tr::url(telegramFaqLink())),
|
||||
tr::marked);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -186,7 +185,7 @@ void ArchiveHintBox(
|
||||
owned->setNaturalWidth(rect.width());
|
||||
const auto widget = box->addRow(std::move(owned), style::al_top);
|
||||
widget->paintRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
auto p = Painter(widget);
|
||||
auto hq = PainterHighQualityEnabler(p);
|
||||
p.setPen(Qt::NoPen);
|
||||
@@ -217,11 +216,11 @@ void ArchiveHintBox(
|
||||
lt_emoji,
|
||||
rpl::single(
|
||||
Ui::Text::IconEmoji(&st::textMoreIconEmoji)),
|
||||
Ui::Text::RichLangValue
|
||||
tr::rich
|
||||
) | rpl::map([](TextWithEntities text) {
|
||||
return Ui::Text::Link(std::move(text), 1);
|
||||
return tr::link(std::move(text), 1);
|
||||
}),
|
||||
Ui::Text::RichLangValue),
|
||||
tr::rich),
|
||||
st::channelEarnHistoryRecipientLabel));
|
||||
label->resizeToWidth(box->width()
|
||||
- rect::m::sum::h(st::boxRowPadding));
|
||||
@@ -263,13 +262,13 @@ void ArchiveHintBox(
|
||||
const auto left = Ui::CreateChild<Ui::RpWidget>(
|
||||
box->verticalLayout().get());
|
||||
left->paintRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
auto p = Painter(left);
|
||||
icon.paint(p, 0, 0, left->width());
|
||||
}, left->lifetime());
|
||||
left->resize(icon.size());
|
||||
top->geometryValue(
|
||||
) | rpl::start_with_next([=](const QRect &g) {
|
||||
) | rpl::on_next([=](const QRect &g) {
|
||||
left->moveToLeft(
|
||||
(g.left() - left->width()) / 2,
|
||||
g.top() + st::channelEarnHistoryThreeSkip);
|
||||
|
||||
@@ -42,7 +42,7 @@ void AboutSponsoredBox(not_null<Ui::GenericBox*> box) {
|
||||
rpl::combine(
|
||||
row->sizeValue(),
|
||||
button->sizeValue()
|
||||
) | rpl::start_with_next([=](
|
||||
) | rpl::on_next([=](
|
||||
const QSize &rowSize,
|
||||
const QSize &buttonSize) {
|
||||
button->moveToLeft(
|
||||
@@ -61,9 +61,9 @@ void AboutSponsoredBox(not_null<Ui::GenericBox*> box) {
|
||||
tr::lng_sponsored_info_description1_link(),
|
||||
tr::lng_sponsored_info_description1_url()
|
||||
) | rpl::map([](const QString &text, const QString &url) {
|
||||
return Ui::Text::Link(text, url);
|
||||
return tr::link(text, url);
|
||||
}),
|
||||
Ui::Text::RichLangValue);
|
||||
tr::rich);
|
||||
box->addRow(object_ptr<FlatLabel>(box, std::move(text1), stLabel));
|
||||
|
||||
box->addSkip(st::sponsoredUrlButtonSkip);
|
||||
|
||||
@@ -126,7 +126,7 @@ void ChatCreateDone(
|
||||
void MustBePublicDestroy(not_null<ChannelData*> channel) {
|
||||
const auto session = &channel->session();
|
||||
session->api().request(MTPchannels_DeleteChannel(
|
||||
channel->inputChannel
|
||||
channel->inputChannel()
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
session->api().applyUpdates(result);
|
||||
}).send();
|
||||
@@ -160,7 +160,7 @@ void MustBePublicFailed(
|
||||
TextWithEntities PeerFloodErrorText(
|
||||
not_null<Main::Session*> session,
|
||||
PeerFloodType type) {
|
||||
const auto link = Ui::Text::Link(
|
||||
const auto link = tr::link(
|
||||
tr::lng_cant_more_info(tr::now),
|
||||
session->createInternalLinkFull(u"spambot"_q));
|
||||
return ((type == PeerFloodType::InviteGroup)
|
||||
@@ -169,7 +169,7 @@ TextWithEntities PeerFloodErrorText(
|
||||
tr::now,
|
||||
lt_more_info,
|
||||
link,
|
||||
Ui::Text::WithEntities);
|
||||
tr::marked);
|
||||
}
|
||||
|
||||
void ShowAddParticipantsError(
|
||||
@@ -324,9 +324,9 @@ void AddContactBox::prepare() {
|
||||
|
||||
const auto submitted = [=] { submit(); };
|
||||
_first->submits(
|
||||
) | rpl::start_with_next(submitted, _first->lifetime());
|
||||
) | rpl::on_next(submitted, _first->lifetime());
|
||||
_last->submits(
|
||||
) | rpl::start_with_next(submitted, _last->lifetime());
|
||||
) | rpl::on_next(submitted, _last->lifetime());
|
||||
connect(_phone, &Ui::PhoneInput::submitted, [=] { submit(); });
|
||||
|
||||
setDimensions(
|
||||
@@ -598,13 +598,13 @@ void GroupInfoBox::prepare() {
|
||||
Core::App().settings().sendSubmitWay());
|
||||
|
||||
_description->heightChanges(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
descriptionResized();
|
||||
}, _description->lifetime());
|
||||
_description->submits(
|
||||
) | rpl::start_with_next([=] { submit(); }, _description->lifetime());
|
||||
) | rpl::on_next([=] { submit(); }, _description->lifetime());
|
||||
_description->cancelled(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
closeBox();
|
||||
}, _description->lifetime());
|
||||
|
||||
@@ -614,7 +614,7 @@ void GroupInfoBox::prepare() {
|
||||
&_navigation->session());
|
||||
}
|
||||
_title->submits(
|
||||
) | rpl::start_with_next([=] { submitName(); }, _title->lifetime());
|
||||
) | rpl::on_next([=] { submitName(); }, _title->lifetime());
|
||||
|
||||
addButton(
|
||||
((_type != Type::Group || _canAddBot)
|
||||
@@ -735,7 +735,7 @@ void GroupInfoBox::createGroup(
|
||||
auto user = peer->asUser();
|
||||
Assert(user != nullptr);
|
||||
if (!user->isSelf()) {
|
||||
inputs.push_back(user->inputUser);
|
||||
inputs.push_back(user->inputUser());
|
||||
}
|
||||
}
|
||||
_creationRequestId = _api.request(MTPmessages_CreateChat(
|
||||
@@ -920,7 +920,7 @@ void GroupInfoBox::checkInviteLink() {
|
||||
_createdChannel->session().changes().peerUpdates(
|
||||
_createdChannel,
|
||||
Data::PeerUpdate::Flag::FullInfo
|
||||
) | rpl::take(1) | rpl::start_with_next([=] {
|
||||
) | rpl::take(1) | rpl::on_next([=] {
|
||||
checkInviteLink();
|
||||
}, lifetime());
|
||||
}
|
||||
@@ -1034,7 +1034,7 @@ void SetupChannelBox::prepare() {
|
||||
setMouseTracking(true);
|
||||
|
||||
_checkRequestId = _api.request(MTPchannels_CheckUsername(
|
||||
_channel->inputChannel,
|
||||
_channel->inputChannel(),
|
||||
MTP_string("preston")
|
||||
)).fail([=](const MTP::Error &error) {
|
||||
_checkRequestId = 0;
|
||||
@@ -1063,11 +1063,11 @@ void SetupChannelBox::prepare() {
|
||||
_channel->session().changes().peerUpdates(
|
||||
_channel,
|
||||
Data::PeerUpdate::Flag::InviteLinks
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
rtlupdate(_invitationLink);
|
||||
}, lifetime());
|
||||
|
||||
boxClosing() | rpl::start_with_next([=] {
|
||||
boxClosing() | rpl::on_next([=] {
|
||||
if (!_mustBePublic) {
|
||||
AddParticipantsBoxController::Start(_navigation, _channel);
|
||||
}
|
||||
@@ -1281,7 +1281,7 @@ void SetupChannelBox::save() {
|
||||
const auto saveUsername = [&](const QString &link) {
|
||||
_sentUsername = link;
|
||||
_saveRequestId = _api.request(MTPchannels_UpdateUsername(
|
||||
_channel->inputChannel,
|
||||
_channel->inputChannel(),
|
||||
MTP_string(_sentUsername)
|
||||
)).done([=] {
|
||||
const auto done = _done;
|
||||
@@ -1365,7 +1365,7 @@ void SetupChannelBox::check() {
|
||||
if (link.size() >= Ui::EditPeer::kMinUsernameLength) {
|
||||
_checkUsername = link;
|
||||
_checkRequestId = _api.request(MTPchannels_CheckUsername(
|
||||
_channel->inputChannel,
|
||||
_channel->inputChannel(),
|
||||
MTP_string(link)
|
||||
)).done([=](const MTPBool &result) {
|
||||
_checkRequestId = 0;
|
||||
@@ -1495,7 +1495,7 @@ void SetupChannelBox::showRevokePublicLinkBoxForEdit() {
|
||||
Box(PublicLinksLimitBox, navigation, callback));
|
||||
const auto session = &navigation->session();
|
||||
revoker->boxClosing(
|
||||
) | rpl::start_with_next(crl::guard(session, [=] {
|
||||
) | rpl::on_next(crl::guard(session, [=] {
|
||||
base::call_delayed(200, session, [=] {
|
||||
if (*revoked) {
|
||||
return;
|
||||
@@ -1563,19 +1563,19 @@ void EditNameBox::prepare() {
|
||||
_last->setMaxLength(Ui::EditPeer::kMaxUserFirstLastName);
|
||||
|
||||
_first->submits(
|
||||
) | rpl::start_with_next([=] { submit(); }, _first->lifetime());
|
||||
) | rpl::on_next([=] { submit(); }, _first->lifetime());
|
||||
_last->submits(
|
||||
) | rpl::start_with_next([=] { submit(); }, _last->lifetime());
|
||||
) | rpl::on_next([=] { submit(); }, _last->lifetime());
|
||||
|
||||
_first->customTab(true);
|
||||
_last->customTab(true);
|
||||
|
||||
_first->tabbed(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
_last->setFocus();
|
||||
}, _first->lifetime());
|
||||
_last->tabbed(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
_first->setFocus();
|
||||
}, _last->lifetime());
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ void AutoDownloadBox::setupContent() {
|
||||
))->toggleOn(
|
||||
rpl::single(value > 0)
|
||||
)->toggledChanges(
|
||||
) | rpl::start_with_next([=](bool enabled) {
|
||||
) | rpl::on_next([=](bool enabled) {
|
||||
(*values)[type] = enabled ? 1 : 0;
|
||||
}, content->lifetime());
|
||||
values->emplace(type, value);
|
||||
|
||||
@@ -102,7 +102,7 @@ void AutoLockBox::prepare() {
|
||||
};
|
||||
|
||||
timeInput->focuses(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
group->setValue(kCustom);
|
||||
}, lifetime());
|
||||
|
||||
@@ -119,7 +119,7 @@ void AutoLockBox::prepare() {
|
||||
[=] { return group->current() == kCustom; }
|
||||
),
|
||||
timeInput->submitRequests()
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
if (const auto result = collect()) {
|
||||
durationChanged(result);
|
||||
} else {
|
||||
|
||||
@@ -211,12 +211,12 @@ void BackgroundBox::prepare() {
|
||||
setInnerTopSkip(st::lineWidth);
|
||||
|
||||
_inner->chooseEvents(
|
||||
) | rpl::start_with_next([=](const Data::WallPaper &paper) {
|
||||
) | rpl::on_next([=](const Data::WallPaper &paper) {
|
||||
chosen(paper);
|
||||
}, _inner->lifetime());
|
||||
|
||||
_inner->removeRequests(
|
||||
) | rpl::start_with_next([=](const Data::WallPaper &paper) {
|
||||
) | rpl::on_next([=](const Data::WallPaper &paper) {
|
||||
removePaper(paper);
|
||||
}, _inner->lifetime());
|
||||
}
|
||||
@@ -337,7 +337,7 @@ void BackgroundBox::resetForPeer() {
|
||||
const auto api = &_controller->session().api();
|
||||
api->request(MTPmessages_SetChatWallPaper(
|
||||
MTP_flags(0),
|
||||
_forPeer->input,
|
||||
_forPeer->input(),
|
||||
MTPInputWallPaper(),
|
||||
MTPWallPaperSettings(),
|
||||
MTPint()
|
||||
@@ -396,30 +396,30 @@ BackgroundBox::Inner::Inner(
|
||||
+ st::backgroundPadding));
|
||||
|
||||
Window::Theme::IsNightModeValue(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
updatePapers();
|
||||
}, lifetime());
|
||||
requestPapers();
|
||||
|
||||
_session->downloaderTaskFinished(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
update();
|
||||
}, lifetime());
|
||||
|
||||
style::PaletteChanged(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
_check->invalidateCache();
|
||||
}, lifetime());
|
||||
|
||||
if (forChannel()) {
|
||||
_session->data().cloudThemes().chatThemesUpdated(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
updatePapers();
|
||||
}, lifetime());
|
||||
} else {
|
||||
using Update = Window::Theme::BackgroundUpdate;
|
||||
Window::Theme::Background()->updates(
|
||||
) | rpl::start_with_next([=](const Update &update) {
|
||||
) | rpl::on_next([=](const Update &update) {
|
||||
if (update.type == Update::Type::New) {
|
||||
sortPapers();
|
||||
requestPapers();
|
||||
|
||||
@@ -225,18 +225,18 @@ BackgroundPreviewBox::BackgroundPreviewBox(
|
||||
}
|
||||
generateBackground();
|
||||
_controller->session().downloaderTaskFinished(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
update();
|
||||
}, lifetime());
|
||||
|
||||
_appNightMode.changes(
|
||||
) | rpl::start_with_next([=](bool night) {
|
||||
) | rpl::on_next([=](bool night) {
|
||||
_boxDarkMode = night;
|
||||
update();
|
||||
}, lifetime());
|
||||
|
||||
_boxDarkMode.changes(
|
||||
) | rpl::start_with_next([=](bool dark) {
|
||||
) | rpl::on_next([=](bool dark) {
|
||||
applyDarkMode(dark);
|
||||
}, lifetime());
|
||||
|
||||
@@ -373,7 +373,7 @@ void BackgroundPreviewBox::createDimmingSlider(bool dark) {
|
||||
_dimmingContent->resize(inner->size());
|
||||
|
||||
_dimmingContent->paintRequest(
|
||||
) | rpl::start_with_next([=](QRect clip) {
|
||||
) | rpl::on_next([=](QRect clip) {
|
||||
auto p = QPainter(_dimmingContent);
|
||||
const auto palette = (dark ? _darkPalette : _lightPalette).get();
|
||||
p.fillRect(clip, equals ? st::boxBg : palette->boxBg());
|
||||
@@ -386,13 +386,13 @@ void BackgroundPreviewBox::createDimmingSlider(bool dark) {
|
||||
heightValue(),
|
||||
_dimmingWrap->heightValue(),
|
||||
rpl::mappers::_1 - rpl::mappers::_2
|
||||
) | rpl::start_with_next([=](int top) {
|
||||
) | rpl::on_next([=](int top) {
|
||||
_dimmingWrap->move(0, top);
|
||||
}, _dimmingWrap->lifetime());
|
||||
|
||||
_dimmingWrap->toggle(dark, anim::type::instant);
|
||||
_dimmingHeight = _dimmingWrap->heightValue();
|
||||
_dimmingHeight.changes() | rpl::start_with_next([=] {
|
||||
_dimmingHeight.changes() | rpl::on_next([=] {
|
||||
update();
|
||||
}, _dimmingWrap->lifetime());
|
||||
}
|
||||
@@ -554,7 +554,7 @@ void BackgroundPreviewBox::recreateBlurCheckbox() {
|
||||
sizeValue(),
|
||||
_blur->sizeValue(),
|
||||
_dimmingHeight.value()
|
||||
) | rpl::start_with_next([=](QSize outer, QSize inner, int dimming) {
|
||||
) | rpl::on_next([=](QSize outer, QSize inner, int dimming) {
|
||||
const auto bottom = st::historyPaddingBottom;
|
||||
_blur->move(
|
||||
(outer.width() - inner.width()) / 2,
|
||||
@@ -562,7 +562,7 @@ void BackgroundPreviewBox::recreateBlurCheckbox() {
|
||||
}, _blur->lifetime());
|
||||
|
||||
_blur->checkedChanges(
|
||||
) | rpl::start_with_next([=](bool checked) {
|
||||
) | rpl::on_next([=](bool checked) {
|
||||
checkBlurAnimationStart();
|
||||
update();
|
||||
}, _blur->lifetime());
|
||||
@@ -607,7 +607,7 @@ void BackgroundPreviewBox::uploadForPeer(bool both) {
|
||||
document->size);
|
||||
|
||||
session->uploader().documentProgress(
|
||||
) | rpl::start_with_next([=](const FullMsgId &fullId) {
|
||||
) | rpl::on_next([=](const FullMsgId &fullId) {
|
||||
if (fullId != _uploadId) {
|
||||
return;
|
||||
}
|
||||
@@ -619,7 +619,7 @@ void BackgroundPreviewBox::uploadForPeer(bool both) {
|
||||
}, _uploadLifetime);
|
||||
|
||||
session->uploader().documentReady(
|
||||
) | rpl::start_with_next([=](const Storage::UploadedMedia &data) {
|
||||
) | rpl::on_next([=](const Storage::UploadedMedia &data) {
|
||||
if (data.fullId != _uploadId) {
|
||||
return;
|
||||
}
|
||||
@@ -668,7 +668,7 @@ void BackgroundPreviewBox::setExistingForPeer(
|
||||
| (_fromMessageId ? Flag() : Flag::f_wallpaper)
|
||||
| (both ? Flag::f_for_both : Flag())
|
||||
| Flag::f_settings),
|
||||
_forPeer->input,
|
||||
_forPeer->input(),
|
||||
paper.mtpInput(&_controller->session()),
|
||||
paper.mtpSettings(),
|
||||
MTP_int(_fromMessageId.msg)
|
||||
@@ -742,13 +742,13 @@ void BackgroundPreviewBox::applyForPeer() {
|
||||
object_ptr<Ui::RpWidget>(this));
|
||||
const auto overlay = _forBothOverlay->entity();
|
||||
|
||||
sizeValue() | rpl::start_with_next([=](QSize size) {
|
||||
sizeValue() | rpl::on_next([=](QSize size) {
|
||||
_forBothOverlay->setGeometry({ QPoint(), size });
|
||||
overlay->setGeometry({ QPoint(), size });
|
||||
}, _forBothOverlay->lifetime());
|
||||
|
||||
overlay->paintRequest(
|
||||
) | rpl::start_with_next([=](QRect clip) {
|
||||
) | rpl::on_next([=](QRect clip) {
|
||||
auto p = QPainter(overlay);
|
||||
p.drawImage(0, 0, bg);
|
||||
p.fillRect(clip, QColor(0, 0, 0, 64));
|
||||
@@ -787,7 +787,7 @@ void BackgroundPreviewBox::applyForPeer() {
|
||||
const auto raw = _forBothOverlay.release();
|
||||
raw->shownValue() | rpl::filter(
|
||||
!rpl::mappers::_1
|
||||
) | rpl::take(1) | rpl::start_with_next(crl::guard(raw, [=] {
|
||||
) | rpl::take(1) | rpl::on_next(crl::guard(raw, [=] {
|
||||
delete raw;
|
||||
}), raw->lifetime());
|
||||
raw->toggle(false, anim::type::normal);
|
||||
@@ -797,7 +797,7 @@ void BackgroundPreviewBox::applyForPeer() {
|
||||
cancel->setTextTransform(RoundButton::TextTransform::NoTransform);
|
||||
|
||||
overlay->sizeValue(
|
||||
) | rpl::start_with_next([=](QSize size) {
|
||||
) | rpl::on_next([=](QSize size) {
|
||||
const auto padding = st::backgroundConfirmPadding;
|
||||
const auto width = size.width()
|
||||
- padding.left()
|
||||
@@ -1063,7 +1063,7 @@ void BackgroundPreviewBox::updateServiceBg(const std::vector<QColor> &bg) {
|
||||
}
|
||||
|
||||
_serviceBgLifetime = _paletteServiceBg.value(
|
||||
) | rpl::start_with_next([=](QColor color) {
|
||||
) | rpl::on_next([=](QColor color) {
|
||||
_serviceBg = Ui::ThemeAdjustedColor(
|
||||
color,
|
||||
QColor(red / count, green / count, blue / count));
|
||||
|
||||
@@ -22,7 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/filter_icons.h"
|
||||
#include "ui/painter.h"
|
||||
#include "ui/rect.h"
|
||||
#include "ui/text/text_utilities.h" // Ui::Text::Bold
|
||||
#include "ui/text/text_utilities.h" // tr::bold
|
||||
#include "ui/toast/toast.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/menu/menu_action.h"
|
||||
@@ -99,7 +99,8 @@ protected:
|
||||
p.drawImage(
|
||||
width()
|
||||
- size.width()
|
||||
- st::menuWithIcons.itemPadding.right(),
|
||||
- st::menuWithIcons.itemPadding.right()
|
||||
- st::popupMenuWithIcons.shadow.extend.right(),
|
||||
(height() - size.height()) / 2,
|
||||
_icon);
|
||||
}
|
||||
@@ -178,10 +179,10 @@ void ChangeFilterById(
|
||||
: tr::lng_filters_toast_remove)(
|
||||
tr::now,
|
||||
lt_chat,
|
||||
Ui::Text::Bold(chat),
|
||||
tr::bold(chat),
|
||||
lt_folder,
|
||||
Ui::Text::Wrapped(name.text, EntityType::Bold),
|
||||
Ui::Text::WithEntities),
|
||||
tr::marked),
|
||||
.textContext = Core::TextContext({
|
||||
.session = &history->session(),
|
||||
.customEmojiLoopLimit = isStatic ? -1 : 0,
|
||||
@@ -344,7 +345,7 @@ void FillChooseFilterMenu(
|
||||
}
|
||||
|
||||
history->owner().chatsFilters().changed(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
menu->hideMenu();
|
||||
}, menu->lifetime());
|
||||
}
|
||||
|
||||
@@ -485,7 +485,7 @@ void ProxyRow::updateFields(View &&view) {
|
||||
TextWithEntities()
|
||||
.append(_view.type)
|
||||
.append(' ')
|
||||
.append(Ui::Text::Link(endpoint, QString())),
|
||||
.append(tr::link(endpoint, QString())),
|
||||
Ui::ItemTextDefaultOptions());
|
||||
|
||||
const auto state = _view.state;
|
||||
@@ -754,7 +754,7 @@ ProxiesBox::ProxiesBox(
|
||||
, _settings(settings)
|
||||
, _initialWrap(this) {
|
||||
_controller->views(
|
||||
) | rpl::start_with_next([=](View &&view) {
|
||||
) | rpl::on_next([=](View &&view) {
|
||||
applyView(std::move(view));
|
||||
}, lifetime());
|
||||
}
|
||||
@@ -796,12 +796,14 @@ void ProxiesBox::setupTopButton() {
|
||||
.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,
|
||||
});
|
||||
if (!_rows.empty()) {
|
||||
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;
|
||||
});
|
||||
@@ -881,17 +883,17 @@ void ProxiesBox::setupContent() {
|
||||
refreshProxyForCalls();
|
||||
});
|
||||
_tryIPv6->checkedChanges(
|
||||
) | rpl::start_with_next([=](bool checked) {
|
||||
) | rpl::on_next([=](bool checked) {
|
||||
_controller->setTryIPv6(checked);
|
||||
}, _tryIPv6->lifetime());
|
||||
|
||||
_controller->proxySettingsValue(
|
||||
) | rpl::start_with_next([=](ProxyData::Settings value) {
|
||||
) | rpl::on_next([=](ProxyData::Settings value) {
|
||||
_proxySettings->setValue(value);
|
||||
}, inner->lifetime());
|
||||
|
||||
_proxyForCalls->entity()->checkedChanges(
|
||||
) | rpl::start_with_next([=](bool checked) {
|
||||
) | rpl::on_next([=](bool checked) {
|
||||
_controller->setProxyForCalls(checked);
|
||||
}, _proxyForCalls->lifetime());
|
||||
|
||||
@@ -928,7 +930,7 @@ void ProxiesBox::setupContent() {
|
||||
+ 3 * rowHeight()),
|
||||
st::boxMaxListHeight);
|
||||
}) | rpl::distinct_until_changed(
|
||||
) | rpl::start_with_next([=](int height) {
|
||||
) | rpl::on_next([=](int height) {
|
||||
setDimensions(st::boxWideWidth, height);
|
||||
}, inner->lifetime());
|
||||
}
|
||||
@@ -1003,7 +1005,7 @@ void ProxiesBox::createNoRowsLabel() {
|
||||
tr::lng_proxy_description(tr::now),
|
||||
st::proxyEmptyListLabel);
|
||||
_noRows->widthValue(
|
||||
) | rpl::start_with_next([=](int width) {
|
||||
) | rpl::on_next([=](int width) {
|
||||
label->resizeToWidth(width);
|
||||
label->moveToLeft(0, 0);
|
||||
}, label->lifetime());
|
||||
@@ -1011,29 +1013,29 @@ void ProxiesBox::createNoRowsLabel() {
|
||||
|
||||
void ProxiesBox::setupButtons(int id, not_null<ProxyRow*> button) {
|
||||
button->deleteClicks(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
_controller->deleteItem(id);
|
||||
}, button->lifetime());
|
||||
|
||||
button->restoreClicks(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
_controller->restoreItem(id);
|
||||
}, button->lifetime());
|
||||
|
||||
button->editClicks(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
getDelegate()->show(_controller->editItemBox(id));
|
||||
}, button->lifetime());
|
||||
|
||||
rpl::merge(
|
||||
button->shareClicks() | rpl::map_to(false),
|
||||
button->showQrClicks() | rpl::map_to(true)
|
||||
) | rpl::start_with_next([=](bool qr) {
|
||||
) | rpl::on_next([=](bool qr) {
|
||||
_controller->shareItem(id, qr);
|
||||
}, button->lifetime());
|
||||
|
||||
button->clicks(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
_controller->applyItem(id);
|
||||
}, button->lifetime());
|
||||
}
|
||||
@@ -1069,7 +1071,7 @@ void ProxyBox::prepare() {
|
||||
});
|
||||
});
|
||||
_port.data()->events(
|
||||
) | rpl::start_with_next([=](not_null<QEvent*> e) {
|
||||
) | rpl::on_next([=](not_null<QEvent*> e) {
|
||||
if (e->type() == QEvent::KeyPress
|
||||
&& (static_cast<QKeyEvent*>(e.get())->key() == Qt::Key_Backspace)
|
||||
&& _port->cursorPosition() == 0) {
|
||||
@@ -1179,7 +1181,7 @@ void ProxyBox::setupSocketAddress(const ProxyData &data) {
|
||||
data.port ? QString::number(data.port) : QString(),
|
||||
65535);
|
||||
address->widthValue(
|
||||
) | rpl::start_with_next([=](int width) {
|
||||
) | rpl::on_next([=](int width) {
|
||||
_port->moveToRight(0, 0);
|
||||
_host->resize(
|
||||
width - _port->width() - st::proxyEditSkip,
|
||||
@@ -1211,11 +1213,11 @@ void ProxyBox::setupCredentials(const ProxyData &data) {
|
||||
(data.type == Type::Mtproto) ? QString() : data.password);
|
||||
_password->move(0, 0);
|
||||
_password->heightValue(
|
||||
) | rpl::start_with_next([=, wrap = passwordWrap.data()](int height) {
|
||||
) | rpl::on_next([=, wrap = passwordWrap.data()](int height) {
|
||||
wrap->resize(wrap->width(), height);
|
||||
}, _password->lifetime());
|
||||
passwordWrap->widthValue(
|
||||
) | rpl::start_with_next([=](int width) {
|
||||
) | rpl::on_next([=](int width) {
|
||||
_password->resize(width, _password->height());
|
||||
}, _password->lifetime());
|
||||
credentials->add(std::move(passwordWrap), st::proxyEditInputPadding);
|
||||
@@ -1237,11 +1239,11 @@ void ProxyBox::setupMtprotoCredentials(const ProxyData &data) {
|
||||
(data.type == Type::Mtproto) ? data.password : QString());
|
||||
_secret->move(0, 0);
|
||||
_secret->heightValue(
|
||||
) | rpl::start_with_next([=, wrap = secretWrap.data()](int height) {
|
||||
) | rpl::on_next([=, wrap = secretWrap.data()](int height) {
|
||||
wrap->resize(wrap->width(), height);
|
||||
}, _secret->lifetime());
|
||||
secretWrap->widthValue(
|
||||
) | rpl::start_with_next([=](int width) {
|
||||
) | rpl::on_next([=](int width) {
|
||||
_secret->resize(width, _secret->height());
|
||||
}, _secret->lifetime());
|
||||
mtproto->add(std::move(secretWrap), st::proxyEditInputPadding);
|
||||
@@ -1303,7 +1305,7 @@ ProxiesBoxController::ProxiesBoxController(not_null<Main::Account*> account)
|
||||
}) | ranges::to_vector;
|
||||
|
||||
_settings.connectionTypeChanges(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
_proxySettingsChanges.fire_copy(_settings.settings());
|
||||
const auto i = findByProxy(_settings.selected());
|
||||
if (i != end(_list)) {
|
||||
|
||||
@@ -198,7 +198,7 @@ not_null<Ui::FlatLabel*> CreateWarningLabel(
|
||||
st::createPollWarning);
|
||||
result->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
field->changes(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
Ui::PostponeCall(crl::guard(field, [=] {
|
||||
const auto length = field->getLastText().size();
|
||||
const auto value = valueLimit - length;
|
||||
@@ -251,17 +251,17 @@ Options::Option::Option(
|
||||
_wrap->hide(anim::type::instant);
|
||||
|
||||
_content->widthValue(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
updateFieldGeometry();
|
||||
}, _field->lifetime());
|
||||
|
||||
_field->heightValue(
|
||||
) | rpl::start_with_next([=](int height) {
|
||||
) | rpl::on_next([=](int height) {
|
||||
_content->resize(_content->width(), height);
|
||||
}, _field->lifetime());
|
||||
|
||||
_field->changes(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
Ui::PostponeCall(crl::guard(_field, [=] {
|
||||
if (_hasCorrect) {
|
||||
_correct->toggle(isGood(), anim::type::normal);
|
||||
@@ -293,7 +293,7 @@ void Options::Option::createShadow() {
|
||||
_shadow.reset(Ui::CreateChild<Ui::PlainShadow>(field().get()));
|
||||
_shadow->show();
|
||||
field()->sizeValue(
|
||||
) | rpl::start_with_next([=](QSize size) {
|
||||
) | rpl::on_next([=](QSize size) {
|
||||
const auto left = st::createPollFieldPadding.left();
|
||||
_shadow->setGeometry(
|
||||
left,
|
||||
@@ -322,7 +322,7 @@ void Options::Option::createRemove() {
|
||||
_removeAlways = lifetime.make_state<rpl::variable<bool>>(false);
|
||||
|
||||
field->changes(
|
||||
) | rpl::start_with_next([field, toggle] {
|
||||
) | rpl::on_next([field, toggle] {
|
||||
// Don't capture 'this'! Because Option is a value type.
|
||||
*toggle = !field->getLastText().isEmpty();
|
||||
}, field->lifetime());
|
||||
@@ -331,13 +331,13 @@ void Options::Option::createRemove() {
|
||||
toggle->value(),
|
||||
_removeAlways->value(),
|
||||
_1 || _2
|
||||
) | rpl::start_with_next([=](bool shown) {
|
||||
) | rpl::on_next([=](bool shown) {
|
||||
remove->toggle(shown, anim::type::normal);
|
||||
}, remove->lifetime());
|
||||
#endif
|
||||
|
||||
field->widthValue(
|
||||
) | rpl::start_with_next([=](int width) {
|
||||
) | rpl::on_next([=](int width) {
|
||||
remove->moveToRight(
|
||||
st::createPollOptionRemovePosition.x(),
|
||||
st::createPollOptionRemovePosition.y(),
|
||||
@@ -359,7 +359,7 @@ void Options::Option::createWarning() {
|
||||
rpl::combine(
|
||||
field->sizeValue(),
|
||||
warning->sizeValue()
|
||||
) | rpl::start_with_next([=](QSize size, QSize label) {
|
||||
) | rpl::on_next([=](QSize size, QSize label) {
|
||||
warning->moveToLeft(
|
||||
(size.width()
|
||||
- label.width()
|
||||
@@ -431,7 +431,7 @@ void Options::Option::enableChooseCorrect(
|
||||
button->entity()->height());
|
||||
button->hide(anim::type::instant);
|
||||
_content->sizeValue(
|
||||
) | rpl::start_with_next([=](QSize size) {
|
||||
) | rpl::on_next([=](QSize size) {
|
||||
const auto left = st::createPollFieldPadding.left();
|
||||
button->moveToLeft(
|
||||
left,
|
||||
@@ -688,19 +688,19 @@ void Options::addEmptyOption() {
|
||||
QPoint(
|
||||
-st::createPollOptionFieldPremium.textMargins.right(),
|
||||
st::createPollOptionEmojiPositionSkip));
|
||||
emojiToggle->shownValue() | rpl::start_with_next([=](bool shown) {
|
||||
emojiToggle->shownValue() | rpl::on_next([=](bool shown) {
|
||||
if (!shown) {
|
||||
return;
|
||||
}
|
||||
_emojiPanelLifetime.destroy();
|
||||
emojiPanel->selector()->emojiChosen(
|
||||
) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) {
|
||||
) | rpl::on_next([=](ChatHelpers::EmojiChosen data) {
|
||||
if (field->hasFocus()) {
|
||||
Ui::InsertEmojiAtCursor(field->textCursor(), data.emoji);
|
||||
}
|
||||
}, _emojiPanelLifetime);
|
||||
emojiPanel->selector()->customEmojiChosen(
|
||||
) | rpl::start_with_next([=](ChatHelpers::FileChosen data) {
|
||||
) | rpl::on_next([=](ChatHelpers::FileChosen data) {
|
||||
if (field->hasFocus()) {
|
||||
Data::InsertCustomEmoji(field, data.document);
|
||||
}
|
||||
@@ -708,24 +708,24 @@ void Options::addEmptyOption() {
|
||||
}, emojiToggle->lifetime());
|
||||
}
|
||||
field->submits(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
const auto index = findField(field);
|
||||
if (_list[index]->isGood() && index + 1 < _list.size()) {
|
||||
_list[index + 1]->setFocus();
|
||||
}
|
||||
}, field->lifetime());
|
||||
field->changes(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
Ui::PostponeCall(crl::guard(field, [=] {
|
||||
validateState();
|
||||
}));
|
||||
}, field->lifetime());
|
||||
field->focusedChanges(
|
||||
) | rpl::filter(rpl::mappers::_1) | rpl::start_with_next([=] {
|
||||
) | rpl::filter(rpl::mappers::_1) | rpl::on_next([=] {
|
||||
_scrollToWidget.fire_copy(field);
|
||||
}, field->lifetime());
|
||||
field->tabbed(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
const auto index = findField(field);
|
||||
if (index + 1 < _list.size()) {
|
||||
_list[index + 1]->setFocus();
|
||||
@@ -753,7 +753,7 @@ void Options::addEmptyOption() {
|
||||
});
|
||||
|
||||
_list.back()->removeClicks(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
Ui::PostponeCall(crl::guard(field, [=] {
|
||||
Expects(!_list.empty());
|
||||
|
||||
@@ -891,13 +891,13 @@ not_null<Ui::InputField*> CreatePollBox::setupQuestion(
|
||||
emojiPanel,
|
||||
st::createPollOptionFieldPremiumEmojiPosition);
|
||||
emojiPanel->selector()->emojiChosen(
|
||||
) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) {
|
||||
) | rpl::on_next([=](ChatHelpers::EmojiChosen data) {
|
||||
if (question->hasFocus()) {
|
||||
Ui::InsertEmojiAtCursor(question->textCursor(), data.emoji);
|
||||
}
|
||||
}, emojiToggle->lifetime());
|
||||
emojiPanel->selector()->customEmojiChosen(
|
||||
) | rpl::start_with_next([=](ChatHelpers::FileChosen data) {
|
||||
) | rpl::on_next([=](ChatHelpers::FileChosen data) {
|
||||
if (question->hasFocus()) {
|
||||
Data::InsertCustomEmoji(question, data.document);
|
||||
}
|
||||
@@ -912,7 +912,7 @@ not_null<Ui::InputField*> CreatePollBox::setupQuestion(
|
||||
rpl::combine(
|
||||
question->geometryValue(),
|
||||
warning->sizeValue()
|
||||
) | rpl::start_with_next([=](QRect geometry, QSize label) {
|
||||
) | rpl::on_next([=](QRect geometry, QSize label) {
|
||||
warning->moveToLeft(
|
||||
(container->width()
|
||||
- label.width()
|
||||
@@ -978,7 +978,7 @@ not_null<Ui::InputField*> CreatePollBox::setupSolution(
|
||||
rpl::combine(
|
||||
solution->geometryValue(),
|
||||
warning->sizeValue()
|
||||
) | rpl::start_with_next([=](QRect geometry, QSize label) {
|
||||
) | rpl::on_next([=](QRect geometry, QSize label) {
|
||||
warning->moveToLeft(
|
||||
(inner->width()
|
||||
- label.width()
|
||||
@@ -1048,7 +1048,7 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
|
||||
st::createPollLimitPadding));
|
||||
|
||||
question->tabbed(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
options->focusFirst();
|
||||
}, question->lifetime());
|
||||
|
||||
@@ -1088,7 +1088,7 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
|
||||
rpl::single(quiz->checked()) | rpl::then(quiz->checkedChanges()));
|
||||
|
||||
options->tabbed(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
if (quiz->checked()) {
|
||||
solution->setFocus();
|
||||
} else {
|
||||
@@ -1097,7 +1097,7 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
|
||||
}, question->lifetime());
|
||||
|
||||
solution->tabbed(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
question->setFocus();
|
||||
}, solution->lifetime());
|
||||
|
||||
@@ -1109,14 +1109,14 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
|
||||
) | rpl::filter([=](not_null<QEvent*> e) {
|
||||
return (e->type() == QEvent::MouseButtonPress)
|
||||
&& quiz->checked();
|
||||
}) | rpl::start_with_next([show = uiShow()] {
|
||||
}) | rpl::on_next([show = uiShow()] {
|
||||
show->showToast(tr::lng_polls_create_one_answer(tr::now));
|
||||
}, multiple->lifetime());
|
||||
}
|
||||
|
||||
using namespace rpl::mappers;
|
||||
quiz->checkedChanges(
|
||||
) | rpl::start_with_next([=](bool checked) {
|
||||
) | rpl::on_next([=](bool checked) {
|
||||
if (multiple) {
|
||||
if (checked && multiple->checked()) {
|
||||
multiple->setChecked(false);
|
||||
@@ -1132,7 +1132,7 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
|
||||
return !text.isEmpty() && (text.size() <= kQuestionLimit);
|
||||
};
|
||||
question->submits(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
if (isValidQuestion()) {
|
||||
options->focusFirst();
|
||||
}
|
||||
@@ -1216,12 +1216,12 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
|
||||
crl::guard(this, send));
|
||||
|
||||
options->scrollToWidget(
|
||||
) | rpl::start_with_next([=](not_null<QWidget*> widget) {
|
||||
) | rpl::on_next([=](not_null<QWidget*> widget) {
|
||||
scrollToWidget(widget);
|
||||
}, lifetime());
|
||||
|
||||
options->backspaceInFront(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
FocusAtEnd(question);
|
||||
}, lifetime());
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ void DeleteMessagesBox::prepare() {
|
||||
lt_date,
|
||||
TextWithEntities{
|
||||
langDayOfMonthFull(_wipeHistoryFirstToDelete) },
|
||||
Ui::Text::RichLangValue)
|
||||
tr::rich)
|
||||
: tr::lng_sure_delete_by_date_many(
|
||||
tr::now,
|
||||
lt_days,
|
||||
@@ -108,8 +108,8 @@ void DeleteMessagesBox::prepare() {
|
||||
lt_count,
|
||||
_wipeHistoryFirstToDelete.daysTo(
|
||||
_wipeHistoryLastToDelete) + 1,
|
||||
Ui::Text::WithEntities),
|
||||
Ui::Text::RichLangValue);
|
||||
tr::marked),
|
||||
tr::rich);
|
||||
deleteStyle = &st::attentionBoxButton;
|
||||
} else if (_wipeHistoryJustClear) {
|
||||
const auto isChannel = peer->isChannel() && !peer->isMegagroup();
|
||||
@@ -130,7 +130,7 @@ void DeleteMessagesBox::prepare() {
|
||||
tr::now,
|
||||
lt_group,
|
||||
peer->name());
|
||||
details = Ui::Text::RichLangValue(details.text);
|
||||
details = tr::rich(details.text);
|
||||
deleteStyle = &st::attentionBoxButton;
|
||||
} else {
|
||||
details.text = peer->isSelf()
|
||||
@@ -148,7 +148,7 @@ void DeleteMessagesBox::prepare() {
|
||||
: peer->isMegagroup()
|
||||
? tr::lng_sure_leave_group(tr::now)
|
||||
: tr::lng_sure_leave_channel(tr::now);
|
||||
details = Ui::Text::RichLangValue(details.text);
|
||||
details = tr::rich(details.text);
|
||||
if (!peer->isUser()) {
|
||||
*deleteText = tr::lng_box_leave();
|
||||
}
|
||||
@@ -164,7 +164,7 @@ void DeleteMessagesBox::prepare() {
|
||||
appendDetails(std::move(revoke->description));
|
||||
if (!peer->isUser() && !_wipeHistoryJustClear) {
|
||||
_revoke->checkedValue(
|
||||
) | rpl::start_with_next([=](bool revokeForAll) {
|
||||
) | rpl::on_next([=](bool revokeForAll) {
|
||||
*deleteText = revokeForAll
|
||||
? tr::lng_box_delete()
|
||||
: tr::lng_box_leave();
|
||||
@@ -201,8 +201,8 @@ void DeleteMessagesBox::prepare() {
|
||||
tr::lng_delete_all_from_user(
|
||||
tr::now,
|
||||
lt_user,
|
||||
Ui::Text::Bold(_moderateFrom->name()),
|
||||
Ui::Text::WithEntities),
|
||||
tr::bold(_moderateFrom->name()),
|
||||
tr::marked),
|
||||
false,
|
||||
st::defaultBoxCheckbox);
|
||||
|
||||
@@ -251,13 +251,13 @@ void DeleteMessagesBox::prepare() {
|
||||
st::defaultBoxCheckbox));
|
||||
_revokeRemember->hide(anim::type::instant);
|
||||
_revoke->checkedValue(
|
||||
) | rpl::start_with_next([=](bool checked) {
|
||||
) | rpl::on_next([=](bool checked) {
|
||||
_revokeRemember->toggle(
|
||||
checked != revokeByDefault,
|
||||
anim::type::normal);
|
||||
}, _revokeRemember->lifetime());
|
||||
_revokeRemember->heightValue(
|
||||
) | rpl::start_with_next([=](int h) {
|
||||
) | rpl::on_next([=](int h) {
|
||||
setDimensions(st::boxWidth, _fullHeight + h);
|
||||
}, lifetime());
|
||||
appendDetails(std::move(revoke->description));
|
||||
@@ -320,7 +320,7 @@ void DeleteMessagesBox::prepare() {
|
||||
rpl::combine(
|
||||
widthValue(),
|
||||
_text->naturalWidthValue()
|
||||
) | rpl::start_with_next([=](int full, int) {
|
||||
) | rpl::on_next([=](int full, int) {
|
||||
_text->resizeToNaturalWidth(full - padding.left() - padding.right());
|
||||
|
||||
auto fullHeight = st::boxPadding.top()
|
||||
@@ -396,7 +396,7 @@ auto DeleteMessagesBox::revokeText(not_null<PeerData*> peer) const
|
||||
tr::now,
|
||||
lt_user,
|
||||
{ user->firstName },
|
||||
Ui::Text::RichLangValue);
|
||||
tr::rich);
|
||||
} else {
|
||||
result.checkbox.text = tr::lng_delete_for_everyone_check(tr::now);
|
||||
}
|
||||
@@ -429,7 +429,7 @@ auto DeleteMessagesBox::revokeText(not_null<PeerData*> peer) const
|
||||
tr::now,
|
||||
lt_user,
|
||||
{ user->firstName },
|
||||
Ui::Text::RichLangValue);
|
||||
tr::rich);
|
||||
} else {
|
||||
result.checkbox.text = tr::lng_delete_for_everyone_check(tr::now);
|
||||
}
|
||||
@@ -441,27 +441,27 @@ auto DeleteMessagesBox::revokeText(not_null<PeerData*> peer) const
|
||||
result.description = tr::lng_selected_unsend_about_user_one(
|
||||
tr::now,
|
||||
lt_user,
|
||||
Ui::Text::Bold(user->shortName()),
|
||||
Ui::Text::WithEntities);
|
||||
tr::bold(user->shortName()),
|
||||
tr::marked);
|
||||
} else {
|
||||
result.description = tr::lng_selected_unsend_about_user(
|
||||
tr::now,
|
||||
lt_count,
|
||||
canRevokeOutgoingCount,
|
||||
lt_user,
|
||||
Ui::Text::Bold(user->shortName()),
|
||||
Ui::Text::WithEntities);
|
||||
tr::bold(user->shortName()),
|
||||
tr::marked);
|
||||
}
|
||||
} else if (canRevokeOutgoingCount == 1) {
|
||||
result.description = tr::lng_selected_unsend_about_group_one(
|
||||
tr::now,
|
||||
Ui::Text::WithEntities);
|
||||
tr::marked);
|
||||
} else {
|
||||
result.description = tr::lng_selected_unsend_about_group(
|
||||
tr::now,
|
||||
lt_count,
|
||||
canRevokeOutgoingCount,
|
||||
Ui::Text::WithEntities);
|
||||
tr::marked);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -557,7 +557,7 @@ void DeleteMessagesBox::deleteAndClear() {
|
||||
? tr::lng_suggest_warn_text_ton
|
||||
: tr::lng_suggest_warn_text_stars)(
|
||||
tr::now,
|
||||
Ui::Text::RichLangValue),
|
||||
tr::rich),
|
||||
.confirmed = callback,
|
||||
.confirmText = tr::lng_suggest_warn_delete_anyway(tr::now),
|
||||
.confirmStyle = &st::attentionBoxButton,
|
||||
@@ -634,8 +634,8 @@ void DeleteMessagesBox::deleteAndClear() {
|
||||
if (_reportSpam->checked()) {
|
||||
_moderateInChannel->session().api().request(
|
||||
MTPchannels_ReportSpam(
|
||||
_moderateInChannel->inputChannel,
|
||||
_moderateFrom->input,
|
||||
_moderateInChannel->inputChannel(),
|
||||
_moderateFrom->input(),
|
||||
MTP_vector<MTPint>(1, MTP_int(_ids[0].msg)))
|
||||
).send();
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ auto AddButtonWithLoader(
|
||||
|
||||
std::move(
|
||||
query
|
||||
) | rpl::start_with_next([=](auto string) {
|
||||
) | rpl::on_next([=](auto string) {
|
||||
wrap->toggle(
|
||||
ranges::any_of(indexList, [&](const QString &s) {
|
||||
return s.startsWith(string, Qt::CaseInsensitive);
|
||||
@@ -198,7 +198,7 @@ auto AddButtonWithLoader(
|
||||
};
|
||||
|
||||
Spellchecker::GlobalLoaderChanged(
|
||||
) | rpl::start_with_next([=](int langId) {
|
||||
) | rpl::on_next([=](int langId) {
|
||||
if (!langId && rawGlobalLoaderPtr()) {
|
||||
setGlobalLoaderPtr(nullptr);
|
||||
} else if (langId == id) {
|
||||
@@ -215,14 +215,14 @@ auto AddButtonWithLoader(
|
||||
rpl::combine(
|
||||
button->widthValue(),
|
||||
label->widthValue()
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
label->moveToLeft(
|
||||
st::settingsUpdateStatePosition.x(),
|
||||
st::settingsUpdateStatePosition.y());
|
||||
}, label->lifetime());
|
||||
|
||||
buttonState->value(
|
||||
) | rpl::start_with_next([=](const DictState &state) {
|
||||
) | rpl::on_next([=](const DictState &state) {
|
||||
const auto isToggledSet = v::is<Active>(state);
|
||||
const auto toggled = isToggledSet ? 1. : 0.;
|
||||
const auto over = !button->isDisabled()
|
||||
@@ -279,7 +279,7 @@ auto AddButtonWithLoader(
|
||||
});
|
||||
|
||||
button->toggledValue(
|
||||
) | rpl::start_with_next([=](bool toggled) {
|
||||
) | rpl::on_next([=](bool toggled) {
|
||||
const auto &state = buttonState->current();
|
||||
if (toggled && (v::is<Available>(state) || v::is<Failed>(state))) {
|
||||
const auto weak = base::make_weak(button);
|
||||
@@ -353,7 +353,7 @@ void Inner::setupContent(
|
||||
ranges::contains(enabledDictionaries, id),
|
||||
queryStream->events());
|
||||
row->toggledValue(
|
||||
) | rpl::start_with_next([=](auto enabled) {
|
||||
) | rpl::on_next([=](auto enabled) {
|
||||
if (enabled) {
|
||||
_enabledRows.push_back(id);
|
||||
} else {
|
||||
@@ -420,7 +420,7 @@ void ManageDictionariesBox::prepare() {
|
||||
});
|
||||
addButton(tr::lng_close(), [=] { closeBox(); });
|
||||
|
||||
boxClosing() | rpl::start_with_next([=] {
|
||||
boxClosing() | rpl::on_next([=] {
|
||||
Core::App().settings().setDictionariesEnabled(
|
||||
FilterEnabledDict(initialEnabledRows));
|
||||
Core::App().saveSettingsDelayed();
|
||||
@@ -434,7 +434,7 @@ void ManageDictionariesBox::prepare() {
|
||||
inner->heightValue(),
|
||||
multiSelect->heightValue(),
|
||||
_1 + _2
|
||||
) | rpl::start_with_next([=](int height) {
|
||||
) | rpl::on_next([=](int height) {
|
||||
using std::min;
|
||||
accumulate_max(*max, height);
|
||||
setDimensions(st::boxWidth, min(*max, st::boxMaxListHeight), true);
|
||||
|
||||
@@ -262,7 +262,7 @@ EditCaptionBox::EditCaptionBox(
|
||||
|
||||
_controller->session().data().itemRemoved(
|
||||
_historyItem->fullId()
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
closeBox();
|
||||
}, lifetime());
|
||||
}
|
||||
@@ -490,7 +490,7 @@ void EditCaptionBox::rebuildPreview() {
|
||||
const auto withCheckbox = _isPhoto && CanBeCompressed(_albumType);
|
||||
if (media && (!withCheckbox || !_asFile)) {
|
||||
media->spoileredChanges(
|
||||
) | rpl::start_with_next([=](bool spoilered) {
|
||||
) | rpl::on_next([=](bool spoilered) {
|
||||
_mediaEditManager.apply({ .type = spoilered
|
||||
? SendMenu::ActionType::SpoilerOn
|
||||
: SendMenu::ActionType::SpoilerOff
|
||||
@@ -512,7 +512,7 @@ void EditCaptionBox::rebuildPreview() {
|
||||
_footerHeight.value(),
|
||||
rpl::single(st::boxPhotoPadding.top()),
|
||||
rpl::mappers::_1 + rpl::mappers::_2 + rpl::mappers::_3
|
||||
) | rpl::start_with_next([=](int height) {
|
||||
) | rpl::on_next([=](int height) {
|
||||
setDimensions(
|
||||
st::boxWideWidth,
|
||||
std::min(st::sendMediaPreviewHeightMax, height),
|
||||
@@ -525,11 +525,11 @@ void EditCaptionBox::rebuildPreview() {
|
||||
_content->modifyRequests(
|
||||
) | rpl::start_to_stream(_photoEditorOpens, _content->lifetime());
|
||||
|
||||
_content->editCoverRequests() | rpl::start_with_next([=] {
|
||||
_content->editCoverRequests() | rpl::on_next([=] {
|
||||
setupEditCoverHandler();
|
||||
}, _content->lifetime());
|
||||
|
||||
_content->clearCoverRequests() | rpl::start_with_next([=] {
|
||||
_content->clearCoverRequests() | rpl::on_next([=] {
|
||||
setupClearCoverHandler();
|
||||
}, _content->lifetime());
|
||||
|
||||
@@ -566,13 +566,13 @@ void EditCaptionBox::setupField() {
|
||||
_field->setMaxHeight(st::defaultComposeFiles.caption.heightMax);
|
||||
|
||||
_field->submits(
|
||||
) | rpl::start_with_next([=] { save(); }, _field->lifetime());
|
||||
) | rpl::on_next([=] { save(); }, _field->lifetime());
|
||||
_field->cancelled(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
closeBox();
|
||||
}, _field->lifetime());
|
||||
_field->heightChanges(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
captionResized();
|
||||
}, _field->lifetime());
|
||||
_field->setMimeDataHook([=](
|
||||
@@ -656,7 +656,7 @@ void EditCaptionBox::setInitialText() {
|
||||
}
|
||||
});
|
||||
_field->changes(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
_checkChangedTimer.callOnce(kChangesDebounceTimeout);
|
||||
setCloseByOutsideClick(false);
|
||||
}, _field->lifetime());
|
||||
@@ -696,7 +696,7 @@ void EditCaptionBox::setupControls() {
|
||||
}),
|
||||
anim::type::instant
|
||||
)->entity()->checkedChanges(
|
||||
) | rpl::start_with_next([&](bool checked) {
|
||||
) | rpl::on_next([&](bool checked) {
|
||||
applyChanges();
|
||||
_asFile = !checked;
|
||||
rebuildPreview();
|
||||
@@ -707,7 +707,7 @@ void EditCaptionBox::setupControls() {
|
||||
|
||||
void EditCaptionBox::setupEditEventHandler() {
|
||||
_editMediaClicks.events(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
ChooseReplacement(_controller, _albumType, crl::guard(this, [=](
|
||||
Ui::PreparedList &&list) {
|
||||
setPreparedList(std::move(list));
|
||||
@@ -718,7 +718,7 @@ void EditCaptionBox::setupEditEventHandler() {
|
||||
void EditCaptionBox::setupPhotoEditorEventHandler() {
|
||||
const auto openedOnce = lifetime().make_state<bool>(false);
|
||||
_photoEditorOpens.events(
|
||||
) | rpl::start_with_next([=, controller = _controller] {
|
||||
) | rpl::on_next([=, controller = _controller] {
|
||||
if (_preparedList.files.empty()
|
||||
&& (!_photoMedia
|
||||
|| !_photoMedia->image(Data::PhotoSize::Large))) {
|
||||
@@ -880,11 +880,11 @@ void EditCaptionBox::setupEmojiPanel() {
|
||||
_emojiPanel->hide();
|
||||
_emojiPanel->selector()->setCurrentPeer(_historyItem->history()->peer);
|
||||
_emojiPanel->selector()->emojiChosen(
|
||||
) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) {
|
||||
) | rpl::on_next([=](ChatHelpers::EmojiChosen data) {
|
||||
Ui::InsertEmojiAtCursor(_field->textCursor(), data.emoji);
|
||||
}, lifetime());
|
||||
_emojiPanel->selector()->customEmojiChosen(
|
||||
) | rpl::start_with_next([=](ChatHelpers::FileChosen data) {
|
||||
) | rpl::on_next([=](ChatHelpers::FileChosen data) {
|
||||
const auto info = data.document->sticker();
|
||||
if (info
|
||||
&& info->setType == Data::StickersType::Emoji
|
||||
|
||||
@@ -111,11 +111,11 @@ void CreateRadiobuttonLock(
|
||||
lock->resize(st::defaultRadio.diameter, st::defaultRadio.diameter);
|
||||
|
||||
widget->sizeValue(
|
||||
) | rpl::start_with_next([=, &st](QSize size) {
|
||||
) | rpl::on_next([=, &st](QSize size) {
|
||||
lock->move(st.checkPosition);
|
||||
}, lock->lifetime());
|
||||
|
||||
lock->paintRequest() | rpl::start_with_next([=] {
|
||||
lock->paintRequest() | rpl::on_next([=] {
|
||||
auto p = QPainter(lock);
|
||||
auto hq = PainterHighQualityEnabler(p);
|
||||
const auto &icon = st::messagePrivacyLock;
|
||||
@@ -138,7 +138,7 @@ void AddPremiumRequiredRow(
|
||||
const auto row = Ui::CreateChild<Ui::AbstractButton>(widget.get());
|
||||
|
||||
widget->sizeValue(
|
||||
) | rpl::start_with_next([=](const QSize &s) {
|
||||
) | rpl::on_next([=](const QSize &s) {
|
||||
row->resize(s);
|
||||
}, row->lifetime());
|
||||
row->setClickedCallback(std::move(clickedCallback));
|
||||
@@ -147,7 +147,7 @@ void AddPremiumRequiredRow(
|
||||
|
||||
Data::AmPremiumValue(
|
||||
session
|
||||
) | rpl::start_with_next([=](bool premium) {
|
||||
) | rpl::on_next([=](bool premium) {
|
||||
row->setVisible(!premium);
|
||||
if (!premium) {
|
||||
setDefaultOption();
|
||||
@@ -382,7 +382,7 @@ auto PrivacyExceptionsBoxController::prepareSpecialRowList(
|
||||
tr::lng_edit_privacy_users_and_groups()));
|
||||
|
||||
controller->specialChanges(
|
||||
) | rpl::start_with_next([=](bool chosen) {
|
||||
) | rpl::on_next([=](bool chosen) {
|
||||
if (type == SpecialRowType::Premiums) {
|
||||
_selected.premiums = chosen;
|
||||
} else {
|
||||
@@ -391,7 +391,7 @@ auto PrivacyExceptionsBoxController::prepareSpecialRowList(
|
||||
}, lifetime);
|
||||
|
||||
controller->rowSelectionChanges(
|
||||
) | rpl::start_with_next([=](RowSelectionChange update) {
|
||||
) | rpl::on_next([=](RowSelectionChange update) {
|
||||
this->delegate()->peerListSetForeignRowChecked(
|
||||
update.row,
|
||||
update.checked,
|
||||
@@ -543,7 +543,7 @@ auto PrivacyExceptionsBoxController::createRow(not_null<History*> history)
|
||||
updateByValue(value);
|
||||
valueFinished(value);
|
||||
};
|
||||
style::PaletteChanged() | rpl::start_with_next([=] {
|
||||
style::PaletteChanged() | rpl::on_next([=] {
|
||||
min->setTextColorOverride(st::windowSubTextFg->c);
|
||||
max->setTextColorOverride(st::windowSubTextFg->c);
|
||||
}, raw->lifetime());
|
||||
@@ -559,7 +559,7 @@ auto PrivacyExceptionsBoxController::createRow(not_null<History*> history)
|
||||
state->indexMin);
|
||||
slider->resize(slider->width(), sliderStyle->seekSize.height());
|
||||
|
||||
raw->widthValue() | rpl::start_with_next([=](int width) {
|
||||
raw->widthValue() | rpl::on_next([=](int width) {
|
||||
labels->resizeToWidth(width);
|
||||
updateByIndex();
|
||||
}, slider->lifetime());
|
||||
@@ -907,7 +907,7 @@ void EditPrivacyBox::setupContent() {
|
||||
const auto never = addExceptionLink(Exception::Never);
|
||||
addLabel(
|
||||
content,
|
||||
_controller->exceptionsDescription() | Ui::Text::ToWithEntities(),
|
||||
_controller->exceptionsDescription() | rpl::map(tr::marked),
|
||||
st::defaultVerticalListSkip);
|
||||
|
||||
auto below = _controller->setupBelowWidget(
|
||||
@@ -939,7 +939,7 @@ void EditPrivacyBox::setupContent() {
|
||||
+ st::settingsButtonNoIcon.padding.bottom();
|
||||
|
||||
widthValue(
|
||||
) | rpl::start_with_next([=](int width) {
|
||||
) | rpl::on_next([=](int width) {
|
||||
content->resizeToWidth(width);
|
||||
}, content->lifetime());
|
||||
|
||||
@@ -947,7 +947,7 @@ void EditPrivacyBox::setupContent() {
|
||||
) | rpl::map([=](int height) {
|
||||
return height - always->height() - never->height() + 2 * linkHeight;
|
||||
}) | rpl::distinct_until_changed(
|
||||
) | rpl::start_with_next([=](int height) {
|
||||
) | rpl::on_next([=](int height) {
|
||||
setDimensions(st::boxWideWidth, height);
|
||||
}, content->lifetime());
|
||||
}
|
||||
@@ -1076,7 +1076,7 @@ void EditMessagesPrivacyBox(
|
||||
key
|
||||
) | rpl::take(
|
||||
1
|
||||
) | rpl::start_with_next([=](const Api::UserPrivacy::Rule &value) {
|
||||
) | rpl::on_next([=](const Api::UserPrivacy::Rule &value) {
|
||||
EditNoPaidMessagesExceptions(controller, value);
|
||||
});
|
||||
});
|
||||
@@ -1092,15 +1092,15 @@ void EditMessagesPrivacyBox(
|
||||
using WeakToast = base::weak_ptr<Ui::Toast::Instance>;
|
||||
const auto toast = std::make_shared<WeakToast>();
|
||||
const auto showToast = [=] {
|
||||
auto link = Ui::Text::Link(
|
||||
Ui::Text::Semibold(
|
||||
auto link = tr::link(
|
||||
tr::semibold(
|
||||
tr::lng_messages_privacy_premium_link(tr::now)));
|
||||
(*toast) = controller->showToast({
|
||||
.text = tr::lng_messages_privacy_premium(
|
||||
tr::now,
|
||||
lt_link,
|
||||
link,
|
||||
Ui::Text::WithEntities),
|
||||
tr::marked),
|
||||
.filter = crl::guard(&controller->session(), [=](
|
||||
const ClickHandlerPtr &,
|
||||
Qt::MouseButton button) {
|
||||
@@ -1233,7 +1233,7 @@ rpl::producer<int> SetupChargeSlider(
|
||||
|
||||
const auto details = container->add(
|
||||
object_ptr<Ui::VerticalLayout>(container));
|
||||
state->stars.value() | rpl::start_with_next([=](int stars) {
|
||||
state->stars.value() | rpl::on_next([=](int stars) {
|
||||
while (details->count()) {
|
||||
delete details->widgetAt(0);
|
||||
}
|
||||
@@ -1277,7 +1277,7 @@ void EditDirectMessagesPriceBox(
|
||||
.lottieMargins = st::settingsFilterIconPadding,
|
||||
.showFinished = box->showFinishes(),
|
||||
.about = tr::lng_manage_monoforum_about(
|
||||
Ui::Text::RichLangValue
|
||||
tr::rich
|
||||
),
|
||||
.aboutMargins = st::settingsFilterDividerLabelPadding,
|
||||
});
|
||||
@@ -1313,7 +1313,7 @@ void EditDirectMessagesPriceBox(
|
||||
savedValue,
|
||||
channel->session().appConfig().paidMessageChannelStarsDefault(),
|
||||
true
|
||||
) | rpl::start_with_next([=](int stars) {
|
||||
) | rpl::on_next([=](int stars) {
|
||||
*result = stars;
|
||||
}, box->lifetime());
|
||||
|
||||
@@ -1358,7 +1358,7 @@ void EditDirectMessagesPriceBox(
|
||||
label->take(),
|
||||
st::inviteLinkFieldPadding);
|
||||
|
||||
label->clicks() | rpl::start_with_next(copyLink, label->lifetime());
|
||||
label->clicks() | rpl::on_next(copyLink, label->lifetime());
|
||||
|
||||
Ui::AddSkip(inner);
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ not_null<Ui::FlatLabel*> CreateWarningLabel(
|
||||
st::createPollWarning);
|
||||
result->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
field->changes(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
Ui::PostponeCall(crl::guard(field, [=] {
|
||||
const auto length = field->getLastText().size();
|
||||
const auto value = valueLimit - length;
|
||||
@@ -310,12 +310,12 @@ Tasks::Task::Task(
|
||||
_wrap->hide(anim::type::instant);
|
||||
|
||||
_content->widthValue(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
updateFieldGeometry();
|
||||
}, _field->lifetime());
|
||||
|
||||
_field->heightValue(
|
||||
) | rpl::start_with_next([=](int height) {
|
||||
) | rpl::on_next([=](int height) {
|
||||
_content->resize(_content->width(), height);
|
||||
}, _field->lifetime());
|
||||
|
||||
@@ -340,7 +340,7 @@ void Tasks::Task::createShadow() {
|
||||
_shadow.reset(Ui::CreateChild<Ui::PlainShadow>(field().get()));
|
||||
_shadow->show();
|
||||
field()->sizeValue(
|
||||
) | rpl::start_with_next([=](QSize size) {
|
||||
) | rpl::on_next([=](QSize size) {
|
||||
const auto left = st::createPollFieldPadding.left();
|
||||
_shadow->setGeometry(
|
||||
left,
|
||||
@@ -369,7 +369,7 @@ void Tasks::Task::createRemove() {
|
||||
_removeAlways = lifetime.make_state<rpl::variable<bool>>(false);
|
||||
|
||||
field->changes(
|
||||
) | rpl::start_with_next([field, toggle] {
|
||||
) | rpl::on_next([field, toggle] {
|
||||
// Don't capture 'this'! Because Option is a value type.
|
||||
*toggle = !field->getLastText().isEmpty();
|
||||
}, field->lifetime());
|
||||
@@ -378,13 +378,13 @@ void Tasks::Task::createRemove() {
|
||||
toggle->value(),
|
||||
_removeAlways->value(),
|
||||
_1 || _2
|
||||
) | rpl::start_with_next([=](bool shown) {
|
||||
) | rpl::on_next([=](bool shown) {
|
||||
remove->toggle(shown, anim::type::normal);
|
||||
}, remove->lifetime());
|
||||
#endif
|
||||
|
||||
field->widthValue(
|
||||
) | rpl::start_with_next([=](int width) {
|
||||
) | rpl::on_next([=](int width) {
|
||||
remove->moveToRight(
|
||||
st::createPollOptionRemovePosition.x(),
|
||||
st::createPollOptionRemovePosition.y(),
|
||||
@@ -406,7 +406,7 @@ void Tasks::Task::createWarning() {
|
||||
rpl::combine(
|
||||
field->sizeValue(),
|
||||
warning->sizeValue()
|
||||
) | rpl::start_with_next([=](QSize size, QSize label) {
|
||||
) | rpl::on_next([=](QSize size, QSize label) {
|
||||
warning->moveToLeft(
|
||||
(size.width()
|
||||
- label.width()
|
||||
@@ -717,19 +717,19 @@ void Tasks::initTaskField(not_null<Task*> task, TextWithEntities text) {
|
||||
QPoint(
|
||||
-st::createPollOptionFieldPremium.textMargins.right(),
|
||||
st::createPollOptionEmojiPositionSkip));
|
||||
emojiToggle->shownValue() | rpl::start_with_next([=](bool shown) {
|
||||
emojiToggle->shownValue() | rpl::on_next([=](bool shown) {
|
||||
if (!shown) {
|
||||
return;
|
||||
}
|
||||
_emojiPanelLifetime.destroy();
|
||||
emojiPanel->selector()->emojiChosen(
|
||||
) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) {
|
||||
) | rpl::on_next([=](ChatHelpers::EmojiChosen data) {
|
||||
if (field->hasFocus()) {
|
||||
Ui::InsertEmojiAtCursor(field->textCursor(), data.emoji);
|
||||
}
|
||||
}, _emojiPanelLifetime);
|
||||
emojiPanel->selector()->customEmojiChosen(
|
||||
) | rpl::start_with_next([=](ChatHelpers::FileChosen data) {
|
||||
) | rpl::on_next([=](ChatHelpers::FileChosen data) {
|
||||
if (field->hasFocus()) {
|
||||
Data::InsertCustomEmoji(field, data.document);
|
||||
}
|
||||
@@ -741,14 +741,14 @@ void Tasks::initTaskField(not_null<Task*> task, TextWithEntities text) {
|
||||
TextUtilities::ConvertEntitiesToTextTags(text.entities)
|
||||
});
|
||||
field->submits(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
const auto index = findField(field);
|
||||
if (_list[index]->isGood() && index + 1 < _list.size()) {
|
||||
_list[index + 1]->setFocus();
|
||||
}
|
||||
}, field->lifetime());
|
||||
field->changes(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
auto list = ParsePastedList(field->getLastText());
|
||||
if (!list.empty()) {
|
||||
field->setText(list.front());
|
||||
@@ -762,11 +762,11 @@ void Tasks::initTaskField(not_null<Task*> task, TextWithEntities text) {
|
||||
}));
|
||||
}, field->lifetime());
|
||||
field->focusedChanges(
|
||||
) | rpl::filter(rpl::mappers::_1) | rpl::start_with_next([=] {
|
||||
) | rpl::filter(rpl::mappers::_1) | rpl::on_next([=] {
|
||||
_scrollToWidget.fire_copy(field);
|
||||
}, field->lifetime());
|
||||
field->tabbed(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
const auto index = findField(field);
|
||||
if (index + 1 < _list.size()) {
|
||||
_list[index + 1]->setFocus();
|
||||
@@ -794,7 +794,7 @@ void Tasks::initTaskField(not_null<Task*> task, TextWithEntities text) {
|
||||
});
|
||||
|
||||
task->removeClicks(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
Ui::PostponeCall(crl::guard(field, [=] {
|
||||
Expects(!_list.empty());
|
||||
|
||||
@@ -895,7 +895,7 @@ EditTodoListBox::EditTodoListBox(
|
||||
, _titleLimit(controller->session().appConfig().todoListTitleLimit()) {
|
||||
_controller->session().changes().messageUpdates(
|
||||
Data::MessageUpdate::Flag::Destroyed
|
||||
) | rpl::start_with_next([=](const Data::MessageUpdate &update) {
|
||||
) | rpl::on_next([=](const Data::MessageUpdate &update) {
|
||||
if (update.item == item) {
|
||||
closeBox();
|
||||
}
|
||||
@@ -946,13 +946,13 @@ not_null<Ui::InputField*> EditTodoListBox::setupTitle(
|
||||
_emojiPanel.get(),
|
||||
st::createPollOptionFieldPremiumEmojiPosition);
|
||||
_emojiPanel->selector()->emojiChosen(
|
||||
) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) {
|
||||
) | rpl::on_next([=](ChatHelpers::EmojiChosen data) {
|
||||
if (title->hasFocus()) {
|
||||
Ui::InsertEmojiAtCursor(title->textCursor(), data.emoji);
|
||||
}
|
||||
}, emojiToggle->lifetime());
|
||||
_emojiPanel->selector()->customEmojiChosen(
|
||||
) | rpl::start_with_next([=](ChatHelpers::FileChosen data) {
|
||||
) | rpl::on_next([=](ChatHelpers::FileChosen data) {
|
||||
if (title->hasFocus()) {
|
||||
Data::InsertCustomEmoji(title, data.document);
|
||||
}
|
||||
@@ -976,7 +976,7 @@ not_null<Ui::InputField*> EditTodoListBox::setupTitle(
|
||||
rpl::combine(
|
||||
title->geometryValue(),
|
||||
warning->sizeValue()
|
||||
) | rpl::start_with_next([=](QRect geometry, QSize label) {
|
||||
) | rpl::on_next([=](QRect geometry, QSize label) {
|
||||
warning->moveToLeft(
|
||||
(container->width()
|
||||
- label.width()
|
||||
@@ -1044,7 +1044,7 @@ object_ptr<Ui::RpWidget> EditTodoListBox::setupContent() {
|
||||
st::createPollLimitPadding));
|
||||
|
||||
title->tabbed(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
tasks->focusFirst();
|
||||
}, title->lifetime());
|
||||
|
||||
@@ -1067,7 +1067,7 @@ object_ptr<Ui::RpWidget> EditTodoListBox::setupContent() {
|
||||
st::createPollCheckboxMargin);
|
||||
|
||||
tasks->tabbed(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
title->setFocus();
|
||||
}, title->lifetime());
|
||||
|
||||
@@ -1076,7 +1076,7 @@ object_ptr<Ui::RpWidget> EditTodoListBox::setupContent() {
|
||||
return !text.isEmpty() && (text.size() <= _titleLimit);
|
||||
};
|
||||
title->submits(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
if (isValidTitle()) {
|
||||
tasks->focusFirst();
|
||||
}
|
||||
@@ -1146,12 +1146,12 @@ object_ptr<Ui::RpWidget> EditTodoListBox::setupContent() {
|
||||
crl::guard(this, send));
|
||||
|
||||
tasks->scrollToWidget(
|
||||
) | rpl::start_with_next([=](not_null<QWidget*> widget) {
|
||||
) | rpl::on_next([=](not_null<QWidget*> widget) {
|
||||
scrollToWidget(widget);
|
||||
}, lifetime());
|
||||
|
||||
tasks->backspaceInFront(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
FocusAtEnd(title);
|
||||
}, lifetime());
|
||||
|
||||
@@ -1201,7 +1201,7 @@ AddTodoListTasksBox::AddTodoListTasksBox(
|
||||
, _item(item) {
|
||||
_controller->session().changes().messageUpdates(
|
||||
Data::MessageUpdate::Flag::Destroyed
|
||||
) | rpl::start_with_next([=](const Data::MessageUpdate &update) {
|
||||
) | rpl::on_next([=](const Data::MessageUpdate &update) {
|
||||
if (update.item == item) {
|
||||
closeBox();
|
||||
}
|
||||
@@ -1266,7 +1266,7 @@ object_ptr<Ui::RpWidget> AddTodoListTasksBox::setupContent() {
|
||||
};
|
||||
|
||||
tasks->scrollToWidget(
|
||||
) | rpl::start_with_next([=](not_null<QWidget*> widget) {
|
||||
) | rpl::on_next([=](not_null<QWidget*> widget) {
|
||||
scrollToWidget(widget);
|
||||
}, lifetime());
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ not_null<FilterChatsPreview*> SetupChatsPreview(
|
||||
(rules.*peers)()));
|
||||
|
||||
preview->flagRemoved(
|
||||
) | rpl::start_with_next([=](Flag flag) {
|
||||
) | rpl::on_next([=](Flag flag) {
|
||||
const auto rules = data->current();
|
||||
auto computed = Data::ChatFilter(
|
||||
rules.id(),
|
||||
@@ -110,7 +110,7 @@ not_null<FilterChatsPreview*> SetupChatsPreview(
|
||||
}, preview->lifetime());
|
||||
|
||||
preview->peerRemoved(
|
||||
) | rpl::start_with_next([=](not_null<History*> history) {
|
||||
) | rpl::on_next([=](not_null<History*> history) {
|
||||
const auto rules = data->current();
|
||||
auto always = rules.always();
|
||||
auto pinned = rules.pinned();
|
||||
@@ -220,13 +220,13 @@ void CreateIconSelector(
|
||||
data->value(
|
||||
) | rpl::map([=](const Data::ChatFilter &filter) {
|
||||
return Ui::ComputeFilterIcon(filter);
|
||||
}) | rpl::start_with_next([=](Ui::FilterIcon icon) {
|
||||
}) | rpl::on_next([=](Ui::FilterIcon icon) {
|
||||
*type = icon;
|
||||
toggle->update();
|
||||
}, toggle->lifetime());
|
||||
|
||||
input->geometryValue(
|
||||
) | rpl::start_with_next([=](QRect geometry) {
|
||||
) | rpl::on_next([=](QRect geometry) {
|
||||
const auto left = geometry.x() + geometry.width() - toggle->width();
|
||||
const auto position = st::windowFilterIconTogglePosition;
|
||||
toggle->move(
|
||||
@@ -235,7 +235,7 @@ void CreateIconSelector(
|
||||
}, toggle->lifetime());
|
||||
|
||||
toggle->paintRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
auto p = QPainter(toggle);
|
||||
const auto icons = Ui::LookupFilterIcon(*type);
|
||||
icons.normal->paintInCenter(
|
||||
@@ -253,7 +253,7 @@ void CreateIconSelector(
|
||||
panel->chosen(
|
||||
) | rpl::filter([=](Ui::FilterIcon icon) {
|
||||
return icon != Ui::ComputeFilterIcon(data->current());
|
||||
}) | rpl::start_with_next([=](Ui::FilterIcon icon) {
|
||||
}) | rpl::on_next([=](Ui::FilterIcon icon) {
|
||||
panel->hideAnimated();
|
||||
const auto rules = data->current();
|
||||
*data = Data::ChatFilter(
|
||||
@@ -382,7 +382,7 @@ void EditFilterBox(
|
||||
});
|
||||
state->hasLinks.value() | rpl::filter(
|
||||
_1
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
state->chatlist = true;
|
||||
}, box->lifetime());
|
||||
|
||||
@@ -391,7 +391,7 @@ void EditFilterBox(
|
||||
owner->chatsFilters().isChatlistChanged(
|
||||
) | rpl::filter([=](FilterId id) {
|
||||
return (id == data->current().id());
|
||||
}) | rpl::start_with_next([=](FilterId id) {
|
||||
}) | rpl::on_next([=](FilterId id) {
|
||||
const auto filters = &owner->chatsFilters();
|
||||
const auto &list = filters->list();
|
||||
const auto i = ranges::find(list, id, &Data::ChatFilter::id);
|
||||
@@ -414,7 +414,7 @@ void EditFilterBox(
|
||||
const auto session = &window->session();
|
||||
Data::AmPremiumValue(
|
||||
session
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
box->closeBox();
|
||||
}, box->lifetime());
|
||||
|
||||
@@ -458,7 +458,7 @@ void EditFilterBox(
|
||||
staticTitle->setClickedCallback([=] {
|
||||
state->staticTitle = !state->staticTitle.current();
|
||||
});
|
||||
state->staticTitle.value() | rpl::start_with_next([=](bool value) {
|
||||
state->staticTitle.value() | rpl::on_next([=](bool value) {
|
||||
staticTitle->setText(value
|
||||
? tr::lng_filters_enable_animations(tr::now)
|
||||
: tr::lng_filters_disable_animations(tr::now));
|
||||
@@ -480,7 +480,7 @@ void EditFilterBox(
|
||||
rpl::combine(
|
||||
staticTitle->widthValue(),
|
||||
name->widthValue()
|
||||
) | rpl::start_with_next([=](int inner, int outer) {
|
||||
) | rpl::on_next([=](int inner, int outer) {
|
||||
staticTitle->moveToRight(
|
||||
st::windowFilterStaticTitlePosition.x(),
|
||||
st::windowFilterStaticTitlePosition.y(),
|
||||
@@ -488,7 +488,7 @@ void EditFilterBox(
|
||||
}, staticTitle->lifetime());
|
||||
|
||||
state->creating.value(
|
||||
) | rpl::filter(!_1) | rpl::start_with_next([=] {
|
||||
) | rpl::filter(!_1) | rpl::on_next([=] {
|
||||
nameEditing->custom = true;
|
||||
}, box->lifetime());
|
||||
|
||||
@@ -508,11 +508,11 @@ void EditFilterBox(
|
||||
state->emojiPanel->hide();
|
||||
state->emojiPanel->selector()->setCurrentPeer(window->session().user());
|
||||
state->emojiPanel->selector()->emojiChosen(
|
||||
) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) {
|
||||
) | rpl::on_next([=](ChatHelpers::EmojiChosen data) {
|
||||
Ui::InsertEmojiAtCursor(name->textCursor(), data.emoji);
|
||||
}, name->lifetime());
|
||||
state->emojiPanel->selector()->customEmojiChosen(
|
||||
) | rpl::start_with_next([=](ChatHelpers::FileChosen data) {
|
||||
) | rpl::on_next([=](ChatHelpers::FileChosen data) {
|
||||
const auto info = data.document->sticker();
|
||||
if (info
|
||||
&& info->setType == Data::StickersType::Emoji
|
||||
@@ -534,7 +534,7 @@ void EditFilterBox(
|
||||
emojiButton->show();
|
||||
|
||||
name->changes(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
if (!nameEditing->settingDefault) {
|
||||
nameEditing->custom = true;
|
||||
}
|
||||
@@ -558,7 +558,7 @@ void EditFilterBox(
|
||||
};
|
||||
|
||||
state->title.value(
|
||||
) | rpl::start_with_next([=](const TextWithEntities &value) {
|
||||
) | rpl::on_next([=](const TextWithEntities &value) {
|
||||
staticTitle->setVisible(!value.entities.isEmpty());
|
||||
}, staticTitle->lifetime());
|
||||
|
||||
@@ -666,7 +666,7 @@ void EditFilterBox(
|
||||
rpl::combine(
|
||||
title->sizeValue(),
|
||||
titleWrap->widthValue()
|
||||
) | rpl::start_with_next([=](const QSize &s, int w) {
|
||||
) | rpl::on_next([=](const QSize &s, int w) {
|
||||
const auto h = st::normalFont->height;
|
||||
const auto left = padding.left()
|
||||
+ s.width()
|
||||
@@ -687,7 +687,7 @@ void EditFilterBox(
|
||||
const auto tag = preview->lifetime().make_state<TagState>();
|
||||
tag->context.textContext = Core::TextContext({ .session = session });
|
||||
const auto shift = st::settingsFilterTagPreviewSkip / 2;
|
||||
preview->paintRequest() | rpl::start_with_next([=] {
|
||||
preview->paintRequest() | rpl::on_next([=] {
|
||||
auto p = QPainter(preview);
|
||||
p.setOpacity(tag->alpha);
|
||||
const auto size = tag->frame.size() / style::DevicePixelRatio();
|
||||
@@ -725,7 +725,7 @@ void EditFilterBox(
|
||||
return value;
|
||||
};
|
||||
state->title.changes(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
tag->context.color = palette(state->colorIndex.current())->c;
|
||||
tag->frame = Ui::ChatsFilterTag(
|
||||
upperTitle(),
|
||||
@@ -785,7 +785,7 @@ void EditFilterBox(
|
||||
});
|
||||
}
|
||||
}
|
||||
line->sizeValue() | rpl::start_with_next([=](const QSize &size) {
|
||||
line->sizeValue() | rpl::on_next([=](const QSize &size) {
|
||||
const auto totalWidth = buttons.size() * side;
|
||||
const auto spacing = (size.width() - totalWidth)
|
||||
/ (buttons.size() - 1);
|
||||
@@ -799,7 +799,7 @@ void EditFilterBox(
|
||||
const auto last = buttons.back();
|
||||
const auto icon = Ui::CreateChild<Ui::RpWidget>(last);
|
||||
icon->resize(side, side);
|
||||
icon->paintRequest() | rpl::start_with_next([=] {
|
||||
icon->paintRequest() | rpl::on_next([=] {
|
||||
auto p = QPainter(icon);
|
||||
(session->premium()
|
||||
? st::windowFilterSmallRemove.icon
|
||||
@@ -853,7 +853,7 @@ void EditFilterBox(
|
||||
tr::lng_filters_link_has(),
|
||||
tr::lng_filters_link()));
|
||||
|
||||
state->hasLinks.changes() | rpl::start_with_next([=] {
|
||||
state->hasLinks.changes() | rpl::on_next([=] {
|
||||
content->resizeToWidth(content->widthNoMargins());
|
||||
}, content->lifetime());
|
||||
|
||||
@@ -886,7 +886,7 @@ void EditFilterBox(
|
||||
addLink->clicks()
|
||||
) | rpl::filter(
|
||||
(rpl::mappers::_1 == Qt::LeftButton)
|
||||
) | rpl::start_with_next([=](Qt::MouseButton button) {
|
||||
) | rpl::on_next([=](Qt::MouseButton button) {
|
||||
const auto result = collect();
|
||||
if (!result || !GoodForExportFilterLink(window, *result)) {
|
||||
return;
|
||||
|
||||
@@ -384,7 +384,7 @@ object_ptr<Ui::RpWidget> CreatePeerListSectionSubtitle(
|
||||
|
||||
const auto raw = result.data();
|
||||
raw->paintRequest(
|
||||
) | rpl::start_with_next([=](QRect clip) {
|
||||
) | rpl::on_next([=](QRect clip) {
|
||||
auto p = QPainter(raw);
|
||||
p.fillRect(clip, st::searchedBarBg);
|
||||
}, raw->lifetime());
|
||||
@@ -394,7 +394,7 @@ object_ptr<Ui::RpWidget> CreatePeerListSectionSubtitle(
|
||||
std::move(text),
|
||||
st::windowFilterChatsSectionSubtitle);
|
||||
raw->widthValue(
|
||||
) | rpl::start_with_next([=](int width) {
|
||||
) | rpl::on_next([=](int width) {
|
||||
const auto padding = st::windowFilterChatsSectionSubtitlePadding;
|
||||
const auto available = width - padding.left() - padding.right();
|
||||
label->resizeToNaturalWidth(available);
|
||||
@@ -533,12 +533,12 @@ object_ptr<Ui::RpWidget> EditFilterChatsListController::prepareTypesList() {
|
||||
tr::lng_filters_edit_chats()));
|
||||
|
||||
controller->selectedChanges(
|
||||
) | rpl::start_with_next([=](Flags selected) {
|
||||
) | rpl::on_next([=](Flags selected) {
|
||||
_selected = selected;
|
||||
}, _lifetime);
|
||||
|
||||
controller->rowSelectionChanges(
|
||||
) | rpl::start_with_next([=](RowSelectionChange update) {
|
||||
) | rpl::on_next([=](RowSelectionChange update) {
|
||||
this->delegate()->peerListSetForeignRowChecked(
|
||||
update.row,
|
||||
update.checked,
|
||||
|
||||
@@ -531,7 +531,7 @@ void LinkController::addHeader(not_null<Ui::VerticalLayout*> container) {
|
||||
},
|
||||
st::settingsFilterIconPadding);
|
||||
_showFinished.events(
|
||||
) | rpl::start_with_next([animate = std::move(icon.animate)] {
|
||||
) | rpl::on_next([animate = std::move(icon.animate)] {
|
||||
animate(anim::repeat::once);
|
||||
}, verticalLayout->lifetime());
|
||||
verticalLayout->add(std::move(icon.widget));
|
||||
@@ -541,13 +541,13 @@ void LinkController::addHeader(not_null<Ui::VerticalLayout*> container) {
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
verticalLayout,
|
||||
(_data.url.isEmpty()
|
||||
? tr::lng_filters_link_no_about(Ui::Text::WithEntities)
|
||||
? tr::lng_filters_link_no_about(tr::marked)
|
||||
: tr::lng_filters_link_share_about(
|
||||
lt_folder,
|
||||
rpl::single(Ui::Text::Wrapped(
|
||||
_filterTitle.text,
|
||||
EntityType::Bold)),
|
||||
Ui::Text::WithEntities)),
|
||||
tr::marked)),
|
||||
st::settingsFilterDividerLabel,
|
||||
st::defaultPopupMenu,
|
||||
Core::TextContext({
|
||||
@@ -558,7 +558,7 @@ void LinkController::addHeader(not_null<Ui::VerticalLayout*> container) {
|
||||
style::al_top)->setTryMakeSimilarLines(true);
|
||||
|
||||
verticalLayout->geometryValue(
|
||||
) | rpl::start_with_next([=](const QRect &r) {
|
||||
) | rpl::on_next([=](const QRect &r) {
|
||||
divider->setGeometry(r);
|
||||
}, divider->lifetime());
|
||||
}
|
||||
@@ -647,7 +647,7 @@ void LinkController::addLinkBlock(not_null<Ui::VerticalLayout*> container) {
|
||||
st::inviteLinkFieldPadding);
|
||||
|
||||
label->clicks(
|
||||
) | rpl::start_with_next(copyLink, label->lifetime());
|
||||
) | rpl::on_next(copyLink, label->lifetime());
|
||||
|
||||
AddCopyShareLinkButtons(container, copyLink, shareLink);
|
||||
|
||||
@@ -785,7 +785,7 @@ void LinkController::setupAboveWidget() {
|
||||
[=](bool select) { toggleAllSelected(select); });
|
||||
|
||||
// Fix label cutting on text change from smaller to longer.
|
||||
_selected.changes() | rpl::start_with_next([=] {
|
||||
_selected.changes() | rpl::on_next([=] {
|
||||
container->resizeToWidth(container->widthNoMargins());
|
||||
}, container->lifetime());
|
||||
|
||||
@@ -825,7 +825,7 @@ LinksController::LinksController(
|
||||
, _currentFilter(std::move(currentFilter))
|
||||
, _rows(std::move(content)) {
|
||||
style::PaletteChanged(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
for (auto &image : _icons) {
|
||||
image = QImage();
|
||||
}
|
||||
@@ -834,7 +834,7 @@ LinksController::LinksController(
|
||||
|
||||
void LinksController::prepare() {
|
||||
_rows.value(
|
||||
) | rpl::start_with_next([=](const std::vector<InviteLinkData> &rows) {
|
||||
) | rpl::on_next([=](const std::vector<InviteLinkData> &rows) {
|
||||
rebuild(rows);
|
||||
}, _lifetime);
|
||||
}
|
||||
@@ -1015,7 +1015,7 @@ void ExportFilterLink(
|
||||
const auto front = peers.front();
|
||||
const auto session = &front->session();
|
||||
auto mtpPeers = peers | ranges::views::transform(
|
||||
[](not_null<PeerData*> peer) { return MTPInputPeer(peer->input); }
|
||||
[](not_null<PeerData*> peer) { return MTPInputPeer(peer->input()); }
|
||||
) | ranges::to<QVector<MTPInputPeer>>();
|
||||
session->api().request(MTPchatlists_ExportChatlistInvite(
|
||||
MTP_inputChatlistDialogFilter(MTP_int(id)),
|
||||
@@ -1048,7 +1048,7 @@ void EditLinkChats(
|
||||
const auto front = peers.front();
|
||||
const auto session = &front->session();
|
||||
auto mtpPeers = peers | ranges::views::transform(
|
||||
[](not_null<PeerData*> peer) { return MTPInputPeer(peer->input); }
|
||||
[](not_null<PeerData*> peer) { return MTPInputPeer(peer->input()); }
|
||||
) | ranges::to<QVector<MTPInputPeer>>();
|
||||
session->api().request(MTPchatlists_EditExportedInvite(
|
||||
MTP_flags(MTPchatlists_EditExportedInvite::Flag::f_peers),
|
||||
@@ -1078,7 +1078,7 @@ object_ptr<Ui::BoxContent> ShowLinkBox(
|
||||
|
||||
const auto saving = std::make_shared<bool>(false);
|
||||
raw->hasChangesValue(
|
||||
) | rpl::start_with_next([=](bool has) {
|
||||
) | rpl::on_next([=](bool has) {
|
||||
box->setCloseByOutsideClick(!has);
|
||||
box->setCloseByEscape(!has);
|
||||
box->clearButtons();
|
||||
@@ -1182,7 +1182,7 @@ void AddFilterSubtitleWithToggles(
|
||||
const auto canSelect = link->lifetime().make_state<rpl::variable<bool>>(
|
||||
std::move(selectedCount) | rpl::map(_1 < selectableCount));
|
||||
canSelect->value(
|
||||
) | rpl::start_with_next([=](bool can) {
|
||||
) | rpl::on_next([=](bool can) {
|
||||
link->setText(can
|
||||
? tr::lng_filters_by_link_select(tr::now)
|
||||
: tr::lng_filters_by_link_deselect(tr::now));
|
||||
@@ -1195,7 +1195,7 @@ void AddFilterSubtitleWithToggles(
|
||||
container->widthValue(),
|
||||
title->topValue(),
|
||||
link->widthValue()
|
||||
) | rpl::start_with_next([=](int outer, int y, int width) {
|
||||
) | rpl::on_next([=](int outer, int y, int width) {
|
||||
link->move(outer - st::boxRowPadding.right() - width, y);
|
||||
}, link->lifetime());
|
||||
}
|
||||
|
||||
@@ -69,9 +69,9 @@ void GiftCreditsBox(
|
||||
auto link = tr::lng_credits_box_history_entry_gift_about_link(
|
||||
lt_emoji,
|
||||
rpl::single(Ui::Text::IconEmoji(&st::textMoreIconEmoji)),
|
||||
Ui::Text::RichLangValue
|
||||
tr::rich
|
||||
) | rpl::map([](TextWithEntities text) {
|
||||
return Ui::Text::Link(
|
||||
return tr::link(
|
||||
std::move(text),
|
||||
u"internal:stars_examples"_q);
|
||||
});
|
||||
@@ -83,7 +83,7 @@ void GiftCreditsBox(
|
||||
rpl::single(TextWithEntities{ peer->shortName() }),
|
||||
lt_link,
|
||||
std::move(link),
|
||||
Ui::Text::RichLangValue),
|
||||
tr::rich),
|
||||
st::creditsBoxAbout),
|
||||
st::boxRowPadding,
|
||||
style::al_top);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -24,6 +24,7 @@ struct GiveawayStart;
|
||||
struct GiveawayResults;
|
||||
struct SubscriptionEntry;
|
||||
struct UniqueGift;
|
||||
struct GiftUpgradeSpinner;
|
||||
} // namespace Data
|
||||
|
||||
namespace Main {
|
||||
@@ -77,8 +78,9 @@ void AddStarGiftTable(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
Settings::CreditsEntryBoxStyleOverrides st,
|
||||
const Data::CreditsHistoryEntry &entry,
|
||||
std::shared_ptr<Data::GiftUpgradeSpinner> spinner,
|
||||
Fn<void()> convertToStars,
|
||||
Fn<void()> startUpgrade,
|
||||
bool canStartUpgrade,
|
||||
Fn<void(Fn<void()> removed)> removeDetails);
|
||||
void AddTransferGiftTable(
|
||||
std::shared_ptr<ChatHelpers::Show> show,
|
||||
|
||||
@@ -908,7 +908,7 @@ void Content::setupContent(
|
||||
inner,
|
||||
st::defaultBox.margin.top()));
|
||||
|
||||
rows->isEmpty() | rpl::start_with_next([=](bool empty) {
|
||||
rows->isEmpty() | rpl::on_next([=](bool empty) {
|
||||
wrap->toggle(!empty, anim::type::instant);
|
||||
}, rows->lifetime());
|
||||
|
||||
@@ -931,7 +931,7 @@ void Content::setupContent(
|
||||
tr::lng_languages_none(),
|
||||
st::membersAbout);
|
||||
empty->entity()->sizeValue(
|
||||
) | rpl::start_with_next([=](QSize size) {
|
||||
) | rpl::on_next([=](QSize size) {
|
||||
label->move(
|
||||
(size.width() - label->width()) / 2,
|
||||
(size.height() - label->height()) / 2);
|
||||
@@ -951,7 +951,7 @@ void Content::setupContent(
|
||||
main->isEmpty(),
|
||||
other->isEmpty(),
|
||||
_1 || _2
|
||||
) | rpl::start_with_next([=](bool empty) {
|
||||
) | rpl::on_next([=](bool empty) {
|
||||
divider->toggle(!empty, anim::type::instant);
|
||||
}, divider->lifetime());
|
||||
|
||||
@@ -959,7 +959,7 @@ void Content::setupContent(
|
||||
a->hasSelection(
|
||||
) | rpl::filter(
|
||||
_1
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
b->setSelected(-1);
|
||||
}, a->lifetime());
|
||||
};
|
||||
@@ -1048,7 +1048,7 @@ void Content::setupContent(
|
||||
};
|
||||
_activations = [=] {
|
||||
if (!main && !other) {
|
||||
return rpl::never<Language>() | rpl::type_erased();
|
||||
return rpl::never<Language>() | rpl::type_erased;
|
||||
} else if (!main) {
|
||||
return other->activations();
|
||||
} else if (!other) {
|
||||
@@ -1057,7 +1057,7 @@ void Content::setupContent(
|
||||
return rpl::merge(
|
||||
main->activations(),
|
||||
other->activations()
|
||||
) | rpl::type_erased();
|
||||
) | rpl::type_erased;
|
||||
};
|
||||
_changeChosen = [=](const QString &chosen) {
|
||||
if (main) {
|
||||
@@ -1134,12 +1134,12 @@ void LanguageBox::prepare() {
|
||||
inner->heightValue(),
|
||||
topContainer->heightValue(),
|
||||
_1 + _2
|
||||
) | rpl::start_with_next([=](int height) {
|
||||
) | rpl::on_next([=](int height) {
|
||||
accumulate_max(*max, height);
|
||||
setDimensions(st::boxWidth, qMin(*max, st::boxMaxListHeight));
|
||||
}, inner->lifetime());
|
||||
topContainer->heightValue(
|
||||
) | rpl::start_with_next([=](int height) {
|
||||
) | rpl::on_next([=](int height) {
|
||||
setInnerTopSkip(height);
|
||||
}, inner->lifetime());
|
||||
|
||||
@@ -1154,7 +1154,7 @@ void LanguageBox::prepare() {
|
||||
});
|
||||
|
||||
inner->activations(
|
||||
) | rpl::start_with_next([=](const Language &language) {
|
||||
) | rpl::on_next([=](const Language &language) {
|
||||
// "#custom" is applied each time it's passed to switchToLanguage().
|
||||
// So we check that the language really has changed.
|
||||
const auto currentId = [] {
|
||||
@@ -1190,7 +1190,7 @@ void LanguageBox::setupTop(not_null<Ui::VerticalLayout*> container) {
|
||||
translateEnabled->toggledValue(
|
||||
) | rpl::filter([](bool checked) {
|
||||
return (checked != Core::App().settings().translateButtonEnabled());
|
||||
}) | rpl::start_with_next([=](bool checked) {
|
||||
}) | rpl::on_next([=](bool checked) {
|
||||
Core::App().settings().setTranslateButtonEnabled(checked);
|
||||
Core::App().saveSettingsDelayed();
|
||||
}, translateEnabled->lifetime());
|
||||
@@ -1207,7 +1207,7 @@ void LanguageBox::setupTop(not_null<Ui::VerticalLayout*> container) {
|
||||
rpl::duplicate(premium),
|
||||
_1 && _2),
|
||||
_translateChatTurnOff.events()));
|
||||
std::move(premium) | rpl::start_with_next([=](bool value) {
|
||||
std::move(premium) | rpl::on_next([=](bool value) {
|
||||
translateChat->setToggleLocked(!value);
|
||||
}, translateChat->lifetime());
|
||||
|
||||
@@ -1222,7 +1222,7 @@ void LanguageBox::setupTop(not_null<Ui::VerticalLayout*> container) {
|
||||
}
|
||||
return premium
|
||||
&& (checked != Core::App().settings().translateChatEnabled());
|
||||
}) | rpl::start_with_next([=](bool checked) {
|
||||
}) | rpl::on_next([=](bool checked) {
|
||||
Core::App().settings().setTranslateChatEnabled(checked);
|
||||
Core::App().saveSettingsDelayed();
|
||||
}, translateChat->lifetime());
|
||||
@@ -1300,7 +1300,7 @@ base::binary_guard LanguageBox::Show(Window::SessionController *controller) {
|
||||
manager.languageListChanged(
|
||||
) | rpl::take(
|
||||
1
|
||||
) | rpl::start_with_next([=]() mutable {
|
||||
) | rpl::on_next([=]() mutable {
|
||||
const auto show = guard->alive();
|
||||
if (lifetime) {
|
||||
base::take(lifetime)->destroy();
|
||||
|
||||
@@ -288,7 +288,7 @@ void LocalStorageBox::Show(not_null<Window::SessionController*> controller) {
|
||||
rpl::combine(
|
||||
controller->session().data().cache().statsOnMain(),
|
||||
controller->session().data().cacheBigFile().statsOnMain()
|
||||
) | rpl::start_with_next([=](
|
||||
) | rpl::on_next([=](
|
||||
Database::Stats &&stats,
|
||||
Database::Stats &&statsBig) {
|
||||
weak->update(std::move(stats), std::move(statsBig));
|
||||
@@ -379,7 +379,7 @@ void LocalStorageBox::setupControls() {
|
||||
const auto shown = (data.count && data.totalSize) || !tag;
|
||||
result->toggle(shown, anim::type::instant);
|
||||
result->entity()->clearRequests(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
clearByTag(tag);
|
||||
}, result->lifetime());
|
||||
_rows.emplace(tag, result);
|
||||
@@ -431,7 +431,7 @@ void LocalStorageBox::setupControls() {
|
||||
);
|
||||
container->resizeToWidth(st::boxWidth);
|
||||
container->heightValue(
|
||||
) | rpl::start_with_next([=](int height) {
|
||||
) | rpl::on_next([=](int height) {
|
||||
setDimensions(st::boxWidth, height);
|
||||
}, container->lifetime());
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ void MaxInviteBox::prepare() {
|
||||
_channel->session().changes().peerUpdates(
|
||||
_channel,
|
||||
Data::PeerUpdate::Flag::InviteLinks
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
rtlupdate(_invitationLink);
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ ModerateOptions CalculateModerateOptions(const HistoryItemsList &items) {
|
||||
const auto peer = from[state->index];
|
||||
const auto peerId = peer->id;
|
||||
state->apiLifetime = search->messagesFounds(
|
||||
) | rpl::start_with_next([=](const Api::FoundMessages &found) {
|
||||
) | rpl::on_next([=](const Api::FoundMessages &found) {
|
||||
state->messagesCounts[peerId] = found.total;
|
||||
state->index++;
|
||||
repeat(repeat);
|
||||
@@ -201,7 +201,7 @@ void CreateModerateMessagesBox(
|
||||
not_null<Ui::Checkbox*> checkbox,
|
||||
not_null<Controller*> controller,
|
||||
Request request) {
|
||||
confirms->events() | rpl::start_with_next([=] {
|
||||
confirms->events() | rpl::on_next([=] {
|
||||
if (checkbox->checked() && controller->collectRequests) {
|
||||
sequentiallyRequest(request, controller->collectRequests());
|
||||
}
|
||||
@@ -280,8 +280,8 @@ void CreateModerateMessagesBox(
|
||||
}) | ranges::to<QVector<MTPint>>();
|
||||
c->session().api().request(
|
||||
MTPchannels_ReportSpam(
|
||||
c->inputChannel,
|
||||
p->input,
|
||||
c->inputChannel(),
|
||||
p->input(),
|
||||
MTP_vector<MTPint>(std::move(filtered)))
|
||||
).send();
|
||||
});
|
||||
@@ -297,12 +297,12 @@ void CreateModerateMessagesBox(
|
||||
!(isSingle)
|
||||
? tr::lng_delete_all_from_users(
|
||||
tr::now,
|
||||
Ui::Text::WithEntities)
|
||||
tr::marked)
|
||||
: tr::lng_delete_all_from_user(
|
||||
tr::now,
|
||||
lt_user,
|
||||
Ui::Text::Bold(firstItem->from()->name()),
|
||||
Ui::Text::WithEntities),
|
||||
tr::bold(firstItem->from()->name()),
|
||||
tr::marked),
|
||||
false,
|
||||
st::defaultBoxCheckbox),
|
||||
st::boxRowPadding + buttonPadding);
|
||||
@@ -354,7 +354,7 @@ void CreateModerateMessagesBox(
|
||||
}
|
||||
return float64(result);
|
||||
})
|
||||
) | rpl::start_with_next([=](const QString &text) {
|
||||
) | rpl::on_next([=](const QString &text) {
|
||||
title->setText(text);
|
||||
title->resizeToWidth(inner->width()
|
||||
- rect::m::sum::h(st::boxRowPadding));
|
||||
@@ -386,7 +386,7 @@ void CreateModerateMessagesBox(
|
||||
rpl::conditional(
|
||||
(ownedWrap
|
||||
? ownedWrap->toggledValue()
|
||||
: rpl::single(false) | rpl::type_erased()),
|
||||
: rpl::single(false) | rpl::type_erased),
|
||||
tr::lng_restrict_user(
|
||||
lt_count,
|
||||
rpl::single(participants.size()) | tr::to_count()),
|
||||
@@ -432,7 +432,7 @@ void CreateModerateMessagesBox(
|
||||
}
|
||||
wrap->toggle(!wrap->toggled(), anim::type::normal);
|
||||
{
|
||||
inner->heightValue() | rpl::start_with_next([=] {
|
||||
inner->heightValue() | rpl::on_next([=] {
|
||||
if (!wrap->animating()) {
|
||||
scrollLifetime->destroy();
|
||||
Ui::PostponeCall(crl::guard(box, [=] {
|
||||
@@ -456,10 +456,10 @@ void CreateModerateMessagesBox(
|
||||
: tr::lng_restrict_users_full)(
|
||||
lt_emoji,
|
||||
rpl::single(toggled ? emojiUp : emojiDown),
|
||||
Ui::Text::WithEntities);
|
||||
tr::marked);
|
||||
}) | rpl::flatten_latest(
|
||||
) | rpl::start_with_next([=](const TextWithEntities &text) {
|
||||
raw->setMarkedText(Ui::Text::Link(text, u"internal:"_q));
|
||||
) | rpl::on_next([=](const TextWithEntities &text) {
|
||||
raw->setMarkedText(tr::link(text, u"internal:"_q));
|
||||
}, label->lifetime());
|
||||
|
||||
Ui::AddSkip(inner);
|
||||
@@ -509,7 +509,7 @@ void CreateModerateMessagesBox(
|
||||
disabledMessages,
|
||||
{ .isForum = peer->isForum() });
|
||||
computeRestrictions = getRestrictions;
|
||||
std::move(changes) | rpl::start_with_next([=] {
|
||||
std::move(changes) | rpl::on_next([=] {
|
||||
ban->setChecked(true);
|
||||
}, ban->lifetime());
|
||||
Ui::AddSkip(container);
|
||||
@@ -519,7 +519,7 @@ void CreateModerateMessagesBox(
|
||||
}
|
||||
|
||||
// Handle confirmation manually.
|
||||
confirms->events() | rpl::start_with_next([=] {
|
||||
confirms->events() | rpl::on_next([=] {
|
||||
if (ban->checked() && controller->collectRequests) {
|
||||
const auto kick = !wrap || !wrap->toggled();
|
||||
const auto restrictions = computeRestrictions
|
||||
@@ -622,12 +622,12 @@ void DeleteChatBox(not_null<Ui::GenericBox*> box, not_null<PeerData*> peer) {
|
||||
Ui::CreateChild<Ui::FlatLabel>(
|
||||
container,
|
||||
peer->isSelf()
|
||||
? tr::lng_saved_messages() | Ui::Text::ToBold()
|
||||
? tr::lng_saved_messages(tr::bold)
|
||||
: maybeUser
|
||||
? tr::lng_profile_delete_conversation() | Ui::Text::ToBold()
|
||||
? tr::lng_profile_delete_conversation(tr::bold)
|
||||
: rpl::single(
|
||||
userpicPeer->name()
|
||||
) | Ui::Text::ToBold() | rpl::type_erased(),
|
||||
tr::bold(userpicPeer->name())
|
||||
) | rpl::type_erased,
|
||||
box->getDelegate()->style().title));
|
||||
|
||||
Ui::AddSkip(container);
|
||||
@@ -661,10 +661,10 @@ void DeleteChatBox(not_null<Ui::GenericBox*> box, not_null<PeerData*> peer) {
|
||||
tr::now,
|
||||
lt_user,
|
||||
TextWithEntities{ maybeUser->firstName },
|
||||
Ui::Text::RichLangValue)
|
||||
tr::rich)
|
||||
: tr::lng_delete_for_everyone_check(
|
||||
tr::now,
|
||||
Ui::Text::WithEntities),
|
||||
tr::marked),
|
||||
false,
|
||||
st::defaultBoxCheckbox));
|
||||
}();
|
||||
@@ -678,7 +678,7 @@ void DeleteChatBox(not_null<Ui::GenericBox*> box, not_null<PeerData*> peer) {
|
||||
return box->addRow(
|
||||
object_ptr<Ui::Checkbox>(
|
||||
container,
|
||||
tr::lng_profile_block_bot(tr::now, Ui::Text::WithEntities),
|
||||
tr::lng_profile_block_bot(tr::now, tr::marked),
|
||||
false,
|
||||
st::defaultBoxCheckbox));
|
||||
}();
|
||||
@@ -712,7 +712,7 @@ void DeleteChatBox(not_null<Ui::GenericBox*> box, not_null<PeerData*> peer) {
|
||||
? tr::lng_filters_checkbox_remove_channel
|
||||
: tr::lng_filters_checkbox_remove_group)(
|
||||
tr::now,
|
||||
Ui::Text::WithEntities),
|
||||
tr::marked),
|
||||
false,
|
||||
st::defaultBoxCheckbox));
|
||||
}();
|
||||
@@ -794,7 +794,7 @@ void DeleteSublistBox(
|
||||
userpic,
|
||||
Ui::CreateChild<Ui::FlatLabel>(
|
||||
container,
|
||||
tr::lng_profile_delete_conversation() | Ui::Text::ToBold(),
|
||||
tr::lng_profile_delete_conversation(tr::bold),
|
||||
box->getDelegate()->style().title));
|
||||
|
||||
Ui::AddSkip(container);
|
||||
|
||||
@@ -47,7 +47,7 @@ void SetCloudPassword(
|
||||
not_null<Ui::GenericBox*> box,
|
||||
not_null<Main::Session*> session) {
|
||||
session->api().cloudPassword().state(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
using namespace Settings;
|
||||
const auto weak = base::make_weak(box);
|
||||
if (CheckEditCloudPassword(session)) {
|
||||
@@ -73,17 +73,17 @@ void TransferPasswordError(
|
||||
auto text = std::move(about).append('\n').append('\n').append(
|
||||
tr::lng_rights_transfer_check_password(
|
||||
tr::now,
|
||||
Ui::Text::RichLangValue)
|
||||
tr::rich)
|
||||
).append('\n').append('\n').append(
|
||||
tr::lng_rights_transfer_check_session(
|
||||
tr::now,
|
||||
Ui::Text::RichLangValue)
|
||||
tr::rich)
|
||||
);
|
||||
if (error == PasswordErrorType::Later) {
|
||||
text.append('\n').append('\n').append(
|
||||
tr::lng_rights_transfer_check_later(
|
||||
tr::now,
|
||||
Ui::Text::RichLangValue));
|
||||
tr::rich));
|
||||
}
|
||||
box->addRow(object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
@@ -120,7 +120,7 @@ void StartPendingReset(
|
||||
};
|
||||
|
||||
session->api().cloudPassword().resetPassword(
|
||||
) | rpl::start_with_next_error_done([=](
|
||||
) | rpl::on_next_error_done([=](
|
||||
Api::CloudPassword::ResetRetryDate retryDate) {
|
||||
constexpr auto kMinute = 60;
|
||||
constexpr auto kHour = 3600;
|
||||
@@ -309,11 +309,11 @@ void PasscodeBox::prepare() {
|
||||
connect(_newPasscode, &Ui::MaskedInputField::changed, [=] { newChanged(); });
|
||||
connect(_reenterPasscode, &Ui::MaskedInputField::changed, [=] { newChanged(); });
|
||||
_passwordHint->changes(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
newChanged();
|
||||
}, _passwordHint->lifetime());
|
||||
_recoverEmail->changes(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
if (!_emailError.isEmpty()) {
|
||||
_emailError = QString();
|
||||
update();
|
||||
@@ -325,9 +325,9 @@ void PasscodeBox::prepare() {
|
||||
connect(_newPasscode, &Ui::MaskedInputField::submitted, fieldSubmit);
|
||||
connect(_reenterPasscode, &Ui::MaskedInputField::submitted, fieldSubmit);
|
||||
_passwordHint->submits(
|
||||
) | rpl::start_with_next(fieldSubmit, _passwordHint->lifetime());
|
||||
) | rpl::on_next(fieldSubmit, _passwordHint->lifetime());
|
||||
_recoverEmail->submits(
|
||||
) | rpl::start_with_next(fieldSubmit, _recoverEmail->lifetime());
|
||||
) | rpl::on_next(fieldSubmit, _recoverEmail->lifetime());
|
||||
|
||||
_recover->addClickHandler([=] { recoverByEmail(); });
|
||||
|
||||
@@ -607,7 +607,7 @@ void PasscodeBox::validateEmail(
|
||||
box->boxClosing(
|
||||
) | rpl::filter([=] {
|
||||
return !*set;
|
||||
}) | start_with_next([=, weak = base::make_weak(this)] {
|
||||
}) | on_next([=, weak = base::make_weak(this)] {
|
||||
if (weak) {
|
||||
weak->_clearUnconfirmedPassword.fire({});
|
||||
}
|
||||
@@ -1117,7 +1117,7 @@ void PasscodeBox::recover() {
|
||||
) | rpl::start_to_stream(_newPasswordSet, lifetime());
|
||||
|
||||
box->recoveryExpired(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
recoverExpired();
|
||||
}, lifetime());
|
||||
|
||||
@@ -1152,7 +1152,7 @@ RecoverBox::RecoverBox(
|
||||
tr::lng_signin_recover_hint(
|
||||
lt_recover_email,
|
||||
rpl::single(Ui::Text::WrapEmailPattern(pattern)),
|
||||
Ui::Text::WithEntities),
|
||||
tr::marked),
|
||||
st::termsContent,
|
||||
st::defaultPopupMenu)
|
||||
, _closeParent(std::move(closeParent)) {
|
||||
@@ -1207,11 +1207,11 @@ void RecoverBox::prepare() {
|
||||
updateHeight();
|
||||
|
||||
_recoverCode->changes(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
codeChanged();
|
||||
}, _recoverCode->lifetime());
|
||||
_recoverCode->submits(
|
||||
) | rpl::start_with_next([=] { submit(); }, _recoverCode->lifetime());
|
||||
) | rpl::on_next([=] { submit(); }, _recoverCode->lifetime());
|
||||
}
|
||||
|
||||
void RecoverBox::paintEvent(QPaintEvent *e) {
|
||||
@@ -1342,7 +1342,7 @@ void RecoverBox::proceedToChange(const QString &code) {
|
||||
auto box = Box<PasscodeBox>(_session, fields);
|
||||
|
||||
box->boxClosing(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
const auto weak = base::make_weak(this);
|
||||
if (const auto onstack = _closeParent) {
|
||||
onstack();
|
||||
@@ -1353,7 +1353,7 @@ void RecoverBox::proceedToChange(const QString &code) {
|
||||
}, lifetime());
|
||||
|
||||
box->newPasswordSet(
|
||||
) | rpl::start_with_next([=](QByteArray &&password) {
|
||||
) | rpl::on_next([=](QByteArray &&password) {
|
||||
_newPasswordSet.fire(std::move(password));
|
||||
}, lifetime());
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ void PeerListBox::createMultiSelect() {
|
||||
tr::lng_participant_filter());
|
||||
_select.create(this, std::move(entity));
|
||||
_select->heightValue(
|
||||
) | rpl::start_with_next(
|
||||
) | rpl::on_next(
|
||||
[this] { updateScrollSkips(); },
|
||||
lifetime());
|
||||
_select->entity()->setSubmittedCallback([=](Qt::KeyboardModifiers) {
|
||||
@@ -191,7 +191,7 @@ void PeerListBox::prepare() {
|
||||
_controller->setDelegate(this);
|
||||
|
||||
_controller->boxHeightValue(
|
||||
) | rpl::start_with_next([=](int height) {
|
||||
) | rpl::on_next([=](int height) {
|
||||
setDimensions(_controller->contentWidth(), height);
|
||||
}, lifetime());
|
||||
|
||||
@@ -203,7 +203,7 @@ void PeerListBox::prepare() {
|
||||
}
|
||||
|
||||
content()->scrollToRequests(
|
||||
) | rpl::start_with_next([this](Ui::ScrollToRequest request) {
|
||||
) | rpl::on_next([this](Ui::ScrollToRequest request) {
|
||||
scrollToY(request.ymin, request.ymax);
|
||||
}, lifetime());
|
||||
|
||||
@@ -1002,14 +1002,14 @@ PeerListContent::PeerListContent(
|
||||
, _controller(controller)
|
||||
, _rowHeight(_st.item.height) {
|
||||
_controller->session().downloaderTaskFinished(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
update();
|
||||
}, lifetime());
|
||||
|
||||
using UpdateFlag = Data::PeerUpdate::Flag;
|
||||
_controller->session().changes().peerUpdates(
|
||||
UpdateFlag::Name | UpdateFlag::Photo | UpdateFlag::EmojiStatus
|
||||
) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
|
||||
) | rpl::on_next([=](const Data::PeerUpdate &update) {
|
||||
if (update.flags & UpdateFlag::Name) {
|
||||
handleNameChanged(update.peer);
|
||||
}
|
||||
@@ -1019,7 +1019,7 @@ PeerListContent::PeerListContent(
|
||||
}, lifetime());
|
||||
|
||||
style::PaletteChanged(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
invalidatePixmapsCache();
|
||||
}, lifetime());
|
||||
|
||||
@@ -1387,10 +1387,10 @@ void PeerListContent::initDecorateWidget(Ui::RpWidget *widget) {
|
||||
widget->events(
|
||||
) | rpl::filter([=](not_null<QEvent*> e) {
|
||||
return (e->type() == QEvent::Enter) && widget->isVisible();
|
||||
}) | rpl::start_with_next([=] {
|
||||
}) | rpl::on_next([=] {
|
||||
mouseLeftGeometry();
|
||||
}, widget->lifetime());
|
||||
widget->heightValue() | rpl::skip(1) | rpl::start_with_next([=] {
|
||||
widget->heightValue() | rpl::skip(1) | rpl::on_next([=] {
|
||||
resizeToWidth(width());
|
||||
}, widget->lifetime());
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ object_ptr<Ui::BoxContent> PrepareContactsBox(
|
||||
});
|
||||
raw->setSortMode(Mode::Online);
|
||||
|
||||
raw->wheelClicks() | rpl::start_with_next([=](not_null<PeerData*> p) {
|
||||
raw->wheelClicks() | rpl::on_next([=](not_null<PeerData*> p) {
|
||||
sessionController->showInNewWindow(p);
|
||||
}, box->lifetime());
|
||||
};
|
||||
@@ -385,7 +385,7 @@ void TrackMessageMoneyRestrictionsChanges(
|
||||
rpl::merge(
|
||||
Data::AmPremiumValue(session) | rpl::to_empty,
|
||||
session->api().premium().someMessageMoneyRestrictionsResolved()
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
const auto st = &controller->computeListSt().item;
|
||||
const auto delegate = controller->delegate();
|
||||
const auto process = [&](not_null<PeerListRow*> raw) {
|
||||
@@ -431,18 +431,18 @@ void ChatsListBoxController::prepare() {
|
||||
session().data().chatsListLoadedEvents(
|
||||
) | rpl::filter([=](Data::Folder *folder) {
|
||||
return !folder;
|
||||
}) | rpl::start_with_next([=] {
|
||||
}) | rpl::on_next([=] {
|
||||
checkForEmptyRows();
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
session().data().chatsListChanges(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
rebuildRows();
|
||||
}, lifetime());
|
||||
|
||||
session().data().contactsLoaded().value(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
rebuildRows();
|
||||
}, lifetime());
|
||||
}
|
||||
@@ -586,14 +586,14 @@ void PeerListStories::prepare(not_null<PeerListDelegate*> delegate) {
|
||||
_delegate = delegate;
|
||||
|
||||
_unreadBrush = PeerListStoriesGradient(_controller->computeListSt());
|
||||
style::PaletteChanged() | rpl::start_with_next([=] {
|
||||
style::PaletteChanged() | rpl::on_next([=] {
|
||||
_unreadBrush = PeerListStoriesGradient(_controller->computeListSt());
|
||||
updateColors();
|
||||
}, _lifetime);
|
||||
|
||||
_session->changes().peerUpdates(
|
||||
Data::PeerUpdate::Flag::StoriesState
|
||||
) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
|
||||
) | rpl::on_next([=](const Data::PeerUpdate &update) {
|
||||
const auto id = update.peer->id.value;
|
||||
if (const auto row = _delegate->peerListFindRow(id)) {
|
||||
process(row);
|
||||
@@ -601,7 +601,7 @@ void PeerListStories::prepare(not_null<PeerListDelegate*> delegate) {
|
||||
}, _lifetime);
|
||||
|
||||
const auto stories = &_session->data().stories();
|
||||
stories->sourceChanged() | rpl::start_with_next([=](PeerId id) {
|
||||
stories->sourceChanged() | rpl::on_next([=](PeerId id) {
|
||||
const auto source = stories->source(id);
|
||||
const auto info = source
|
||||
? source->info()
|
||||
@@ -662,7 +662,7 @@ void ContactsBoxController::prepare() {
|
||||
}
|
||||
|
||||
session().data().contactsLoaded().value(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
rebuildRows();
|
||||
}, lifetime());
|
||||
}
|
||||
@@ -724,7 +724,7 @@ void ContactsBoxController::setSortMode(SortMode mode) {
|
||||
) | rpl::filter([=](const Data::PeerUpdate &update) {
|
||||
return !_sortByOnlineTimer.isActive()
|
||||
&& delegate()->peerListFindRow(update.peer->id.value);
|
||||
}) | rpl::start_with_next([=] {
|
||||
}) | rpl::on_next([=] {
|
||||
_sortByOnlineTimer.callOnce(kSortByOnlineThrottle);
|
||||
}, _sortByOnlineLifetime);
|
||||
} else {
|
||||
@@ -788,11 +788,11 @@ RecipientMoneyRestrictionError WriteMoneyRestrictionError(
|
||||
lt_user,
|
||||
TextWithEntities{ user->shortName() },
|
||||
lt_link,
|
||||
Ui::Text::Link(
|
||||
Ui::Text::Bold(
|
||||
tr::link(
|
||||
tr::bold(
|
||||
tr::lng_send_non_premium_message_toast_link(
|
||||
tr::now))),
|
||||
Ui::Text::RichLangValue),
|
||||
tr::rich),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -874,7 +874,7 @@ void ChooseRecipientBoxController::rowClicked(not_null<PeerListRow*> row) {
|
||||
});
|
||||
|
||||
forum->destroyed(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
box->closeBox();
|
||||
}, box->lifetime());
|
||||
});
|
||||
@@ -913,7 +913,7 @@ void ChooseRecipientBoxController::rowClicked(not_null<PeerListRow*> row) {
|
||||
});
|
||||
|
||||
monoforum->destroyed(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
box->closeBox();
|
||||
}, box->lifetime());
|
||||
});
|
||||
@@ -995,7 +995,7 @@ void ChooseTopicSearchController::searchQuery(const QString &query) {
|
||||
void ChooseTopicSearchController::searchOnServer() {
|
||||
_requestId = _api.request(MTPmessages_GetForumTopics(
|
||||
MTP_flags(MTPmessages_GetForumTopics::Flag::f_q),
|
||||
_forum->peer()->input,
|
||||
_forum->peer()->input(),
|
||||
MTP_string(_query),
|
||||
MTP_int(_offsetDate),
|
||||
MTP_int(_offsetId),
|
||||
@@ -1098,12 +1098,12 @@ ChooseTopicBoxController::ChooseTopicBoxController(
|
||||
setStyleOverrides(&st::chooseTopicList);
|
||||
|
||||
_forum->chatsListChanges(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
refreshRows();
|
||||
}, lifetime());
|
||||
|
||||
_forum->topicDestroyed(
|
||||
) | rpl::start_with_next([=](not_null<Data::ForumTopic*> topic) {
|
||||
) | rpl::on_next([=](not_null<Data::ForumTopic*> topic) {
|
||||
const auto id = PeerListRowId(topic->rootId().bare);
|
||||
if (const auto row = delegate()->peerListFindRow(id)) {
|
||||
delegate()->peerListRemoveRow(row);
|
||||
@@ -1133,7 +1133,7 @@ void ChooseTopicBoxController::prepare() {
|
||||
|
||||
session().changes().entryUpdates(
|
||||
Data::EntryUpdate::Flag::Repaint
|
||||
) | rpl::start_with_next([=](const Data::EntryUpdate &update) {
|
||||
) | rpl::on_next([=](const Data::EntryUpdate &update) {
|
||||
if (const auto topic = update.entry->asTopic()) {
|
||||
if (topic->forum() == _forum) {
|
||||
const auto id = topic->rootId().bare;
|
||||
@@ -1200,12 +1200,12 @@ ChooseSublistBoxController::ChooseSublistBoxController(
|
||||
setStyleOverrides(&st::chooseTopicList);
|
||||
|
||||
_monoforum->chatsListChanges(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
refreshRows();
|
||||
}, lifetime());
|
||||
|
||||
_monoforum->sublistDestroyed(
|
||||
) | rpl::start_with_next([=](not_null<Data::SavedSublist*> sublist) {
|
||||
) | rpl::on_next([=](not_null<Data::SavedSublist*> sublist) {
|
||||
const auto id = sublist->sublistPeer()->id.value;
|
||||
if (const auto row = delegate()->peerListFindRow(id)) {
|
||||
delegate()->peerListRemoveRow(row);
|
||||
@@ -1235,7 +1235,7 @@ void ChooseSublistBoxController::prepare() {
|
||||
|
||||
session().changes().entryUpdates(
|
||||
Data::EntryUpdate::Flag::Repaint
|
||||
) | rpl::start_with_next([=](const Data::EntryUpdate &update) {
|
||||
) | rpl::on_next([=](const Data::EntryUpdate &update) {
|
||||
if (const auto sublist = update.entry->asSublist()) {
|
||||
if (sublist->parent() == _monoforum) {
|
||||
const auto id = sublist->sublistPeer()->id.value;
|
||||
|
||||
@@ -25,7 +25,7 @@ PeerListWidgets::PeerListWidgets(
|
||||
, _controller(controller)
|
||||
, _st(controller->computeListSt()) {
|
||||
_content = base::make_unique_q<Ui::VerticalLayout>(this);
|
||||
parent->sizeValue() | rpl::start_with_next([this](const QSize &size) {
|
||||
parent->sizeValue() | rpl::on_next([this](const QSize &size) {
|
||||
_content->resizeToWidth(size.width());
|
||||
resize(size.width(), _content->height());
|
||||
}, lifetime());
|
||||
@@ -129,7 +129,7 @@ void PeerListWidgets::appendRow(std::unique_ptr<PeerListRow> row) {
|
||||
st.button.ripple,
|
||||
st.button.textBgOver)));
|
||||
widget->resize(widget->width(), st.height);
|
||||
widget->paintRequest() | rpl::start_with_next([=, this] {
|
||||
widget->paintRequest() | rpl::on_next([=, this] {
|
||||
auto p = Painter(widget);
|
||||
const auto selected = widget->isOver() || widget->isDown();
|
||||
paintRow(p, crl::now(), selected, raw);
|
||||
|
||||
@@ -90,7 +90,7 @@ void PeerListsBox::createMultiSelect() {
|
||||
tr::lng_participant_filter());
|
||||
_select.create(this, std::move(entity));
|
||||
_select->heightValue(
|
||||
) | rpl::start_with_next(
|
||||
) | rpl::on_next(
|
||||
[this] { updateScrollSkips(); },
|
||||
lifetime());
|
||||
_select->entity()->setSubmittedCallback([=](Qt::KeyboardModifiers) {
|
||||
@@ -158,7 +158,7 @@ void PeerListsBox::prepare() {
|
||||
list.controller->setDelegate(list.delegate.get());
|
||||
|
||||
content->scrollToRequests(
|
||||
) | rpl::start_with_next([=](Ui::ScrollToRequest request) {
|
||||
) | rpl::on_next([=](Ui::ScrollToRequest request) {
|
||||
const auto skip = content->y();
|
||||
scrollToY(
|
||||
skip + request.ymin,
|
||||
@@ -168,7 +168,7 @@ void PeerListsBox::prepare() {
|
||||
content->selectedIndexValue(
|
||||
) | rpl::filter([=](int index) {
|
||||
return (index >= 0);
|
||||
}) | rpl::start_with_next([=] {
|
||||
}) | rpl::on_next([=] {
|
||||
for (const auto &list : _lists) {
|
||||
if (list.content && list.content != content) {
|
||||
list.content->clearSelection();
|
||||
|
||||
@@ -65,7 +65,7 @@ Controller::Controller(
|
||||
, _callback(std::move(callback)) {
|
||||
std::move(
|
||||
add
|
||||
) | rpl::start_with_next([=](not_null<PeerData*> peer) {
|
||||
) | rpl::on_next([=](not_null<PeerData*> peer) {
|
||||
if (_prepared) {
|
||||
addRow(peer);
|
||||
} else {
|
||||
@@ -163,8 +163,8 @@ void AddBotToGroupBoxController::requestExistingRights(
|
||||
_bot->session().api().request(_existingRightsRequestId).cancel();
|
||||
_existingRightsRequestId = _bot->session().api().request(
|
||||
MTPchannels_GetParticipant(
|
||||
_existingRightsChannel->inputChannel,
|
||||
_bot->input)
|
||||
_existingRightsChannel->inputChannel(),
|
||||
_bot->input())
|
||||
).done([=](const MTPchannels_ChannelParticipant &result) {
|
||||
result.match([&](const MTPDchannels_channelParticipant &data) {
|
||||
channel->owner().processUsers(data.vusers());
|
||||
@@ -359,7 +359,7 @@ object_ptr<Ui::RpWidget> AddBotToGroupBoxController::prepareAdminnedChats() {
|
||||
delegate->setContent(content);
|
||||
controller->setDelegate(delegate);
|
||||
|
||||
items.events() | rpl::take(1) | rpl::start_with_next([=] {
|
||||
items.events() | rpl::take(1) | rpl::on_next([=] {
|
||||
wrap->show(anim::type::instant);
|
||||
}, inner->lifetime());
|
||||
};
|
||||
@@ -373,7 +373,7 @@ object_ptr<Ui::RpWidget> AddBotToGroupBoxController::prepareAdminnedChats() {
|
||||
rpl::merge(
|
||||
_groups.events(),
|
||||
_channels.events()
|
||||
) | rpl::take(1) | rpl::start_with_next([=] {
|
||||
) | rpl::take(1) | rpl::on_next([=] {
|
||||
container->add(CreatePeerListSectionSubtitle(
|
||||
container,
|
||||
tr::lng_bot_groups()));
|
||||
@@ -403,7 +403,7 @@ void AddBotToGroupBoxController::prepareViewHook() {
|
||||
session().data().chatsListLoadedEvents(
|
||||
) | rpl::filter([=](Data::Folder *folder) {
|
||||
return !folder;
|
||||
}) | rpl::start_with_next([=] {
|
||||
}) | rpl::on_next([=] {
|
||||
updateLabels();
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/boxes/confirm_box.h"
|
||||
#include "ui/boxes/show_or_premium_box.h"
|
||||
#include "ui/effects/premium_graphics.h"
|
||||
#include "ui/text/text_utilities.h" // Ui::Text::RichLangValue
|
||||
#include "ui/text/text_utilities.h" // tr::rich
|
||||
#include "ui/toast/toast.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
@@ -191,17 +191,17 @@ void FillUpgradeToPremiumCover(
|
||||
for (auto i = 0; i != names; ++i) {
|
||||
const auto name = userpicUsers[i]->shortName();
|
||||
if (text.empty()) {
|
||||
text = Ui::Text::Bold(name);
|
||||
text = tr::bold(name);
|
||||
} else if (i == names - 1 && !remaining) {
|
||||
text = tr::lng_invite_upgrade_users_few(
|
||||
tr::now,
|
||||
lt_users,
|
||||
text,
|
||||
lt_last,
|
||||
Ui::Text::Bold(name),
|
||||
Ui::Text::RichLangValue);
|
||||
tr::bold(name),
|
||||
tr::rich);
|
||||
} else {
|
||||
text.append(", ").append(Ui::Text::Bold(name));
|
||||
text.append(", ").append(tr::bold(name));
|
||||
}
|
||||
}
|
||||
if (remaining > 0) {
|
||||
@@ -211,7 +211,7 @@ void FillUpgradeToPremiumCover(
|
||||
remaining,
|
||||
lt_users,
|
||||
text,
|
||||
Ui::Text::RichLangValue);
|
||||
tr::rich);
|
||||
}
|
||||
const auto inviteOnly = !forbidden.premiumAllowsInvite.empty()
|
||||
&& (forbidden.premiumAllowsWrite.size() != forbidden.users.size());
|
||||
@@ -227,7 +227,7 @@ void FillUpgradeToPremiumCover(
|
||||
int(userpicUsers.size()),
|
||||
lt_users,
|
||||
text,
|
||||
Ui::Text::RichLangValue);
|
||||
tr::rich);
|
||||
container->add(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
@@ -273,7 +273,7 @@ void SimpleForbiddenBox(
|
||||
|
||||
Data::AmPremiumValue(
|
||||
&peer->session()
|
||||
) | rpl::skip(1) | rpl::start_with_next([=] {
|
||||
) | rpl::skip(1) | rpl::on_next([=] {
|
||||
box->closeBox();
|
||||
}, box->lifetime());
|
||||
}
|
||||
@@ -474,11 +474,11 @@ void InviteForbiddenController::setSimpleCover() {
|
||||
? phraseCounted(
|
||||
lt_count,
|
||||
rpl::single<float64>(count),
|
||||
Ui::Text::RichLangValue)
|
||||
tr::rich)
|
||||
: phraseNamed(
|
||||
lt_user,
|
||||
rpl::single(TextWithEntities{ _users.front()->name() }),
|
||||
Ui::Text::RichLangValue);
|
||||
tr::rich);
|
||||
delegate()->peerListSetAboveWidget(object_ptr<Ui::PaddingWrap<>>(
|
||||
(QWidget*)nullptr,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
@@ -530,18 +530,18 @@ void InviteForbiddenController::setComplexCover() {
|
||||
? tr::lng_invite_upgrade_via_channel_about
|
||||
: tr::lng_invite_upgrade_via_group_about)(
|
||||
tr::now,
|
||||
Ui::Text::WithEntities)
|
||||
tr::marked)
|
||||
: (_forbidden.users.size() == 1
|
||||
? tr::lng_via_link_cant_one(
|
||||
tr::now,
|
||||
lt_user,
|
||||
TextWithEntities{ _forbidden.users.front()->shortName() },
|
||||
Ui::Text::RichLangValue)
|
||||
tr::rich)
|
||||
: tr::lng_via_link_cant_many(
|
||||
tr::now,
|
||||
lt_count,
|
||||
int(_forbidden.users.size()),
|
||||
Ui::Text::RichLangValue));
|
||||
tr::rich));
|
||||
container->add(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
@@ -555,7 +555,7 @@ void InviteForbiddenController::setComplexCover() {
|
||||
|
||||
void InviteForbiddenController::prepare() {
|
||||
session().api().premium().someMessageMoneyRestrictionsResolved(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
auto stars = 0;
|
||||
const auto process = [&](not_null<PeerListRow*> raw) {
|
||||
const auto row = static_cast<ForbiddenRow*>(raw.get());
|
||||
@@ -667,7 +667,7 @@ void InviteForbiddenController::send(
|
||||
if (!waiting.empty()) {
|
||||
session().changes().peerUpdates(
|
||||
Data::PeerUpdate::Flag::FullInfo
|
||||
) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
|
||||
) | rpl::on_next([=](const Data::PeerUpdate &update) {
|
||||
if (waiting.contains(update.peer)) {
|
||||
withPaymentApproved(alreadyApproved);
|
||||
}
|
||||
@@ -677,7 +677,7 @@ void InviteForbiddenController::send(
|
||||
session().credits().loadedValue(
|
||||
) | rpl::filter(
|
||||
rpl::mappers::_1
|
||||
) | rpl::take(1) | rpl::start_with_next([=] {
|
||||
) | rpl::take(1) | rpl::on_next([=] {
|
||||
withPaymentApproved(alreadyApproved);
|
||||
}, _paymentCheckLifetime);
|
||||
}
|
||||
@@ -721,12 +721,12 @@ void InviteForbiddenController::send(
|
||||
tr::now,
|
||||
lt_user,
|
||||
TextWithEntities{ list.front()->name() },
|
||||
Ui::Text::RichLangValue)
|
||||
tr::rich)
|
||||
: tr::lng_via_link_shared_many(
|
||||
tr::now,
|
||||
lt_count,
|
||||
int(list.size()),
|
||||
Ui::Text::RichLangValue);
|
||||
tr::rich);
|
||||
close();
|
||||
show->showToast(std::move(text));
|
||||
return true;
|
||||
@@ -750,7 +750,7 @@ void InviteForbiddenController::send(
|
||||
_peer->session().changes().peerUpdates(
|
||||
_peer,
|
||||
Data::PeerUpdate::Flag::FullInfo
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
sendForFull();
|
||||
}, lifetime());
|
||||
}
|
||||
@@ -926,7 +926,7 @@ void AddParticipantsBoxController::addInviteLinkButton() {
|
||||
st::inviteViaLinkIcon,
|
||||
QPoint());
|
||||
button->entity()->heightValue(
|
||||
) | rpl::start_with_next([=](int height) {
|
||||
) | rpl::on_next([=](int height) {
|
||||
icon->moveToLeft(
|
||||
st::inviteViaLinkIconPosition.x(),
|
||||
(height - st::inviteViaLinkIcon.height()) / 2);
|
||||
@@ -938,7 +938,7 @@ void AddParticipantsBoxController::addInviteLinkButton() {
|
||||
button->entity()->events(
|
||||
) | rpl::filter([=](not_null<QEvent*> e) {
|
||||
return (e->type() == QEvent::Enter);
|
||||
}) | rpl::start_with_next([=] {
|
||||
}) | rpl::on_next([=] {
|
||||
delegate()->peerListMouseLeftGeometry();
|
||||
}, button->lifetime());
|
||||
delegate()->peerListSetAboveWidget(std::move(button));
|
||||
@@ -989,14 +989,14 @@ void AddParticipantsBoxController::inviteSelectedUsers(
|
||||
{ users.front()->name()},
|
||||
lt_group,
|
||||
{ _peer->name()},
|
||||
Ui::Text::RichLangValue)
|
||||
tr::rich)
|
||||
: tr::lng_participant_invite_sure_many(
|
||||
tr::now,
|
||||
lt_count,
|
||||
int(users.size()),
|
||||
lt_group,
|
||||
{ _peer->name() },
|
||||
Ui::Text::RichLangValue);
|
||||
tr::rich);
|
||||
Ui::ConfirmBox(box, {
|
||||
.text = std::move(text),
|
||||
.confirmed = crl::guard(weak, [=](Fn<void()> &&close) {
|
||||
@@ -1062,7 +1062,7 @@ void AddParticipantsBoxController::Start(
|
||||
[=] { box->closeBox(); });
|
||||
if (justCreated) {
|
||||
const auto weak = base::make_weak(parent);
|
||||
box->boxClosing() | rpl::start_with_next([=] {
|
||||
box->boxClosing() | rpl::on_next([=] {
|
||||
auto params = Window::SectionShow();
|
||||
params.activation = anim::activation::background;
|
||||
if (const auto strong = weak.get()) {
|
||||
@@ -1145,7 +1145,7 @@ bool ChatInviteForbidden(
|
||||
) | rpl::map(
|
||||
rpl::mappers::_1 > 0
|
||||
) | rpl::distinct_until_changed(
|
||||
) | rpl::start_with_next([=](bool has) {
|
||||
) | rpl::on_next([=](bool has) {
|
||||
box->clearButtons();
|
||||
if (has) {
|
||||
const auto send = box->addButton(tr::lng_via_link_send(), [=] {
|
||||
@@ -1165,7 +1165,7 @@ bool ChatInviteForbidden(
|
||||
|
||||
Data::AmPremiumValue(
|
||||
&peer->session()
|
||||
) | rpl::skip(1) | rpl::start_with_next([=] {
|
||||
) | rpl::skip(1) | rpl::on_next([=] {
|
||||
box->closeBox();
|
||||
}, box->lifetime());
|
||||
};
|
||||
@@ -1272,7 +1272,7 @@ void AddSpecialBoxController::prepareChatRows(not_null<ChatData*> chat) {
|
||||
chat->session().changes().peerUpdates(
|
||||
chat,
|
||||
UpdateFlag::Members | UpdateFlag::Admins
|
||||
) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
|
||||
) | rpl::on_next([=](const Data::PeerUpdate &update) {
|
||||
_additional.fillFromPeer();
|
||||
if (update.flags & UpdateFlag::Members) {
|
||||
rebuildChatRows(chat);
|
||||
@@ -1330,7 +1330,7 @@ void AddSpecialBoxController::loadMoreRows() {
|
||||
const auto channel = _peer->asChannel();
|
||||
|
||||
_loadRequestId = _api.request(MTPchannels_GetParticipants(
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
MTP_channelParticipantsRecent(),
|
||||
MTP_int(_offset),
|
||||
MTP_int(perPage),
|
||||
@@ -1393,8 +1393,8 @@ bool AddSpecialBoxController::checkInfoLoaded(
|
||||
// We don't know what this user status is in the group.
|
||||
const auto channel = _peer->asChannel();
|
||||
_api.request(MTPchannels_GetParticipant(
|
||||
channel->inputChannel,
|
||||
participant->input
|
||||
channel->inputChannel(),
|
||||
participant->input()
|
||||
)).done([=](const MTPchannels_ChannelParticipant &result) {
|
||||
result.match([&](const MTPDchannels_channelParticipant &data) {
|
||||
channel->owner().processUsers(data.vusers());
|
||||
@@ -1800,7 +1800,7 @@ void AddSpecialBoxSearchController::requestParticipants() {
|
||||
const auto channel = _peer->asChannel();
|
||||
|
||||
_requestId = _api.request(MTPchannels_GetParticipants(
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
MTP_channelParticipantsSearch(MTP_string(_query)),
|
||||
MTP_int(_offset),
|
||||
MTP_int(perPage),
|
||||
|
||||
@@ -202,10 +202,10 @@ object_ptr<Ui::BoxContent> MakeConfirmBox(
|
||||
auto text = tr::lng_request_peer_confirm(
|
||||
tr::now,
|
||||
lt_chat,
|
||||
Ui::Text::Bold(name),
|
||||
tr::bold(name),
|
||||
lt_bot,
|
||||
Ui::Text::Bold(botName),
|
||||
Ui::Text::WithEntities);
|
||||
tr::bold(botName),
|
||||
tr::marked);
|
||||
if (!peer->isUser()) {
|
||||
const auto rights = peer->isBroadcast()
|
||||
? BroadcastRightsText(query.botRights)
|
||||
@@ -215,12 +215,12 @@ object_ptr<Ui::BoxContent> MakeConfirmBox(
|
||||
tr::lng_request_peer_confirm_rights(
|
||||
tr::now,
|
||||
lt_bot,
|
||||
Ui::Text::Bold(botName),
|
||||
tr::bold(botName),
|
||||
lt_chat,
|
||||
Ui::Text::Bold(name),
|
||||
tr::bold(name),
|
||||
lt_rights,
|
||||
TextWithEntities{ rights },
|
||||
Ui::Text::WithEntities));
|
||||
tr::marked));
|
||||
} else if (!peer->isBroadcast() && query.isBotParticipant) {
|
||||
const auto common = bot->session().api().botCommonGroups(bot);
|
||||
if (!common || !ranges::contains(*common, peer)) {
|
||||
@@ -228,10 +228,10 @@ object_ptr<Ui::BoxContent> MakeConfirmBox(
|
||||
tr::lng_request_peer_confirm_add(
|
||||
tr::now,
|
||||
lt_bot,
|
||||
Ui::Text::Bold(botName),
|
||||
tr::bold(botName),
|
||||
lt_chat,
|
||||
Ui::Text::Bold(name),
|
||||
Ui::Text::WithEntities));
|
||||
tr::bold(name),
|
||||
tr::marked));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -373,7 +373,7 @@ void ChoosePeerBoxController::prepareRestrictions() {
|
||||
st,
|
||||
QPoint());
|
||||
button->heightValue(
|
||||
) | rpl::start_with_next([=](int height) {
|
||||
) | rpl::on_next([=](int height) {
|
||||
icon->moveToLeft(
|
||||
st::choosePeerCreateIconLeft,
|
||||
(height - st::inviteViaLinkIcon.height()) / 2);
|
||||
@@ -387,7 +387,7 @@ void ChoosePeerBoxController::prepareRestrictions() {
|
||||
button->events(
|
||||
) | rpl::filter([=](not_null<QEvent*> e) {
|
||||
return (e->type() == QEvent::Enter);
|
||||
}) | rpl::start_with_next([=] {
|
||||
}) | rpl::on_next([=] {
|
||||
delegate()->peerListMouseLeftGeometry();
|
||||
}, button->lifetime());
|
||||
return button;
|
||||
@@ -522,7 +522,7 @@ void ShowChoosePeerBox(
|
||||
query,
|
||||
std::move(callback));
|
||||
auto initBox = [=, ptr = controller.get()](not_null<PeerListBox*> box) {
|
||||
ptr->selectedCountValue() | rpl::start_with_next([=](int count) {
|
||||
ptr->selectedCountValue() | rpl::on_next([=](int count) {
|
||||
box->clearButtons();
|
||||
if (limit > 1) {
|
||||
box->setAdditionalTitle(rpl::single(u"%1 / %2"_q.arg(count).arg(limit)));
|
||||
|
||||
@@ -92,7 +92,7 @@ void SendRequest(
|
||||
user->session().api().request(MTPcontacts_AddContact(
|
||||
MTP_flags(Flag::f_note
|
||||
| (sharePhone ? Flag::f_add_phone_privacy_exception : Flag(0))),
|
||||
user->inputUser,
|
||||
user->inputUser(),
|
||||
MTP_string(first),
|
||||
MTP_string(last),
|
||||
MTP_string(phone),
|
||||
@@ -348,8 +348,8 @@ void Controller::initNameFields(
|
||||
_save();
|
||||
}
|
||||
};
|
||||
first->submits() | rpl::start_with_next(submit, first->lifetime());
|
||||
last->submits() | rpl::start_with_next(submit, last->lifetime());
|
||||
first->submits() | rpl::on_next(submit, first->lifetime());
|
||||
last->submits() | rpl::on_next(submit, last->lifetime());
|
||||
first->setMaxLength(Ui::EditPeer::kMaxUserFirstLastName);
|
||||
first->setMaxLength(Ui::EditPeer::kMaxUserFirstLastName);
|
||||
}
|
||||
@@ -418,11 +418,11 @@ void Controller::setupNotesField() {
|
||||
_emojiPanel->hide();
|
||||
_emojiPanel->selector()->setCurrentPeer(_window->session().user());
|
||||
_emojiPanel->selector()->emojiChosen(
|
||||
) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) {
|
||||
) | rpl::on_next([=](ChatHelpers::EmojiChosen data) {
|
||||
Ui::InsertEmojiAtCursor(_notesField->textCursor(), data.emoji);
|
||||
}, _notesField->lifetime());
|
||||
_emojiPanel->selector()->customEmojiChosen(
|
||||
) | rpl::start_with_next([=](ChatHelpers::FileChosen data) {
|
||||
) | rpl::on_next([=](ChatHelpers::FileChosen data) {
|
||||
const auto info = data.document->sticker();
|
||||
if (info
|
||||
&& info->setType == Data::StickersType::Emoji
|
||||
@@ -464,7 +464,7 @@ void Controller::setupNotesField() {
|
||||
rpl::combine(
|
||||
limitState->charsLimitation->geometryValue(),
|
||||
_notesField->geometryValue()
|
||||
) | rpl::start_with_next([=](QRect limit, QRect field) {
|
||||
) | rpl::on_next([=](QRect limit, QRect field) {
|
||||
limitState->charsLimitation->setVisible(
|
||||
(w->mapToGlobal(limit.bottomLeft()).y() - border)
|
||||
< w->mapToGlobal(field.bottomLeft()).y());
|
||||
@@ -474,7 +474,7 @@ void Controller::setupNotesField() {
|
||||
limitState->charsLimitation->setLeft(remove);
|
||||
};
|
||||
|
||||
_notesField->changes() | rpl::start_with_next([=] {
|
||||
_notesField->changes() | rpl::on_next([=] {
|
||||
checkCharsLimitation();
|
||||
}, _notesField->lifetime());
|
||||
|
||||
@@ -496,7 +496,7 @@ void Controller::setupPhotoButtons() {
|
||||
})) | rpl::map([=](const QString &text) {
|
||||
return text.isEmpty() ? Ui::kQEllipsis : text;
|
||||
})
|
||||
: rpl::single(_user->shortName()) | rpl::type_erased();
|
||||
: rpl::single(_user->shortName()) | rpl::type_erased;
|
||||
const auto inner = _box->verticalLayout();
|
||||
Ui::AddSkip(inner);
|
||||
|
||||
@@ -558,7 +558,7 @@ void Controller::setupPhotoButtons() {
|
||||
|
||||
_suggestIconWidget = Ui::CreateChild<Ui::RpWidget>(suggestButton);
|
||||
_suggestIconWidget->resize(iconPlaceholder);
|
||||
_suggestIconWidget->paintRequest() | rpl::start_with_next([=] {
|
||||
_suggestIconWidget->paintRequest() | rpl::on_next([=] {
|
||||
if (_suggestIcon && _suggestIcon->valid()) {
|
||||
auto p = QPainter(_suggestIconWidget);
|
||||
const auto frame = _suggestIcon->frame(st::lightButtonFg->c);
|
||||
@@ -566,7 +566,7 @@ void Controller::setupPhotoButtons() {
|
||||
}
|
||||
}, _suggestIconWidget->lifetime());
|
||||
|
||||
suggestButton->sizeValue() | rpl::start_with_next([=](QSize size) {
|
||||
suggestButton->sizeValue() | rpl::on_next([=](QSize size) {
|
||||
_suggestIconWidget->move(
|
||||
st::settingsButtonLight.iconLeft - iconPlaceholder.width() / 4,
|
||||
(size.height() - _suggestIconWidget->height()) / 2);
|
||||
@@ -590,7 +590,7 @@ void Controller::setupPhotoButtons() {
|
||||
|
||||
_cameraIconWidget = Ui::CreateChild<Ui::RpWidget>(setButton);
|
||||
_cameraIconWidget->resize(iconPlaceholder);
|
||||
_cameraIconWidget->paintRequest() | rpl::start_with_next([=] {
|
||||
_cameraIconWidget->paintRequest() | rpl::on_next([=] {
|
||||
if (_cameraIcon && _cameraIcon->valid()) {
|
||||
auto p = QPainter(_cameraIconWidget);
|
||||
const auto frame = _cameraIcon->frame(st::lightButtonFg->c);
|
||||
@@ -598,7 +598,7 @@ void Controller::setupPhotoButtons() {
|
||||
}
|
||||
}, _cameraIconWidget->lifetime());
|
||||
|
||||
setButton->sizeValue() | rpl::start_with_next([=](QSize size) {
|
||||
setButton->sizeValue() | rpl::on_next([=](QSize size) {
|
||||
_cameraIconWidget->move(
|
||||
st::settingsButtonLight.iconLeft - iconPlaceholder.width() / 4,
|
||||
(size.height() - _cameraIconWidget->height()) / 2);
|
||||
@@ -635,7 +635,7 @@ void Controller::setupPhotoButtons() {
|
||||
userpicButton->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
|
||||
resetButton->sizeValue(
|
||||
) | rpl::start_with_next([=](QSize size) {
|
||||
) | rpl::on_next([=](QSize size) {
|
||||
userpicButton->move(
|
||||
st::settingsButtonLight.iconLeft,
|
||||
(size.height() - userpicButton->height()) / 2);
|
||||
@@ -688,7 +688,7 @@ void Controller::setupDeleteContactButton() {
|
||||
const auto deleteSure = [=](Fn<void()> &&close) {
|
||||
close();
|
||||
_user->session().api().request(MTPcontacts_DeleteContacts(
|
||||
MTP_vector<MTPInputUser>(1, _user->inputUser)
|
||||
MTP_vector<MTPInputUser>(1, _user->inputUser())
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
_user->session().api().applyUpdates(result);
|
||||
_box->closeBox();
|
||||
@@ -751,13 +751,13 @@ void Controller::showPhotoMenu(bool suggest) {
|
||||
? tr::lng_profile_suggest_sure(
|
||||
tr::now,
|
||||
lt_user,
|
||||
Ui::Text::Bold(_user->shortName()),
|
||||
Ui::Text::WithEntities)
|
||||
tr::bold(_user->shortName()),
|
||||
tr::marked)
|
||||
: tr::lng_profile_set_personal_sure(
|
||||
tr::now,
|
||||
lt_user,
|
||||
Ui::Text::Bold(_user->shortName()),
|
||||
Ui::Text::WithEntities)),
|
||||
tr::bold(_user->shortName()),
|
||||
tr::marked)),
|
||||
.confirm = (suggest
|
||||
? tr::lng_profile_suggest_button(tr::now)
|
||||
: tr::lng_profile_set_photo_button(tr::now)),
|
||||
@@ -798,13 +798,13 @@ void Controller::choosePhotoFile(bool suggest) {
|
||||
? tr::lng_profile_suggest_sure(
|
||||
tr::now,
|
||||
lt_user,
|
||||
Ui::Text::Bold(_user->shortName()),
|
||||
Ui::Text::WithEntities)
|
||||
tr::bold(_user->shortName()),
|
||||
tr::marked)
|
||||
: tr::lng_profile_set_personal_sure(
|
||||
tr::now,
|
||||
lt_user,
|
||||
Ui::Text::Bold(_user->shortName()),
|
||||
Ui::Text::WithEntities)),
|
||||
tr::bold(_user->shortName()),
|
||||
tr::marked)),
|
||||
.confirm = (suggest
|
||||
? tr::lng_profile_suggest_button(tr::now)
|
||||
: tr::lng_profile_set_photo_button(tr::now)),
|
||||
|
||||
@@ -16,7 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/vertical_list.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "ui/text/text_utilities.h" // Ui::Text::RichLangValue
|
||||
#include "ui/text/text_utilities.h" // tr::rich
|
||||
#include "boxes/peer_list_box.h"
|
||||
#include "ui/boxes/confirm_box.h"
|
||||
#include "boxes/add_contact_box.h"
|
||||
@@ -81,7 +81,7 @@ Controller::Controller(
|
||||
Data::PeerUpdate::Flag::FullInfo
|
||||
) | rpl::filter([=](const Data::PeerUpdate &update) {
|
||||
return (update.peer == _waitForFull);
|
||||
}) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
|
||||
}) | rpl::on_next([=](const Data::PeerUpdate &update) {
|
||||
choose(std::exchange(_waitForFull, nullptr));
|
||||
}, lifetime());
|
||||
}
|
||||
@@ -146,10 +146,10 @@ void Controller::choose(not_null<ChannelData*> chat) {
|
||||
auto text = tr::lng_manage_discussion_group_sure(
|
||||
tr::now,
|
||||
lt_group,
|
||||
Ui::Text::Bold(chat->name()),
|
||||
tr::bold(chat->name()),
|
||||
lt_channel,
|
||||
Ui::Text::Bold(_channel->name()),
|
||||
Ui::Text::WithEntities);
|
||||
tr::bold(_channel->name()),
|
||||
tr::marked);
|
||||
if (!_channel->isPublic()) {
|
||||
text.append(
|
||||
"\n\n" + tr::lng_manage_linked_channel_private(tr::now));
|
||||
@@ -161,7 +161,7 @@ void Controller::choose(not_null<ChannelData*> chat) {
|
||||
text.append("\n\n");
|
||||
text.append(tr::lng_manage_discussion_group_warning(
|
||||
tr::now,
|
||||
Ui::Text::RichLangValue));
|
||||
tr::rich));
|
||||
}
|
||||
}
|
||||
const auto sure = [=](Fn<void()> &&close) {
|
||||
@@ -180,10 +180,10 @@ void Controller::choose(not_null<ChatData*> chat) {
|
||||
auto text = tr::lng_manage_discussion_group_sure(
|
||||
tr::now,
|
||||
lt_group,
|
||||
Ui::Text::Bold(chat->name()),
|
||||
tr::bold(chat->name()),
|
||||
lt_channel,
|
||||
Ui::Text::Bold(_channel->name()),
|
||||
Ui::Text::WithEntities);
|
||||
tr::bold(_channel->name()),
|
||||
tr::marked);
|
||||
if (!_channel->isPublic()) {
|
||||
text.append("\n\n" + tr::lng_manage_linked_channel_private(tr::now));
|
||||
}
|
||||
@@ -191,7 +191,7 @@ void Controller::choose(not_null<ChatData*> chat) {
|
||||
text.append("\n\n");
|
||||
text.append(tr::lng_manage_discussion_group_warning(
|
||||
tr::now,
|
||||
Ui::Text::RichLangValue));
|
||||
tr::rich));
|
||||
const auto sure = [=](Fn<void()> &&close) {
|
||||
close();
|
||||
const auto done = [=](not_null<ChannelData*> chat) {
|
||||
@@ -213,15 +213,15 @@ void Controller::choose(not_null<ChatData*> chat) {
|
||||
if (!channel->isBroadcast()) {
|
||||
return tr::lng_manage_linked_channel_about(
|
||||
lt_channel,
|
||||
rpl::single(Ui::Text::Bold(chat->name())),
|
||||
Ui::Text::WithEntities);
|
||||
rpl::single(tr::bold(chat->name())),
|
||||
tr::marked);
|
||||
} else if (chat != nullptr) {
|
||||
return tr::lng_manage_discussion_group_about_chosen(
|
||||
lt_group,
|
||||
rpl::single(Ui::Text::Bold(chat->name())),
|
||||
Ui::Text::WithEntities);
|
||||
rpl::single(tr::bold(chat->name())),
|
||||
tr::marked);
|
||||
}
|
||||
return tr::lng_manage_discussion_group_about(Ui::Text::WithEntities);
|
||||
return tr::lng_manage_discussion_group_about(tr::marked);
|
||||
}
|
||||
|
||||
[[nodiscard]] object_ptr<Ui::BoxContent> EditDiscussionLinkBox(
|
||||
@@ -361,5 +361,5 @@ void ShowForumForDiscussionError(
|
||||
navigation->showToast(
|
||||
tr::lng_forum_topics_no_discussion(
|
||||
tr::now,
|
||||
Ui::Text::RichLangValue));
|
||||
tr::rich));
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ DefaultIconEmoji::DefaultIconEmoji(
|
||||
Fn<void()> repaint,
|
||||
Data::CustomEmojiSizeTag tag)
|
||||
: _tag(tag) {
|
||||
std::move(value) | rpl::start_with_next([=](DefaultIcon value) {
|
||||
std::move(value) | rpl::on_next([=](DefaultIcon value) {
|
||||
_icon = value;
|
||||
_image = QImage();
|
||||
if (repaint) {
|
||||
@@ -164,7 +164,7 @@ bool DefaultIconEmoji::readyInDefaultState() {
|
||||
|
||||
std::move(
|
||||
iconId
|
||||
) | rpl::start_with_next([=](DocumentId id) {
|
||||
) | rpl::on_next([=](DocumentId id) {
|
||||
const auto owner = &controller->session().data();
|
||||
state->icon = id
|
||||
? owner->customEmojiManager().create(
|
||||
@@ -177,7 +177,7 @@ bool DefaultIconEmoji::readyInDefaultState() {
|
||||
|
||||
std::move(
|
||||
defaultIcon
|
||||
) | rpl::start_with_next([=](DefaultIcon icon) {
|
||||
) | rpl::on_next([=](DefaultIcon icon) {
|
||||
state->defaultIcon = Data::ForumTopicIconFrame(
|
||||
icon.colorId,
|
||||
icon.title,
|
||||
@@ -189,7 +189,7 @@ bool DefaultIconEmoji::readyInDefaultState() {
|
||||
result->paintRequest(
|
||||
) | rpl::filter([=] {
|
||||
return !paintIconFrame(result);
|
||||
}) | rpl::start_with_next([=](QRect clip) {
|
||||
}) | rpl::on_next([=](QRect clip) {
|
||||
auto args = Ui::Text::CustomEmoji::Context{
|
||||
.textColor = st::windowFg->c,
|
||||
.now = crl::now(),
|
||||
@@ -222,7 +222,7 @@ bool DefaultIconEmoji::readyInDefaultState() {
|
||||
|
||||
rpl::single(rpl::empty) | rpl::then(
|
||||
style::PaletteChanged()
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
state->frame = Data::ForumTopicGeneralIconFrame(
|
||||
st::largeForumTopicIcon.size,
|
||||
st::windowSubTextFg->c);
|
||||
@@ -231,7 +231,7 @@ bool DefaultIconEmoji::readyInDefaultState() {
|
||||
|
||||
result->resize(size, size);
|
||||
result->paintRequest(
|
||||
) | rpl::start_with_next([=](QRect clip) {
|
||||
) | rpl::on_next([=](QRect clip) {
|
||||
auto p = QPainter(result);
|
||||
const auto skip = (size - st::largeForumTopicIcon.size) / 2;
|
||||
p.drawImage(skip, skip, state->frame);
|
||||
@@ -300,7 +300,7 @@ struct IconSelector {
|
||||
|
||||
icons->requestDefaultIfUnknown();
|
||||
icons->defaultUpdates(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
selector->provideRecent(DocumentListToRecent(recent()));
|
||||
}, selector->lifetime());
|
||||
|
||||
@@ -312,14 +312,14 @@ struct IconSelector {
|
||||
rpl::combine(
|
||||
rpl::duplicate(coverHeight),
|
||||
selector->widthValue()
|
||||
) | rpl::start_with_next([=](int top, int width) {
|
||||
) | rpl::on_next([=](int top, int width) {
|
||||
shadow->setGeometry(0, top, width, st::lineWidth);
|
||||
}, shadow->lifetime());
|
||||
|
||||
selector->refreshEmoji();
|
||||
|
||||
selector->scrollToRequests(
|
||||
) | rpl::start_with_next([=](int y) {
|
||||
) | rpl::on_next([=](int y) {
|
||||
box->scrollToY(y);
|
||||
shadow->update();
|
||||
}, selector->lifetime());
|
||||
@@ -328,7 +328,7 @@ struct IconSelector {
|
||||
box->heightValue(),
|
||||
std::move(coverHeight),
|
||||
rpl::mappers::_1 - rpl::mappers::_2
|
||||
) | rpl::start_with_next([=](int height) {
|
||||
) | rpl::on_next([=](int height) {
|
||||
selector->setMinimalHeight(selector->width(), height);
|
||||
}, body->lifetime());
|
||||
|
||||
@@ -345,7 +345,7 @@ struct IconSelector {
|
||||
};
|
||||
|
||||
selector->customChosen(
|
||||
) | rpl::start_with_next([=](ChatHelpers::FileChosen data) {
|
||||
) | rpl::on_next([=](ChatHelpers::FileChosen data) {
|
||||
const auto owner = &controller->session().data();
|
||||
const auto document = data.document;
|
||||
const auto id = document->id;
|
||||
@@ -465,14 +465,14 @@ void EditForumTopicBox(
|
||||
paintIconFrame);
|
||||
|
||||
title->geometryValue(
|
||||
) | rpl::start_with_next([=](QRect geometry) {
|
||||
) | rpl::on_next([=](QRect geometry) {
|
||||
icon->move(
|
||||
st::editTopicIconPosition.x(),
|
||||
st::editTopicIconPosition.y());
|
||||
}, icon->lifetime());
|
||||
|
||||
state->iconId.value(
|
||||
) | rpl::start_with_next([=](DocumentId iconId) {
|
||||
) | rpl::on_next([=](DocumentId iconId) {
|
||||
icon->setAttribute(
|
||||
Qt::WA_TransparentForMouseEvents,
|
||||
created || (iconId != 0));
|
||||
@@ -486,13 +486,13 @@ void EditForumTopicBox(
|
||||
};
|
||||
});
|
||||
title->changes(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
state->defaultIcon = DefaultIcon{
|
||||
title->getLastText().trimmed(),
|
||||
state->defaultIcon.current().colorId,
|
||||
};
|
||||
}, title->lifetime());
|
||||
title->submits() | rpl::start_with_next([box] {
|
||||
title->submits() | rpl::on_next([box] {
|
||||
box->triggerButton(0);
|
||||
}, title->lifetime());
|
||||
|
||||
@@ -515,7 +515,7 @@ void EditForumTopicBox(
|
||||
state->paintIconFrame = std::move(selector.paintIconFrame);
|
||||
std::move(
|
||||
selector.iconIdValue
|
||||
) | rpl::start_with_next([=](DocumentId iconId) {
|
||||
) | rpl::on_next([=](DocumentId iconId) {
|
||||
state->iconId = (iconId != kDefaultIconId) ? iconId : 0;
|
||||
}, box->lifetime());
|
||||
}
|
||||
@@ -565,7 +565,7 @@ void EditForumTopicBox(
|
||||
state->requestId = api->request(MTPmessages_EditForumTopic(
|
||||
MTP_flags(Flag::f_title
|
||||
| (topic->isGeneral() ? Flag() : Flag::f_icon_emoji_id)),
|
||||
topic->peer()->input,
|
||||
topic->peer()->input(),
|
||||
MTP_int(rootId),
|
||||
MTP_string(title->getLastText().trimmed()),
|
||||
MTP_long(state->iconId.current()),
|
||||
|
||||
@@ -62,10 +62,10 @@ namespace {
|
||||
Ui::AddDividerText(container, tr::lng_profile_hide_participants_about());
|
||||
|
||||
button->toggledValue(
|
||||
) | rpl::start_with_next([=](bool toggled) {
|
||||
) | rpl::on_next([=](bool toggled) {
|
||||
megagroup->session().api().request(
|
||||
MTPchannels_ToggleParticipantsHidden(
|
||||
megagroup->inputChannel,
|
||||
megagroup->inputChannel(),
|
||||
MTP_bool(toggled)
|
||||
)
|
||||
).done([=](const MTPUpdates &result) {
|
||||
|
||||
@@ -94,7 +94,7 @@ EditParticipantBox::Inner::Inner(
|
||||
, _hasAdminRights(hasAdminRights)
|
||||
, _rows(this) {
|
||||
_rows->heightValue(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
resizeToWidth(width());
|
||||
}, lifetime());
|
||||
|
||||
@@ -282,7 +282,7 @@ void EditAdminBox::prepare() {
|
||||
true)),
|
||||
st::rightsToggleMargin + (st::rightsDividerMargin / 2));
|
||||
_addAsAdmin->checkedChanges(
|
||||
) | rpl::start_with_next([=](bool checked) {
|
||||
) | rpl::on_next([=](bool checked) {
|
||||
_adminControlsWrap->toggle(checked, anim::type::normal);
|
||||
refreshButtons();
|
||||
}, _addAsAdmin->lifetime());
|
||||
@@ -301,11 +301,11 @@ void EditAdminBox::prepare() {
|
||||
tr::lng_rights_about_by(
|
||||
lt_user,
|
||||
rpl::single(_by
|
||||
? Ui::Text::Link(_by->name(), 1)
|
||||
? tr::link(_by->name(), 1)
|
||||
: TextWithEntities{ QString::fromUtf8("\U0001F47B") }),
|
||||
lt_date,
|
||||
rpl::single(TextWithEntities{ langDateTimeFull(parsed) }),
|
||||
Ui::Text::WithEntities));
|
||||
tr::marked));
|
||||
if (_by) {
|
||||
label->setLink(1, _by->createOpenLink());
|
||||
}
|
||||
@@ -465,8 +465,8 @@ void EditAdminBox::prepare() {
|
||||
phrase(
|
||||
tr::now,
|
||||
lt_group,
|
||||
Ui::Text::Bold(peer()->name()),
|
||||
Ui::Text::WithEntities),
|
||||
tr::bold(peer()->name()),
|
||||
tr::marked),
|
||||
crl::guard(this, [=] { finishAddAdmin(); })
|
||||
}));
|
||||
} else {
|
||||
@@ -530,7 +530,7 @@ not_null<Ui::InputField*> EditAdminBox::addRankInput(
|
||||
result->setMaxLength(kAdminRoleLimit);
|
||||
result->setInstantReplaces(Ui::InstantReplaces::TextOnly());
|
||||
result->changes(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
const auto text = result->getLastText();
|
||||
const auto removed = TextUtilities::RemoveEmoji(text);
|
||||
if (removed != text) {
|
||||
@@ -592,7 +592,7 @@ void EditAdminBox::transferOwnership() {
|
||||
}
|
||||
|
||||
const auto channel = peer()->isChannel()
|
||||
? peer()->asChannel()->inputChannel
|
||||
? peer()->asChannel()->inputChannel()
|
||||
: MTP_inputChannelEmpty();
|
||||
const auto api = &peer()->session().api();
|
||||
api->cloudPassword().reload();
|
||||
@@ -611,10 +611,10 @@ void EditAdminBox::transferOwnership() {
|
||||
.text = tr::lng_rights_transfer_about(
|
||||
tr::now,
|
||||
lt_group,
|
||||
Ui::Text::Bold(peer()->name()),
|
||||
tr::bold(peer()->name()),
|
||||
lt_user,
|
||||
Ui::Text::Bold(user()->shortName()),
|
||||
Ui::Text::RichLangValue),
|
||||
tr::bold(user()->shortName()),
|
||||
tr::rich),
|
||||
.confirmed = callback,
|
||||
.confirmText = tr::lng_rights_transfer_sure(),
|
||||
}));
|
||||
@@ -627,8 +627,8 @@ bool EditAdminBox::handleTransferPasswordError(const QString &error) {
|
||||
auto about = tr::lng_rights_transfer_check_about(
|
||||
tr::now,
|
||||
lt_user,
|
||||
Ui::Text::Bold(user()->shortName()),
|
||||
Ui::Text::WithEntities);
|
||||
tr::bold(user()->shortName()),
|
||||
tr::marked);
|
||||
if (auto box = PrePasswordErrorBox(error, session, std::move(about))) {
|
||||
getDelegate()->show(std::move(box));
|
||||
return true;
|
||||
@@ -654,7 +654,7 @@ void EditAdminBox::requestTransferPassword(not_null<ChannelData*> channel) {
|
||||
peer()->session().api().cloudPassword().state(
|
||||
) | rpl::take(
|
||||
1
|
||||
) | rpl::start_with_next([=](const Core::CloudPasswordState &state) {
|
||||
) | rpl::on_next([=](const Core::CloudPasswordState &state) {
|
||||
auto fields = PasscodeBox::CloudFields::From(state);
|
||||
fields.customTitle = tr::lng_rights_transfer_password_title();
|
||||
fields.customDescription
|
||||
@@ -680,8 +680,8 @@ void EditAdminBox::sendTransferRequestFrom(
|
||||
const auto user = this->user();
|
||||
const auto api = &channel->session().api();
|
||||
_transferRequestId = api->request(MTPchannels_EditCreator(
|
||||
channel->inputChannel,
|
||||
user->inputUser,
|
||||
channel->inputChannel(),
|
||||
user->inputUser(),
|
||||
result.result
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
api->applyUpdates(result);
|
||||
@@ -837,11 +837,11 @@ void EditRestrictedBox::prepare() {
|
||||
: tr::lng_rights_chat_restricted_by)(
|
||||
lt_user,
|
||||
rpl::single(_by
|
||||
? Ui::Text::Link(_by->name(), 1)
|
||||
? tr::link(_by->name(), 1)
|
||||
: TextWithEntities{ QString::fromUtf8("\U0001F47B") }),
|
||||
lt_date,
|
||||
rpl::single(TextWithEntities{ langDateTimeFull(parsed) }),
|
||||
Ui::Text::WithEntities));
|
||||
tr::marked));
|
||||
if (_by) {
|
||||
label->setLink(1, _by->createOpenLink());
|
||||
}
|
||||
|
||||
@@ -57,8 +57,8 @@ void RemoveAdmin(
|
||||
Fn<void()> onFail) {
|
||||
const auto newRights = MTP_chatAdminRights(MTP_flags(0));
|
||||
channel->session().api().request(MTPchannels_EditAdmin(
|
||||
channel->inputChannel,
|
||||
user->inputUser,
|
||||
channel->inputChannel(),
|
||||
user->inputUser(),
|
||||
newRights,
|
||||
MTP_string(QString())
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
@@ -81,8 +81,8 @@ void AddChatParticipant(
|
||||
Fn<void()> onDone,
|
||||
Fn<void()> onFail) {
|
||||
chat->session().api().request(MTPmessages_AddChatUser(
|
||||
chat->inputChat,
|
||||
user->inputUser,
|
||||
chat->inputChat(),
|
||||
user->inputUser(),
|
||||
MTP_int(kForwardMessagesOnAdd)
|
||||
)).done([=](const MTPmessages_InvitedUsers &result) {
|
||||
const auto &data = result.data();
|
||||
@@ -111,8 +111,8 @@ void SaveChatAdmin(
|
||||
Fn<void()> onFail,
|
||||
bool retryOnNotParticipant = true) {
|
||||
chat->session().api().request(MTPmessages_EditChatAdmin(
|
||||
chat->inputChat,
|
||||
user->inputUser,
|
||||
chat->inputChat(),
|
||||
user->inputUser(),
|
||||
MTP_bool(isAdmin)
|
||||
)).done([=] {
|
||||
chat->applyEditAdmin(user, isAdmin);
|
||||
@@ -150,8 +150,8 @@ void SaveChannelAdmin(
|
||||
Fn<void()> onDone,
|
||||
Fn<void()> onFail) {
|
||||
channel->session().api().request(MTPchannels_EditAdmin(
|
||||
channel->inputChannel,
|
||||
user->inputUser,
|
||||
channel->inputChannel(),
|
||||
user->inputUser(),
|
||||
AdminRightsToMTP(newRights),
|
||||
MTP_string(rank)
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
@@ -175,8 +175,8 @@ void SaveChatParticipantKick(
|
||||
Fn<void()> onFail) {
|
||||
chat->session().api().request(MTPmessages_DeleteChatUser(
|
||||
MTP_flags(0),
|
||||
chat->inputChat,
|
||||
user->inputUser
|
||||
chat->inputChat(),
|
||||
user->inputUser()
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
chat->session().api().applyUpdates(result);
|
||||
if (onDone) {
|
||||
@@ -296,7 +296,7 @@ void SubscribeToMigration(
|
||||
return (channel != nullptr);
|
||||
}) | rpl::take(
|
||||
1
|
||||
) | rpl::start_with_next([=](not_null<ChannelData*> channel) {
|
||||
) | rpl::on_next([=](not_null<ChannelData*> channel) {
|
||||
const auto onstack = base::duplicate(migrate);
|
||||
onstack(channel);
|
||||
}, lifetime);
|
||||
@@ -812,7 +812,7 @@ ParticipantsOnlineSorter::ParticipantsOnlineSorter(
|
||||
, _sortByOnlineTimer([=] { sort(); }) {
|
||||
peer->session().changes().peerUpdates(
|
||||
Data::PeerUpdate::Flag::OnlineStatus
|
||||
) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
|
||||
) | rpl::on_next([=](const Data::PeerUpdate &update) {
|
||||
const auto peerId = update.peer->id;
|
||||
if (const auto row = _delegate->peerListFindRow(peerId.value)) {
|
||||
row->refreshStatus();
|
||||
@@ -910,7 +910,7 @@ void ParticipantsBoxController::setupListChangeViewers() {
|
||||
|
||||
channel->owner().megagroupParticipantAdded(
|
||||
channel
|
||||
) | rpl::start_with_next([=](not_null<UserData*> user) {
|
||||
) | rpl::on_next([=](not_null<UserData*> user) {
|
||||
if (delegate()->peerListFullRowsCount() > 0) {
|
||||
if (delegate()->peerListRowAt(0)->peer() == user) {
|
||||
return;
|
||||
@@ -935,7 +935,7 @@ void ParticipantsBoxController::setupListChangeViewers() {
|
||||
|
||||
channel->owner().megagroupParticipantRemoved(
|
||||
channel
|
||||
) | rpl::start_with_next([=](not_null<UserData*> user) {
|
||||
) | rpl::on_next([=](not_null<UserData*> user) {
|
||||
if (const auto row = delegate()->peerListFindRow(user->id.value)) {
|
||||
delegate()->peerListRemoveRow(row);
|
||||
}
|
||||
@@ -1127,13 +1127,13 @@ auto ParticipantsBoxController::saveState() const
|
||||
chat->session().changes().peerUpdates(
|
||||
chat,
|
||||
Data::PeerUpdate::Flag::Members
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
weak->controllerState = nullptr;
|
||||
}, my->lifetime);
|
||||
} else if (const auto channel = _peer->asMegagroup()) {
|
||||
channel->owner().megagroupParticipantAdded(
|
||||
channel
|
||||
) | rpl::start_with_next([=](not_null<UserData*> user) {
|
||||
) | rpl::on_next([=](not_null<UserData*> user) {
|
||||
if (!weak->list.empty()) {
|
||||
if (weak->list[0] == user) {
|
||||
return;
|
||||
@@ -1150,7 +1150,7 @@ auto ParticipantsBoxController::saveState() const
|
||||
|
||||
channel->owner().megagroupParticipantRemoved(
|
||||
channel
|
||||
) | rpl::start_with_next([=](not_null<UserData*> user) {
|
||||
) | rpl::on_next([=](not_null<UserData*> user) {
|
||||
weak->list.erase(std::remove(
|
||||
weak->list.begin(),
|
||||
weak->list.end(),
|
||||
@@ -1257,7 +1257,7 @@ void ParticipantsBoxController::prepare() {
|
||||
auto visible = _peer->isMegagroup()
|
||||
? Info::Profile::CanViewParticipantsValue(_peer->asMegagroup())
|
||||
: rpl::single(true);
|
||||
std::move(visible) | rpl::start_with_next([=](bool visible) {
|
||||
std::move(visible) | rpl::on_next([=](bool visible) {
|
||||
if (!visible) {
|
||||
_onlineCountValue = 0;
|
||||
_onlineSorter = nullptr;
|
||||
@@ -1275,7 +1275,7 @@ void ParticipantsBoxController::prepare() {
|
||||
}
|
||||
|
||||
_peer->session().changes().chatAdminChanges(
|
||||
) | rpl::start_with_next([=](const Data::ChatAdminChange &update) {
|
||||
) | rpl::on_next([=](const Data::ChatAdminChange &update) {
|
||||
if (update.peer != _peer) {
|
||||
return;
|
||||
}
|
||||
@@ -1347,7 +1347,7 @@ void ParticipantsBoxController::prepareChatRows(not_null<ChatData*> chat) {
|
||||
chat->session().changes().peerUpdates(
|
||||
chat,
|
||||
UpdateFlag::Members | UpdateFlag::Admins
|
||||
) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
|
||||
) | rpl::on_next([=](const Data::PeerUpdate &update) {
|
||||
_additional.fillFromPeer();
|
||||
if ((update.flags & UpdateFlag::Members)
|
||||
|| (_role == Role::Admins)) {
|
||||
@@ -1515,7 +1515,7 @@ void ParticipantsBoxController::loadMoreRows() {
|
||||
const auto participantsHash = uint64(0);
|
||||
|
||||
_loadRequestId = _api.request(MTPchannels_GetParticipants(
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
filter,
|
||||
MTP_int(_offset),
|
||||
MTP_int(perPage),
|
||||
@@ -1686,11 +1686,11 @@ base::unique_qptr<Ui::PopupMenu> ParticipantsBoxController::rowContextMenu(
|
||||
auto text = phrase(
|
||||
tr::now,
|
||||
lt_user,
|
||||
Ui::Text::Bold(by->name()),
|
||||
tr::bold(by->name()),
|
||||
lt_date,
|
||||
Ui::Text::Bold(
|
||||
tr::bold(
|
||||
langDateTimeFull(base::unixtime::parse(since))),
|
||||
Ui::Text::WithEntities);
|
||||
tr::marked);
|
||||
auto button = base::make_unique_q<Ui::Menu::MultilineAction>(
|
||||
result->menu(),
|
||||
result->st().menu,
|
||||
@@ -2201,7 +2201,7 @@ void ParticipantsBoxController::subscribeToCreatorChange(
|
||||
return (change.diff & ChannelDataFlag::Creator);
|
||||
}) | rpl::filter([=] {
|
||||
return (isCreator != channel->amCreator());
|
||||
}) | rpl::start_with_next([=] {
|
||||
}) | rpl::on_next([=] {
|
||||
if (channel->isBroadcast()) {
|
||||
fullListRefresh();
|
||||
return;
|
||||
@@ -2209,7 +2209,7 @@ void ParticipantsBoxController::subscribeToCreatorChange(
|
||||
const auto weak = base::make_weak(this);
|
||||
const auto api = &channel->session().api();
|
||||
api->request(MTPchannels_GetParticipants(
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
MTP_channelParticipantsRecent(),
|
||||
MTP_int(0), // offset
|
||||
MTP_int(channel->session().serverConfig().chatSizeMax),
|
||||
@@ -2356,7 +2356,7 @@ bool ParticipantsBoxSearchController::loadMoreRows() {
|
||||
const auto participantsHash = uint64(0);
|
||||
|
||||
_requestId = _api.request(MTPchannels_GetParticipants(
|
||||
_channel->inputChannel,
|
||||
_channel->inputChannel(),
|
||||
filter,
|
||||
MTP_int(_offset),
|
||||
MTP_int(perPage),
|
||||
|
||||
@@ -142,7 +142,7 @@ base::unique_qptr<Ui::RpWidget> CreateEmptyPlaceholder(
|
||||
container->resize(width, totalHeight);
|
||||
|
||||
container->sizeValue(
|
||||
) | rpl::start_with_next([=](QSize size) {
|
||||
) | rpl::on_next([=](QSize size) {
|
||||
const auto totalContentHeight = iconWidget->height()
|
||||
+ st::normalFont->height + emptyLabel->height()
|
||||
+ (emptyNextLabel
|
||||
@@ -313,17 +313,17 @@ PreviewWrap::PreviewWrap(
|
||||
_style->apply(_theme.get());
|
||||
|
||||
_fake->setName(peer->name(), QString());
|
||||
std::move(colorIndexValue) | rpl::start_with_next([=](uint8 index) {
|
||||
std::move(colorIndexValue) | rpl::on_next([=](uint8 index) {
|
||||
if (index != kUnsetColorIndex) {
|
||||
_fake->changeColorIndex(index);
|
||||
update();
|
||||
}
|
||||
}, lifetime());
|
||||
std::move(backgroundEmojiId) | rpl::start_with_next([=](DocumentId id) {
|
||||
std::move(backgroundEmojiId) | rpl::on_next([=](DocumentId id) {
|
||||
_fake->changeBackgroundEmojiId(id);
|
||||
update();
|
||||
}, lifetime());
|
||||
std::move(colorCollectible) | rpl::start_with_next([=](
|
||||
std::move(colorCollectible) | rpl::on_next([=](
|
||||
std::optional<Ui::ColorCollectible> &&collectible) {
|
||||
if (collectible) {
|
||||
_fake->changeColorCollectible(std::move(*collectible));
|
||||
@@ -335,7 +335,7 @@ PreviewWrap::PreviewWrap(
|
||||
|
||||
const auto session = &_history->session();
|
||||
session->data().viewRepaintRequest(
|
||||
) | rpl::start_with_next([=](not_null<const Element*> view) {
|
||||
) | rpl::on_next([=](not_null<const Element*> view) {
|
||||
if (view == _element.get()) {
|
||||
update();
|
||||
}
|
||||
@@ -391,7 +391,7 @@ void PreviewWrap::initElements() {
|
||||
widthValue(
|
||||
) | rpl::filter([=](int width) {
|
||||
return width > st::msgMinWidth;
|
||||
}) | rpl::start_with_next([=](int width) {
|
||||
}) | rpl::on_next([=](int width) {
|
||||
const auto height = _position.y()
|
||||
+ _element->resizeGetHeight(width)
|
||||
+ st::msgMargin.top();
|
||||
@@ -436,7 +436,7 @@ void LevelBadge::updateText() {
|
||||
tr::now,
|
||||
lt_count,
|
||||
_level,
|
||||
Ui::Text::WithEntities));
|
||||
tr::marked));
|
||||
} else {
|
||||
text.append(QString::number(_level));
|
||||
}
|
||||
@@ -602,7 +602,7 @@ void Set(
|
||||
: Flag(0))
|
||||
| Flag::f_background_emoji_id
|
||||
| (values.forProfile ? Flag::f_for_profile : Flag(0))),
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
MTP_int(values.colorIndex),
|
||||
MTP_long(values.backgroundEmojiId)));
|
||||
}
|
||||
@@ -749,11 +749,11 @@ void Apply(
|
||||
};
|
||||
const auto state = right->lifetime().make_state<State>();
|
||||
state->panel.someCustomChosen(
|
||||
) | rpl::start_with_next([=](EmojiStatusPanel::CustomChosen chosen) {
|
||||
) | rpl::on_next([=](EmojiStatusPanel::CustomChosen chosen) {
|
||||
emojiIdChosen(chosen.id.documentId);
|
||||
}, raw->lifetime());
|
||||
|
||||
std::move(colorIndexValue) | rpl::start_with_next([=](uint8 index) {
|
||||
std::move(colorIndexValue) | rpl::on_next([=](uint8 index) {
|
||||
state->index = index;
|
||||
if (state->emoji) {
|
||||
right->update();
|
||||
@@ -762,7 +762,7 @@ void Apply(
|
||||
|
||||
const auto session = &show->session();
|
||||
const auto added = st::lineWidth * 2;
|
||||
std::move(emojiIdValue) | rpl::start_with_next([=](DocumentId emojiId) {
|
||||
std::move(emojiIdValue) | rpl::on_next([=](DocumentId emojiId) {
|
||||
state->emojiId = emojiId;
|
||||
state->emoji = emojiId
|
||||
? session->data().customEmojiManager().create(
|
||||
@@ -778,14 +778,14 @@ void Apply(
|
||||
rpl::combine(
|
||||
raw->sizeValue(),
|
||||
right->widthValue()
|
||||
) | rpl::start_with_next([=](QSize outer, int width) {
|
||||
) | rpl::on_next([=](QSize outer, int width) {
|
||||
right->resize(width, outer.height());
|
||||
const auto skip = st::settingsButton.padding.right();
|
||||
right->moveToRight(skip - button.added, 0, outer.width());
|
||||
}, right->lifetime());
|
||||
|
||||
right->paintRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
if (state->panel.paintBadgeFrame(right)) {
|
||||
return;
|
||||
}
|
||||
@@ -893,12 +893,12 @@ void Apply(
|
||||
};
|
||||
const auto state = right->lifetime().make_state<State>();
|
||||
state->panel.someCustomChosen(
|
||||
) | rpl::start_with_next([=](EmojiStatusPanel::CustomChosen chosen) {
|
||||
) | rpl::on_next([=](EmojiStatusPanel::CustomChosen chosen) {
|
||||
statusIdChosen({ chosen.id }, chosen.until);
|
||||
}, raw->lifetime());
|
||||
|
||||
const auto session = &show->session();
|
||||
std::move(statusIdValue) | rpl::start_with_next([=](EmojiStatusId id) {
|
||||
std::move(statusIdValue) | rpl::on_next([=](EmojiStatusId id) {
|
||||
state->statusId = id;
|
||||
state->emoji = id
|
||||
? session->data().customEmojiManager().create(
|
||||
@@ -914,14 +914,14 @@ void Apply(
|
||||
rpl::combine(
|
||||
raw->sizeValue(),
|
||||
right->widthValue()
|
||||
) | rpl::start_with_next([=](QSize outer, int width) {
|
||||
) | rpl::on_next([=](QSize outer, int width) {
|
||||
right->resize(width, outer.height());
|
||||
const auto skip = st::settingsButton.padding.right();
|
||||
right->moveToRight(skip - button.added, 0, outer.width());
|
||||
}, right->lifetime());
|
||||
|
||||
right->paintRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
if (state->panel.paintBadgeFrame(right)) {
|
||||
return;
|
||||
}
|
||||
@@ -1007,7 +1007,7 @@ void Apply(
|
||||
rpl::combine(
|
||||
raw->sizeValue(),
|
||||
right->widthValue()
|
||||
) | rpl::start_with_next([=](QSize outer, int width) {
|
||||
) | rpl::on_next([=](QSize outer, int width) {
|
||||
right->resize(width, outer.height());
|
||||
const auto skip = st::settingsButton.padding.right();
|
||||
right->moveToRight(skip - button.added, 0, outer.width());
|
||||
@@ -1016,7 +1016,7 @@ void Apply(
|
||||
right->paintRequest(
|
||||
) | rpl::filter([=] {
|
||||
return state->icon != nullptr;
|
||||
}) | rpl::start_with_next([=] {
|
||||
}) | rpl::on_next([=] {
|
||||
auto p = QPainter(right);
|
||||
const auto x = button.added;
|
||||
const auto y = (right->height() - button.emojiWidth) / 2;
|
||||
@@ -1076,7 +1076,7 @@ void Apply(
|
||||
return wrapLoaded(sets->find(id));
|
||||
}));
|
||||
}) | rpl::flatten_latest(
|
||||
) | rpl::start_with_next([=](DocumentData *icon) {
|
||||
) | rpl::on_next([=](DocumentData *icon) {
|
||||
if (state->icon != icon) {
|
||||
state->icon = icon;
|
||||
state->custom = nullptr;
|
||||
@@ -1111,7 +1111,7 @@ Fn<void()> AddColorGiftTabs(
|
||||
GiftsStars(
|
||||
session,
|
||||
session->user()
|
||||
) | rpl::start_with_next([=](const std::vector<GiftTypeStars> &list) {
|
||||
) | rpl::on_next([=](const std::vector<GiftTypeStars> &list) {
|
||||
auto filtered = std::vector<Data::StarGift>();
|
||||
for (const auto &gift : list) {
|
||||
if ((profile || gift.info.peerColorAvailable) && gift.resale) {
|
||||
@@ -1122,11 +1122,11 @@ Fn<void()> AddColorGiftTabs(
|
||||
}, container->lifetime());
|
||||
|
||||
state->list.value(
|
||||
) | rpl::start_with_next([=](const std::vector<Data::StarGift> &list) {
|
||||
) | rpl::on_next([=](const std::vector<Data::StarGift> &list) {
|
||||
auto tabs = std::vector<Ui::SubTabs::Tab>();
|
||||
tabs.push_back({
|
||||
.id = u"my"_q,
|
||||
.text = tr::lng_gift_stars_tabs_my(tr::now, Ui::Text::WithEntities),
|
||||
.text = tr::lng_gift_stars_tabs_my(tr::now, tr::marked),
|
||||
});
|
||||
for (const auto &gift : list) {
|
||||
auto text = TextWithEntities();
|
||||
@@ -1152,7 +1152,7 @@ Fn<void()> AddColorGiftTabs(
|
||||
context));
|
||||
|
||||
state->tabs->activated(
|
||||
) | rpl::start_with_next([=](const QString &id) {
|
||||
) | rpl::on_next([=](const QString &id) {
|
||||
state->tabs->setActiveTab(id);
|
||||
chosen(id.toULongLong());
|
||||
}, state->tabs->lifetime());
|
||||
@@ -1228,7 +1228,7 @@ void AddGiftSelector(
|
||||
shownGiftId,
|
||||
{},
|
||||
state->current->offset
|
||||
) | rpl::start_with_next([=](Data::ResaleGiftsDescriptor slice) {
|
||||
) | rpl::on_next([=](Data::ResaleGiftsDescriptor slice) {
|
||||
auto &entry = state->lists[shownGiftId];
|
||||
entry.loading.destroy();
|
||||
entry.offset = slice.offset;
|
||||
@@ -1254,7 +1254,7 @@ void AddGiftSelector(
|
||||
session,
|
||||
Data::MyUniqueType::OwnedAndHosted,
|
||||
state->current->offset
|
||||
) | rpl::start_with_next([=](Data::MyGiftsDescriptor slice) {
|
||||
) | rpl::on_next([=](Data::MyGiftsDescriptor slice) {
|
||||
auto &entry = state->lists[shownGiftId];
|
||||
entry.loading.destroy();
|
||||
entry.offset = slice.offset;
|
||||
@@ -1393,7 +1393,7 @@ void AddGiftSelector(
|
||||
};
|
||||
|
||||
state->selected.value(
|
||||
) | rpl::combine_previous() | rpl::start_with_next([=](
|
||||
) | rpl::combine_previous() | rpl::on_next([=](
|
||||
uint64 wasCollectibleId,
|
||||
uint64 nowCollectibleId) {
|
||||
if (wasCollectibleId) {
|
||||
@@ -1409,7 +1409,7 @@ void AddGiftSelector(
|
||||
}, raw->lifetime());
|
||||
|
||||
state->selectedGiftId.value(
|
||||
) | rpl::combine_previous() | rpl::start_with_next([=](
|
||||
) | rpl::combine_previous() | rpl::on_next([=](
|
||||
uint64 wasGiftId,
|
||||
uint64 nowGiftId) {
|
||||
if (wasGiftId) {
|
||||
@@ -1465,7 +1465,7 @@ void AddGiftSelector(
|
||||
};
|
||||
|
||||
state->showingGiftId.value(
|
||||
) | rpl::start_with_next([=](uint64 showingId) {
|
||||
) | rpl::on_next([=](uint64 showingId) {
|
||||
state->current = &state->lists[showingId];
|
||||
state->buttons.clear();
|
||||
if (state->emptyPlaceholder) {
|
||||
@@ -1479,7 +1479,7 @@ void AddGiftSelector(
|
||||
|
||||
state->visibleRange = raw->visibleRange();
|
||||
state->visibleRange.value(
|
||||
) | rpl::start_with_next(state->rebuild, raw->lifetime());
|
||||
) | rpl::on_next(state->rebuild, raw->lifetime());
|
||||
}
|
||||
|
||||
Fn<void(int)> CreateTabsWidget(
|
||||
@@ -1544,7 +1544,7 @@ Fn<void(int)> CreateTabsWidget(
|
||||
|
||||
const auto penWidth = st::lineWidth * 2;
|
||||
|
||||
tabsContainer->paintRequest() | rpl::start_with_next([=] {
|
||||
tabsContainer->paintRequest() | rpl::on_next([=] {
|
||||
auto p = QPainter(tabsContainer);
|
||||
auto hq = PainterHighQualityEnabler(p);
|
||||
const auto r = tabsContainer->rect();
|
||||
@@ -1639,14 +1639,14 @@ void CreateBoostLevelContainer(
|
||||
};
|
||||
const auto state = boostLevelContainer->lifetime().make_state<State>();
|
||||
|
||||
boostLevelContainer->paintRequest() | rpl::start_with_next([=] {
|
||||
boostLevelContainer->paintRequest() | rpl::on_next([=] {
|
||||
auto p = QPainter(boostLevelContainer);
|
||||
const auto bg = state->currentColor.value_or(st::boxDividerBg->c);
|
||||
p.fillRect(boostLevelContainer->rect(), bg);
|
||||
p.fillRect(boostLevelContainer->rect(), st::shadowFg);
|
||||
}, boostLevelContainer->lifetime());
|
||||
|
||||
std::move(colorProducer) | rpl::start_with_next([=](
|
||||
std::move(colorProducer) | rpl::on_next([=](
|
||||
std::optional<QColor> color) {
|
||||
const auto colorChanged = (state->currentColor != color)
|
||||
|| !state->label;
|
||||
@@ -1668,11 +1668,11 @@ void CreateBoostLevelContainer(
|
||||
using namespace Ui::Text;
|
||||
return Link(std::move(t), u"internal:"_q);
|
||||
}),
|
||||
Ui::Text::RichLangValue),
|
||||
tr::rich),
|
||||
style);
|
||||
state->label->show();
|
||||
boostLevelContainer->sizeValue(
|
||||
) | rpl::start_with_next([=](QSize s) {
|
||||
) | rpl::on_next([=](QSize s) {
|
||||
state->label->moveToLeft(
|
||||
(s.width() - state->label->width()) / 2,
|
||||
(s.height() - state->label->height()) / 2);
|
||||
@@ -1707,7 +1707,7 @@ void AddLevelBadge(
|
||||
rpl::combine(
|
||||
button->sizeValue(),
|
||||
std::move(text)
|
||||
) | rpl::start_with_next([=](const QSize &s, const QString &) {
|
||||
) | rpl::on_next([=](const QSize &s, const QString &) {
|
||||
if (s.isNull()) {
|
||||
return;
|
||||
}
|
||||
@@ -1771,7 +1771,7 @@ void EditPeerColorSection(
|
||||
state->preview->setPatternEmojiId(
|
||||
state->profileEmojiId.current());
|
||||
}
|
||||
state->statusId.value() | rpl::start_with_next([=](EmojiStatusId id) {
|
||||
state->statusId.value() | rpl::on_next([=](EmojiStatusId id) {
|
||||
state->preview->setLocalEmojiStatusId(std::move(id));
|
||||
}, state->preview->lifetime());
|
||||
const auto peerColors = &peer->session().api().peerColors();
|
||||
@@ -1835,7 +1835,7 @@ void EditPeerColorSection(
|
||||
true));
|
||||
|
||||
state->profileIndex.value(
|
||||
) | rpl::start_with_next([=](uint8 index) {
|
||||
) | rpl::on_next([=](uint8 index) {
|
||||
selector->updateSelection(index);
|
||||
}, selector->lifetime());
|
||||
|
||||
@@ -2126,7 +2126,7 @@ void EditPeerColorSection(
|
||||
}));
|
||||
});
|
||||
state->collectible.value(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
const auto buy = state->buyCollectible.get();
|
||||
while (!button->children().isEmpty()) {
|
||||
delete button->children().first();
|
||||
@@ -2150,13 +2150,13 @@ void EditPeerColorSection(
|
||||
tr::lng_gift_buy_resale_button(
|
||||
lt_cost,
|
||||
rpl::single(Data::FormatGiftResaleTon(*buy)),
|
||||
Ui::Text::WithEntities),
|
||||
tr::marked),
|
||||
tr::lng_gift_buy_resale_equals(
|
||||
lt_cost,
|
||||
rpl::single(Ui::Text::IconEmoji(
|
||||
&st::starIconEmojiSmall
|
||||
).append(Lang::FormatCountDecimal(buy->starsForResale))),
|
||||
Ui::Text::WithEntities),
|
||||
tr::marked),
|
||||
st::resaleButtonTitle,
|
||||
st::resaleButtonSubtitle);
|
||||
} else {
|
||||
@@ -2164,7 +2164,7 @@ void EditPeerColorSection(
|
||||
lt_cost,
|
||||
rpl::single(Ui::Text::IconEmoji(&st::starIconEmoji).append(
|
||||
Lang::FormatCountDecimal(buy->starsForResale))),
|
||||
Ui::Text::WithEntities));
|
||||
tr::marked));
|
||||
}
|
||||
}, button->lifetime());
|
||||
}
|
||||
@@ -2282,11 +2282,11 @@ void EditPeerProfileColorSection(
|
||||
tr::lng_settings_color_profile_about_link(
|
||||
lt_emoji,
|
||||
rpl::single(Ui::Text::IconEmoji(&st::textMoreIconEmoji)),
|
||||
Ui::Text::RichLangValue
|
||||
tr::rich
|
||||
) | rpl::map([=](TextWithEntities t) {
|
||||
return Ui::Text::Link(std::move(t), u"internal:"_q);
|
||||
return tr::link(std::move(t), u"internal:"_q);
|
||||
}),
|
||||
Ui::Text::RichLangValue));
|
||||
tr::rich));
|
||||
Ui::AddSkip(container, st::settingsColorSampleSkip);
|
||||
about->setClickHandlerFilter([=](auto...) {
|
||||
aboutCallback();
|
||||
@@ -2294,7 +2294,7 @@ void EditPeerProfileColorSection(
|
||||
});
|
||||
|
||||
state->index.value(
|
||||
) | rpl::start_with_next([=](uint8 index) {
|
||||
) | rpl::on_next([=](uint8 index) {
|
||||
if (state->selector) {
|
||||
state->selector->updateSelection(index);
|
||||
}
|
||||
@@ -2386,7 +2386,7 @@ void EditPeerProfileColorSection(
|
||||
}));
|
||||
});
|
||||
state->wearable.value(
|
||||
) | rpl::start_with_next([=](EmojiStatusId id) {
|
||||
) | rpl::on_next([=](EmojiStatusId id) {
|
||||
const auto buy = state->buyCollectible.get();
|
||||
while (!button->children().isEmpty()) {
|
||||
delete button->children().first();
|
||||
@@ -2412,13 +2412,13 @@ void EditPeerProfileColorSection(
|
||||
tr::lng_gift_buy_resale_button(
|
||||
lt_cost,
|
||||
rpl::single(Data::FormatGiftResaleTon(*buy)),
|
||||
Ui::Text::WithEntities),
|
||||
tr::marked),
|
||||
tr::lng_gift_buy_resale_equals(
|
||||
lt_cost,
|
||||
rpl::single(Ui::Text::IconEmoji(
|
||||
&st::starIconEmojiSmall
|
||||
).append(Lang::FormatCountDecimal(buy->starsForResale))),
|
||||
Ui::Text::WithEntities),
|
||||
tr::marked),
|
||||
st::resaleButtonTitle,
|
||||
st::resaleButtonSubtitle);
|
||||
} else {
|
||||
@@ -2426,7 +2426,7 @@ void EditPeerProfileColorSection(
|
||||
lt_cost,
|
||||
rpl::single(Ui::Text::IconEmoji(&st::starIconEmoji).append(
|
||||
Lang::FormatCountDecimal(buy->starsForResale))),
|
||||
Ui::Text::WithEntities));
|
||||
tr::marked));
|
||||
}
|
||||
}, button->lifetime());
|
||||
}
|
||||
@@ -2469,7 +2469,7 @@ void EditPeerColorBox(
|
||||
buttonContainer->widthValue(),
|
||||
profileButton->sizeValue(),
|
||||
nameButton->sizeValue()
|
||||
) | rpl::start_with_next([=](int w, QSize, QSize) {
|
||||
) | rpl::on_next([=](int w, QSize, QSize) {
|
||||
profileButton->resizeToWidth(w);
|
||||
nameButton->resizeToWidth(w);
|
||||
}, buttonContainer->lifetime());
|
||||
@@ -2602,7 +2602,7 @@ void SetupPeerColorSample(
|
||||
rpl::duplicate(colorIndexValue),
|
||||
rpl::duplicate(colorProfileIndexValue),
|
||||
rpl::duplicate(emojiStatusIdValue)
|
||||
) | rpl::start_with_next([=](
|
||||
) | rpl::on_next([=](
|
||||
int width,
|
||||
const QString &buttonText,
|
||||
int colorIndex,
|
||||
@@ -2668,7 +2668,7 @@ void SetupPeerColorSample(
|
||||
rpl::duplicate(colorIndexValue),
|
||||
rpl::duplicate(colorProfileIndexValue),
|
||||
rpl::duplicate(emojiStatusIdValue)
|
||||
) | rpl::start_with_next([=](
|
||||
) | rpl::on_next([=](
|
||||
QSize outer,
|
||||
QSize inner,
|
||||
int colorIndex,
|
||||
@@ -2746,7 +2746,7 @@ void AddPeerColorButton(
|
||||
rpl::combine(
|
||||
rpl::duplicate(label),
|
||||
button->widthValue()
|
||||
) | rpl::start_with_next([=](
|
||||
) | rpl::on_next([=](
|
||||
const QString &text,
|
||||
int width) {
|
||||
const auto space = st.style.font->spacew;
|
||||
@@ -2776,7 +2776,7 @@ void CheckBoostLevel(
|
||||
Fn<std::optional<Ui::AskBoostReason>(int level)> askMore,
|
||||
Fn<void()> cancel) {
|
||||
peer->session().api().request(MTPpremium_GetBoostsStatus(
|
||||
peer->input
|
||||
peer->input()
|
||||
)).done([=](const MTPpremium_BoostsStatus &result) {
|
||||
const auto &data = result.data();
|
||||
if (const auto channel = peer->asChannel()) {
|
||||
|
||||
@@ -29,7 +29,7 @@ void EditPeerHistoryVisibilityBox(
|
||||
HistoryVisibility v) {
|
||||
const auto button = Ui::CreateChild<Ui::AbstractButton>(inner.get());
|
||||
inner->sizeValue(
|
||||
) | rpl::start_with_next([=](const QSize &s) {
|
||||
) | rpl::on_next([=](const QSize &s) {
|
||||
button->resize(s);
|
||||
}, button->lifetime());
|
||||
button->setClickedCallback([=] { historyVisibility->setValue(v); });
|
||||
|
||||
@@ -155,7 +155,7 @@ not_null<Ui::SettingsButton*> AddButtonWithText(
|
||||
return AddButtonWithText(
|
||||
parent,
|
||||
std::move(text),
|
||||
std::move(label) | Ui::Text::ToWithEntities(),
|
||||
std::move(label) | rpl::map(tr::marked),
|
||||
std::move(callback),
|
||||
std::move(descriptor));
|
||||
}
|
||||
@@ -182,7 +182,7 @@ void SaveDefaultRestrictions(
|
||||
|
||||
const auto requestId = api->request(
|
||||
MTPmessages_EditChatDefaultBannedRights(
|
||||
peer->input,
|
||||
peer->input(),
|
||||
RestrictionsToMTP({ rights, 0 }))
|
||||
).done([=](const MTPUpdates &result) {
|
||||
api->clearModifyRequest(key);
|
||||
@@ -214,7 +214,7 @@ void SaveSlowmodeSeconds(
|
||||
const auto key = Api::RequestKey("slowmode_seconds", channel->id);
|
||||
|
||||
const auto requestId = api->request(MTPchannels_ToggleSlowMode(
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
MTP_int(seconds)
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
api->clearModifyRequest(key);
|
||||
@@ -249,7 +249,7 @@ void SaveStarsPerMessage(
|
||||
MTP_flags(broadcastAllowed
|
||||
? Flag::f_broadcast_messages_allowed
|
||||
: Flag(0)),
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
MTP_long(starsPerMessage)
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
api->clearModifyRequest(key);
|
||||
@@ -284,7 +284,7 @@ void SaveBoostsUnrestrict(
|
||||
const auto key = Api::RequestKey("boosts_unrestrict", channel->id);
|
||||
const auto requestId = api->request(
|
||||
MTPchannels_SetBoostsToUnblockRestrictions(
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
MTP_int(boostsUnrestrict))
|
||||
).done([=](const MTPUpdates &result) {
|
||||
api->clearModifyRequest(key);
|
||||
@@ -610,11 +610,11 @@ object_ptr<Ui::RpWidget> Controller::createPhotoAndTitleEdit() {
|
||||
container,
|
||||
createTitleEdit());
|
||||
photoWrap->heightValue(
|
||||
) | rpl::start_with_next([container](int height) {
|
||||
) | rpl::on_next([container](int height) {
|
||||
container->resize(container->width(), height);
|
||||
}, photoWrap->lifetime());
|
||||
container->widthValue(
|
||||
) | rpl::start_with_next([titleEdit](int width) {
|
||||
) | rpl::on_next([titleEdit](int width) {
|
||||
const auto left = st::editPeerPhotoMargins.left()
|
||||
+ st::defaultUserpicButton.size.width();
|
||||
titleEdit->resizeToWidth(width - left);
|
||||
@@ -669,7 +669,7 @@ object_ptr<Ui::RpWidget> Controller::createTitleEdit() {
|
||||
&_peer->session());
|
||||
|
||||
result->entity()->submits(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
submitTitle();
|
||||
}, result->entity()->lifetime());
|
||||
|
||||
@@ -699,7 +699,7 @@ object_ptr<Ui::RpWidget> Controller::createTitleEdit() {
|
||||
emojiPanel->hide();
|
||||
emojiPanel->selector()->setCurrentPeer(_peer);
|
||||
emojiPanel->selector()->emojiChosen(
|
||||
) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) {
|
||||
) | rpl::on_next([=](ChatHelpers::EmojiChosen data) {
|
||||
Ui::InsertEmojiAtCursor(field->textCursor(), data.emoji);
|
||||
field->setFocus();
|
||||
}, field->lifetime());
|
||||
@@ -733,7 +733,7 @@ object_ptr<Ui::RpWidget> Controller::createTitleEdit() {
|
||||
});
|
||||
}());
|
||||
|
||||
field->widthValue() | rpl::start_with_next([=](int width) {
|
||||
field->widthValue() | rpl::on_next([=](int width) {
|
||||
const auto &p = st::editPeerTitleEmojiPosition;
|
||||
emojiToggle->moveToRight(p.x(), p.y(), width);
|
||||
updateEmojiPanelGeometry();
|
||||
@@ -779,7 +779,7 @@ object_ptr<Ui::RpWidget> Controller::createDescriptionEdit() {
|
||||
&_peer->session());
|
||||
|
||||
result->entity()->submits(
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::on_next([=] {
|
||||
submitDescription();
|
||||
}, result->entity()->lifetime());
|
||||
|
||||
@@ -893,7 +893,7 @@ void Controller::showEditPeerTypeBox(
|
||||
_typeDataSavedValue,
|
||||
error));
|
||||
box->boxClosing(
|
||||
) | rpl::start_with_next([peer = _peer] {
|
||||
) | rpl::on_next([peer = _peer] {
|
||||
peer->session().api().usernames().requestToCache(peer);
|
||||
}, box->lifetime());
|
||||
}
|
||||
@@ -1069,13 +1069,13 @@ void Controller::fillDiscussionLinkButton() {
|
||||
? _discussionLinkUpdates.events(
|
||||
) | rpl::map([](ChannelData *chat) {
|
||||
return chat ? chat->name() : QString();
|
||||
}) | rpl::type_erased()
|
||||
}) | rpl::type_erased
|
||||
: rpl::combine(
|
||||
tr::lng_manage_discussion_group_add(),
|
||||
_discussionLinkUpdates.events()
|
||||
) | rpl::map([=](const QString &add, ChannelData *chat) {
|
||||
return chat ? chat->name() : add;
|
||||
}) | rpl::type_erased();
|
||||
}) | rpl::type_erased;
|
||||
AddButtonWithText(
|
||||
_controls.buttonsLayout,
|
||||
std::move(text),
|
||||
@@ -1098,9 +1098,9 @@ void Controller::fillDirectMessagesButton() {
|
||||
auto label = _starsPerDirectMessageSavedValue->value(
|
||||
) | rpl::map([](int starsPerMessage) {
|
||||
return (starsPerMessage < 0)
|
||||
? tr::lng_manage_monoforum_off(Ui::Text::WithEntities)
|
||||
? tr::lng_manage_monoforum_off(tr::marked)
|
||||
: !starsPerMessage
|
||||
? tr::lng_manage_monoforum_free(Ui::Text::WithEntities)
|
||||
? tr::lng_manage_monoforum_free(tr::marked)
|
||||
: rpl::single(Ui::Text::IconEmoji(
|
||||
&st::starIconEmojiColored
|
||||
).append(' ').append(
|
||||
@@ -1164,7 +1164,7 @@ void Controller::fillForumButton() {
|
||||
tr::now,
|
||||
lt_count,
|
||||
EnableForumMinMembers(_peer),
|
||||
Ui::Text::RichLangValue));
|
||||
tr::rich));
|
||||
}
|
||||
} else {
|
||||
_navigation->uiShow()->show(Box(
|
||||
@@ -1242,12 +1242,12 @@ void Controller::fillAutoTranslateButton() {
|
||||
.data = Ui::AskBoostAutotranslate{ .requiredLevel = requiredLevel },
|
||||
};
|
||||
|
||||
state->isLocked.value() | rpl::start_with_next([=](bool locked) {
|
||||
state->isLocked.value() | rpl::on_next([=](bool locked) {
|
||||
autotranslate->setToggleLocked(locked);
|
||||
}, autotranslate->lifetime());
|
||||
|
||||
autotranslate->toggledChanges(
|
||||
) | rpl::start_with_next([=](bool value) {
|
||||
) | rpl::on_next([=](bool value) {
|
||||
if (!state->isLocked.current()) {
|
||||
_autotranslateSavedValue = value;
|
||||
} else if (value) {
|
||||
@@ -1269,7 +1269,7 @@ void Controller::fillAutoTranslateButton() {
|
||||
}, autotranslate->lifetime());
|
||||
|
||||
autotranslate->toggledValue(
|
||||
) | rpl::start_with_next([=](bool toggled) {
|
||||
) | rpl::on_next([=](bool toggled) {
|
||||
_autotranslateSavedValue = toggled;
|
||||
}, _controls.buttonsLayout->lifetime());
|
||||
}
|
||||
@@ -1306,12 +1306,12 @@ void Controller::fillSignaturesButton() {
|
||||
profiles->entity()->toggleOn(rpl::single(
|
||||
channel->addsSignature() && channel->signatureProfiles()
|
||||
))->toggledValue(
|
||||
) | rpl::start_with_next([=](bool toggled) {
|
||||
) | rpl::on_next([=](bool toggled) {
|
||||
_signatureProfilesSavedValue = toggled;
|
||||
}, profiles->entity()->lifetime());
|
||||
|
||||
signs->toggledValue(
|
||||
) | rpl::start_with_next([=](bool toggled) {
|
||||
) | rpl::on_next([=](bool toggled) {
|
||||
_signaturesSavedValue = toggled;
|
||||
if (!toggled) {
|
||||
_signatureProfilesSavedValue = false;
|
||||
@@ -1323,8 +1323,8 @@ void Controller::fillSignaturesButton() {
|
||||
_controls.buttonsLayout,
|
||||
rpl::conditional(
|
||||
signs->toggledValue(),
|
||||
tr::lng_edit_sign_profiles_about(Ui::Text::WithEntities),
|
||||
tr::lng_edit_sign_messages_about(Ui::Text::WithEntities)));
|
||||
tr::lng_edit_sign_profiles_about(tr::marked),
|
||||
tr::lng_edit_sign_messages_about(tr::marked)));
|
||||
Ui::AddSkip(_controls.buttonsLayout);
|
||||
}
|
||||
|
||||
@@ -1412,11 +1412,11 @@ void Controller::fillManageSection() {
|
||||
container,
|
||||
tr::lng_manage_peer_bot_about(
|
||||
lt_bot,
|
||||
rpl::single(Ui::Text::Link(
|
||||
rpl::single(tr::link(
|
||||
'@' + kBotManagerUsername.utf16(),
|
||||
_peer->session().createInternalLinkFull(
|
||||
kBotManagerUsername.utf16()))),
|
||||
Ui::Text::RichLangValue),
|
||||
tr::rich),
|
||||
st::boxDividerLabel),
|
||||
st::defaultBoxDividerLabelPadding));
|
||||
fillBotVerifyAccounts();
|
||||
@@ -1718,7 +1718,7 @@ void Controller::editReactions() {
|
||||
}
|
||||
_controls.levelRequested = true;
|
||||
_api.request(MTPpremium_GetBoostsStatus(
|
||||
_peer->input
|
||||
_peer->input()
|
||||
)).done([=](const MTPpremium_BoostsStatus &result) {
|
||||
_controls.levelRequested = false;
|
||||
if (const auto channel = _peer->asChannel()) {
|
||||
@@ -1782,7 +1782,7 @@ void Controller::fillPendingRequestsButton() {
|
||||
{ &st::menuIconInvite });
|
||||
std::move(
|
||||
pendingRequestsCount
|
||||
) | rpl::start_with_next([=](int count) {
|
||||
) | rpl::on_next([=](int count) {
|
||||
wrap->toggle(count > 0, anim::type::instant);
|
||||
}, wrap->lifetime());
|
||||
}
|
||||
@@ -1878,7 +1878,7 @@ void Controller::fillBotCurrencyButton() {
|
||||
const auto currencyLoad
|
||||
= button->lifetime().make_state<Api::EarnStatistics>(_peer);
|
||||
currencyLoad->request(
|
||||
) | rpl::start_with_error_done([=](const QString &error) {
|
||||
) | rpl::on_error_done([=](const QString &error) {
|
||||
}, [=] {
|
||||
const auto balance = currencyLoad->data().currentBalance;
|
||||
if (balance) {
|
||||
@@ -1891,13 +1891,13 @@ void Controller::fillBotCurrencyButton() {
|
||||
const auto icon = Ui::CreateChild<Ui::RpWidget>(button);
|
||||
icon->resize(st::menuIconLinks.size());
|
||||
const auto image = Ui::Earn::MenuIconCurrency(icon->size());
|
||||
icon->paintRequest() | rpl::start_with_next([=] {
|
||||
icon->paintRequest() | rpl::on_next([=] {
|
||||
auto p = QPainter(icon);
|
||||
p.drawImage(0, 0, image);
|
||||
}, icon->lifetime());
|
||||
|
||||
button->sizeValue(
|
||||
) | rpl::start_with_next([=](const QSize &size) {
|
||||
) | rpl::on_next([=](const QSize &size) {
|
||||
icon->moveToLeft(
|
||||
button->st().iconLeft,
|
||||
(size.height() - icon->height()) / 2);
|
||||
@@ -1947,13 +1947,13 @@ void Controller::fillBotCreditsButton() {
|
||||
const auto icon = Ui::CreateChild<Ui::RpWidget>(button);
|
||||
const auto image = Ui::Earn::MenuIconCredits();
|
||||
icon->resize(image.size() / style::DevicePixelRatio());
|
||||
icon->paintRequest() | rpl::start_with_next([=] {
|
||||
icon->paintRequest() | rpl::on_next([=] {
|
||||
auto p = QPainter(icon);
|
||||
p.drawImage(0, 0, image);
|
||||
}, icon->lifetime());
|
||||
|
||||
button->sizeValue(
|
||||
) | rpl::start_with_next([=](const QSize &size) {
|
||||
) | rpl::on_next([=](const QSize &size) {
|
||||
icon->moveToLeft(
|
||||
button->st().iconLeft,
|
||||
(size.height() - icon->height()) / 2);
|
||||
@@ -2284,7 +2284,7 @@ void Controller::saveUsernamesOrder() {
|
||||
}
|
||||
if (_savingData.usernamesOrder->empty()) {
|
||||
_api.request(MTPchannels_DeactivateAllUsernames(
|
||||
channel->inputChannel
|
||||
channel->inputChannel()
|
||||
)).done([=] {
|
||||
channel->setUsernames(channel->editableUsername().isEmpty()
|
||||
? Data::Usernames()
|
||||
@@ -2302,7 +2302,7 @@ void Controller::saveUsernamesOrder() {
|
||||
_peer->session().api().usernames().reorder(
|
||||
_peer,
|
||||
newUsernames
|
||||
) | rpl::start_with_done([=] {
|
||||
) | rpl::on_done([=] {
|
||||
channel->setUsernames(ranges::views::all(
|
||||
newUsernames
|
||||
) | ranges::views::transform([&](QString username) {
|
||||
@@ -2341,7 +2341,7 @@ void Controller::saveUsername() {
|
||||
|
||||
const auto newUsername = (*_savingData.username);
|
||||
_api.request(MTPchannels_UpdateUsername(
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
MTP_string(newUsername)
|
||||
)).done([=] {
|
||||
channel->setName(
|
||||
@@ -2393,11 +2393,11 @@ void Controller::saveDiscussionLink() {
|
||||
}
|
||||
|
||||
const auto input = *_savingData.discussionLink
|
||||
? (*_savingData.discussionLink)->inputChannel
|
||||
? (*_savingData.discussionLink)->inputChannel()
|
||||
: MTP_inputChannelEmpty();
|
||||
_api.request(MTPchannels_SetDiscussionGroup(
|
||||
(channel->isBroadcast() ? channel->inputChannel : input),
|
||||
(channel->isBroadcast() ? input : channel->inputChannel)
|
||||
(channel->isBroadcast() ? channel->inputChannel() : input),
|
||||
(channel->isBroadcast() ? input : channel->inputChannel())
|
||||
)).done([=] {
|
||||
channel->setDiscussionLink(*_savingData.discussionLink);
|
||||
continueSave();
|
||||
@@ -2462,14 +2462,14 @@ void Controller::saveTitle() {
|
||||
|
||||
if (const auto channel = _peer->asChannel()) {
|
||||
_api.request(MTPchannels_EditTitle(
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
MTP_string(*_savingData.title)
|
||||
)).done(std::move(onDone)
|
||||
).fail(std::move(onFail)
|
||||
).send();
|
||||
} else if (const auto chat = _peer->asChat()) {
|
||||
_api.request(MTPmessages_EditChatTitle(
|
||||
chat->inputChat,
|
||||
chat->inputChat(),
|
||||
MTP_string(*_savingData.title)
|
||||
)).done(std::move(onDone)
|
||||
).fail(std::move(onFail)
|
||||
@@ -2477,7 +2477,7 @@ void Controller::saveTitle() {
|
||||
} else if (_isBot) {
|
||||
_api.request(MTPbots_GetBotInfo(
|
||||
MTP_flags(MTPbots_GetBotInfo::Flag::f_bot),
|
||||
_peer->asUser()->inputUser,
|
||||
_peer->asUser()->inputUser(),
|
||||
MTPstring() // Lang code.
|
||||
)).done([=](const MTPbots_BotInfo &result) {
|
||||
const auto was = qs(result.data().vname());
|
||||
@@ -2488,7 +2488,7 @@ void Controller::saveTitle() {
|
||||
using Flag = MTPbots_SetBotInfo::Flag;
|
||||
_api.request(MTPbots_SetBotInfo(
|
||||
MTP_flags(Flag::f_bot | Flag::f_name),
|
||||
_peer->asUser()->inputUser,
|
||||
_peer->asUser()->inputUser(),
|
||||
MTPstring(), // Lang code.
|
||||
MTP_string(now), // Name.
|
||||
MTPstring(), // About.
|
||||
@@ -2516,7 +2516,7 @@ void Controller::saveDescription() {
|
||||
if (_isBot) {
|
||||
_api.request(MTPbots_GetBotInfo(
|
||||
MTP_flags(MTPbots_GetBotInfo::Flag::f_bot),
|
||||
_peer->asUser()->inputUser,
|
||||
_peer->asUser()->inputUser(),
|
||||
MTPstring() // Lang code.
|
||||
)).done([=](const MTPbots_BotInfo &result) {
|
||||
const auto was = qs(result.data().vabout());
|
||||
@@ -2527,7 +2527,7 @@ void Controller::saveDescription() {
|
||||
using Flag = MTPbots_SetBotInfo::Flag;
|
||||
_api.request(MTPbots_SetBotInfo(
|
||||
MTP_flags(Flag::f_bot | Flag::f_about),
|
||||
_peer->asUser()->inputUser,
|
||||
_peer->asUser()->inputUser(),
|
||||
MTPstring(), // Lang code.
|
||||
MTPstring(), // Name.
|
||||
MTP_string(now), // About.
|
||||
@@ -2544,7 +2544,7 @@ void Controller::saveDescription() {
|
||||
return;
|
||||
}
|
||||
_api.request(MTPmessages_EditChatAbout(
|
||||
_peer->input,
|
||||
_peer->input(),
|
||||
MTP_string(*_savingData.description)
|
||||
)).done([=] {
|
||||
successCallback();
|
||||
@@ -2620,7 +2620,7 @@ void Controller::togglePreHistoryHidden(
|
||||
done();
|
||||
};
|
||||
_api.request(MTPchannels_TogglePreHistoryHidden(
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
MTP_bool(hidden)
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
channel->session().api().applyUpdates(result);
|
||||
@@ -2658,7 +2658,7 @@ void Controller::saveForum() {
|
||||
return;
|
||||
}
|
||||
_api.request(MTPchannels_ToggleForum(
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
MTP_bool(*_savingData.forum),
|
||||
MTP_bool(*_savingData.forum && *_savingData.forumTabs)
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
@@ -2685,7 +2685,7 @@ void Controller::saveAutotranslate() {
|
||||
return continueSave();
|
||||
}
|
||||
_api.request(MTPchannels_ToggleAutotranslation(
|
||||
channel->inputChannel,
|
||||
channel->inputChannel(),
|
||||
MTP_bool(*_savingData.autotranslate)
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
channel->session().api().applyUpdates(result);
|
||||
@@ -2721,7 +2721,7 @@ void Controller::saveSignatures() {
|
||||
| (*_savingData.signatureProfiles
|
||||
? Flag::f_profiles_enabled
|
||||
: Flag())),
|
||||
channel->inputChannel
|
||||
channel->inputChannel()
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
channel->session().api().applyUpdates(result);
|
||||
continueSave();
|
||||
@@ -2741,7 +2741,7 @@ void Controller::saveForwards() {
|
||||
return continueSave();
|
||||
}
|
||||
_api.request(MTPmessages_ToggleNoForwards(
|
||||
_peer->input,
|
||||
_peer->input(),
|
||||
MTP_bool(*_savingData.noForwards)
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
_peer->session().api().applyUpdates(result);
|
||||
@@ -2764,7 +2764,7 @@ void Controller::saveJoinToWrite() {
|
||||
return continueSave();
|
||||
}
|
||||
_api.request(MTPchannels_ToggleJoinToSend(
|
||||
_peer->asChannel()->inputChannel,
|
||||
_peer->asChannel()->inputChannel(),
|
||||
MTP_bool(*_savingData.joinToWrite)
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
_peer->session().api().applyUpdates(result);
|
||||
@@ -2787,7 +2787,7 @@ void Controller::saveRequestToJoin() {
|
||||
return continueSave();
|
||||
}
|
||||
_api.request(MTPchannels_ToggleJoinRequest(
|
||||
_peer->asChannel()->inputChannel,
|
||||
_peer->asChannel()->inputChannel(),
|
||||
MTP_bool(*_savingData.requestToJoin)
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
_peer->session().api().applyUpdates(result);
|
||||
@@ -2847,7 +2847,7 @@ void Controller::deleteChannel() {
|
||||
session->api().deleteConversation(chat, false);
|
||||
}
|
||||
session->api().request(MTPchannels_DeleteChannel(
|
||||
channel->inputChannel
|
||||
channel->inputChannel()
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
session->api().applyUpdates(result);
|
||||
//}).fail([=](const MTP::Error &error) {
|
||||
@@ -2875,7 +2875,7 @@ void EditPeerInfoBox::prepare() {
|
||||
this,
|
||||
_peer);
|
||||
_focusRequests.events(
|
||||
) | rpl::start_with_next(
|
||||
) | rpl::on_next(
|
||||
[=] { controller->setFocus(); },
|
||||
lifetime());
|
||||
auto content = controller->createContent();
|
||||
@@ -2895,7 +2895,7 @@ object_ptr<Ui::SettingsButton> EditPeerInfoBox::CreateButton(
|
||||
return CreateButton(
|
||||
parent,
|
||||
std::move(text),
|
||||
std::move(count) | Ui::Text::ToWithEntities(),
|
||||
std::move(count) | rpl::map(tr::marked),
|
||||
std::move(callback),
|
||||
st,
|
||||
std::move(descriptor));
|
||||
@@ -2939,7 +2939,7 @@ object_ptr<Ui::SettingsButton> EditPeerInfoBox::CreateButton(
|
||||
rpl::duplicate(text),
|
||||
std::move(labelText),
|
||||
button->widthValue()
|
||||
) | rpl::start_with_next([&st, label](
|
||||
) | rpl::on_next([&st, label](
|
||||
const QString &text,
|
||||
const TextWithEntities &labelText,
|
||||
int width) {
|
||||
@@ -2961,7 +2961,7 @@ object_ptr<Ui::SettingsButton> EditPeerInfoBox::CreateButton(
|
||||
std::move(text),
|
||||
label->widthValue(),
|
||||
button->widthValue()
|
||||
) | rpl::start_with_next([=](
|
||||
) | rpl::on_next([=](
|
||||
const QString &text,
|
||||
int labelWidth,
|
||||
int width) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user