A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
mobile: update download attachments
ammarahm-ede0e505371c2a
diff --git a/apps/mobile/app/components/attachments/download-attachments.js b/apps/mobile/app/components/attachments/download-attachments.jsindex 541983897..1a37e2f65 100644--- a/apps/mobile/app/components/attachments/download-attachments.js+++ b/apps/mobile/app/components/attachments/download-attachments.js@@ -157,7 +157,7 @@ const DownloadAttachments = ({ close, attachments, isNote, update }) => {width={null}animated={true}useNativeDriver- progress={progress.value || 0}+ progress={progress.value ? progress.value / 100 : 0}unfilledColor={colors.nav}color={colors.accent}borderWidth={0}@@ -187,14 +187,17 @@ const DownloadAttachments = ({ close, attachments, isNote, update }) => {<Paragraph color={colors.icon}>No downloads in progress.</Paragraph></View>}- renderItem={({ item }) => (- <AttachmentItem- attachment={item}- setAttachments={() => {}}- pressable={false}- hideWhenNotDownloading={true}- />- )}+ keyExtractor={(item) => item.id}+ renderItem={({ item }) => {+ return (+ <AttachmentItem+ attachment={item}+ setAttachments={() => {}}+ pressable={false}+ hideWhenNotDownloading={true}+ />+ );+ }}/>{result.size ? (diff --git a/apps/mobile/app/components/attachments/index.js b/apps/mobile/app/components/attachments/index.jsindex d85972f12..b66185b46 100644--- a/apps/mobile/app/components/attachments/index.js+++ b/apps/mobile/app/components/attachments/index.js@@ -35,8 +35,12 @@ import Paragraph from "../ui/typography/paragraph";import { AttachmentItem } from "./attachment-item";import DownloadAttachments from "./download-attachments";import { Button } from "../ui/button";--const documentMimeTypes = ["application/pdf"];+import {+ isAudio,+ isDocument,+ isImage,+ isVideo+} from "@notesnook/core/utils/filename";export const AttachmentDialog = ({ note }) => {const colors = useThemeStore((state) => state.colors);@@ -127,26 +131,25 @@ export const AttachmentDialog = ({ note }) => {const attachments = note? db.attachments.ofNote(note.id, "all"): [...(db.attachments.all || [])];-+ isDocument;switch (type) {case "all":return attachments;case "images":return attachments.filter((attachment) =>- attachment.metadata.type.startsWith("image/")+ isImage(attachment.metadata.type));case "video":return attachments.filter((attachment) =>- attachment.metadata.type.startsWith("video/")+ isVideo(attachment.metadata.type));case "audio":return attachments.filter((attachment) =>- attachment.metadata.type.startsWith("audio/")+ isAudio(attachment.metadata.type));case "documents":- return attachments.filter(- (attachment) =>- documentMimeTypes.indexOf(attachment.metadata.type) > -1+ return attachments.filter((attachment) =>+ isDocument(attachment.metadata.type));}};@@ -231,12 +234,14 @@ export const AttachmentDialog = ({ note }) => {maxToRenderPerBatch={10}initialNumToRender={10}windowSize={5}+ stickyHeaderIndices={[0]}ListHeaderComponent={<ScrollViewstyle={{width: "100%",height: 50,- flexDirection: "row"+ flexDirection: "row",+ backgroundColor: colors.bg}}contentContainerStyle={{minWidth: "100%"