do not allow deleting locked note directly

This commit is contained in:
ammarahm-ed
2021-01-01 15:43:41 +05:00
parent 8ed0959240
commit d718763cf0
2 changed files with 18 additions and 6 deletions

View File

@@ -39,7 +39,7 @@ import {
import {deleteItems} from '../../utils/functions';
import {MMKV} from '../../utils/mmkv';
import {opacity, pv, SIZE} from '../../utils/SizeUtils';
import {timeConverter} from '../../utils/TimeUtils';
import {sleep, timeConverter} from '../../utils/TimeUtils';
import {PremiumTag} from '../Premium/PremiumTag';
import {PressableButton} from '../PressableButton';
import {Toast} from '../Toast';
@@ -176,11 +176,22 @@ export const ActionSheetComponent = ({
name: 'Delete',
icon: 'delete',
func: async () => {
if (note.locked) {
close();
await sleep(300);
openVault({
deleteNote: true,
novault: true,
locked: true,
item: note,
});
} else {
try {
await deleteItems(note);
} catch (e) {
console.log(e);
}
}
close();
},
},

View File

@@ -676,8 +676,9 @@ export class VaultDialog extends Component {
: 'Lock'
}
/>
<Toast context="local" />
</View>
<Toast context="local" />
</BaseDialog>
);
}