diff --git a/lib/features/base/base_controller.dart b/lib/features/base/base_controller.dart index 24bbc9f8a3..4fbb329ba5 100644 --- a/lib/features/base/base_controller.dart +++ b/lib/features/base/base_controller.dart @@ -46,7 +46,9 @@ import 'package:tmail_ui_user/features/push_notification/domain/usecases/get_sto import 'package:tmail_ui_user/features/push_notification/presentation/bindings/fcm_interactor_bindings.dart'; import 'package:tmail_ui_user/features/push_notification/presentation/config/fcm_configuration.dart'; import 'package:tmail_ui_user/features/push_notification/presentation/controller/fcm_message_controller.dart'; +import 'package:tmail_ui_user/features/push_notification/presentation/controller/fcm_token_controller.dart'; import 'package:tmail_ui_user/features/push_notification/presentation/services/fcm_receiver.dart'; +import 'package:tmail_ui_user/features/push_notification/presentation/services/fcm_service.dart'; import 'package:tmail_ui_user/main/bindings/network/binding_tag.dart'; import 'package:tmail_ui_user/main/error/capability_validator.dart'; import 'package:tmail_ui_user/main/exceptions/remote_exception.dart'; @@ -268,7 +270,10 @@ abstract class BaseController extends GetxController await AppUtils.loadFcmConfigFileToEnv(currentMapEnvData: mapEnvData); await FcmConfiguration.initialize(); FcmInteractorBindings().dependencies(); - FcmMessageController.instance.initializeFromAccountId(accountId, session); + FcmService.instance.initialStreamController(); + FcmMessageController.instance.initialize(accountId: accountId, session: session); + FcmTokenController.instance.initialBindingInteractor(); + await FcmReceiver.instance.onInitialFcmListener(); } else { throw NotSupportFCMException(); } @@ -355,7 +360,7 @@ abstract class BaseController extends GetxController authorizationInterceptors.clear(); authorizationIsolateInterceptors.clear(); if (_isFcmEnabled) { - _fcmReceiver.deleteFcmToken(); + await _fcmReceiver.deleteFcmToken(); } await cachingManager.closeHive(); } @@ -372,7 +377,7 @@ abstract class BaseController extends GetxController authorizationIsolateInterceptors.clear(); authorizationInterceptors.clear(); if (_isFcmEnabled) { - _fcmReceiver.deleteFcmToken(); + await _fcmReceiver.deleteFcmToken(); } await cachingManager.closeHive(); } diff --git a/lib/features/mailbox_dashboard/presentation/bindings/mailbox_dashboard_bindings.dart b/lib/features/mailbox_dashboard/presentation/bindings/mailbox_dashboard_bindings.dart index 69a1c91234..b248b23e96 100644 --- a/lib/features/mailbox_dashboard/presentation/bindings/mailbox_dashboard_bindings.dart +++ b/lib/features/mailbox_dashboard/presentation/bindings/mailbox_dashboard_bindings.dart @@ -25,8 +25,6 @@ import 'package:tmail_ui_user/features/email/domain/usecases/mark_as_email_read_ import 'package:tmail_ui_user/features/email/domain/usecases/mark_as_star_email_interactor.dart'; import 'package:tmail_ui_user/features/email/domain/usecases/move_to_mailbox_interactor.dart'; import 'package:tmail_ui_user/features/email/domain/usecases/unsubscribe_email_interactor.dart'; -import 'package:tmail_ui_user/features/email/presentation/controller/email_supervisor_controller.dart'; -import 'package:tmail_ui_user/features/email/presentation/controller/single_email_controller.dart'; import 'package:tmail_ui_user/features/email/presentation/bindings/email_bindings.dart'; import 'package:tmail_ui_user/features/home/domain/repository/session_repository.dart'; import 'package:tmail_ui_user/features/home/domain/usecases/store_session_interactor.dart'; @@ -42,7 +40,6 @@ import 'package:tmail_ui_user/features/mailbox/data/repository/mailbox_repositor import 'package:tmail_ui_user/features/mailbox/domain/repository/mailbox_repository.dart'; import 'package:tmail_ui_user/features/mailbox/domain/usecases/mark_as_mailbox_read_interactor.dart'; import 'package:tmail_ui_user/features/mailbox/presentation/mailbox_bindings.dart'; -import 'package:tmail_ui_user/features/mailbox/presentation/mailbox_controller.dart'; import 'package:tmail_ui_user/features/mailbox_dashboard/data/datasource/search_datasource.dart'; import 'package:tmail_ui_user/features/mailbox_dashboard/data/datasource/session_storage_composer_datasource.dart'; import 'package:tmail_ui_user/features/mailbox_dashboard/data/datasource/spam_report_datasource.dart'; @@ -92,7 +89,6 @@ import 'package:tmail_ui_user/features/sending_queue/domain/usecases/store_sendi import 'package:tmail_ui_user/features/sending_queue/domain/usecases/update_sending_email_interactor.dart'; import 'package:tmail_ui_user/features/sending_queue/presentation/bindings/sending_queue_bindings.dart'; import 'package:tmail_ui_user/features/sending_queue/presentation/bindings/sending_queue_interactor_bindings.dart'; -import 'package:tmail_ui_user/features/sending_queue/presentation/sending_queue_controller.dart'; import 'package:tmail_ui_user/features/thread/data/datasource/thread_datasource.dart'; import 'package:tmail_ui_user/features/thread/data/datasource_impl/local_thread_datasource_impl.dart'; import 'package:tmail_ui_user/features/thread/data/datasource_impl/thread_datasource_impl.dart'; @@ -110,7 +106,6 @@ import 'package:tmail_ui_user/features/thread/domain/usecases/move_multiple_emai import 'package:tmail_ui_user/features/thread/domain/usecases/search_email_interactor.dart'; import 'package:tmail_ui_user/features/thread/domain/usecases/search_more_email_interactor.dart'; import 'package:tmail_ui_user/features/thread/presentation/thread_bindings.dart'; -import 'package:tmail_ui_user/features/thread/presentation/thread_controller.dart'; import 'package:tmail_ui_user/main/exceptions/cache_exception_thrower.dart'; import 'package:tmail_ui_user/main/exceptions/remote_exception_thrower.dart'; @@ -356,13 +351,4 @@ class MailboxDashBoardBindings extends BaseBindings { }, )); } - - void deleteController() { - Get.delete(); - Get.delete(); - Get.delete(); - Get.delete(); - Get.delete(); - Get.delete(); - } } \ No newline at end of file diff --git a/lib/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart b/lib/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart index 0b2d09dcfc..d7db9a7b65 100644 --- a/lib/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart +++ b/lib/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart @@ -75,7 +75,6 @@ import 'package:tmail_ui_user/features/mailbox_dashboard/domain/state/remove_ema import 'package:tmail_ui_user/features/mailbox_dashboard/domain/usecases/get_composer_cache_on_web_interactor.dart'; import 'package:tmail_ui_user/features/mailbox_dashboard/domain/usecases/remove_email_drafts_interactor.dart'; import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/action/dashboard_action.dart'; -import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/bindings/mailbox_dashboard_bindings.dart'; import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/controller/app_grid_dashboard_controller.dart'; import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/controller/download/download_controller.dart'; import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/controller/search_controller.dart' as search; @@ -2406,7 +2405,6 @@ class MailboxDashBoardController extends ReloadableController { _notificationManager.closeStream(); _fcmService.closeStream(); BackButtonInterceptor.removeByName(AppRoutes.dashboard); - MailboxDashBoardBindings().deleteController(); super.onClose(); } } \ No newline at end of file diff --git a/lib/features/push_notification/data/local/fcm_cache_manager.dart b/lib/features/push_notification/data/local/fcm_cache_manager.dart index cadc2150b8..8b2857e923 100644 --- a/lib/features/push_notification/data/local/fcm_cache_manager.dart +++ b/lib/features/push_notification/data/local/fcm_cache_manager.dart @@ -1,5 +1,6 @@ import 'package:fcm/model/type_name.dart'; import 'package:jmap_dart_client/jmap/account_id.dart'; +import 'package:jmap_dart_client/jmap/core/state.dart' as jmap; import 'package:jmap_dart_client/jmap/core/user_name.dart'; import 'package:model/extensions/account_id_extensions.dart'; import 'package:tmail_ui_user/features/caching/clients/fcm_cache_client.dart'; @@ -7,7 +8,6 @@ import 'package:tmail_ui_user/features/caching/clients/firebase_registration_cac import 'package:tmail_ui_user/features/caching/utils/cache_utils.dart'; import 'package:tmail_ui_user/features/push_notification/data/model/firebase_registration_cache.dart'; import 'package:tmail_ui_user/features/push_notification/domain/exceptions/fcm_exception.dart'; -import 'package:jmap_dart_client/jmap/core/state.dart' as jmap; class FCMCacheManager { final FcmCacheClient _fcmCacheClient; @@ -62,4 +62,11 @@ class FCMCacheManager { Future deleteFirebaseRegistration() async { await _firebaseRegistrationCacheClient.deleteItem(FirebaseRegistrationCache.keyCacheValue); } + + Future closeCacheBox() async { + await Future.wait([ + _fcmCacheClient.closeBox(), + _firebaseRegistrationCacheClient.closeBox(), + ]); + } } \ No newline at end of file diff --git a/lib/features/push_notification/presentation/config/fcm_configuration.dart b/lib/features/push_notification/presentation/config/fcm_configuration.dart index 3693af26b5..33f996f020 100644 --- a/lib/features/push_notification/presentation/config/fcm_configuration.dart +++ b/lib/features/push_notification/presentation/config/fcm_configuration.dart @@ -1,22 +1,9 @@ import 'package:firebase_core/firebase_core.dart'; import 'package:tmail_ui_user/features/push_notification/presentation/config/firebase_options.dart'; -import 'package:tmail_ui_user/features/push_notification/presentation/services/fcm_receiver.dart'; -import 'package:tmail_ui_user/features/push_notification/presentation/services/fcm_service.dart'; class FcmConfiguration { - static Future initialize() async { await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); - await FcmService.instance.recreateStreamController(); - _initMessageListener(); - } - - static void _initMessageListener() { - FcmReceiver.instance.onForegroundMessage(); - FcmReceiver.instance.onBackgroundMessage(); - FcmReceiver.instance.onMessageOpenedApp(); - FcmReceiver.instance.getFcmToken(); - FcmReceiver.instance.onRefreshFcmToken(); } } \ No newline at end of file diff --git a/lib/features/push_notification/presentation/controller/fcm_message_controller.dart b/lib/features/push_notification/presentation/controller/fcm_message_controller.dart index 0213b0469b..cb4d11f2ac 100644 --- a/lib/features/push_notification/presentation/controller/fcm_message_controller.dart +++ b/lib/features/push_notification/presentation/controller/fcm_message_controller.dart @@ -28,6 +28,7 @@ import 'package:tmail_ui_user/features/login/domain/state/get_stored_token_oidc_ import 'package:tmail_ui_user/features/login/domain/usecases/get_authenticated_account_interactor.dart'; import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/bindings/mailbox_dashboard_bindings.dart'; import 'package:tmail_ui_user/features/offline_mode/manager/new_email_cache_manager.dart'; +import 'package:tmail_ui_user/features/push_notification/data/local/fcm_cache_manager.dart'; import 'package:tmail_ui_user/features/push_notification/presentation/action/fcm_action.dart'; import 'package:tmail_ui_user/features/push_notification/presentation/bindings/fcm_interactor_bindings.dart'; import 'package:tmail_ui_user/features/push_notification/presentation/controller/fcm_base_controller.dart'; @@ -52,51 +53,43 @@ class FcmMessageController extends FcmBaseController { AuthorizationInterceptors? _authorizationInterceptors; GetSessionInteractor? _getSessionInteractor; NewEmailCacheManager? _newEmailCacheManager; + FCMCacheManager? _fcmCacheManager; - FcmMessageController._internal() { - _listenFcmStream(); - } + FcmMessageController._internal(); static final FcmMessageController _instance = FcmMessageController._internal(); static FcmMessageController get instance => _instance; - void initializeFromAccountId(AccountId accountId, Session session) { + void initialize({AccountId? accountId, Session? session}) { _currentAccountId = accountId; _currentSession = session; - _userName = session.username; - FcmTokenController.instance.initialize(); - } + _userName = session?.username; - void initialize() {} - - void _listenFcmStream() async { - await Future.wait([ - listenForegroundMessageStream(), - listenBackgroundMessageStream(), - listenTokenStream() - ]); + _listenTokenStream(); + _listenForegroundMessageStream(); + _listenBackgroundMessageStream(); } - Future listenForegroundMessageStream() { - FcmService.instance.foregroundMessageStream + void _listenForegroundMessageStream() { + FcmService.instance.foregroundMessageStreamController + ?.stream .throttleTime(const Duration(milliseconds: FcmService.durationMessageComing)) .listen(_handleForegroundMessageAction); - return Future.value(); } - Future listenBackgroundMessageStream() { - FcmService.instance.backgroundMessageStream + void _listenBackgroundMessageStream() { + FcmService.instance.backgroundMessageStreamController + ?.stream .throttleTime(const Duration(milliseconds: FcmService.durationMessageComing)) .listen(_handleBackgroundMessageAction); - return Future.value(); } - Future listenTokenStream() { - FcmService.instance.fcmTokenStream - .debounceTime(const Duration(milliseconds: FcmService.durationRefreshToken)) + void _listenTokenStream() { + FcmService.instance.fcmTokenStreamController + ?.stream + .throttleTime(const Duration(milliseconds: FcmService.durationRefreshToken)) .listen(FcmTokenController.instance.onFcmTokenChanged); - return Future.value(); } void _handleForegroundMessageAction(RemoteMessage newRemoteMessage) { @@ -201,7 +194,12 @@ class FcmMessageController extends FcmBaseController { _getInteractorBindings(); - await _newEmailCacheManager?.closeNewEmailHiveCacheBox(); + await Future.wait([ + if (_newEmailCacheManager != null) + _newEmailCacheManager!.closeNewEmailHiveCacheBox(), + if (_fcmCacheManager != null) + _fcmCacheManager!.closeCacheBox(), + ]); } void _getInteractorBindings() { @@ -210,7 +208,9 @@ class FcmMessageController extends FcmBaseController { _authorizationInterceptors = getBinding(); _getSessionInteractor = getBinding(); _newEmailCacheManager = getBinding(); - FcmTokenController.instance.initialize(); + _fcmCacheManager = getBinding(); + + FcmTokenController.instance.initialBindingInteractor(); } void _getAuthenticatedAccount() { diff --git a/lib/features/push_notification/presentation/controller/fcm_token_controller.dart b/lib/features/push_notification/presentation/controller/fcm_token_controller.dart index 9666aed335..ecb70032a4 100644 --- a/lib/features/push_notification/presentation/controller/fcm_token_controller.dart +++ b/lib/features/push_notification/presentation/controller/fcm_token_controller.dart @@ -43,7 +43,7 @@ class FcmTokenController extends FcmBaseController { UpdateFirebaseRegistrationTokenInteractor? _updateFirebaseRegistrationTokenInteractor; DeleteFirebaseRegistrationCacheInteractor? _deleteFirebaseRegistrationCacheInteractor; - void initialize() { + void initialBindingInteractor() { _storeFirebaseRegistrationInteractor = getBinding(); _getFirebaseRegistrationByDeviceIdInteractor = getBinding(); _registerNewFirebaseRegistrationTokenInteractor = getBinding(); diff --git a/lib/features/push_notification/presentation/services/fcm_receiver.dart b/lib/features/push_notification/presentation/services/fcm_receiver.dart index dd8c0b83a1..9354e72d09 100644 --- a/lib/features/push_notification/presentation/services/fcm_receiver.dart +++ b/lib/features/push_notification/presentation/services/fcm_receiver.dart @@ -1,13 +1,15 @@ import 'package:core/utils/app_logger.dart'; +import 'package:core/utils/platform_info.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; +import 'package:tmail_ui_user/features/push_notification/presentation/controller/fcm_message_controller.dart'; import 'package:tmail_ui_user/features/push_notification/presentation/services/fcm_service.dart'; -import 'package:tmail_ui_user/features/push_notification/presentation/utils/fcm_utils.dart'; -import 'package:tmail_ui_user/main/utils/app_utils.dart'; +import 'package:tmail_ui_user/main/utils/app_config.dart'; @pragma('vm:entry-point') Future handleFirebaseBackgroundMessage(RemoteMessage message) async { - log('FcmReceiver::handleFirebaseBackgroundMessage(): ${message.data}'); + FcmService.instance.initialStreamController(); + FcmMessageController.instance.initialize(); FcmService.instance.handleFirebaseBackgroundMessage(message); } @@ -18,35 +20,48 @@ class FcmReceiver { static FcmReceiver get instance => _instance; - void onForegroundMessage() { + Future onInitialFcmListener() async { + log('FcmReceiver::onInitialFcmListener:'); + await _onHandleFcmToken(); + + _onForegroundMessage(); + _onBackgroundMessage(); + _onMessageOpenedApp(); + } + + void _onForegroundMessage() { FirebaseMessaging.onMessage.listen(FcmService.instance.handleFirebaseForegroundMessage); } - void onBackgroundMessage() { + void _onBackgroundMessage() { FirebaseMessaging.onBackgroundMessage(handleFirebaseBackgroundMessage); } - void onMessageOpenedApp() { + void _onMessageOpenedApp() { FirebaseMessaging.onMessageOpenedApp.listen(FcmService.instance.handleFirebaseMessageOpenedApp); } - void getFcmToken() async { - try { - final currentToken = await FirebaseMessaging.instance.getToken(vapidKey: AppUtils.fcmVapidPublicKey); - log('FcmReceiver::onFcmToken():currentToken: $currentToken'); - if (!FcmUtils.instance.isMobileAndroid) { - FcmService.instance.handleGetToken(currentToken); - } - } catch(e) { - log('FcmReceiver::onFcmToken():exception: $e'); - } + Future _getInitialToken() async { + final token = await FirebaseMessaging.instance.getToken( + vapidKey: PlatformInfo.isWeb ? AppConfig.fcmVapidPublicKeyWeb : null + ); + log('FcmReceiver::_getInitialToken:token: $token'); + return token; } - void onRefreshFcmToken() { - FirebaseMessaging.instance.onTokenRefresh.listen(FcmService.instance.handleRefreshToken); + Future _onHandleFcmToken() async { + final token = await _getInitialToken(); + FcmService.instance.handleToken(token); + + FirebaseMessaging.instance.onTokenRefresh.listen((newToken) { + log('FcmReceiver::_onHandleFcmToken:onTokenRefresh: $newToken'); + if (newToken != token) { + FcmService.instance.handleToken(newToken); + } + }); } - - void deleteFcmToken(){ - FirebaseMessaging.instance.deleteToken(); + + Future deleteFcmToken() async { + await FirebaseMessaging.instance.deleteToken(); } } \ No newline at end of file diff --git a/lib/features/push_notification/presentation/services/fcm_service.dart b/lib/features/push_notification/presentation/services/fcm_service.dart index b1d99131c0..a752a6ae46 100644 --- a/lib/features/push_notification/presentation/services/fcm_service.dart +++ b/lib/features/push_notification/presentation/services/fcm_service.dart @@ -3,7 +3,6 @@ import 'dart:async'; import 'package:core/utils/app_logger.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; -import 'package:tmail_ui_user/features/push_notification/presentation/controller/fcm_message_controller.dart'; import 'package:tmail_ui_user/features/push_notification/presentation/notification/local_notification_manager.dart'; class FcmService { @@ -11,37 +10,24 @@ class FcmService { static const int durationMessageComing = 2000; static const int durationRefreshToken = 2000; - late StreamController foregroundMessageStreamController; - Stream get foregroundMessageStream => foregroundMessageStreamController.stream; + StreamController? foregroundMessageStreamController; + StreamController? backgroundMessageStreamController; + StreamController? fcmTokenStreamController; - late StreamController backgroundMessageStreamController; - Stream get backgroundMessageStream => backgroundMessageStreamController.stream; - - late StreamController fcmTokenStreamController; - Stream get fcmTokenStream => fcmTokenStreamController.stream; - - FcmService._internal() { - foregroundMessageStreamController = StreamController.broadcast(); - backgroundMessageStreamController = StreamController.broadcast(); - fcmTokenStreamController = StreamController.broadcast(); - } + FcmService._internal(); static final FcmService _instance = FcmService._internal(); static FcmService get instance => _instance; void handleFirebaseForegroundMessage(RemoteMessage newRemoteMessage) { - log('FcmService::handleFirebaseForegroundMessage():message: ${newRemoteMessage.data}'); - if (!foregroundMessageStreamController.isClosed) { - foregroundMessageStreamController.add(newRemoteMessage); - } + log('FcmService::handleFirebaseForegroundMessage():data: ${newRemoteMessage.data}'); + foregroundMessageStreamController?.add(newRemoteMessage); } void handleFirebaseBackgroundMessage(RemoteMessage newRemoteMessage) { - FcmMessageController.instance.initialize(); - if (!backgroundMessageStreamController.isClosed) { - backgroundMessageStreamController.add(newRemoteMessage); - } + log('FcmService::handleFirebaseBackgroundMessage():data: ${newRemoteMessage.data}'); + backgroundMessageStreamController?.add(newRemoteMessage); } void handleFirebaseMessageOpenedApp(RemoteMessage newRemoteMessage) async { @@ -49,49 +35,25 @@ class FcmService { await LocalNotificationManager.instance.removeNotificationBadgeForIOS(); } - void handleGetToken(String? currentToken) async { - log('FcmService::handleGetToken():currentToken: $currentToken'); - if (fcmTokenStreamController.isClosed) { - log('FcmService::handleGetToken():fcmTokenStreamController: isClosed'); - fcmTokenStreamController = StreamController.broadcast(); - await FcmMessageController.instance.listenTokenStream(); - } - if (!fcmTokenStreamController.isClosed) { - fcmTokenStreamController.add(currentToken); - } + void handleToken(String? token) { + log('FcmService::handleToken():token: $token'); + fcmTokenStreamController?.add(token); } - void handleRefreshToken(String? newToken) async { - log('FcmService::handleRefreshToken():newToken: $newToken'); - if (fcmTokenStreamController.isClosed) { - log('FcmService::handleRefreshToken():fcmTokenStreamController: isClosed'); - fcmTokenStreamController = StreamController.broadcast(); - await FcmMessageController.instance.listenTokenStream(); - } - if (!fcmTokenStreamController.isClosed) { - fcmTokenStreamController.add(newToken); - } - } - - Future recreateStreamController() async { - if (foregroundMessageStreamController.isClosed) { - foregroundMessageStreamController = StreamController.broadcast(); - await FcmMessageController.instance.listenForegroundMessageStream(); - } - if (backgroundMessageStreamController.isClosed) { - backgroundMessageStreamController = StreamController.broadcast(); - await FcmMessageController.instance.listenBackgroundMessageStream(); - } - if (fcmTokenStreamController.isClosed) { - fcmTokenStreamController = StreamController.broadcast(); - await FcmMessageController.instance.listenTokenStream(); - } - return Future.value(); + void initialStreamController() { + log('FcmService::initialStreamController:'); + foregroundMessageStreamController = StreamController.broadcast(); + backgroundMessageStreamController = StreamController.broadcast(); + fcmTokenStreamController = StreamController.broadcast(); } void closeStream() { - foregroundMessageStreamController.close(); - backgroundMessageStreamController.close(); - fcmTokenStreamController.close(); + foregroundMessageStreamController?.close(); + backgroundMessageStreamController?.close(); + fcmTokenStreamController?.close(); + + foregroundMessageStreamController = null; + backgroundMessageStreamController = null; + fcmTokenStreamController = null; } } \ No newline at end of file diff --git a/lib/main/utils/app_utils.dart b/lib/main/utils/app_utils.dart index bce6ae53d9..7b619502e7 100644 --- a/lib/main/utils/app_utils.dart +++ b/lib/main/utils/app_utils.dart @@ -1,14 +1,13 @@ -import 'package:core/utils/platform_info.dart'; +import 'package:date_format/date_format.dart' as date_format; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:get/get.dart'; +import 'package:intl/intl.dart' as intl; import 'package:tmail_ui_user/main/localizations/app_localizations.dart'; import 'package:tmail_ui_user/main/localizations/language_code_constants.dart'; import 'package:tmail_ui_user/main/utils/app_config.dart'; import 'package:url_launcher/url_launcher.dart'; -import 'package:intl/intl.dart' as intl; -import 'package:date_format/date_format.dart' as date_format; class AppUtils { @@ -33,8 +32,6 @@ class AppUtils { ); } - static String? get fcmVapidPublicKey => PlatformInfo.isWeb ? AppConfig.fcmVapidPublicKeyWeb : null; - static bool isDirectionRTL(BuildContext context) { return intl.Bidi.isRtlLanguage(Localizations.localeOf(context).languageCode); }