Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32210570
D12604.1765132148.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D12604.1765132148.diff
View Options
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
@@ -6,6 +6,7 @@
import {
logOutActionTypes,
useLogOut,
+ usePrimaryDeviceLogOut,
useSecondaryDeviceLogOut,
} from 'lib/actions/user-actions.js';
import { useStringForUser } from 'lib/hooks/ens-cache.js';
@@ -159,6 +160,7 @@
+styles: $ReadOnly<typeof unboundStyles>,
+dispatchActionPromise: DispatchActionPromise,
+logOut: () => Promise<LogOutResult>,
+ +logOutPrimaryDevice: () => Promise<LogOutResult>,
+logOutSecondaryDevice: () => Promise<LogOutResult>,
+staffCanSee: boolean,
+stringForUser: ?string,
@@ -251,14 +253,21 @@
);
}
- let secondaryDeviceLogout;
+ let experimentalLogoutActions;
if (__DEV__) {
- secondaryDeviceLogout = (
- <ProfileRow
- danger
- content="Log out (secondary device)"
- onPress={this.onPressSecondaryDeviceLogout}
- />
+ experimentalLogoutActions = (
+ <>
+ <ProfileRow
+ danger
+ content="Log out (primary device)"
+ onPress={this.onPressPrimaryDeviceLogout}
+ />
+ <ProfileRow
+ danger
+ content="Log out (secondary device)"
+ onPress={this.onPressSecondaryDeviceLogout}
+ />
+ </>
);
}
@@ -313,7 +322,7 @@
{keyserverSelection}
<ProfileRow content="Build info" onPress={this.onPressBuildInfo} />
{developerTools}
- {secondaryDeviceLogout}
+ {experimentalLogoutActions}
</View>
<View style={this.props.styles.unpaddedSection}>
<ProfileRow
@@ -371,6 +380,26 @@
);
};
+ onPressPrimaryDeviceLogout = () => {
+ if (this.loggedOutOrLoggingOut) {
+ return;
+ }
+ // TODO: Add check for primary device
+ Alert.alert(
+ 'Log out primary device',
+ 'Are you sure you want to log out all devices?',
+ [
+ { text: 'No', style: 'cancel' },
+ {
+ text: 'Yes',
+ onPress: this.logOutPrimaryDevice,
+ style: 'destructive',
+ },
+ ],
+ { cancelable: true },
+ );
+ };
+
onPressSecondaryDeviceLogout = () => {
if (this.loggedOutOrLoggingOut) {
return;
@@ -413,6 +442,16 @@
);
}
+ logOutPrimaryDevice = async () => {
+ if (this.loggedOutOrLoggingOut) {
+ return;
+ }
+ void this.props.dispatchActionPromise(
+ logOutActionTypes,
+ this.props.logOutPrimaryDevice(),
+ );
+ };
+
logOutSecondaryDevice = async () => {
if (this.loggedOutOrLoggingOut) {
return;
@@ -497,6 +536,7 @@
const colors = useColors();
const styles = useStyles(unboundStyles);
const callLogOut = useLogOut();
+ const callPrimaryDeviceLogOut = usePrimaryDeviceLogOut();
const callSecondaryDeviceLogOut = useSecondaryDeviceLogOut();
const dispatchActionPromise = useDispatchActionPromise();
const staffCanSee = useStaffCanSee();
@@ -513,6 +553,7 @@
colors={colors}
styles={styles}
logOut={callLogOut}
+ logOutPrimaryDevice={callPrimaryDeviceLogOut}
logOutSecondaryDevice={callSecondaryDeviceLogOut}
dispatchActionPromise={dispatchActionPromise}
staffCanSee={staffCanSee}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 7, 6:29 PM (16 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5845404
Default Alt Text
D12604.1765132148.diff (3 KB)
Attached To
Mode
D12604: [native] Add dev-only button for primary device logout
Attached
Detach File
Event Timeline
Log In to Comment