Skip to content

Commit

Permalink
Update - logout should show confirmation dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
sarthakpranesh committed Jun 27, 2020
1 parent 5f6e418 commit 628f805
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions src/screens/GameHome.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
Animated,
TouchableOpacity,
BackHandler,
Alert,
} from 'react-native';
import SoundPlayer from 'react-native-sound-player';
import auth from '@react-native-firebase/auth';
Expand Down Expand Up @@ -113,6 +114,25 @@ export default class GameHome extends Component {
});
}

onLogout() {
Alert.alert(
'Logout',
'Are you sure, you want to logout of the app?',
[
{
text: 'Yes',
onPress: async () => {
await GoogleSignin.revokeAccess();
await GoogleSignin.signOut();
auth().signOut();
},
},
{text: 'No'},
],
{cancelable: true},
);
}

render() {
return (
<View style={styles.viewContainer}>
Expand Down Expand Up @@ -154,11 +174,7 @@ export default class GameHome extends Component {
</TouchableOpacity>
<TouchableOpacity
style={styles.button}
onPress={async () => {
await GoogleSignin.revokeAccess();
await GoogleSignin.signOut();
auth().signOut();
}}>
onPress={() => this.onLogout()}>
<Text style={styles.buttonText}>LogOut</Text>
</TouchableOpacity>
</Animated.View>
Expand Down

0 comments on commit 628f805

Please sign in to comment.