mirror of
https://github.com/balzack/databag.git
synced 2025-02-14 20:49:16 +00:00
Merge branch 'e2e' of https://github.com/balzack/databag into e2e
This commit is contained in:
commit
c991a70775
@ -78,7 +78,9 @@ export function useAppContext() {
|
|||||||
{ event: 'contact.addCard', messageTitle: 'New Contact Request' },
|
{ event: 'contact.addCard', messageTitle: 'New Contact Request' },
|
||||||
{ event: 'contact.updateCard', messageTitle: 'Contact Update' },
|
{ event: 'contact.updateCard', messageTitle: 'Contact Update' },
|
||||||
{ event: 'content.addChannel.superbasic', messageTitle: 'New Topic' },
|
{ event: 'content.addChannel.superbasic', messageTitle: 'New Topic' },
|
||||||
|
{ event: 'content.addChannel.sealed', messageTitle: 'New Topic' },
|
||||||
{ event: 'content.addChannelTopic.superbasic', messageTitle: 'New Topic Message' },
|
{ event: 'content.addChannelTopic.superbasic', messageTitle: 'New Topic Message' },
|
||||||
|
{ event: 'content.addChannelTopic.sealedtopic', messageTitle: 'New Topic Message' },
|
||||||
];
|
];
|
||||||
|
|
||||||
const actions = {
|
const actions = {
|
||||||
|
@ -380,11 +380,16 @@ export function ProfileBody({ navigation }) {
|
|||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
{ state.canSaveSeal && (
|
{ state.canSaveSeal && (
|
||||||
<>
|
<>
|
||||||
{ state.sealMode !== 'unlocking' && (
|
{ state.sealMode !== 'unlocking' && state.sealMode !== 'unlocked' && (
|
||||||
<TouchableOpacity style={styles.save} onPress={saveSeal}>
|
<TouchableOpacity style={styles.save} onPress={saveSeal}>
|
||||||
<Text style={styles.saveText}>Save</Text>
|
<Text style={styles.saveText}>Save</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
)}
|
)}
|
||||||
|
{ state.sealMode === 'unlocked' && (
|
||||||
|
<TouchableOpacity style={styles.save} onPress={saveSeal}>
|
||||||
|
<Text style={styles.saveText}>Forget</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
)}
|
||||||
{ state.sealMode === 'unlocking' && (
|
{ state.sealMode === 'unlocking' && (
|
||||||
<TouchableOpacity style={styles.save} onPress={saveSeal}>
|
<TouchableOpacity style={styles.save} onPress={saveSeal}>
|
||||||
<Text style={styles.saveText}>Unlock</Text>
|
<Text style={styles.saveText}>Unlock</Text>
|
||||||
|
@ -175,6 +175,10 @@ export function useProfileBody() {
|
|||||||
await account.actions.unlockAccountSeal(sealKey);
|
await account.actions.unlockAccountSeal(sealKey);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const sealForget = async () => {
|
||||||
|
await account.actions.unlockAccountSeal({});
|
||||||
|
}
|
||||||
|
|
||||||
const sealUpdate = async () => {
|
const sealUpdate = async () => {
|
||||||
// generate key to encrypt private key
|
// generate key to encrypt private key
|
||||||
const salt = CryptoJS.lib.WordArray.random(128 / 8);
|
const salt = CryptoJS.lib.WordArray.random(128 / 8);
|
||||||
@ -199,6 +203,9 @@ export function useProfileBody() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (state.sealMode === 'unlocked') {
|
||||||
|
return updateState({ canSaveSeal: true });
|
||||||
|
}
|
||||||
if (state.sealMode === 'unlocking' && state.sealUnlock != null && state.sealUnlock !== '') {
|
if (state.sealMode === 'unlocking' && state.sealUnlock != null && state.sealUnlock !== '') {
|
||||||
return updateState({ canSaveSeal: true });
|
return updateState({ canSaveSeal: true });
|
||||||
}
|
}
|
||||||
@ -265,6 +272,9 @@ export function useProfileBody() {
|
|||||||
else if (state.sealMode === 'unlocking') {
|
else if (state.sealMode === 'unlocking') {
|
||||||
await sealUnlock();
|
await sealUnlock();
|
||||||
}
|
}
|
||||||
|
else if (state.sealMode === 'unlocked') {
|
||||||
|
await sealForget();
|
||||||
|
}
|
||||||
else if (state.sealMode === 'updating') {
|
else if (state.sealMode === 'updating') {
|
||||||
await sealUpdate();
|
await sealUpdate();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user