Make hidden backend selector only visible after 9 taps

This commit is contained in:
John Lyon-Smith
2018-04-23 14:08:25 -07:00
parent 9730c83c9c
commit 24420935a1

View File

@@ -81,6 +81,13 @@ export class Login extends React.Component {
apiModal: null, apiModal: null,
waitModal: null, waitModal: null,
} }
this.hiddenTouchCount = 0
}
componentWillUnmount() {
if (this.hiddenTouchTimer) {
clearTimeout(this.hiddenTouchTimer)
}
} }
@autobind @autobind
@@ -121,7 +128,23 @@ export class Login extends React.Component {
@autobind @autobind
handleApiPress() { handleApiPress() {
this.hiddenTouchCount += 1
if (this.hiddenTouchCount == 9) {
this.hiddenTouchCount = 0
this.setState({ apiModal: {} }) this.setState({ apiModal: {} })
return
} else {
if (this.hiddenTouchTimer) {
clearTimeout(this.hiddenTouchTimer)
this.hiddenTouchTimer = null
}
this.hiddenTouchTimer = setTimeout(
() => (this.hiddenTouchCount = 0),
1000
)
}
} }
render() { render() {