From 24420935a13d685200fdb863860d2d6d7aa35df7 Mon Sep 17 00:00:00 2001 From: John Lyon-Smith Date: Mon, 23 Apr 2018 14:08:25 -0700 Subject: [PATCH] Make hidden backend selector only visible after 9 taps --- mobile/src/Auth/Login.js | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/mobile/src/Auth/Login.js b/mobile/src/Auth/Login.js index 96b839c..1c7c644 100644 --- a/mobile/src/Auth/Login.js +++ b/mobile/src/Auth/Login.js @@ -81,6 +81,13 @@ export class Login extends React.Component { apiModal: null, waitModal: null, } + this.hiddenTouchCount = 0 + } + + componentWillUnmount() { + if (this.hiddenTouchTimer) { + clearTimeout(this.hiddenTouchTimer) + } } @autobind @@ -121,7 +128,23 @@ export class Login extends React.Component { @autobind handleApiPress() { - this.setState({ apiModal: {} }) + this.hiddenTouchCount += 1 + + if (this.hiddenTouchCount == 9) { + this.hiddenTouchCount = 0 + this.setState({ apiModal: {} }) + return + } else { + if (this.hiddenTouchTimer) { + clearTimeout(this.hiddenTouchTimer) + this.hiddenTouchTimer = null + } + + this.hiddenTouchTimer = setTimeout( + () => (this.hiddenTouchCount = 0), + 1000 + ) + } } render() {