Merge pull request #386 from ente-io/shared_album_v2
Minor bug fixes in shared album
This commit is contained in:
commit
3ab7b510b3
|
@ -43,6 +43,7 @@ export default function PublicCollectionGallery() {
|
|||
const url = useRef<string>(null);
|
||||
const [publicFiles, setPublicFiles] = useState<EnteFile[]>(null);
|
||||
const [publicCollection, setPublicCollection] = useState<Collection>(null);
|
||||
const [errorMessage, setErrorMessage] = useState<String>(null);
|
||||
const appContext = useContext(AppContext);
|
||||
const [abuseReportFormView, setAbuseReportFormView] = useState(false);
|
||||
const [dialogMessage, setDialogMessage] = useState<MessageAttributes>();
|
||||
|
@ -135,9 +136,11 @@ export default function PublicCollectionGallery() {
|
|||
setPublicCollection(collection);
|
||||
|
||||
await syncPublicFiles(token.current, collection, setPublicFiles);
|
||||
setErrorMessage(null);
|
||||
} catch (e) {
|
||||
const parsedError = parseSharingErrorCodes(e);
|
||||
if (parsedError.message === CustomError.TOKEN_EXPIRED) {
|
||||
setErrorMessage(constants.LINK_EXPIRED);
|
||||
// share has been disabled
|
||||
// local cache should be cleared
|
||||
removePublicCollectionWithFiles(
|
||||
|
@ -155,6 +158,11 @@ export default function PublicCollectionGallery() {
|
|||
if (!publicFiles && loading) {
|
||||
return <Loader />;
|
||||
}
|
||||
|
||||
if (errorMessage && !loading) {
|
||||
return <Container>{errorMessage}</Container>;
|
||||
}
|
||||
|
||||
if (!publicFiles && !loading) {
|
||||
return <Container>{constants.NOT_FOUND}</Container>;
|
||||
}
|
||||
|
|
|
@ -321,6 +321,8 @@ export const removePublicCollectionWithFiles = async (
|
|||
)
|
||||
);
|
||||
|
||||
await localForage.removeItem(getPublicCollectionSyncTimeUID(collectionUID));
|
||||
|
||||
const publicCollectionFiles =
|
||||
(await localForage.getItem<LocalSavedPublicCollectionFiles[]>(
|
||||
PUBLIC_COLLECTION_FILES_TABLE
|
||||
|
|
|
@ -627,6 +627,7 @@ const englishConstants = {
|
|||
ALBUM_URL: 'album url',
|
||||
PUBLIC_SHARING: 'link sharing',
|
||||
NOT_FOUND: '404 - not found',
|
||||
LINK_EXPIRED: 'the link has expired!',
|
||||
DISABLE_PUBLIC_SHARING: "'disable public sharing",
|
||||
DISABLE_PUBLIC_SHARING_MESSAGE:
|
||||
'are you sure you want to disable public sharing?',
|
||||
|
|
Loading…
Reference in a new issue