Added functionality to jump to talk-tab when app is launched via notification
This commit is contained in:
parent
248483be4e
commit
6d48d299b5
@ -2,4 +2,9 @@ class ApiError {
|
|||||||
String message;
|
String message;
|
||||||
|
|
||||||
ApiError(this.message);
|
ApiError(this.message);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return "ApiError: $message";
|
||||||
|
}
|
||||||
}
|
}
|
@ -23,12 +23,13 @@ import 'view/pages/timetable/timetable.dart';
|
|||||||
class App extends StatefulWidget {
|
class App extends StatefulWidget {
|
||||||
const App({Key? key}) : super(key: key);
|
const App({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
static PersistentTabController bottomNavigator = PersistentTabController(initialIndex: 0);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<App> createState() => _AppState();
|
State<App> createState() => _AppState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AppState extends State<App> {
|
class _AppState extends State<App> {
|
||||||
int currentPage = 0;
|
|
||||||
late Timer refetchChats;
|
late Timer refetchChats;
|
||||||
late Timer updateTimings;
|
late Timer updateTimings;
|
||||||
|
|
||||||
@ -68,11 +69,9 @@ class _AppState extends State<App> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
PersistentTabController tabController = PersistentTabController(initialIndex: 0);
|
|
||||||
|
|
||||||
return PersistentTabView(
|
return PersistentTabView(
|
||||||
context,
|
context,
|
||||||
controller: tabController,
|
controller: App.bottomNavigator,
|
||||||
navBarStyle: NavBarStyle.style6,
|
navBarStyle: NavBarStyle.style6,
|
||||||
hideNavigationBarWhenKeyboardShows: true,
|
hideNavigationBarWhenKeyboardShows: true,
|
||||||
navBarHeight: MediaQuery.of(context).viewInsets.bottom > 0 ? 0.0 : kBottomNavigationBarHeight,
|
navBarHeight: MediaQuery.of(context).viewInsets.bottom > 0 ? 0.0 : kBottomNavigationBarHeight,
|
||||||
|
@ -44,6 +44,7 @@ class NotificationController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Future<void> onAppOpenedByNotification(RemoteMessage message, BuildContext context) async {
|
static Future<void> onAppOpenedByNotification(RemoteMessage message, BuildContext context) async {
|
||||||
|
NotificationTasks.navigateToTalk();
|
||||||
NotificationTasks.updateProviders(context);
|
NotificationTasks.updateProviders(context);
|
||||||
|
|
||||||
DebugTile(context).run(() {
|
DebugTile(context).run(() {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter_app_badger/flutter_app_badger.dart';
|
import 'package:flutter_app_badger/flutter_app_badger.dart';
|
||||||
|
import 'package:marianum_mobile/app.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import '../model/chatList/chatListProps.dart';
|
import '../model/chatList/chatListProps.dart';
|
||||||
@ -17,6 +18,6 @@ class NotificationTasks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void navigateToTalk() {
|
static void navigateToTalk() {
|
||||||
// TODO Navigate
|
App.bottomNavigator.jumpToTab(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user