mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 23:27:09 +02:00
Show saved stories / current stories in channels.
This commit is contained in:
parent
f3e65181cd
commit
f3647d7f8c
4 changed files with 12 additions and 13 deletions
|
@ -129,10 +129,10 @@ inline auto AddCommonGroupsButton(
|
|||
inline auto AddStoriesButton(
|
||||
Ui::VerticalLayout *parent,
|
||||
not_null<Window::SessionNavigation*> navigation,
|
||||
not_null<UserData*> user,
|
||||
not_null<PeerData*> peer,
|
||||
Ui::MultiSlideTracker &tracker) {
|
||||
auto count = rpl::single(0) | rpl::then(Data::SavedStoriesIds(
|
||||
user,
|
||||
peer,
|
||||
ServerMaxStoryId - 1,
|
||||
0
|
||||
) | rpl::map([](const Data::StoriesIdsSlice &slice) {
|
||||
|
@ -146,7 +146,7 @@ inline auto AddStoriesButton(
|
|||
},
|
||||
tracker)->entity();
|
||||
result->addClickHandler([=] {
|
||||
navigation->showSection(Info::Stories::Make(user));
|
||||
navigation->showSection(Info::Stories::Make(peer));
|
||||
});
|
||||
return result;
|
||||
};
|
||||
|
|
|
@ -187,12 +187,15 @@ object_ptr<Ui::RpWidget> InnerWidget::setupSharedMedia(
|
|||
st::infoSharedMediaButtonIconPosition);
|
||||
};
|
||||
auto addStoriesButton = [&](
|
||||
not_null<UserData*> user,
|
||||
not_null<PeerData*> peer,
|
||||
const style::icon &icon) {
|
||||
if (peer->isChat()) {
|
||||
return;
|
||||
}
|
||||
auto result = Media::AddStoriesButton(
|
||||
content,
|
||||
_controller,
|
||||
user,
|
||||
peer,
|
||||
tracker);
|
||||
object_ptr<Profile::FloatingIcon>(
|
||||
result,
|
||||
|
@ -200,9 +203,7 @@ object_ptr<Ui::RpWidget> InnerWidget::setupSharedMedia(
|
|||
st::infoSharedMediaButtonIconPosition);
|
||||
};
|
||||
|
||||
if (auto user = _peer->asUser()) {
|
||||
addStoriesButton(user, st::infoIconMediaStories);
|
||||
}
|
||||
addStoriesButton(_peer, st::infoIconMediaStories);
|
||||
addMediaButton(MediaType::Photo, st::infoIconMediaPhoto);
|
||||
addMediaButton(MediaType::Video, st::infoIconMediaVideo);
|
||||
addMediaButton(MediaType::File, st::infoIconMediaFile);
|
||||
|
|
|
@ -110,10 +110,8 @@ rpl::producer<QString> Widget::title() {
|
|||
|
||||
rpl::producer<Dialogs::Stories::Content> Widget::titleStories() {
|
||||
const auto peer = controller()->key().peer();
|
||||
if (const auto user = peer->asUser()) {
|
||||
if (!user->isBot()) {
|
||||
return Dialogs::Stories::LastForPeer(user);
|
||||
}
|
||||
if (peer && !peer->isChat()) {
|
||||
return Dialogs::Stories::LastForPeer(peer);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -2218,7 +2218,7 @@ bool SessionController::openSharedStory(HistoryItem *item) {
|
|||
bool SessionController::openFakeItemStory(
|
||||
FullMsgId fakeItemId,
|
||||
const Data::StoriesContext *stories) {
|
||||
if (!peerIsUser(fakeItemId.peer)
|
||||
if (peerIsChat(fakeItemId.peer)
|
||||
|| !IsStoryMsgId(fakeItemId.msg)) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue