From ad18e0620a7ee54465e4defefd5785ef35460344 Mon Sep 17 00:00:00 2001 From: talksik Date: Tue, 20 Aug 2019 22:00:07 -0700 Subject: [PATCH] only requiring google sign in for specific command --- src/components/MainCommand.js | 43 ++++++++++++++++++++++------------- src/components/root.less | 4 ++++ 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/src/components/MainCommand.js b/src/components/MainCommand.js index 6549faf..cc2e209 100644 --- a/src/components/MainCommand.js +++ b/src/components/MainCommand.js @@ -17,7 +17,9 @@ const INITIAL_COMMAND_STATE = { : 'https://s3-us-west-1.amazonaws.com/charify-assets/defaultLogo.png', commandInputPlaceholder: 'Do Everything You Want', commandComplete: false, - commandProcessedData: null + commandProcessedData: null, + + needGoogleAuth: false }; class MainCommand extends Component { @@ -94,6 +96,7 @@ class MainCommand extends Component { var newCommandInputPlaceholder = this.state.commandInputPlaceholder; var newCommandComplete = this.state.commandComplete; var newCommandProcessedData = this.state.commandProcessedData; + var newNeedGoogleAuth = this.state.needGoogleAuth; // initial finding that command was entered // TODO: helper function to properly change properties @@ -103,6 +106,7 @@ class MainCommand extends Component { 'https://image.flaticon.com/icons/png/512/281/281769.png'; newInput = newInput.replace('gmail', ''); newCommandInputPlaceholder = 'to | subject | message'; + newNeedGoogleAuth = true; } if (newCommand == 'google') { @@ -129,6 +133,11 @@ class MainCommand extends Component { } } + if (newNeedGoogleAuth) { + // Make the user go through google sign in + this.googleSignIn(); + } + this.setState({ command: newCommand, commandInput: newInput, @@ -196,8 +205,11 @@ class MainCommand extends Component { return (
- {googleAccessToken == null ? ( -
+ {/* Google Sign In button */} + {/*
Login with Google -
- ) : ( - - - - - )} +
*/} + + + + + {commandComplete && (