LCOV - code coverage report
Current view: top level - lib/_classes/integration/notification - notification_background.dart Coverage Total Hit
Test: lcov.info Lines: 0.0 % 18 0
Test Date: 2026-12-05 10:50:38 Functions: - 0 0

            Line data    Source code
       1              : // Copyright 2026 The terCAD team. All rights reserved.
       2              : // Use of this source code is governed by a CC BY-NC-ND 4.0 license that can be found in the LICENSE file.
       3              : 
       4              : import 'dart:async';
       5              : 
       6              : import 'package:app_finance/_classes/herald/app_sync.dart';
       7              : import 'package:app_finance/_classes/integration/notification/notification_channel.dart';
       8              : import 'package:app_finance/_classes/integration/notification/notification_controller.dart';
       9              : import 'package:app_finance/_classes/storage/app_data.dart';
      10              : import 'package:app_finance/_classes/storage/app_preferences.dart';
      11              : import 'package:flutter/widgets.dart';
      12              : import 'package:flutter_currency_picker/flutter_currency_picker.dart';
      13              : import 'package:shared_preferences/shared_preferences.dart';
      14              : 
      15              : class NotificationBackground {
      16            0 :   static Future<void> run() async {
      17            0 :     WidgetsFlutterBinding.ensureInitialized();
      18              :     try {
      19            0 :       AppPreferences.pref = await SharedPreferences.getInstance();
      20            0 :       CurrencyDefaults.cache = AppPreferences.pref;
      21            0 :       final state = AppData(AppSync(isOnline: false));
      22            0 :       await loaded(state);
      23            0 :       await NotificationController.instance.attachBackground(state);
      24              :     } catch (_) {
      25            0 :       await const NotificationChannel().done(0);
      26              :     }
      27              :   }
      28              : 
      29            0 :   static Future<void> loaded(AppData state) {
      30            0 :     if (!state.isLoading) {
      31            0 :       return Future.value();
      32              :     }
      33            0 :     final completer = Completer<void>();
      34            0 :     void listener() {
      35            0 :       if (!state.isLoading && !completer.isCompleted) {
      36            0 :         state.removeListener(listener);
      37            0 :         completer.complete();
      38              :       }
      39              :     }
      40              : 
      41            0 :     state.addListener(listener);
      42            0 :     return completer.future;
      43              :   }
      44              : }
        

Generated by: LCOV version 2.0-1