Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3298635
D8806.id29864.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D8806.id29864.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D8806: [native] Prevent simulators from attempting to open the barcode scanner
Attached
Detach File
Event Timeline
Log In to Comment