-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for setting an account as active
- Loading branch information
Showing
13 changed files
with
333 additions
and
34 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { useQueryClient } from "@tanstack/react-query"; | ||
import { StatusBar } from "expo-status-bar"; | ||
import { Button, StyleSheet, TextInput, View } from "react-native"; | ||
import { useRouter } from "expo-router"; | ||
import { useState } from "react"; | ||
import { useFacade } from "../../data/facades"; | ||
|
||
export default function OnboardingCreate() { | ||
const router = useRouter(); | ||
const facade = useFacade(); | ||
const qc = useQueryClient(); | ||
|
||
const createAccount = facade.createAccount.useMutation({ | ||
onSuccess: async () => { | ||
await qc.invalidateQueries(); | ||
}, | ||
}); | ||
|
||
const [accountName, setAccountName] = useState("Account Name"); | ||
|
||
return ( | ||
<View style={styles.container}> | ||
<TextInput | ||
placeholder="Account Name" | ||
value={accountName} | ||
onChangeText={setAccountName} | ||
/> | ||
<Button | ||
title="Continue" | ||
onPress={async () => { | ||
await createAccount.mutateAsync({ name: accountName }); | ||
router.dismissAll(); | ||
}} | ||
/> | ||
<StatusBar style="auto" /> | ||
</View> | ||
); | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
backgroundColor: "#fff", | ||
alignItems: "center", | ||
justifyContent: "center", | ||
}, | ||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { useQueryClient } from "@tanstack/react-query"; | ||
import { StatusBar } from "expo-status-bar"; | ||
import { Button, Modal, StyleSheet, Text, TextInput, View } from "react-native"; | ||
import { useRouter } from "expo-router"; | ||
import { useState } from "react"; | ||
import { useFacade } from "../../data/facades"; | ||
|
||
export default function OnboardingImportEncoded() { | ||
const router = useRouter(); | ||
|
||
const [modalVisible, setModalVisible] = useState(false); | ||
const [accountName, setAccountName] = useState("Account Name"); | ||
const [encodedAccount, setEncodedAccount] = useState(""); | ||
|
||
const facade = useFacade(); | ||
const qc = useQueryClient(); | ||
|
||
const importAccount = facade.importAccount.useMutation({ | ||
onSuccess: async () => { | ||
await qc.invalidateQueries(); | ||
}, | ||
}); | ||
|
||
return ( | ||
<View style={styles.container}> | ||
<Modal visible={modalVisible} animationType="slide"> | ||
<View style={styles.container}> | ||
<Text>Account Imported!</Text> | ||
<Text> | ||
Before you start managing your digital assets, we need to scan the | ||
blockchain. This may take some time. | ||
</Text> | ||
<Button | ||
title="Let's go!" | ||
onPress={async () => { | ||
router.dismissAll(); | ||
setModalVisible(false); | ||
}} | ||
/> | ||
</View> | ||
</Modal> | ||
<Text>Paste the complete string into the provided text field below.</Text> | ||
<TextInput | ||
placeholder="Account Name" | ||
value={accountName} | ||
onChangeText={setAccountName} | ||
/> | ||
<TextInput | ||
placeholder="Encoded Key" | ||
value={encodedAccount} | ||
onChangeText={setEncodedAccount} | ||
/> | ||
<Button | ||
title="Continue" | ||
onPress={async () => { | ||
await importAccount.mutateAsync({ | ||
account: encodedAccount, | ||
name: accountName, | ||
}); | ||
setModalVisible(true); | ||
}} | ||
/> | ||
<StatusBar style="auto" /> | ||
</View> | ||
); | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
backgroundColor: "#fff", | ||
alignItems: "center", | ||
justifyContent: "center", | ||
}, | ||
}); |
This file contains 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
This file contains 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
Oops, something went wrong.