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