summarylogtreecommitdiffstats
path: root/notification.patch
blob: aa6ee284a3b46472f4195a8cba9f458554615f91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
From 95172aed8fcae1bbc73f47bdda81c63fb9f2054b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20Ku=C3=9Fowski?= <c.kussowski@famedly.com>
Date: Fri, 20 Jun 2025 15:23:56 +0200
Subject: [PATCH 01/10] build: Do not delete vodozemac on web release

---
 .github/workflows/release.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 550e512c24..763ca14627 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -30,6 +30,7 @@ jobs:
       - run: flutter pub get
       - name: Prepare web
         run: ./scripts/prepare-web.sh
+      - run: rm ./assets/vodozemac/.gitignore
       - name: Build Release Web
         run: flutter build web --dart-define=FLUTTER_WEB_CANVASKIT_URL=canvaskit/ --release --source-maps --base-href "/web/"
       - name: Create archive

From e41537271ff17d1f62a6abb33f5deb46172aac44 Mon Sep 17 00:00:00 2001
From: ShootingStarDragons <ShootingStarDragons@protonmail.com>
Date: Sat, 21 Jun 2025 00:47:38 +0900
Subject: [PATCH 02/10] fix: open chat from notification

default should not be ignored
---
 lib/widgets/local_notifications_extension.dart | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/widgets/local_notifications_extension.dart b/lib/widgets/local_notifications_extension.dart
index 540648eb49..38b8f55170 100644
--- a/lib/widgets/local_notifications_extension.dart
+++ b/lib/widgets/local_notifications_extension.dart
@@ -1,5 +1,6 @@
 import 'dart:io';
 
+import 'package:collection/collection.dart';
 import 'package:flutter/foundation.dart';
 import 'package:flutter/material.dart';
 
