Skip to content

Commit

Permalink
Update mail extension (#16214)
Browse files Browse the repository at this point in the history
* Update mail extension

- add unreadonly for see recent mail action
- Initial commit

* rename \`see\` -> \`view\`

* Revert "rename \`see\` -> \`view\`"

* Update CHANGELOG.md and optimise images

---------

Co-authored-by: raycastbot <[email protected]>
  • Loading branch information
ViGeng and raycastbot authored Jan 15, 2025
1 parent f3f1e6a commit 8e30123
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
4 changes: 4 additions & 0 deletions extensions/mail/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Mail Changelog

## [Improvement] - 2025-01-15

- Add preference for `See Recent Mail`: `unreadonly` to show whether only unread messages.

## [Fix] - 2024-12-10

[#15571](https://github.com/raycast/extensions/issues/15571): Properly handle the timeout error for loading messages for mailboxes and increase timeout.
Expand Down
16 changes: 14 additions & 2 deletions extensions/mail/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"lukah",
"stelo",
"StevenRCE0",
"ridemountainpig"
"ridemountainpig",
"ViGeng"
],
"categories": [
"Applications",
Expand Down Expand Up @@ -88,7 +89,18 @@
"name": "see-recent-mail",
"title": "See Recent Mail",
"description": "See recent unread messages.",
"mode": "view"
"mode": "view",
"preferences": [
{
"name": "unreadonly",
"label": "Only show unread messages",
"title": "Unread-Only",
"description": "Only show unread messages.",
"type": "checkbox",
"default": false,
"required": false
}
]
},
{
"name": "see-important-mail",
Expand Down
10 changes: 5 additions & 5 deletions extensions/mail/src/see-recent-mail.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { useCallback, useRef, useState } from "react";
import { Color, Icon, List } from "@raycast/api";
import { Color, Icon, List, getPreferenceValues } from "@raycast/api";
import { useCachedPromise } from "@raycast/utils";
import { useCallback, useRef, useState } from "react";

import { Account, Mailbox } from "./types";
import { MessageListItem } from "./components";
import { getAccounts } from "./scripts/accounts";
import { getMessages } from "./scripts/messages";
import { Account, Mailbox } from "./types";
import { invoke } from "./utils";
import { isInbox } from "./utils/mailbox";
import { Cache } from "./utils/cache";
import { isInbox } from "./utils/mailbox";

export default function SeeRecentMail() {
const [account, setAccount] = useState<Account>();
Expand All @@ -26,7 +26,7 @@ export default function SeeRecentMail() {
if (!mailbox) {
return [];
}
return getMessages(account, mailbox, true);
return getMessages(account, mailbox, getPreferenceValues().unreadonly);
}),
);

Expand Down

0 comments on commit 8e30123

Please sign in to comment.