summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2018-07-10 20:13:52 +0200
committerAndrej Mihajlov <and@mullvad.net>2018-07-16 11:19:29 +0200
commit211df037c1bf56169e82ab68a167986c556f9889 (patch)
treedfda2e8976081ae847a91560db7bacbbeda109cf
parentf12938214e72a39b1d78c863ca25eb5ce2f309e3 (diff)
downloadmullvadvpn-211df037c1bf56169e82ab68a167986c556f9889.tar.xz
mullvadvpn-211df037c1bf56169e82ab68a167986c556f9889.zip
Add actions and reducers for autoConnect
-rw-r--r--app/redux/settings/actions.js22
-rw-r--r--app/redux/settings/reducers.js8
2 files changed, 27 insertions, 3 deletions
diff --git a/app/redux/settings/actions.js b/app/redux/settings/actions.js
index 0d3e252778..fd3ad651d9 100644
--- a/app/redux/settings/actions.js
+++ b/app/redux/settings/actions.js
@@ -12,12 +12,21 @@ export type UpdateRelayLocationsAction = {
relayLocations: Array<RelayLocationRedux>,
};
+export type UpdateAutoConnectAction = {
+ type: 'UPDATE_AUTO_CONNECT',
+ autoConnect: boolean,
+};
+
export type UpdateAllowLanAction = {
type: 'UPDATE_ALLOW_LAN',
allowLan: boolean,
};
-export type SettingsAction = UpdateRelayAction | UpdateRelayLocationsAction | UpdateAllowLanAction;
+export type SettingsAction =
+ | UpdateRelayAction
+ | UpdateRelayLocationsAction
+ | UpdateAutoConnectAction
+ | UpdateAllowLanAction;
function updateRelay(relay: RelaySettingsRedux): UpdateRelayAction {
return {
@@ -35,11 +44,18 @@ function updateRelayLocations(
};
}
+function updateAutoConnect(autoConnect: boolean): UpdateAutoConnectAction {
+ return {
+ type: 'UPDATE_AUTO_CONNECT',
+ autoConnect,
+ };
+}
+
function updateAllowLan(allowLan: boolean): UpdateAllowLanAction {
return {
type: 'UPDATE_ALLOW_LAN',
- allowLan: allowLan,
+ allowLan,
};
}
-export default { updateRelay, updateRelayLocations, updateAllowLan };
+export default { updateRelay, updateRelayLocations, updateAutoConnect, updateAllowLan };
diff --git a/app/redux/settings/reducers.js b/app/redux/settings/reducers.js
index 4a25bf9502..2bd5798aa5 100644
--- a/app/redux/settings/reducers.js
+++ b/app/redux/settings/reducers.js
@@ -37,6 +37,7 @@ export type RelayLocationRedux = {
export type SettingsReduxState = {
relaySettings: RelaySettingsRedux,
relayLocations: Array<RelayLocationRedux>,
+ autoConnect: boolean,
allowLan: boolean,
};
@@ -49,6 +50,7 @@ const initialState: SettingsReduxState = {
},
},
relayLocations: [],
+ autoConnect: false,
allowLan: false,
};
@@ -75,6 +77,12 @@ export default function(
allowLan: action.allowLan,
};
+ case 'UPDATE_AUTO_CONNECT':
+ return {
+ ...state,
+ autoConnect: action.autoConnect,
+ };
+
default:
return state;
}