mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Removed Ui::show from EditAdminBox and EditRestrictedBox.
This commit is contained in:
parent
1f8f462461
commit
bdb2a5f277
2 changed files with 33 additions and 25 deletions
|
@ -204,6 +204,7 @@ EditAdminBox::EditAdminBox(
|
||||||
peer,
|
peer,
|
||||||
user,
|
user,
|
||||||
(rights.flags != 0))
|
(rights.flags != 0))
|
||||||
|
, _show(this)
|
||||||
, _oldRights(rights)
|
, _oldRights(rights)
|
||||||
, _oldRank(rank) {
|
, _oldRank(rank) {
|
||||||
}
|
}
|
||||||
|
@ -534,15 +535,19 @@ void EditAdminBox::sendTransferRequestFrom(
|
||||||
channel->inputChannel,
|
channel->inputChannel,
|
||||||
user->inputUser,
|
user->inputUser,
|
||||||
result.result
|
result.result
|
||||||
)).done([=](const MTPUpdates &result) {
|
)).done([=, toastParent = _show.toastParent()](const MTPUpdates &result) {
|
||||||
api->applyUpdates(result);
|
api->applyUpdates(result);
|
||||||
Ui::Toast::Show((channel->isBroadcast()
|
Ui::Toast::Show(
|
||||||
? tr::lng_rights_transfer_done_channel
|
toastParent,
|
||||||
: tr::lng_rights_transfer_done_group)(
|
(channel->isBroadcast()
|
||||||
tr::now,
|
? tr::lng_rights_transfer_done_channel
|
||||||
lt_user,
|
: tr::lng_rights_transfer_done_group)(
|
||||||
user->shortName()));
|
tr::now,
|
||||||
Ui::hideLayer();
|
lt_user,
|
||||||
|
user->shortName()));
|
||||||
|
if (weak) {
|
||||||
|
_show.hideLayer();
|
||||||
|
}
|
||||||
}).fail(crl::guard(this, [=](const MTP::Error &error) {
|
}).fail(crl::guard(this, [=](const MTP::Error &error) {
|
||||||
if (weak) {
|
if (weak) {
|
||||||
_transferRequestId = 0;
|
_transferRequestId = 0;
|
||||||
|
@ -604,6 +609,7 @@ EditRestrictedBox::EditRestrictedBox(
|
||||||
bool hasAdminRights,
|
bool hasAdminRights,
|
||||||
ChatRestrictionsInfo rights)
|
ChatRestrictionsInfo rights)
|
||||||
: EditParticipantBox(nullptr, peer, user, hasAdminRights)
|
: EditParticipantBox(nullptr, peer, user, hasAdminRights)
|
||||||
|
, _show(this)
|
||||||
, _oldRights(rights) {
|
, _oldRights(rights) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -701,23 +707,23 @@ void EditRestrictedBox::showRestrictUntil() {
|
||||||
? tomorrow
|
? tomorrow
|
||||||
: base::unixtime::parse(getRealUntilValue()).date();
|
: base::unixtime::parse(getRealUntilValue()).date();
|
||||||
auto month = highlighted;
|
auto month = highlighted;
|
||||||
_restrictUntilBox = Ui::show(
|
auto box = Box<Ui::CalendarBox>(Ui::CalendarBoxArgs{
|
||||||
Box<Ui::CalendarBox>(Ui::CalendarBoxArgs{
|
.month = month,
|
||||||
.month = month,
|
.highlighted = highlighted,
|
||||||
.highlighted = highlighted,
|
.callback = [=](const QDate &date) {
|
||||||
.callback = [=](const QDate &date) {
|
setRestrictUntil(
|
||||||
setRestrictUntil(
|
static_cast<int>(date.startOfDay().toSecsSinceEpoch()));
|
||||||
static_cast<int>(date.startOfDay().toSecsSinceEpoch()));
|
},
|
||||||
},
|
.finalize = [=](not_null<Ui::CalendarBox*> box) {
|
||||||
.finalize = [=](not_null<Ui::CalendarBox*> box) {
|
box->addLeftButton(
|
||||||
box->addLeftButton(
|
tr::lng_rights_chat_banned_forever(),
|
||||||
tr::lng_rights_chat_banned_forever(),
|
[=] { setRestrictUntil(0); });
|
||||||
[=] { setRestrictUntil(0); });
|
},
|
||||||
},
|
.minDate = tomorrow,
|
||||||
.minDate = tomorrow,
|
.maxDate = QDate::currentDate().addDays(kMaxRestrictDelayDays),
|
||||||
.maxDate = QDate::currentDate().addDays(kMaxRestrictDelayDays),
|
});
|
||||||
}),
|
_restrictUntilBox = Ui::MakeWeak(box.data());
|
||||||
Ui::LayerOption::KeepOther);
|
_show.showBox(std::move(box));
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditRestrictedBox::setRestrictUntil(TimeId until) {
|
void EditRestrictedBox::setRestrictUntil(TimeId until) {
|
||||||
|
|
|
@ -103,6 +103,7 @@ private:
|
||||||
bool canTransferOwnership() const;
|
bool canTransferOwnership() const;
|
||||||
not_null<Ui::SlideWrap<Ui::RpWidget>*> setupTransferButton(bool isGroup);
|
not_null<Ui::SlideWrap<Ui::RpWidget>*> setupTransferButton(bool isGroup);
|
||||||
|
|
||||||
|
const Ui::BoxShow _show;
|
||||||
const ChatAdminRightsInfo _oldRights;
|
const ChatAdminRightsInfo _oldRights;
|
||||||
const QString _oldRank;
|
const QString _oldRank;
|
||||||
Fn<void(
|
Fn<void(
|
||||||
|
@ -149,6 +150,7 @@ private:
|
||||||
void createUntilVariants();
|
void createUntilVariants();
|
||||||
TimeId getRealUntilValue() const;
|
TimeId getRealUntilValue() const;
|
||||||
|
|
||||||
|
const Ui::BoxShow _show;
|
||||||
const ChatRestrictionsInfo _oldRights;
|
const ChatRestrictionsInfo _oldRights;
|
||||||
TimeId _until = 0;
|
TimeId _until = 0;
|
||||||
Fn<void(ChatRestrictionsInfo, ChatRestrictionsInfo)> _saveCallback;
|
Fn<void(ChatRestrictionsInfo, ChatRestrictionsInfo)> _saveCallback;
|
||||||
|
|
Loading…
Add table
Reference in a new issue