From 2a008f12121b88e98a2a0a11e4d7eaa1a1f27296 Mon Sep 17 00:00:00 2001 From: vishnukvmd Date: Tue, 1 Nov 2022 15:34:19 +0530 Subject: [PATCH] Minor refactor --- lib/services/authenticator_service.dart | 29 ++++++++++--------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/lib/services/authenticator_service.dart b/lib/services/authenticator_service.dart index 934b037a0..4d739d1bb 100644 --- a/lib/services/authenticator_service.dart +++ b/lib/services/authenticator_service.dart @@ -108,28 +108,14 @@ class AuthenticatorService { try { _logger.info("Sync"); _logger.info("State of DB before sync"); - _logger.info("_____"); - var entities = await _db.getAll(); - for (final entity in entities) { - _logger.info(entity.id); - } + await _printDBState(); await _remoteToLocalSync(); _logger.info("remote fetch completed"); _logger.info("State of DB after remoteToLocal sync"); - _logger.info("_____"); - entities = await _db.getAll(); - for (final entity in entities) { - _logger.info(entity.id); - } - _logger.info("_____"); + await _printDBState(); await _localToRemoteSync(); _logger.info("State of DB after localToRemote sync"); - _logger.info("_____"); - entities = await _db.getAll(); - for (final entity in entities) { - _logger.info(entity.id); - } - _logger.info("_____"); + await _printDBState(); _logger.info("local push completed"); Bus.instance.fire(CodesUpdatedEvent()); } catch (e) { @@ -222,4 +208,13 @@ class AuthenticatorService { rethrow; } } + + Future _printDBState() async { + _logger.info("_____"); + final entities = await _db.getAll(); + for (final entity in entities) { + _logger.info(entity.id); + } + _logger.info("_____"); + } }