@bobfrankston/rmfmail 1.1.33 → 1.1.35

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.
@@ -808,7 +808,36 @@ export class WebMailxService implements MailxApi {
808
808
  async addPreferredContact(_entry: { name: string; email: string; source?: string; organization?: string }): Promise<void> { this.notImpl("addPreferredContact"); }
809
809
  async addToDenylist(_email: string): Promise<void> { this.notImpl("addToDenylist"); }
810
810
  hasBccHistoryTo(_email: string): boolean { return false; }
811
- async loadContactsConfig(): Promise<any> { return null; }
811
+ /** Pull the shared GDrive `contacts.jsonc` and merge its entries into the
812
+ * local contacts table. Desktop flushes the full union there (everything
813
+ * it discovered from its mailbox corpus + Google contacts + preferred);
814
+ * this is how an Android device gets contacts it never saw in its own
815
+ * (partial) on-device corpus. Called once at startup — re-importing on a
816
+ * loop would bump `use_count` every pass and distort autocomplete rank. */
817
+ async loadContactsConfig(): Promise<any> {
818
+ try {
819
+ const { cloudRead } = await import("./web-settings.js");
820
+ const raw = await cloudRead("contacts.jsonc");
821
+ if (!raw) return null;
822
+ const cfg = parseJsoncLoose(raw);
823
+ if (!cfg) return null;
824
+ let imported = 0;
825
+ for (const list of [cfg.preferred, cfg.discovered]) {
826
+ if (!Array.isArray(list)) continue;
827
+ for (const e of list) {
828
+ const email = (e?.email || "").trim();
829
+ if (!email) continue;
830
+ this.db.recordSentAddress((e?.name || "").trim(), email);
831
+ imported++;
832
+ }
833
+ }
834
+ if (imported > 0) console.log(`[contacts] loaded ${imported} from contacts.jsonc`);
835
+ return { imported };
836
+ } catch (e: any) {
837
+ console.error(`[contacts] loadContactsConfig failed: ${e?.message || e}`);
838
+ return null;
839
+ }
840
+ }
812
841
 
813
842
  // Calendar — Android UI has its own native calendar; no JS-side data.
814
843
  async getCalendarEvents(_fromMs: number, _toMs: number): Promise<any[]> { return []; }