Skip to content

Commit

Permalink
Switch to schema version 3 (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
hkamran80 authored Dec 5, 2022
1 parent d83f0b5 commit 5533586
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
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

0 comments on commit 5533586

Please sign in to comment.