MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / ShowVoteRestrictionToast

Function ShowVoteRestrictionToast

Telegram/SourceFiles/api/api_polls.cpp:94–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92}
93
94void ShowVoteRestrictionToast(
95 not_null<PeerData*> peer,
96 not_null<const PollData*> poll,
97 PollData::VoteRestriction restriction) {
98 if (restriction == PollData::VoteRestriction::None) {
99 return;
100 }
101 auto text = PollVoteRestrictionText(restriction, peer, poll);
102 if (text.text.isEmpty()) {
103 return;
104 }
105 if (const auto window = peer->session().tryResolveWindow(peer)) {
106 window->showToast({
107 .text = std::move(text),
108 .iconLottie = u"ban"_q,
109 .iconLottieSize = st::pollToastIconSize,
110 .duration = kVoteRestrictionToastDuration,
111 });
112 }
113}
114
115#ifdef _DEBUG
116[[nodiscard]] Data::StatisticalGraph GenerateMockupPollStats(

Callers 1

sendVotesMethod · 0.85

Calls 5

PollVoteRestrictionTextFunction · 0.85
tryResolveWindowMethod · 0.80
isEmptyMethod · 0.45
sessionMethod · 0.45
showToastMethod · 0.45

Tested by

no test coverage detected