Skip to content
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

docs(sdk): React native passkeys tutorial #663

Merged
merged 30 commits into from
Jan 16, 2025
Merged

Conversation

yagopv
Copy link
Member

@yagopv yagopv commented Dec 18, 2024

Context

This PR adds a new tutorial to the advanced passkeys guides, teaching Safe developers how to work with React Native and Safe contracts, as well as how to add passkeys signers.

As a companion to this tutorial, we are introducing two new repositories:

@yagopv yagopv requested a review from germartinez December 18, 2024 15:01
Copy link

github-actions bot commented Dec 18, 2024

Branch preview

✅ Deployed successfully in branch deployment:

https://react_native_passkeys--docs.review.5afe.dev

Copy link

github-actions bot commented Dec 18, 2024

Overall readability score: 30.91 (🟢 +0.12)

File Readability
react-native.mdx 64.19 (-)
View detailed metrics

🟢 - Shows an increase in readability
🔴 - Shows a decrease in readability

File Readability FRE GF ARI CLI DCRS
react-native.mdx 64.19 54.52 9.96 11 10.9 7.18
  - - - - - -

Averages:

  Readability FRE GF ARI CLI DCRS
Average 30.91 26.94 13.63 17.74 15.81 8.96
  🟢 +0.12 🟢 +0.1 🟢 +0.01 🟢 +0.02 🟢 +0.02 🟢 +0.01
View metric targets
Metric Range Ideal score
Flesch Reading Ease 100 (very easy read) to 0 (extremely difficult read) 60
Gunning Fog 6 (very easy read) to 17 (extremely difficult read) 8 or less
Auto. Read. Index 6 (very easy read) to 14 (extremely difficult read) 8 or less
Coleman Liau Index 6 (very easy read) to 17 (extremely difficult read) 8 or less
Dale-Chall Readability 4.9 (very easy read) to 9.9 (extremely difficult read) 6.9 or less

@yagopv yagopv changed the title React native passkeys tutorial docs(sdk): React native passkeys tutorial Dec 18, 2024
@yagopv yagopv linked an issue Dec 18, 2024 that may be closed by this pull request
@yagopv yagopv requested a review from louis-md December 20, 2024 12:35
Copy link
Collaborator

@louis-md louis-md left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strong work! 💪 A few small remarks to help the user get to the end of the tutorial

pages/advanced/passkeys/tutorials/react-native.mdx Outdated Show resolved Hide resolved
pages/advanced/passkeys/tutorials/react-native.mdx Outdated Show resolved Hide resolved
pages/advanced/passkeys/tutorials/react-native.mdx Outdated Show resolved Hide resolved
pages/advanced/passkeys/tutorials/react-native.mdx Outdated Show resolved Hide resolved
pages/advanced/passkeys/tutorials/react-native.mdx Outdated Show resolved Hide resolved
Copy link
Collaborator

@valle-xyz valle-xyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, this is a great tutorial and a great use case. It was "relatively" easy to follow along, given the complexity of developing and running a mobile app.

However, the last step needs rework. It is important to handhold the developer, and to distuingish between iOS and Android (for example with Tabs). So we really need to be cristal clear and provide good guidance (better guidance than Apple and Google). I was unfortunately not able to add a passkey to the Safe on an Android Emulator. The Safe got deployed, though.

Additional to that, I would like to see some explanatory comments in the code, to guide the developer on what to look out for (as I mentioned in a comment).

When this is added, we need to retest it on Android and on iOS.

pages/advanced/passkeys/tutorials/react-native.mdx Outdated Show resolved Hide resolved
pages/advanced/passkeys/tutorials/react-native.mdx Outdated Show resolved Hide resolved
pages/advanced/passkeys/tutorials/react-native.mdx Outdated Show resolved Hide resolved
pages/advanced/passkeys/tutorials/react-native.mdx Outdated Show resolved Hide resolved
pages/advanced/passkeys/tutorials/react-native.mdx Outdated Show resolved Hide resolved
@louis-md louis-md requested a review from valle-xyz January 13, 2025 17:05
Copy link
Collaborator

