mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-25 10:01:00 +00:00
Show saved messages entry point from profiles.
This commit is contained in:
parent
fd417024fb
commit
4e6d8f06d9
BIN
Telegram/Resources/icons/info/info_media_saved.png
Normal file
BIN
Telegram/Resources/icons/info/info_media_saved.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 380 B |
BIN
Telegram/Resources/icons/info/info_media_saved@2x.png
Normal file
BIN
Telegram/Resources/icons/info/info_media_saved@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 664 B |
BIN
Telegram/Resources/icons/info/info_media_saved@3x.png
Normal file
BIN
Telegram/Resources/icons/info/info_media_saved@3x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 954 B |
@ -1188,6 +1188,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_profile_common_groups#other" = "{count} groups in common";
|
||||
"lng_profile_similar_channels#one" = "{count} similar channel";
|
||||
"lng_profile_similar_channels#other" = "{count} similar channels";
|
||||
"lng_profile_saved_messages#one" = "{count} saved message";
|
||||
"lng_profile_saved_messages#other" = "{count} saved messages";
|
||||
"lng_profile_participants_section" = "Members";
|
||||
"lng_profile_subscribers_section" = "Subscribers";
|
||||
"lng_profile_add_contact" = "Add Contact";
|
||||
|
@ -398,6 +398,7 @@ infoIconMediaGroup: icon {{ "info/info_common_groups", infoIconFg }};
|
||||
infoIconMediaChannel: icon {{ "menu/channel", infoIconFg, point(4px, 4px) }};
|
||||
infoIconMediaVoice: icon {{ "info/info_media_voice", infoIconFg }};
|
||||
infoIconMediaStories: icon {{ "info/info_media_stories", infoIconFg }};
|
||||
infoIconMediaSaved: icon {{ "info/info_media_saved", infoIconFg }};
|
||||
infoIconMediaStoriesArchive: icon {{ "info/info_stories_archive", infoIconFg }};
|
||||
infoIconMediaStoriesRecent: icon {{ "info/info_stories_recent", infoIconFg }};
|
||||
|
||||
|
@ -10,8 +10,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include <rpl/mappers.h>
|
||||
#include <rpl/map.h>
|
||||
#include "lang/lang_keys.h"
|
||||
#include "data/data_saved_messages.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_stories_ids.h"
|
||||
#include "storage/storage_shared_media.h"
|
||||
#include "history/view/history_view_sublist_section.h"
|
||||
#include "info/info_memento.h"
|
||||
#include "info/info_controller.h"
|
||||
#include "info/profile/info_profile_values.h"
|
||||
@ -126,7 +129,7 @@ inline auto AddCommonGroupsButton(
|
||||
Section::Type::CommonGroups));
|
||||
});
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
inline auto AddSimilarChannelsButton(
|
||||
Ui::VerticalLayout *parent,
|
||||
@ -150,7 +153,7 @@ inline auto AddSimilarChannelsButton(
|
||||
Section::Type::SimilarChannels));
|
||||
});
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
inline auto AddStoriesButton(
|
||||
Ui::VerticalLayout *parent,
|
||||
@ -178,6 +181,26 @@ inline auto AddStoriesButton(
|
||||
navigation->showSection(Info::Stories::Make(peer));
|
||||
});
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
inline auto AddSavedSublistButton(
|
||||
Ui::VerticalLayout *parent,
|
||||
not_null<Window::SessionNavigation*> navigation,
|
||||
not_null<PeerData*> peer,
|
||||
Ui::MultiSlideTracker &tracker) {
|
||||
auto result = AddCountedButton(
|
||||
parent,
|
||||
Profile::SavedSublistCountValue(peer),
|
||||
[](int count) {
|
||||
return tr::lng_profile_saved_messages(tr::now, lt_count, count);
|
||||
},
|
||||
tracker)->entity();
|
||||
result->addClickHandler([=] {
|
||||
navigation->showSection(
|
||||
std::make_shared<HistoryView::SublistMemento>(
|
||||
peer->owner().savedMessages().sublist(peer)));
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace Info::Media
|
||||
|
@ -215,8 +215,22 @@ object_ptr<Ui::RpWidget> InnerWidget::setupSharedMedia(
|
||||
icon,
|
||||
st::infoSharedMediaButtonIconPosition);
|
||||
};
|
||||
auto addSavedSublistButton = [&](
|
||||
not_null<PeerData*> peer,
|
||||
const style::icon &icon) {
|
||||
auto result = Media::AddSavedSublistButton(
|
||||
content,
|
||||
_controller,
|
||||
peer,
|
||||
tracker);
|
||||
object_ptr<Profile::FloatingIcon>(
|
||||
result,
|
||||
icon,
|
||||
st::infoSharedMediaButtonIconPosition);
|
||||
};
|
||||
|
||||
addStoriesButton(_peer, st::infoIconMediaStories);
|
||||
addSavedSublistButton(_peer, st::infoIconMediaSaved);
|
||||
addMediaButton(MediaType::Photo, st::infoIconMediaPhoto);
|
||||
addMediaButton(MediaType::Video, st::infoIconMediaVideo);
|
||||
addMediaButton(MediaType::File, st::infoIconMediaFile);
|
||||
|
@ -20,6 +20,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "lang/lang_keys.h"
|
||||
#include "data/notify/data_notify_settings.h"
|
||||
#include "data/data_peer_values.h"
|
||||
#include "data/data_saved_messages.h"
|
||||
#include "data/data_saved_sublist.h"
|
||||
#include "data/data_shared_media.h"
|
||||
#include "data/data_message_reactions.h"
|
||||
#include "data/data_folder.h"
|
||||
@ -536,6 +538,17 @@ rpl::producer<int> SimilarChannelsCountValue(
|
||||
});
|
||||
}
|
||||
|
||||
rpl::producer<int> SavedSublistCountValue(
|
||||
not_null<PeerData*> peer) {
|
||||
const auto saved = &peer->owner().savedMessages();
|
||||
const auto sublist = saved->sublist(peer);
|
||||
if (!sublist->fullCount()) {
|
||||
saved->loadMore(sublist);
|
||||
return rpl::single(0) | rpl::then(sublist->fullCountValue());
|
||||
}
|
||||
return sublist->fullCountValue();
|
||||
}
|
||||
|
||||
rpl::producer<bool> CanAddMemberValue(not_null<PeerData*> peer) {
|
||||
if (const auto chat = peer->asChat()) {
|
||||
return peer->session().changes().peerFlagsValue(
|
||||
|
@ -104,6 +104,8 @@ rpl::producer<not_null<PeerData*>> MigratedOrMeValue(
|
||||
not_null<UserData*> user);
|
||||
[[nodiscard]] rpl::producer<int> SimilarChannelsCountValue(
|
||||
not_null<ChannelData*> channel);
|
||||
[[nodiscard]] rpl::producer<int> SavedSublistCountValue(
|
||||
not_null<PeerData*> peer);
|
||||
[[nodiscard]] rpl::producer<bool> CanAddMemberValue(
|
||||
not_null<PeerData*> peer);
|
||||
[[nodiscard]] rpl::producer<int> FullReactionsCountValue(
|
||||
|
Loading…
Reference in New Issue
Block a user