Compare commits

...

3 Commits

Author SHA1 Message Date
Ammar Ahmed
17023d949f mobile: disable template when pin note to notifications 2024-05-11 12:46:12 +05:00
Ammar Ahmed
e09b1a556a mobile: fix exporting note to text for share/copy 2024-05-11 12:38:03 +05:00
Ammar Ahmed
ff379a52db mobile: fix update notification not showing on mobile app 2024-05-11 12:12:50 +05:00
4 changed files with 10 additions and 27 deletions

View File

@@ -586,7 +586,7 @@ export class VaultDialog extends Component {
} }
async _copyNote(note) { async _copyNote(note) {
Clipboard.setString(await convertNoteToText(note)); Clipboard.setString((await convertNoteToText(note, true)) || "");
ToastManager.show({ ToastManager.show({
heading: "Note copied", heading: "Note copied",
type: "success", type: "success",
@@ -602,7 +602,7 @@ export class VaultDialog extends Component {
await Share.open({ await Share.open({
heading: "Share note", heading: "Share note",
failOnCancel: false, failOnCancel: false,
message: await convertNoteToText(note) message: (await convertNoteToText(note)) || ""
}); });
} catch (e) { } catch (e) {
console.error(e); console.error(e);

View File

@@ -600,20 +600,11 @@ export const useActions = ({
}); });
return; return;
} }
const text = await convertNoteToText(item as Note, false); const text = await convertNoteToText(item as Note, true);
if (!text) { const html = (text || "").replace(/\n/g, "<br />");
ToastManager.error(
new Error(Errors.export("text")),
undefined,
"local"
);
return;
}
const html = text.replace(/\n/g, "<br />");
await Notifications.displayNotification({ await Notifications.displayNotification({
title: item.title, title: item.title,
message: (item as Note).headline || text, message: (item as Note).headline || text || "",
subtitle: "", subtitle: "",
bigText: html, bigText: html,
ongoing: true, ongoing: true,
@@ -684,15 +675,11 @@ export const useActions = ({
} else { } else {
processingId.current = "shareNote"; processingId.current = "shareNote";
const convertedText = await convertNoteToText(item); const convertedText = await convertNoteToText(item);
if (!convertedText) {
ToastManager.error(new Error(Errors.export("text")));
return;
}
processingId.current = undefined; processingId.current = undefined;
Share.open({ Share.open({
title: "Share note to", title: "Share note to",
failOnCancel: false, failOnCancel: false,
message: convertedText message: convertedText || ""
}); });
} }
} }
@@ -772,11 +759,7 @@ export const useActions = ({
} else { } else {
processingId.current = "copyContent"; processingId.current = "copyContent";
const text = await convertNoteToText(item as Note, true); const text = await convertNoteToText(item as Note, true);
if (!text) { Clipboard.setString(text || "");
ToastManager.error(new Error(Errors.export("text")));
return;
}
Clipboard.setString(text);
processingId.current = undefined; processingId.current = undefined;
ToastManager.show({ ToastManager.show({
heading: "Note copied to clipboard", heading: "Note copied to clipboard",

View File

@@ -952,13 +952,13 @@ async function pinNote(id: string) {
const note = await db.notes.note(id as string); const note = await db.notes.note(id as string);
if (!note) return; if (!note) return;
let text = await convertNoteToText(note, false); let text = await convertNoteToText(note, true);
if (!text) text = ""; if (!text) text = "";
const html = text.replace(/\n/g, "<br />"); const html = text.replace(/\n/g, "<br />");
Notifications.displayNotification({ Notifications.displayNotification({
title: note.title, title: note.title,
message: note.headline || text, message: note.headline || text,
subtitle: note.headline || text, subtitle: "",
bigText: html, bigText: html,
ongoing: true, ongoing: true,
actions: ["UNPIN"], actions: ["UNPIN"],

View File

@@ -23,7 +23,7 @@ export const IOS_APPGROUPID = "group.org.streetwriters.notesnook";
export const FILE_SIZE_LIMIT = 500 * 1024 * 1024; export const FILE_SIZE_LIMIT = 500 * 1024 * 1024;
export const IMAGE_SIZE_LIMIT = 50 * 1024 * 1024; export const IMAGE_SIZE_LIMIT = 50 * 1024 * 1024;
export const BETA = true; export const BETA = false;
export const STORE_LINK = export const STORE_LINK =
Platform.OS === "ios" Platform.OS === "ios"