mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-23 19:49:56 +01:00
mobile: redeem gift code
This commit is contained in:
committed by
Abdullah Atta
parent
6b4f7900ec
commit
c2e7f7576e
@@ -78,8 +78,7 @@ import { verifyUser, verifyUserWithApplock } from "./functions";
|
||||
import { SettingSection } from "./types";
|
||||
import { getTimeLeft } from "./user-section";
|
||||
import Clipboard from "@react-native-clipboard/clipboard";
|
||||
|
||||
type User = any;
|
||||
import { User } from "@notesnook/core";
|
||||
|
||||
export const settingsGroups: SettingSection[] = [
|
||||
{
|
||||
@@ -119,6 +118,10 @@ export const settingsGroups: SettingSection[] = [
|
||||
"MMMM D, YYYY"
|
||||
);
|
||||
|
||||
if (user.subscription.provider === 4) {
|
||||
return strings.subEndsOn(expiryDate);
|
||||
}
|
||||
|
||||
return user.subscription?.type === 2
|
||||
? strings.signedUpOn(startDate)
|
||||
: user.subscription?.type === 1
|
||||
@@ -134,6 +137,39 @@ export const settingsGroups: SettingSection[] = [
|
||||
: strings.neverHesitate();
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "redeem-gift-code",
|
||||
name: strings.redeemGiftCode(),
|
||||
description: strings.redeemGiftCodeDesc(),
|
||||
hidden: (current) => {
|
||||
return !current as boolean;
|
||||
},
|
||||
useHook: () =>
|
||||
useUserStore(
|
||||
(state) =>
|
||||
state.user?.subscription.type == SUBSCRIPTION_STATUS.TRIAL ||
|
||||
state.user?.subscription.type == SUBSCRIPTION_STATUS.BASIC
|
||||
),
|
||||
icon: "gift",
|
||||
modifer: () => {
|
||||
presentDialog({
|
||||
title: strings.redeemGiftCode(),
|
||||
paragraph: strings.redeemGiftCodeDesc(),
|
||||
input: true,
|
||||
inputPlaceholder: strings.code(),
|
||||
positiveText: strings.redeem(),
|
||||
positivePress: async (value) => {
|
||||
db.subscriptions.redeemCode(value).catch((e) => {
|
||||
ToastManager.show({
|
||||
heading: "Error redeeming code",
|
||||
message: (e as Error).message,
|
||||
type: "error"
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "account-settings",
|
||||
type: "screen",
|
||||
|
||||
@@ -126,18 +126,19 @@ export const Subscription = () => {
|
||||
user.subscription?.type !== SUBSCRIPTION_STATUS.PREMIUM_EXPIRED &&
|
||||
user.subscription?.type !== SUBSCRIPTION_STATUS.BASIC ? (
|
||||
<Button
|
||||
title={subscriptionProviderInfo?.title}
|
||||
title={subscriptionProviderInfo?.title()}
|
||||
onPress={() => {
|
||||
presentSheet({
|
||||
title: subscriptionProviderInfo.title,
|
||||
paragraph: subscriptionProviderInfo.desc
|
||||
title: subscriptionProviderInfo.title(),
|
||||
paragraph: subscriptionProviderInfo.desc()
|
||||
});
|
||||
}}
|
||||
style={{
|
||||
alignSelf: "flex-start",
|
||||
borderRadius: 100
|
||||
width: "100%",
|
||||
paddingHorizontal: 0
|
||||
}}
|
||||
fontSize={SIZE.sm}
|
||||
fontSize={SIZE.xs}
|
||||
height={30}
|
||||
type="secondaryAccented"
|
||||
/>
|
||||
|
||||
Binary file not shown.
@@ -81,7 +81,8 @@ const EXTRA_ICON_NAMES = [
|
||||
"notebook-plus",
|
||||
"arrow-right-bold-box-outline",
|
||||
"arrow-up-bold",
|
||||
"login"
|
||||
"login",
|
||||
"gift"
|
||||
];
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
|
||||
@@ -4584,6 +4584,10 @@ msgstr "Recovery key text file saved"
|
||||
msgid "Recovery successful!"
|
||||
msgstr "Recovery successful!"
|
||||
|
||||
#: src/strings.ts:2408
|
||||
msgid "Redeem"
|
||||
msgstr "Redeem"
|
||||
|
||||
#: src/strings.ts:2405
|
||||
msgid "Redeem gift code"
|
||||
msgstr "Redeem gift code"
|
||||
|
||||
@@ -4564,6 +4564,10 @@ msgstr "<<<<<<< HEAD<<<<<<< HEAD"
|
||||
|
||||
#: src/strings.ts:1891
|
||||
msgid "Recovery successful!"
|
||||
msgstr "<<<<<<< HEAD"
|
||||
|
||||
#: src/strings.ts:2408
|
||||
msgid "Redeem"
|
||||
msgstr ""
|
||||
|
||||
#: src/strings.ts:2405
|
||||
|
||||
@@ -2404,5 +2404,6 @@ Use this if changes from other devices are not appearing on this device. This wi
|
||||
emailCopied: () => t`Email copied`,
|
||||
redeemGiftCode: () => t`Redeem gift code`,
|
||||
redeemGiftCodeDesc: () => t`Enter the gift code to redeem your subscription.`,
|
||||
redeemingGiftCode: () => t`Redeeming gift code`
|
||||
redeemingGiftCode: () => t`Redeeming gift code`,
|
||||
redeem: () => t`Redeem`
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user