diff --git a/main/index.js b/main/index.js index 8ff557e..6bd6177 100644 --- a/main/index.js +++ b/main/index.js @@ -362,12 +362,22 @@ class MyFirstAddon { /** * Process selected files from context menu. */ - async processFiles(files) { + async processFiles(contextData) { + const files = contextData?.files || []; this.context?.log.info('Processing files:', files); + // Show notification to demonstrate the context menu is working + const fileCount = files.length; + const fileList = files.map(f => f.path).join(', '); + + this.context?.ipc.send('show-notification', { + title: 'Process with My Addon', + body: `Processing ${fileCount} file(s): ${fileList}`, + }); + // Example file processing const results = []; - for (const file of files || []) { + for (const file of files) { results.push({ path: file.path, status: file.status, @@ -381,11 +391,19 @@ class MyFirstAddon { /** * Analyze a commit from context menu. */ - async analyzeCommit(commit) { + async analyzeCommit(contextData) { + const commit = contextData?.commit; this.context?.log.info('Analyzing commit:', commit?.sha); + // Show notification to demonstrate the context menu is working + this.context?.ipc.send('show-notification', { + title: 'Analyze Commit', + body: `Analyzing commit: ${commit?.sha?.substring(0, 7) || 'unknown'}\n${commit?.summary || ''}`, + }); + return { sha: commit?.sha, + summary: commit?.summary, analysis: 'This is a demo analysis result', }; }