import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_app_badger/flutter_app_badger.dart';
import 'package:provider/provider.dart';

import '../app.dart';
import '../model/chatList/chatListProps.dart';
import '../model/chatList/chatProps.dart';

class NotificationTasks {
  static void updateBadgeCount(RemoteMessage notification) {
    FlutterAppBadger.updateBadgeCount(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() {
    App.bottomNavigator.jumpToTab(1);
  }
}