Skip to content

Commit

Permalink
[native] Show version unsupported when opened QR screen
Browse files Browse the repository at this point in the history
Summary:
The QR screen is now for dev-only, but it's theoretically possible to access it via deep link.

For now, the clients aren't able to do it because there are no such QR codes to scan, but in the future after device list launch, they might try doing it on old client versions.
We should display the unsupported version message.

Depends on D14036

Test Plan: Changed isDev condition and opened the QR scanner screen. I was logged out and a message was displayed.

Reviewers: kamil, angelika

Reviewed By: kamil

Subscribers: ashoat, tomek

Differential Revision: https://phab.comm.dev/D14037
  • Loading branch information
barthap committed Nov 29, 2024
1 parent a9ed611 commit ce616cf
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions native/navigation/deep-links-context-provider.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@ import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js';
import {
errorMessageIsInvalidCSAT,
usingCommServicesAccessToken,
usingRestoreFlow,
} from 'lib/utils/services-utils.js';

import {
InviteLinkModalRouteName,
SecondaryDeviceQRCodeScannerRouteName,
} from './route-names.js';
import { useSelector } from '../redux/redux-utils.js';
import { useOnFirstLaunchEffect } from '../utils/hooks.js';
import {
useShowVersionUnsupportedAlert,
useOnFirstLaunchEffect,
} from '../utils/hooks.js';

type DeepLinksContextType = {
+setCurrentLinkUrl: SetState<?string>,
Expand Down Expand Up @@ -97,6 +101,7 @@ function DeepLinksContextProvider(props: Props): React.Node {
const { getAuthMetadata } = identityContext;

const invalidTokenLogOut = useInvalidCSATLogOut();
const showVersionUnsupportedAlert = useShowVersionUnsupportedAlert(false);
const loggedIn = useSelector(isLoggedIn);
const dispatchActionPromise = useDispatchActionPromise();
const validateLink = useVerifyInviteLink(keyserverOverride);
Expand Down Expand Up @@ -146,10 +151,21 @@ function DeepLinksContextProvider(props: Props): React.Node {
});
}
} else if (parsedData.type === 'qr-code') {
if (!usingRestoreFlow) {
showVersionUnsupportedAlert();
return;
}
navigation.navigate(SecondaryDeviceQRCodeScannerRouteName);
}
})();
}, [currentLink, getAuthMetadata, loggedIn, navigation, invalidTokenLogOut]);
}, [
currentLink,
getAuthMetadata,
loggedIn,
navigation,
invalidTokenLogOut,
showVersionUnsupportedAlert,
]);

React.useEffect(() => {
const secret = inviteLinkSecret.current;
Expand Down

0 comments on commit ce616cf

Please sign in to comment.