@valle-xyz valle-xyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This review includes the first comments after testing. It worked on iOS and did not work on Android (yet).

pages/advanced/passkeys/tutorials/react-native.mdx Outdated Show resolved Hide resolved
pages/advanced/passkeys/tutorials/react-native.mdx Outdated Show resolved Hide resolved
pages/advanced/passkeys/tutorials/react-native.mdx Outdated Show resolved Hide resolved

const txResult = await protocolKit.executeTransaction(signedAddOwnerTx);

const receipt = await waitForTransactionReceipt(client, {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this client is undefined, right? It seems that the function holds here and the app shows a loading spinner for ever.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I log it I have:
Capture d’écran 2025-01-16 à 15 06 15


We will use emulators and development builds in this tutorial, so please refer to the relevant sections in the Expo documentation for proper configuration. If you know how to do that or want to use a physical device, you can skip these steps. If you only want to test one platform, that's fine too, you only need to follow one of the steps below:

- [**Android Studio Emulator**](https://docs.expo.dev/get-started/set-up-your-environment/?platform=android&device=simulated&mode=development-build)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can mention that the steps to “Create a development build” using expo are optional as we are executing the app locally in both Android and iOS setups

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you say on line 69 that we can skip these steps if we know what we do ;)

@yagopv
Copy link
Member Author

yagopv commented Jan 16, 2025

It's mandatory to add the plugins section in the app.json

    "plugins": [
      [
        "expo-build-properties",
        {
          "ios": {
            "deploymentTarget": "15.1"
          },
          "android": {
            "compileSdkVersion": 34
          }
        }
      ]
    ]

This is not reflected in any place

Copy link
Collaborator

@valle-xyz valle-xyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, I went through it again, and still could not get the passkey working on Android.

I added two comments.

pages/advanced/passkeys/tutorials/react-native.mdx Outdated Show resolved Hide resolved
- Have enrolled to the [Apple Developer Program](https://developer.apple.com/programs/enroll/) and installed [Xcode](https://developer.apple.com/xcode/) (if you want to test the app on iOS)
- Have downloaded and installed [Android Studio](https://developer.android.com/studio) and have a Google account connected to your emulator (if you want to test the app on Android)
- Have a [ngrok](https://ngrok.com/) account to create an HTTPS tunnel to your server.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the requirement, that the local java version should be 17.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's mentioned on l.74, do you want to add another one here?

@louis-md louis-md self-requested a review January 16, 2025 15:26
@louis-md louis-md merged commit 95f09c0 into development Jan 16, 2025
3 checks passed
@louis-md louis-md deleted the react-native-passkeys branch January 16, 2025 16:16
louis-md added a commit that referenced this pull request Jan 16, 2025
* chore(sdk): Update passkeys documentation (#649)

* docs(sdk): React native passkeys tutorial (#663)

* Write tutorial

* Upload GIF

* Some improvements

* Update image

* Vale

* Some improvements

* Some improvements

* Some fixes and improvements

* Update pages/advanced/passkeys/tutorials/react-native.mdx

* Update pages/advanced/passkeys/tutorials/react-native.mdx

* Update pages/advanced/passkeys/tutorials/react-native.mdx

* Update pages/advanced/passkeys/tutorials/react-native.mdx

* Update pages/advanced/passkeys/tutorials/react-native.mdx

* Update pages/advanced/passkeys/tutorials/react-native.mdx

* Update pages/advanced/passkeys/tutorials/react-native.mdx

* Add react-native-passkeys tutorial to generateCodeExamples.js script

* Switch generateCodeExamples.js to TypeScript

* Run generateCodeExamples.ts

* Add Xcode to Vale whitelist

* Import style changes from tutorial repo

* Implement requested changes

* Implement requested changes

* Fix vale errors

* Revert requested change l.93 and fix formatting issue

* Fix instructions for iOS

* Reupload iOS assets

* Fix typo

* Add app.json to the code examples

* Streamline iOS flow; implement requested changes

* Fix typo

---------

Co-authored-by: louis-md <[email protected]>

---------

Co-authored-by: Yago Pérez Vázquez <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[React Native] Create guide in docs
3 participants