mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Allow filtering resale gifts by-stars-only.
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 652 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
@@ -4133,9 +4133,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_gift_resale_date" = "Date";
|
||||
"lng_gift_resale_count#one" = "{count} gift in resale";
|
||||
"lng_gift_resale_count#other" = "{count} gifts in resale";
|
||||
"lng_gift_resale_count_none" = "No listings";
|
||||
"lng_gift_resale_sort_price" = "Sort by Price";
|
||||
"lng_gift_resale_sort_date" = "Sort by Date";
|
||||
"lng_gift_resale_sort_number" = "Sort by Number";
|
||||
"lng_gift_resale_all_listings" = "All Listings";
|
||||
"lng_gift_resale_stars_only" = "For Stars Only";
|
||||
"lng_gift_resale_filter_all" = "Select All";
|
||||
"lng_gift_resale_model" = "Model";
|
||||
"lng_gift_resale_models#one" = "{count} Model";
|
||||
@@ -4148,6 +4151,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_gift_resale_symbols#other" = "{count} Symbols";
|
||||
"lng_gift_resale_switch_to_ton" = "Switch to Ton";
|
||||
"lng_gift_resale_switch_to_stars" = "Switch to Stars";
|
||||
"lng_gift_resale_search_none" = "No gifts found for your search.";
|
||||
"lng_gift_resale_early" = "You will be able to resell this gift in {duration}.";
|
||||
"lng_gift_transfer_early" = "You will be able to transfer this gift in {duration}.";
|
||||
"lng_gift_resale_transfer_early_title" = "Try Later";
|
||||
|
||||
@@ -248,6 +248,18 @@ struct ResaleTabs {
|
||||
actionWithIcon(tr::lng_gift_resale_sort_number(tr::now), [=] {
|
||||
sort(ResaleGiftsSort::Number);
|
||||
}, &st::menuIconOrderNumber, is(ResaleGiftsSort::Number));
|
||||
menu->addSeparator();
|
||||
const auto starsOnly = state->filter.current().starsOnly;
|
||||
actionWithIcon(tr::lng_gift_resale_all_listings(tr::now), [=] {
|
||||
modify([&](ResaleGiftsFilter &filter) {
|
||||
filter.starsOnly = false;
|
||||
});
|
||||
}, &st::menuIconTopics, !starsOnly);
|
||||
actionWithIcon(tr::lng_gift_resale_stars_only(tr::now), [=] {
|
||||
modify([&](ResaleGiftsFilter &filter) {
|
||||
filter.starsOnly = true;
|
||||
});
|
||||
}, &st::menuIconStar, starsOnly);
|
||||
} else {
|
||||
const auto now = state->filter.current().attributes;
|
||||
const auto type = IndexToType(index);
|
||||
@@ -503,7 +515,12 @@ void GiftResaleBox(
|
||||
const auto countLabel = titleWrap->add(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
titleWrap,
|
||||
tr::lng_gift_resale_count(tr::now, lt_count, descriptor.count),
|
||||
(descriptor.count
|
||||
? tr::lng_gift_resale_count(
|
||||
tr::now,
|
||||
lt_count,
|
||||
descriptor.count)
|
||||
: tr::lng_gift_resale_count_none(tr::now)),
|
||||
st::defaultFlatLabel),
|
||||
QMargins(
|
||||
st::boxRowPadding.left(),
|
||||
@@ -547,7 +564,17 @@ void GiftResaleBox(
|
||||
peer,
|
||||
content,
|
||||
std::move(descriptor),
|
||||
state->ton.value());
|
||||
state->ton.value(),
|
||||
nullptr,
|
||||
false,
|
||||
[=](int count) {
|
||||
countLabel->setText(count
|
||||
? tr::lng_gift_resale_count(
|
||||
tr::now,
|
||||
lt_count,
|
||||
count)
|
||||
: tr::lng_gift_resale_count_none(tr::now));
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -559,7 +586,8 @@ void AddResaleGiftsList(
|
||||
Data::ResaleGiftsDescriptor descriptor,
|
||||
rpl::producer<bool> forceTon,
|
||||
Fn<void(std::shared_ptr<Data::UniqueGift>)> bought,
|
||||
bool forCraft) {
|
||||
bool forCraft,
|
||||
Fn<void(int)> countChanged) {
|
||||
struct State {
|
||||
rpl::event_stream<> updated;
|
||||
ResaleGiftsDescriptor data;
|
||||
@@ -606,7 +634,11 @@ void AddResaleGiftsList(
|
||||
state->data.offset = slice.list.empty()
|
||||
? QString()
|
||||
: slice.offset;
|
||||
state->data.count = slice.count;
|
||||
state->data.list = std::move(slice.list);
|
||||
if (countChanged) {
|
||||
countChanged(state->data.count);
|
||||
}
|
||||
state->updated.fire({});
|
||||
});
|
||||
}, container->lifetime());
|
||||
@@ -712,7 +744,9 @@ void AddResaleGiftsList(
|
||||
container,
|
||||
object_ptr<FlatLabel>(
|
||||
container,
|
||||
tr::lng_gift_craft_search_none(),
|
||||
(forCraft
|
||||
? tr::lng_gift_craft_search_none()
|
||||
: tr::lng_gift_resale_search_none()),
|
||||
st::craftYourListEmpty),
|
||||
(st::boxRowPadding + QMargins(0, 0, 0, skip))),
|
||||
style::al_top);
|
||||
|
||||
@@ -48,6 +48,7 @@ void AddResaleGiftsList(
|
||||
Data::ResaleGiftsDescriptor descriptor,
|
||||
rpl::producer<bool> forceTon,
|
||||
Fn<void(std::shared_ptr<Data::UniqueGift>)> bought = nullptr,
|
||||
bool forCraft = false);
|
||||
bool forCraft = false,
|
||||
Fn<void(int)> countChanged = nullptr);
|
||||
|
||||
} // namespace Ui
|
||||
|
||||
@@ -236,7 +236,8 @@ rpl::producer<ResaleGiftsDescriptor> ResaleGiftsSlice(
|
||||
| (filter.attributes.empty()
|
||||
? Flag()
|
||||
: Flag::f_attributes)
|
||||
| (filter.forCraft ? Flag::f_for_craft : Flag())),
|
||||
| (filter.forCraft ? Flag::f_for_craft : Flag())
|
||||
| (filter.starsOnly ? Flag::f_stars_only : Flag())),
|
||||
MTP_long(filter.attributesHash),
|
||||
MTP_long(giftId),
|
||||
MTP_vector_from_range(filter.attributes
|
||||
|
||||
@@ -397,6 +397,7 @@ struct ResaleGiftsFilter {
|
||||
base::flat_set<GiftAttributeId> attributes;
|
||||
ResaleGiftsSort sort = ResaleGiftsSort::Price;
|
||||
bool forCraft = false;
|
||||
bool starsOnly = false;
|
||||
|
||||
friend inline bool operator==(
|
||||
const ResaleGiftsFilter &,
|
||||
|
||||
@@ -208,6 +208,7 @@ menuIconTagEdit: icon{{ "menu/tag_edit-24x24", menuIconColor }};
|
||||
menuIconDownloadOff: icon {{ "menu/download_off-24x24", menuIconColor }};
|
||||
menuIconShareOff: icon {{ "menu/share_off-24x24", menuIconColor }};
|
||||
menuIconShareOn: icon {{ "menu/share_on-24x24", menuIconColor }};
|
||||
menuIconStar: icon {{ "menu/star", menuIconColor }};
|
||||
|
||||
menuIconTTLAny: icon {{ "menu/auto_delete_plain", menuIconColor }};
|
||||
menuIconTTLAnyTextPosition: point(11px, 22px);
|
||||
|
||||
Reference in New Issue
Block a user