1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-23 18:53:36 +02:00

Mobile: Resolves #10092: Added empty trash option on long pressing the trash folder (#10120)

This commit is contained in:
Siddhant Paritosh Rao 2024-03-15 00:12:58 +05:30 committed by GitHub
parent 04298f0eba
commit b9eb4522f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -16,6 +16,7 @@ import { reg } from '@joplin/lib/registry';
import { ProfileConfig } from '@joplin/lib/services/profileConfig/types';
import { getTrashFolderIcon, getTrashFolderId } from '@joplin/lib/services/trash';
import restoreItems from '@joplin/lib/services/trash/restoreItems';
import emptyTrash from '@joplin/lib/services/trash/emptyTrash';
import { ModelType } from '@joplin/lib/BaseModel';
const { substrWithEllipsis } = require('@joplin/lib/string-utils');
@ -146,11 +147,30 @@ const SideMenuContentComponent = (props: Props) => {
const folder = folderOrAll as FolderEntity;
if (folder && folder.id === getTrashFolderId()) return;
const menuItems: any[] = [];
if (folder && !!folder.deleted_time) {
if (folder && folder.id === getTrashFolderId()) {
menuItems.push({
text: _('Empty trash'),
onPress: async () => {
Alert.alert('', _('This will permanently delete all items in the trash. Continue?'), [
{
text: _('Empty trash'),
onPress: async () => {
await emptyTrash();
},
},
{
text: _('Cancel'),
onPress: () => { },
style: 'cancel',
},
]);
},
style: 'destructive',
});
} else if (folder && !!folder.deleted_time) {
menuItems.push({
text: _('Restore'),
onPress: async () => {