Merge branch 'master' into build-improvement

This commit is contained in:
Matthew Raymer
2025-08-11 06:42:22 +00:00
12 changed files with 2852 additions and 556 deletions

View File

@@ -54,7 +54,10 @@ messages * - Conditional UI based on platform capabilities * * @component *
<script lang="ts">
import { Component, Prop, Vue } from "vue-facing-decorator";
import * as R from "ramda";
import { AppString, NotificationIface } from "../constants/app";
import { Contact } from "../db/tables/contacts";
import { logger } from "../utils/logger";
import { contactsToExportJson } from "../libs/util";
@@ -175,11 +178,21 @@ export default class DataExportSection extends Vue {
try {
this.isExporting = true;
// Fetch contacts from database using mixin's cached method
const allContacts = await this.$contacts();
// Fetch contacts from database using database utility
const allContacts = await this.$databaseUtil.getContacts();
// Convert contacts to export format
const exportData = contactsToExportJson(allContacts);
const processedContacts: Contact[] = allContacts.map((contact) => {
// first remove the contactMethods field, mostly to cast to a clear type (that will end up with JSON objects)
const exContact: Contact = R.omit(["contactMethods"], contact);
// now add contactMethods as a true array of ContactMethod objects
exContact.contactMethods = contact.contactMethods
? JSON.parse(contact.contactMethods as string)
: undefined;
return exContact;
});
const exportData = contactsToExportJson(processedContacts);
const jsonStr = JSON.stringify(exportData, null, 2);
// Use platform service to handle export (no platform-specific logic here!)