Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to schema version 3 #60

Merged
merged 3 commits into from
Dec 5, 2022
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
2 changes: 1 addition & 1 deletion lib/constants.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const applicationName = "Schedules";

Uri schedulesLink =
Uri.parse("https://cfg-schedules.unisontech.org/schedules/latest");
Uri.parse("https://cfg-schedules.unisontech.org/schedules/schema-3");

Uri requestLink = Uri.parse("https://go.unisontech.org/schreq");
Uri feedbackLink = Uri.parse("https://go.unisontech.org/sch-mobile-feedback");
Expand Down
4 changes: 2 additions & 2 deletions lib/extensions/string.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ extension StringDateTime on String {
}

String convertTime(bool hour24) => hour24
? split("-").sublist(0, 2).join(":")
: replaceAll("-", ":").convertTo12Hour();
? split(":").sublist(0, 2).join(":")
: convertTo12Hour();
}

extension StringRegExp on String {
Expand Down
8 changes: 4 additions & 4 deletions lib/utils/schedule.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ class Schedule {
try {
return daySchedulePeriods.firstWhere(
(schedulePeriod) {
if (int.parse(schedulePeriod.times.start.replaceAll("-", "")) <=
if (int.parse(schedulePeriod.times.start.replaceAll(":", "")) <=
currentTime &&
currentTime <=
int.parse(schedulePeriod.times.end.replaceAll("-", ""))) {
int.parse(schedulePeriod.times.end.replaceAll(":", ""))) {
if (_periodName != schedulePeriod.name) {
_notificationsScheduled = false;
_periodName = schedulePeriod.originalName;
Expand Down Expand Up @@ -157,7 +157,7 @@ class Schedule {
String get timeRemaining {
if (currentPeriodExists) {
DateTime now = DateTime.now();
List<String> endTime = currentPeriod!.times.end.split("-");
List<String> endTime = currentPeriod!.times.end.split(":");

Duration remaining = DateTime(
now.year,
Expand Down Expand Up @@ -314,7 +314,7 @@ class Schedule {
for (var interval in intervals) {
DateTime scheduledTime = DateFormat("y-M-d H:m:s")
.parse(
"${DateTime.now().toString().split(" ")[0]} ${currentPeriod!.times.end.replaceAll("-", ":")}",
"${DateTime.now().toString().split(" ")[0]} ${currentPeriod!.times.end}",
)
.subtract(interval.duration);

Expand Down