Skip to content

Commit c4ba921

Browse files
chore: pos sample improvements (#259)
1 parent 0c838ef commit c4ba921

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1777
-895
lines changed

dapps/W3MWagmi/ios/W3MWagmi.xcodeproj/project.pbxproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@
10471047
PRODUCT_BUNDLE_IDENTIFIER = com.walletconnect.web3modal.rnsample;
10481048
PRODUCT_NAME = W3MWagmi;
10491049
PROVISIONING_PROFILE_SPECIFIER = "";
1050-
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "match AppStore com.walletconnect.web3modal.rnsample 1757428944";
1050+
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "matchAppStore com.walletconnect.web3modal.rnsample";
10511051
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
10521052
SUPPORTS_MACCATALYST = NO;
10531053
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
@@ -1167,7 +1167,7 @@
11671167
PRODUCT_BUNDLE_IDENTIFIER = com.walletconnect.web3modal.rnsample;
11681168
PRODUCT_NAME = W3MWagmi;
11691169
PROVISIONING_PROFILE_SPECIFIER = "";
1170-
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "match AppStore com.walletconnect.web3modal.rnsample 1757428944";
1170+
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "matchAppStore com.walletconnect.web3modal.rnsample";
11711171
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
11721172
SUPPORTS_MACCATALYST = NO;
11731173
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
@@ -1422,7 +1422,7 @@
14221422
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-Internal";
14231423
CLANG_ENABLE_MODULES = YES;
14241424
CODE_SIGN_ENTITLEMENTS = W3MWagmi/W3MWagmi.entitlements;
1425-
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
1425+
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
14261426
CODE_SIGN_STYLE = Manual;
14271427
CURRENT_PROJECT_VERSION = 114;
14281428
DEVELOPMENT_TEAM = W5R8AG9K22;
@@ -1524,8 +1524,8 @@
15241524
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_DEBUG";
15251525
PRODUCT_BUNDLE_IDENTIFIER = com.walletconnect.web3modal.rnsample.internal;
15261526
PRODUCT_NAME = "$(TARGET_NAME)";
1527-
PROVISIONING_PROFILE_SPECIFIER = "match AppStore com.walletconnect.web3modal.rnsample.internal";
1528-
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "match AppStore com.walletconnect.web3modal.rnsample.internal 1757428937";
1527+
PROVISIONING_PROFILE_SPECIFIER = "";
1528+
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "match Development com.walletconnect.web3modal.rnsample.internal";
15291529
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
15301530
SUPPORTS_MACCATALYST = NO;
15311531
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
@@ -1543,7 +1543,7 @@
15431543
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-Internal";
15441544
CLANG_ENABLE_MODULES = YES;
15451545
CODE_SIGN_ENTITLEMENTS = W3MWagmi/W3MWagmi.entitlements;
1546-
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
1546+
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
15471547
CODE_SIGN_STYLE = Manual;
15481548
CURRENT_PROJECT_VERSION = 114;
15491549
DEVELOPMENT_TEAM = W5R8AG9K22;
@@ -1644,8 +1644,8 @@
16441644
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_RELEASE";
16451645
PRODUCT_BUNDLE_IDENTIFIER = com.walletconnect.web3modal.rnsample.internal;
16461646
PRODUCT_NAME = "$(TARGET_NAME)";
1647-
PROVISIONING_PROFILE_SPECIFIER = "match AppStore com.walletconnect.web3modal.rnsample.internal";
1648-
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "match AppStore com.walletconnect.web3modal.rnsample.internal 1757428937";
1647+
PROVISIONING_PROFILE_SPECIFIER = "";
1648+
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "match Development com.walletconnect.web3modal.rnsample.internal";
16491649
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
16501650
SUPPORTS_MACCATALYST = NO;
16511651
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;

dapps/pos-app/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,3 @@ app-example
4242

4343
ios/*
4444
android/*
45-
.env.local

dapps/pos-app/README.md

Lines changed: 92 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,103 @@ In the output, you'll find options to open the app in a
2525

2626
You can start developing by editing the files inside the **app** directory. This project uses [file-based routing](https://docs.expo.dev/router/introduction).
2727

28-
## Get a fresh project
28+
## Sentry Configuration
2929

30-
When you're ready, run:
30+
This project uses [Sentry](https://sentry.io/) for error tracking and monitoring. Before building the app, you need to configure Sentry authentication.
31+
32+
### Option 1: Using Sentry Wizard (Recommended)
33+
34+
Run the Sentry wizard to automatically configure your project:
35+
36+
```bash
37+
npx @sentry/wizard@latest -i reactNative
38+
```
39+
40+
This will:
41+
- Create/update the `sentry.properties` file in the `android/` and `ios/` directories
42+
- Set up your authentication token
43+
- Configure source map uploading
44+
45+
### Option 2: Manual Configuration
46+
47+
If you prefer to configure manually, you can set the `SENTRY_AUTH_TOKEN` environment variable:
48+
49+
```bash
50+
# DO NOT COMMIT YOUR AUTH TOKEN
51+
export SENTRY_AUTH_TOKEN=sntrys_YOUR_TOKEN_HERE
52+
```
53+
54+
Alternatively, you can add the token directly to the `sentry.properties` files:
55+
56+
**android/sentry.properties** and **ios/sentry.properties**:
57+
```properties
58+
defaults.url=https://sentry.io/
59+
defaults.org=walletconnect
60+
defaults.project=mobile-pos-react-native
61+
auth.token=YOUR_AUTH_TOKEN_HERE
62+
```
63+
64+
> **⚠️ Security Note**: Never commit your Sentry auth token to version control. Add `sentry.properties` to your `.gitignore` file.
65+
66+
### Getting Your Auth Token
67+
68+
1. Log in to [sentry.io](https://sentry.io/)
69+
2. Go to Settings → Account → API → Auth Tokens
70+
3. Create a new token with the following scopes:
71+
- `project:read`
72+
- `project:releases`
73+
- `org:read`
74+
75+
For more information on source maps and Expo integration, see the [Sentry Expo Documentation](https://docs.sentry.io/platforms/react-native/sourcemaps/uploading/expo/).
76+
77+
## Android Release Configuration
78+
79+
To build Android release versions of the app, you need to create a `secrets.properties` file in the `android/` directory with your keystore credentials.
80+
81+
### Option 1: Testing with Debug Signing (Recommended for Development)
82+
83+
For testing purposes, you can use the debug signing configuration. In `android/app/build.gradle`, ensure the release build type uses the debug signing config:
84+
85+
```gradle
86+
buildTypes {
87+
release {
88+
signingConfig signingConfigs.debug
89+
// ... other release configurations
90+
}
91+
}
92+
```
93+
94+
This allows you to build release APKs without setting up a production keystore.
95+
96+
### Option 2: Production Signing with secrets.properties
97+
98+
For production releases, create a file at `android/secrets.properties` with the following content:
99+
100+
```properties
101+
WC_FILENAME_UPLOAD=path/to/your-keystore.keystore
102+
WC_STORE_PASSWORD_UPLOAD=your_store_password
103+
WC_KEYSTORE_ALIAS=your_key_alias
104+
WC_KEY_PASSWORD_UPLOAD=your_key_password
105+
```
106+
107+
Then update the release signing config in `android/app/build.gradle` to use the release signing configuration instead of debug.
108+
109+
### Generating a Keystore
110+
111+
If you don't have a keystore file yet, you can generate one using the following command:
31112

32113
```bash
33-
npm run reset-project
114+
keytool -genkeypair -v -storetype PKCS12 -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000
34115
```
35116

36-
This command will move the starter code to the **app-example** directory and create a blank **app** directory where you can start developing.
117+
This will prompt you to create passwords for the keystore and key. Make sure to:
118+
- Store the keystore file in a secure location
119+
- Remember the passwords you set
120+
- Never commit the keystore file or `secrets.properties` to version control
121+
122+
> **⚠️ Security Note**: The `secrets.properties` file is already excluded in the `.gitignore`. Never commit this file or your keystore to version control.
123+
124+
For more information on Android app signing, see the [React Native documentation](https://reactnative.dev/docs/signed-apk-android).
37125

38126
## Learn more
39127

dapps/pos-app/app.json

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@
1616
"usesNonExemptEncryption": false
1717
},
1818
"infoPlist": {
19-
"NFCReaderUsageDescription": "This app requires NFC to send messages"
19+
"NFCReaderUsageDescription": "This app requires NFC to send messages",
20+
"NSLocationWhenInUseUsageDescription": "This app requires location when using the camera"
2021
},
2122
"entitlements": {
22-
"com.apple.developer.nfc.readersession.formats": ["TAG"]
23+
"com.apple.developer.nfc.readersession.formats": [
24+
"TAG"
25+
]
2326
}
2427
},
2528
"android": {
@@ -32,8 +35,10 @@
3235
"edgeToEdgeEnabled": true,
3336
"predictiveBackGestureEnabled": false,
3437
"package": "com.reown.mobilepos",
35-
"permissions": ["android.permission.NFC"],
36-
"versionCode": 2
38+
"permissions": [
39+
"android.permission.NFC"
40+
],
41+
"versionCode": 3
3742
},
3843
"web": {
3944
"output": "static",
@@ -54,6 +59,7 @@
5459
"@sentry/react-native/expo",
5560
{
5661
"url": "https://sentry.io/",
62+
"note": "Use SENTRY_AUTH_TOKEN env to authenticate with Sentry.",
5763
"project": "mobile-pos-react-native",
5864
"organization": "walletconnect"
5965
}
@@ -62,7 +68,11 @@
6268
[
6369
"expo-font",
6470
{
65-
"fonts": ["./assets/fonts/KHTeka-Light.otf", "./assets/fonts/KHTeka-Regular.otf", "./assets/fonts/KHTeka-Medium.otf"],
71+
"fonts": [
72+
"./assets/fonts/KHTeka-Light.otf",
73+
"./assets/fonts/KHTeka-Regular.otf",
74+
"./assets/fonts/KHTeka-Medium.otf"
75+
],
6676
"android": {
6777
"fonts": [
6878
{
@@ -85,9 +95,20 @@
8595
]
8696
},
8797
"ios": {
88-
"fonts": ["./assets/fonts/KHTeka-Light.otf", "./assets/fonts/KHTeka-Regular.otf", "./assets/fonts/KHTeka-Medium.otf"]
98+
"fonts": [
99+
"./assets/fonts/KHTeka-Light.otf",
100+
"./assets/fonts/KHTeka-Regular.otf",
101+
"./assets/fonts/KHTeka-Medium.otf"
102+
]
89103
}
90104
}
105+
],
106+
[
107+
"react-native-vision-camera",
108+
{
109+
"cameraPermissionText": "$(PRODUCT_NAME) needs access to your Camera.",
110+
"enableLocation": false
111+
}
91112
]
92113
],
93114
"experiments": {

dapps/pos-app/app/_layout.tsx

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ import { useColorScheme } from "@/hooks/use-color-scheme";
1717
import { useInitializePOS } from "@/hooks/use-initialize-pos";
1818
import { useTheme } from "@/hooks/use-theme-color";
1919
import { appKit, wagmiAdapter } from "@/utils/appkit";
20+
import {
21+
getHeaderBackgroundColor,
22+
getHeaderTintColor,
23+
shouldCenterHeaderTitle,
24+
} from "@/utils/navigation";
2025
import { AppKit, AppKitProvider } from "@reown/appkit-react-native";
2126
import * as Sentry from "@sentry/react-native";
2227
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
@@ -28,15 +33,15 @@ Sentry.init({
2833

2934
// Adds more context data to events (IP address, cookies, user, etc.)
3035
// For more information, visit: https://docs.sentry.io/platforms/react-native/data-management/data-collected/
31-
sendDefaultPii: true,
36+
sendDefaultPii: false,
3237

3338
// Enable Logs
34-
enableLogs: true,
39+
enableLogs: __DEV__ ? true : false,
3540

3641
// Configure Session Replay
37-
replaysSessionSampleRate: 0.1,
38-
replaysOnErrorSampleRate: 1,
39-
integrations: [Sentry.mobileReplayIntegration()],
42+
replaysSessionSampleRate: 0,
43+
replaysOnErrorSampleRate: 0,
44+
integrations: [],
4045

4146
// uncomment the line below to enable Spotlight (https://spotlightjs.com)
4247
spotlight: __DEV__,
@@ -59,7 +64,7 @@ export default Sentry.wrap(function RootLayout() {
5964
url: "https://reown.com/appkit",
6065
},
6166
loggerOptions: {
62-
posLevel: "debug",
67+
posLevel: __DEV__ ? "debug" : "silent",
6368
},
6469
});
6570

@@ -74,17 +79,11 @@ export default Sentry.wrap(function RootLayout() {
7479
<POSProvider posClient={posClient} isInitialized={isInitialized}>
7580
<Stack
7681
screenOptions={({ route }) => {
77-
const centerTitle =
78-
route.name === "index" ||
79-
route.name === "payment-success";
80-
const isPaymentSuccess = route.name === "payment-success";
81-
const headerBackgroundColor = isPaymentSuccess
82-
? Theme["text-success"]
83-
: Theme["bg-primary"];
84-
85-
const headerTintColor = isPaymentSuccess
86-
? Theme["text-invert"]
87-
: Theme["text-primary"];
82+
const centerTitle = shouldCenterHeaderTitle(route.name);
83+
const headerTintColor = getHeaderTintColor(route.name);
84+
const headerBackgroundColor = getHeaderBackgroundColor(
85+
route.name,
86+
);
8887

8988
return {
9089
headerTitle: centerTitle ? HeaderImage : "",
@@ -94,12 +93,11 @@ export default Sentry.wrap(function RootLayout() {
9493
)
9594
: undefined,
9695
headerShadowVisible: false,
97-
headerTintColor,
96+
headerTintColor: Theme[headerTintColor],
9897
headerBackButtonDisplayMode: "minimal",
9998
headerTitleAlign: "center",
100-
headerBackImageSource: require("@/assets/images/arrow-left.png"),
10199
headerStyle: {
102-
backgroundColor: headerBackgroundColor,
100+
backgroundColor: Theme[headerBackgroundColor],
103101
},
104102
contentStyle: {
105103
backgroundColor: Theme["bg-primary"],
@@ -109,12 +107,6 @@ export default Sentry.wrap(function RootLayout() {
109107
}}
110108
>
111109
<Stack.Screen name="index" />
112-
<Stack.Screen
113-
name="settings"
114-
options={{
115-
title: "",
116-
}}
117-
/>
118110
<Stack.Screen name="amount" />
119111
<Stack.Screen name="payment-method" />
120112
<Stack.Screen name="payment-token" />
@@ -127,6 +119,12 @@ export default Sentry.wrap(function RootLayout() {
127119
headerBackVisible: false,
128120
}}
129121
/>
122+
<Stack.Screen name="address-not-set" />
123+
<Stack.Screen name="settings" />
124+
<Stack.Screen name="settings-address-list" />
125+
<Stack.Screen name="settings-update-address" />
126+
<Stack.Screen name="settings-scan-address" />
127+
<Stack.Screen name="settings-networks" />
130128
</Stack>
131129
<StatusBar style="auto" />
132130
<AppKit />

0 commit comments

Comments
 (0)