27 lines
968 B
Dart
27 lines
968 B
Dart
import 'package:firebase_messaging/firebase_messaging.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter_app_badge/flutter_app_badge.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
import '../main.dart';
|
|
import '../model/chatList/chatListProps.dart';
|
|
import '../model/chatList/chatProps.dart';
|
|
import '../state/app/modules/app_modules.dart';
|
|
|
|
class NotificationTasks {
|
|
static void updateBadgeCount(RemoteMessage notification) {
|
|
FlutterAppBadge.count(int.parse(notification.data['unreadCount'] ?? 0));
|
|
}
|
|
|
|
static void updateProviders(BuildContext context) {
|
|
Provider.of<ChatListProps>(context, listen: false).run(renew: true);
|
|
Provider.of<ChatProps>(context, listen: false).run();
|
|
}
|
|
|
|
static void navigateToTalk(BuildContext context) {
|
|
var talkTab = AppModule.getBottomBarModules(context).map((e) => e.module).toList().indexOf(Modules.talk);
|
|
if(talkTab == -1) return;
|
|
Main.bottomNavigator.jumpToTab(talkTab);
|
|
}
|
|
}
|