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.
This commit is contained in:
2026-01-18 15:04:43 -05:00
parent a9da086587
commit 48fdf4b99f

View File

@@ -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',
};
}