- Flutter-App (app/) für iOS, Android, macOS, Windows und Linux erstellt - WebView-Startseite mit flutter_inappwebview (iOS/Android/macOS/Windows), Linux-Fallback mit url_launcher - STOMP-over-WebSocket: Topic-basierte Echtzeit-Kommunikation zwischen Flutter-App und Spring Boot Core - Core: STOMP-Broker (/ws/stomp), CallEventBroadcaster auf /topic/calls, StompMessageController für /app/ping und /app/broadcast - SecurityConfig: /ws/** permitAll + CSRF-Ausnahme - Asset-basierte Konfigurationsdatei (app_config.json) für Server-URL, STOMP-Reconnect, Topics und WebView-URL - launch.json um Flutter-Debug/Profile/Release-Konfigurationen erweitert - macOS: FLTEnableMergedPlatformUIThread deaktiviert (WKWebView-Kompatibilität), network.client Entitlement gesetzt - iOS: NSAllowsLocalNetworking für lokale Entwicklung - Android: INTERNET-Permission und usesCleartextTraffic Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
47 lines
1.5 KiB
Dart
47 lines
1.5 KiB
Dart
import 'dart:convert';
|
|
|
|
import 'package:flutter/services.dart' show rootBundle;
|
|
|
|
class AppConfig {
|
|
static const String _assetPath = 'assets/config/app_config.json';
|
|
|
|
final String stompUrl;
|
|
final Duration reconnectDelay;
|
|
final String webviewUrl;
|
|
final String defaultTopic;
|
|
final List<String> topicPresets;
|
|
final String defaultDestination;
|
|
final String defaultPayload;
|
|
|
|
const AppConfig({
|
|
required this.stompUrl,
|
|
required this.reconnectDelay,
|
|
required this.webviewUrl,
|
|
required this.defaultTopic,
|
|
required this.topicPresets,
|
|
required this.defaultDestination,
|
|
required this.defaultPayload,
|
|
});
|
|
|
|
static Future<AppConfig> load() async {
|
|
final raw = await rootBundle.loadString(_assetPath);
|
|
final json = jsonDecode(raw) as Map<String, dynamic>;
|
|
final server = json['server'] as Map<String, dynamic>;
|
|
final topics = json['topics'] as Map<String, dynamic>;
|
|
final send = json['send'] as Map<String, dynamic>;
|
|
|
|
return AppConfig(
|
|
stompUrl: server['stompUrl'] as String,
|
|
reconnectDelay: Duration(
|
|
seconds: (server['reconnectDelaySeconds'] as num).toInt(),
|
|
),
|
|
webviewUrl: server['webviewUrl'] as String,
|
|
defaultTopic: topics['default'] as String,
|
|
topicPresets: (topics['presets'] as List).cast<String>(),
|
|
defaultDestination: send['defaultDestination'] as String,
|
|
defaultPayload:
|
|
const JsonEncoder.withIndent(' ').convert(send['defaultPayload']),
|
|
);
|
|
}
|
|
}
|