mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-23 02:36:05 +00:00
feat(share): outline multi platform share functionality
This commit is contained in:
parent
242bc25ac4
commit
9574dd4f19
14 changed files with 1568 additions and 59 deletions
7
electron/electronAPI.d.ts
vendored
7
electron/electronAPI.d.ts
vendored
|
|
@ -70,6 +70,13 @@ export interface ElectronAPI {
|
|||
data: string,
|
||||
): Promise<{ success: boolean; path?: string }>;
|
||||
|
||||
shareNative(payload: {
|
||||
text?: string;
|
||||
url?: string;
|
||||
title?: string;
|
||||
files?: string[];
|
||||
}): Promise<{ success: boolean; error?: string }>;
|
||||
|
||||
isLinux(): boolean;
|
||||
|
||||
isMacOS(): boolean;
|
||||
|
|
|
|||
|
|
@ -79,6 +79,17 @@ export const initIpcInterfaces = (): void => {
|
|||
return { success: false };
|
||||
});
|
||||
|
||||
ipcMain.handle(IPC.SHARE_NATIVE, async (ev, payload) => {
|
||||
// TODO: Implement native share for macOS (NSSharingService) and Windows (WinRT Share UI)
|
||||
// For now, return false to fall back to web-based sharing
|
||||
// Native implementation would require:
|
||||
// - macOS: Swift/Objective-C bridge using NSSharingServicePicker
|
||||
// - Windows: C#/C++ bridge using Windows.ApplicationModel.DataTransfer.DataTransferManager
|
||||
// - Linux: No native share, always use fallback
|
||||
log('Native share requested but not implemented, falling back to web share');
|
||||
return { success: false, error: 'Native share not yet implemented' };
|
||||
});
|
||||
|
||||
ipcMain.on(IPC.LOCK_SCREEN, () => {
|
||||
if ((app as any).isLocked) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -80,6 +80,16 @@ const ea: ElectronAPI = {
|
|||
success: boolean;
|
||||
path?: string;
|
||||
}>,
|
||||
shareNative: (payload: {
|
||||
text?: string;
|
||||
url?: string;
|
||||
title?: string;
|
||||
files?: string[];
|
||||
}) =>
|
||||
_invoke('SHARE_NATIVE', payload) as Promise<{
|
||||
success: boolean;
|
||||
error?: string;
|
||||
}>,
|
||||
scheduleRegisterBeforeClose: (id) => _send('REGISTER_BEFORE_CLOSE', { id }),
|
||||
unscheduleRegisterBeforeClose: (id) => _send('UNREGISTER_BEFORE_CLOSE', { id }),
|
||||
setDoneRegisterBeforeClose: (id) => _send('BEFORE_CLOSE_DONE', { id }),
|
||||
|
|
|
|||
|
|
@ -63,6 +63,8 @@ export enum IPC {
|
|||
|
||||
SAVE_FILE_DIALOG = 'SAVE_FILE_DIALOG',
|
||||
|
||||
SHARE_NATIVE = 'SHARE_NATIVE',
|
||||
|
||||
// Plugin Node Execution
|
||||
PLUGIN_EXEC_NODE_SCRIPT = 'PLUGIN_EXEC_NODE_SCRIPT',
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue