From 7b3aa6fef0a989df43252744f9a28983fa51c3a0 Mon Sep 17 00:00:00 2001 From: fortuna Date: Thu, 6 Jun 2019 18:38:40 -0400 Subject: [PATCH 1/4] Make TOS a dialog --- .../ui_components/app-root.html | 276 ++++++++---------- ...-tos-view.html => outline-tos-dialog.html} | 41 +-- src/server_manager/web_app/app.ts | 9 + 3 files changed, 159 insertions(+), 167 deletions(-) rename src/server_manager/ui_components/{outline-tos-view.html => outline-tos-dialog.html} (60%) diff --git a/src/server_manager/ui_components/app-root.html b/src/server_manager/ui_components/app-root.html index df288c62a..82ce5b5ed 100644 --- a/src/server_manager/ui_components/app-root.html +++ b/src/server_manager/ui_components/app-root.html @@ -36,7 +36,7 @@ - + diff --git a/src/server_manager/web_app/app.ts b/src/server_manager/web_app/app.ts index 0c5a73a84..d5657bd71 100644 --- a/src/server_manager/web_app/app.ts +++ b/src/server_manager/web_app/app.ts @@ -36,6 +36,8 @@ interface PolymerEvent extends Event { // https://www.digitalocean.com/help/referral-program/ const DIGITALOCEAN_REFERRAL_CODE = '5ddb4219b716'; +const TOS_ACK_LOCAL_STORAGE_KEY = 'tos-ack'; + interface UiAccessKey { id: string; placeholderName: string; @@ -92,6 +94,10 @@ export class App { private digitalOceanTokenManager: TokenManager) { appRoot.setAttribute('outline-version', this.version); + appRoot.addEventListener('TermsOfServiceAccepted', (event: PolymerEvent) => { + window.localStorage[TOS_ACK_LOCAL_STORAGE_KEY] = Date.now(); + }); + appRoot.addEventListener('ConnectToDigitalOcean', (event: PolymerEvent) => { this.connectToDigitalOcean(); }); @@ -215,6 +221,9 @@ export class App { } async start(): Promise { + if (!window.localStorage[TOS_ACK_LOCAL_STORAGE_KEY]) { + this.appRoot.$.tosDialog.open(); + } this.showIntro(); await this.syncDisplayServersToUi(); From 405f61ba0988c716eb8a216861d6d397a084061b Mon Sep 17 00:00:00 2001 From: fortuna Date: Fri, 7 Jun 2019 13:18:14 -0400 Subject: [PATCH 2/4] Remove TOS constant --- src/server_manager/ui_components/app-root.html | 1 - 1 file changed, 1 deletion(-) diff --git a/src/server_manager/ui_components/app-root.html b/src/server_manager/ui_components/app-root.html index 82ce5b5ed..b00feb3f1 100644 --- a/src/server_manager/ui_components/app-root.html +++ b/src/server_manager/ui_components/app-root.html @@ -441,7 +441,6 @@

Disconnect DigitalOcean account