summaryrefslogtreecommitdiffhomepage
path: root/gui/src/renderer
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2021-09-01 16:00:13 +0200
committerOskar Nyberg <oskar@mullvad.net>2021-09-06 14:38:26 +0200
commit02fb05e44efb4802fa111a359dbf9669e2799ac2 (patch)
tree088a26a5ee56432898d00455bcbf4d33d7f4a06c /gui/src/renderer
parent993c7e039041d238256b663b80d20297a6ffca7e (diff)
downloadmullvadvpn-02fb05e44efb4802fa111a359dbf9669e2799ac2.tar.xz
mullvadvpn-02fb05e44efb4802fa111a359dbf9669e2799ac2.zip
Improve location reset
Diffstat (limited to 'gui/src/renderer')
-rw-r--r--gui/src/renderer/app.tsx16
1 files changed, 13 insertions, 3 deletions
diff --git a/gui/src/renderer/app.tsx b/gui/src/renderer/app.tsx
index 28d2c8b480..4ee5dc51e7 100644
--- a/gui/src/renderer/app.tsx
+++ b/gui/src/renderer/app.tsx
@@ -612,16 +612,25 @@ export default class AppRenderer {
if (location !== 'any' && 'only' in location) {
const constraint = location.only;
- const relayLocations = this.reduxStore.getState().settings.relayLocations;
+ const state = this.reduxStore.getState();
+ const coordinates = {
+ longitude: state.connection.longitude,
+ latitude: state.connection.latitude,
+ };
+ const relayLocations = state.settings.relayLocations;
if ('country' in constraint) {
const country = relayLocations.find(({ code }) => constraint.country === code);
- this.reduxActions.connection.newLocation({ country: country?.name });
+ this.reduxActions.connection.newLocation({ country: country?.name, ...coordinates });
} else if ('city' in constraint) {
const country = relayLocations.find(({ code }) => constraint.city[0] === code);
const city = country?.cities.find(({ code }) => constraint.city[1] === code);
- this.reduxActions.connection.newLocation({ country: country?.name, city: city?.name });
+ this.reduxActions.connection.newLocation({
+ country: country?.name,
+ city: city?.name,
+ ...coordinates,
+ });
} else if ('hostname' in constraint) {
const country = relayLocations.find(({ code }) => constraint.hostname[0] === code);
const city = country?.cities.find((location) => location.code === constraint.hostname[1]);
@@ -630,6 +639,7 @@ export default class AppRenderer {
country: country?.name,
city: city?.name,
hostname: constraint.hostname[2],
+ ...coordinates,
});
}
}