Add feedback service, reminder diagnostics and smooth week transitions
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../domain/app_snapshot.dart';
|
||||
import '../domain/app_settings.dart';
|
||||
@@ -24,6 +25,7 @@ class AppController extends ChangeNotifier {
|
||||
AppSettings? _demoSettings;
|
||||
Future<void> _queue = Future.value();
|
||||
String? lastError, calendarSyncError;
|
||||
String? reminderErrorCode;
|
||||
ReminderResult reminderResult = const ReminderResult(ReminderStatus.off);
|
||||
List<Course> get visibleCourses => isDemo ? _demo : snapshot.courses;
|
||||
AppSettings get visibleSettings =>
|
||||
@@ -331,10 +333,18 @@ class AppController extends ChangeNotifier {
|
||||
settings,
|
||||
clock(),
|
||||
);
|
||||
} catch (_) {
|
||||
reminderResult = const ReminderResult(
|
||||
reminderErrorCode = null;
|
||||
} catch (error) {
|
||||
reminderErrorCode = error is ReminderSetupException
|
||||
? error.code
|
||||
: error is PlatformException
|
||||
? error.code
|
||||
: error.runtimeType.toString();
|
||||
reminderResult = ReminderResult(
|
||||
ReminderStatus.error,
|
||||
message: '提醒设置未完成,可重试',
|
||||
message: error is ReminderSetupException
|
||||
? error.message
|
||||
: '提醒设置未完成,请点击“检查提醒”后重试。',
|
||||
);
|
||||
}
|
||||
if (snapshot.calendarCleanupPending) {
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
const appVersion = '0.6.0';
|
||||
const appBuildNumber = 15;
|
||||
@@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
|
||||
import '../domain/schedule_engine.dart';
|
||||
import '../features/feedback/feedback_http_sender.dart';
|
||||
import '../features/feedback/feedback_submission.dart';
|
||||
import '../features/timetable/course_details.dart';
|
||||
|
||||
import 'app_controller.dart';
|
||||
@@ -20,11 +22,13 @@ class HepanApp extends StatelessWidget {
|
||||
this.schoolBuilder,
|
||||
this.school,
|
||||
this.notificationSelection,
|
||||
this.feedbackSender,
|
||||
});
|
||||
final AppController controller;
|
||||
final Widget Function()? schoolBuilder;
|
||||
final SchoolSession? school;
|
||||
final ValueNotifier<String?>? notificationSelection;
|
||||
final FeedbackSender? feedbackSender;
|
||||
@override
|
||||
Widget build(BuildContext context) => MaterialApp(
|
||||
debugShowCheckedModeBanner: false,
|
||||
@@ -38,6 +42,7 @@ class HepanApp extends StatelessWidget {
|
||||
schoolBuilder: schoolBuilder,
|
||||
school: school,
|
||||
notificationSelection: notificationSelection,
|
||||
feedbackSender: feedbackSender ?? configuredFeedbackSender(),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -48,11 +53,13 @@ class _Shell extends StatefulWidget {
|
||||
this.schoolBuilder,
|
||||
this.school,
|
||||
this.notificationSelection,
|
||||
required this.feedbackSender,
|
||||
});
|
||||
final AppController controller;
|
||||
final Widget Function()? schoolBuilder;
|
||||
final SchoolSession? school;
|
||||
final ValueNotifier<String?>? notificationSelection;
|
||||
final FeedbackSender feedbackSender;
|
||||
@override
|
||||
State<_Shell> createState() => _ShellState();
|
||||
}
|
||||
@@ -267,6 +274,7 @@ class _ShellState extends State<_Shell> with WidgetsBindingObserver {
|
||||
),
|
||||
ProfilePage(
|
||||
controller: widget.controller,
|
||||
feedbackSender: widget.feedbackSender,
|
||||
onLogin: _school,
|
||||
onUpdateTerm: () => _school(chooseTerm: true),
|
||||
authStatus: widget.school?.statusLabel ?? '未登录',
|
||||
|
||||
Reference in New Issue
Block a user