Skip to content

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

mobile: copy support email automatically

Ammar Ahmed7dc581b9f3f5
diff --git a/apps/mobile/app/components/toast/index.tsx b/apps/mobile/app/components/toast/index.tsx
index 33bed9204..e0b6bcf6c 100644
--- a/apps/mobile/app/components/toast/index.tsx
+++ b/apps/mobile/app/components/toast/index.tsx
@@ -154,7 +154,9 @@ export const Toast = ({ context = "global" }) => {
>
<Icon
name={
- toastOptions.type === "success"
+ toastOptions.icon
+ ? toastOptions.icon
+ : toastOptions.type === "success"
? "check"
: toastOptions.type === "info"
? "information"
diff --git a/apps/mobile/app/screens/settings/settings-data.tsx b/apps/mobile/app/screens/settings/settings-data.tsx
index 2a6426f3a..8d173ff9f 100644
--- a/apps/mobile/app/screens/settings/settings-data.tsx
+++ b/apps/mobile/app/screens/settings/settings-data.tsx
@@ -77,6 +77,7 @@ import { useDragState } from "./editor/state";
import { verifyUser, verifyUserWithApplock } from "./functions";
import { SettingSection } from "./types";
import { getTimeLeft } from "./user-section";
+import Clipboard from "@react-native-clipboard/clipboard";
type User = any;
@@ -1383,7 +1384,15 @@ export const settingsGroups: SettingSection[] = [
name: strings.emailSupport(),
icon: "mail",
modifer: () => {
- Linking.openURL("mailto:[email protected]");
+ Clipboard.setString("[email protected]");
+ ToastManager.show({
+ heading: strings.emailCopied(),
+ type: "success",
+ icon: "content-copy"
+ });
+ setTimeout(() => {
+ Linking.openURL("mailto:[email protected]");
+ }, 1000);
},
description: strings.emailSupportDesc()
},
diff --git a/apps/mobile/app/services/event-manager.ts b/apps/mobile/app/services/event-manager.ts
index 6376d895f..a7dc36bd3 100644
--- a/apps/mobile/app/services/event-manager.ts
+++ b/apps/mobile/app/services/event-manager.ts
@@ -148,28 +148,31 @@ export const ToastManager = {
type = "error",
context = "global",
func,
- actionText
+ actionText,
+ icon,
+ duration = 3000
}: ToastOptions) => {
if (Config.isTesting) return;
eSendEvent(eShowToast, {
- heading: heading,
- message: message,
- type: type,
- context: context,
- duration: 3000,
- func: func,
- actionText: actionText
+ heading,
+ message,
+ type,
+ context,
+ func,
+ actionText,
+ icon,
+ duration
});
},
hide: () => eSendEvent(eHideToast),
- error: (e: Error, title?: string, context?: any, duration = 5000) => {
+ error: (e: Error, title?: string, context?: any, duration = 6000) => {
ToastManager.show({
heading: title,
message: e?.message || "",
type: "error",
context: context || "global",
actionText: "Copy logs",
- duration: 6000,
+ duration: duration,
func: () => {
Clipboard.setString(e?.stack || "");
ToastManager.show({
diff --git a/packages/intl/locale/en.po b/packages/intl/locale/en.po
index 4e35307d1..47d05d501 100644
--- a/packages/intl/locale/en.po
+++ b/packages/intl/locale/en.po
@@ -2075,6 +2075,10 @@ msgstr "Editor"
msgid "Email"
msgstr "Email"
+#: src/strings.ts:2383
+msgid "Email copied"
+msgstr "Email copied"
+
#: src/strings.ts:733
msgid "Email is required"
msgstr "Email is required"
diff --git a/packages/intl/locale/pseudo-LOCALE.po b/packages/intl/locale/pseudo-LOCALE.po
index ba262a126..32358c5b6 100644
--- a/packages/intl/locale/pseudo-LOCALE.po
+++ b/packages/intl/locale/pseudo-LOCALE.po
@@ -2068,6 +2068,10 @@ msgstr ""
msgid "Email"
msgstr ""
+#: src/strings.ts:2383
+msgid "Email copied"
+msgstr ""
+
#: src/strings.ts:733
msgid "Email is required"
msgstr ""
diff --git a/packages/intl/src/strings.ts b/packages/intl/src/strings.ts
index 90d97407a..6a1ee9244 100644
--- a/packages/intl/src/strings.ts
+++ b/packages/intl/src/strings.ts
@@ -2379,5 +2379,6 @@ Use this if changes from other devices are not appearing on this device. This wi
plural(count, {
one: `Move all notes in this notebook to trash`,
other: `Move all notes in these notebooks to trash`
- })
+ }),
+ emailCopied: () => t`Email copied`
};