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

Fixed opening of shared media in corresponding window from media viewer.

This commit is contained in:
23rd
2022-06-08 14:36:40 +03:00
parent fe2455dea6
commit 37f96534ec
6 changed files with 13 additions and 34 deletions

View File

@@ -9,23 +9,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <rpl/combine.h>
#include "main/main_session.h"
#include "main/main_domain.h"
#include "core/application.h"
#include "apiwrap.h"
#include "storage/storage_facade.h"
#include "storage/storage_shared_media.h"
#include "history/history.h"
#include "history/history_item.h"
#include "data/data_document.h"
#include "data/data_media_types.h"
#include "data/data_photo.h"
#include "data/data_scheduled_messages.h"
#include "data/data_sparse_ids.h"
#include "data/data_session.h"
#include "info/info_memento.h"
#include "info/info_controller.h"
#include "window/window_session_controller.h"
#include "mainwindow.h"
#include "core/crash_reports.h"
namespace {
@@ -92,23 +84,6 @@ std::optional<Storage::SharedMediaType> SharedMediaOverviewType(
return std::nullopt;
}
void SharedMediaShowOverview(
Storage::SharedMediaType type,
not_null<History*> history) {
if (SharedMediaOverviewType(type)) {
const auto &windows = history->session().windows();
if (windows.empty()) {
Core::App().domain().activate(&history->session().account());
if (windows.empty()) {
return;
}
}
windows.front()->showSection(std::make_shared<Info::Memento>(
history->peer,
Info::Section(type)));
}
}
bool SharedMediaAllowSearch(Storage::SharedMediaType type) {
switch (type) {
case Type::MusicFile:

View File

@@ -11,17 +11,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/weak_ptr.h"
#include "data/data_sparse_ids.h"
class History;
namespace Main {
class Session;
} // namespace Main
std::optional<Storage::SharedMediaType> SharedMediaOverviewType(
[[nodiscard]] std::optional<Storage::SharedMediaType> SharedMediaOverviewType(
Storage::SharedMediaType type);
void SharedMediaShowOverview(
Storage::SharedMediaType type,
not_null<History*> history);
bool SharedMediaAllowSearch(Storage::SharedMediaType type);
rpl::producer<SparseIdsSlice> SharedMediaViewer(