Skip to content

Commit

Permalink
VPN-3112: Auto start breadcrumb on Android (#9931)
Browse files Browse the repository at this point in the history
* to debug

* working version

* PR feedback
  • Loading branch information
mcleinman authored Oct 10, 2024
1 parent ed136c3 commit 5043801
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 1 deletion.
1 change: 1 addition & 0 deletions nebula/ui/components/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ qt_add_qml_module(components
MZHeaderLink.qml
MZHeadline.qml
MZHelpSheet.qml
MZLinkRow.qml
MZLottieAnimation.qml
MZIconAndLabel.qml
MZIconButton.qml
Expand Down
2 changes: 1 addition & 1 deletion nebula/ui/components/MZBottomSheet.qml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import Mozilla.Shared 1.0
contentItem: ColumnLayout {
Rectangle {
anchors.left: parent.left
anchors. right: parent.right
anchors.right: parent.right
height: 20
color: "green"
Expand Down
75 changes: 75 additions & 0 deletions nebula/ui/components/MZLinkRow.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import QtQuick 2.5
import QtQuick.Layouts 1.14

import Mozilla.Shared 1.0


RowLayout {
id: linkRow
Layout.fillWidth: true
Layout.rightMargin: MZTheme.theme.windowMargin
Layout.leftMargin: MZTheme.theme.windowMargin
property alias title: label.text
property alias subLabelText: subLabel.text
property var accessibleName: ""

signal clicked()

spacing: 16
Accessible.name: accessibleName

ColumnLayout {
Layout.fillWidth: true
Layout.alignment: Qt.AlignTop

spacing: 0

MZInterLabel {
id: label
Layout.fillWidth: true
text: ""
color: MZTheme.theme.fontColorDark
horizontalAlignment: Text.AlignLeft
visible: !!text.length
Layout.topMargin: 10
}

MZTextBlock {
id: subLabel

Layout.fillWidth: true
text: ""
font.pixelSize: MZTheme.theme.fontSizeSmall
visible: !!text.length
wrapMode: Text.Wrap
verticalAlignment: Text.AlignVCenter
}

Rectangle {
id: divider

Layout.topMargin: MZTheme.theme.toggleRowDividerSpacing
Layout.fillWidth: true
Layout.preferredHeight: 1

color: MZTheme.colors.grey10
}
}

MZIconButton {
id: icon
Layout.alignment: Qt.AlignTop
Layout.preferredHeight: 50
Layout.preferredWidth: 50
buttonColorScheme: MZTheme.theme.clickableRowBlue
MZIcon {
source: "qrc:/nebula/resources/externalLink.svg"
anchors.centerIn: parent
}
onClicked: linkRow.clicked()
}
}
1 change: 1 addition & 0 deletions nebula/ui/components/qmldir
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ MZInformationCard 0.1 MZInformationCard.qml
MZInterLabel 0.1 MZInterLabel.qml
MZLightLabel 0.1 MZLightLabel.qml
MZLinkButton 0.1 MZLinkButton.qml
MZLinkRow 0.1 MZLinkRow.qml
MZList 0.1 MZList.qml
MZLoader 0.1 MZLoader.qml
MZLogsButton 0.1 MZLogsButton.qml
Expand Down
3 changes: 3 additions & 0 deletions src/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ constexpr const char* SUMO_MULTIHOP =
"https://support.mozilla.org/kb/"
"multi-hop-encrypt-your-data-twice-enhanced-security";

constexpr const char* SUMO_ALWAYS_ON_ANDROID =
"https://support.mozilla.org/kb/how-enable-always-vpn-android";

PRODBETAEXPR(QString, contactSupportUrl, "https://accounts.firefox.com/support",
"https://accounts.stage.mozaws.net/support")

Expand Down
4 changes: 4 additions & 0 deletions src/mozillavpn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1355,6 +1355,10 @@ void MozillaVPN::registerUrlOpenerLabels() {

uo->registerUrlLabel("sumoMultihop",
[]() -> QString { return Constants::SUMO_MULTIHOP; });

uo->registerUrlLabel("sumoAlwaysOnAndroid", []() -> QString {
return Constants::SUMO_ALWAYS_ON_ANDROID;
});
}

void MozillaVPN::errorHandled() {
Expand Down
10 changes: 10 additions & 0 deletions src/ui/screens/settings/ViewPreferences.qml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ MZViewBase {

spacing: MZTheme.theme.windowMargin

MZLinkRow {
objectName: "androidStartAtBootLink"

accessibleName: _startAtBootTitle
title: _startAtBootTitle
subLabelText: MZI18n.SettingsStartAtBootSubtitle
visible: Qt.platform.os === "android"
onClicked: MZUrlOpener.openUrlLabel("sumoAlwaysOnAndroid")
}

MZToggleRow {
objectName: "startAtBootToogle"

Expand Down

0 comments on commit 5043801

Please sign in to comment.