Skip to content

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

mobile: fix audio playback in editor

Ammar Ahmedb169206c689f
diff --git a/apps/mobile/app/screens/editor/index.tsx b/apps/mobile/app/screens/editor/index.tsx
index 3a383dec9..896399e31 100755
--- a/apps/mobile/app/screens/editor/index.tsx
+++ b/apps/mobile/app/screens/editor/index.tsx
@@ -183,6 +183,7 @@ const Editor = React.memo(
hideKeyboardAccessoryView={false}
allowsFullscreenVideo={true}
allowFileAccessFromFileURLs={true}
+ allowsInlineMediaPlayback
allowUniversalAccessFromFileURLs={true}
originWhitelist={["*"]}
source={{
diff --git a/apps/mobile/app/screens/editor/tiptap/use-editor-events.tsx b/apps/mobile/app/screens/editor/tiptap/use-editor-events.tsx
index bdca7806a..471bd5205 100644
--- a/apps/mobile/app/screens/editor/tiptap/use-editor-events.tsx
+++ b/apps/mobile/app/screens/editor/tiptap/use-editor-events.tsx
@@ -534,15 +534,24 @@ export const useEditorEvents = (
}
case EditorEvents.getAttachmentData: {
- const attachment = (editorMessage.value as any)
- ?.attachment as Attachment;
+ const data = (editorMessage.value as any)?.attachment as Attachment;
+ const attachment = await db.attachments.attachment(data.hash);
+
+ if (!attachment) {
+ editor.postMessage(NativeEvents.resolve, {
+ resolverId: editorMessage.resolverId,
+ data: undefined
+ });
+ break;
+ }
DatabaseLogger.log(
- `Getting attachment data: ${attachment?.hash} ${attachment?.type}`
+ `Getting attachment data: ${attachment.mimeType} ${attachment.hash} ${data.type}`
);
downloadAttachment(attachment.hash, true, {
- base64: attachment.type === "image",
- text: attachment.type === "web-clip",
+ base64:
+ data.type === "image" || attachment.mimeType?.startsWith("audio"),
+ text: data.type === "web-clip",
silent: true,
groupId: editor.note.current?.id,
cache: true
@@ -550,7 +559,7 @@ export const useEditorEvents = (
.then((data: any) => {
console.log(
"Got attachment data:",
- !!data,
+ data,
editorMessage.resolverId
);
editor.postMessage(NativeEvents.resolve, {