Skip to content

Commit daa48fc

Browse files
chore: pos improvements (#262)
1 parent 24303b8 commit daa48fc

Some content is hidden

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

42 files changed

+135
-384
lines changed

dapps/pos-app/app.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"slug": "mobile-pos",
55
"version": "1.0.0",
66
"orientation": "portrait",
7-
"icon": "./assets/images/icon.png",
7+
"icon": "./assets/app_icons/icon.png",
88
"scheme": "WPay",
99
"userInterfaceStyle": "automatic",
1010
"newArchEnabled": true,
@@ -28,28 +28,27 @@
2828
"android": {
2929
"adaptiveIcon": {
3030
"backgroundColor": "#E6F4FE",
31-
"foregroundImage": "./assets/images/android-icon-foreground.png",
32-
"backgroundImage": "./assets/images/android-icon-background.png",
33-
"monochromeImage": "./assets/images/android-icon-monochrome.png"
31+
"foregroundImage": "./assets/app_icons/android_icon_foreground.png",
32+
"backgroundImage": "./assets/app_icons/android_icon_background.png",
33+
"monochromeImage": "./assets/app_icons/android_icon_monochrome.png"
3434
},
3535
"edgeToEdgeEnabled": true,
3636
"predictiveBackGestureEnabled": false,
3737
"package": "com.reown.mobilepos",
3838
"permissions": [
3939
"android.permission.NFC"
4040
],
41-
"versionCode": 3
41+
"versionCode": 4
4242
},
4343
"web": {
44-
"output": "static",
45-
"favicon": "./assets/images/favicon.png"
44+
"output": "static"
4645
},
4746
"plugins": [
4847
"expo-router",
4948
[
5049
"expo-splash-screen",
5150
{
52-
"image": "./assets/images/splash-icon.png",
51+
"image": "./assets/app_icons/splash_icon.png",
5352
"imageWidth": 200,
5453
"resizeMode": "contain",
5554
"backgroundColor": "#000000"
@@ -68,11 +67,6 @@
6867
[
6968
"expo-font",
7069
{
71-
"fonts": [
72-
"./assets/fonts/KHTeka-Light.otf",
73-
"./assets/fonts/KHTeka-Regular.otf",
74-
"./assets/fonts/KHTeka-Medium.otf"
75-
],
7670
"android": {
7771
"fonts": [
7872
{
@@ -109,6 +103,12 @@
109103
"cameraPermissionText": "$(PRODUCT_NAME) needs access to your Camera.",
110104
"enableLocation": false
111105
}
106+
],
107+
[
108+
"expo-asset",
109+
{
110+
"assets": ["./assets/images","./assets/images/tokens","./assets/images/chains","./assets/images/payment_methods","./assets/app_icons"]
111+
}
112112
]
113113
],
114114
"experiments": {

dapps/pos-app/app/address-not-set.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function PaymentSuccessScreen() {
2323
<View style={[styles.container, { paddingTop: insets.top }]}>
2424
<View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
2525
<Image
26-
source={require("@/assets/images/warning-circle.png")}
26+
source={{ uri: "warning_circle" }}
2727
style={[styles.warningCircle, { tintColor: Theme["icon-warning"] }]}
2828
cachePolicy="memory-disk"
2929
priority="high"

dapps/pos-app/app/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default function HomeScreen() {
3636
]}
3737
>
3838
<Image
39-
source={require("@/assets/images/plus.png")}
39+
source={{ uri: "plus" }}
4040
style={styles.actionButtonImage}
4141
cachePolicy="memory-disk"
4242
priority="high"
@@ -51,7 +51,7 @@ export default function HomeScreen() {
5151
]}
5252
>
5353
<Image
54-
source={require("@/assets/images/gear.png")}
54+
source={{ uri: "gear" }}
5555
style={styles.actionButtonImage}
5656
cachePolicy="memory-disk"
5757
priority="high"

dapps/pos-app/app/payment-failure.tsx

Lines changed: 34 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as Haptics from "expo-haptics";
22
import { Image } from "expo-image";
33
import { router, UnknownOutputParams, useLocalSearchParams } from "expo-router";
4-
import React, { useEffect, useRef } from "react";
5-
import { Animated, Dimensions, StyleSheet, View } from "react-native";
4+
import React, { useEffect } from "react";
5+
import { StyleSheet, View } from "react-native";
66
import { useSafeAreaInsets } from "react-native-safe-area-context";
77

88
import { Button } from "@/components/button";
@@ -11,11 +11,6 @@ import { BorderRadius, Spacing } from "@/constants/spacing";
1111
import { useTheme } from "@/hooks/use-theme-color";
1212
import { TokenKey } from "@/utils/networks";
1313

14-
const { width: screenWidth, height: screenHeight } = Dimensions.get("window");
15-
const diagonalLength = Math.sqrt(screenWidth ** 2 + screenHeight ** 2);
16-
const initialCircleSize = 20;
17-
const finalScale = Math.round(diagonalLength / initialCircleSize) + 1;
18-
1914
interface ScreenParams extends UnknownOutputParams {
2015
amount: string;
2116
token: TokenKey;
@@ -28,9 +23,6 @@ export default function PaymentSuccessScreen() {
2823
const insets = useSafeAreaInsets();
2924
const params = useLocalSearchParams<ScreenParams>();
3025

31-
const circleScale = useRef(new Animated.Value(1)).current;
32-
const contentOpacity = useRef(new Animated.Value(0)).current;
33-
3426
const handleRetry = () => {
3527
const { amount, token, networkCaipId, recipientAddress } = params;
3628
router.dismissTo({
@@ -46,93 +38,46 @@ export default function PaymentSuccessScreen() {
4638

4739
useEffect(() => {
4840
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Heavy);
49-
50-
Animated.parallel([
51-
Animated.spring(circleScale, {
52-
toValue: finalScale,
53-
tension: 15,
54-
friction: 12,
55-
useNativeDriver: true,
56-
}),
57-
Animated.sequence([
58-
Animated.delay(300),
59-
Animated.timing(contentOpacity, {
60-
toValue: 1,
61-
duration: 400,
62-
useNativeDriver: true,
63-
}),
64-
]),
65-
]).start();
66-
// eslint-disable-next-line react-hooks/exhaustive-deps
6741
}, []);
6842

6943
return (
7044
<View style={[styles.container, { paddingTop: insets.top }]}>
71-
{/* Expanding circle background */}
72-
<Animated.View
73-
style={[
74-
styles.circle,
75-
{
76-
backgroundColor: Theme["bg-primary"],
77-
width: initialCircleSize,
78-
height: initialCircleSize,
79-
borderRadius: initialCircleSize / 2,
80-
transform: [{ scale: circleScale }],
81-
},
82-
]}
83-
/>
84-
85-
{/* Content that fades in after circle expands */}
86-
<Animated.View
87-
style={[
88-
styles.contentContainer,
89-
{
90-
opacity: contentOpacity,
91-
},
92-
]}
93-
>
94-
<View
95-
style={{ flex: 1, justifyContent: "center", alignItems: "center" }}
45+
<View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
46+
<Image
47+
source={{ uri: "warning_circle" }}
48+
style={[styles.warningCircle, { tintColor: Theme["icon-error"] }]}
49+
cachePolicy="memory-disk"
50+
priority="high"
51+
/>
52+
<ThemedText
53+
style={[styles.failedText, { color: Theme["text-primary"] }]}
54+
>
55+
Payment failed
56+
</ThemedText>
57+
<ThemedText
58+
style={[styles.failedDescription, { color: Theme["text-secondary"] }]}
59+
>
60+
The payment couldn't be completed due to an error. Please try again or
61+
use a different payment method.
62+
</ThemedText>
63+
</View>
64+
<View style={styles.buttonContainer}>
65+
<Button
66+
onPress={handleRetry}
67+
style={[
68+
styles.button,
69+
{
70+
backgroundColor: Theme["bg-accent-primary"],
71+
},
72+
]}
9673
>
97-
<Image
98-
source={require("@/assets/images/warning-circle.png")}
99-
style={[styles.warningCircle, { tintColor: Theme["icon-error"] }]}
100-
cachePolicy="memory-disk"
101-
priority="high"
102-
/>
103-
<ThemedText
104-
style={[styles.failedText, { color: Theme["text-primary"] }]}
105-
>
106-
Payment failed
107-
</ThemedText>
10874
<ThemedText
109-
style={[
110-
styles.failedDescription,
111-
{ color: Theme["text-secondary"] },
112-
]}
75+
style={[styles.buttonText, { color: Theme["text-invert"] }]}
11376
>
114-
The payment couldn’t be completed due to an error. Please try again
115-
or use a different payment method.
77+
Try again
11678
</ThemedText>
117-
</View>
118-
<View style={styles.buttonContainer}>
119-
<Button
120-
onPress={handleRetry}
121-
style={[
122-
styles.button,
123-
{
124-
backgroundColor: Theme["bg-accent-primary"],
125-
},
126-
]}
127-
>
128-
<ThemedText
129-
style={[styles.buttonText, { color: Theme["text-invert"] }]}
130-
>
131-
Try again
132-
</ThemedText>
133-
</Button>
134-
</View>
135-
</Animated.View>
79+
</Button>
80+
</View>
13681
</View>
13782
);
13883
}
@@ -143,17 +88,6 @@ const styles = StyleSheet.create({
14388
paddingHorizontal: Spacing["spacing-5"],
14489
paddingBottom: Spacing["spacing-5"],
14590
},
146-
circle: {
147-
position: "absolute",
148-
top: "50%",
149-
left: "50%",
150-
marginLeft: -initialCircleSize / 2,
151-
marginTop: -initialCircleSize / 2,
152-
},
153-
contentContainer: {
154-
flex: 1,
155-
width: "100%",
156-
},
15791
failedText: {
15892
fontSize: 26,
15993
lineHeight: 28,

dapps/pos-app/app/payment-method.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default function PaymentMethodScreen() {
3333
]}
3434
>
3535
<Image
36-
source={require("@/assets/images/payment-methods/card.png")}
36+
source={{ uri: "card" }}
3737
style={styles.cardsImage}
3838
cachePolicy="memory-disk"
3939
priority="high"
@@ -48,7 +48,7 @@ export default function PaymentMethodScreen() {
4848
]}
4949
>
5050
<Image
51-
source={require("@/assets/images/payment-methods/wpay.png")}
51+
source={{ uri: "wpay" }}
5252
style={styles.cryptoImage}
5353
cachePolicy="memory-disk"
5454
priority="high"

dapps/pos-app/app/payment-network.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { BorderRadius, Spacing } from "@/constants/spacing";
55
import { useTheme } from "@/hooks/use-theme-color";
66
import { useSettingsStore } from "@/store/useSettingsStore";
77
import {
8-
getIcon,
98
getTokenAvailableNetworks,
109
getTokenById,
1110
TokenKey,
@@ -88,12 +87,12 @@ export default function PaymentNetworkScreen() {
8887
{tokenData?.symbol} on {item.name}
8988
</ThemedText>
9089
<ImageBackground
91-
source={getIcon(tokenData?.icon)}
90+
source={{ uri: tokenData?.icon }}
9291
style={styles.tokenIcon}
9392
resizeMode="contain"
9493
>
9594
<Image
96-
source={getIcon(item.icon)}
95+
source={{ uri: item.icon }}
9796
style={[
9897
styles.chainIcon,
9998
{ borderColor: Theme["border-primary"] },

0 commit comments

Comments
 (0)