feat(mobile): implement NFC tag writing support to share DevCards#348
Open
JavaProgswing wants to merge 1 commit into
Open
feat(mobile): implement NFC tag writing support to share DevCards#348JavaProgswing wants to merge 1 commit into
JavaProgswing wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR adds NFC writing support in the mobile app, allowing users to write a “DevCard” link from Settings to an NFC tag/card, along with the required platform configuration.
Changes:
- Adds NFC write flow in
SettingsScreen(fetch payload, request NDEF tech, write tag). - Introduces
react-native-nfc-managerdependency for NFC support. - Updates iOS Info.plist and adds an Android manifest with NFC permission/feature flags.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| apps/mobile/src/screens/SettingsScreen.tsx | Adds UI + async logic to fetch an NFC payload and write it to an NDEF tag. |
| apps/mobile/package.json | Adds react-native-nfc-manager dependency. |
| apps/mobile/ios/DevCard/Info.plist | Adds NFC usage description required for iOS permission prompt. |
| apps/mobile/android/app/src/main/AndroidManifest.xml | Adds Android NFC permission/feature declarations and app/activity manifest. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+70
to
+72
| NfcManager.cancelTechnologyRequest(); | ||
| setWritingNfc(false); | ||
| } |
Comment on lines
+1
to
+4
| <manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| <uses-permission android:name="android.permission.INTERNET" /> | ||
| <uses-permission android:name="android.permission.NFC" /> | ||
| <uses-feature android:name="android.hardware.nfc" android:required="false" /> |
Comment on lines
+58
to
+65
| const bytes = Ndef.encodeMessage([ | ||
| Ndef.uriRecord(data.payload), | ||
| ]); | ||
|
|
||
| if (bytes) { | ||
| await NfcManager.ndefHandler.writeNdefMessage(bytes); | ||
| Alert.alert('Success', 'Successfully wrote DevCard to NFC tag!'); | ||
| } |
Comment on lines
+168
to
+179
| <TouchableOpacity | ||
| style={styles.settingRow} | ||
| onPress={writeNfcTag} | ||
| disabled={writingNfc}> | ||
| <View style={styles.settingRowLeft}> | ||
| <Text style={styles.settingRowIcon}>💳</Text> | ||
| <Text style={styles.settingRowText}> | ||
| {writingNfc ? 'Writing to NFC...' : 'Write to NFC Card'} | ||
| </Text> | ||
| </View> | ||
| <Text style={styles.settingRowArrow}>→</Text> | ||
| </TouchableOpacity> |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR introduces the ability to write a DevCard profile link directly to a physical NFC tag, enabling a seamless one-tap sharing experience on the mobile app.
Fixes #347
Changes Included
react-native-nfc-managerto@devcard/mobileto handle cross-platform NFC interactions.NFCReaderUsageDescriptioninInfo.plist) and Android (android.permission.NFCinAndroidManifest.xml).SettingsScreen./api/nfc/payloadbackend endpoint.NfcManagerto write the fetched URI record securely to a scanned physical NFC tag.Testing Instructions
pnpm installfrom the repository root to ensure the newreact-native-nfc-managerdependency is linked.pnpm --filter @devcard/mobile run android) or iOS (pnpm --filter @devcard/mobile run ios).