Skip to content

Commit

Permalink
fix: prevent commands with alerts from dying before timer is launched
Browse files Browse the repository at this point in the history
should address #20
  • Loading branch information
ThatNerdSquared committed Sep 25, 2024
1 parent aa2cd6e commit c2bebcf
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 30 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ node_modules/*
.idea/
raycast-env.d.ts
assets/TimersNotifHelper.app/
*.swp
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Timers Changelog

## [Fix commands finishing before timer launch due to alert] - 2024-09-24

## [Fix date formatter and residual timer files] - 2024-09-21

- Fix issue where date formatter incorrectly displayed the previous month instead of the current one
Expand Down
3 changes: 1 addition & 2 deletions src/manageTimers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ export default function Command(props: LaunchProps<{ launchContext: CommandLinkP
title: "This custom timer no longer exists!",
});
} else {
popToRoot();
startTimer({
timeInSeconds: ct.timeInSeconds,
timerName: ct.name,
selectedSound: ct.selectedSound,
});
}).then(() => popToRoot());
return;
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/start10MinuteTimer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { closeMainWindow } from "@raycast/api";
import { checkForOverlyLoudAlert, startTimer } from "./backend/timerBackend";

export default async () => {
if (!checkForOverlyLoudAlert()) return;
await closeMainWindow();
startTimer({ timeInSeconds: 60 * 10, timerName: "10 Minute Timer" });
await startTimer({ timeInSeconds: 60 * 10, timerName: "10 Minute Timer" });
};
4 changes: 1 addition & 3 deletions src/start15MinuteTimer.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { closeMainWindow } from "@raycast/api";
import { checkForOverlyLoudAlert, startTimer } from "./backend/timerBackend";

export default async () => {
if (!checkForOverlyLoudAlert()) return;
await closeMainWindow();
startTimer({
await startTimer({
timeInSeconds: 60 * 15,
timerName: "15 Minute Timer",
});
Expand Down
4 changes: 1 addition & 3 deletions src/start25MinuteTimer.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { closeMainWindow } from "@raycast/api";
import { checkForOverlyLoudAlert, startTimer } from "./backend/timerBackend";

export default async () => {
if (!checkForOverlyLoudAlert()) return;
await closeMainWindow();
startTimer({
await startTimer({
timeInSeconds: 60 * 25,
timerName: "25 Minute Timer",
});
Expand Down
4 changes: 1 addition & 3 deletions src/start2MinuteTimer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { closeMainWindow } from "@raycast/api";
import { checkForOverlyLoudAlert, startTimer } from "./backend/timerBackend";

export default async () => {
if (!checkForOverlyLoudAlert()) return;
await closeMainWindow();
startTimer({ timeInSeconds: 60 * 2, timerName: "2 Minute Timer" });
await startTimer({ timeInSeconds: 60 * 2, timerName: "2 Minute Timer" });
};
2 changes: 0 additions & 2 deletions src/start30MinuteTimer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { closeMainWindow } from "@raycast/api";
import { checkForOverlyLoudAlert, startTimer } from "./backend/timerBackend";

export default async () => {
if (!checkForOverlyLoudAlert()) return;
await closeMainWindow();
await startTimer({ timeInSeconds: 60 * 30, timerName: "30 Minute Timer" });
};
4 changes: 1 addition & 3 deletions src/start45MinuteTimer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { closeMainWindow } from "@raycast/api";
import { checkForOverlyLoudAlert, startTimer } from "./backend/timerBackend";

export default async () => {
if (!checkForOverlyLoudAlert()) return;
await closeMainWindow();
startTimer({ timeInSeconds: 60 * 45, timerName: "45 Minute Timer" });
await startTimer({ timeInSeconds: 60 * 45, timerName: "45 Minute Timer" });
};
4 changes: 1 addition & 3 deletions src/start5MinuteTimer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { closeMainWindow } from "@raycast/api";
import { checkForOverlyLoudAlert, startTimer } from "./backend/timerBackend";

export default async () => {
if (!checkForOverlyLoudAlert()) return;
await closeMainWindow();
startTimer({ timeInSeconds: 60 * 5, timerName: "5 Minute Timer" });
await startTimer({ timeInSeconds: 60 * 5, timerName: "5 Minute Timer" });
};
4 changes: 1 addition & 3 deletions src/start60MinuteTimer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { closeMainWindow } from "@raycast/api";
import { checkForOverlyLoudAlert, startTimer } from "./backend/timerBackend";

export default async () => {
if (!checkForOverlyLoudAlert()) return;
await closeMainWindow();
startTimer({ timeInSeconds: 60 * 60, timerName: "1 Hour Timer" });
await startTimer({ timeInSeconds: 60 * 60, timerName: "1 Hour Timer" });
};
4 changes: 1 addition & 3 deletions src/start90MinuteTimer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { closeMainWindow } from "@raycast/api";
import { checkForOverlyLoudAlert, startTimer } from "./backend/timerBackend";

export default async () => {
if (!checkForOverlyLoudAlert()) return;
await closeMainWindow();
startTimer({ timeInSeconds: 60 * 90, timerName: "90 Minute Timer" });
await startTimer({ timeInSeconds: 60 * 90, timerName: "90 Minute Timer" });
};
3 changes: 1 addition & 2 deletions src/startCustomTimer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ export default function CustomTimerView(props: { arguments: CTInlineArgs }) {
setSecErr("Seconds must be a number!");
} else {
if (!checkForOverlyLoudAlert()) return;
pop();
const timerName = values.name ? values.name : "Untitled";
const timeInSeconds = 3600 * Number(values.hours) + 60 * Number(values.minutes) + Number(values.seconds);
startTimer({
timeInSeconds: timeInSeconds,
timerName: timerName,
selectedSound: values.selectedSound,
});
}).then(() => pop());
if (values.willBeSaved)
createCustomTimer({
name: values.name,
Expand Down

0 comments on commit c2bebcf

Please sign in to comment.