Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VPN-4691: Add location selection help sheet #8873

Merged
merged 8 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ constexpr const char* MOZILLA_VPN_SUMO_URL =
constexpr const char* SUMO_DNS =
"https://support.mozilla.org/kb/how-do-i-change-my-dns-settings";

constexpr const char* SUMO_MULTIHOP =
"https://support.mozilla.org/kb/"
"multi-hop-encrypt-your-data-twice-enhanced-security";

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

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

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

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

void MozillaVPN::errorHandled() {
Expand Down
12 changes: 12 additions & 0 deletions src/translations/strings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,18 @@ helpSheets:
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
locationTitle:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flodolo format is incorrect now, but will be resolved once #8864 is merged. These strings will fall under the helpSheets label

value: Location selection
comment: Title label for the location selection help sheet
locationHeader:
value: Single-hop vs multi-hop
comment: Header label for the location selection help sheet
locationBody1:
value: If you want maximum speed and reliability, choose one of the recommended locations in the “Single-hop” toggle. We’ve sorted them based on expected performance.
comment: Body label for the location selection help sheet
locationBody2:
value: If you want to add more privacy, switch to “Multi-hop” and add an additional server location. Multi-hop VPN routes your traffic through two server locations instead of one for extra security and privacy. This may also slow down your connection a bit.
comment: Body label for the location selection help sheet

global:
expand:
Expand Down
13 changes: 0 additions & 13 deletions src/ui/screens/home/ViewMultiHop.qml
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,6 @@ StackView {
anchors.rightMargin: MZTheme.theme.windowMargin / 2
spacing: MZTheme.theme.vSpacing

MZCollapsibleCard {
title: MZI18n.MultiHopFeatureMultiHopCardHeader

iconSrc: "qrc:/ui/resources/tip.svg"
contentItem: MZTextBlock {
text: MZI18n.MultiHopFeatureMultiHopCardBody
textFormat: Text.StyledText
Layout.fillWidth: true
}
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: parent.width - MZTheme.theme.windowMargin
}

RecentConnections {
Layout.fillWidth: true
showMultiHopRecentConnections: true
Expand Down
39 changes: 39 additions & 0 deletions src/ui/screens/home/ViewServers.qml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,24 @@ Item {
title: defaultMenuTitle
onActiveFocusChanged: if (focus) forceFocus = true

rightButtonComponent: Component {
Loader {
active: MZFeatureList.get("helpSheets").isSupported
sourceComponent: MZIconButton {
onClicked: helpSheetLoader.active = true

accessibleName: MZI18n.GlobalHelp

Image {
anchors.centerIn: parent

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

_menuOnBackClicked: () => {
if (multiHopStackView && multiHopStackView.depth > 1) {
// User clicked back from either the Multi-hop entry or exit server list
Expand Down Expand Up @@ -131,6 +149,27 @@ Item {
}
}

Loader {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A 'HelpSheetLoader' component is starting to sound better and better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea... or even just a loader as the base for all sheets. will do this for all in a fast follow

id: helpSheetLoader

active: false

onActiveChanged: if (active) item.open()

sourceComponent: MZHelpSheet {
title: MZI18n.HelpSheetsLocationTitle

model: [
{type: MZHelpSheet.BlockType.Title, text: MZI18n.HelpSheetsLocationHeader},
{type: MZHelpSheet.BlockType.Text, text: MZI18n.HelpSheetsLocationBody1, margin: 8},
{type: MZHelpSheet.BlockType.Text, text:MZI18n.HelpSheetsLocationBody2, margin: 16},
{type: MZHelpSheet.BlockType.LinkButton, text: MZI18n.GlobalLearnMore, margin: 16, action: () => { MZUrlOpener.openUrlLabel("sumoMultihop") } },
]

onClosed: helpSheetLoader.active = false
}
}

Component.onCompleted: {
if (!MZFeatureList.get("multiHop").isSupported) {
return;
Expand Down
13 changes: 0 additions & 13 deletions src/ui/screens/home/servers/ServerList.qml
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,6 @@ FocusScope {
right: parent.right
}

MZCollapsibleCard {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤩✨🧹👋

...This is a great way for ServerList.qml to start the new year.

anchors.horizontalCenter: parent.horizontalCenter

iconSrc: "qrc:/ui/resources/tip.svg"
contentItem: MZTextBlock {
text: MZI18n.ServersViewRecommendedCardBody
textFormat: Text.StyledText
Layout.fillWidth: true
}
title: MZI18n.ServersViewRecommendedCardTitle
width: parent.width - MZTheme.theme.windowMargin * 2
}

// Status component
// TODO: Refresh server list and handle states
MZClickableRow {
Expand Down
2 changes: 0 additions & 2 deletions tests/functional/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ const screenHome = {
'//segmentedNavToggle/segmentedToggleBtnLayout/tabMultiHop'),
MULTIHOP_VIEW: new QmlQueryComposer('//multiHopStackView'),
ALL_SERVERS_TAB: new QmlQueryComposer('//tabAllServers'),
VPN_MULTHOP_CHEVRON: new QmlQueryComposer('//vpnCollapsibleCardChevron'),
VPN_COLLAPSIBLE_CARD: new QmlQueryComposer('//vpnCollapsibleCard'),
}
};

Expand Down
12 changes: 0 additions & 12 deletions tests/functional/testMultihop.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,12 @@ describe('Server list', function() {
it('opening the entry and exit server list', async () => {
await vpn.waitForQueryAndClick(
queries.screenHome.serverListView.MULTIHOP_SELECTOR_TAB.visible());
await vpn.waitForQuery(
queries.screenHome.serverListView.VPN_COLLAPSIBLE_CARD.visible());

assert(
await vpn.getQueryProperty(
queries.screenHome.serverListView.VPN_COLLAPSIBLE_CARD,
'expanded') === 'false');

await vpn.waitForQuery(
queries.screenHome.serverListView.ENTRY_BUTTON.visible());

await vpn.waitForQuery(
queries.screenHome.serverListView.EXIT_BUTTON.visible());

await vpn.waitForQueryAndClick(
queries.screenHome.serverListView.VPN_MULTHOP_CHEVRON.visible())
assert(await vpn.getQueryProperty(
queries.screenHome.serverListView.VPN_COLLAPSIBLE_CARD, 'expanded'))
});

it('check the countries and cities for multihop entries', async () => {
Expand Down
Loading