Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

show loading when checking attachments

ammarahm-ede6ae6ce51cb8
diff --git a/apps/mobile/src/components/attachments/index.js b/apps/mobile/src/components/attachments/index.js
index dfbd8b2c1..9a33721ca 100644
--- a/apps/mobile/src/components/attachments/index.js
+++ b/apps/mobile/src/components/attachments/index.js
@@ -23,6 +23,7 @@ export const AttachmentDialog = () => {
const [attachments, setAttachments] = useState([]);
const attachmentSearchValue = useRef();
const searchTimer = useRef();
+ const [loading, setLoading] = useState(false);
useEffect(() => {
eSubscribeEvent(eOpenAttachmentsDialog, open);
@@ -98,14 +99,17 @@ export const AttachmentDialog = () => {
button={{
title: 'Check all',
type: 'accent',
+ loading: loading,
onPress: async () => {
+ setLoading(true);
for (let attachment of attachments) {
let result = await filesystem.checkAttachment(attachment.metadata.hash);
if (result.failed) {
db.attachments.markAsFailed(attachment.metadata.hash, result.failed);
+ setAttachments([...db.attachments.all]);
}
}
- setAttachments([...db.attachments.all]);
+ setLoading(false);
}
}}
/>
diff --git a/apps/mobile/src/components/dialog/DialogHeader.js b/apps/mobile/src/components/dialog/DialogHeader.js
index c974f39c7..96dca794d 100644
--- a/apps/mobile/src/components/dialog/DialogHeader.js
+++ b/apps/mobile/src/components/dialog/DialogHeader.js
@@ -53,6 +53,7 @@ const DialogHeader = ({
borderRadius: 100,
paddingHorizontal: 12
}}
+ loading={button.loading}
fontSize={13}
title={button.title}
type={button.type || 'grayBg'}