Skip to content

Commit 24303b8

Browse files
chore: added loader screen to POS (#261)
1 parent d039114 commit 24303b8

File tree

6 files changed

+320
-35
lines changed

6 files changed

+320
-35
lines changed

.github/workflows/release-android-base.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ jobs:
121121
run: touch ${{ inputs.root-path }}/android/sentry.properties && echo "${{ secrets.sentry-file }}" >> ${{ inputs.root-path }}/android/sentry.properties
122122

123123
- name: Add Secrets file
124-
run: touch ${{ inputs.root-path }}/android/secrets.properties && echo "${{ secrets.secrets-file }}" >> ${{ inputs.root-path }}/android/secrets.properties
124+
run: touch ${{ inputs.root-path }}/android/secrets.properties && echo "${{ secrets.secrets-file }}" > ${{ inputs.root-path }}/android/secrets.properties
125125

126126
- name: Add Keystore file
127127
run: echo ${{ secrets.keystore }} | base64 --decode >> ${{ inputs.root-path }}/android/app/${{ secrets.keystore-name }}.keystore

dapps/pos-app/app/_layout.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ export default Sentry.wrap(function RootLayout() {
8989
headerTitle: centerTitle ? HeaderImage : "",
9090
headerRight: !centerTitle
9191
? () => (
92-
<HeaderImage padding tintColor={headerTintColor} />
92+
<HeaderImage
93+
padding
94+
tintColor={Theme[headerTintColor]}
95+
/>
9396
)
9497
: undefined,
9598
headerShadowVisible: false,

dapps/pos-app/app/scan.tsx

Lines changed: 62 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { CloseButton } from "@/components/close-button";
22
import { QRCode } from "@/components/qr-code";
33
import { ThemedText } from "@/components/themed-text";
4+
import { WalletConnectLoading } from "@/components/walletconnect-loading";
45
import { BorderRadius, Spacing } from "@/constants/spacing";
56
import { usePOS } from "@/context/POSContext";
67
import { usePOSListener } from "@/hooks/use-pos-listener";
@@ -29,6 +30,7 @@ export default function QRModalScreen() {
2930
const params = useLocalSearchParams<ScreenParams>();
3031

3132
const [qrUri, setQrUri] = useState("");
33+
const [isLoading, setIsLoading] = useState(false);
3234
const { posClient } = usePOS();
3335
const Theme = useTheme();
3436

@@ -48,6 +50,7 @@ export default function QRModalScreen() {
4850
recipientAddress,
4951
},
5052
});
53+
setIsLoading(false);
5154
}, [amount, token, networkCaipId, recipientAddress]);
5255

5356
usePOSListener("connection_failed", ({ error }) => {
@@ -64,8 +67,9 @@ export default function QRModalScreen() {
6467
setQrUri(uri);
6568
});
6669

67-
usePOSListener("payment_requested", () => {
70+
usePOSListener("connected", () => {
6871
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Heavy);
72+
setIsLoading(true);
6973
});
7074

7175
usePOSListener("payment_rejected", ({ error }) => {
@@ -97,6 +101,7 @@ export default function QRModalScreen() {
97101
recipientAddress: recipientAddress,
98102
},
99103
});
104+
setIsLoading(false);
100105
});
101106

