Complete Enhanced Triple Migration Pattern for contact components

- Migrate ContactBulkActions, ContactInputForm, ContactListHeader, ContactListItem, LargeIdenticonModal, and ContactsView to PlatformServiceMixin
- Add comprehensive deep linking support to CapacitorPlatformService and WebPlatformService
- Enhance PlatformService with new database operations and deep link handling
- Update service worker and documentation for migration progress
- Fix TypeScript type errors in util.ts and deepLinks.ts
- Streamline circular dependency analysis and migration tracking docs
This commit is contained in:
Matthew Raymer
2025-07-16 08:41:13 +00:00
parent 8dd73950f5
commit b1ef7fb9ee
15 changed files with 433 additions and 201 deletions

View File

@@ -1305,4 +1305,61 @@ export class CapacitorPlatformService implements PlatformService {
public get isPWAEnabled(): boolean {
return false;
}
// Database utility methods
generateInsertStatement(
model: Record<string, unknown>,
tableName: string,
): { sql: string; params: unknown[] } {
const keys = Object.keys(model);
const placeholders = keys.map(() => "?").join(", ");
const sql = `INSERT INTO ${tableName} (${keys.join(", ")}) VALUES (${placeholders})`;
const params = keys.map((key) => model[key]);
return { sql, params };
}
async updateDefaultSettings(
settings: Record<string, unknown>,
): Promise<void> {
const keys = Object.keys(settings);
const setClause = keys.map((key) => `${key} = ?`).join(", ");
const sql = `UPDATE settings SET ${setClause} WHERE key = 'default'`;
const params = keys.map((key) => settings[key]);
await this.dbExec(sql, params);
}
async insertDidSpecificSettings(did: string): Promise<void> {
await this.dbExec("INSERT INTO settings (key, value) VALUES (?, ?)", [
did,
"{}",
]);
}
async updateDidSpecificSettings(
did: string,
settings: Record<string, unknown>,
): Promise<void> {
const keys = Object.keys(settings);
const setClause = keys.map((key) => `${key} = ?`).join(", ");
const sql = `UPDATE settings SET ${setClause} WHERE key = ?`;
const params = [...keys.map((key) => settings[key]), did];
await this.dbExec(sql, params);
}
async retrieveSettingsForActiveAccount(): Promise<Record<
string,
unknown
> | null> {
const result = await this.dbQuery(
"SELECT value FROM settings WHERE key = 'default'",
);
if (result?.values?.[0]?.[0]) {
try {
return JSON.parse(result.values[0][0] as string);
} catch {
return null;
}
}
return null;
}
}