124 lines
6.3 KiB
Markdown
124 lines
6.3 KiB
Markdown
# Settings und Konfiguration für die Tenant Admin App
|
||
|
||
## Status
|
||
- **Version**: 1.0.0 (2025-09-13)
|
||
- **Fokus**: App-interne und tenant-spezifische Einstellungen; Integration mit Capacitor-Plugins.
|
||
|
||
## App-interne Settings
|
||
Diese Settings werden lokal in der App gespeichert (via Capacitor Preferences oder IndexedDB) und beeinflussen das Verhalten der App:
|
||
|
||
### Core App Settings
|
||
- **language**: String (default: 'de') – UI-Sprache; Sync mit User-Profile und i18next (react-i18next); Fallback 'en'; URL-Prefix (/de/, /en/) für persistente Wechsel.
|
||
- **themeMode**: String ('system' | 'light' | 'dark') – Dark Mode-Präferenz; Framework7-Theming.
|
||
- **offlineMode**: Boolean (default: true) – Aktiviert Offline-Caching und Background-Sync.
|
||
- **pushNotifications**: Boolean (default: true) – Erlaubt Push-Registrierung.
|
||
- **autoSyncInterval**: Number (default: 300) – Sekunden bis automatischer Sync (min: 60).
|
||
- **maxPhotoCache**: Number (default: 100) – Anzahl gecachter Photos pro Event.
|
||
|
||
### User-spezifische Settings
|
||
- **notificationPreferences**: Object
|
||
- `newPhotos`: Boolean – Benachrichtigung bei neuen Uploads.
|
||
- `eventUpdates`: Boolean – Bei Event-Änderungen (z.B. Veröffentlicht).
|
||
- `lowCredits`: Boolean – Warnung bei < 2 Credits.
|
||
- **privacySettings**: Object
|
||
- `shareAnalytics`: Boolean (default: false) – Anonyme Stats teilen.
|
||
- `dataRetention`: Number (default: 30) – Tage bis Auto-Delete von Cache.
|
||
|
||
**Speicherung**: Capacitor Preferences API (`@capacitor/preferences`) für sichere, persistente Speicherung. Bei Web-Fallback: localStorage mit Encryption (via Crypto API).
|
||
|
||
## Tenant-spezifische Optionen
|
||
Diese werden über API (`GET/PATCH /tenant/settings`) geladen und überschreiben globale Defaults. Sie definieren das Verhalten für den Tenant und seine Events:
|
||
|
||
### Theme & Branding
|
||
- **primaryColor**: String (default: '#007AFF') – Hauptfarbe (iOS-Blau); verwendet in Framework7 CSS-Vars (`--f7-primary`).
|
||
- **secondaryColor**: String (default: '#5856D6') – Sekundärfarbe für Buttons/Accents.
|
||
- **logoUrl**: String – Custom Logo für App-Banner (URL zu S3/CDN).
|
||
- **tenantName**: String – Anzeigename (z.B. "Müller Hochzeit"); in Dashboard-Banner.
|
||
|
||
### Event Limits & Features
|
||
- **maxEventsPerMonth**: Number (default: 5) – Limit pro Monat (enforced via Credits).
|
||
- **maxPhotosPerEvent**: Number (default: 1000) – Soft-Limit; Warnung bei Überschreitung.
|
||
- **enableTasks**: Boolean (default: true) – Tasks-System aktivieren.
|
||
- **enableEmotions**: Boolean (default: true) – Emotions/Reactions erlauben.
|
||
- **autoApprovePhotos**: Boolean (default: false) – Neue Uploads sofort freigeben (Risiko: Spam).
|
||
|
||
### Legal & Compliance
|
||
- **legalPages**: Object (von Backend geladen, siehe docs/prp/02-tenancy.md)
|
||
- `impressumUrl`: String – Pflicht in DE; Customizable Link.
|
||
- `privacyUrl`: String – Datenschutzerklärung.
|
||
- `agbUrl`: String – Allgemeine Geschäftsbedingungen.
|
||
- **gdprRetentionDays**: Number (default: 30) – Automatische Löschung alter Photos/Events.
|
||
- **contactEmail**: String – Support-Email für In-App-Feedback.
|
||
|
||
### Notifications & Integration
|
||
- **pushEnabled**: Boolean – Tenant-weit Push aktivieren (erfordert Plugin-Registrierung).
|
||
- **stripePublicKey**: String – Für Client-side Checkout (aus Env, nicht persistent).
|
||
- **eventJoinDomain**: String (default: 'events.fotospiel.app') – Custom Domain für Guest-PWA.
|
||
|
||
**API-Handling**: Laden bei Login; Cache mit ETag; Update triggert UI-Refresh (z.B. Theme-Wechsel). Validation: Backend enforct Limits (z.B. Colors als HEX).
|
||
|
||
## Capacitor-Plugins
|
||
Die App integriert folgende Plugins für native Features. Installation via `npx cap add` und Sync nach Build.
|
||
|
||
### Essentielle Plugins
|
||
1. **@capacitor/preferences** (v6+)
|
||
- **Zweck**: Sichere Speicherung von App- und User-Settings.
|
||
- **Usage**: `Preferences.set({ key: 'themeMode', value: 'dark' })`; Migrate von localStorage.
|
||
- **iOS/Android**: Keychain/Keystore für Encryption.
|
||
|
||
2. **@capacitor/push-notifications** (v6+)
|
||
- **Zweck**: Native Push für neue Photos, Event-Updates, Low-Credits.
|
||
- **Setup**: Registrierung bei App-Start (`PushNotifications.register()`); Token an Backend senden (`POST /tenant/devices`).
|
||
- **Events**: `registrationToken` (senden), `pushNotificationReceived` (In-App-Handling), `pushNotificationActionPerformed` (Tap-Actions).
|
||
- **Permissions**: Request bei erstem Login; Fallback zu Web Push in PWA/TWA.
|
||
|
||
3. **@capacitor/storage** (v6+)
|
||
- **Zweck**: Offline-Caching von Events/Photos (als Alternative zu IndexedDB).
|
||
- **Usage**: `Storage.set({ key: 'event-123', value: JSON.stringify(data) })`; Size-Limit beachten (50MB).
|
||
- **Fallback**: Für Web; Sync mit Background-Sync.
|
||
|
||
4. **@capacitor/camera** (v6+)
|
||
- **Zweck**: Direkte Kamera-Zugriff für Event-QR-Scans oder schnelle Photo-Uploads (Admin-Selfies).
|
||
- **Usage**: `Camera.getPhoto({ quality: 90, allowEditing: true })`; Upload via signed URL.
|
||
- **Permissions**: Camera/Mic; Privacy-Manifest für App Store.
|
||
|
||
5. **@capacitor/network** (v6+)
|
||
- **Zweck**: Connectivity-Status überwachen; Offline-Modus triggern.
|
||
- **Usage**: `Network.addListener('networkStatusChange', handleOffline)`; UI-Update bei 'offline'.
|
||
- **Integration**: Deaktiviere Sync-Buttons; Zeige Cached-Data.
|
||
|
||
### Optionale Plugins
|
||
- **@capacitor/haptics** (v6+): Vibration-Feedback bei Actions (z.B. Photo-Approve).
|
||
- **@capacitor/share** (v6+): Teilen von Event-QR-Codes via Native Share-Sheet.
|
||
- **@capacitor/device** (v6+): Geräte-Info (Model, OS) für Analytics; Token zu Backend.
|
||
|
||
### Plugin-Konfiguration (capacitor.config.ts)
|
||
```typescript
|
||
import { CapacitorConfig } from '@capacitor/cli';
|
||
|
||
const config: CapacitorConfig = {
|
||
appId: 'com.fotospiel.tenantadmin',
|
||
appName: 'Event Photo Admin',
|
||
webDir: 'dist',
|
||
bundledWebRuntime: false,
|
||
plugins: {
|
||
PushNotifications: {
|
||
presentationOptions: ["badge", "sound", "alert"]
|
||
},
|
||
Camera: {
|
||
permissions: {
|
||
camera: true
|
||
}
|
||
}
|
||
}
|
||
};
|
||
|
||
export default config;
|
||
```
|
||
|
||
### Security & Privacy
|
||
- **Plugin-Permissions**: Explizite Requests; Erkläre Zweck im Onboarding (z.B. "Push für neue Photos").
|
||
- **Data Storage**: Kein PII in Preferences; Tokens encrypted (siehe Auth-Specs).
|
||
- **App Store Compliance**: Privacy Manifest mit Usage-Descriptions (z.B. NSPhotoLibraryUsageDescription).
|
||
|
||
Für detailliertes Packaging siehe capacitor-setup.md; UI-Integration in pages-ui.md. |