summaryrefslogtreecommitdiffhomepage
path: root/gui/src/renderer/lib
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2022-04-20 10:53:07 +0200
committerOskar Nyberg <oskar@mullvad.net>2022-04-20 10:53:07 +0200
commit4c93bdcf07af75c8ab3a91ddb0ab2641d277b7c9 (patch)
treeb0af816c5202d64b54d3f3b91b2da700399c019e /gui/src/renderer/lib
parentfbdf3932b450ab65940f9f006db05cd35ff10704 (diff)
parent87a7d264343b356d1acc746635346021fe7d3c6a (diff)
downloadmullvadvpn-4c93bdcf07af75c8ab3a91ddb0ab2641d277b7c9.tar.xz
mullvadvpn-4c93bdcf07af75c8ab3a91ddb0ab2641d277b7c9.zip
Merge branch 'remember-location'
Diffstat (limited to 'gui/src/renderer/lib')
-rw-r--r--gui/src/renderer/lib/history.tsx18
1 files changed, 18 insertions, 0 deletions
diff --git a/gui/src/renderer/lib/history.tsx b/gui/src/renderer/lib/history.tsx
index 2eb08d001d..9a0205b382 100644
--- a/gui/src/renderer/lib/history.tsx
+++ b/gui/src/renderer/lib/history.tsx
@@ -2,6 +2,7 @@ import { Action, History as OriginalHistory, Location, LocationDescriptorObject
import React from 'react';
import { RouteComponentProps, useHistory as useReactRouterHistory, withRouter } from 'react-router';
+import { IHistoryObject } from '../../shared/ipc-types';
import { GeneratedRoutePath, RoutePath } from './routes';
export interface ITransitionSpecification {
@@ -61,6 +62,15 @@ export default class History {
this.entries = [this.createLocation(location, state)];
}
+ public static fromSavedHistory(savedHistory: IHistoryObject): History {
+ const history = new History(RoutePath.launch);
+ history.entries = savedHistory.entries;
+ history.index = savedHistory.index;
+ history.lastAction = savedHistory.lastAction;
+
+ return history;
+ }
+
public get location(): Location<S> {
return this.entries[this.index];
}
@@ -126,6 +136,14 @@ export default class History {
return this as OriginalHistory;
}
+ public get asObject(): IHistoryObject {
+ return {
+ entries: this.entries,
+ index: this.index,
+ lastAction: this.lastAction,
+ };
+ }
+
public block(): never {
throw Error('Not implemented');
}