Page MenuHomePhabricator

D6831.diff
No OneTemporary

D6831.diff

diff --git a/native/profile/profile-screen.react.js b/native/profile/profile-screen.react.js
--- a/native/profile/profile-screen.react.js
+++ b/native/profile/profile-screen.react.js
@@ -70,6 +70,7 @@
+logOut: (preRequestUserState: PreRequestUserState) => Promise<LogOutResult>,
+staffCanSee: boolean,
+stringForUser: ?string,
+ +isAccountWithPassword: boolean,
};
class ProfileScreen extends React.PureComponent<Props> {
@@ -174,6 +175,22 @@
if (this.loggedOutOrLoggingOut) {
return;
}
+ if (!this.props.isAccountWithPassword) {
+ Alert.alert(
+ 'Log out',
+ 'Are you sure you want to log out?',
+ [
+ { text: 'No', style: 'cancel' },
+ {
+ text: 'Yes',
+ onPress: this.logOutWithoutDeletingNativeCredentialsWrapper,
+ style: 'destructive',
+ },
+ ],
+ { cancelable: true },
+ );
+ return;
+ }
const alertTitle =
Platform.OS === 'ios' ? 'Keep Login Info in Keychain' : 'Keep Login Info';
const alertDescription =
@@ -184,7 +201,10 @@
alertDescription,
[
{ text: 'Cancel', style: 'cancel' },
- { text: 'Keep', onPress: this.logOutButKeepNativeCredentialsWrapper },
+ {
+ text: 'Keep',
+ onPress: this.logOutWithoutDeletingNativeCredentialsWrapper,
+ },
{
text: 'Remove',
onPress: this.logOutAndDeleteNativeCredentialsWrapper,
@@ -195,7 +215,7 @@
);
};
- logOutButKeepNativeCredentialsWrapper = () => {
+ logOutWithoutDeletingNativeCredentialsWrapper = () => {
if (this.loggedOutOrLoggingOut) {
return;
}
@@ -356,6 +376,9 @@
const dispatchActionPromise = useDispatchActionPromise();
const staffCanSee = useStaffCanSee();
const stringForUser = useStringForUser(currentUserInfo);
+ const isAccountWithPassword = useSelector(state =>
+ accountHasPassword(state.currentUserInfo),
+ );
return (
<ProfileScreen
@@ -369,6 +392,7 @@
dispatchActionPromise={dispatchActionPromise}
staffCanSee={staffCanSee}
stringForUser={stringForUser}
+ isAccountWithPassword={isAccountWithPassword}
/>
);
});

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 22, 11:56 PM (18 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2692912
Default Alt Text
D6831.diff (2 KB)

Event Timeline