mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Slightly improved share message phrase factory to be more flexible.
This commit is contained in:
@@ -1796,7 +1796,9 @@ ShareBox::SubmitCallback ShareBox::DefaultForwardCallback(
|
||||
auto phrase = rpl::variable<TextWithEntities>(
|
||||
ChatHelpers::ForwardedMessagePhrase(
|
||||
donePhraseArgs)).current();
|
||||
show->showToast(std::move(phrase));
|
||||
if (!phrase.empty()) {
|
||||
show->showToast(std::move(phrase));
|
||||
}
|
||||
show->hideLayer();
|
||||
}
|
||||
}
|
||||
@@ -1954,7 +1956,9 @@ void FastShareMessageToSelf(
|
||||
auto phrase = rpl::variable<TextWithEntities>(
|
||||
ChatHelpers::ForwardedMessagePhrase(
|
||||
donePhraseArgs)).current();
|
||||
show->showToast(std::move(phrase));
|
||||
if (!phrase.empty()) {
|
||||
show->showToast(std::move(phrase));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@ rpl::producer<TextWithEntities> ForwardedMessagePhrase(
|
||||
Assert(args.to1);
|
||||
|
||||
if (args.to1->isSelf()) {
|
||||
if (args.toSelfWithPremiumIsEmpty && args.to1->isPremium()) {
|
||||
return {};
|
||||
}
|
||||
return (args.singleMessage
|
||||
? tr::lng_share_message_to_saved_messages
|
||||
: tr::lng_share_messages_to_saved_messages)(
|
||||
|
||||
@@ -16,6 +16,7 @@ struct ForwardedMessagePhraseArgs final {
|
||||
bool singleMessage = false;
|
||||
PeerData *to1 = nullptr;
|
||||
PeerData *to2 = nullptr;
|
||||
bool toSelfWithPremiumIsEmpty = true;
|
||||
};
|
||||
|
||||
rpl::producer<TextWithEntities> ForwardedMessagePhrase(
|
||||
|
||||
@@ -3908,7 +3908,9 @@ void ForwardToSelf(
|
||||
.singleMessage = (count == 1),
|
||||
.to1 = session->user(),
|
||||
})).current();
|
||||
show->showToast(std::move(phrase));
|
||||
if (!phrase.empty()) {
|
||||
show->showToast(std::move(phrase));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user