Fix passport for Xcode and macOS.

Also use different bundle id for debug builds.
This commit is contained in:
John Preston 2018-04-13 09:11:53 +04:00
parent ead31757d7
commit 8969a7d929
12 changed files with 69 additions and 22 deletions

View File

@ -22,6 +22,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace {
constexpr auto kEmptyPidForCommandResponse = 0ULL;
QChar _toHex(ushort v) {
v = v & 0x000F;
return QChar::fromLatin1((v >= 10) ? ('a' + (v - 10)) : ('0' + v));
@ -62,6 +64,26 @@ QString _escapeFrom7bit(const QString &str) {
} // namespace
bool StartUrlRequiresActivate(const QString &url) {
const auto urlTrimmed = url.trimmed();
if (!urlTrimmed.startsWith(qstr("tg://"), Qt::CaseInsensitive) || App::passcoded()) {
return true;
}
const auto command = urlTrimmed.midRef(qstr("tg://").size());
using namespace qthelp;
const auto matchOptions = RegExOption::CaseInsensitive;
const auto authMatch = regex_match(
qsl("^passport/?\\?(.+)(#|$)"),
command,
matchOptions);
const auto authLegacyMatch = regex_match(
qsl("^resolve/?\\?domain=telegrampassport&(.+)(#|$)"),
command,
matchOptions);
return !authMatch->hasMatch() && !authLegacyMatch->hasMatch();
}
Application::Application(
not_null<Core::Launcher*> launcher,
int &argc,

View File

@ -12,6 +12,8 @@ class Launcher;
class UpdateChecker;
} // namespace Core
bool StartUrlRequiresActivate(const QString &url);
class Application : public QApplication {
Q_OBJECT

View File

@ -274,7 +274,9 @@ bool Messenger::eventFilter(QObject *object, QEvent *e) {
cSetStartUrl(url.mid(0, 8192));
checkStartUrl();
}
_window->activate();
if (StartUrlRequiresActivate(url)) {
_window->activate();
}
}
} break;
}

View File

@ -287,11 +287,13 @@ void Panel::showInner(base::unique_qptr<Ui::RpWidget> inner) {
}
void Panel::focusInEvent(QFocusEvent *e) {
if (_layer) {
_layer->setInnerFocus();
} else if (!_inner->isHidden()) {
_inner->setFocus();
}
crl::on_main(this, [=] {
if (_layer) {
_layer->setInnerFocus();
} else if (!_inner->isHidden()) {
_inner->setFocus();
}
});
}
void Panel::initGeometry() {

View File

@ -92,8 +92,6 @@ private:
QPoint _dragStartMousePosition;
QPoint _dragStartMyPosition;
int _stateChangedSubscription = 0;
Animation _titleLeft;
bool _visible = false;

View File

@ -663,7 +663,7 @@ void PanelController::editScope(int index, int documentIndex) {
return object_ptr<PanelEditContact>(
_panel.get(),
this,
std::move(GetContactScheme(_editScope->type)),
GetContactScheme(_editScope->type),
(valueIt == end(parsed.fields)
? QString()
: valueIt->second),
@ -862,4 +862,6 @@ rpl::lifetime &PanelController::lifetime() {
return _lifetime;
}
PanelController::~PanelController() = default;
} // namespace Passport

View File

@ -94,6 +94,8 @@ public:
rpl::lifetime &lifetime();
~PanelController();
private:
void ensurePanelCreated();

View File

@ -280,7 +280,9 @@ void PanelEditContact::setupControls(
}
void PanelEditContact::focusInEvent(QFocusEvent *e) {
_field->setFocusFast();
crl::on_main(this, [=] {
_field->setFocusFast();
});
}
void PanelEditContact::resizeEvent(QResizeEvent *e) {

View File

@ -256,11 +256,13 @@ not_null<Ui::RpWidget*> PanelEditDocument::setupContent(
}
void PanelEditDocument::focusInEvent(QFocusEvent *e) {
for (const auto [index, row] : _details) {
if (row->setFocusFast()) {
return;
crl::on_main(this, [=] {
for (const auto [index, row] : _details) {
if (row->setFocusFast()) {
return;
}
}
}
});
}
void PanelEditDocument::resizeEvent(QResizeEvent *e) {

View File

@ -89,16 +89,14 @@ void PanelAskPassword::submit() {
_controller->submitPassword(_password->getLastText());
}
void PanelAskPassword::setInnerFocus() {
_password->setFocusFast();
}
void PanelAskPassword::resizeEvent(QResizeEvent *e) {
updateControlsGeometry();
}
void PanelAskPassword::focusInEvent(QFocusEvent *e) {
_password->setFocusFast();
crl::on_main(this, [=] {
_password->setFocusFast();
});
}
void PanelAskPassword::updateControlsGeometry() {

View File

@ -27,7 +27,6 @@ public:
QWidget *parent,
not_null<PanelController*> controller);
void setInnerFocus();
void submit();
protected:

View File

@ -45,7 +45,6 @@
],
}], [ 'build_macold', {
'xcode_settings': {
'PRODUCT_BUNDLE_IDENTIFIER': 'com.tdesktop.Telegram',
'OTHER_CPLUSPLUSFLAGS': [ '-nostdinc++' ],
'OTHER_LDFLAGS': [
'-lbase',
@ -77,11 +76,17 @@
],
'configurations': {
'Debug': {
'xcode_settings': {
'PRODUCT_BUNDLE_IDENTIFIER': 'com.tdesktop.TelegramDebugOld',
},
'library_dirs': [
'<(libs_loc)/macold/crashpad/out/Debug',
],
},
'Release': {
'xcode_settings': {
'PRODUCT_BUNDLE_IDENTIFIER': 'com.tdesktop.Telegram',
},
'library_dirs': [
'<(libs_loc)/macold/crashpad/out/Release',
],
@ -147,13 +152,24 @@
},
}], [ '"<(build_macold)" != "1" and "<(build_macstore)" != "1"', {
'xcode_settings': {
'PRODUCT_BUNDLE_IDENTIFIER': 'com.tdesktop.Telegram',
'OTHER_LDFLAGS': [
'-lbase',
'-lcrashpad_client',
'-lcrashpad_util',
],
},
'configurations': {
'Debug': {
'xcode_settings': {
'PRODUCT_BUNDLE_IDENTIFIER': 'com.tdesktop.TelegramDebug',
},
},
'Release': {
'xcode_settings': {
'PRODUCT_BUNDLE_IDENTIFIER': 'com.tdesktop.Telegram',
},
},
},
'postbuilds': [{
'postbuild_name': 'Force Frameworks path',
'action': [