@shaxpir/duiduidui-models 1.9.7 → 1.9.8

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.
@@ -16,6 +16,7 @@ interface BaseQueueItem {
16
16
  export interface AudioDownloadQueueItem extends BaseQueueItem {
17
17
  type: 'audio';
18
18
  text: string;
19
+ pronunciation?: string;
19
20
  }
20
21
  export interface ImageDownloadQueueItem extends BaseQueueItem {
21
22
  type: 'image';
@@ -67,8 +68,8 @@ export declare class Device extends Content {
67
68
  addToDownloadQueue(item: AudioDownloadQueueItem | ImageDownloadQueueItem): void;
68
69
  removeFromDownloadQueue(predicate: (item: DownloadQueueItem) => boolean): void;
69
70
  updateDownloadQueueItem(predicate: (item: DownloadQueueItem) => boolean, updates: Partial<BaseQueueItem>): void;
70
- addAudioToDownloadQueue(text: string): void;
71
- removeAudioFromDownloadQueue(text: string): void;
71
+ addAudioToDownloadQueue(text: string, pronunciation?: string): void;
72
+ removeAudioFromDownloadQueue(text: string, pronunciation?: string): void;
72
73
  get uploadQueue(): UploadQueueItem[];
73
74
  get uploadQueueLength(): number;
74
75
  addToUploadQueue(item: UploadQueueItem): void;
@@ -142,7 +142,7 @@ class Device extends Content_1.Content {
142
142
  // Check if item already exists in queue
143
143
  const existingIndex = this._downloadQueueView.values.findIndex(queueItem => {
144
144
  if (queueItem.type === 'audio' && item.type === 'audio') {
145
- return queueItem.text === item.text;
145
+ return queueItem.text === item.text && queueItem.pronunciation === item.pronunciation;
146
146
  }
147
147
  else if (queueItem.type === 'image' && item.type === 'image') {
148
148
  return queueItem.image_id === item.image_id;
@@ -175,17 +175,18 @@ class Device extends Content_1.Content {
175
175
  }
176
176
  }
177
177
  // Convenience methods for audio downloads (backward compatibility)
178
- addAudioToDownloadQueue(text) {
178
+ addAudioToDownloadQueue(text, pronunciation) {
179
179
  const now = shaxpir_common_1.ClockService.getClock().utc();
180
180
  this.addToDownloadQueue({
181
181
  type: 'audio',
182
182
  text,
183
+ ...(pronunciation && { pronunciation }),
183
184
  added_at: now,
184
185
  retry_count: 0
185
186
  });
186
187
  }
187
- removeAudioFromDownloadQueue(text) {
188
- this.removeFromDownloadQueue(item => item.type === 'audio' && item.text === text);
188
+ removeAudioFromDownloadQueue(text, pronunciation) {
189
+ this.removeFromDownloadQueue(item => item.type === 'audio' && item.text === text && item.pronunciation === pronunciation);
189
190
  }
190
191
  // Upload Queue Methods
191
192
  get uploadQueue() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shaxpir/duiduidui-models",
3
- "version": "1.9.7",
3
+ "version": "1.9.8",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/shaxpir/duiduidui-models"