Skip to content

Commit b83246c

Browse files
authored
Style the bridge transaction confirmation (#145)
1 parent 893eda6 commit b83246c

File tree

6 files changed

+379
-108
lines changed

6 files changed

+379
-108
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ Targets can be defined in the `package.json` or `projects.json`. Learn more [in
4545

4646
### New Build
4747

48+
- Update the Version and Build numbers in `app.json`. If you're pushing an update, you'll probably just want to increment the build.
49+
4850
```shell
4951
nx prebuild mobile-app -- --platform ios
5052
nx cargo-ios ironfish-native-module -- --target='ios'
@@ -61,7 +63,8 @@ open .
6163
- Double Click "mobileapp"
6264
- Signing & Capabilities tab
6365
- Under signing select "IF Labs" for team (must be added to team in App Store Connect, ask Derek)
64-
- Bundle identifier should be prepopulated but should read "com.ironfish.mobileapp"
66+
- Bundle identifier should be prepopulated but should read "network.ironfish.mobilewallet"
67+
- Double-check Version and Build numbers match those in `app.json`.
6568
- In the scheme bar (top center of editor), select Any iOS Device (arm64)
6669
- Mac menu bar - click Product -> Archive, wait for build (might take a minute or two)
6770
- Click Distribute App button in popup

packages/mobile-app/app.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
"ios": {
1717
"icon": "./assets/icon.png",
1818
"bundleIdentifier": "network.ironfish.mobilewallet",
19+
"appleTeamId": "9WR79D873L",
20+
"buildNumber": "2",
1921
"infoPlist": {
2022
"NSAppTransportSecurity": {
2123
"NSAllowsArbitraryLoads": false,

packages/mobile-app/app/(drawer)/account/bridge/index.tsx

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { StyleSheet, View } from "react-native";
33
import { Button, Card, Layout, Text } from "@ui-kitten/components";
44
import { oreoWallet } from "@/data/wallet/oreowalletWallet";
55
import { Network } from "@/data/constants";
6-
import { useCallback, useRef, useState } from "react";
6+
import { useCallback, useEffect, useRef, useState } from "react";
77
import * as Uint8ArrayUtils from "@/utils/uint8Array";
88
import { useFacade } from "@/data/facades";
99
import { Output } from "@/data/facades/wallet/types";
@@ -219,15 +219,13 @@ export default function MenuDebugBrowser() {
219219
},
220220
);
221221

222-
const handlePresentModalPress = useCallback(() => {
223-
bottomSheetModalRef.current?.present();
224-
setAccountModalVisible(true);
225-
}, []);
226-
227-
const handleDismissModalPress = useCallback(() => {
228-
bottomSheetModalRef.current?.dismiss();
229-
setAccountModalVisible(false);
230-
}, []);
222+
useEffect(() => {
223+
if (accountModalVisible) {
224+
bottomSheetModalRef.current?.present();
225+
} else {
226+
bottomSheetModalRef.current?.dismiss();
227+
}
228+
}, [accountModalVisible]);
231229

232230
const renderBackdrop = useCallback(
233231
(props: any) => (
@@ -379,7 +377,10 @@ export default function MenuDebugBrowser() {
379377
enablePanDownToClose
380378
backdropComponent={renderBackdrop}
381379
onDismiss={() => {
382-
messageHandler.current.updateActiveAccount(null);
380+
if (messageHandler.current.connectRequest) {
381+
messageHandler.current.connectRequest.resolve(null);
382+
messageHandler.current.connectRequest = null;
383+
}
383384
setAccountModalVisible(false);
384385
}}
385386
backgroundStyle={styles.bottomSheetModal}
@@ -391,7 +392,7 @@ export default function MenuDebugBrowser() {
391392
style={{ width: 48, height: 48 }}
392393
/>
393394
<Layout style={{ gap: 2 }}>
394-
<Text category="h5">Iron Fish Bridge</Text>
395+
<Text category="h5">Connect Account</Text>
395396
<Text category="s2" appearance="hint">
396397
{network}
397398
</Text>
@@ -412,34 +413,36 @@ export default function MenuDebugBrowser() {
412413
>
413414
<Button
414415
onPress={() => {
416+
messageHandler.current.updateActiveAccount(null);
417+
setAccountModalVisible(false);
418+
}}
419+
style={{ flex: 1 }}
420+
appearance="outline"
421+
>
422+
Cancel
423+
</Button>
424+
<Button
425+
onPress={async () => {
415426
if (!account.data) {
416427
console.error("No account loaded");
417428
return;
418429
}
419-
messageHandler.current.updateActiveAccount({
430+
await messageHandler.current.updateActiveAccount({
420431
name: account.data.name,
421432
address: account.data.publicAddress,
422433
});
423-
handleDismissModalPress();
434+
setAccountModalVisible(false);
424435
}}
425436
style={{ flex: 1 }}
426437
>
427438
Confirm
428439
</Button>
429-
<Button
430-
onPress={() => {
431-
messageHandler.current.updateActiveAccount(null);
432-
handleDismissModalPress();
433-
}}
434-
style={{ flex: 1 }}
435-
appearance="outline"
436-
>
437-
Cancel
438-
</Button>
439440
</Layout>
440441
</BottomSheetView>
441442
</BottomSheetModal>
442443
<SendTransactionModal
444+
network={network}
445+
renderBackdrop={renderBackdrop}
443446
sendTransactionData={sendTransactionData}
444447
cancel={() => {
445448
messageHandler.current.rejectSendTransactionRequest();
@@ -457,7 +460,7 @@ export default function MenuDebugBrowser() {
457460
onMessage={(event) => {
458461
messageHandler.current.handleMessage(
459462
event.nativeEvent.data,
460-
handlePresentModalPress,
463+
() => setAccountModalVisible(true),
461464
(data) => {
462465
setSendTransactionData(data);
463466
},

packages/mobile-app/app/(drawer)/account/transaction/[hash].tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@ export default function TransactionDetails() {
6565
},
6666
);
6767

68+
const explorer = facade.getExplorerUrl.useQuery(
69+
{
70+
type: "transaction",
71+
hash: hash,
72+
},
73+
{
74+
enabled: !!hash,
75+
},
76+
);
77+
6878
// Get assets for all balance deltas
6979
const assetQueries = useQueries({
7080
queries:
@@ -76,7 +86,8 @@ export default function TransactionDetails() {
7686
});
7787

7888
const openInExplorer = () => {
79-
Linking.openURL(`https://explorer.ironfish.network/transaction/${hash}`);
89+
if (!explorer.data) return;
90+
Linking.openURL(explorer.data);
8091
};
8192

8293
if (transactionQuery.isLoading || assetQueries.some((q) => q.isLoading)) {

0 commit comments

Comments
 (0)