2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Add support for requesting deep link info.

Also update API scheme.
Also remove auth.checkPhone requests.
This commit is contained in:
John Preston
2018-04-18 19:42:02 +04:00
parent 46af87a00a
commit 67e698a374
16 changed files with 153 additions and 4 deletions

View File

@@ -53,6 +53,16 @@ ConfirmBox::ConfirmBox(QWidget*, const QString &text, const QString &confirmText
init(text);
}
ConfirmBox::ConfirmBox(QWidget*, const TextWithEntities &text, const QString &confirmText, base::lambda_once<void()> confirmedCallback, base::lambda_once<void()> cancelledCallback)
: _confirmText(confirmText)
, _cancelText(lang(lng_cancel))
, _confirmStyle(st::defaultBoxButton)
, _text(st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right())
, _confirmedCallback(std::move(confirmedCallback))
, _cancelledCallback(std::move(cancelledCallback)) {
init(text);
}
ConfirmBox::ConfirmBox(QWidget*, const QString &text, const QString &confirmText, const style::RoundButton &confirmStyle, base::lambda_once<void()> confirmedCallback, base::lambda_once<void()> cancelledCallback)
: _confirmText(confirmText)
, _cancelText(lang(lng_cancel))
@@ -93,6 +103,16 @@ ConfirmBox::ConfirmBox(const InformBoxTag &, const QString &text, const QString
init(text);
}
ConfirmBox::ConfirmBox(const InformBoxTag &, const TextWithEntities &text, const QString &doneText, base::lambda<void()> closedCallback)
: _confirmText(doneText)
, _confirmStyle(st::defaultBoxButton)
, _informative(true)
, _text(st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right())
, _confirmedCallback(generateInformCallback(closedCallback))
, _cancelledCallback(generateInformCallback(closedCallback)) {
init(text);
}
base::lambda_once<void()> ConfirmBox::generateInformCallback(base::lambda<void()> closedCallback) {
return base::lambda_guarded(this, [this, closedCallback] {
closeBox();
@@ -106,6 +126,10 @@ void ConfirmBox::init(const QString &text) {
_text.setText(st::boxLabelStyle, text, _informative ? _confirmBoxTextOptions : _textPlainOptions);
}
void ConfirmBox::init(const TextWithEntities &text) {
_text.setMarkedText(st::boxLabelStyle, text, _confirmBoxTextOptions);
}
void ConfirmBox::prepare() {
addButton([this] { return _confirmText; }, [this] { confirmed(); }, _confirmStyle);
if (!_informative) {
@@ -223,6 +247,9 @@ InformBox::InformBox(QWidget*, const QString &text, base::lambda<void()> closedC
InformBox::InformBox(QWidget*, const QString &text, const QString &doneText, base::lambda<void()> closedCallback) : ConfirmBox(ConfirmBox::InformBoxTag(), text, doneText, std::move(closedCallback)) {
}
InformBox::InformBox(QWidget*, const TextWithEntities &text, base::lambda<void()> closedCallback) : ConfirmBox(ConfirmBox::InformBoxTag(), text, lang(lng_box_ok), std::move(closedCallback)) {
}
MaxInviteBox::MaxInviteBox(QWidget*, not_null<ChannelData*> channel) : BoxContent()
, _channel(channel)
, _text(st::boxLabelStyle, lng_participant_invite_sorry(lt_count, Global::ChatSizeMax()), _confirmBoxTextOptions, st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right()) {

View File

@@ -23,6 +23,7 @@ public:
ConfirmBox(QWidget*, const QString &text, const QString &confirmText, const style::RoundButton &confirmStyle, base::lambda_once<void()> confirmedCallback = base::lambda_once<void()>(), base::lambda_once<void()> cancelledCallback = base::lambda_once<void()>());
ConfirmBox(QWidget*, const QString &text, const QString &confirmText, const QString &cancelText, base::lambda_once<void()> confirmedCallback = base::lambda_once<void()>(), base::lambda_once<void()> cancelledCallback = base::lambda_once<void()>());
ConfirmBox(QWidget*, const QString &text, const QString &confirmText, const style::RoundButton &confirmStyle, const QString &cancelText, base::lambda_once<void()> confirmedCallback = base::lambda_once<void()>(), base::lambda_once<void()> cancelledCallback = base::lambda_once<void()>());
ConfirmBox(QWidget*, const TextWithEntities &text, const QString &confirmText, base::lambda_once<void()> confirmedCallback = nullptr, base::lambda_once<void()> cancelledCallback = nullptr);
void updateLink();
@@ -51,11 +52,13 @@ private:
struct InformBoxTag {
};
ConfirmBox(const InformBoxTag &, const QString &text, const QString &doneText, base::lambda<void()> closedCallback);
ConfirmBox(const InformBoxTag &, const TextWithEntities &text, const QString &doneText, base::lambda<void()> closedCallback);
base::lambda_once<void()> generateInformCallback(base::lambda<void()> closedCallback);
friend class InformBox;
void confirmed();
void init(const QString &text);
void init(const TextWithEntities &text);
void textUpdated();
void updateHover();
@@ -81,8 +84,9 @@ private:
class InformBox : public ConfirmBox {
public:
InformBox(QWidget*, const QString &text, base::lambda<void()> closedCallback = base::lambda<void()>());
InformBox(QWidget*, const QString &text, const QString &doneText, base::lambda<void()> closedCallback = base::lambda<void()>());
InformBox(QWidget*, const QString &text, base::lambda<void()> closedCallback = nullptr);
InformBox(QWidget*, const QString &text, const QString &doneText, base::lambda<void()> closedCallback = nullptr);
InformBox(QWidget*, const TextWithEntities &text, base::lambda<void()> closedCallback = nullptr);
};