Make the webview optional
This commit is contained in:
parent
bf24f169d6
commit
69f959befe
@ -26,7 +26,6 @@
|
||||
#include <QSysInfo>
|
||||
#include <QCommandLineParser>
|
||||
#include <QCommandLineOption>
|
||||
#include <QtWebView>
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
#include <QtAndroidExtras/QtAndroid>
|
||||
@ -71,7 +70,6 @@ int main(int argc, char *argv[])
|
||||
QApplication application(argc, argv);
|
||||
application.setApplicationName("nymea-app");
|
||||
application.setOrganizationName("nymea");
|
||||
QtWebView::initialize();
|
||||
|
||||
QCommandLineParser parser;
|
||||
parser.addHelpOption();
|
||||
|
||||
@ -2,7 +2,7 @@ TEMPLATE=app
|
||||
TARGET=nymea-app
|
||||
include(../config.pri)
|
||||
|
||||
QT += network qml quick quickcontrols2 svg websockets bluetooth charts gui-private webview
|
||||
QT += network qml quick quickcontrols2 svg websockets bluetooth charts gui-private
|
||||
|
||||
INCLUDEPATH += $$top_srcdir/libnymea-common \
|
||||
$$top_srcdir/libnymea-app-core
|
||||
@ -44,6 +44,10 @@ equals(STYLES_PATH, "") {
|
||||
RESOURCES += $${STYLES_PATH}/styles.qrc
|
||||
}
|
||||
|
||||
win32 {
|
||||
QT += webview
|
||||
}
|
||||
|
||||
android {
|
||||
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/../packaging/android
|
||||
|
||||
@ -60,7 +64,7 @@ android {
|
||||
INCLUDEPATH += /opt/firebase_cpp_sdk/include
|
||||
LIBS += -L/opt/firebase_cpp_sdk/libs/android/$$ANDROID_TARGET_ARCH/$$FIREBASE_STL_VARIANT/ -lfirebase_messaging -lfirebase_app
|
||||
|
||||
QT += androidextras
|
||||
QT += androidextras webview
|
||||
HEADERS += platformintegration/android/platformhelperandroid.h
|
||||
SOURCES += platformintegration/android/platformhelperandroid.cpp
|
||||
|
||||
@ -80,6 +84,7 @@ android {
|
||||
}
|
||||
|
||||
macx: {
|
||||
QT += webview
|
||||
PRODUCT_NAME=$$TARGET
|
||||
plist.input = ../packaging/osx/Info.plist.in
|
||||
plist.output = $$OUT_PWD/Info.plist
|
||||
@ -91,6 +96,7 @@ macx: {
|
||||
|
||||
ios: {
|
||||
message("iOS build")
|
||||
QT += webview
|
||||
HEADERS += platformintegration/ios/platformhelperios.h
|
||||
SOURCES += platformintegration/ios/platformhelperios.cpp
|
||||
OBJECTIVE_SOURCES += $$PWD/../packaging/ios/pushnotifications.mm \
|
||||
|
||||
@ -3,15 +3,19 @@
|
||||
#include <QUuid>
|
||||
#include <QScreen>
|
||||
#include <QApplication>
|
||||
#include <QtWebView>
|
||||
|
||||
PlatformHelperIOS::PlatformHelperIOS(QObject *parent) : PlatformHelper(parent)
|
||||
{
|
||||
QtWebView::initialize();
|
||||
|
||||
QScreen *screen = qApp->primaryScreen();
|
||||
screen->setOrientationUpdateMask(Qt::PortraitOrientation | Qt::LandscapeOrientation | Qt::InvertedPortraitOrientation | Qt::InvertedLandscapeOrientation);
|
||||
QObject::connect(screen, &QScreen::orientationChanged, qApp, [this](Qt::ScreenOrientation) {
|
||||
setBottomPanelColor(bottomPanelColor());
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
void PlatformHelperIOS::requestPermissions()
|
||||
|
||||
@ -195,5 +195,6 @@
|
||||
<file>ui/components/KeypadButton.qml</file>
|
||||
<file>ui/devicepages/DoorbellDevicePage.qml</file>
|
||||
<file>ui/magic/NewMagicPage.qml</file>
|
||||
<file>ui/components/WebViewWrapper.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
9
nymea-app/ui/components/WebViewWrapper.qml
Normal file
9
nymea-app/ui/components/WebViewWrapper.qml
Normal file
@ -0,0 +1,9 @@
|
||||
import QtQuick 2.0
|
||||
import QtWebView 1.1
|
||||
|
||||
// This is needed because we can only load this on-demand but
|
||||
// *deployqt will not include the module if there isn't a actual qml file importing it
|
||||
|
||||
WebView {
|
||||
|
||||
}
|
||||
@ -3,7 +3,6 @@ import QtQuick.Layouts 1.1
|
||||
import QtQuick.Controls 2.1
|
||||
import QtQuick.Controls.Material 2.1
|
||||
import Nymea 1.0
|
||||
import QtWebView 1.1
|
||||
|
||||
import "../components"
|
||||
import "../delegates"
|
||||
@ -464,19 +463,56 @@ Page {
|
||||
id: oAuthPageComponent
|
||||
Page {
|
||||
id: oAuthPage
|
||||
property alias oAuthUrl: oAuthWebView.url
|
||||
property string oAuthUrl
|
||||
|
||||
WebView {
|
||||
id: oAuthWebView
|
||||
ColumnLayout {
|
||||
anchors.centerIn: parent
|
||||
width: parent.width - app.margins * 2
|
||||
spacing: app.margins * 2
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("OAuth is not supported on this platform. Please use this app on a different device to set up this thing.")
|
||||
wrapMode: Text.WordWrap
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("In order to use OAuth on this platform, make sure qml-module-qtwebview is installed.")
|
||||
wrapMode: Text.WordWrap
|
||||
font.pixelSize: app.smallFont
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: webViewContainer
|
||||
anchors.fill: parent
|
||||
|
||||
onUrlChanged: {
|
||||
print("OAUTH URL changed", url)
|
||||
if (url.toString().indexOf("https://127.0.0.1") == 0) {
|
||||
print("Redirect URL detected!");
|
||||
engine.deviceManager.confirmPairing(d.pairingTransactionId, url)
|
||||
}
|
||||
Component.onCompleted: {
|
||||
// This might fail if qml-module-qtwebview isn't around
|
||||
Qt.createQmlObject(webViewString, webViewContainer);
|
||||
}
|
||||
|
||||
property string webViewString:
|
||||
'
|
||||
import QtQuick 2.8;
|
||||
import QtWebView 1.1;
|
||||
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.deviceManager.confirmPairing(d.pairingTransactionId, url)
|
||||
}
|
||||
}
|
||||
}
|
||||
'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,7 +16,6 @@ Build-Depends: debhelper (>= 9.0.0),
|
||||
qtconnectivity5-dev,
|
||||
qtdeclarative5-dev,
|
||||
qtquickcontrols2-5-dev,
|
||||
libqt5webview5-dev,
|
||||
|
||||
Package: nymea-app
|
||||
Architecture: any
|
||||
@ -28,6 +27,7 @@ Depends: ${shlibs:Depends},
|
||||
libqt5gui5,
|
||||
libqt5websockets5,
|
||||
libqt5bluetooth5,
|
||||
qml-module-qt-labs-folderlistmodel,
|
||||
qml-module-qt-labs-settings,
|
||||
qml-module-qtcharts,
|
||||
qml-module-qtgraphicaleffects,
|
||||
@ -35,8 +35,7 @@ Depends: ${shlibs:Depends},
|
||||
qml-module-qtquick-layouts,
|
||||
qml-module-qtquick-window2,
|
||||
qml-module-qtquick2,
|
||||
qml-module-qtwebview,
|
||||
xinit,
|
||||
Recommends: qml-module-qtwebview,
|
||||
Suggests: nymea,
|
||||
network-manager
|
||||
Description: An open source IoT server - daemon
|
||||
@ -56,7 +55,7 @@ Depends: nymea-app,
|
||||
openbox,
|
||||
lightdm,
|
||||
qtvirtualkeyboard-plugin,
|
||||
qtdeclarative5-folderlistmodel-plugin,
|
||||
xinit,
|
||||
Provides: lightdm-greeter
|
||||
Description: Run nymea:app in kiosk mode
|
||||
This package will install nymea:app in kiosk mode on your machine.
|
||||
|
||||
Reference in New Issue
Block a user