Skip to content

Commit

Permalink
🐛 [Register] Fix sign out if quit
Browse files Browse the repository at this point in the history
  • Loading branch information
nwingt committed Nov 3, 2022
1 parent 7fd313b commit 07de346
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 0 additions & 4 deletions app/screens/registration-screen/registration-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,6 @@ export class RegistrationScreen extends React.Component<RegistrationScreenProps,
}
}

async componentWillUnmount() {
await this.props.userStore.authCore.signOut()
}

/**
* Validate the target input
*/
Expand Down
15 changes: 15 additions & 0 deletions app/screens/sign-in-screen/sign-in-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { LoadingScreen } from "../../components/loading-screen"

import { translate } from "../../i18n"
import { color } from "../../theme"
import { NavigationEventSubscription } from "react-navigation"

const defaultBgImage = require("./bg.jpg")

Expand Down Expand Up @@ -68,15 +69,29 @@ export class SignInScreen extends React.Component<SignInScreenProps, SignInScree
footerYAnim: new Animated.Value(200),
}

screenWillFocusSubscription: NavigationEventSubscription

componentDidMount() {
this._checkNavigationParams()
this.screenWillFocusSubscription = this.props.navigation.addListener("willFocus", (payload) => {
if ((payload.lastState as any).routeName === "Register") {
// Sign out Authcore if users cancel Liker ID registration
this.props.userStore.authCore.signOut()
}
})
this.reveal()
}

componentDidUpdate() {
this._checkNavigationParams()
}

componentWillUnmount() {
if (this.screenWillFocusSubscription) {
this.screenWillFocusSubscription.remove()
}
}

private reveal() {
const duration = 1500
const easing = Easing.out(Easing.cubic)
Expand Down

0 comments on commit 07de346

Please sign in to comment.