@@ -97,9 +98,12 @@ extension LocalNotificationsExtension on MatrixState {
         ],
       );
       notification.action.then((actionStr) {
-        final action = DesktopNotificationActions.values
-            .singleWhere((a) => a.name == actionStr);
-        switch (action) {
+        var action = DesktopNotificationActions.values
+            .singleWhereOrNull((a) => a.name == actionStr);
+        if (action == null && actionStr == "default") {
+          action = DesktopNotificationActions.openChat;
+        }
+        switch (action!) {
           case DesktopNotificationActions.seen:
             event.room.setReadMarker(
               event.eventId,

From 4802277dca7ba288cd5a0a450d7144054945d013 Mon Sep 17 00:00:00 2001
From: ShootingStarDragons <ShootingStarDragons@protonmail.com>
Date: Sat, 21 Jun 2025 01:26:14 +0900
Subject: [PATCH 03/10] fix: notification clicked still cannot jump

the context in context.go is the BuildContext by flutter, not that one
from go_router.
example is here: https://github.com/flutter/packages/blob/main/packages/go_router/example/lib/main.dart

it was a mistaken
---
 lib/widgets/local_notifications_extension.dart | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/widgets/local_notifications_extension.dart b/lib/widgets/local_notifications_extension.dart
index 38b8f55170..bf05424553 100644
--- a/lib/widgets/local_notifications_extension.dart
+++ b/lib/widgets/local_notifications_extension.dart
@@ -1,11 +1,11 @@
 import 'dart:io';
 
 import 'package:collection/collection.dart';
+import 'package:fluffychat/widgets/fluffy_chat_app.dart';
 import 'package:flutter/foundation.dart';
 import 'package:flutter/material.dart';
 
 import 'package:desktop_notifications/desktop_notifications.dart';
-import 'package:go_router/go_router.dart';
 import 'package:matrix/matrix.dart';
 import 'package:universal_html/html.dart' as html;
 
@@ -112,7 +112,7 @@ extension LocalNotificationsExtension on MatrixState {
             );
             break;
           case DesktopNotificationActions.openChat:
-            context.go('/rooms/${event.room.id}');
+            FluffyChatApp.router.go('/rooms/${event.room.id}');
             break;
         }
       });

From 5d8bad7458f671ef82003c8eb05596e71f35a501 Mon Sep 17 00:00:00 2001
From: ShootingStarDragons <ShootingStarDragons@protonmail.com>
Date: Sat, 21 Jun 2025 01:32:50 +0900
Subject: [PATCH 04/10] chore: do format

---
 lib/widgets/local_notifications_extension.dart | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/widgets/local_notifications_extension.dart b/lib/widgets/local_notifications_extension.dart
index bf05424553..06e7a40e9f 100644
--- a/lib/widgets/local_notifications_extension.dart
+++ b/lib/widgets/local_notifications_extension.dart
@@ -1,10 +1,9 @@
 import 'dart:io';
 
-import 'package:collection/collection.dart';
-import 'package:fluffychat/widgets/fluffy_chat_app.dart';
 import 'package:flutter/foundation.dart';
 import 'package:flutter/material.dart';
 
+import 'package:collection/collection.dart';
 import 'package:desktop_notifications/desktop_notifications.dart';
 import 'package:matrix/matrix.dart';
 import 'package:universal_html/html.dart' as html;
@@ -14,6 +13,7 @@ import 'package:fluffychat/l10n/l10n.dart';
 import 'package:fluffychat/utils/client_download_content_extension.dart';
 import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
 import 'package:fluffychat/utils/platform_infos.dart';
+import 'package:fluffychat/widgets/fluffy_chat_app.dart';
 import 'package:fluffychat/widgets/matrix.dart';
 
 extension LocalNotificationsExtension on MatrixState {

From 44b577e9787e2f83db65abc25524aa307bde1d7e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20Ku=C3=9Fowski?= <c.kussowski@famedly.com>
Date: Sat, 21 Jun 2025 08:47:30 +0200
Subject: [PATCH 05/10] build: Set commit message as changelog for internal
 builds

---
 .github/workflows/main_deploy.yaml            |  3 +
 .github/workflows/release.yaml                |  1 +
 .../android/en-US/changelogs/2324 (1.6.0).txt | 68 -------------------
 .../android/en-US/changelogs/default.txt      |  2 +
 fastlane                                      |  1 -
 5 files changed, 6 insertions(+), 69 deletions(-)
 delete mode 100644 android/fastlane/metadata/android/en-US/changelogs/2324 (1.6.0).txt
 create mode 100644 android/fastlane/metadata/android/en-US/changelogs/default.txt
 delete mode 120000 fastlane

diff --git a/.github/workflows/main_deploy.yaml b/.github/workflows/main_deploy.yaml
index d9347edefc..55ad0fafa0 100644
--- a/.github/workflows/main_deploy.yaml
+++ b/.github/workflows/main_deploy.yaml
@@ -67,6 +67,9 @@ jobs:
         run: ./scripts/prepare-android-release.sh
       - name: Build Android Release
         run: flutter build appbundle --target-platform android-arm,android-arm64,android-x64
+      - name: Set changelog
+        working-directory: android/fastlane/metadata/android/en-US/changelogs
+        run: git log --no-merges -1 --pretty=%B > default.txt
       - name: Deploy Android Release
         run: |
           mkdir -p build/android
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 763ca14627..d666c0f8fb 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -151,6 +151,7 @@ jobs:
           ruby-version: '3.3'
       - uses: moonrepo/setup-rust@v1
       - name: Install Fastlane
+        working-directory: android
         run: gem install fastlane -NV
       - name: Apply Google Services Patch
         run: git apply ./scripts/enable-android-google-services.patch
diff --git a/android/fastlane/metadata/android/en-US/changelogs/2324 (1.6.0).txt b/android/fastlane/metadata/android/en-US/changelogs/2324 (1.6.0).txt
deleted file mode 100644
index b2318505fe..0000000000
--- a/android/fastlane/metadata/android/en-US/changelogs/2324 (1.6.0).txt	
+++ /dev/null
@@ -1,68 +0,0 @@
-FluffyChat 1.6.0 features a lot of bug fixes and improvements. The code base has been
-simplified and the drawer on the chat list page got a come-back. Some new features like
-the space hierarchy and session dump have been implemented.
-
-- feat: Added monochrome entry for themed icon support in Android 13 (James Reilly)
-- feat: Display timeline of messages in android notification (Christian Pauly)
-- feat: Emoji related fixes (TheOneWithTheBraid)
-- feat: Implement deleting pushers in app (Christian Pauly)
-- feat: New material 3 design (Christian Pauly)
-- feat: Redesign bootsstrap and offer secure storage support (Christian Pauly)
-- feat: Send multiple images at once (Christian Pauly)
-- feat: implement session dump (TheOneWithTheBraid)
-- feat: implement space hierarchy (TheOneWithTheBraid)
-- feat: introduce extended integration tests (TheOneWithTheBraid)
-- feat: libhandy integration (TheOneWithTheBraid)
-- fix: Clearing push triggered when only one room got seen (Christian Pauly)
-- fix: Dont display loading dialog when adding reaction (Christian Pauly)
-- fix: Follow up for spaces hierarchy (TheOneWithTheBraid)
-- fix: Missing null checks in chat details view (Christian Pauly)
-- fix: Non FCM Android builds crash on start (Christian Pauly)
-- fix: Permission chooser dialog on iOS (Christian Pauly)
-- fix: Set avatar on only single action available (Christian Pauly)
-- fix: Sharing on iOS and iPad (Christian Pauly)
-- fix: Unread bubble is invisible in dark mode (Christian Pauly)
-- fix: appimage builds (TheOneWithTheBraid)
-- fix: only use custom http client on android (Jayesh Nirve)
-- fix: pass isrg cert to http client (Jayesh Nirve)
-- refactor: Chat view (Christian Pauly)
-- refactor: Encryption button (Christian Pauly)
-- refactor: Remove duplicated imports (Christian Pauly)
-- refactor: Remove legacy store (Christian Pauly)
-- refactor: Remove presence status feature (Christian Pauly)
-- refactor: Simplify MxcImage and replace CachedNetworkImage (Christian Pauly)
-- refactor: Switch to Hive Collections DB (Christian Pauly)
-- refactor: move start chat FAB to implementation file (TheOneWithTheBraid)
-- Translated using Weblate (Catalan) (Alfonso Montero López)
-- Translated using Weblate (Catalan) (Auri B.P)
-- Translated using Weblate (Chinese (Simplified)) (Eric)
-- Translated using Weblate (Croatian) (Milo Ivir)
-- Translated using Weblate (Dutch) (Jelv)
-- Translated using Weblate (English) (Raatty)
-- Translated using Weblate (Estonian) (Priit Jõerüüt)
-- Translated using Weblate (Finnish) (Aminda Suomalainen)
-- Translated using Weblate (Galician) (Xosé M)
-- Translated using Weblate (Indonesian) (Linerly)
-- Translated using Weblate (Persian) (Amir Hossein Maher)
-- Translated using Weblate (Polish) (Przemysław Romanik)
-- Translated using Weblate (Russian) (Nikita Epifanov)
-- Translated using Weblate (Turkish) (Oğuz Ersen)
-- Translated using Weblate (Ukrainian) (Ihor Hordiichuk)
-- chore: Add border to avatars (Christian Pauly)
-- chore: Add fancy hero animations (Christian Pauly)
-- chore: Adjust appbar design (Christian Pauly)
-- chore: Adjust design (Christian Pauly)
-- chore: Adjust search bar design (Christian Pauly)
-- chore: Always display header elevation in chat (Christian Pauly)
-- chore: Design follow up fixes (Christian Pauly)
-- chore: Design follow up fixes (Christian Pauly)
-- chore: Disable integration tests without runners (Krille Fear)
-- chore: Enhance invitiation UX (Christian Pauly)
-- chore: Make push helper more fail safe (Christian Pauly)
-- chore: Make push helper more stable (Christian Pauly)
-- chore: Minor design improvements (Christian Pauly)
-- chore: Pinned events design (Christian Pauly)
-- chore: Remove permission handler dependency and increase compileSdkVersion (Christian Pauly)
-- chore: Switch to flutter 3.0.5 (Krille Fear)
-- chore: Update SDK (Christian Pauly)
-- chore: remove snapping sheet (TheOneWithTheBraid)
\ No newline at end of file
diff --git a/android/fastlane/metadata/android/en-US/changelogs/default.txt b/android/fastlane/metadata/android/en-US/changelogs/default.txt
new file mode 100644
index 0000000000..bb8145335b
--- /dev/null
+++ b/android/fastlane/metadata/android/en-US/changelogs/default.txt
@@ -0,0 +1,2 @@
+build: Do not delete vodozemac on web release
+
diff --git a/fastlane b/fastlane
deleted file mode 120000
index 94746b0d7f..0000000000
--- a/fastlane
+++ /dev/null
@@ -1 +0,0 @@
-./android/fastlane
\ No newline at end of file

From 95ca19ba899d0012a02f6b5d565ffbe1969d59b8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20Ku=C3=9Fowski?= <c.kussowski@famedly.com>
Date: Sat, 21 Jun 2025 08:49:05 +0200
Subject: [PATCH 06/10] build: Update changelog for fastlane android

---
 android/fastlane/metadata/android/en-US/changelogs/default.txt | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/android/fastlane/metadata/android/en-US/changelogs/default.txt b/android/fastlane/metadata/android/en-US/changelogs/default.txt
index bb8145335b..1fe529d3f2 100644
--- a/android/fastlane/metadata/android/en-US/changelogs/default.txt
+++ b/android/fastlane/metadata/android/en-US/changelogs/default.txt
@@ -1,2 +1 @@
-build: Do not delete vodozemac on web release
-
+FluffyChat 2.0.0 now uses the Vodozemac encryption library and brings bugfixes and performance improvements, together with an improved user experience when interacting with messages.
\ No newline at end of file

From a20bfeca219f957139f9273d3719e4162434fff1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20Ku=C3=9Fowski?= <c.kussowski@famedly.com>
Date: Sat, 21 Jun 2025 09:04:16 +0200
Subject: [PATCH 07/10] chore: Nicer own reaction color design

---
 lib/pages/chat/events/message_reactions.dart | 22 ++++++++++++--------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/lib/pages/chat/events/message_reactions.dart b/lib/pages/chat/events/message_reactions.dart
index e34dad9a03..dede458aa5 100644
--- a/lib/pages/chat/events/message_reactions.dart
+++ b/lib/pages/chat/events/message_reactions.dart
@@ -4,7 +4,6 @@ import 'package:collection/collection.dart' show IterableExtension;
 import 'package:matrix/matrix.dart';
 
 import 'package:fluffychat/config/app_config.dart';
-import 'package:fluffychat/config/themes.dart';
 import 'package:fluffychat/widgets/avatar.dart';
 import 'package:fluffychat/widgets/future_loading_dialog.dart';
 import 'package:fluffychat/widgets/matrix.dart';
@@ -110,11 +109,7 @@ class _Reaction extends StatelessWidget {
   @override
   Widget build(BuildContext context) {
     final theme = Theme.of(context);
-    final textColor =
-        theme.brightness == Brightness.dark ? Colors.white : Colors.black;
-    final color = reacted == true
-        ? theme.bubbleColor
-        : theme.colorScheme.surfaceContainerHigh;
+
     Widget content;
     if (reactionKey.startsWith('mxc://')) {
       content = Row(
@@ -131,8 +126,9 @@ class _Reaction extends StatelessWidget {
             const SizedBox(width: 4),
             Text(
               count.toString(),
+              textAlign: TextAlign.center,
               style: TextStyle(
-                color: textColor,
+                color: theme.colorScheme.onSurface,
                 fontSize: DefaultTextStyle.of(context).style.fontSize,
               ),
             ),
@@ -147,7 +143,7 @@ class _Reaction extends StatelessWidget {
       content = Text(
         renderKey.toString() + (count > 1 ? ' $count' : ''),
         style: TextStyle(
-          color: reacted == true ? theme.onBubbleColor : textColor,
+          color: theme.colorScheme.onSurface,
           fontSize: DefaultTextStyle.of(context).style.fontSize,
         ),
       );
@@ -158,7 +154,15 @@ class _Reaction extends StatelessWidget {
       borderRadius: BorderRadius.circular(AppConfig.borderRadius / 2),
       child: Container(
         decoration: BoxDecoration(
-          color: color,
+          color: reacted == true
+              ? theme.colorScheme.primaryContainer
+              : theme.colorScheme.surfaceContainerHigh,
+          border: Border.all(
+            color: reacted == true
+                ? theme.colorScheme.primary
+                : theme.colorScheme.surfaceContainerHigh,
+            width: 1,
+          ),
           borderRadius: BorderRadius.circular(AppConfig.borderRadius / 2),
         ),
         padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 2),

From b8d64a113e0733777a8dfd873f7df358838436b8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20Ku=C3=9Fowski?= <c.kussowski@famedly.com>
Date: Sat, 21 Jun 2025 09:18:27 +0200
Subject: [PATCH 08/10] chore: Add CI workflow for thank you message after
 issue got completed

---
 .../workflows/completed_issue_comment.yaml    | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 .github/workflows/completed_issue_comment.yaml

diff --git a/.github/workflows/completed_issue_comment.yaml b/.github/workflows/completed_issue_comment.yaml
new file mode 100644
index 0000000000..90f97beead
--- /dev/null
+++ b/.github/workflows/completed_issue_comment.yaml
@@ -0,0 +1,24 @@
+name: Completed Issue Comment
+
+on:
+  issues:
+    types: [labeled]
+
+jobs:
+  completed_issue_comment:
+    if: github.event.label.name == 'status:completed'
+    runs-on: ubuntu-latest
+    env:
+        GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+    steps:
+      - run: |
+          gh issue comment ${{ github.event.issue.number }} --body "$(cat <<EOF
+          Thank you so much for reporting this issue and helping us improve FluffyChat! 💬💖
+
+          This project is built and maintained by volunteers in their free time.
+          If you enjoyed using FluffyChat and want to support the people behind it,
+          you can say thanks by buying us a coffee or chipping in:
+          ☕ https://ko-fi.com/krille  
+          💜 https://liberapay.com/KrilleChritzelius
+          EOF
+          )"
\ No newline at end of file

From 3d0a3ee2264430720329aefd1e10ac27f57c258f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20Ku=C3=9Fowski?= <c.kussowski@famedly.com>
Date: Sat, 21 Jun 2025 10:05:14 +0200
Subject: [PATCH 09/10] fix: Workaround for reversed width and height of
 compressed videos sent from Android

---
 lib/pages/chat/events/video_player.dart | 13 +++++++++----
 lib/pages/chat/send_file_dialog.dart    | 18 ++++++++++++------
 lib/utils/resize_video.dart             | 15 ++++++++++-----
 3 files changed, 31 insertions(+), 15 deletions(-)

diff --git a/lib/pages/chat/events/video_player.dart b/lib/pages/chat/events/video_player.dart
index 856bda50cf..6b31eb7748 100644
--- a/lib/pages/chat/events/video_player.dart
+++ b/lib/pages/chat/events/video_player.dart
@@ -1,3 +1,5 @@
+import 'dart:math';
+
 import 'package:flutter/material.dart';
 
 import 'package:flutter_linkify/flutter_linkify.dart';
@@ -36,11 +38,14 @@ class EventVideoPlayer extends StatelessWidget {
             .tryGet<String>('xyz.amorgan.blurhash') ??
         fallbackBlurHash;
     final fileDescription = event.fileDescription;
+    const maxDimension = 300.0;
     final infoMap = event.content.tryGetMap<String, Object?>('info');
-    final videoWidth = infoMap?.tryGet<int>('w') ?? 400;
-    final videoHeight = infoMap?.tryGet<int>('h') ?? 300;
-    const height = 300.0;
-    final width = videoWidth * (height / videoHeight);
+    final videoWidth = infoMap?.tryGet<int>('w') ?? maxDimension;
+    final videoHeight = infoMap?.tryGet<int>('h') ?? maxDimension;
+
+    final modifier = max(videoWidth, videoHeight) / maxDimension;
+    final width = videoWidth / modifier;
+    final height = videoHeight / modifier;
 
     final durationInt = infoMap?.tryGet<int>('duration');
     final duration =
diff --git a/lib/pages/chat/send_file_dialog.dart b/lib/pages/chat/send_file_dialog.dart
index c786b6769f..7b215496e0 100644
--- a/lib/pages/chat/send_file_dialog.dart
+++ b/lib/pages/chat/send_file_dialog.dart
@@ -59,16 +59,22 @@ class SendFileDialogState extends State<SendFileDialog> {
         final length = await xfile.length();
         final mimeType = xfile.mimeType ?? lookupMimeType(xfile.path);
 
-        // If file is a video, shrink it!
+        // Generate video thumbnail
         if (PlatformInfos.isMobile &&
             mimeType != null &&
-            mimeType.startsWith('video') &&
-            length > minSizeToCompress &&
-            compress) {
-          scaffoldMessenger.showLoadingSnackBar(l10n.compressVideo);
-          file = await xfile.resizeVideo();
+            mimeType.startsWith('video')) {
           scaffoldMessenger.showLoadingSnackBar(l10n.generatingVideoThumbnail);
           thumbnail = await xfile.getVideoThumbnail();
+        }
+
+        // If file is a video, shrink it!
+        if (PlatformInfos.isMobile &&
+            mimeType != null &&
+            mimeType.startsWith('video')) {
+          scaffoldMessenger.showLoadingSnackBar(l10n.compressVideo);
+          file = await xfile.getVideoInfo(
+            compress: length > minSizeToCompress && compress,
+          );
         } else {
           if (length > maxUploadSize) {
             throw FileTooBigMatrixException(length, maxUploadSize);
diff --git a/lib/utils/resize_video.dart b/lib/utils/resize_video.dart
index 768677106a..99a4c6b0a1 100644
--- a/lib/utils/resize_video.dart
+++ b/lib/utils/resize_video.dart
@@ -8,22 +8,27 @@ extension ResizeImage on XFile {
   static const int max = 1200;
   static const int quality = 40;
 
-  Future<MatrixVideoFile> resizeVideo() async {
+  Future<MatrixVideoFile> getVideoInfo({bool compress = true}) async {
     MediaInfo? mediaInfo;
     try {
       if (PlatformInfos.isMobile) {
         // will throw an error e.g. on Android SDK < 18
-        mediaInfo = await VideoCompress.compressVideo(path);
+        mediaInfo = compress
+            ? await VideoCompress.compressVideo(path, deleteOrigin: true)
+            : await VideoCompress.getMediaInfo(path);
       }
     } catch (e, s) {
-      Logs().w('Error while compressing video', e, s);
+      Logs().w('Error while fetching video media info', e, s);
     }
+
     return MatrixVideoFile(
       bytes: (await mediaInfo?.file?.readAsBytes()) ?? await readAsBytes(),
       name: name,
       mimeType: mimeType,
-      width: mediaInfo?.width,
-      height: mediaInfo?.height,
+      // on Android width and height is reversed:
+      // https://github.com/jonataslaw/VideoCompress/issues/172
+      width: PlatformInfos.isAndroid ? mediaInfo?.height : mediaInfo?.width,
+      height: PlatformInfos.isAndroid ? mediaInfo?.width : mediaInfo?.height,
       duration: mediaInfo?.duration?.round(),
     );
   }

From 103cb8328dbabda1169bbef30cef2b16b78a0322 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20Ku=C3=9Fowski?= <c.kussowski@famedly.com>
Date: Sat, 21 Jun 2025 11:15:28 +0200
Subject: [PATCH 10/10] feat: Collapse all state events by default

---
 lib/config/app_config.dart                    |  2 -
 lib/l10n/intl_en.arb                          |  3 +-
 lib/pages/chat/chat.dart                      | 18 ++++
 lib/pages/chat/chat_event_list.dart           | 22 ++++-
 lib/pages/chat/events/message.dart            |  6 +-
 lib/pages/chat/events/state_message.dart      | 90 +++++++++++++------
 .../settings_chat/settings_chat_view.dart     |  7 --
 .../filtered_timeline_extension.dart          | 48 +++-------
 lib/widgets/matrix.dart                       |  4 -
 9 files changed, 121 insertions(+), 79 deletions(-)

diff --git a/lib/config/app_config.dart b/lib/config/app_config.dart
index 11f9e8f216..a80d16e149 100644
--- a/lib/config/app_config.dart
+++ b/lib/config/app_config.dart
@@ -53,7 +53,6 @@ abstract class AppConfig {
   static bool renderHtml = true;
   static bool hideRedactedEvents = false;
   static bool hideUnknownEvents = true;
-  static bool hideUnimportantStateEvents = true;
   static bool separateChatTypes = false;
   static bool autoplayImages = true;
   static bool sendTypingNotifications = true;
@@ -64,7 +63,6 @@ abstract class AppConfig {
   static bool displayNavigationRail = false;
   static bool experimentalVoip = false;
   static const bool hideTypingUsernames = false;
-  static const bool hideAllStateEvents = false;
   static const String inviteLinkPrefix = 'https://matrix.to/#/';
   static const String deepLinkPrefix = 'im.fluffychat://chat/';
   static const String schemePrefix = 'matrix:';
diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb
index 52d2c76f05..863fcc0f3b 100644
--- a/lib/l10n/intl_en.arb
+++ b/lib/l10n/intl_en.arb
@@ -3240,5 +3240,6 @@
     "commandHint_logout": "Logout your current device",
     "commandHint_logoutall": "Logout all active devices",
     "displayNavigationRail": "Show navigation rail on mobile",
-    "customReaction": "Custom reaction"
+    "customReaction": "Custom reaction",
+    "moreEvents": "More events"
 }
\ No newline at end of file
diff --git a/lib/pages/chat/chat.dart b/lib/pages/chat/chat.dart
index 308ac2b1f1..13238a6a8c 100644
--- a/lib/pages/chat/chat.dart
+++ b/lib/pages/chat/chat.dart
@@ -339,6 +339,24 @@ class ChatController extends State<ChatPageWithRoom>
     }
   }
 
+  final Set<String> expandedEventIds = {};
+
+  void expandEventsFrom(Event event, bool expand) {
+    final events = timeline!.events.filterByVisibleInGui();
+    final start = events.indexOf(event);
+    setState(() {
+      for (var i = start; i < events.length; i++) {
+        final event = events[i];
+        if (!event.isCollapsedState) return;
+        if (expand) {
+          expandedEventIds.add(event.eventId);
+        } else {
+          expandedEventIds.remove(event.eventId);
+        }
+      }
+    });
+  }
+
   void _tryLoadTimeline() async {
     final initialEventId = widget.eventId;
     loadTimelineFuture = _getTimeline();
diff --git a/lib/pages/chat/chat_event_list.dart b/lib/pages/chat/chat_event_list.dart
index 50a1c262a6..7e11588a47 100644
--- a/lib/pages/chat/chat_event_list.dart
+++ b/lib/pages/chat/chat_event_list.dart
@@ -119,6 +119,17 @@ class ChatEventList extends StatelessWidget {
                 timeline.events.length > animateInEventIndex &&
                 event == timeline.events[animateInEventIndex];
 
+            final nextEvent = i + 1 < events.length ? events[i + 1] : null;
+            final previousEvent = i > 0 ? events[i - 1] : null;
+
+            // Collapsed state event
+            final canExpand = event.isCollapsedState &&
+                nextEvent?.isCollapsedState == true &&
+                previousEvent?.isCollapsedState != true;
+            final isCollapsed = event.isCollapsedState &&
+                previousEvent?.isCollapsedState == true &&
+                !controller.expandedEventIds.contains(event.eventId);
+
             return AutoScrollTag(
               key: ValueKey(event.eventId),
               index: i,
@@ -148,11 +159,18 @@ class ChatEventList extends StatelessWidget {
                 timeline: timeline,
                 displayReadMarker:
                     i > 0 && controller.readMarkerEventId == event.eventId,
-                nextEvent: i + 1 < events.length ? events[i + 1] : null,
-                previousEvent: i > 0 ? events[i - 1] : null,
+                nextEvent: nextEvent,
+                previousEvent: previousEvent,
                 wallpaperMode: hasWallpaper,
                 scrollController: controller.scrollController,
                 colors: colors,
+                isCollapsed: isCollapsed,
+                onExpand: canExpand
+                    ? () => controller.expandEventsFrom(
+                          event,
+                          !controller.expandedEventIds.contains(event.eventId),
+                        )
+                    : null,
               ),
             );
           },
diff --git a/lib/pages/chat/events/message.dart b/lib/pages/chat/events/message.dart
index 279ea439f5..fab82c91b1 100644
--- a/lib/pages/chat/events/message.dart
+++ b/lib/pages/chat/events/message.dart
@@ -44,6 +44,8 @@ class Message extends StatelessWidget {
   final bool wallpaperMode;
   final ScrollController scrollController;
   final List<Color> colors;
+  final void Function()? onExpand;
+  final bool isCollapsed;
 
   const Message(
     this.event, {
@@ -66,6 +68,8 @@ class Message extends StatelessWidget {
     required this.onMention,
     required this.scrollController,
     required this.colors,
+    this.onExpand,
+    this.isCollapsed = false,
     super.key,
   });
 
@@ -85,7 +89,7 @@ class Message extends StatelessWidget {
       if (event.type == EventTypes.RoomCreate) {
         return RoomCreationStateEvent(event: event);
       }
-      return StateMessage(event);
+      return StateMessage(event, onExpand: onExpand, isCollapsed: isCollapsed);
     }
 
     if (event.type == EventTypes.Message &&
diff --git a/lib/pages/chat/events/state_message.dart b/lib/pages/chat/events/state_message.dart
index 41f0113053..7d6be428ce 100644
--- a/lib/pages/chat/events/state_message.dart
+++ b/lib/pages/chat/events/state_message.dart
@@ -1,46 +1,84 @@
+import 'package:flutter/gestures.dart';
 import 'package:flutter/material.dart';
 
 import 'package:matrix/matrix.dart';
 
+import 'package:fluffychat/config/themes.dart';
 import 'package:fluffychat/l10n/l10n.dart';
 import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
 import '../../../config/app_config.dart';
 
 class StateMessage extends StatelessWidget {
   final Event event;
-  const StateMessage(this.event, {super.key});
+  final void Function()? onExpand;
+  final bool isCollapsed;
+  const StateMessage(
+    this.event, {
+    this.onExpand,
+    this.isCollapsed = false,
+    super.key,
+  });
 
   @override
   Widget build(BuildContext context) {
     final theme = Theme.of(context);
-    return Padding(
-      padding: const EdgeInsets.symmetric(horizontal: 8.0),
-      child: Center(
-        child: Padding(
-          padding: const EdgeInsets.all(4),
-          child: Material(
-            color: theme.colorScheme.surface.withAlpha(128),
-            borderRadius: BorderRadius.circular(AppConfig.borderRadius / 3),
-            child: Padding(
-              padding:
-                  const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0),
-              child: Text(
-                event.calcLocalizedBodyFallback(
-                  MatrixLocals(L10n.of(context)),
-                ),
-                textAlign: TextAlign.center,
-                maxLines: 2,
-                overflow: TextOverflow.ellipsis,
-                style: TextStyle(
-                  fontSize: 12 * AppConfig.fontSizeFactor,
-                  decoration:
-                      event.redacted ? TextDecoration.lineThrough : null,
+    return AnimatedSize(
+      duration: FluffyThemes.animationDuration,
+      curve: FluffyThemes.animationCurve,
+      child: isCollapsed
+          ? const SizedBox.shrink()
+          : Padding(
+              padding: const EdgeInsets.symmetric(horizontal: 8.0),
+              child: Center(
+                child: Padding(
+                  padding: const EdgeInsets.all(4),
+                  child: Material(
+                    color: theme.colorScheme.surface.withAlpha(128),
+                    borderRadius:
+                        BorderRadius.circular(AppConfig.borderRadius / 3),
+                    child: Padding(
+                      padding: const EdgeInsets.symmetric(
+                        horizontal: 8.0,
+                        vertical: 4.0,
+                      ),
+                      child: Text.rich(
+                        TextSpan(
+                          children: [
+                            TextSpan(
+                              text: event.calcLocalizedBodyFallback(
+                                MatrixLocals(L10n.of(context)),
+                              ),
+                            ),
+                            if (onExpand != null) ...[
+                              const TextSpan(
+                                text: ' + ',
+                                style: TextStyle(fontWeight: FontWeight.bold),
+                              ),
+                              TextSpan(
+                                style: TextStyle(
+                                  color: theme.colorScheme.primary,
+                                  decoration: TextDecoration.underline,
+                                ),
+                                recognizer: TapGestureRecognizer()
+                                  ..onTap = onExpand,
+                                text: L10n.of(context).moreEvents,
+                              ),
+                            ],
+                          ],
+                        ),
+                        textAlign: TextAlign.center,
+                        style: TextStyle(
+                          fontSize: 12 * AppConfig.fontSizeFactor,
+                          decoration: event.redacted
+                              ? TextDecoration.lineThrough
+                              : null,
+                        ),
+                      ),
+                    ),
+                  ),
                 ),
               ),
             ),
-          ),
-        ),
-      ),
     );
   }
 }
diff --git a/lib/pages/settings_chat/settings_chat_view.dart b/lib/pages/settings_chat/settings_chat_view.dart
index 449ab6a75f..d3526a28e2 100644
--- a/lib/pages/settings_chat/settings_chat_view.dart
+++ b/lib/pages/settings_chat/settings_chat_view.dart
@@ -38,13 +38,6 @@ class SettingsChatView extends StatelessWidget {
                 storeKey: SettingKeys.renderHtml,
                 defaultValue: AppConfig.renderHtml,
               ),
-              SettingsSwitchListTile.adaptive(
-                title: L10n.of(context).hideMemberChangesInPublicChats,
-                subtitle: L10n.of(context).hideMemberChangesInPublicChatsBody,
-                onChanged: (b) => AppConfig.hideUnimportantStateEvents = b,
-                storeKey: SettingKeys.hideUnimportantStateEvents,
-                defaultValue: AppConfig.hideUnimportantStateEvents,
-              ),
               SettingsSwitchListTile.adaptive(
                 title: L10n.of(context).hideRedactedMessages,
                 subtitle: L10n.of(context).hideRedactedMessagesBody,
diff --git a/lib/utils/matrix_sdk_extensions/filtered_timeline_extension.dart b/lib/utils/matrix_sdk_extensions/filtered_timeline_extension.dart
index cd9d223ee3..055ce50118 100644
--- a/lib/utils/matrix_sdk_extensions/filtered_timeline_extension.dart
+++ b/lib/utils/matrix_sdk_extensions/filtered_timeline_extension.dart
@@ -3,33 +3,9 @@ import 'package:matrix/matrix.dart';
 import '../../config/app_config.dart';
 
 extension VisibleInGuiExtension on List<Event> {
-  List<Event> filterByVisibleInGui({String? exceptionEventId}) {
-    final visibleEvents =
-        where((e) => e.isVisibleInGui || e.eventId == exceptionEventId)
-            .toList();
-
-    // Hide creation state events:
-    if (visibleEvents.isNotEmpty &&
-        visibleEvents.last.type == EventTypes.RoomCreate) {
-      var i = visibleEvents.length - 2;
-      while (i > 0) {
-        final event = visibleEvents[i];
-        if (!event.isState) break;
-        if (event.type == EventTypes.Encryption) {
-          i--;
-          continue;
-        }
-        if (event.type == EventTypes.RoomMember &&
-            event.roomMemberChangeType == RoomMemberChangeType.acceptInvite) {
-          i--;
-          continue;
-        }
-        visibleEvents.removeAt(i);
-        i--;
-      }
-    }
-    return visibleEvents;
-  }
+  List<Event> filterByVisibleInGui({String? exceptionEventId}) => where(
+        (event) => event.isVisibleInGui || event.eventId == exceptionEventId,
+      ).toList();
 }
 
 extension IsStateExtension on Event {
@@ -45,19 +21,19 @@ extension IsStateExtension on Event {
       // if we enabled to hide all redacted events, don't show those
       (!AppConfig.hideRedactedEvents || !redacted) &&
       // if we enabled to hide all unknown events, don't show those
-      (!AppConfig.hideUnknownEvents || isEventTypeKnown) &&
-      // remove state events that we don't want to render
-      (isState || !AppConfig.hideAllStateEvents) &&
-      // hide simple join/leave member events in public rooms
-      (!AppConfig.hideUnimportantStateEvents ||
-          type != EventTypes.RoomMember ||
-          room.joinRules != JoinRules.public ||
-          content.tryGet<String>('membership') == 'ban' ||
-          stateKey != senderId);
+      (!AppConfig.hideUnknownEvents || isEventTypeKnown);
 
   bool get isState => !{
         EventTypes.Message,
         EventTypes.Sticker,
         EventTypes.Encrypted,
       }.contains(type);
+
+  bool get isCollapsedState => !{
+        EventTypes.Message,
+        EventTypes.Sticker,
+        EventTypes.Encrypted,
+        EventTypes.RoomCreate,
+        EventTypes.RoomTombstone,
+      }.contains(type);
 }
diff --git a/lib/widgets/matrix.dart b/lib/widgets/matrix.dart
index 1115e8756f..2b7a1797b1 100644
--- a/lib/widgets/matrix.dart
+++ b/lib/widgets/matrix.dart
@@ -411,10 +411,6 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
         store.getBool(SettingKeys.hideUnknownEvents) ??
             AppConfig.hideUnknownEvents;
 
-    AppConfig.hideUnimportantStateEvents =
-        store.getBool(SettingKeys.hideUnimportantStateEvents) ??
-            AppConfig.hideUnimportantStateEvents;
-
     AppConfig.separateChatTypes =
         store.getBool(SettingKeys.separateChatTypes) ??
             AppConfig.separateChatTypes;