fix: Bug - Add logout in mobile version of settings, allow clearing data on android
All checks were successful
Queue Release Build / prepare (push) Successful in 19s
Deploy Web Apps / deploy (push) Successful in 7m55s
Queue Release Build / build-windows (push) Successful in 28m37s
Queue Release Build / build-linux (push) Successful in 47m3s
Queue Release Build / build-android (push) Successful in 20m33s
Queue Release Build / finalize (push) Successful in 3m48s

Expose settings logout on mobile where the title bar is hidden, and enable
Capacitor data settings with storage visibility and local erase/sign-out.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-11 22:31:40 +02:00
parent cb59af6b6c
commit 07e91a0d09
20 changed files with 553 additions and 39 deletions

View File

@@ -0,0 +1,54 @@
import { Injectable, inject } from '@angular/core';
import { PlatformService } from '../../core/platform';
import { clearStoredLocalAppData } from '../../core/storage/current-user-storage';
import { DatabaseService } from './database.service';
import { UserLogoutService } from '../../domains/authentication/application/services/user-logout.service';
import { AuthTokenStoreService } from '../../domains/authentication/application/services/auth-token-store.service';
import { loadCapacitorAttachmentFilesystem } from '../../domains/attachment/infrastructure/services/capacitor-attachment-filesystem.adapter';
const CAPACITOR_APP_DATA_ROOT = 'metoyou';
export interface EraseLocalUserDataResult {
restartRequired: boolean;
}
@Injectable({ providedIn: 'root' })
export class LocalUserDataService {
private readonly platform = inject(PlatformService);
private readonly database = inject(DatabaseService);
private readonly userLogout = inject(UserLogoutService);
private readonly authTokenStore = inject(AuthTokenStoreService);
async eraseLocalUserData(): Promise<EraseLocalUserDataResult> {
if (!this.platform.isCapacitor) {
throw new Error('Local user data erase is only supported on native mobile shells.');
}
await this.database.clearAllData();
await this.deleteCapacitorAttachmentTree();
this.authTokenStore.clearAllTokens();
clearStoredLocalAppData();
this.userLogout.logout();
return { restartRequired: false };
}
private async deleteCapacitorAttachmentTree(): Promise<void> {
const filesystem = await loadCapacitorAttachmentFilesystem();
if (!filesystem) {
return;
}
try {
await filesystem.filesystem.rmdir({
path: CAPACITOR_APP_DATA_ROOT,
directory: filesystem.directory,
recursive: true
});
} catch {
// Missing directory is fine during erase.
}
}
}