From d9c19e0451cf4a39fb168f865d090377b1e1da90 Mon Sep 17 00:00:00 2001 From: Fareez Iqmal <60868965+iqfareez@users.noreply.github.com> Date: Tue, 4 Jul 2023 13:09:07 +0800 Subject: [PATCH] :recycle: Replace LaneEventsResponse to Records type release new version 1.3.0+35 --- Inno/setup-script.iss | 2 +- README.md | 10 +++----- lib/util/lane_events_util.dart | 25 +++++-------------- lib/util/schedule_share.dart | 3 +-- lib/util/screenshot_widget.dart | 2 +- .../saved_schedule/saved_schedule_layout.dart | 24 ++++++++++-------- .../saved_schedule/schedule_export_page.dart | 19 ++++++++------ .../schedule_view/schedule_layout.dart | 7 +++--- pubspec.lock | 23 +++++++---------- pubspec.yaml | 4 +-- 10 files changed, 52 insertions(+), 67 deletions(-) diff --git a/Inno/setup-script.iss b/Inno/setup-script.iss index 0ddb7c6..8cc692a 100644 --- a/Inno/setup-script.iss +++ b/Inno/setup-script.iss @@ -2,7 +2,7 @@ ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "IIUM Schedule" -#define MyAppVersion "1.2.2.0" +#define MyAppVersion "1.3.0.0" #define MyAppPublisher "Muhammad Fareez Iqmal" #define MyAppURL "https://iiumschedule.iqfareez.com/" #define MyAppExeName "iium_schedule.exe" diff --git a/README.md b/README.md index 1a478e8..1360b66 100644 --- a/README.md +++ b/README.md @@ -3,14 +3,14 @@ [![Web]()](https://iiumschedule.web.app/#/) [![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white)](https://iiumschedule.iqfareez.com/downloads/stable#windows) ![License](https://img.shields.io/github/license/iqfareez/iium_schedule?style=for-the-badge) -[![BuyMeACoffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-ffdd00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](https://www.buymeacoffee.com/iqfareez) [![PRs Welcome](https://img.shields.io/badge/PR-welcome-brightgreen.svg?style=for-the-badge)](https://makeapullrequest.com) +[![BuyMeACoffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-ffdd00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](https://www.buymeacoffee.com/iqfareez) # IIUM Schedule App Generate a beautiful & clean IIUM Schedule quickly with automatic subject data fetching. View what courses are available to register at your fingertips. -Load timetable I-Ma'luum and your schedule is ready/ As easy as that :wink:. +Load timetable I-Ma'luum and your schedule is ready. As easy as that :wink:

