Fix: Macht die BackgroundWorker für den IsolateManager on Web möglich

This commit is contained in:
2026-01-05 02:12:38 +01:00
parent 6f3d987d19
commit caf50aa8d2
9 changed files with 8917 additions and 8588 deletions

View File

@@ -0,0 +1,6 @@
import '../../Controller/port_controller.dart';
/// Aktualisiert die Transaktionen, die angezeigt werden
void updateTransactions() {
PortController().getPort('update-transactions')?.send('ready');
}

View File

@@ -0,0 +1,19 @@
/// Utility functions for working with dates.
class DateUtils {
/// Returns a [DateTime] that is [monthDate] with the added number
/// of months and the day set to 1 and time set to midnight.
///
/// For example:
///
/// ```dart
/// DateTime date = DateTime(2019, 1, 15);
/// DateTime futureDate = DateUtils.addMonthsToMonthDate(date, 3);
/// ```
///
/// `date` would be January 15, 2019.
/// `futureDate` would be April 1, 2019 since it adds 3 months.
static DateTime addMonthsToMonthDate(
final DateTime monthDate,
final int monthsToAdd,
) => DateTime(monthDate.year, monthDate.month + monthsToAdd);
}

View File

@@ -0,0 +1,7 @@
/// Ein Stub
class LocalNotifications {
/// Ein Stub
Future<void> showTransactionsToCheckNotification(
final List<dynamic> transactions,
) async {}
}

View File

@@ -0,0 +1,2 @@
/// Ein Stub
void updateTransactions() {}

View File

@@ -1,6 +1,6 @@
import 'package:logger/logger.dart';
/// Initialisiert benötigte Services in Background-Isolates für Web
/// Initialisiert benötigte Services in Background-Isolates für PlatformDependent
Future<void> initBackground() async {
Logger().d('Init Background for Web');
Logger().d('Init Background for PlatformDependent');
}

View File

@@ -1,14 +1,14 @@
import 'dart:async';
import 'package:drift/drift.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:logger/logger.dart';
import '../Controller/port_controller.dart';
import '../Controller/transaction_controller.dart';
import '../Entities/drift_database.dart';
import '../Entities/time_frame_enum.dart';
import '../PlatformDependent/Web/date_utils_web.dart'
if (dart.library.io) 'package:flutter/material.dart';
import '../PlatformDependent/Web/update_transactions.dart'
if (dart.library.io) '../PlatformDependent/Native/update_transactions.dart';
import '../Repositories/recurring_transacation_repository.dart';
import '../Repositories/transaction_repository.dart';
import 'task.dart';
@@ -48,11 +48,7 @@ class GenerateTransactionsTask extends Task {
_logger.i('Generating transactions completed.');
if (!kIsWeb) {
PortController().getPort('update-transactions')?.send('ready');
} else {
unawaited(TransactionController().updateTransactions());
}
updateTransactions();
return true;
}

View File

@@ -1,7 +1,8 @@
import 'package:logger/logger.dart';
import '../Controller/local_notifications.dart';
import '../Entities/drift_database.dart';
import '../PlatformDependent/Web/local_notifications_web_stub.dart'
if (dart.library.io) '../Controller/local_notifications.dart';
import '../Repositories/transaction_repository.dart';
import 'task.dart';
@@ -18,6 +19,7 @@ class ShowNotificationsTask extends Task {
if (transactions.isNotEmpty) {
Logger().i('Showing notification for unchecked transactions...');
await LocalNotifications().showTransactionsToCheckNotification(
transactions,
);

View File

@@ -0,0 +1 @@
// TODO Implement this library.

File diff suppressed because one or more lines are too long