From 48fdf4b99f126b8de6303805e148a43ee9e0fe18 Mon Sep 17 00:00:00 2001 From: logikonline Date: Sun, 18 Jan 2026 15:04:43 -0500 Subject: [PATCH] feat(context-menu): add notifications for file and commit processing Updates processFiles and analyzeCommit methods to show user notifications when context menu actions are triggered. Also refactors parameter handling to accept contextData objects instead of direct file/commit parameters. --- main/index.js | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) 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', }; }