-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(IT Wallet): [SIW-1960] Scan QR code for remote presentation #6670
Merged
RiccardoMolinari95
merged 18 commits into
master
from
SIW-1960-scan-qr-code-remote-presentation
Feb 6, 2025
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
d73f30d
feat: scan qr code for remote presentation
RiccardoMolinari95 b2da4d3
Merge branch 'master' into SIW-1960-scan-qr-code-remote-presentation
RiccardoMolinari95 fc799a5
chore: add missing locales
RiccardoMolinari95 624a3d8
chore: updated regex for itw_remote barcode
RiccardoMolinari95 786f4f3
Merge branch 'master' into SIW-1960-scan-qr-code-remote-presentation
RiccardoMolinari95 196a756
fix: prettify
RiccardoMolinari95 f28f1c2
chore: improvement itw remote qr code decoding
RiccardoMolinari95 7a96824
Merge branch 'master' into SIW-1960-scan-qr-code-remote-presentation
RiccardoMolinari95 1728d91
chore: fix import
RiccardoMolinari95 2452726
refactor: change qrCodePayload in remoteRequestPayload
RiccardoMolinari95 e76db18
Merge branch 'master' into SIW-1960-scan-qr-code-remote-presentation
RiccardoMolinari95 3ffe18f
Merge branch 'master' into SIW-1960-scan-qr-code-remote-presentation
RiccardoMolinari95 b2316b4
Merge branch 'master' into SIW-1960-scan-qr-code-remote-presentation
RiccardoMolinari95 bb3467e
Merge branch 'master' into SIW-1960-scan-qr-code-remote-presentation
RiccardoMolinari95 f21116f
refactor: rename remote presentation context remoteRequestPayload in …
RiccardoMolinari95 c30320f
refactor: renamed ItwEidClaimsSelectionScreen in ItwRemoteClaimsDiscl…
RiccardoMolinari95 d8033ad
Merge branch 'master' into SIW-1960-scan-qr-code-remote-presentation
RiccardoMolinari95 e01b533
Merge branch 'master' into SIW-1960-scan-qr-code-remote-presentation
RiccardoMolinari95 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import * as O from "fp-ts/Option"; | ||
import { pipe } from "fp-ts/function"; | ||
|
||
export const getUrlParam = (url: string, paramName: string): O.Option<string> => | ||
pipe( | ||
O.tryCatch(() => new URL(url)), | ||
O.chainNullableK(({ searchParams }) => searchParams.get(paramName)) | ||
); |
8 changes: 8 additions & 0 deletions
8
ts/features/itwallet/presentation/remote/Utils/itwRemoteTypeUtils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// TODO: This will be imported from io-react-native-wallet, when the type will be available | ||
// Remote presentation QR code data | ||
export type ItwRemoteRequestPayload = { | ||
clientId: string; | ||
requestUri: string; | ||
state: string; | ||
requestUriMethod?: string; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 17 additions & 3 deletions
20
ts/features/itwallet/presentation/remote/machine/context.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,18 @@ | ||
// This file is a placeholder for future implementation | ||
export type Context = object; | ||
import { ItwRemoteRequestPayload } from "../Utils/itwRemoteTypeUtils.ts"; | ||
import { RemoteFailure } from "./failure.ts"; | ||
|
||
export const InitialContext: Context = {}; | ||
export type Context = { | ||
/** | ||
* The remote request payload for the remote presentation | ||
*/ | ||
payload: ItwRemoteRequestPayload | undefined; | ||
/** | ||
* The failure of the remote presentation machine | ||
*/ | ||
failure?: RemoteFailure; | ||
}; | ||
|
||
export const InitialContext: Context = { | ||
payload: undefined, | ||
failure: undefined | ||
}; |
14 changes: 10 additions & 4 deletions
14
ts/features/itwallet/presentation/remote/machine/events.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
// This file is a placeholder for future implementation | ||
export type PlaceHolder = { | ||
type: "PLACEHOLDER"; | ||
import { ItwRemoteRequestPayload } from "../Utils/itwRemoteTypeUtils.ts"; | ||
|
||
export type Start = { | ||
type: "start"; | ||
payload: ItwRemoteRequestPayload; | ||
}; | ||
|
||
export type Back = { | ||
type: "back"; | ||
}; | ||
|
||
export type RemoteEvents = PlaceHolder; | ||
export type RemoteEvents = Start | Back; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
ts/features/itwallet/presentation/remote/navigation/ItwRemoteParamsList.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { ItwRemoteClaimsDisclosureScreenNavigationParams } from "../screens/ItwRemoteClaimsDisclosureScreen.tsx"; | ||
import { ITW_REMOTE_ROUTES } from "./routes.ts"; | ||
|
||
export type ItwRemoteParamsList = { | ||
[ITW_REMOTE_ROUTES.CLAIMS_DISCLOSURE]: ItwRemoteClaimsDisclosureScreenNavigationParams; | ||
}; |
41 changes: 41 additions & 0 deletions
41
ts/features/itwallet/presentation/remote/navigation/ItwRemoteStackNavigator.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { createStackNavigator } from "@react-navigation/stack"; | ||
import { isGestureEnabled } from "../../../../../utils/navigation.ts"; | ||
import { | ||
ItwRemoteMachineContext, | ||
ItwRemoteMachineProvider | ||
} from "../machine/provider.tsx"; | ||
import { ItwRemoteClaimsDisclosureScreen } from "../screens/ItwRemoteClaimsDisclosureScreen.tsx"; | ||
import { ITW_REMOTE_ROUTES } from "./routes.ts"; | ||
import { ItwRemoteParamsList } from "./ItwRemoteParamsList.ts"; | ||
|
||
const Stack = createStackNavigator<ItwRemoteParamsList>(); | ||
|
||
const hiddenHeader = { headerShown: false }; | ||
|
||
export const ItwRemoteStackNavigator = () => ( | ||
<ItwRemoteMachineProvider> | ||
<InnerNavigator /> | ||
</ItwRemoteMachineProvider> | ||
); | ||
|
||
const InnerNavigator = () => { | ||
const itwRemoteMachineRef = ItwRemoteMachineContext.useActorRef(); | ||
|
||
return ( | ||
<Stack.Navigator | ||
initialRouteName={ITW_REMOTE_ROUTES.CLAIMS_DISCLOSURE} | ||
screenOptions={{ gestureEnabled: isGestureEnabled }} | ||
screenListeners={{ | ||
beforeRemove: () => { | ||
itwRemoteMachineRef.send({ type: "back" }); | ||
} | ||
}} | ||
> | ||
<Stack.Screen | ||
name={ITW_REMOTE_ROUTES.CLAIMS_DISCLOSURE} | ||
component={ItwRemoteClaimsDisclosureScreen} | ||
options={hiddenHeader} | ||
/> | ||
</Stack.Navigator> | ||
); | ||
}; |
4 changes: 4 additions & 0 deletions
4
ts/features/itwallet/presentation/remote/navigation/routes.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const ITW_REMOTE_ROUTES = { | ||
MAIN: "ITW_REMOTE_MAIN" as const, | ||
CLAIMS_DISCLOSURE: "ITW_REMOTE_CLAIMS_DISCLOSURE" as const | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not forget to add tests for the new decoder :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the reminder! I hadn't seen the test folder before. I've added the tests and made corrections in f28f1c2