mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-05-18 13:16:11 +02:00
mobile: fix handling invalid gift code
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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:2172
|
||||
msgid "GNU GENERAL PUBLIC LICENSE Version 3"
|
||||
msgstr "GNU GENERAL PUBLIC LICENSE Version 3"
|
||||
|
||||
@@ -3083,6 +3083,10 @@ msgstr ""
|
||||
msgid "Getting recovery codes"
|
||||
msgstr ""
|
||||
|
||||
#: src/strings.ts:2663
|
||||
msgid "Gift code required"
|
||||
msgstr ""
|
||||
|
||||
#: src/strings.ts:2172
|
||||
msgid "GNU GENERAL PUBLIC LICENSE Version 3"
|
||||
msgstr ""
|
||||
|
||||
@@ -2659,5 +2659,6 @@ Use this if changes from other devices are not appearing on this device. This wi
|
||||
t`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`
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user