Merge pull request #386 from ente-io/shared_album_v2

Minor bug fixes in shared album
This commit is contained in:
Neeraj Gupta 2022-02-22 14:20:53 +05:30 committed by GitHub
commit 3ab7b510b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View file

@ -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>;
}

View file

@ -321,6 +321,8 @@ export const removePublicCollectionWithFiles = async (
)
);
await localForage.removeItem(getPublicCollectionSyncTimeUID(collectionUID));
const publicCollectionFiles =
(await localForage.getItem<LocalSavedPublicCollectionFiles[]>(
PUBLIC_COLLECTION_FILES_TABLE

View file

@ -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?',