fix: flutter analyze Warnings beheben (totes/unerreichbares Code)

Entfernt tatsächlich toten Code, den flutter analyze als Warning markiert
hatte: unbenutzte Felder/Parameter (_saved, _hovered wird jetzt für Hover-
Feedback genutzt, destructive-Flag ohne Aufrufer, size-Parameter ohne
Override), unerreichbaren dead_code (Room.topic/Space.topic sind laut SDK
nie null, client.database ist nie null) sowie Legacy-Funktionen aus der
alten Push-Architektur (_showNotif/_fetchTitle, ersetzt durch natives
PushService.kt) und einen leeren Noise-Suppression-Stub ohne Aufrufer.
Keine funktionale Verhaltensänderung an aktiven Code-Pfaden.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Bernd Steckmeister
2026-07-03 06:26:31 +02:00
parent 594e6718be
commit 9dc11757e2
9 changed files with 31 additions and 132 deletions
-100
View File
@@ -1,6 +1,4 @@
import 'dart:convert';
import 'dart:io';
import 'dart:isolate';
import 'dart:ui';
import 'package:firebase_messaging/firebase_messaging.dart';
@@ -14,8 +12,6 @@ import 'package:path_provider/path_provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:sqflite/sqflite.dart' as sqflite_native;
const _kChannel = 'pyramid_messages';
/// Port name used to locate the main isolate from background isolates.
/// Registered by notification_service.dart when the app starts.
const kMainIsolateName = 'pyramid_main';
@@ -304,99 +300,3 @@ Future<void> handleBackgroundNotificationResponse(
print('[NOTIF-BG] background reply sent=$sent room=$roomId');
}
// ── Notification builder ──────────────────────────────────────────────────────
Future<void> _showNotif({
required String title,
required String body,
required String? roomId,
required int notifId,
}) async {
final plugin = FlutterLocalNotificationsPlugin();
await plugin.initialize(
const InitializationSettings(
android: AndroidInitializationSettings('@drawable/ic_notification')),
onDidReceiveBackgroundNotificationResponse: handleBackgroundNotificationResponse,
);
await plugin.show(
notifId, title, body,
NotificationDetails(
android: AndroidNotificationDetails(
_kChannel, 'Nachrichten',
channelDescription: 'Neue Nachrichten',
importance: Importance.high,
priority: Priority.high,
icon: '@drawable/ic_notification',
color: const Color(0xFF7B61FF),
groupKey: 'pyramid_messages',
actions: roomId != null
? const [
AndroidNotificationAction(
'reply', 'Antworten',
inputs: [AndroidNotificationActionInput(label: 'Antworten…')],
allowGeneratedReplies: true,
showsUserInterface: false, // BroadcastReceiver path — app never opens
),
AndroidNotificationAction(
'read', 'Gelesen',
showsUserInterface: false,
),
]
: const [],
),
),
payload: roomId,
);
}
// ── HTTP fallback — fetch sender / room name without the SDK ──────────────────
Future<String?> _fetchTitle(
String hs, String token, String roomId, String eventId) async {
try {
final encRoom = Uri.encodeComponent(roomId);
final encEvent = Uri.encodeComponent(eventId);
final rawEvent = await _get(
'$hs/_matrix/client/v3/rooms/$encRoom/event/$encEvent', token);
if (rawEvent == null) return null;
final senderId = rawEvent['sender'] as String? ?? '';
String senderName = senderId.split(':').first.replaceFirst('@', '');
if (senderId.isNotEmpty) {
final encSender = Uri.encodeComponent(senderId);
final memberState = await _get(
'$hs/_matrix/client/v3/rooms/$encRoom/state/m.room.member/$encSender',
token);
final name = memberState?['displayname'] as String?;
if (name != null && name.isNotEmpty) senderName = name;
}
final nameState =
await _get('$hs/_matrix/client/v3/rooms/$encRoom/state/m.room.name', token);
final roomName = nameState?['name'] as String?;
return roomName?.isNotEmpty == true
? '$senderName · $roomName'
: senderName;
} catch (_) {
return null;
}
}
Future<Map<String, dynamic>?> _get(String url, String token) async {
try {
final req = await HttpClient()
.getUrl(Uri.parse(url))
.timeout(const Duration(seconds: 8));
req.headers.add('Authorization', 'Bearer $token');
final res = await req.close();
if (res.statusCode != 200) return null;
final raw = await res.transform(utf8.decoder).join();
return jsonDecode(raw) as Map<String, dynamic>;
} catch (_) {
return null;
}
}
-2
View File
@@ -586,8 +586,6 @@ class LiveKitCallManager with ChangeNotifier {
}
}
void _applyNoiseSuppression(bool enabled) {}
void _startStatsLogging() {
_stopStatsLogging();
_statsTimer = Timer.periodic(const Duration(seconds: 5), (_) => _logStats());