diff --git a/CHANGELOG.md b/CHANGELOG.md index 63d85a3d..355751c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## 2.7.0 +- Added update channel options: `release` or `preview`. - Introduced immersive timetable wallpaper. - Introduced timetable palette generator from images. - Cropping the timetable wallpaper. diff --git a/lib/backend/stats/entity/feature.dart b/lib/backend/stats/entity/feature.dart index e5aefa12..51a92010 100644 --- a/lib/backend/stats/entity/feature.dart +++ b/lib/backend/stats/entity/feature.dart @@ -5,12 +5,14 @@ class StatsFeatureUsage { @Id() int id; final String feature; + final String result; @Property(type: PropertyType.date) final DateTime time; StatsFeatureUsage({ this.id = 0, required this.feature, + this.result = "", required this.time, }); } diff --git a/lib/login/page/index.dart b/lib/login/page/index.dart index 45f9e1a6..2b836b98 100644 --- a/lib/login/page/index.dart +++ b/lib/login/page/index.dart @@ -358,7 +358,7 @@ class _LoginPageState extends ConsumerState { icon: const Icon(Icons.login), label: _i18n.login.text(), ), - if (!widget.isGuarded && ref.watch(CredentialsInit.storage.oa.$lastAuthTime) == null ) + if (!widget.isGuarded && ref.watch(CredentialsInit.storage.oa.$lastAuthTime) == null) $account >> (ctx, account) => $password >> diff --git a/lib/objectbox-model.json b/lib/objectbox-model.json index dc65a0de..59ebbf71 100644 --- a/lib/objectbox-model.json +++ b/lib/objectbox-model.json @@ -4,47 +4,52 @@ "_note3": "If you have VCS merge conflicts, you must resolve them according to ObjectBox docs.", "entities": [ { - "id": "1:3049504742638355443", - "lastPropertyId": "3:6829777567001922062", + "id": "1:6058686906110423483", + "lastPropertyId": "4:1456794932391410454", "name": "StatsFeatureUsage", "properties": [ { - "id": "1:7339886906527342418", + "id": "1:8567821803968552595", "name": "id", "type": 6, "flags": 1 }, { - "id": "2:3550306696746963752", - "name": "time", - "type": 10 + "id": "2:6258818122600997136", + "name": "feature", + "type": 9 }, { - "id": "3:6829777567001922062", - "name": "feature", + "id": "3:3615904521094794642", + "name": "result", "type": 9 + }, + { + "id": "4:1456794932391410454", + "name": "time", + "type": 10 } ], "relations": [] }, { - "id": "2:2808936172102568470", - "lastPropertyId": "3:4450762094026544792", + "id": "2:6860077869163213812", + "lastPropertyId": "3:6558364299568351246", "name": "StatsRoute", "properties": [ { - "id": "1:2242334635534013885", + "id": "1:1088320578842355463", "name": "id", "type": 6, "flags": 1 }, { - "id": "2:5995258184475796813", + "id": "2:6229011439275914211", "name": "route", "type": 9 }, { - "id": "3:4450762094026544792", + "id": "3:6558364299568351246", "name": "time", "type": 10 } @@ -52,7 +57,7 @@ "relations": [] } ], - "lastEntityId": "2:2808936172102568470", + "lastEntityId": "2:6860077869163213812", "lastIndexId": "0:0", "lastRelationId": "0:0", "lastSequenceId": "0:0", diff --git a/lib/objectbox.g.dart b/lib/objectbox.g.dart index 4a1e1b0b..939efb9e 100644 --- a/lib/objectbox.g.dart +++ b/lib/objectbox.g.dart @@ -20,26 +20,27 @@ export 'package:objectbox/objectbox.dart'; // so that callers only have to impor final _entities = [ obx_int.ModelEntity( - id: const obx_int.IdUid(1, 3049504742638355443), + id: const obx_int.IdUid(1, 6058686906110423483), name: 'StatsFeatureUsage', - lastPropertyId: const obx_int.IdUid(3, 6829777567001922062), + lastPropertyId: const obx_int.IdUid(4, 1456794932391410454), flags: 0, properties: [ - obx_int.ModelProperty(id: const obx_int.IdUid(1, 7339886906527342418), name: 'id', type: 6, flags: 1), - obx_int.ModelProperty(id: const obx_int.IdUid(2, 3550306696746963752), name: 'time', type: 10, flags: 0), - obx_int.ModelProperty(id: const obx_int.IdUid(3, 6829777567001922062), name: 'feature', type: 9, flags: 0) + obx_int.ModelProperty(id: const obx_int.IdUid(1, 8567821803968552595), name: 'id', type: 6, flags: 1), + obx_int.ModelProperty(id: const obx_int.IdUid(2, 6258818122600997136), name: 'feature', type: 9, flags: 0), + obx_int.ModelProperty(id: const obx_int.IdUid(3, 3615904521094794642), name: 'result', type: 9, flags: 0), + obx_int.ModelProperty(id: const obx_int.IdUid(4, 1456794932391410454), name: 'time', type: 10, flags: 0) ], relations: [], backlinks: []), obx_int.ModelEntity( - id: const obx_int.IdUid(2, 2808936172102568470), + id: const obx_int.IdUid(2, 6860077869163213812), name: 'StatsRoute', - lastPropertyId: const obx_int.IdUid(3, 4450762094026544792), + lastPropertyId: const obx_int.IdUid(3, 6558364299568351246), flags: 0, properties: [ - obx_int.ModelProperty(id: const obx_int.IdUid(1, 2242334635534013885), name: 'id', type: 6, flags: 1), - obx_int.ModelProperty(id: const obx_int.IdUid(2, 5995258184475796813), name: 'route', type: 9, flags: 0), - obx_int.ModelProperty(id: const obx_int.IdUid(3, 4450762094026544792), name: 'time', type: 10, flags: 0) + obx_int.ModelProperty(id: const obx_int.IdUid(1, 1088320578842355463), name: 'id', type: 6, flags: 1), + obx_int.ModelProperty(id: const obx_int.IdUid(2, 6229011439275914211), name: 'route', type: 9, flags: 0), + obx_int.ModelProperty(id: const obx_int.IdUid(3, 6558364299568351246), name: 'time', type: 10, flags: 0) ], relations: [], backlinks: []) @@ -80,7 +81,7 @@ Future openStore( obx_int.ModelDefinition getObjectBoxModel() { final model = obx_int.ModelInfo( entities: _entities, - lastEntityId: const obx_int.IdUid(2, 2808936172102568470), + lastEntityId: const obx_int.IdUid(2, 6860077869163213812), lastIndexId: const obx_int.IdUid(0, 0), lastRelationId: const obx_int.IdUid(0, 0), lastSequenceId: const obx_int.IdUid(0, 0), @@ -103,10 +104,12 @@ obx_int.ModelDefinition getObjectBoxModel() { }, objectToFB: (StatsFeatureUsage object, fb.Builder fbb) { final featureOffset = fbb.writeString(object.feature); - fbb.startTable(4); + final resultOffset = fbb.writeString(object.result); + fbb.startTable(5); fbb.addInt64(0, object.id); - fbb.addInt64(1, object.time.millisecondsSinceEpoch); - fbb.addOffset(2, featureOffset); + fbb.addOffset(1, featureOffset); + fbb.addOffset(2, resultOffset); + fbb.addInt64(3, object.time.millisecondsSinceEpoch); fbb.finish(fbb.endTable()); return object.id; }, @@ -114,10 +117,11 @@ obx_int.ModelDefinition getObjectBoxModel() { final buffer = fb.BufferContext(fbData); final rootOffset = buffer.derefObject(0); final idParam = const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0); - final featureParam = const fb.StringReader(asciiOptimization: true).vTableGet(buffer, rootOffset, 8, ''); + final featureParam = const fb.StringReader(asciiOptimization: true).vTableGet(buffer, rootOffset, 6, ''); + final resultParam = const fb.StringReader(asciiOptimization: true).vTableGet(buffer, rootOffset, 8, ''); final timeParam = - DateTime.fromMillisecondsSinceEpoch(const fb.Int64Reader().vTableGet(buffer, rootOffset, 6, 0)); - final object = StatsFeatureUsage(id: idParam, feature: featureParam, time: timeParam); + DateTime.fromMillisecondsSinceEpoch(const fb.Int64Reader().vTableGet(buffer, rootOffset, 10, 0)); + final object = StatsFeatureUsage(id: idParam, feature: featureParam, result: resultParam, time: timeParam); return object; }), @@ -159,11 +163,14 @@ class StatsFeatureUsage_ { /// See [StatsFeatureUsage.id]. static final id = obx.QueryIntegerProperty(_entities[0].properties[0]); - /// See [StatsFeatureUsage.time]. - static final time = obx.QueryDateProperty(_entities[0].properties[1]); - /// See [StatsFeatureUsage.feature]. - static final feature = obx.QueryStringProperty(_entities[0].properties[2]); + static final feature = obx.QueryStringProperty(_entities[0].properties[1]); + + /// See [StatsFeatureUsage.result]. + static final result = obx.QueryStringProperty(_entities[0].properties[2]); + + /// See [StatsFeatureUsage.time]. + static final time = obx.QueryDateProperty(_entities[0].properties[3]); } /// [StatsRoute] entity fields to define ObjectBox queries. diff --git a/lib/school/oa_announce/page/list.dart b/lib/school/oa_announce/page/list.dart index 9bb7497d..75515591 100644 --- a/lib/school/oa_announce/page/list.dart +++ b/lib/school/oa_announce/page/list.dart @@ -130,14 +130,14 @@ class _OaAnnounceLoadingListState extends State with Auto desc: i18n.noOaAnnouncementsTip, ) : ListView.builder( - itemCount: announcements.length, - itemBuilder: (ctx, index) { - return Card.filled( - clipBehavior: Clip.hardEdge, - child: OaAnnounceTile(announcements[index]), - ); - }, - ); + itemCount: announcements.length, + itemBuilder: (ctx, index) { + return Card.filled( + clipBehavior: Clip.hardEdge, + child: OaAnnounceTile(announcements[index]), + ); + }, + ); } Future loadMore() async { diff --git a/lib/settings/page/proxy.dart b/lib/settings/page/proxy.dart index 50b5beb9..1c9e725d 100644 --- a/lib/settings/page/proxy.dart +++ b/lib/settings/page/proxy.dart @@ -548,7 +548,7 @@ class _EnableProxyToggleTile extends ConsumerWidget { title: i18n.proxy.enableProxy.text(), subtitle: i18n.proxy.enableProxyDesc.text(), value: enabled, - onChanged: tileEnabled? onChanged : null, + onChanged: tileEnabled ? onChanged : null, ); } } diff --git a/lib/timetable/widget/timetable/weekly.dart b/lib/timetable/widget/timetable/weekly.dart index dc88c6b5..13912e0d 100644 --- a/lib/timetable/widget/timetable/weekly.dart +++ b/lib/timetable/widget/timetable/weekly.dart @@ -193,9 +193,9 @@ class TimetableOneWeek extends StatelessWidget { final Size fullSize; final bool showFreeTip; final Widget Function({ - required BuildContext context, - required TimetableLessonPart lesson, - required TimetableEntity timetable, + required BuildContext context, + required TimetableLessonPart lesson, + required TimetableEntity timetable, }) cellBuilder; const TimetableOneWeek({ @@ -236,7 +236,11 @@ class TimetableOneWeek extends StatelessWidget { } /// timeslots - Widget buildLeftColumn(BuildContext context, Size cellSize, {required int month,}) { + Widget buildLeftColumn( + BuildContext context, + Size cellSize, { + required int month, + }) { final textStyle = context.textTheme.bodyMedium; final cells = []; cells.add(Container( @@ -264,7 +268,8 @@ class TimetableOneWeek extends StatelessWidget { return cells.column(); } - Widget buildSingleWeekView(TimetableWeek timetableWeek, { + Widget buildSingleWeekView( + TimetableWeek timetableWeek, { required BuildContext context, required TimetableEntity timetable, required Size cellSize, @@ -273,11 +278,12 @@ class TimetableOneWeek extends StatelessWidget { }) { return List.generate(8, (index) { if (index == 0) { - return buildLeftColumn(context, cellSize, month:reflectWeekDayIndexToDate( - weekIndex: weekIndex, - weekday: Weekday.monday, - startDate: timetable.startDate, - ).month); + return buildLeftColumn(context, cellSize, + month: reflectWeekDayIndexToDate( + weekIndex: weekIndex, + weekday: Weekday.monday, + startDate: timetable.startDate, + ).month); } else { return _buildCellsByDay( context, @@ -290,11 +296,12 @@ class TimetableOneWeek extends StatelessWidget { } /// lessons on a day - Widget _buildCellsByDay(BuildContext context, - TimetableDay day, - Size cellSize, { - required TimetablePos todayPos, - }) { + Widget _buildCellsByDay( + BuildContext context, + TimetableDay day, + Size cellSize, { + required TimetablePos todayPos, + }) { final cells = []; cells.add(DashLined( color: getTimetableHeaderDashLinedColor(context), @@ -380,21 +387,19 @@ class InteractiveCourseCell extends ConsumerWidget { course: course, isLessonTaken: isLessonTaken, style: style, - innerBuilder: (ctx, child) => - InkWell( - onTap: () async { - if (!context.mounted) return; - await context.showSheet( - (ctx) => - TimetableCourseSheetPage( - courseCode: course.courseCode, - timetable: timetable, - highlightedCourseKey: course.courseKey, - ), - ); - }, - child: child, - ), + innerBuilder: (ctx, child) => InkWell( + onTap: () async { + if (!context.mounted) return; + await context.showSheet( + (ctx) => TimetableCourseSheetPage( + courseCode: course.courseCode, + timetable: timetable, + highlightedCourseKey: course.courseKey, + ), + ); + }, + child: child, + ), ); } } @@ -427,37 +432,35 @@ class _InteractiveCourseCellWithTooltipState extends State - Tooltip( - key: $tooltip, - preferBelow: false, - triggerMode: UniversalPlatform.isDesktop ? TooltipTriggerMode.tap : TooltipTriggerMode.manual, - message: buildTooltipMessage(), - textAlign: TextAlign.center, - child: InkWell( - onTap: UniversalPlatform.isDesktop - ? null - : () async { - $tooltip.currentState?.ensureTooltipVisible(); - await HapticFeedback.selectionClick(); - }, - // onDoubleTap: showDetailsSheet, - onLongPress: showDetailsSheet, - child: child, - ), - ), + innerBuilder: (ctx, child) => Tooltip( + key: $tooltip, + preferBelow: false, + triggerMode: UniversalPlatform.isDesktop ? TooltipTriggerMode.tap : TooltipTriggerMode.manual, + message: buildTooltipMessage(), + textAlign: TextAlign.center, + child: InkWell( + onTap: UniversalPlatform.isDesktop + ? null + : () async { + $tooltip.currentState?.ensureTooltipVisible(); + await HapticFeedback.selectionClick(); + }, + // onDoubleTap: showDetailsSheet, + onLongPress: showDetailsSheet, + child: child, + ), + ), ); } Future showDetailsSheet() async { final course = widget.lesson.course; await context.showSheet( - (ctx) => - TimetableCourseSheetPage( - courseCode: course.courseCode, - timetable: widget.timetable, - highlightedCourseKey: course.courseKey, - ), + (ctx) => TimetableCourseSheetPage( + courseCode: course.courseCode, + timetable: widget.timetable, + highlightedCourseKey: course.courseKey, + ), ); } diff --git a/lib/utils/images.dart b/lib/utils/images.dart index 83653f94..9751cbe1 100644 --- a/lib/utils/images.dart +++ b/lib/utils/images.dart @@ -6,8 +6,8 @@ import 'package:image_cropper/image_cropper.dart'; import 'package:universal_platform/universal_platform.dart'; import 'package:path/path.dart' as path; -bool isGif(File imageFile){ - return path.extension(imageFile.path).toLowerCase() == ".gif"; +bool isGif(File imageFile) { + return path.extension(imageFile.path).toLowerCase() == ".gif"; } Future copyCompressedImageToTarget({