TF-438 Remove func not used

This commit is contained in:
dab246
2022-11-25 13:54:46 +07:00
committed by Dat H. Pham
parent f3f2c19f20
commit 44bb192a8f
5 changed files with 9 additions and 21 deletions
@@ -12,7 +12,6 @@ class FcmConfiguration {
static void _initMessageListener() {
FcmReceiver.instance.onForegroundMessage();
FcmReceiver.instance.onMessageOpenedApp();
FcmReceiver.instance.onBackgroundMessage();
FcmReceiver.instance.getFcmToken();
}
@@ -142,10 +142,10 @@ class FcmController extends BaseController {
FcmInteractorBindings().dependencies();
});
_getInteractorBindings();
return await _getInteractorBindings();
}
void _getInteractorBindings() {
Future<void> _getInteractorBindings() {
try {
_getAuthenticatedAccountInteractor = Get.find<GetAuthenticatedAccountInteractor>();
_dynamicUrlInterceptors = Get.find<DynamicUrlInterceptors>();
@@ -154,9 +154,10 @@ class FcmController extends BaseController {
} catch (e) {
logError('FcmController::_getBindings(): ${e.toString()}');
}
return Future.value(null);
}
void _getAuthenticatedAccount() async {
void _getAuthenticatedAccount() {
if (_getAuthenticatedAccountInteractor != null) {
consumeState(_getAuthenticatedAccountInteractor!.execute());
} else {
@@ -171,6 +172,7 @@ class FcmController extends BaseController {
}
void _handleSuccessViewState(Success success) {
log('FcmController::_handleSuccessViewState(): $success');
if (success is GetStoredTokenOidcSuccess) {
_getSessionWithTokenOidc(success);
} else if (success is GetCredentialViewState) {
@@ -198,7 +200,7 @@ class FcmController extends BaseController {
_getSession();
}
void _getSession() async {
void _getSession() {
if (_getSessionInteractor != null) {
consumeState(_getSessionInteractor!.execute().asStream());
} else {
@@ -123,7 +123,7 @@ class EmailChangeListener extends ChangeListener {
);
}
void consumeState(Stream<Either<Failure, Success>> newStateStream) async {
void consumeState(Stream<Either<Failure, Success>> newStateStream) {
newStateStream.listen(
_handleStateStream,
onError: (error, stackTrace) {
@@ -21,10 +21,6 @@ class FcmReceiver {
FirebaseMessaging.onMessage.listen(FcmService.instance.handleFirebaseForegroundMessage);
}
void onMessageOpenedApp() {
FirebaseMessaging.onMessageOpenedApp.listen(FcmService.instance.handleFirebaseMessageOpenedApp);
}
void onBackgroundMessage() {
FirebaseMessaging.onBackgroundMessage(handleFirebaseBackgroundMessage);
}
@@ -17,7 +17,6 @@ class FcmService {
Stream<RemoteMessage> get backgroundMessageStream => backgroundMessageStreamController.stream;
FirebaseToken? currentToken;
int semaphore = 0;
FcmService._internal();
@@ -26,12 +25,8 @@ class FcmService {
static FcmService get instance => _instance;
void handleFirebaseForegroundMessage(RemoteMessage newRemoteMessage) {
if (semaphore != 0) {
return;
}
semaphore = 1;
Future.delayed(const Duration(milliseconds: durationMessageComing)).then((_) => semaphore = 0);
log('FcmService::handleFirebaseForegroundMessage():messageId: ${newRemoteMessage.messageId}');
log('FcmService::handleFirebaseForegroundMessage():message: ${newRemoteMessage.data}');
foregroundMessageStreamController.add(newRemoteMessage);
}
@@ -40,10 +35,6 @@ class FcmService {
backgroundMessageStreamController.add(newRemoteMessage);
}
void handleFirebaseMessageOpenedApp(RemoteMessage newRemoteMessage) {
log('FcmService::handleFirebaseMessageOpenedApp():newRemoteMessage: ${newRemoteMessage.data}');
}
void _closeStream() {
foregroundMessageStreamController.close();
backgroundMessageStreamController.close();