folder restructuring
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_app_badge/flutter_app_badge.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../routing/app_routes.dart';
|
||||
import '../state/app/modules/chat/bloc/chat_bloc.dart';
|
||||
import '../state/app/modules/chatList/bloc/chat_list_bloc.dart';
|
||||
|
||||
class NotificationTasks {
|
||||
static void updateBadgeCount(RemoteMessage notification) {
|
||||
FlutterAppBadge.count(int.parse(notification.data['unreadCount'] ?? '0'));
|
||||
}
|
||||
|
||||
static void updateProviders(BuildContext context) {
|
||||
context.read<ChatListBloc>().refresh();
|
||||
context.read<ChatBloc>().refresh();
|
||||
}
|
||||
|
||||
/// Switches to the Talk tab. If [chatToken] is provided, also schedules
|
||||
/// the matching chat to be opened automatically once the chat list view
|
||||
/// resolves the token (handled inside [ChatList]).
|
||||
static void navigateToTalk(BuildContext context, {String? chatToken}) {
|
||||
if (chatToken != null && chatToken.isNotEmpty) {
|
||||
AppRoutes.openChatByToken(context, chatToken);
|
||||
} else {
|
||||
AppRoutes.goToTalkTab(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user