diff --git a/qml/MobilePermissions.qml b/qml/MobilePermissions.qml index e7504f2c..54b47e0a 100644 --- a/qml/MobilePermissions.qml +++ b/qml/MobilePermissions.qml @@ -14,6 +14,7 @@ Item { function loadScreen() { // refresh permissions deviceManager.checkBluetoothPermissions() + notifButton.validperm = utilsApp.checkMobileNotificationPermission() // change screen appContent.state = "AboutPermissions" @@ -55,8 +56,64 @@ Item { spacing: 8 //////// +/* + Item { // Network access + anchors.left: parent.left + anchors.right: parent.right + height: 24 - Item { // Bluetooth + RoundButtonIcon { + anchors.left: parent.left + anchors.leftMargin: 16 + anchors.verticalCenter: parent.verticalCenter + width: 32 + height: 32 + z: 1 + + property bool validperm: true + + source: (validperm) ? "qrc:/assets/icons_material/baseline-check-24px.svg" : "qrc:/assets/icons_material/baseline-close-24px.svg" + iconColor: (validperm) ? "white" : "white" + backgroundColor: (validperm) ? Theme.colorSuccess : Theme.colorSubText + backgroundVisible: true + } + + Text { + anchors.left: parent.left + anchors.leftMargin: 64 + anchors.right: parent.right + anchors.rightMargin: 16 + anchors.verticalCenter: parent.verticalCenter + height: 16 + + text: qsTr("Network access") + textFormat: Text.PlainText + wrapMode: Text.WordWrap + font.pixelSize: 18 + color: Theme.colorText + verticalAlignment: Text.AlignVCenter + } + } + Text { // Network access legend + anchors.left: parent.left + anchors.leftMargin: 64 + anchors.right: parent.right + anchors.rightMargin: 16 + + text: qsTr("Network state and Internet permissions are used to connect to MQTT brokers.") + textFormat: Text.PlainText + wrapMode: Text.WordWrap + color: Theme.colorSubText + font.pixelSize: Theme.fontSizeContentSmall + } + + //////// + + ListSeparatorPadded { height: 16+1 } +*/ + //////// + + Item { // Bluetooth control anchors.left: parent.left anchors.right: parent.right height: 24 @@ -68,18 +125,12 @@ Item { width: 32 height: 32 - property bool validperm: deviceManager.permissionOS + property bool validperm: true source: (validperm) ? "qrc:/assets/icons_material/baseline-check-24px.svg" : "qrc:/assets/icons_material/baseline-close-24px.svg" iconColor: (validperm) ? "white" : "white" backgroundColor: (validperm) ? Theme.colorSuccess : Theme.colorSubText backgroundVisible: true - - onClicked: { - utilsApp.vibrate(25) - utilsApp.getMobileBluetoothPermission() - refreshPermissions.start() - } } Text { @@ -90,7 +141,7 @@ Item { anchors.verticalCenter: parent.verticalCenter height: 16 - text: qsTr("Bluetooth") + text: qsTr("Bluetooth control") textFormat: Text.PlainText wrapMode: Text.WordWrap font.pixelSize: 17 @@ -98,14 +149,14 @@ Item { verticalAlignment: Text.AlignVCenter } } - Text { // Bluetooth legend + Text { // Bluetooth control legend anchors.left: parent.left anchors.leftMargin: appHeader.headerPosition anchors.right: parent.right anchors.rightMargin: Theme.componentMargin - text: qsTr("The Android operating system requires permission to scan for nearby Bluetooth Low Energy sensors.") - textFormat: Text.StyledText + text: qsTr("WatchFlower can activate your device's Bluetooth in order to operate.") + textFormat: Text.PlainText wrapMode: Text.WordWrap color: Theme.colorSubText font.pixelSize: Theme.fontSizeContentSmall @@ -117,7 +168,7 @@ Item { //////// - Item { // Bluetooth control + Item { // Bluetooth anchors.left: parent.left anchors.right: parent.right height: 24 @@ -129,12 +180,18 @@ Item { width: 32 height: 32 - property bool validperm: true + property bool validperm: deviceManager.permissionOS source: (validperm) ? "qrc:/assets/icons_material/baseline-check-24px.svg" : "qrc:/assets/icons_material/baseline-close-24px.svg" iconColor: (validperm) ? "white" : "white" backgroundColor: (validperm) ? Theme.colorSuccess : Theme.colorSubText backgroundVisible: true + + onClicked: { + utilsApp.vibrate(25) + utilsApp.getMobileBluetoothPermission() + refreshPermissions.start() + } } Text { @@ -145,7 +202,7 @@ Item { anchors.verticalCenter: parent.verticalCenter height: 16 - text: qsTr("Bluetooth control") + text: qsTr("Bluetooth") textFormat: Text.PlainText wrapMode: Text.WordWrap font.pixelSize: 17 @@ -153,14 +210,14 @@ Item { verticalAlignment: Text.AlignVCenter } } - Text { // Bluetooth control legend + Text { // Bluetooth legend anchors.left: parent.left anchors.leftMargin: appHeader.headerPosition anchors.right: parent.right anchors.rightMargin: Theme.componentMargin - text: qsTr("WatchFlower can activate your device's Bluetooth in order to operate.") - textFormat: Text.PlainText + text: qsTr("The Android operating system requires permission to scan for nearby Bluetooth Low Energy sensors.") + textFormat: Text.StyledText wrapMode: Text.WordWrap color: Theme.colorSubText font.pixelSize: Theme.fontSizeContentSmall @@ -389,6 +446,72 @@ Item { //////// + Item { // Notifications + height: 24 + anchors.left: parent.left + anchors.right: parent.right + + visible: (utilsApp.getAndroidSdkVersion() >= 13) + + RoundButtonIcon { + id: notifButton + width: 32 + height: 32 + anchors.left: parent.left + anchors.leftMargin: Theme.componentMargin + anchors.verticalCenter: parent.verticalCenter + + property bool validperm: false + + source: (validperm) ? "qrc:/assets/icons_material/baseline-check-24px.svg" : "qrc:/assets/icons_material/baseline-close-24px.svg" + iconColor: (validperm) ? "white" : "white" + backgroundColor: (validperm) ? Theme.colorSuccess : Theme.colorSubText + backgroundVisible: true + + onClicked: { + utilsApp.vibrate(25) + validperm = utilsApp.getMobileNotificationPermission() + refreshPermissions.start() + } + } + + Text { + height: 16 + anchors.left: parent.left + anchors.leftMargin: appHeader.headerPosition + anchors.right: parent.right + anchors.rightMargin: Theme.componentMargin + anchors.verticalCenter: parent.verticalCenter + + text: qsTr("Notifications") + textFormat: Text.PlainText + wrapMode: Text.WordWrap + font.pixelSize: 17 + color: Theme.colorText + verticalAlignment: Text.AlignVCenter + } + } + Text { // Notifications legend + anchors.left: parent.left + anchors.leftMargin: appHeader.headerPosition + anchors.right: parent.right + anchors.rightMargin: 12 + + visible: (utilsApp.getAndroidSdkVersion() >= 13) + + text: qsTr("The Android operating system requires permission to send notifications.") + textFormat: Text.StyledText + wrapMode: Text.WordWrap + color: Theme.colorSubText + font.pixelSize: Theme.fontSizeContentSmall + } + + //////// + + ListSeparatorPadded { height: 16+1 } + + //////// + Item { id: element_infos anchors.left: parent.left diff --git a/qml/Settings.qml b/qml/Settings.qml index 79070ec3..269aac3f 100644 --- a/qml/Settings.qml +++ b/qml/Settings.qml @@ -682,7 +682,12 @@ Loader { z: 1 checked: settingsManager.notifications - onClicked: settingsManager.notifications = checked + onClicked: { + settingsManager.notifications = checked + if (settingsManager.notifications) { + utilsApp.getMobileNotificationPermission() + } + } } } Text { diff --git a/qml/components/ItemNoPermissions.qml b/qml/components/ItemNoPermissions.qml index 1bf2f950..ab16aff1 100644 --- a/qml/components/ItemNoPermissions.qml +++ b/qml/components/ItemNoPermissions.qml @@ -84,7 +84,7 @@ Item { width: singleColumn ? (itemNoPermissions.width*0.85) : undefined spacing: Theme.componentMargin - visible: (Qt.platform.os === "android" || Qt.platform.os === "ios" || Qt.platform.os === "osx") + visible: false // (Qt.platform.os === "android" || Qt.platform.os === "ios" || Qt.platform.os === "osx") IconSvg { Layout.preferredWidth: 20