showSyncResultNotification static method

Future<void> showSyncResultNotification({
  1. required String title,
  2. required String body,
  3. bool isSuccess = true,
})

Mostra notificação de resultado da sincronização

Implementation

static Future<void> showSyncResultNotification({
  required String title,
  required String body,
  bool isSuccess = true,
}) async {
  try {
    final syncConfig = _getSyncConfig();
    if (syncConfig == null || !syncConfig.enableNotifications) {
      return;
    }

    // Verificar se as notificações estão habilitadas
    final areEnabled = await syncConfig.areNotificationsEnabled();
    if (!areEnabled) {
      SyncUtils.debugLog('Notificações não estão habilitadas', tag: 'BackgroundSyncService');
      return;
    }

    await syncConfig.showNotification(
      title: title,
      message: body,
      notificationId: SyncConstants.syncNotificationId,
    );
  } catch (e) {
    SyncUtils.debugLog('Erro ao mostrar notificação de resultado: $e', tag: 'BackgroundSyncService');
  }
}