diff --git a/apps/mobile/app/components/attachments/index.js b/apps/mobile/app/components/attachments/index.js
index 5ce300ec7..8f14b66a7 100644
--- a/apps/mobile/app/components/attachments/index.js
+++ b/apps/mobile/app/components/attachments/index.js
@@ -18,7 +18,7 @@ along with this program. If not, see .
*/
import React, { useRef, useState } from "react";
-import { View } from "react-native";
+import { ActivityIndicator, View } from "react-native";
import { FlatList } from "react-native-actions-sheet";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { db } from "../../common/database";
@@ -71,14 +71,21 @@ export const AttachmentDialog = ({ note }) => {
const onCheck = async () => {
setLoading(true);
+ const checkedAttachments = [];
for (let attachment of attachments) {
let result = await filesystem.checkAttachment(attachment.metadata.hash);
if (result.failed) {
- db.attachments.markAsFailed(attachment.metadata.hash, result.failed);
+ await db.attachments.markAsFailed(
+ attachment.metadata.hash,
+ result.failed
+ );
} else {
- db.attachments.markAsFailed(attachment.id, null);
+ await db.attachments.markAsFailed(attachment.id, null);
}
- setAttachments([...db.attachments.all]);
+ checkedAttachments.push(
+ db.attachments.attachment(attachment.metadata.hash)
+ );
+ setAttachments([...checkedAttachments]);
}
setLoading(false);
};
@@ -106,17 +113,28 @@ export const AttachmentDialog = ({ note }) => {
flexDirection: "row"
}}
>
-
+ {loading ? (
+
+ ) : (
+
+ )}