Handling new 2fa reset account error codes.

Archived stickers description text layout fixed in 100% scale.
This commit is contained in:
John Preston 2016-07-26 12:17:44 +03:00
parent dbdf28d0a0
commit 82a0ac28ad
3 changed files with 30 additions and 4 deletions

View file

@ -190,6 +190,11 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_signin_reset_account" = "Reset your account";
"lng_signin_sure_reset" = "Warning!\n\nYou will lose all your chats and messages, along with any media and files you shared!\n\nDo you want to reset your account?";
"lng_signin_reset" = "Reset";
"lng_signin_reset_wait" = "Since the account {phone_number} is active and protected by a password, we will delete it in 1 week for security purposes. You can cancel this process at any time.\n\nYoull be able to reset your account in:\n{when}";
"lng_signin_reset_in_days" = "{count_days:0 days|# day|# days} {count_hours:_not_used_|# hour|# hours} {count_minutes:_not_used_|# minute|# minutes}";
"lng_signin_reset_in_hours" = "{count_hours:0 hours|# hour|# hours} {count_minutes:_not_used_|# minute|# minutes}";
"lng_signin_reset_in_minutes" = "{count_minutes:0 minutes|# minute|# minutes}";
"lng_signin_reset_cancelled" = "Your recent attempts to reset this account have been cancelled by its active user. Please try again in 7 days.";
"lng_signup_title" = "Information and photo";
"lng_signup_desc" = "Please enter your name and\nupload a photo.";

View file

@ -1280,7 +1280,7 @@ StickersInner::~StickersInner() {
StickersBox::StickersBox(Section section) : ItemListBox(st::boxScroll)
, _section(section)
, _inner(section)
, _aboutWidth(st::boxWideWidth - st::contactsPadding.left() - st::contactsPadding.left())
, _aboutWidth(st::boxWideWidth - 2 * st::stickersReorderPadding.top())
, _about(st::boxTextFont, lang((section == Section::Archived) ? lng_stickers_packs_archived : lng_stickers_reorder), _defaultOptions, _aboutWidth) {
setup();
}
@ -1288,7 +1288,7 @@ StickersBox::StickersBox(Section section) : ItemListBox(st::boxScroll)
StickersBox::StickersBox(const Stickers::Order &archivedIds) : ItemListBox(st::boxScroll)
, _section(Section::ArchivedPart)
, _inner(archivedIds)
, _aboutWidth(st::boxWideWidth - st::contactsPadding.left() - st::contactsPadding.left())
, _aboutWidth(st::boxWideWidth - 2 * st::stickersReorderPadding.top())
, _about(st::boxTextFont, lang(lng_stickers_packs_archived), _defaultOptions, _aboutWidth) {
setup();
}
@ -1507,7 +1507,7 @@ void StickersBox::paintEvent(QPaintEvent *e) {
if (_aboutHeight > 0) {
p.fillRect(0, 0, width(), _aboutHeight, st::contactsAboutBg);
p.setPen(st::stickersReorderFg);
_about.draw(p, st::contactsPadding.left(), st::stickersReorderPadding.top(), _aboutWidth, style::al_center);
_about.draw(p, st::stickersReorderPadding.top(), st::stickersReorderPadding.top(), _aboutWidth, style::al_center);
}
}

View file

@ -340,7 +340,28 @@ bool IntroPwdCheck::deleteFail(const RPCError &error) {
if (MTP::isDefaultHandledError(error)) return false;
sentRequest = 0;
showError(lang(lng_server_error));
auto type = error.type();
if (type.startsWith(qstr("2FA_CONFIRM_WAIT_"))) {
int seconds = type.mid(qstr("2FA_CONFIRM_WAIT_").size()).toInt();
int days = (seconds + 59) / 86400;
int hours = ((seconds + 59) % 86400) / 3600;
int minutes = ((seconds + 59) % 3600) / 60;
QString when;
if (days > 0) {
when = lng_signin_reset_in_days(lt_count_days, days, lt_count_hours, hours, lt_count_minutes, minutes);
} else if (hours > 0) {
when = lng_signin_reset_in_hours(lt_count_hours, hours, lt_count_minutes, minutes);
} else {
when = lng_signin_reset_in_minutes(lt_count_minutes, minutes);
}
Ui::showLayer(new InformBox(lng_signin_reset_wait(lt_phone_number, App::formatPhone(intro()->getPhone()), lt_when, when)));
} else if (type == qstr("2FA_RECENT_CONFIRM")) {
Ui::showLayer(new InformBox(lang(lng_signin_reset_cancelled)));
} else {
Ui::hideLayer();
showError(lang(lng_server_error));
}
return true;
}