2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Show toasts on reply / archive / unarchive.

This commit is contained in:
John Preston
2023-06-15 20:28:53 +04:00
parent ff835ec76c
commit ad5b96b049
7 changed files with 49 additions and 17 deletions

View File

@@ -16,16 +16,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_document.h"
#include "data/data_file_origin.h"
#include "data/data_photo.h"
#include "data/data_session.h"
#include "lang/lang_keys.h"
#include "main/main_session.h"
#include "ui/text/text_utilities.h"
// #TODO stories testing
#include "data/data_user.h"
#include "data/data_session.h"
#include "data/data_thread.h"
#include "history/history.h"
#include "history/history_item.h"
#include "storage/storage_shared_media.h"
#include "lang/lang_keys.h"
#include "main/main_session.h"
#include "ui/layers/show.h"
#include "ui/text/text_utilities.h"
namespace Data {
namespace {
@@ -1140,7 +1139,10 @@ void Stories::markAsRead(FullStoryId id, bool viewed) {
_markReadTimer.callOnce(kMarkAsReadDelay);
}
void Stories::toggleHidden(PeerId peerId, bool hidden) {
void Stories::toggleHidden(
PeerId peerId,
bool hidden,
std::shared_ptr<Ui::Show> show) {
const auto user = _owner->peer(peerId)->asUser();
Assert(user != nullptr);
if (user->hasStoriesHidden() != hidden) {
@@ -1153,6 +1155,14 @@ void Stories::toggleHidden(PeerId peerId, bool hidden) {
)).send();
}
const auto guard = gsl::finally([&] {
if (show) {
show->showToast(hidden
? tr::lng_stories_hidden_to_contacts(tr::now)
: tr::lng_stories_shown_in_chats(tr::now));
}
});
const auto i = _all.find(peerId);
if (i == end(_all)) {
return;