Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
291 changes: 0 additions & 291 deletions school_data_hub_flutter/.cursorrules

This file was deleted.

2 changes: 2 additions & 0 deletions school_data_hub_flutter/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ test_enc.dart
decrypt_files.dart
**/scripts/
cursor_docs/
test_enc.dart
.cursorrules

# Flutter/Dart/Pub related
**/doc/api/
Expand Down
2 changes: 1 addition & 1 deletion school_data_hub_flutter/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include: package:flutter_lints/flutter.yaml
linter:
rules:
avoid_print: false # Allow print statements, useful for debugging
unused_local_variable: ignore # Ignore warnings about unused local variables
# unused_local_variable: ignore # Ignore warnings about unused local variables
always_declare_return_types: true # Ensure all methods have a return type
prefer_const_constructors: true # Prefer const constructors for better performance
avoid_unnecessary_containers: true # Avoid redundant containers in UI
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:logging/logging.dart';
import 'package:school_data_hub_flutter/common/services/notification_service.dart';
import 'package:school_data_hub_flutter/common/widgets/generic_components/bottom_nav_bar_no_filter_button.dart';
import 'package:school_data_hub_flutter/common/widgets/generic_components/generic_app_bar.dart';
import 'package:school_data_hub_flutter/core/updater/shorebird_update_manager.dart';
Expand All @@ -9,14 +10,14 @@ import 'package:watch_it/watch_it.dart';

final _log = Logger('CheckForUpdatesPage');

class CheckForUpdatesPage extends StatefulWidget {
const CheckForUpdatesPage({super.key});
class ShorebirdCodePushPage extends WatchingStatefulWidget {
const ShorebirdCodePushPage({super.key});

@override
State<CheckForUpdatesPage> createState() => _CheckForUpdatesPageState();
State<ShorebirdCodePushPage> createState() => _ShorebirdCodePushPageState();
}

class _CheckForUpdatesPageState extends State<CheckForUpdatesPage> {
class _ShorebirdCodePushPageState extends State<ShorebirdCodePushPage> {
final _updater = di<ShorebirdUpdateManager>().shorebirdUpdater;
late final bool _isUpdaterAvailable;
var _currentTrack = UpdateTrack.stable;
Expand Down Expand Up @@ -123,26 +124,15 @@ class _CheckForUpdatesPageState extends State<CheckForUpdatesPage> {
}

void _showRestartBanner() {
ScaffoldMessenger.of(context)
..hideCurrentMaterialBanner()
..showMaterialBanner(
MaterialBanner(
content: const Text(
'Ein neuer Patch ist verfügbar! Bitte starte die App neu.',
),
actions: [
TextButton(
onPressed: () {
ScaffoldMessenger.of(context).hideCurrentMaterialBanner();
},
child: const Text('Verstanden'),
),
],
),
);
di<NotificationService>().showInformationDialog(
'Ein neuer Patch ist verfügbar! Bitte starte die App neu.',
);
}

void _showErrorBanner(Object error) {
di<NotificationService>().showInformationDialog(
'Fehler beim Herunterladen des Updates: $error.',
);
ScaffoldMessenger.of(context)
..hideCurrentMaterialBanner()
..showMaterialBanner(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ShorebirdUpdateManager extends ChangeNotifier {

// Auto-update settings
bool _autoCheckEnabled = true;
Duration _autoCheckInterval = const Duration(hours: 6);
Duration _autoCheckInterval = const Duration(hours: 2);
Timer? _autoCheckTimer;

// Getters
Expand Down Expand Up @@ -137,8 +137,15 @@ class ShorebirdUpdateManager extends ChangeNotifier {
_log.info('Update available');
_updateAvailable = true;
_setStatus(UpdateManagerStatus.updateAvailable);
di<NotificationService>().showSnackBar(
NotificationType.info,
'Ein Update wird heruntergeladen...',
);
await _updater.update(track: _currentTrack);

di<NotificationService>().showInformationDialog(
'Ein Update wurde installiert. Bitte starten Sie die App neu, um die neueste Version der App zu verwenden.',
);
_setStatus(UpdateManagerStatus.restartRequired);
return true;

case UpdateStatus.restartRequired:
Expand Down
Loading