You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-23 22:36:32 +02:00
This commit is contained in:
@@ -4,6 +4,8 @@ import { Dispatch } from 'redux';
|
||||
import CommandService from '@joplin/lib/services/CommandService';
|
||||
import Logger from '@joplin/utils/Logger';
|
||||
import { DeviceEventEmitter } from 'react-native';
|
||||
import { GotoNoteOptions } from './commands/util/goToNote';
|
||||
import { AttachFileAction } from './components/screens/Note/commands/attachFile';
|
||||
|
||||
const logger = Logger.create('setupQuickActions');
|
||||
|
||||
@@ -19,9 +21,17 @@ export default async (dispatch: Dispatch) => {
|
||||
return null;
|
||||
}
|
||||
|
||||
// List of iOS icons:
|
||||
// https://github.com/EvanBacon/expo-quick-actions?tab=readme-ov-file#system-icons
|
||||
//
|
||||
// Note: on Android, anything beyond the fourth menu item appears to be ignored, at least on
|
||||
// emulator.
|
||||
QuickActions.setShortcutItems([
|
||||
{ type: 'New note', title: _('New note'), icon: 'Compose', userInfo },
|
||||
{ type: 'New to-do', title: _('New to-do'), icon: 'Add', userInfo },
|
||||
{ type: 'newNote', title: _('New note'), icon: 'Compose', userInfo },
|
||||
{ type: 'newTodo', title: _('New to-do'), icon: 'Add', userInfo },
|
||||
{ type: 'newPhoto', title: _('New photo'), icon: 'CapturePhoto', userInfo },
|
||||
{ type: 'newResource', title: _('New attachment'), icon: 'Bookmark', userInfo },
|
||||
{ type: 'newDrawing', title: _('New drawing'), icon: 'Favorite', userInfo },
|
||||
]);
|
||||
|
||||
try {
|
||||
@@ -50,6 +60,18 @@ const quickActionHandler = (dispatch: Dispatch) => async (data: TData) => {
|
||||
dispatch({ type: 'NAV_BACK' });
|
||||
dispatch({ type: 'SIDE_MENU_CLOSE' });
|
||||
|
||||
const isTodo = data.type === 'New to-do' ? 1 : 0;
|
||||
await CommandService.instance().execute('newNote', '', isTodo);
|
||||
const isTodo = data.type === 'newTodo' ? 1 : 0;
|
||||
const options: GotoNoteOptions = {
|
||||
attachFileAction: null,
|
||||
};
|
||||
|
||||
if (data.type === 'newPhoto') {
|
||||
options.attachFileAction = AttachFileAction.TakePhoto;
|
||||
} else if (data.type === 'newResource') {
|
||||
options.attachFileAction = AttachFileAction.AttachFile;
|
||||
} else if (data.type === 'newDrawing') {
|
||||
options.attachFileAction = AttachFileAction.AttachDrawing;
|
||||
}
|
||||
|
||||
await CommandService.instance().execute('newNote', '', isTodo, options);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user