Page MenuHomePhabricator

D8806.id29864.diff
No OneTemporary

D8806.id29864.diff

diff --git a/native/profile/linked-devices-header-right-button.react.js b/native/profile/linked-devices-header-right-button.react.js
--- a/native/profile/linked-devices-header-right-button.react.js
+++ b/native/profile/linked-devices-header-right-button.react.js
@@ -6,15 +6,25 @@
import { SecondaryDeviceQRCodeScannerRouteName } from '../navigation/route-names.js';
import { useStyles } from '../themes/colors.js';
+import Alert from '../utils/alert.js';
+import { devIsEmulator } from '../utils/url-utils.js';
function LinkedDevicesHeaderRightButton(): React.Node {
const styles = useStyles(unboundStyles);
const navigation = useNavigation();
- const navigateToQRCodeScanner = React.useCallback(
- () => navigation.navigate(SecondaryDeviceQRCodeScannerRouteName),
- [navigation],
- );
+ const navigateToQRCodeScanner = React.useCallback(() => {
+ if (devIsEmulator) {
+ Alert.alert(
+ 'Unsupported device',
+ "You can't access the QR code scanner on a simulator.",
+ [{ text: 'OK' }],
+ { cancelable: false },
+ );
+ return;
+ }
+ navigation.navigate(SecondaryDeviceQRCodeScannerRouteName);
+ }, [navigation]);
return (
<TouchableOpacity onPress={navigateToQRCodeScanner}>
diff --git a/native/utils/url-utils.js b/native/utils/url-utils.js
--- a/native/utils/url-utils.js
+++ b/native/utils/url-utils.js
@@ -78,4 +78,5 @@
natNodeServer,
setCustomServer,
normalizeURL,
+ devIsEmulator,
};

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 18, 7:37 AM (22 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2534273
Default Alt Text
D8806.id29864.diff (1 KB)

Event Timeline