Skip to content

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

mobile: allow users to open redeem code url from app

Ammar Ahmedf8171ddc3f37
diff --git a/apps/mobile/app/screens/settings/notesnook-circle.tsx b/apps/mobile/app/screens/settings/notesnook-circle.tsx
index af0170e91..1e6b46392 100644
--- a/apps/mobile/app/screens/settings/notesnook-circle.tsx
+++ b/apps/mobile/app/screens/settings/notesnook-circle.tsx
@@ -2,7 +2,8 @@ import { CirclePartner, SubscriptionStatus } from "@notesnook/core";
import { strings } from "@notesnook/intl";
import { useThemeColors } from "@notesnook/theme";
import Clipboard from "@react-native-clipboard/clipboard";
-import { useEffect, useState } from "react";
+import { useState } from "react";
+import { useAsync } from "react-async-hook";
import {
ActivityIndicator,
Image,
@@ -13,6 +14,7 @@ import {
import { db } from "../../common/database";
import AppIcon from "../../components/ui/AppIcon";
import { Button } from "../../components/ui/button";
+import { Notice } from "../../components/ui/notice";
import Heading from "../../components/ui/typography/heading";
import Paragraph from "../../components/ui/typography/paragraph";
import { ToastManager } from "../../services/event-manager";
@@ -21,8 +23,8 @@ import PremiumService from "../../services/premium";
import { useUserStore } from "../../stores/use-user-store";
import { AppFontSize, defaultBorderRadius } from "../../utils/size";
import { DefaultAppStyles } from "../../utils/styles";
-import { useAsync } from "react-async-hook";
-import { Notice } from "../../components/ui/notice";
+import { openLinkInBrowser } from "../../utils/functions";
+import { Pressable } from "../../components/ui/pressable";
export const NotesnookCircle = () => {
const user = useUserStore((state) => state.user);
@@ -156,32 +158,53 @@ const Partner = ({
}}
/>
) : (
- <TouchableOpacity
- style={{
- backgroundColor: colors.secondary.background,
- borderRadius: defaultBorderRadius,
- alignItems: "center",
- justifyContent: "center",
- padding: DefaultAppStyles.GAP_SMALL,
- borderWidth: 0.5,
- borderColor: colors.secondary.border,
- flexDirection: "row",
- gap: DefaultAppStyles.GAP_SMALL
- }}
- activeOpacity={0.9}
- onPress={() => {
- Clipboard.setString(code);
- }}
- >
- <Paragraph
- size={AppFontSize.lg}
- color={colors.secondary.paragraph}
+ <>
+ <TouchableOpacity
+ style={{
+ backgroundColor: colors.secondary.background,
+ borderRadius: defaultBorderRadius,
+ alignItems: "center",
+ justifyContent: "center",
+ padding: DefaultAppStyles.GAP_SMALL,
+ borderWidth: 0.5,
+ borderColor: colors.secondary.border,
+ flexDirection: "row",
+ gap: DefaultAppStyles.GAP_SMALL
+ }}
+ activeOpacity={0.9}
+ onPress={() => {
+ Clipboard.setString(code);
+ }}
>
- {code}
- </Paragraph>
+ <Paragraph
+ size={AppFontSize.lg}
+ color={colors.secondary.paragraph}
+ >
+ {code}
+ </Paragraph>
+
+ <AppIcon name="content-copy" />
+ </TouchableOpacity>
- <AppIcon name="content-copy" />
- </TouchableOpacity>
+ {item.codeRedeemUrl ? (
+ <Pressable
+ onPress={() => {
+ if (item.codeRedeemUrl) {
+ openLinkInBrowser(
+ item.codeRedeemUrl.replace("{{code}}", code)
+ );
+ }
+ }}
+ >
+ <Paragraph
+ color={colors.secondary.paragraph}
+ size={AppFontSize.xxs}
+ >
+ {strings.clickToDirectlyClaimPromo()}
+ </Paragraph>
+ </Pressable>
+ ) : null}
+ </>
)}
</>
) : null}
diff --git a/packages/intl/locale/en.po b/packages/intl/locale/en.po
index 0e8fe5045..36b1bd9dc 100644
--- a/packages/intl/locale/en.po
+++ b/packages/intl/locale/en.po
@@ -1580,6 +1580,10 @@ msgstr ""
"\n"
"**Only use this for troubleshooting purposes. If you are having persistent issues, it is recommended that you reach out to us via [email protected] so we can help you resolve it permanently.**"
+#: src/strings.ts:2606
+msgid "Click here to directly claim the promotion."
+msgstr "Click here to directly claim the promotion."
+
#: src/strings.ts:239
msgid "Click to deselect"
msgstr "Click to deselect"
diff --git a/packages/intl/locale/pseudo-LOCALE.po b/packages/intl/locale/pseudo-LOCALE.po
index 358349271..90866c7dc 100644
--- a/packages/intl/locale/pseudo-LOCALE.po
+++ b/packages/intl/locale/pseudo-LOCALE.po
@@ -1569,6 +1569,10 @@ msgid ""
"**Only use this for troubleshooting purposes. If you are having persistent issues, it is recommended that you reach out to us via [email protected] so we can help you resolve it permanently.**"
msgstr ""
+#: src/strings.ts:2606
+msgid "Click here to directly claim the promotion."
+msgstr ""
+
#: src/strings.ts:239
msgid "Click to deselect"
msgstr ""
diff --git a/packages/intl/src/strings.ts b/packages/intl/src/strings.ts
index bd0e5bca4..0882b2e4c 100644
--- a/packages/intl/src/strings.ts
+++ b/packages/intl/src/strings.ts
@@ -2601,5 +2601,7 @@ Use this if changes from other devices are not appearing on this device. This wi
freeUserCircleNotice: () =>
t`The Notesnook Circle is exclusive to subscribers. Please consider subscribing to gain access to Notesnook Circle and enjoy additional benefits.`,
finishPurchaseInBrowser: () => t`Finish your purchase in the browser.`,
- goBack: () => t`Go back`
+ goBack: () => t`Go back`,
+ clickToDirectlyClaimPromo: () =>
+ t`Click here to directly claim the promotion.`
};