add upload permission

This commit is contained in:
Timi
2026-01-29 11:58:18 +08:00
parent 81cb0b361d
commit 6e01e927b1
14 changed files with 213 additions and 36 deletions

View File

@ -9,6 +9,7 @@ import { OrderType } from "../../../../types/Model";
import { PreviewImageMetadata } from "../../../../types/Attachment";
import { MediaItem, MediaItemType } from "../../../../types/UI";
import { JournalApi } from "../../../../api/JournalApi";
import Permission from "../../../../utils/Permission";
interface JournalData {
page: JournalPage;
@ -23,6 +24,7 @@ interface JournalData {
isShowMoreMenu: boolean;
menuTop: number;
menuLeft: number;
canUpload: boolean;
}
Page({
@ -52,7 +54,17 @@ Page({
stickyOffset: 0,
isShowMoreMenu: false,
menuTop: 0,
menuLeft: 0
menuLeft: 0,
canUpload: false
},
async onShow() {
const cached = Permission.getCachedUploadPermission();
if (cached !== null) {
this.setData({ canUpload: cached });
return;
}
const canUpload = await Permission.checkAndCacheUploadPermission();
this.setData({ canUpload });
},
onLoad() {
Events.reset("JOURNAL_REFRESH", () => {