-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Raycast Notification] Added success and failure notification types (#…
…13958) * feat(raycast-notification): added success and failure notification types closes #13957 * Removed metadata not showing Raycast * Update CHANGELOG.md and optimise images --------- Co-authored-by: Per Nielsen Tikær <per@raycast.com> Co-authored-by: raycastbot <bot@raycast.com>
- Loading branch information
1 parent
d3dae34
commit 688169c
Showing
10 changed files
with
79 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
# Raycast Notification Changelog | ||
|
||
## Added icons and screenshots - 2024-08-08 | ||
## [Improvements] - 2024-08-20 | ||
|
||
## [Initial Version] - 2024-08-04 | ||
- Moved screenshots to metadata folder and used raycast colors for the command icon. | ||
- Supported success and failure notification types with Toast API. | ||
|
||
## [Initial Version] - 2024-08-04 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,27 @@ | ||
import { showHUD, LaunchProps } from "@raycast/api"; | ||
import { closeMainWindow, LaunchProps, LaunchType, showHUD, showToast, Toast } from "@raycast/api"; | ||
|
||
export default async function main(props: LaunchProps<{ arguments: { title: string } }>) { | ||
const { title } = props.arguments; | ||
await showHUD(title); | ||
export default async function main(props: LaunchProps<{ arguments: Arguments.Index }>) { | ||
const { | ||
arguments: { title, type }, | ||
launchType, | ||
} = props; | ||
|
||
let notificationType = type ?? "standard"; | ||
if (launchType === LaunchType.UserInitiated) { | ||
await closeMainWindow(); | ||
} else { | ||
// Toast API is not available when command is launched in the background. | ||
notificationType = "standard"; | ||
} | ||
|
||
switch (notificationType) { | ||
case "success": | ||
await showToast(Toast.Style.Success, title); | ||
break; | ||
case "failure": | ||
await showToast(Toast.Style.Failure, title); | ||
break; | ||
default: | ||
await showHUD(title); | ||
} | ||
} |