mirror of
https://github.com/balzack/databag.git
synced 2025-02-12 03:29:16 +00:00
adding delete account modal to new settings screen
This commit is contained in:
parent
e87a5b86fb
commit
bcbdfeb963
@ -189,7 +189,7 @@ export function Settings() {
|
|||||||
<View style={styles.control} />
|
<View style={styles.control} />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
<View style={styles.divider} />
|
<View style={styles.divider} />
|
||||||
<TouchableOpacity style={styles.entry} activeOpacity={1}>
|
<TouchableOpacity style={styles.entry} activeOpacity={1} onPress={actions.showDelete}>
|
||||||
<View style={styles.icon}>
|
<View style={styles.icon}>
|
||||||
<MatIcons name="trash-can-outline" size={20} color={Colors.dangerText} />
|
<MatIcons name="trash-can-outline" size={20} color={Colors.dangerText} />
|
||||||
</View>
|
</View>
|
||||||
@ -543,6 +543,42 @@ export function Settings() {
|
|||||||
</View>
|
</View>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
|
<Modal
|
||||||
|
animationType="fade"
|
||||||
|
transparent={true}
|
||||||
|
visible={state.delete}
|
||||||
|
supportedOrientations={['portrait', 'landscape']}
|
||||||
|
onRequestClose={actions.hideDelete}
|
||||||
|
>
|
||||||
|
<View style={styles.modalOverlay}>
|
||||||
|
<View style={styles.modalContainer}>
|
||||||
|
<View style={styles.modalClose}>
|
||||||
|
<TouchableOpacity style={styles.closeButton} activeOpacity={1} onPress={actions.hideDelete}>
|
||||||
|
<MatIcons name="close" size={20} color={Colors.descriptionText} />
|
||||||
|
</TouchableOpacity>
|
||||||
|
</View>
|
||||||
|
<Text style={styles.modalHeader}>{ state.strings.deleteAccount }</Text>
|
||||||
|
<ActivityIndicator style={styles.modalBusy} animating={busy} color={Colors.primary} />
|
||||||
|
|
||||||
|
<View style={styles.modalInput}>
|
||||||
|
<TextInput style={styles.inputText} value={state.sealDelete} onChangeText={actions.setSealDelete}
|
||||||
|
autoCapitalize={'none'} placeholder={state.strings.typeDelete}
|
||||||
|
placeholderTextColor={Colors.inputPlaceholder} />
|
||||||
|
</View>
|
||||||
|
{ state.sealDelete === state.strings.deleteKey && (
|
||||||
|
<TouchableOpacity style={styles.dangerButton} activeOpacity={1} onPress={() => sealAction(actions.removeKey, 'Remove')}>
|
||||||
|
<Text style={styles.dangerButtonText}>{ state.strings.delete }</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
)}
|
||||||
|
{ state.sealDelete !== state.strings.deleteKey && (
|
||||||
|
<View style={styles.disabledButton}>
|
||||||
|
<Text style={styles.disabledButtonText}>{ state.strings.delete }</Text>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
);
|
);
|
||||||
|
@ -26,6 +26,7 @@ export function useSettings() {
|
|||||||
available: true,
|
available: true,
|
||||||
password: null,
|
password: null,
|
||||||
confirm: null,
|
confirm: null,
|
||||||
|
delete: null,
|
||||||
|
|
||||||
logout: false,
|
logout: false,
|
||||||
editSeal: false,
|
editSeal: false,
|
||||||
@ -106,13 +107,18 @@ export function useSettings() {
|
|||||||
clearTimeout(debounce.current);
|
clearTimeout(debounce.current);
|
||||||
checking.current = username;
|
checking.current = username;
|
||||||
updateState({ username, validated: false });
|
updateState({ username, validated: false });
|
||||||
debounce.current = setTimeout(async () => {
|
if (state.handle === username) {
|
||||||
const cur = JSON.parse(JSON.stringify(username));
|
updateState({ available: true, validated: true });
|
||||||
const available = await profile.actions.getHandleStatus(cur);
|
}
|
||||||
if (checking.current === cur) {
|
else {
|
||||||
updateState({ available, validated: true });
|
debounce.current = setTimeout(async () => {
|
||||||
}
|
const cur = JSON.parse(JSON.stringify(username));
|
||||||
}, 1000);
|
const available = await profile.actions.getHandleStatus(cur);
|
||||||
|
if (checking.current === cur) {
|
||||||
|
updateState({ available, validated: true });
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
setPassword: (password) => {
|
setPassword: (password) => {
|
||||||
updateState({ password });
|
updateState({ password });
|
||||||
@ -123,6 +129,12 @@ export function useSettings() {
|
|||||||
logout: async () => {
|
logout: async () => {
|
||||||
await app.actions.logout();
|
await app.actions.logout();
|
||||||
},
|
},
|
||||||
|
showDelete: () => {
|
||||||
|
updateState({ delete: true });
|
||||||
|
},
|
||||||
|
hideDelete: () => {
|
||||||
|
updateState({ delete: false });
|
||||||
|
},
|
||||||
showLogout: () => {
|
showLogout: () => {
|
||||||
updateState({ logout: true });
|
updateState({ logout: true });
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user