Fix visual glitches in OAuth flow
This commit is contained in:
parent
bac150106b
commit
56bdef2b31
@ -570,23 +570,40 @@ Page {
|
|||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
// This might fail if qml-module-qtwebview isn't around
|
// This might fail if qml-module-qtwebview isn't around
|
||||||
Qt.createQmlObject(webViewString, webViewContainer);
|
var webView = Qt.createQmlObject(webViewString, webViewContainer);
|
||||||
|
print("created webView", webView)
|
||||||
}
|
}
|
||||||
|
|
||||||
property string webViewString:
|
property string webViewString:
|
||||||
'
|
'
|
||||||
import QtQuick 2.8;
|
import QtQuick 2.8;
|
||||||
import QtWebView 1.1;
|
import QtWebView 1.1;
|
||||||
WebView {
|
import QtQuick.Controls 2.9
|
||||||
id: oAuthWebView
|
import Nymea 1.0;
|
||||||
anchors.fill: parent
|
|
||||||
url: oAuthPage.oAuthUrl
|
|
||||||
|
|
||||||
onUrlChanged: {
|
Rectangle {
|
||||||
print("OAUTH URL changed", url)
|
anchors.fill: parent
|
||||||
if (url.toString().indexOf("https://127.0.0.1") == 0) {
|
color: Style.backgroundColor
|
||||||
print("Redirect URL detected!");
|
|
||||||
engine.thingManager.confirmPairing(d.pairingTransactionId, url)
|
BusyIndicator {
|
||||||
|
id: busyIndicator
|
||||||
|
anchors.centerIn: parent
|
||||||
|
running: oAuthWebView.loading
|
||||||
|
}
|
||||||
|
|
||||||
|
WebView {
|
||||||
|
id: oAuthWebView
|
||||||
|
anchors.fill: parent
|
||||||
|
url: oAuthPage.oAuthUrl
|
||||||
|
|
||||||
|
onUrlChanged: {
|
||||||
|
print("OAUTH URL changed", url)
|
||||||
|
if (url.toString().indexOf("https://127.0.0.1") == 0) {
|
||||||
|
print("Redirect URL detected!");
|
||||||
|
engine.thingManager.confirmPairing(d.pairingTransactionId, url)
|
||||||
|
busyIndicator.running = true
|
||||||
|
oAuthWebView.visible = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user