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: fix handling invalid gift code
Ammar Ahmed5ef3bdcad45b
diff --git a/apps/mobile/app/screens/settings/settings-data.tsx b/apps/mobile/app/screens/settings/settings-data.tsxindex c2369337c..0328b1240 100644--- a/apps/mobile/app/screens/settings/settings-data.tsx+++ b/apps/mobile/app/screens/settings/settings-data.tsx@@ -238,13 +238,21 @@ export const settingsGroups: SettingSection[] = [inputPlaceholder: strings.code(),positiveText: strings.redeem(),positivePress: async (value) => {- db.subscriptions.redeemCode(value).catch((e) => {+ try {+ if (!value || !value.trim()) {+ throw new Error(strings.giftCodeRequired());+ }++ await db.subscriptions.redeemCode(value);+ return true;+ } catch (e) {ToastManager.show({heading: "Error redeeming code",message: (e as Error).message,type: "error"});- });+ return false;+ }}});}diff --git a/packages/intl/locale/en.po b/packages/intl/locale/en.poindex a16f04684..311ee8c33 100644--- a/packages/intl/locale/en.po+++ b/packages/intl/locale/en.po@@ -3101,6 +3101,10 @@ msgstr "Getting information"msgid "Getting recovery codes"msgstr "Getting recovery codes"+#: src/strings.ts:2663+msgid "Gift code required"+msgstr "Gift code required"+#: src/strings.ts:2172msgid "GNU GENERAL PUBLIC LICENSE Version 3"msgstr "GNU GENERAL PUBLIC LICENSE Version 3"diff --git a/packages/intl/locale/pseudo-LOCALE.po b/packages/intl/locale/pseudo-LOCALE.poindex 2d924d193..0f076d21c 100644--- a/packages/intl/locale/pseudo-LOCALE.po+++ b/packages/intl/locale/pseudo-LOCALE.po@@ -3083,6 +3083,10 @@ msgstr ""msgid "Getting recovery codes"msgstr ""+#: src/strings.ts:2663+msgid "Gift code required"+msgstr ""+#: src/strings.ts:2172msgid "GNU GENERAL PUBLIC LICENSE Version 3"msgstr ""diff --git a/packages/intl/src/strings.ts b/packages/intl/src/strings.tsindex eca1169f3..0b5621788 100644--- a/packages/intl/src/strings.ts+++ b/packages/intl/src/strings.ts@@ -2659,5 +2659,6 @@ Use this if changes from other devices are not appearing on this device. This wit`Value must be between ${min} and ${max}`,passwordRequired: () => t`Password required`,confirmPasswordRequired: () => t`Confirm password required`,- enterAValidEmailAddress: () => t`Please enter a valid email address`+ enterAValidEmailAddress: () => t`Please enter a valid email address`,+ giftCodeRequired: () => t`Gift code required`};