Fix: Start in chat, if configured
Some checks are pending
Flutter analyze & test / flutter_analyze_and_test (push) Waiting to run

This commit is contained in:
otsmr 2026-04-20 12:52:25 +02:00
parent f321e35027
commit 60e5a5c7cc
5 changed files with 33 additions and 21 deletions

View file

@ -2,8 +2,9 @@
## 0.1.6 ## 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: Phantom push notification
- Fix: Start in chat, if configured
- Fix: Smaller UI fixes - Fix: Smaller UI fixes
## 0.1.5 ## 0.1.5

View file

@ -214,6 +214,8 @@ Future<void> showLocalPushNotification(
pushNotification.kind == PushKind.reactionToText || pushNotification.kind == PushKind.reactionToText ||
pushNotification.kind == PushKind.reactionToAudio)) { pushNotification.kind == PushKind.reactionToAudio)) {
payload = Routes.chatsMessages(groupId); payload = Routes.chatsMessages(groupId);
} else {
payload = Routes.chats;
} }
await flutterLocalNotificationsPlugin.show( await flutterLocalNotificationsPlugin.show(

View file

@ -40,10 +40,12 @@ class _TypingIndicatorSubtitleState extends State<TypingIndicatorSubtitle> {
} }
void filterOpenUsers(List<GroupMember> input) { void filterOpenUsers(List<GroupMember> input) {
if (mounted) {
setState(() { setState(() {
_groupMembers = input.where(isTyping).toList(); _groupMembers = input.where(isTyping).toList();
}); });
} }
}
@override @override
void dispose() { void dispose() {

View file

@ -66,10 +66,12 @@ class _TypingIndicatorState extends State<TypingIndicator> {
} }
void filterOpenUsers(List<GroupMember> input) { void filterOpenUsers(List<GroupMember> input) {
if (mounted) {
setState(() { setState(() {
_groupMembers = input.where(hasChatOpen).toList(); _groupMembers = input.where(hasChatOpen).toList();
}); });
} }
}
@override @override
void dispose() { void dispose() {

View file

@ -49,11 +49,11 @@ class Shade extends StatelessWidget {
} }
class HomeViewState extends State<HomeView> { class HomeViewState extends State<HomeView> {
int activePageIdx = 0; int _activePageIdx = 1;
final MainCameraController _mainCameraController = MainCameraController(); final MainCameraController _mainCameraController = MainCameraController();
final PageController homeViewPageController = PageController(initialPage: 1); final PageController _homeViewPageController = PageController(initialPage: 1);
late StreamSubscription<List<SharedFile>> _intentStreamSub; late StreamSubscription<List<SharedFile>> _intentStreamSub;
late StreamSubscription<Uri> _deepLinkSub; late StreamSubscription<Uri> _deepLinkSub;
@ -67,10 +67,10 @@ class HomeViewState extends State<HomeView> {
bool onPageView(ScrollNotification notification) { bool onPageView(ScrollNotification notification) {
disableCameraTimer?.cancel(); disableCameraTimer?.cancel();
if (notification.depth == 0 && notification is ScrollUpdateNotification) { if (notification.depth == 0 && notification is ScrollUpdateNotification) {
final page = homeViewPageController.page ?? 0; final page = _homeViewPageController.page ?? 0;
lastChange = page; lastChange = page;
setState(() { setState(() {
offsetFromOne = 1.0 - (homeViewPageController.page ?? 0); offsetFromOne = 1.0 - (_homeViewPageController.page ?? 0);
offsetRatio = offsetFromOne.abs(); offsetRatio = offsetFromOne.abs();
}); });
} }
@ -100,17 +100,17 @@ class HomeViewState extends State<HomeView> {
_mainCameraController.setState = () { _mainCameraController.setState = () {
if (mounted) setState(() {}); if (mounted) setState(() {});
}; };
activePageIdx = widget.initialPage;
globalUpdateOfHomeViewPageIndex = (index) { globalUpdateOfHomeViewPageIndex = (index) {
homeViewPageController.jumpToPage(index); _homeViewPageController.jumpToPage(index);
setState(() { setState(() {
activePageIdx = index; _activePageIdx = index;
}); });
}; };
selectNotificationStream.stream.listen((response) async { selectNotificationStream.stream.listen((response) async {
if (response.payload != null && if (response.payload != null &&
response.payload!.startsWith(Routes.chats)) { response.payload!.startsWith(Routes.chats) &&
response.payload! != Routes.chats) {
await routerProvider.push(response.payload!); await routerProvider.push(response.payload!);
} }
globalUpdateOfHomeViewPageIndex(0); globalUpdateOfHomeViewPageIndex(0);
@ -134,6 +134,11 @@ class HomeViewState extends State<HomeView> {
context, context,
_mainCameraController.setSharedLinkForPreview, _mainCameraController.setSharedLinkForPreview,
); );
WidgetsBinding.instance.addPostFrameCallback((_) {
if (widget.initialPage == 0) {
globalUpdateOfHomeViewPageIndex(0);
}
});
} }
@override @override
@ -196,10 +201,10 @@ class HomeViewState extends State<HomeView> {
onNotification: onPageView, onNotification: onPageView,
child: Positioned.fill( child: Positioned.fill(
child: PageView( child: PageView(
controller: homeViewPageController, controller: _homeViewPageController,
onPageChanged: (index) { onPageChanged: (index) {
setState(() { setState(() {
activePageIdx = index; _activePageIdx = index;
}); });
}, },
children: [ children: [
@ -222,7 +227,7 @@ class HomeViewState extends State<HomeView> {
child: CameraPreviewControllerView( child: CameraPreviewControllerView(
mainController: _mainCameraController, mainController: _mainCameraController,
isVisible: isVisible:
((1 - (offsetRatio * 4) % 1) == 1) && activePageIdx == 1, ((1 - (offsetRatio * 4) % 1) == 1) && _activePageIdx == 1,
), ),
), ),
), ),
@ -253,15 +258,15 @@ class HomeViewState extends State<HomeView> {
), ),
], ],
onTap: (index) async { onTap: (index) async {
activePageIdx = index; _activePageIdx = index;
await homeViewPageController.animateToPage( await _homeViewPageController.animateToPage(
index, index,
duration: const Duration(milliseconds: 100), duration: const Duration(milliseconds: 100),
curve: Curves.bounceIn, curve: Curves.bounceIn,
); );
if (mounted) setState(() {}); if (mounted) setState(() {});
}, },
currentIndex: activePageIdx, currentIndex: _activePageIdx,
), ),
); );
} }