@@ -23,15 +23,13 @@ Load timetable I-Ma'luum and your schedule is ready/ As easy as that :wink:. Feel free to open up [issues](https://github.com/iqfareez/iium_schedule/issues) and/or submit [pull requests](https://github.com/iqfareez/iium_schedule/pulls). - - -More proper guides will be written soon. +Refer [Wiki/Contributing](https://github.com/iqfareez/iium_schedule/wiki/Contributing) for more info. ## Getting started ### Build the project locally -See [here](https://github.com/iqfareez/iium_schedule/wiki/Build-steps) +See [Wiki/Build](https://github.com/iqfareez/iium_schedule/wiki/Build) ### Cloud development environment diff --git a/lib/util/lane_events_util.dart b/lib/util/lane_events_util.dart index bfefccd..64f9324 100644 --- a/lib/util/lane_events_util.dart +++ b/lib/util/lane_events_util.dart @@ -30,7 +30,7 @@ class LaneEventsUtil { required this.fontSize, }); - LaneEventsResponse laneEvents() { + ({List laneEvents, int startHour, int endHour}) laneEvents() { List laneEventsList = []; // Find if there any subject in each day for (var i = 1; i <= 7; i++) { @@ -152,30 +152,17 @@ class LaneEventsUtil { } } - // TODO: Perhaps this will no longer needs when Dart's new Records are landed - return LaneEventsResponse( - laneEventsList: laneEventsList, - startHour: _startHour, - endHour: _endHour); + return ( + laneEvents: laneEventsList, + startHour: _startHour, + endHour: _endHour + ); } // int get scheduleStartHour => _startHour; // int get scheduleEndHour => _endHour; } -// TODO: Perhaps this will no longer needs when Dart's new Records are landed -class LaneEventsResponse { - final List laneEventsList; - final int startHour; - final int endHour; - - LaneEventsResponse({ - required this.laneEventsList, - required this.startHour, - required this.endHour, - }); -} - class SubjectEvents { final String title; final String code; diff --git a/lib/util/schedule_share.dart b/lib/util/schedule_share.dart index 2d075cc..8c13b95 100644 --- a/lib/util/schedule_share.dart +++ b/lib/util/schedule_share.dart @@ -15,8 +15,7 @@ class ScheduleShare { Share.shareXFiles([xFilePath], text: scheduleTitle); } - /// TODO: Test with Firebase functions and use it - /// TODO: Not fully implemented yet + /// TODO: Test with Firebase functions and use it (Not fully implemented yet) static void email(String savedPath, String scheduleTitle) async { Map data = {"schedule_title": scheduleTitle}; var request = diff --git a/lib/util/screenshot_widget.dart b/lib/util/screenshot_widget.dart index a108194..a289383 100644 --- a/lib/util/screenshot_widget.dart +++ b/lib/util/screenshot_widget.dart @@ -17,7 +17,7 @@ class ScreenshotWidget { globalKey.currentContext?.findRenderObject() as RenderRepaintBoundary; // In debug mode Android sometimes will return !debugNeedsPrint error // TODO: this can be remove? - if (kDebugMode ? boundary.debugNeedsPaint : false) { + if (kDebugMode || boundary.debugNeedsPaint) { print("Waiting for boundary to be painted."); await Future.delayed(const Duration(milliseconds: 20)); } diff --git a/lib/views/saved_schedule/saved_schedule_layout.dart b/lib/views/saved_schedule/saved_schedule_layout.dart index c9ff9b0..48627a2 100644 --- a/lib/views/saved_schedule/saved_schedule_layout.dart +++ b/lib/views/saved_schedule/saved_schedule_layout.dart @@ -184,7 +184,7 @@ class _SavedScheduleLayoutState extends State { titleSetting: snapshot.data!.subjectTitleSetting, extraInfo: snapshot.data!.extraInfo); - LaneEventsResponse laneEventsList = LaneEventsUtil( + var laneEventsData = LaneEventsUtil( context: context, fontSize: snapshot.data!.fontSize, savedSubjectList: snapshot.data!.subjects.toList()) @@ -358,9 +358,9 @@ class _SavedScheduleLayoutState extends State { controller: _refreshController, onRefresh: _onRefresh, child: TimetableViewWidget( - startHour: laneEventsList.startHour, - endHour: laneEventsList.endHour, - laneEventsList: laneEventsList.laneEventsList, + laneEventsList: laneEventsData.laneEvents, + startHour: laneEventsData.startHour, + endHour: laneEventsData.endHour, itemHeight: snapshot.data!.heightFactor, ))), ), @@ -434,16 +434,20 @@ class _SavedScheduleLayoutState extends State { case 'save': if (!mounted) return; + var laneData = LaneEventsUtil( + context: context, + fontSize: schedule!.fontSize, + savedSubjectList: schedule.subjects.toList()) + .laneEvents(); + Navigator.push( context, MaterialPageRoute( builder: (_) => ScheduleExportPage( - scheduleTitle: schedule!.title!, - laneEventsResponse: LaneEventsUtil( - context: context, - fontSize: schedule.fontSize, - savedSubjectList: schedule.subjects.toList()) - .laneEvents(), + scheduleTitle: schedule.title!, + laneEventsList: laneData.laneEvents, + startHour: laneData.startHour, + endHour: laneData.endHour, itemHeight: schedule.heightFactor), ), ); diff --git a/lib/views/saved_schedule/schedule_export_page.dart b/lib/views/saved_schedule/schedule_export_page.dart index 8c0632b..0a2380c 100644 --- a/lib/views/saved_schedule/schedule_export_page.dart +++ b/lib/views/saved_schedule/schedule_export_page.dart @@ -2,9 +2,9 @@ import 'dart:io'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_timetable_view/flutter_timetable_view.dart'; import 'package:fluttertoast/fluttertoast.dart'; -import '../../util/lane_events_util.dart'; import '../../util/my_ftoast.dart'; import '../../util/schedule_share.dart'; import '../../util/screenshot_widget.dart'; @@ -13,10 +13,14 @@ import '../scheduler/schedule_view/timetable_view_widget.dart'; class ScheduleExportPage extends StatefulWidget { const ScheduleExportPage( {super.key, - required this.laneEventsResponse, required this.scheduleTitle, - required this.itemHeight}); - final LaneEventsResponse laneEventsResponse; + required this.itemHeight, + required this.laneEventsList, + required this.startHour, + required this.endHour}); + final List laneEventsList; + final int startHour; + final int endHour; final double itemHeight; final String scheduleTitle; @@ -63,10 +67,9 @@ class _ScheduleExportPageState extends State { child: ClipRect( // cliprect to remove schedule 'leaking' out of the container child: TimetableViewWidget( - startHour: widget.laneEventsResponse.startHour, - endHour: widget.laneEventsResponse.endHour, - laneEventsList: - widget.laneEventsResponse.laneEventsList, + startHour: widget.startHour, + endHour: widget.endHour, + laneEventsList: widget.laneEventsList, itemHeight: widget.itemHeight + 4, ), ), diff --git a/lib/views/scheduler/schedule_view/schedule_layout.dart b/lib/views/scheduler/schedule_view/schedule_layout.dart index 34182a8..6ce7300 100644 --- a/lib/views/scheduler/schedule_view/schedule_layout.dart +++ b/lib/views/scheduler/schedule_view/schedule_layout.dart @@ -344,10 +344,9 @@ class _ScheduleLayoutState extends State { navigator.push( MaterialPageRoute( builder: (_) => ScheduleExportPage( - laneEventsResponse: LaneEventsResponse( - laneEventsList: laneEventsList, - startHour: _startHour, - endHour: _endHour), + laneEventsList: laneEventsList, + startHour: _startHour, + endHour: _endHour, scheduleTitle: name, itemHeight: _itemHeight), ), diff --git a/pubspec.lock b/pubspec.lock index 45e25fe..5dbbb3a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -12,10 +12,9 @@ packages: albiruni: dependency: "direct main" description: - name: albiruni - sha256: "35506039256df62e841d052ab98da2ed25cd706b6a9b6dee28aafedfff36b587" - url: "https://pub.dev" - source: hosted + path: "../../Dart App/albiruni" + relative: true + source: path version: "1.3.0" analyzer: dependency: transitive @@ -344,11 +343,9 @@ packages: flutter_timetable_view: dependency: "direct main" description: - path: "." - ref: "0486b731669a055b2c5d4924a0d2228f5e2968f7" - resolved-ref: "0486b731669a055b2c5d4924a0d2228f5e2968f7" - url: "https://github.com/iqfareez/flutter_timetable_view.git" - source: git + path: "../Experiments/flutter_timetable_view" + relative: true + source: path version: "0.3.0" flutter_web_plugins: dependency: transitive @@ -831,11 +828,9 @@ packages: recase: dependency: "direct main" description: - path: "." - ref: HEAD - resolved-ref: "1e9c25cdf4828ce9d66430e4cd4deab6102e5722" - url: "https://github.com/iqfareez/recase.git" - source: git + path: "../../Dart App/recase" + relative: true + source: path version: "4.0.5" share_plus: dependency: "direct main" diff --git a/pubspec.yaml b/pubspec.yaml index a47cdee..da91d9d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev # When changing this version, also change the versions in # - msix block (msix_version) # - Inno setup (MyAppVersion) -version: 1.2.2+34 +version: 1.3.0+35 environment: sdk: ">=3.0.0 <4.0.0" @@ -111,7 +111,7 @@ msix_config: display_name: IIUM Schedule publisher_display_name: Muhammad Fareez Iqmal identity_name: fareez.flutter.iiumschedule - msix_version: 1.2.2.0 # same as inno setup (MyAppVersion) + msix_version: 1.3.0.0 # same as inno setup (MyAppVersion) logo_path: ".\\assets\\logo\\app-logo.png" capabilities: "internetClient" certificate_path: ".\\windows\\CERTIFICATE.pfx"