mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fixed display of archiving toasts on wrong window.
This commit is contained in:
parent
9201cf24f1
commit
01906c1161
3 changed files with 14 additions and 7 deletions
|
@ -714,8 +714,9 @@ void ContactStatus::setupShareHandler(not_null<UserData*> user) {
|
||||||
|
|
||||||
void ContactStatus::setupUnarchiveHandler(not_null<PeerData*> peer) {
|
void ContactStatus::setupUnarchiveHandler(not_null<PeerData*> peer) {
|
||||||
_inner->unarchiveClicks(
|
_inner->unarchiveClicks(
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=, show = _controller->uiShow()] {
|
||||||
Window::ToggleHistoryArchived(peer->owner().history(peer), false);
|
using namespace Window;
|
||||||
|
ToggleHistoryArchived(show, peer->owner().history(peer), false);
|
||||||
peer->owner().notifySettings().resetToDefault(peer);
|
peer->owner().notifySettings().resetToDefault(peer);
|
||||||
if (const auto settings = peer->settings()) {
|
if (const auto settings = peer->settings()) {
|
||||||
const auto flags = PeerSetting::AutoArchived
|
const auto flags = PeerSetting::AutoArchived
|
||||||
|
|
|
@ -652,8 +652,8 @@ void Filler::addToggleArchive() {
|
||||||
? tr::lng_archived_remove(tr::now)
|
? tr::lng_archived_remove(tr::now)
|
||||||
: tr::lng_archived_add(tr::now);
|
: tr::lng_archived_add(tr::now);
|
||||||
};
|
};
|
||||||
const auto toggle = [=] {
|
const auto toggle = [=, show = _controller->uiShow()] {
|
||||||
ToggleHistoryArchived(history, !isArchived());
|
ToggleHistoryArchived(show, history, !isArchived());
|
||||||
};
|
};
|
||||||
const auto archiveAction = _addAction(
|
const auto archiveAction = _addAction(
|
||||||
label(),
|
label(),
|
||||||
|
@ -2406,9 +2406,12 @@ void MenuAddMarkAsReadChatListAction(
|
||||||
&st::menuIconMarkRead);
|
&st::menuIconMarkRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToggleHistoryArchived(not_null<History*> history, bool archived) {
|
void ToggleHistoryArchived(
|
||||||
|
std::shared_ptr<ChatHelpers::Show> show,
|
||||||
|
not_null<History*> history,
|
||||||
|
bool archived) {
|
||||||
const auto callback = [=] {
|
const auto callback = [=] {
|
||||||
Ui::Toast::Show(Ui::Toast::Config{
|
show->showToast(Ui::Toast::Config{
|
||||||
.text = { (archived
|
.text = { (archived
|
||||||
? tr::lng_archived_added(tr::now)
|
? tr::lng_archived_added(tr::now)
|
||||||
: tr::lng_archived_removed(tr::now)) },
|
: tr::lng_archived_removed(tr::now)) },
|
||||||
|
|
|
@ -116,7 +116,10 @@ void BlockSenderFromRepliesBox(
|
||||||
not_null<Window::SessionController*> controller,
|
not_null<Window::SessionController*> controller,
|
||||||
FullMsgId id);
|
FullMsgId id);
|
||||||
|
|
||||||
void ToggleHistoryArchived(not_null<History*> history, bool archived);
|
void ToggleHistoryArchived(
|
||||||
|
std::shared_ptr<ChatHelpers::Show> show,
|
||||||
|
not_null<History*> history,
|
||||||
|
bool archived);
|
||||||
Fn<void()> ClearHistoryHandler(
|
Fn<void()> ClearHistoryHandler(
|
||||||
not_null<Window::SessionController*> controller,
|
not_null<Window::SessionController*> controller,
|
||||||
not_null<PeerData*> peer);
|
not_null<PeerData*> peer);
|
||||||
|
|
Loading…
Add table
Reference in a new issue