Skip to content

Commit

Permalink
feat(INJI-474): use polyfill for URL searchParams feat
Browse files Browse the repository at this point in the history
Signed-off-by: Harsh Vardhan <[email protected]>
  • Loading branch information
vharsh committed Nov 15, 2023
1 parent 9088719 commit 09a0398
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ fileignoreconfig:
- filename: package.json
checksum: fdd5905228a1afbfb004c710fd6c61adf073a12840200327c0592b76bea5e7e3
- filename: package-lock.json
checksum: 179883df6d414d82b7f54353a3a4cc75e6a681224f4b6d1831ce85de27de2726
checksum: 489ccd69f2deecedb8b2ff9a3a02d74c704dfba01fdfb6179316a9df698c4562
- filename: components/PasscodeVerify.tsx
checksum: 14654c0f038979fcd0d260170a45894a072f81e0767ca9a0e66935d33b5cc703
- filename: i18n.ts
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'react-native-gesture-handler';
import { registerRootComponent } from 'expo';
import 'react-native-url-polyfill/auto'; // https://stackoverflow.com/a/75787849
import {registerRootComponent} from 'expo';

import App from './App';

Expand Down
7 changes: 2 additions & 5 deletions machines/bleShare/scan/scanMachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ export const scanMachine =
}),

setLinkCode: assign({
linkCode: (_context, event) =>
linkCode: (_, event) =>
new URL(event.params).searchParams.get('linkCode'),
}),
setStayInProgress: assign({
Expand Down Expand Up @@ -1180,10 +1180,7 @@ export const scanMachine =
try {
let linkCode = new URL(event.params);
// sample: 'inji://landing-page-name?linkCode=sTjp0XVH3t3dGCU&linkExpireDateTime=2023-11-09T06:56:18.482Z'
return (
linkCode.searchParams.get('linkCode') &&
linkCode.searchParams.get('linkExpireDateTime')
);
return linkCode.searchParams.get('linkCode') !== '';
} catch (e) {
return false;
}
Expand Down
98 changes: 98 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
"react-native-flipper": "^0.212.0",
"react-native-flipper-xstate": "^1.0.5",
"react-native-svg-transformer": "^1.1.0",
"react-native-url-polyfill": "^2.0.0",
"rn-mmkv-storage-flipper": "^1.1.1",
"typescript": "^4.9.4"
},
Expand Down
6 changes: 3 additions & 3 deletions screens/Scan/ScanScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export const ScanScreen: React.FC = () => {
return noShareableVcText();
}
if (controller.selectIsInvalid) {
return invalidQR();
return displayInvalidQR();
}
if (controller.isNearByDevicesPermissionDenied) {
return allowNearbyDevicesPermissionComponent();
Expand Down Expand Up @@ -163,7 +163,7 @@ export const ScanScreen: React.FC = () => {
);
}

function invalidQR(): React.ReactNode {
function displayInvalidQR(): React.ReactNode {
return (
!controller.isEmpty && (
<MessageOverlay
Expand All @@ -174,7 +174,7 @@ export const ScanScreen: React.FC = () => {
<Button
fill
type="gradient"
title={t('common:ok')}
title={t('common:cancel')}
onPress={() => navigation.navigate(BOTTOM_TAB_ROUTES.home)}
/>
<Button
Expand Down

0 comments on commit 09a0398

Please sign in to comment.