feat: web push notifications, image fullscreen, public room browser

- Web Push: push_sw.js service worker + VAPID subscription registered
  on login; Matrix pusher registered pointing to Sygnal on
  https://matrix.m8chat.au/_matrix/push/v1/notify
- Chat: tap image -> fullscreen InteractiveViewer (pinch/zoom)
- Rooms: public room browser via Matrix room directory (FAB + empty state)

Build fixes applied to web_push_service.dart:
  - dart:js_interop_unsafe import added for getProperty on JSObject
  - client.setPusher -> client.postPusher (matrix 0.33.0 API)
  - keyBytes.toJS removed (JSUint8Array already a JS type)
  - register() script URL coerced with .toJS (String -> JSAny)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-27 06:48:48 +10:00
parent 542a5e5221
commit 1cffe09faf
5 changed files with 262 additions and 3 deletions

View File

@@ -1,12 +1,15 @@
// Version: 1.1.0 | Created: 2026-04-01 | Updated: 2026-04-10
// Version: 1.2.0 | Created: 2026-04-01 | Updated: 2026-04-27
// Application entry point.
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:olm/olm.dart' as olm;
import 'app/app.dart';
import 'core/push/web_push_service.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
@@ -19,6 +22,12 @@ void main() async {
debugPrint('[M8Chat] Olm NOT available: $e');
}
// Register the push service worker at startup so the browser knows about it.
// The actual push subscription happens after login (in auth_notifier.dart).
if (kIsWeb) {
unawaited(registerPushServiceWorker());
}
// Catch Flutter framework errors (widget build, rendering) without crashing.
FlutterError.onError = (details) {
debugPrint('[M8Chat] Flutter error: ${details.exceptionAsString()}');