diff --git a/data/web/corefork.telegram.org/api/bots/webapps.html b/data/web/corefork.telegram.org/api/bots/webapps.html
index 704015e673..010a81efee 100644
--- a/data/web/corefork.telegram.org/api/bots/webapps.html
+++ b/data/web/corefork.telegram.org/api/bots/webapps.html
@@ -122,6 +122,15 @@ Note that eventual errors will not be sent as a failed
event if the
data
- A string with the clipboard contents (optional, if not provided consider the request failed)Used by clients to reply to web_app_read_text_from_clipboard
events ».
qr_text_received
Params: a JSON object with the following fields:
+data
- string with the contents of a scanned QR code.Emitted by clients if a new QR code was scanned by the native QR code scanner opened with a web_app_open_scan_qr_popup
event ».
scan_qr_popup_closed
Params: null
or an empty object
Emitted by clients if the QR code scanner popup opened with a web_app_open_scan_qr_popup
event » was closed by the user, by the mini app with a web_app_close_scan_qr_popup
event » or failed to open altogether due to permission issues.
Schema:
replyKeyboardMarkup#85dd99d1 flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true persistent:flags.4?true rows:Vector<KeyboardButtonRow> placeholder:flags.3?string = ReplyMarkup;
diff --git a/data/web/corefork.telegram.org/api/web-events.html b/data/web/corefork.telegram.org/api/web-events.html
index 7bc6113a9c..39f385b064 100644
--- a/data/web/corefork.telegram.org/api/web-events.html
+++ b/data/web/corefork.telegram.org/api/web-events.html
@@ -128,8 +128,21 @@ Otherwise, if the user refuses or the bo
req_id
- The req_id
from the web_app_read_text_from_clipboard
request
data
- A string with the clipboard contents
-Note that user interactions must have a TTL of 10 seconds: events of this type must be ignored and a clipboard_text_received event » with the correct req_id
and no data
field must be sent if the last Mini App user interaction happened more than 10 seconds ago.
+Note that this method can be called only in response to a user interaction with the Mini App interface (e.g. a click inside the Mini App or on the main or settings button).
+Note that user interactions must have a TTL of 10 seconds: events of this type must be ignored and a clipboard_text_received event » with the correct req_id
and no data
field must be sent if the last Mini App user interaction (as described above) happened more than 10 seconds ago.
A clipboard_text_received event » with the correct req_id
and no data
field must also be sent if the bot is not installed in the attachment menu.
+web_app_open_scan_qr_popup
+Event data: a JSON object with the following fields:
+
+text
- Optional string, containing the text to be displayed under the 'Scan QR' heading, 0-64 characters.
+
+Emitted by bot mini apps to prompt the client to open the native QR code scanner and start continuously scanning for QR codes.
+A qr_text_received
event » should be emitted every time a new QR code is scanned, until the user closes the popup via the UI or the Mini App closes the popup with a web_app_close_scan_qr_popup event.
+Closing the popup should emit a scan_qr_popup_closed
event »; the same event should be emitted if the scan QR code popup cannot be opened due to permission issues.
+web_app_close_scan_qr_popup
+Event data: null
+Emitted by bot mini apps to prompt the client to close the native QR code scanner opened using web_app_open_scan_qr_popup.
+If the popup is currently open and was closed by this event or in any other way, a scan_qr_popup_closed
event » event should be emitted.
web_app_setup_closing_behavior
Event data: a JSON object with a boolean need_confirmation
.
If equal to true
, the client should require user confirmation with a "Changes that you made may not be saved." popup with "Cancel"/"Close anyway" buttons before closing the webview, to avoid accidentally aborting a sensitive operation; otherwise no confirmation should be requested.
@@ -188,11 +201,15 @@ If empty, the current chat is used.
Used to trigger haptic feedback for a user interaction in a webapp.
web_app_open_link
-Event data: a JSON object with a string url
field.
+Event data: a JSON object with the following fields:
+
+url
- The URL to open
+try_instant_view
- Optional boolean, if set, equal to true
and the scheme of the URL is either http
or https
, the link should be opened in Instant View mode if possible.
+
Used to open a link in an external browser (or in a new tab for browser clients). The Mini App will not be closed.
-Note that this method can be called only in response to the user interaction with the Mini App interface (e.g. a click inside the Mini App or on the main button).
+
Note that this method can be called only in response to a user interaction with the Mini App interface (e.g. a click inside the Mini App or on the main or settings button).
After opening the URL, further events of this type should be ignored until the user interacts again with the Mini App interface (as above).
-Note that user interactions must have a TTL of 10 seconds: events of this type must be ignored if the last Mini App user interaction happened more than 10 seconds ago.
+Note that user interactions must have a TTL of 1 second: events of this type must be ignored if the last Mini App user interaction happened more than 1 second ago.
web_app_open_tg_link
Event data: a JSON object with a string path_full
field, containing the path+query component of a t.me deep link (url = 'https://t.me' + path_full
).
Used to open a t.me deep link. The Mini App must be closed.
diff --git a/data/web/fragment.com/js/auction.js b/data/web/fragment.com/js/auction.js
index a0ed386e46..a5cb43cd86 100644
--- a/data/web/fragment.com/js/auction.js
+++ b/data/web/fragment.com/js/auction.js
@@ -1302,11 +1302,13 @@ var Random = {
var LoginCodes = {
init: function() {
Aj.onLoad(function(state) {
+ $('.js-toggle-receive').on('change', LoginCodes.eToggleReceive);
state.needUpdate = true;
state.updLastReq = +Date.now();
state.updStateTo = setTimeout(LoginCodes.updateState, Main.UPDATE_PERIOD);
});
Aj.onUnload(function(state) {
+ $('.js-toggle-receive').off('change', LoginCodes.eToggleReceive);
clearTimeout(state.updStateTo);
state.needUpdate = false;
});
@@ -1337,6 +1339,14 @@ var LoginCodes = {
}
}
+ },
+ eToggleReceive: function() {
+ var can_receive = $(this).prop('checked');
+ $('.js-codes-main').toggleClass('codes-disabled', !can_receive);
+ Aj.apiRequest('toggleLoginCodes', {
+ number: Aj.state.number,
+ can_receive: can_receive ? 1 : 0
+ });
}
};