File tree Expand file tree Collapse file tree 5 files changed +45
-17
lines changed Expand file tree Collapse file tree 5 files changed +45
-17
lines changed Original file line number Diff line number Diff line change 11name : Snap
22
33on :
4- push : {}
5- pull_request : {}
6- workflow_dispatch : {}
4+ push :
5+ branches : [main]
6+ workflow_dispatch :
77
88jobs :
99 build :
Original file line number Diff line number Diff line change 11import 'dart:convert' ;
22import 'dart:ui' ;
33
4+ import 'package:adaptive_dialog/adaptive_dialog.dart' ;
45import 'package:flutter/material.dart' ;
56import 'package:flutter/services.dart' ;
6-
7- import 'package:adaptive_dialog/adaptive_dialog.dart' ;
87import 'package:future_loading_dialog/future_loading_dialog.dart' ;
98import 'package:matrix/encryption.dart' ;
109import 'package:matrix/matrix.dart' ;
1110
11+ import '../../../common/view/build_context_x.dart' ;
1212import '../../../l10n/l10n.dart' ;
1313import '../../view/chat_avatar.dart' ;
1414
@@ -21,10 +21,14 @@ class KeyVerificationDialog extends StatefulWidget {
2121 );
2222
2323 final KeyVerification request;
24+ final Function ()? onCancel;
25+ final Function ()? onDone;
2426
2527 const KeyVerificationDialog ({
2628 super .key,
2729 required this .request,
30+ this .onCancel,
31+ this .onDone,
2832 });
2933
3034 @override
@@ -95,7 +99,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
9599
96100 @override
97101 Widget build (BuildContext context) {
98- final theme = Theme . of ( context) ;
102+ final theme = context.theme ;
99103 final l10n = context.l10n;
100104
101105 User ? user;
@@ -321,7 +325,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
321325 l10n.close,
322326 ),
323327 onPressed: () {
324- Navigator . of (context, rootNavigator : false ). pop ();
328+ widget.onDone ? . call ();
325329 if (context.mounted) {
326330 Navigator .of (
327331 context,
Original file line number Diff line number Diff line change 11import 'package:collection/collection.dart' ;
2+ import 'package:matrix/encryption/utils/key_verification.dart' ;
23import 'package:matrix/matrix.dart' ;
34import 'package:safe_change_notifier/safe_change_notifier.dart' ;
45
@@ -17,6 +18,8 @@ class ChatModel extends SafeChangeNotifier {
1718 bool isUserEvent (Event event) => myUserId == event.senderId;
1819 bool get isLogged => _client.isLogged ();
1920 bool get encryptionEnabled => _client.encryptionEnabled;
21+ Stream <KeyVerification > get onKeyVerificationRequest =>
22+ _client.onKeyVerificationRequest.stream;
2023
2124 // Room management
2225 /// The list of all rooms the user is participating or invited.
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ import 'dart:async';
22
33import 'package:matrix/matrix.dart' ;
44
5+ import '../common/logging.dart' ;
6+
57class RemoteImageService {
68 RemoteImageService ({required Client client}) : _client = client;
79 final Client _client;
@@ -19,16 +21,21 @@ class RemoteImageService {
1921 ThumbnailMethod ? method = ThumbnailMethod .scale,
2022 bool ? animated = false ,
2123 }) async {
22- final albumArtUrl = put (
23- key: uri,
24- url: await uri.getThumbnailUri (
25- _client,
26- animated: animated,
27- height: height,
28- width: width,
29- method: method,
30- ),
31- );
24+ Uri ? albumArtUrl;
25+ try {
26+ albumArtUrl = put (
27+ key: uri,
28+ url: await uri.getThumbnailUri (
29+ _client,
30+ animated: animated,
31+ height: height,
32+ width: width,
33+ method: method,
34+ ),
35+ );
36+ } on Exception catch (_) {
37+ printMessageInDebugMode ('Could not find profile (anymore)' );
38+ }
3239 _propertiesChangedController.add (true );
3340
3441 return albumArtUrl;
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import '../../../common/view/common_widgets.dart';
88import '../../../common/view/ui_constants.dart' ;
99import '../../bootstrap/bootstrap_model.dart' ;
1010import '../../bootstrap/view/bootstrap_page.dart' ;
11+ import '../../bootstrap/view/key_verification_dialog.dart' ;
1112import '../../chat_model.dart' ;
1213import '../chat_room/chat_room_page.dart' ;
1314import '../no_selected_room_page.dart' ;
@@ -49,6 +50,19 @@ class _ChatMasterDetailPageState extends State<ChatMasterDetailPage> {
4950
5051 @override
5152 Widget build (BuildContext context) {
53+ registerStreamHandler (
54+ select: (ChatModel m) => m.onKeyVerificationRequest,
55+ handler: (context, newValue, cancel) {
56+ if (newValue.hasData) {
57+ showDialog (
58+ context: context,
59+ builder: (context) =>
60+ KeyVerificationDialog (request: newValue.data! ),
61+ );
62+ }
63+ },
64+ );
65+
5266 final selectedRoom = watchPropertyValue ((ChatModel m) => m.selectedRoom);
5367 final isArchivedRoom =
5468 watchPropertyValue ((ChatModel m) => m.selectedRoom? .isArchived == true );
You can’t perform that action at this time.
0 commit comments