Skip to content

Commit

Permalink
dns settings help sheet
Browse files Browse the repository at this point in the history
  • Loading branch information
Foxbolts committed Dec 22, 2023
1 parent c34cc36 commit 92a553a
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 14 deletions.
11 changes: 8 additions & 3 deletions nebula/ui/components/MZHelpSheet.qml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ MZBottomSheet {
id: icon
anchors.centerIn: parent

sourceSize.width: MZTheme.theme.iconSize
sourceSize.width: MZTheme.theme.iconSize * 1.5

mirror: MZLocalizer.isRightToLeft
fillMode: Image.PreserveAspectFit
Expand All @@ -107,13 +107,18 @@ MZBottomSheet {
}

MZIconButton {
id: iconButton

Layout.rightMargin: MZTheme.theme.windowMargin / 2

Layout.preferredHeight: MZTheme.theme.rowHeight
Layout.preferredWidth: MZTheme.theme.rowHeight

//Hacky workaround because for some reason, when opening a sheet via
//the right menu button in MZMenu, this close button is in a
//"Hovered" state, even though it wasn't hovered
//Likely something to do with both icon buttons being in the same position
//Relative to their parent (top right corner)
mouseArea.hoverEnabled: bottomSheet.opened

onClicked: bottomSheet.close()

accessibleName: MZI18n.GlobalClose
Expand Down
1 change: 1 addition & 0 deletions nebula/ui/components/MZIconButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ MZButtonBase {
property bool skipEnsureVisible: false
property var accessibleName
property var buttonColorScheme: MZTheme.theme.iconButtonLightBackground
property alias mouseArea: mouseArea
property alias backgroundRadius: uiStates.radius
property alias uiStatesVisible: uiStates.visible

Expand Down
2 changes: 2 additions & 0 deletions nebula/ui/resources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,7 @@ qt_add_qml_module(resources
info.svg
lock.svg
startup.svg
question.svg
tip-filled.svg

)
3 changes: 3 additions & 0 deletions nebula/ui/resources/question.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions nebula/ui/resources/tip-filled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions src/featurelist.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ FEATURE(gleanRust, // Feature ID
QStringList(), // feature dependencies
FeatureCallback_true)

FEATURE(helpSheets, // Feature ID
"Help sheets", // Feature name
FeatureCallback_true, // Can be flipped on
FeatureCallback_true, // Can be flipped off
QStringList(), // feature dependencies
FeatureCallback_false)

FEATURE(inAppAccountCreate, // Feature ID
"In-app Account Creation", // Feature name
FeatureCallback_true, // Can be flipped on
Expand Down
4 changes: 4 additions & 0 deletions src/mozillavpn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1381,6 +1381,10 @@ void MozillaVPN::registerUrlOpenerLabels() {
uo->registerUrlLabel("upgradeToAnnualUrl", []() -> QString {
return Constants::upgradeToAnnualUrl();
});

uo->registerUrlLabel("sumoDns", []() -> QString {
return "https://support.mozilla.org/en-US/kb/how-do-i-change-my-dns-settings";
});
}

void MozillaVPN::errorHandled() {
Expand Down
20 changes: 20 additions & 0 deletions src/translations/strings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,20 @@ devices:
value: My devices
comment: Title for the menu bar when viewing the devices or device limit pages

helpSheets:
dnsTitle:
value: Custom DNS settings
comment: Title label for the custom dns help sheet
dnsHeader:
value: What is custom DNS?
comment: Header label for the custom dns help sheet
dnsBody1:
value: Whenever you connect to a website, a DNS (domain name system) first turns the domain name (e.g. www.mozilla.org) into an IP address that allows your internet traffic to reach that destination.
comment: Body text for the custom dns help sheet
dnsBody2:
value: Mozilla VPN allows you to choose a custom DNS server if you prefer. If you use one, you won’t be able to use other privacy features in the VPN like tracker blocking.
comment: Body text for the custom dns help sheet

global:
expand:
value: Expand
Expand Down Expand Up @@ -977,6 +991,12 @@ global:
getStarted:
value: Get started
comment: Label for a button used to begin something / proceed
help:
value: Help
comment: Action taken that will help the user
learnMore:
value: Learn more
comment: Label for link to allow the user to learn more about a topic

getHelp:
helpCenter: Help Center
Expand Down
65 changes: 54 additions & 11 deletions src/ui/screens/settings/ViewDNSSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,27 @@ MZViewBase {
property bool privacyDialogNeeded: true
property bool dnsSelectionChanged: false
readonly property string telemetryScreenId : "dns_settings"
property Component rightMenuButton: Component {
Loader {
active: MZFeatureList.get("helpSheets").isSupported
sourceComponent: MZIconButton {
id: iconButton

onClicked: helpSheetLoader.active = true

accessibleName: MZI18n.GlobalHelp
Accessible.ignored: !visible

Image {
anchors.centerIn: parent

source: "qrc:/nebula/resources/question.svg"
fillMode: Image.PreserveAspectFit
}
}
}
}


function applyFrontendChanges(settingValue) {
if (settingValue === MZSettings.Gateway) {
Expand Down Expand Up @@ -73,7 +94,7 @@ MZViewBase {
function reset() {
root.customDNS = MZSettings.dnsProviderFlags === MZSettings.Custom;
root.privacyDialogNeeded = MZSettings.dnsProviderFlags !== MZSettings.Custom &&
MZSettings.dnsProviderFlags !== MZSettings.Gateway;
MZSettings.dnsProviderFlags !== MZSettings.Gateway;
ipInput.text = MZSettings.userDNS;
}

Expand Down Expand Up @@ -224,9 +245,9 @@ MZViewBase {
}

onActiveFocusChanged: {
if (!activeFocus && !ipInput.focusReasonA11y) {
maybeSaveChange();
}
if (!activeFocus && !ipInput.focusReasonA11y) {
maybeSaveChange();
}
}
}

Expand Down Expand Up @@ -258,8 +279,8 @@ MZViewBase {

Component.onCompleted: {
Glean.impression.dnsSettingsScreen.record({
screen: telemetryScreenId,
});
screen: telemetryScreenId,
});
reset();
}

Expand All @@ -268,11 +289,11 @@ MZViewBase {
}

onVisibleChanged: {
if (!visible) {
maybeSaveChange();
} else {
reset();
}
if (!visible) {
maybeSaveChange();
} else {
reset();
}
}

Loader {
Expand Down Expand Up @@ -315,5 +336,27 @@ MZViewBase {

onActiveChanged: if (active) { item.open() }
}

Loader {
id: helpSheetLoader

active: false

onActiveChanged: if (active) item.open()

sourceComponent: MZHelpSheet {
title: MZI18n.HelpSheetsDnsTitle
iconSource: "qrc:/nebula/resources/tip-filled.svg"

model: [
{type: MZHelpSheet.BlockType.Title, text: MZI18n.HelpSheetsDnsHeader},
{type: MZHelpSheet.BlockType.Text, text: MZI18n.HelpSheetsDnsBody1, margin: 8},
{type: MZHelpSheet.BlockType.Text, text:MZI18n.HelpSheetsDnsBody2, margin: 16},
{type: MZHelpSheet.BlockType.LinkButton, text: MZI18n.GlobalLearnMore, margin: 16, action: () => { MZUrlOpener.openUrlLabel("sumoDns") } },
]

onClosed: helpSheetLoader.active = false
}
}
}

0 comments on commit 92a553a

Please sign in to comment.