feat: add media save guide
This commit is contained in:
@@ -22,6 +22,7 @@ import { formatDateYmd } from "../utils/format";
|
||||
import { postToResource } from "../utils/postResourceAdapter";
|
||||
import type { Post } from "../types/post";
|
||||
import { downloadAttachment } from "./messageStream/utils/downloadFile";
|
||||
import { mediaSaveKindFromType, useSaveToAlbumGuide } from "./SaveToAlbumGuide";
|
||||
import { useToast } from "./Toast";
|
||||
|
||||
const MEDALS = ["🥇", "🥈", "🥉"];
|
||||
@@ -94,6 +95,7 @@ function PopularRankRow({
|
||||
const navigate = useNavigate();
|
||||
const lp = useLocalizedPath();
|
||||
const { showToast } = useToast();
|
||||
const { showSaveToAlbumGuide } = useSaveToAlbumGuide();
|
||||
const [isDownloading, setIsDownloading] = useState(false);
|
||||
const [coverFailed, setCoverFailed] = useState(false);
|
||||
|
||||
@@ -110,6 +112,8 @@ function PopularRankRow({
|
||||
r.downloadAttachmentId,
|
||||
r.title,
|
||||
);
|
||||
const mediaKind = mediaSaveKindFromType(r.type);
|
||||
if (mediaKind) showSaveToAlbumGuide(mediaKind);
|
||||
} catch {
|
||||
showToast(t("downloadFail"), "error");
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user