Version 0.10.9: don't handle cStartUrl() while passcoded.

This commit is contained in:
John Preston 2016-10-03 11:20:02 +03:00
parent 4a5f467560
commit e1a8c89ff1
4 changed files with 21 additions and 10 deletions

View file

@ -303,9 +303,8 @@ void Application::readClients() {
if (!startUrl.isEmpty()) {
cSetStartUrl(startUrl);
}
if (!cStartUrl().isEmpty() && App::main() && App::self()) {
App::main()->openLocalUrl(cStartUrl());
cSetStartUrl(QString());
if (auto main = App::main()) {
main->checkStartUrl();
}
}

View file

@ -3301,10 +3301,7 @@ void MainWidget::start(const MTPUser &user) {
App::feedUsers(MTP_vector<MTPUser>(1, user));
MTP::send(MTPupdates_GetState(), rpcDone(&MainWidget::gotState));
update();
if (!cStartUrl().isEmpty()) {
openLocalUrl(cStartUrl());
cSetStartUrl(QString());
}
_started = true;
App::wnd()->sendServiceHistoryRequest();
Local::readInstalledStickers();
@ -3312,12 +3309,23 @@ void MainWidget::start(const MTPUser &user) {
Local::readRecentStickers();
Local::readSavedGifs();
_history->start();
checkStartUrl();
}
bool MainWidget::started() {
return _started;
}
void MainWidget::checkStartUrl() {
if (!cStartUrl().isEmpty() && App::self() && !App::passcoded()) {
auto url = cStartUrl();
cSetStartUrl(QString());
openLocalUrl(url);
}
}
void MainWidget::openLocalUrl(const QString &url) {
auto urlTrimmed = url.trimmed();
if (urlTrimmed.size() > 8192) urlTrimmed = urlTrimmed.mid(0, 8192);

View file

@ -155,6 +155,7 @@ public:
void start(const MTPUser &user);
void checkStartUrl();
void openLocalUrl(const QString &str);
void openPeerByName(const QString &name, MsgId msgId = ShowAtUnreadMsgId, const QString &startToken = QString());
void joinGroupByHash(const QString &hash);

View file

@ -550,6 +550,10 @@ void MainWindow::clearPasscode() {
notifyUpdateAll();
title->updateBackButton();
updateGlobalMenu();
if (auto main = App::main()) {
main->checkStartUrl();
}
}
void MainWindow::setupPasscode(bool anim) {
@ -1040,9 +1044,8 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *e) {
QString url = static_cast<QFileOpenEvent*>(e)->url().toEncoded().trimmed();
if (url.startsWith(qstr("tg://"), Qt::CaseInsensitive)) {
cSetStartUrl(url.mid(0, 8192));
if (!cStartUrl().isEmpty() && App::main() && App::self()) {
App::main()->openLocalUrl(cStartUrl());
cSetStartUrl(QString());
if (auto main = App::main()) {
main->checkStartUrl();
}
}
activate();