mobile: allow users to open redeem code url from app

This commit is contained in:
Ammar Ahmed
2025-10-23 21:38:55 +05:00
parent 2e5ff859eb
commit 19d90fa221
4 changed files with 61 additions and 28 deletions

View File

@@ -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,6 +158,7 @@ const Partner = ({
}}
/>
) : (
<>
<TouchableOpacity
style={{
backgroundColor: colors.secondary.background,
@@ -182,6 +185,26 @@ const Partner = ({
<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}

View File

@@ -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 support@streetwriters.co 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"

View File

@@ -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 support@streetwriters.co 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 ""

View File

@@ -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.`
};