mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Use stories ShareBox from the saved stories list.
This commit is contained in:
parent
5f72a5238c
commit
a733b83642
4 changed files with 24 additions and 10 deletions
|
@ -33,6 +33,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "history/view/history_view_cursor_state.h"
|
||||
#include "history/view/history_view_service_message.h"
|
||||
#include "media/stories/media_stories_controller.h" // ...TogglePinnedToast.
|
||||
#include "media/stories/media_stories_share.h" // PrepareShareBox.
|
||||
#include "window/window_session_controller.h"
|
||||
#include "window/window_peer_menu.h"
|
||||
#include "ui/widgets/popup_menu.h"
|
||||
|
@ -1104,7 +1105,16 @@ void ListWidget::contextMenuEvent(QContextMenuEvent *e) {
|
|||
}
|
||||
|
||||
void ListWidget::forwardSelected() {
|
||||
if (auto items = collectSelectedIds(); !items.empty()) {
|
||||
if (_controller->storiesPeer()) {
|
||||
const auto ids = collectSelectedIds();
|
||||
if (ids.size() == 1 && IsStoryMsgId(ids.front().msg)) {
|
||||
const auto id = ids.front();
|
||||
_controller->parentController()->show(
|
||||
::Media::Stories::PrepareShareBox(
|
||||
_controller->parentController()->uiShow(),
|
||||
{ id.peer, StoryIdFromMsgId(id.msg) }));
|
||||
}
|
||||
} else if (auto items = collectSelectedIds(); !items.empty()) {
|
||||
forwardItems(std::move(items));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1245,7 +1245,7 @@ void Controller::unfocusReply() {
|
|||
|
||||
void Controller::shareRequested() {
|
||||
const auto show = _delegate->storiesShow();
|
||||
if (auto box = PrepareShareBox(show, _shown)) {
|
||||
if (auto box = PrepareShareBox(show, _shown, true)) {
|
||||
show->show(std::move(box));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,8 @@ namespace Media::Stories {
|
|||
|
||||
[[nodiscard]] object_ptr<Ui::BoxContent> PrepareShareBox(
|
||||
std::shared_ptr<ChatHelpers::Show> show,
|
||||
FullStoryId id) {
|
||||
FullStoryId id,
|
||||
bool viewerStyle) {
|
||||
const auto session = &show->session();
|
||||
const auto resolve = [=] {
|
||||
const auto maybeStory = session->data().stories().lookup(id);
|
||||
|
@ -170,7 +171,7 @@ namespace Media::Stories {
|
|||
}
|
||||
};
|
||||
|
||||
const auto scheduleStyle = [&] {
|
||||
const auto viewerScheduleStyle = [&] {
|
||||
auto date = Ui::ChooseDateTimeStyleArgs();
|
||||
date.labelStyle = &st::groupCallBoxLabel;
|
||||
date.dateFieldStyle = &st::groupCallScheduleDateField;
|
||||
|
@ -191,11 +192,13 @@ namespace Media::Stories {
|
|||
.copyCallback = std::move(copyLinkCallback),
|
||||
.submitCallback = std::move(submitCallback),
|
||||
.filterCallback = std::move(filterCallback),
|
||||
.stMultiSelect = &st::groupCallMultiSelect,
|
||||
.stComment = &st::groupCallShareBoxComment,
|
||||
.st = &st::groupCallShareBoxList,
|
||||
.stLabel = &st::groupCallField,
|
||||
.scheduleBoxStyle = scheduleStyle(),
|
||||
.stMultiSelect = viewerStyle ? &st::groupCallMultiSelect : nullptr,
|
||||
.stComment = viewerStyle ? &st::groupCallShareBoxComment : nullptr,
|
||||
.st = viewerStyle ? &st::groupCallShareBoxList : nullptr,
|
||||
.stLabel = viewerStyle ? &st::groupCallField : nullptr,
|
||||
.scheduleBoxStyle = (viewerStyle
|
||||
? viewerScheduleStyle()
|
||||
: HistoryView::ScheduleBoxStyleArgs()),
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ namespace Media::Stories {
|
|||
|
||||
[[nodiscard]] object_ptr<Ui::BoxContent> PrepareShareBox(
|
||||
std::shared_ptr<ChatHelpers::Show> show,
|
||||
FullStoryId id);
|
||||
FullStoryId id,
|
||||
bool viewerStyle = false);
|
||||
|
||||
} // namespace Media::Stories
|
||||
|
|
Loading…
Add table
Reference in a new issue