whatsapp-pi 1.0.38 → 1.0.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/ui/menu.handler.ts +9 -11
package/package.json
CHANGED
package/src/ui/menu.handler.ts
CHANGED
|
@@ -3,9 +3,11 @@ import { SessionManager, type Contact } from '../services/session.manager.js';
|
|
|
3
3
|
import { validatePhoneNumber, type RecentConversationSummary } from '../models/whatsapp.types.js';
|
|
4
4
|
import { RecentsService } from '../services/recents.service.js';
|
|
5
5
|
import * as qrcode from 'qrcode-terminal';
|
|
6
|
-
import {
|
|
6
|
+
import type { ExtensionCommandContext } from '@mariozechner/pi-coding-agent';
|
|
7
7
|
|
|
8
8
|
export class MenuHandler {
|
|
9
|
+
private readonly printedAllowedNumbers: string[] = [];
|
|
10
|
+
|
|
9
11
|
constructor(
|
|
10
12
|
private readonly whatsappService: WhatsAppService,
|
|
11
13
|
private readonly sessionManager: SessionManager,
|
|
@@ -107,7 +109,7 @@ export class MenuHandler {
|
|
|
107
109
|
|
|
108
110
|
private async manageAllowedContact(ctx: ExtensionCommandContext, contact: Contact) {
|
|
109
111
|
const displayName = this.formatAllowedContactOption(contact);
|
|
110
|
-
const options = ['Send Message', '
|
|
112
|
+
const options = ['Send Message', 'Print Number', 'History'];
|
|
111
113
|
if (contact.name) {
|
|
112
114
|
options.push('Remove Alias');
|
|
113
115
|
} else {
|
|
@@ -129,8 +131,8 @@ export class MenuHandler {
|
|
|
129
131
|
return;
|
|
130
132
|
}
|
|
131
133
|
|
|
132
|
-
if (choice === '
|
|
133
|
-
|
|
134
|
+
if (choice === 'Print Number') {
|
|
135
|
+
this.printAllowedNumber(ctx, contact.number);
|
|
134
136
|
await this.manageAllowedContact(ctx, contact);
|
|
135
137
|
return;
|
|
136
138
|
}
|
|
@@ -171,13 +173,9 @@ export class MenuHandler {
|
|
|
171
173
|
await this.manageAllowList(ctx);
|
|
172
174
|
}
|
|
173
175
|
|
|
174
|
-
private
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
ctx.ui.notify(`Copied ${contact.number} to clipboard`, 'info');
|
|
178
|
-
} catch {
|
|
179
|
-
ctx.ui.notify(`Failed to copy ${contact.number} to clipboard`, 'error');
|
|
180
|
-
}
|
|
176
|
+
private printAllowedNumber(ctx: ExtensionCommandContext, number: string) {
|
|
177
|
+
this.printedAllowedNumbers.push(number);
|
|
178
|
+
ctx.ui.notify(this.printedAllowedNumbers.join('\n'), 'info');
|
|
181
179
|
}
|
|
182
180
|
|
|
183
181
|
private async manageBlockList(ctx: ExtensionCommandContext) {
|