102107
const handleOnClosePress = () => {
@@ -146,36 +151,51 @@ export default function QRModalScreen() {
146151

147152
return (
148153
<View style={styles.container}>
149-
<View style={styles.amountContainer}>
150-
<ThemedText
151-
style={[styles.amountText, { color: Theme["text-tertiary"] }]}
152-
>
153-
Scan to pay
154-
</ThemedText>
155-
<ThemedText
156-
style={[
157-
styles.amountValue,
158-
{ color: Theme["text-primary"], textTransform: "uppercase" },
159-
]}
160-
>
161-
${amount}
162-
</ThemedText>
163-
</View>
164-
<QRCode size={300} uri={qrUri} logoBorderRadius={55}>
165-
<ImageBackground
166-
source={getIcon(tokenData?.icon)}
167-
style={styles.tokenIcon}
168-
resizeMode="contain"
169-
>
170-
<Image
171-
source={getIcon(networkData?.icon)}
172-
style={[styles.chainIcon, { borderColor: Theme["bg-primary"] }]}
173-
cachePolicy="memory-disk"
174-
priority="high"
175-
/>
176-
</ImageBackground>
177-
</QRCode>
178-
<View style={{ flex: 1 }} />
154+
{isLoading ? (
155+
<View style={styles.loadingContainer}>
156+
<WalletConnectLoading size={180} />
157+
<ThemedText
158+
style={[styles.amountText, { color: Theme["text-primary"] }]}
159+
fontSize={16}
160+
lineHeight={18}
161+
>
162+
Waiting for payment confirmation…
163+
</ThemedText>
164+
</View>
165+
) : (
166+
<View style={styles.scanContainer}>
167+
<View style={styles.amountContainer}>
168+
<ThemedText
169+
style={[styles.amountText, { color: Theme["text-tertiary"] }]}
170+
>
171+
Scan to pay
172+
</ThemedText>
173+
<ThemedText
174+
style={[
175+
styles.amountValue,
176+
{ color: Theme["text-primary"], textTransform: "uppercase" },
177+
]}
178+
>
179+
${amount}
180+
</ThemedText>
181+
</View>
182+
<QRCode size={300} uri={qrUri} logoBorderRadius={55}>
183+
<ImageBackground
184+
source={getIcon(tokenData?.icon)}
185+
style={styles.tokenIcon}
186+
resizeMode="contain"
187+
>
188+
<Image
189+
source={getIcon(networkData?.icon)}
190+
style={[styles.chainIcon, { borderColor: Theme["bg-primary"] }]}
191+
cachePolicy="memory-disk"
192+
priority="high"
193+
/>
194+
</ImageBackground>
195+
</QRCode>
196+
<View style={{ flex: 1 }} />
197+
</View>
198+
)}
179199
<CloseButton style={styles.closeButton} onPress={handleOnClosePress} />
180200
</View>
181201
);
@@ -184,6 +204,16 @@ export default function QRModalScreen() {
184204
const styles = StyleSheet.create({
185205
container: {
186206
flex: 1,
207+
},
208+
loadingContainer: {
209+
flex: 1,
210+
alignItems: "center",
211+
justifyContent: "center",
212+
gap: Spacing["spacing-6"],
213+
paddingHorizontal: Spacing["spacing-5"],
214+
},
215+
scanContainer: {
216+
flex: 1,
187217
paddingHorizontal: Spacing["spacing-5"],
188218
paddingVertical: Spacing["spacing-5"],
189219
alignItems: "center",
@@ -222,5 +252,6 @@ const styles = StyleSheet.create({
222252
},
223253
closeButton: {
224254
position: "absolute",
255+
alignSelf: "center",
225256
},
226257
});

dapps/pos-app/app/settings-update-address.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ interface ScreenParams extends UnknownOutputParams {
2222
export default function SettingsUpdateAddress() {
2323
const Theme = useTheme();
2424
const { namespace } = useLocalSearchParams<ScreenParams>();
25-
const { setNetworkAddress, networkAddresses } = useSettingsStore(
25+
const { setNetworkAddress, networkAddresses, themeMode } = useSettingsStore(
2626
(state) => state,
2727
);
2828
const { open, disconnect } = useAppKit();
@@ -80,7 +80,11 @@ export default function SettingsUpdateAddress() {
8080
cachePolicy="memory-disk"
8181
priority="high"
8282
contentFit="contain"
83-
source={require("@/assets/images/reown-logo.png")}
83+
source={
84+
themeMode === "dark"
85+
? require("@/assets/images/reown-logo-white.png")
86+
: require("@/assets/images/reown-logo.png")
87+
}
8488
style={styles.reownLogo}
8589
/>
8690
</Card>
1.43 KB
Loading

0 commit comments

Comments
 (0)