diff --git a/CHANGELOG.md b/CHANGELOG.md index c9e845a..dea3300 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,9 @@ ## 0.1.6 -- Improved: Show typing indicator also in the chat overview +- Improved: Show input indicator in the chat overview as well - Fix: Phantom push notification +- Fix: Start in chat, if configured - Fix: Smaller UI fixes ## 0.1.5 diff --git a/lib/src/services/notifications/background.notifications.dart b/lib/src/services/notifications/background.notifications.dart index 50d7820..3a1e682 100644 --- a/lib/src/services/notifications/background.notifications.dart +++ b/lib/src/services/notifications/background.notifications.dart @@ -214,6 +214,8 @@ Future showLocalPushNotification( pushNotification.kind == PushKind.reactionToText || pushNotification.kind == PushKind.reactionToAudio)) { payload = Routes.chatsMessages(groupId); + } else { + payload = Routes.chats; } await flutterLocalNotificationsPlugin.show( diff --git a/lib/src/views/chats/chat_list_components/typing_indicator_subtitle.dart b/lib/src/views/chats/chat_list_components/typing_indicator_subtitle.dart index ebebb82..8592f48 100644 --- a/lib/src/views/chats/chat_list_components/typing_indicator_subtitle.dart +++ b/lib/src/views/chats/chat_list_components/typing_indicator_subtitle.dart @@ -40,9 +40,11 @@ class _TypingIndicatorSubtitleState extends State { } void filterOpenUsers(List input) { - setState(() { - _groupMembers = input.where(isTyping).toList(); - }); + if (mounted) { + setState(() { + _groupMembers = input.where(isTyping).toList(); + }); + } } @override diff --git a/lib/src/views/chats/chat_messages_components/typing_indicator.dart b/lib/src/views/chats/chat_messages_components/typing_indicator.dart index 620680a..b48908b 100644 --- a/lib/src/views/chats/chat_messages_components/typing_indicator.dart +++ b/lib/src/views/chats/chat_messages_components/typing_indicator.dart @@ -66,9 +66,11 @@ class _TypingIndicatorState extends State { } void filterOpenUsers(List input) { - setState(() { - _groupMembers = input.where(hasChatOpen).toList(); - }); + if (mounted) { + setState(() { + _groupMembers = input.where(hasChatOpen).toList(); + }); + } } @override diff --git a/lib/src/views/home.view.dart b/lib/src/views/home.view.dart index 83a52c6..f208d90 100644 --- a/lib/src/views/home.view.dart +++ b/lib/src/views/home.view.dart @@ -49,11 +49,11 @@ class Shade extends StatelessWidget { } class HomeViewState extends State { - int activePageIdx = 0; + int _activePageIdx = 1; final MainCameraController _mainCameraController = MainCameraController(); - final PageController homeViewPageController = PageController(initialPage: 1); + final PageController _homeViewPageController = PageController(initialPage: 1); late StreamSubscription> _intentStreamSub; late StreamSubscription _deepLinkSub; @@ -67,10 +67,10 @@ class HomeViewState extends State { bool onPageView(ScrollNotification notification) { disableCameraTimer?.cancel(); if (notification.depth == 0 && notification is ScrollUpdateNotification) { - final page = homeViewPageController.page ?? 0; + final page = _homeViewPageController.page ?? 0; lastChange = page; setState(() { - offsetFromOne = 1.0 - (homeViewPageController.page ?? 0); + offsetFromOne = 1.0 - (_homeViewPageController.page ?? 0); offsetRatio = offsetFromOne.abs(); }); } @@ -100,17 +100,17 @@ class HomeViewState extends State { _mainCameraController.setState = () { if (mounted) setState(() {}); }; - activePageIdx = widget.initialPage; globalUpdateOfHomeViewPageIndex = (index) { - homeViewPageController.jumpToPage(index); + _homeViewPageController.jumpToPage(index); setState(() { - activePageIdx = index; + _activePageIdx = index; }); }; selectNotificationStream.stream.listen((response) async { if (response.payload != null && - response.payload!.startsWith(Routes.chats)) { + response.payload!.startsWith(Routes.chats) && + response.payload! != Routes.chats) { await routerProvider.push(response.payload!); } globalUpdateOfHomeViewPageIndex(0); @@ -134,6 +134,11 @@ class HomeViewState extends State { context, _mainCameraController.setSharedLinkForPreview, ); + WidgetsBinding.instance.addPostFrameCallback((_) { + if (widget.initialPage == 0) { + globalUpdateOfHomeViewPageIndex(0); + } + }); } @override @@ -196,10 +201,10 @@ class HomeViewState extends State { onNotification: onPageView, child: Positioned.fill( child: PageView( - controller: homeViewPageController, + controller: _homeViewPageController, onPageChanged: (index) { setState(() { - activePageIdx = index; + _activePageIdx = index; }); }, children: [ @@ -222,7 +227,7 @@ class HomeViewState extends State { child: CameraPreviewControllerView( mainController: _mainCameraController, isVisible: - ((1 - (offsetRatio * 4) % 1) == 1) && activePageIdx == 1, + ((1 - (offsetRatio * 4) % 1) == 1) && _activePageIdx == 1, ), ), ), @@ -253,15 +258,15 @@ class HomeViewState extends State { ), ], onTap: (index) async { - activePageIdx = index; - await homeViewPageController.animateToPage( + _activePageIdx = index; + await _homeViewPageController.animateToPage( index, duration: const Duration(milliseconds: 100), curve: Curves.bounceIn, ); if (mounted) setState(() {}); }, - currentIndex: activePageIdx, + currentIndex: _activePageIdx, ), ); }