@oxyhq/services 22.5.0 → 22.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/ui/client.js +1 -1
- package/lib/commonjs/ui/components/FontLoader.js +18 -145
- package/lib/commonjs/ui/components/FontLoader.js.map +1 -1
- package/lib/commonjs/ui/components/FontLoader.native.js +88 -0
- package/lib/commonjs/ui/components/FontLoader.native.js.map +1 -0
- package/lib/commonjs/ui/components/OxyProvider.js +1 -1
- package/lib/commonjs/ui/components/fileManagement/FileDetailsModal.js +16 -27
- package/lib/commonjs/ui/components/fileManagement/FileDetailsModal.js.map +1 -1
- package/lib/commonjs/ui/components/fileManagement/UploadPreview.js.map +1 -1
- package/lib/commonjs/ui/components/fileManagement/styles.js +1 -225
- package/lib/commonjs/ui/components/fileManagement/styles.js.map +1 -1
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js +5 -2
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -1
- package/lib/commonjs/ui/context/useOxyAccountGraph.js +7 -0
- package/lib/commonjs/ui/context/useOxyAccountGraph.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/useAccountQueries.js +10 -4
- package/lib/commonjs/ui/hooks/queries/useAccountQueries.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/userCache.js +33 -9
- package/lib/commonjs/ui/hooks/queries/userCache.js.map +1 -1
- package/lib/commonjs/ui/hooks/useAvatarPicker.js +23 -8
- package/lib/commonjs/ui/hooks/useAvatarPicker.js.map +1 -1
- package/lib/commonjs/ui/hooks/useFileDownloadUrl.js +7 -21
- package/lib/commonjs/ui/hooks/useFileDownloadUrl.js.map +1 -1
- package/lib/commonjs/ui/hooks/useResolvedFileUrls.js +163 -0
- package/lib/commonjs/ui/hooks/useResolvedFileUrls.js.map +1 -0
- package/lib/commonjs/ui/index.js +1 -1
- package/lib/commonjs/ui/screens/FileManagementScreen.js +51 -22
- package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/fileManagement/PhotoPickerSection.js +216 -203
- package/lib/commonjs/ui/screens/fileManagement/PhotoPickerSection.js.map +1 -1
- package/lib/commonjs/ui/screens/fileManagement/hooks/useFileUploadState.js +26 -9
- package/lib/commonjs/ui/screens/fileManagement/hooks/useFileUploadState.js.map +1 -1
- package/lib/commonjs/ui/screens/fileManagement/photoGridLayout.js +44 -0
- package/lib/commonjs/ui/screens/fileManagement/photoGridLayout.js.map +1 -0
- package/lib/commonjs/ui/session/tokenTransport.js +21 -10
- package/lib/commonjs/ui/session/tokenTransport.js.map +1 -1
- package/lib/commonjs/ui/utils/fileManagement.js +0 -40
- package/lib/commonjs/ui/utils/fileManagement.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/ui/client.js +1 -1
- package/lib/module/ui/client.js.map +1 -1
- package/lib/module/ui/components/FontLoader.js +18 -146
- package/lib/module/ui/components/FontLoader.js.map +1 -1
- package/lib/module/ui/components/FontLoader.native.js +83 -0
- package/lib/module/ui/components/FontLoader.native.js.map +1 -0
- package/lib/module/ui/components/OxyProvider.js +1 -1
- package/lib/module/ui/components/OxyProvider.js.map +1 -1
- package/lib/module/ui/components/fileManagement/FileDetailsModal.js +16 -27
- package/lib/module/ui/components/fileManagement/FileDetailsModal.js.map +1 -1
- package/lib/module/ui/components/fileManagement/UploadPreview.js.map +1 -1
- package/lib/module/ui/components/fileManagement/styles.js +0 -224
- package/lib/module/ui/components/fileManagement/styles.js.map +1 -1
- package/lib/module/ui/context/hooks/useAuthOperations.js +5 -2
- package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -1
- package/lib/module/ui/context/useOxyAccountGraph.js +7 -0
- package/lib/module/ui/context/useOxyAccountGraph.js.map +1 -1
- package/lib/module/ui/hooks/queries/useAccountQueries.js +10 -4
- package/lib/module/ui/hooks/queries/useAccountQueries.js.map +1 -1
- package/lib/module/ui/hooks/queries/userCache.js +33 -9
- package/lib/module/ui/hooks/queries/userCache.js.map +1 -1
- package/lib/module/ui/hooks/useAvatarPicker.js +23 -8
- package/lib/module/ui/hooks/useAvatarPicker.js.map +1 -1
- package/lib/module/ui/hooks/useFileDownloadUrl.js +7 -21
- package/lib/module/ui/hooks/useFileDownloadUrl.js.map +1 -1
- package/lib/module/ui/hooks/useResolvedFileUrls.js +157 -0
- package/lib/module/ui/hooks/useResolvedFileUrls.js.map +1 -0
- package/lib/module/ui/index.js +1 -1
- package/lib/module/ui/index.js.map +1 -1
- package/lib/module/ui/screens/FileManagementScreen.js +52 -23
- package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/fileManagement/PhotoPickerSection.js +218 -205
- package/lib/module/ui/screens/fileManagement/PhotoPickerSection.js.map +1 -1
- package/lib/module/ui/screens/fileManagement/hooks/useFileUploadState.js +26 -9
- package/lib/module/ui/screens/fileManagement/hooks/useFileUploadState.js.map +1 -1
- package/lib/module/ui/screens/fileManagement/photoGridLayout.js +39 -0
- package/lib/module/ui/screens/fileManagement/photoGridLayout.js.map +1 -0
- package/lib/module/ui/session/tokenTransport.js +21 -10
- package/lib/module/ui/session/tokenTransport.js.map +1 -1
- package/lib/module/ui/utils/fileManagement.js +0 -39
- package/lib/module/ui/utils/fileManagement.js.map +1 -1
- package/lib/typescript/commonjs/ui/components/FontLoader.d.ts +14 -5
- package/lib/typescript/commonjs/ui/components/FontLoader.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/FontLoader.native.d.ts +13 -0
- package/lib/typescript/commonjs/ui/components/FontLoader.native.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/fileManagement/FileDetailsModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/fileManagement/styles.d.ts +0 -218
- package/lib/typescript/commonjs/ui/components/fileManagement/styles.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/useOxyAccountGraph.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/useAccountQueries.d.ts +9 -0
- package/lib/typescript/commonjs/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/userCache.d.ts +3 -0
- package/lib/typescript/commonjs/ui/hooks/queries/userCache.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useAvatarPicker.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useFileDownloadUrl.d.ts +3 -2
- package/lib/typescript/commonjs/ui/hooks/useFileDownloadUrl.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useResolvedFileUrls.d.ts +48 -0
- package/lib/typescript/commonjs/ui/hooks/useResolvedFileUrls.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/fileManagement/PhotoPickerSection.d.ts +1 -1
- package/lib/typescript/commonjs/ui/screens/fileManagement/PhotoPickerSection.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/fileManagement/hooks/useFileUploadState.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/fileManagement/photoGridLayout.d.ts +37 -0
- package/lib/typescript/commonjs/ui/screens/fileManagement/photoGridLayout.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/session/tokenTransport.d.ts +15 -8
- package/lib/typescript/commonjs/ui/session/tokenTransport.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/fileManagement.d.ts +4 -11
- package/lib/typescript/commonjs/ui/utils/fileManagement.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +1 -1
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/client.d.ts +1 -1
- package/lib/typescript/module/ui/client.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/FontLoader.d.ts +14 -5
- package/lib/typescript/module/ui/components/FontLoader.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/FontLoader.native.d.ts +13 -0
- package/lib/typescript/module/ui/components/FontLoader.native.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/fileManagement/FileDetailsModal.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/fileManagement/styles.d.ts +0 -218
- package/lib/typescript/module/ui/components/fileManagement/styles.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/useOxyAccountGraph.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/useAccountQueries.d.ts +9 -0
- package/lib/typescript/module/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/userCache.d.ts +3 -0
- package/lib/typescript/module/ui/hooks/queries/userCache.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useAvatarPicker.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useFileDownloadUrl.d.ts +3 -2
- package/lib/typescript/module/ui/hooks/useFileDownloadUrl.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useResolvedFileUrls.d.ts +48 -0
- package/lib/typescript/module/ui/hooks/useResolvedFileUrls.d.ts.map +1 -0
- package/lib/typescript/module/ui/index.d.ts +1 -1
- package/lib/typescript/module/ui/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/fileManagement/PhotoPickerSection.d.ts +1 -1
- package/lib/typescript/module/ui/screens/fileManagement/PhotoPickerSection.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/fileManagement/hooks/useFileUploadState.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/fileManagement/photoGridLayout.d.ts +37 -0
- package/lib/typescript/module/ui/screens/fileManagement/photoGridLayout.d.ts.map +1 -0
- package/lib/typescript/module/ui/session/tokenTransport.d.ts +15 -8
- package/lib/typescript/module/ui/session/tokenTransport.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/fileManagement.d.ts +4 -11
- package/lib/typescript/module/ui/utils/fileManagement.d.ts.map +1 -1
- package/package.json +5 -10
- package/src/ui/components/FontLoader.native.tsx +88 -0
- package/src/ui/components/FontLoader.tsx +16 -151
- package/src/ui/components/fileManagement/FileDetailsModal.tsx +17 -18
- package/src/ui/components/fileManagement/UploadPreview.tsx +1 -1
- package/src/ui/components/fileManagement/styles.ts +0 -225
- package/src/ui/context/hooks/useAuthOperations.ts +5 -2
- package/src/ui/context/useOxyAccountGraph.ts +5 -0
- package/src/ui/hooks/queries/__tests__/userCache.test.ts +29 -0
- package/src/ui/hooks/queries/useAccountQueries.ts +10 -4
- package/src/ui/hooks/queries/userCache.ts +31 -8
- package/src/ui/hooks/useAvatarPicker.ts +27 -7
- package/src/ui/hooks/useFileDownloadUrl.ts +7 -23
- package/src/ui/hooks/useResolvedFileUrls.ts +170 -0
- package/src/ui/screens/FileManagementScreen.tsx +55 -27
- package/src/ui/screens/__tests__/photoGridLayout.test.ts +57 -0
- package/src/ui/screens/fileManagement/PhotoPickerSection.tsx +215 -213
- package/src/ui/screens/fileManagement/hooks/useFileUploadState.ts +27 -3
- package/src/ui/screens/fileManagement/photoGridLayout.ts +45 -0
- package/src/ui/session/__tests__/tokenTransport.test.ts +25 -10
- package/src/ui/session/tokenTransport.ts +21 -10
- package/src/ui/utils/fileManagement.ts +3 -46
- package/lib/typescript/types/expo-vector-icons.d.ts +0 -22
- package/src/types/expo-vector-icons.d.ts +0 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_queryKeys","require","_authStore","DEGRADED_DISPLAY_NAME","isMeaningful","value","undefined","trim","isMeaningfulDisplayName","isPlainObject","Array","isArray","normalizeName","name","trimmed","displayName","toCachedUser","user","fallbackId","rawName","rest","id","String","_id","normalized","normalizeIncoming","cached","mergeName","existing","incoming","merged","key","Object","entries","mergeCount","followers","following","mergeRelationship","isFollowing","followsYou","mergeUsers","count","_count","relationship","upsertOneKey","queryClient","getQueryData","setQueryData","updatedAt","dataUpdatedAt","getQueryState","resolveViewerId","viewerId","useAuthStore","getState","upsertCachedUser","queryKeys","users","detail","username","byUsername","upsertCachedUsers","length","resolvedViewerId"],"sourceRoot":"../../../../../src","sources":["ui/hooks/queries/userCache.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"names":["_queryKeys","require","_authStore","DEGRADED_DISPLAY_NAME","isMeaningful","value","undefined","trim","isMeaningfulDisplayName","isPlainObject","Array","isArray","normalizeName","name","trimmed","displayName","toCachedUser","user","fallbackId","rawName","rest","id","String","_id","normalized","normalizeIncoming","cached","mergeName","existing","incoming","merged","key","Object","entries","mergeCount","followers","following","mergeRelationship","isFollowing","followsYou","mergeUsers","options","includeRelationship","count","_count","relationship","upsertOneKey","queryClient","mergeOpts","getQueryData","seeded","setQueryData","updatedAt","dataUpdatedAt","getQueryState","resolveViewerId","viewerId","useAuthStore","getState","upsertCachedUser","queryKeys","users","detail","username","byUsername","upsertCachedUsers","length","resolvedViewerId"],"sourceRoot":"../../../../../src","sources":["ui/hooks/queries/userCache.ts"],"mappings":";;;;;;;AA2CA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AA5CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAwBA;AACA,MAAME,qBAAqB,GAAG,cAAc;;AAE5C;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,YAAYA,CAACC,KAAc,EAAW;EAC7C,IAAIA,KAAK,KAAKC,SAAS,IAAID,KAAK,KAAK,IAAI,EAAE,OAAO,KAAK;EACvD,IAAI,OAAOA,KAAK,KAAK,QA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AM,KAAK,CAAC,EAAE;EACjD,MAAMC,gBAAgB,GAAGZ,eAAe,CAACC,QAAQ,CAAC;EAClD,KAAK,MAAMvC,IAAI,IAAI4C,KAAK,EAAE;IACxB,IAAI5C,IAAI,EAAE0C,gBAAgB,CAACZ,WAAW,EAAE9B,IAAI,EAAEkD,gBAAgB,CAAC;EACjE;AACF","ignoreList":[]}
|
|
@@ -68,19 +68,34 @@ function useAvatarPicker({
|
|
|
68
68
|
}, [activeSessionId, currentLanguage, oxyServices, queryClient]);
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
|
-
* After the user picks a file in the FileManagement sheet,
|
|
72
|
-
*
|
|
71
|
+
* After the user picks a file in the FileManagement sheet, resolve a working
|
|
72
|
+
* source URL and route to the crop screen.
|
|
73
|
+
*
|
|
74
|
+
* The picked file is usually PRIVATE, so the synchronous
|
|
75
|
+
* `getFileDownloadUrl` (public CDN origin) would 404 and the crop screen's
|
|
76
|
+
* `Image.getSize` would fail silently. We resolve the authenticated URL via
|
|
77
|
+
* `assetGetUrl` (which throws on failure — unlike `getFileDownloadUrlAsync`,
|
|
78
|
+
* which swallows errors and falls back to the broken public URL) so a
|
|
79
|
+
* failure surfaces a real user-facing error instead of a blank crop canvas.
|
|
80
|
+
* No variant is requested — cropping needs the original.
|
|
73
81
|
*/
|
|
74
|
-
const handleFilePicked = (0, _react.useCallback)(file => {
|
|
82
|
+
const handleFilePicked = (0, _react.useCallback)(async file => {
|
|
75
83
|
if (!file.contentType?.startsWith('image/')) {
|
|
76
84
|
_bloom.toast.error((0, _core.translate)(currentLanguage ?? undefined, 'editProfile.toasts.selectImage') || 'Please select an image file');
|
|
77
85
|
return;
|
|
78
86
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
87
|
+
let sourceUri;
|
|
88
|
+
try {
|
|
89
|
+
const resolved = await oxyServices.assetGetUrl(file.id);
|
|
90
|
+
if (!resolved?.url) {
|
|
91
|
+
throw new Error('No download URL returned for the selected image');
|
|
92
|
+
}
|
|
93
|
+
sourceUri = resolved.url;
|
|
94
|
+
} catch (e) {
|
|
95
|
+
const message = e instanceof Error ? e.message : undefined;
|
|
96
|
+
_bloom.toast.error(message || (0, _core.translate)(currentLanguage ?? undefined, 'editProfile.toasts.cropMeasureFailed') || 'Could not load the selected image');
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
84
99
|
showBottomSheet({
|
|
85
100
|
screen: 'AvatarCrop',
|
|
86
101
|
props: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_core","_bloom","_avatarUtils","extractUploadedFileId","result","undefined","id","file","first","files","useAvatarPicker","oxyServices","currentLanguage","activeSessionId","queryClient","showBottomSheet","finalizeCroppedAvatar","useCallback","cropped","uploadResult","assetUpload","uri","type","mime","name","Date","now","newFileId","Error","updateAvatarVisibility","updateProfileWithAvatar","avatar","toast","success","translate","e","message","error","handleFilePicked","contentType","startsWith","sourceUri","
|
|
1
|
+
{"version":3,"names":["_react","require","_core","_bloom","_avatarUtils","extractUploadedFileId","result","undefined","id","file","first","files","useAvatarPicker","oxyServices","currentLanguage","activeSessionId","queryClient","showBottomSheet","finalizeCroppedAvatar","useCallback","cropped","uploadResult","assetUpload","uri","type","mime","name","Date","now","newFileId","Error","updateAvatarVisibility","updateProfileWithAvatar","avatar","toast","success","translate","e","message","error","handleFilePicked","contentType","startsWith","sourceUri","resolved","assetGetUrl","url","screen","props","imageUri","onConfirm","openAvatarPicker","selectMode","multiSelect","disabledMimeTypes","afterSelect","onSelect"],"sourceRoot":"../../../../src","sources":["ui/hooks/useAvatarPicker.ts"],"mappings":";;;;;;AAgBA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAEA,IAAAG,YAAA,GAAAH,OAAA;AAtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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;MACd8B,MAAM,EAAE,YAAY;MACpBC,KAAK,EAAE;QACLC,QAAQ,EAAEN,SAAS;QACnBO,SAAS,EAAEhC;MACb;IACF,CAAC,CAAC;EACJ,CAAC,EACD,CAACJ,eAAe,EAAEI,qBAAqB,EAAEL,WAAW,EAAEI,eAAe,CACvE,CAAC;EAED,MAAMkC,gBAAgB,GAAG,IAAAhC,kBAAW,EAAC,MAAM;IACzCF,eAAe,CAAC;MACd8B,MAAM,EAAE,gBAAgB;MACxBC,KAAK,EAAE;QACLI,UAAU,EAAE,IAAI;QAChBC,WAAW,EAAE,KAAK;QAClBC,iBAAiB,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,CAAC;QAC1DC,WAAW,EAAE,MAAM;QACnBC,QAAQ,EAAEhB;MACZ;IACF,CAAC,CAAC;EACJ,CAAC,EAAE,CAACA,gBAAgB,EAAEvB,eAAe,CAAC,CAAC;EAEvC,OAAO;IAAEkC;EAAiB,CAAC;AAC7B","ignoreList":[]}
|
|
@@ -8,8 +8,9 @@ var _react = require("react");
|
|
|
8
8
|
/**
|
|
9
9
|
* Hook to resolve a file's download URL asynchronously.
|
|
10
10
|
*
|
|
11
|
-
* Uses `getFileDownloadUrlAsync
|
|
12
|
-
*
|
|
11
|
+
* Uses `getFileDownloadUrlAsync`, which returns a scoped media-token stream URL
|
|
12
|
+
* for private assets. There is no sync CDN fallback — the synchronous
|
|
13
|
+
* `getFileDownloadUrl` is public-CDN-only and 404s for private uploads.
|
|
13
14
|
*/
|
|
14
15
|
const useFileDownloadUrl = (oxyServices, fileId, options) => {
|
|
15
16
|
const [url, setUrl] = (0, _react.useState)(null);
|
|
@@ -37,31 +38,16 @@ const useFileDownloadUrl = (oxyServices, fileId, options) => {
|
|
|
37
38
|
setLoading(true);
|
|
38
39
|
setError(null);
|
|
39
40
|
try {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
resolvedUrl = await instance.getFileDownloadUrlAsync(targetFileId, variant, expiresIn);
|
|
43
|
-
}
|
|
44
|
-
if (!resolvedUrl && typeof instance.getFileDownloadUrl === 'function') {
|
|
45
|
-
resolvedUrl = instance.getFileDownloadUrl(targetFileId, variant, expiresIn);
|
|
41
|
+
if (typeof instance.getFileDownloadUrlAsync !== 'function') {
|
|
42
|
+
throw new Error('getFileDownloadUrlAsync is not available on this OxyServices instance');
|
|
46
43
|
}
|
|
44
|
+
const resolvedUrl = await instance.getFileDownloadUrlAsync(targetFileId, variant, expiresIn);
|
|
47
45
|
if (!cancelled) {
|
|
48
46
|
setUrl(resolvedUrl || null);
|
|
49
47
|
}
|
|
50
48
|
} catch (err) {
|
|
51
|
-
// Fallback to sync URL on error where possible
|
|
52
|
-
try {
|
|
53
|
-
if (typeof instance.getFileDownloadUrl === 'function') {
|
|
54
|
-
const fallbackUrl = instance.getFileDownloadUrl(targetFileId, variant, expiresIn);
|
|
55
|
-
if (!cancelled) {
|
|
56
|
-
setUrl(fallbackUrl || null);
|
|
57
|
-
setError(err instanceof Error ? err : new Error(String(err)));
|
|
58
|
-
}
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
} catch {
|
|
62
|
-
// Secondary failure: surface the original error below.
|
|
63
|
-
}
|
|
64
49
|
if (!cancelled) {
|
|
50
|
+
setUrl(null);
|
|
65
51
|
setError(err instanceof Error ? err : new Error(String(err)));
|
|
66
52
|
}
|
|
67
53
|
} finally {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","useFileDownloadUrl","oxyServices","fileId","options","url","setUrl","useState","loading","setLoading","error","setError","variant","expiresIn","useEffect","Error","cancelled","instance","targetFileId","load","
|
|
1
|
+
{"version":3,"names":["_react","require","useFileDownloadUrl","oxyServices","fileId","options","url","setUrl","useState","loading","setLoading","error","setError","variant","expiresIn","useEffect","Error","cancelled","instance","targetFileId","load","getFileDownloadUrlAsync","resolvedUrl","err","String","exports"],"sourceRoot":"../../../../src","sources":["ui/hooks/useFileDownloadUrl.ts"],"mappings":";;;;;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AAEC,SAAS,CAAC;QAE5F,IAAI,CAACG,SAAS,EAAE;UACdV,MAAM,CAACe,WAAW,IAAI,IAAI,CAAC;QAC7B;MACF,CAAC,CAAC,OAAOC,GAAY,EAAE;QACrB,IAAI,CAACN,SAAS,EAAE;UACdV,MAAM,CAAC,IAAI,CAAC;UACZK,QAAQ,CAACW,GAAG,YAAYP,KAAK,GAAGO,GAAG,GAAG,IAAIP,KAAK,CAACQ,MAAM,CAACD,GAAG,CAAC,CAAC,CAAC;QAC/D;MACF,CAAC,SAAS;QACR,IAAI,CAACN,SAAS,EAAE;UACdP,UAAU,CAAC,KAAK,CAAC;QACnB;MACF;IACF,CAAC;IAEDU,IAAI,CAAC,CAAC;IAEN,OAAO,MAAM;MACXH,SAAS,GAAG,IAAI;IAClB,CAAC;EACH,CAAC,EAAE,CAACb,MAAM,EAAED,WAAW,EAAEU,OAAO,EAAEC,SAAS,CAAC,CAAC;EAE7C,OAAO;IAAER,GAAG;IAAEG,OAAO;IAAEE;EAAM,CAAC;AAChC,CAAC;AAACc,OAAA,CAAAvB,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ASSET_DOWNLOAD_URLS_QUERY_KEY = void 0;
|
|
7
|
+
exports.fileThumbSource = fileThumbSource;
|
|
8
|
+
exports.isOptimisticFile = isOptimisticFile;
|
|
9
|
+
exports.useResolvedFileUrls = useResolvedFileUrls;
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
var _reactQuery = require("@tanstack/react-query");
|
|
12
|
+
/**
|
|
13
|
+
* The variant-aware batch resolver contract (`@oxyhq/core`).
|
|
14
|
+
*
|
|
15
|
+
* `getFileDownloadUrls` takes a per-file `{ fileId, variant }` list and returns
|
|
16
|
+
* a map keyed by `fileId`; ids that are denied or missing are OMITTED (never an
|
|
17
|
+
* empty string), and PRIVATE assets resolve to a working scoped-media-token
|
|
18
|
+
* stream URL. Typed here rather than `Pick<OxyServices, …>` so this file states
|
|
19
|
+
* the exact contract it depends on.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Private-safe grid/thumbnail URL resolution.
|
|
24
|
+
*
|
|
25
|
+
* The synchronous `oxyServices.getFileDownloadUrl(id, variant)` always yields
|
|
26
|
+
* the public CDN origin (`cloud.oxy.so/<id>`), which 404s for PRIVATE assets —
|
|
27
|
+
* and uploads default to private. Thumbnails and previews therefore have to be
|
|
28
|
+
* resolved through the authenticated batch endpoint, which returns a working
|
|
29
|
+
* `/assets/:id/stream?…&mt=<scoped media token>` URL for private files.
|
|
30
|
+
*
|
|
31
|
+
* This hook resolves an ENTIRE page of files in ONE (chunked) batch request
|
|
32
|
+
* rather than N per-tile calls, and caches the result in React Query keyed by
|
|
33
|
+
* the (fileId, variant) set. `staleTime` is deliberately shorter than the
|
|
34
|
+
* server media-token TTL so a tile never renders a URL whose token has already
|
|
35
|
+
* expired.
|
|
36
|
+
*
|
|
37
|
+
* Optimistic (`temp-…` / `uploading`) entries are NEVER resolved here — an
|
|
38
|
+
* asset URL must never be built from an id the server does not yet know. Their
|
|
39
|
+
* preview comes from the locally-picked uri (see {@link fileThumbSource}).
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
/** Server media-token lifetime we request for each resolved URL (seconds). */
|
|
43
|
+
const ASSET_URL_TTL_SECONDS = 600; // 10 minutes
|
|
44
|
+
/**
|
|
45
|
+
* Refresh window. Kept below {@link ASSET_URL_TTL_SECONDS} so React Query
|
|
46
|
+
* re-resolves in the background before a rendered URL's token can die.
|
|
47
|
+
*/
|
|
48
|
+
const ASSET_URL_STALE_MS = 5 * 60 * 1000; // 5 minutes
|
|
49
|
+
const ASSET_URL_GC_MS = 30 * 60 * 1000;
|
|
50
|
+
/** Server-side batch cap for `POST /assets/batch-access` — chunk beyond this. */
|
|
51
|
+
const BATCH_CAP = 100;
|
|
52
|
+
|
|
53
|
+
/** React Query prefix — scoped media URLs must never leak across accounts. */
|
|
54
|
+
const ASSET_DOWNLOAD_URLS_QUERY_KEY = exports.ASSET_DOWNLOAD_URLS_QUERY_KEY = 'assetDownloadUrls';
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* True when a file is an optimistic placeholder that has not been persisted by
|
|
58
|
+
* the server yet — either its id is still the client-minted `temp-…` id, or it
|
|
59
|
+
* carries the `uploading` flag. Mirrors the `temp-` id guard precedent in
|
|
60
|
+
* `@oxyhq/core`'s `avatarUtils.updateAvatarVisibility`.
|
|
61
|
+
*/
|
|
62
|
+
function isOptimisticFile(file) {
|
|
63
|
+
if (typeof file.id === 'string' && file.id.startsWith('temp-')) return true;
|
|
64
|
+
return file.metadata?.uploading === true;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Grid thumbnail variant for a file, or `undefined` when it needs no URL. */
|
|
68
|
+
function thumbVariantFor(file) {
|
|
69
|
+
if (file.contentType.startsWith('video/')) return 'poster';
|
|
70
|
+
if (file.contentType.startsWith('image/')) return 'thumb';
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Locally-picked preview uri stashed on an optimistic entry's metadata by the
|
|
76
|
+
* upload flow, if present.
|
|
77
|
+
*/
|
|
78
|
+
function localPreviewUri(file) {
|
|
79
|
+
const uri = file.metadata?.localPreviewUri;
|
|
80
|
+
return typeof uri === 'string' && uri.length > 0 ? uri : undefined;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Resolve the image source for a grid tile.
|
|
85
|
+
*
|
|
86
|
+
* - Optimistic entry → its locally-picked preview uri (never an asset URL).
|
|
87
|
+
* - Persisted entry → the private-safe URL from {@link useResolvedFileUrls},
|
|
88
|
+
* or `undefined` while it is still resolving / was denied (tile shows a
|
|
89
|
+
* placeholder instead of a guaranteed-404 CDN URL).
|
|
90
|
+
*/
|
|
91
|
+
function fileThumbSource(file, resolved) {
|
|
92
|
+
if (isOptimisticFile(file)) {
|
|
93
|
+
return localPreviewUri(file);
|
|
94
|
+
}
|
|
95
|
+
return resolved.get(file.id);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Batch-resolve private-safe thumbnail URLs for the given files.
|
|
100
|
+
*
|
|
101
|
+
* Only image/video, non-optimistic files are resolved (documents render an
|
|
102
|
+
* icon, optimistic entries render their local preview). Returns a stable
|
|
103
|
+
* `Map<fileId, url>`; missing entries mean "not resolved yet or access denied".
|
|
104
|
+
*/
|
|
105
|
+
function useResolvedFileUrls(oxyServices, files, /** Active viewer account id — media tokens are minted per user; must be in the query key. */
|
|
106
|
+
viewerId) {
|
|
107
|
+
const viewerKey = viewerId ?? '';
|
|
108
|
+
const requests = (0, _react.useMemo)(() => {
|
|
109
|
+
const list = [];
|
|
110
|
+
for (const file of files) {
|
|
111
|
+
if (isOptimisticFile(file)) continue;
|
|
112
|
+
const variant = thumbVariantFor(file);
|
|
113
|
+
if (!variant) continue;
|
|
114
|
+
list.push({
|
|
115
|
+
fileId: file.id,
|
|
116
|
+
variant
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
return list;
|
|
120
|
+
}, [files]);
|
|
121
|
+
|
|
122
|
+
// A content signature so the query key is stable across renders while the
|
|
123
|
+
// resolvable set is unchanged (the `files` array is a fresh reference every
|
|
124
|
+
// render). Sorted so ordering churn does not force a refetch.
|
|
125
|
+
const signature = (0, _react.useMemo)(() => requests.map(r => `${r.fileId}:${r.variant ?? ''}`).sort().join('|'), [requests]);
|
|
126
|
+
const query = (0, _reactQuery.useQuery)({
|
|
127
|
+
queryKey: [ASSET_DOWNLOAD_URLS_QUERY_KEY, viewerKey, signature],
|
|
128
|
+
enabled: requests.length > 0 && viewerKey.length > 0,
|
|
129
|
+
staleTime: ASSET_URL_STALE_MS,
|
|
130
|
+
gcTime: ASSET_URL_GC_MS,
|
|
131
|
+
// Keep previously-resolved URLs on screen while the SAME viewer's file set
|
|
132
|
+
// grows (pagination), but never carry another account's scoped media tokens
|
|
133
|
+
// across a switch — `keepPreviousData` alone would do that.
|
|
134
|
+
placeholderData: (previousData, previousQuery) => {
|
|
135
|
+
if (!previousData || !previousQuery) return undefined;
|
|
136
|
+
const prevViewer = previousQuery.queryKey[1];
|
|
137
|
+
if (prevViewer !== viewerKey) return undefined;
|
|
138
|
+
return previousData;
|
|
139
|
+
},
|
|
140
|
+
queryFn: async () => {
|
|
141
|
+
const merged = {};
|
|
142
|
+
for (let i = 0; i < requests.length; i += BATCH_CAP) {
|
|
143
|
+
const chunk = requests.slice(i, i + BATCH_CAP);
|
|
144
|
+
const urls = await oxyServices.getFileDownloadUrls(chunk, {
|
|
145
|
+
expiresIn: ASSET_URL_TTL_SECONDS
|
|
146
|
+
});
|
|
147
|
+
Object.assign(merged, urls);
|
|
148
|
+
}
|
|
149
|
+
return merged;
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
return (0, _react.useMemo)(() => {
|
|
153
|
+
const map = new Map();
|
|
154
|
+
const data = query.data;
|
|
155
|
+
if (data) {
|
|
156
|
+
for (const [id, url] of Object.entries(data)) {
|
|
157
|
+
if (typeof url === 'string' && url.length > 0) map.set(id, url);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return map;
|
|
161
|
+
}, [query.data]);
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=useResolvedFileUrls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_reactQuery","ASSET_URL_TTL_SECONDS","ASSET_URL_STALE_MS","ASSET_URL_GC_MS","BATCH_CAP","ASSET_DOWNLOAD_URLS_QUERY_KEY","exports","isOptimisticFile","file","id","startsWith","metadata","uploading","thumbVariantFor","contentType","undefined","localPreviewUri","uri","length","fileThumbSource","resolved","get","useResolvedFileUrls","oxyServices","files","viewerId","viewerKey","requests","useMemo","list","variant","push","fileId","signature","map","r","sort","join","query","useQuery","queryKey","enabled","staleTime","gcTime","placeholderData","previousData","previousQuery","prevViewer","queryFn","merged","i","chunk","slice","urls","getFileDownloadUrls","expiresIn","Object","assign","Map","data","url","entries","set"],"sourceRoot":"../../../../src","sources":["ui/hooks/useResolvedFileUrls.ts"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,MAAME,qBAAqB,GAAG,GAAG,CAAC,CAAC;AACnC;AACA;AACA;AACA;AACA,MAAMC,kBAAkB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;AAC1C,MAAMC,eAAe,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;AACtC;AACA,MAAMC,SAAS,GAAG,GAAG;;AAErB;AACO,MAAMC,6BAA6B,GAAAC,OAAA,CAAAD,6BAAA,GAAG,mBAA4B;;AAEzE;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,gBAAgBA,CAACC,IAA2C,EAAW;EACrF,IAAI,OAAOA,IAAI,CAACC,EAAE,KAAK,QAAQ,IAAID,IAAI,CAACC,EAAE,CAACC,UAAU,CAAC,OAAO,CAAC,EAAE,OAAO,IAAI;EAC3E,OAAOF,IAAI,CAACG,QAAQ,EAAEC,SAAS,KAAK,IAAI;AAC1C;;AAEA;AACA,SAASC,eAAeA,CAACL,IAAkB,EAAsB;EAC/D,IAAIA,IAAI,CAACM,WAAW,CAACJ,UAAU,CAAC,QAAQ,CAAC,EAAE,OAAO,QAAQ;EAC1D,IAAIF,IAAI,CAACM,WAAW,CAACJ,UAAU,CAAC,QAAQ,CAAC,EAAE,OAAO,OAAO;EACzD,OAAOK,SAAS;AAClB;;AAE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AiB,CAAC;IACrC,MAAMC,IAAI,GAAGrB,KAAK,CAACqB,IAAI;IACvB,IAAIA,IAAI,EAAE;MACR,KAAK,MAAM,CAAClD,EAAE,EAAEmD,GAAG,CAAC,IAAIJ,MAAM,CAACK,OAAO,CAACF,IAAI,CAAC,EAAE;QAC5C,IAAI,OAAOC,GAAG,KAAK,QAAQ,IAAIA,GAAG,CAAC1C,MAAM,GAAG,CAAC,EAAEgB,GAAG,CAAC4B,GAAG,CAACrD,EAAE,EAAEmD,GAAG,CAAC;MACjE;IACF;IACA,OAAO1B,GAAG;EACZ,CAAC,EAAE,CAACI,KAAK,CAACqB,IAAI,CAAC,CAAC;AAClB","ignoreList":[]}
|
package/lib/commonjs/ui/index.js
CHANGED
|
@@ -173,7 +173,7 @@ var _LogoText = require("./components/logo/LogoText.js");
|
|
|
173
173
|
var _RequireOxyAuth = require("./components/RequireOxyAuth.js");
|
|
174
174
|
var _FollowButton = _interopRequireDefault(require("./components/FollowButton.js"));
|
|
175
175
|
var _OxyPayButton = _interopRequireDefault(require("./components/OxyPayButton.js"));
|
|
176
|
-
var _FontLoader = require("./components/FontLoader
|
|
176
|
+
var _FontLoader = require("./components/FontLoader");
|
|
177
177
|
var _ProfileButton = _interopRequireDefault(require("./components/ProfileButton.js"));
|
|
178
178
|
var _OxyContext = require("./context/OxyContext.js");
|
|
179
179
|
var _useAuth = require("./hooks/useAuth.js");
|
|
@@ -17,6 +17,7 @@ var _OxyContext = require("../context/OxyContext.js");
|
|
|
17
17
|
var _useI18n = require("../hooks/useI18n.js");
|
|
18
18
|
var _useAccountMutations = require("../hooks/mutations/useAccountMutations.js");
|
|
19
19
|
var _fileManagement = require("../utils/fileManagement.js");
|
|
20
|
+
var _useResolvedFileUrls = require("../hooks/useResolvedFileUrls.js");
|
|
20
21
|
var _FileViewer = require("../components/fileManagement/FileViewer.js");
|
|
21
22
|
var _FileDetailsModal = require("../components/fileManagement/FileDetailsModal.js");
|
|
22
23
|
var _UploadPreview = require("../components/fileManagement/UploadPreview.js");
|
|
@@ -310,10 +311,16 @@ const FileManagementScreen = ({
|
|
|
310
311
|
onClose?.();
|
|
311
312
|
}, [selectMode, multiSelect, selectedIds, files, onConfirmSelection, onClose, defaultVisibility, oxyServices, linkContext]);
|
|
312
313
|
|
|
313
|
-
//
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
314
|
+
// Private-safe thumbnail URLs for the currently-shown files, resolved in
|
|
315
|
+
// ONE batch per page (not N per-tile) and cached by React Query. Uploads
|
|
316
|
+
// default to private, so the synchronous public-CDN URL would 404 for
|
|
317
|
+
// every private thumbnail.
|
|
318
|
+
const resolvedThumbUrls = (0, _useResolvedFileUrls.useResolvedFileUrls)(oxyServices, filteredFiles, user?.id);
|
|
319
|
+
|
|
320
|
+
// Image source for a grid tile: the resolved private-safe URL for a
|
|
321
|
+
// persisted file, or the locally-picked preview for an in-flight optimistic
|
|
322
|
+
// entry. Never builds an asset URL from a `temp-…`/uploading id.
|
|
323
|
+
const thumbSourceFor = (0, _react.useCallback)(file => (0, _useResolvedFileUrls.fileThumbSource)(file, resolvedThumbUrls), [resolvedThumbUrls]);
|
|
317
324
|
const bloomTheme = (0, _theme.useTheme)();
|
|
318
325
|
const {
|
|
319
326
|
colors
|
|
@@ -442,7 +449,14 @@ const FileManagementScreen = ({
|
|
|
442
449
|
try {
|
|
443
450
|
await Promise.all(photosToLoad.map(async photo => {
|
|
444
451
|
try {
|
|
445
|
-
const downloadUrl =
|
|
452
|
+
const downloadUrl = thumbSourceFor(photo);
|
|
453
|
+
// URL not resolved yet — skip (do NOT record fallback
|
|
454
|
+
// dims) so this photo is re-measured once its private-safe
|
|
455
|
+
// URL resolves. Measuring the broken public URL is exactly
|
|
456
|
+
// the bug we are fixing.
|
|
457
|
+
if (!downloadUrl) {
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
446
460
|
|
|
447
461
|
// Unified approach using Image.getSize (works on all platforms)
|
|
448
462
|
await new Promise(resolve => {
|
|
@@ -480,7 +494,19 @@ const FileManagementScreen = ({
|
|
|
480
494
|
} finally {
|
|
481
495
|
setLoadingDimensions(false);
|
|
482
496
|
}
|
|
483
|
-
}, [
|
|
497
|
+
}, [thumbSourceFor, photoDimensions]);
|
|
498
|
+
|
|
499
|
+
// Re-measure photo dimensions when their private-safe URLs resolve. The
|
|
500
|
+
// justified grid's own trigger fires on the photo SET, not on URL
|
|
501
|
+
// availability, so newly-resolved private tiles would otherwise keep their
|
|
502
|
+
// skipped (unmeasured) state and render with fallback geometry.
|
|
503
|
+
(0, _react.useEffect)(() => {
|
|
504
|
+
if (viewMode !== 'photos') return;
|
|
505
|
+
const photos = filteredFiles.filter(file => file.contentType.startsWith('image/'));
|
|
506
|
+
if (photos.length > 0) {
|
|
507
|
+
loadPhotoDimensions(photos);
|
|
508
|
+
}
|
|
509
|
+
}, [resolvedThumbUrls, viewMode, filteredFiles, loadPhotoDimensions]);
|
|
484
510
|
|
|
485
511
|
// Create justified rows from photos with responsive algorithm
|
|
486
512
|
const createJustifiedRows = (0, _react.useCallback)((photos, containerWidth) => {
|
|
@@ -624,9 +650,10 @@ const FileManagementScreen = ({
|
|
|
624
650
|
// Unified download function - works on all platforms
|
|
625
651
|
const handleFileDownload = async (fileId, filename) => {
|
|
626
652
|
try {
|
|
627
|
-
//
|
|
628
|
-
//
|
|
629
|
-
|
|
653
|
+
// Resolve an authenticated, private-safe URL. The synchronous
|
|
654
|
+
// `getFileDownloadUrl` yields the public CDN origin, which 404s for
|
|
655
|
+
// private assets (the default visibility).
|
|
656
|
+
const downloadUrl = await oxyServices.getFileDownloadUrlAsync(fileId);
|
|
630
657
|
|
|
631
658
|
// For web platforms, use link download
|
|
632
659
|
if (typeof window !== 'undefined' && window.document) {
|
|
@@ -678,8 +705,10 @@ const FileManagementScreen = ({
|
|
|
678
705
|
if (file.contentType.startsWith('text/') || file.contentType.includes('json') || file.contentType.includes('xml') || file.contentType.includes('javascript') || file.contentType.includes('typescript') || file.contentType.startsWith('image/') || file.contentType.includes('pdf') || file.contentType.startsWith('video/') || file.contentType.startsWith('audio/')) {
|
|
679
706
|
try {
|
|
680
707
|
if (file.contentType.startsWith('image/') || file.contentType.includes('pdf') || file.contentType.startsWith('video/') || file.contentType.startsWith('audio/')) {
|
|
681
|
-
// For images, PDFs, videos, and audio, we
|
|
682
|
-
|
|
708
|
+
// For images, PDFs, videos, and audio, we render the URL
|
|
709
|
+
// directly. Resolve the authenticated, private-safe URL —
|
|
710
|
+
// the synchronous public-CDN URL 404s for private assets.
|
|
711
|
+
const downloadUrl = await oxyServices.getFileDownloadUrlAsync(file.id);
|
|
683
712
|
setFileContent(downloadUrl);
|
|
684
713
|
} else {
|
|
685
714
|
// For text files, get the content using authenticated request
|
|
@@ -715,7 +744,7 @@ const FileManagementScreen = ({
|
|
|
715
744
|
fileDetailsControl.open();
|
|
716
745
|
};
|
|
717
746
|
const renderSimplePhotoItem = (0, _react.useCallback)((photo, index) => {
|
|
718
|
-
const downloadUrl =
|
|
747
|
+
const downloadUrl = thumbSourceFor(photo);
|
|
719
748
|
|
|
720
749
|
// Calculate photo item width based on actual container size from bottom sheet
|
|
721
750
|
let itemsPerRow = 3; // Default for mobile
|
|
@@ -763,9 +792,9 @@ const FileManagementScreen = ({
|
|
|
763
792
|
})]
|
|
764
793
|
})
|
|
765
794
|
}, photo.id);
|
|
766
|
-
}, [
|
|
795
|
+
}, [thumbSourceFor, safeContainerWidth, selectMode, selectedIds, colors.primary, colors.text]);
|
|
767
796
|
const renderJustifiedPhotoItem = (0, _react.useCallback)((photo, width, height, isLast) => {
|
|
768
|
-
const downloadUrl =
|
|
797
|
+
const downloadUrl = thumbSourceFor(photo);
|
|
769
798
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
770
799
|
style: [_styles.fileManagementStyles.justifiedPhotoItem, {
|
|
771
800
|
width,
|
|
@@ -804,7 +833,7 @@ const FileManagementScreen = ({
|
|
|
804
833
|
})]
|
|
805
834
|
})
|
|
806
835
|
}, photo.id);
|
|
807
|
-
}, [
|
|
836
|
+
}, [thumbSourceFor, selectMode, selectedIds, multiSelect, colors.primary, colors.text]);
|
|
808
837
|
|
|
809
838
|
// Run initial load once per targetUserId change to avoid accidental loops
|
|
810
839
|
const lastLoadedFor = (0, _react.useRef)(undefined);
|
|
@@ -840,7 +869,7 @@ const FileManagementScreen = ({
|
|
|
840
869
|
style: _styles.fileManagementStyles.filePreview,
|
|
841
870
|
children: [isImage && /*#__PURE__*/(0, _jsxRuntime.jsx)(_expoImage.Image, {
|
|
842
871
|
source: {
|
|
843
|
-
uri:
|
|
872
|
+
uri: thumbSourceFor(file)
|
|
844
873
|
},
|
|
845
874
|
style: _styles.fileManagementStyles.previewImage,
|
|
846
875
|
contentFit: "cover",
|
|
@@ -866,7 +895,7 @@ const FileManagementScreen = ({
|
|
|
866
895
|
style: _styles.fileManagementStyles.videoPreviewWrapper,
|
|
867
896
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_expoImage.Image, {
|
|
868
897
|
source: {
|
|
869
|
-
uri:
|
|
898
|
+
uri: thumbSourceFor(file)
|
|
870
899
|
},
|
|
871
900
|
style: _styles.fileManagementStyles.videoPosterImage,
|
|
872
901
|
contentFit: "cover",
|
|
@@ -995,7 +1024,7 @@ const FileManagementScreen = ({
|
|
|
995
1024
|
},
|
|
996
1025
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_expoImage.Image, {
|
|
997
1026
|
source: {
|
|
998
|
-
uri:
|
|
1027
|
+
uri: thumbSourceFor(file)
|
|
999
1028
|
},
|
|
1000
1029
|
style: {
|
|
1001
1030
|
width: 36,
|
|
@@ -1022,7 +1051,7 @@ const FileManagementScreen = ({
|
|
|
1022
1051
|
},
|
|
1023
1052
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_expoImage.Image, {
|
|
1024
1053
|
source: {
|
|
1025
|
-
uri:
|
|
1054
|
+
uri: thumbSourceFor(file)
|
|
1026
1055
|
},
|
|
1027
1056
|
style: {
|
|
1028
1057
|
width: 36,
|
|
@@ -1130,7 +1159,7 @@ const FileManagementScreen = ({
|
|
|
1130
1159
|
}) : undefined
|
|
1131
1160
|
};
|
|
1132
1161
|
});
|
|
1133
|
-
}, [filteredFiles, theme, deleting, handleFileDownload, confirmFileDelete, handleFileOpen,
|
|
1162
|
+
}, [filteredFiles, theme, deleting, handleFileDownload, confirmFileDelete, handleFileOpen, thumbSourceFor, selectMode, selectedIds]);
|
|
1134
1163
|
|
|
1135
1164
|
// Scroll to selected file after selection
|
|
1136
1165
|
(0, _react.useEffect)(() => {
|
|
@@ -1214,7 +1243,7 @@ const FileManagementScreen = ({
|
|
|
1214
1243
|
}
|
|
1215
1244
|
}, [lastSelectedFileId]);
|
|
1216
1245
|
const renderPhotoItem = (photo, index) => {
|
|
1217
|
-
const downloadUrl =
|
|
1246
|
+
const downloadUrl = thumbSourceFor(photo);
|
|
1218
1247
|
|
|
1219
1248
|
// Calculate photo item width based on actual container size from bottom sheet
|
|
1220
1249
|
let itemsPerRow = 3; // Default for mobile
|
|
@@ -1617,7 +1646,7 @@ const FileManagementScreen = ({
|
|
|
1617
1646
|
hasMore: paging.hasMore,
|
|
1618
1647
|
loadingMore: paging.loadingMore,
|
|
1619
1648
|
reduceMotion: reduceMotion,
|
|
1620
|
-
getThumbUrl:
|
|
1649
|
+
getThumbUrl: thumbSourceFor,
|
|
1621
1650
|
primaryColor: colors.primary,
|
|
1622
1651
|
isOwner: isOwner,
|
|
1623
1652
|
onTogglePhoto: toggleSelect,
|