mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-16 19:57:52 +01:00
mobile: open web purchase in browser.
This commit is contained in:
@@ -21,7 +21,13 @@ import { strings } from "@notesnook/intl";
|
||||
import { useThemeColors } from "@notesnook/theme";
|
||||
import dayjs from "dayjs";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { ScrollView, Text, TouchableOpacity, View } from "react-native";
|
||||
import {
|
||||
Linking,
|
||||
ScrollView,
|
||||
Text,
|
||||
TouchableOpacity,
|
||||
View
|
||||
} from "react-native";
|
||||
import Config from "react-native-config";
|
||||
import * as RNIap from "react-native-iap";
|
||||
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
|
||||
@@ -60,27 +66,17 @@ export const BuyPlan = (props: {
|
||||
return checkoutUrl ? (
|
||||
<View
|
||||
style={{
|
||||
flex: 1
|
||||
flex: 1,
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
gap: DefaultAppStyles.GAP_VERTICAL
|
||||
}}
|
||||
>
|
||||
<WebView
|
||||
source={{
|
||||
uri: checkoutUrl
|
||||
}}
|
||||
onMessage={(message) => {
|
||||
try {
|
||||
const data = JSON.parse(message.nativeEvent.data);
|
||||
if (data.success) {
|
||||
pricingPlans.finish();
|
||||
}
|
||||
} catch (e) {}
|
||||
}}
|
||||
domStorageEnabled
|
||||
javaScriptEnabled
|
||||
cacheEnabled
|
||||
enabled
|
||||
style={{
|
||||
flex: 1
|
||||
<Paragraph>{strings.finishPurchaseInBrowser()}</Paragraph>
|
||||
<Button
|
||||
title={strings.goBack()}
|
||||
onPress={() => {
|
||||
setCheckoutUrl(undefined);
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
@@ -245,12 +241,14 @@ export const BuyPlan = (props: {
|
||||
}
|
||||
onPress={async () => {
|
||||
if (isGithubRelease) {
|
||||
setCheckoutUrl(
|
||||
await db.subscriptions.checkoutUrl(
|
||||
(pricingPlans.selectedProduct as Plan).plan,
|
||||
(pricingPlans.selectedProduct as Plan).period
|
||||
)
|
||||
const url = await db.subscriptions.checkoutUrl(
|
||||
(pricingPlans.selectedProduct as Plan).plan,
|
||||
(pricingPlans.selectedProduct as Plan).period
|
||||
);
|
||||
if (url) {
|
||||
setCheckoutUrl(url);
|
||||
Linking.openURL(url);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data android:scheme="com.streetwriters.notesnook" />
|
||||
<data android:scheme="notesnook" />
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
|
||||
@@ -2842,6 +2842,10 @@ msgstr "Filter attachments by filename, type or hash"
|
||||
msgid "Filter languages"
|
||||
msgstr "Filter languages"
|
||||
|
||||
#: src/strings.ts:2594
|
||||
msgid "Finish your purchase in the browser."
|
||||
msgstr "Finish your purchase in the browser."
|
||||
|
||||
#: src/strings.ts:1668
|
||||
msgid "Fix it"
|
||||
msgstr "Fix it"
|
||||
@@ -3028,6 +3032,10 @@ msgstr "Getting recovery codes"
|
||||
msgid "GNU GENERAL PUBLIC LICENSE Version 3"
|
||||
msgstr "GNU GENERAL PUBLIC LICENSE Version 3"
|
||||
|
||||
#: src/strings.ts:2595
|
||||
msgid "Go back"
|
||||
msgstr "Go back"
|
||||
|
||||
#: src/strings.ts:2445
|
||||
msgid "Go back in tab"
|
||||
msgstr "Go back in tab"
|
||||
|
||||
@@ -2831,6 +2831,10 @@ msgstr ""
|
||||
msgid "Filter languages"
|
||||
msgstr ""
|
||||
|
||||
#: src/strings.ts:2594
|
||||
msgid "Finish your purchase in the browser."
|
||||
msgstr ""
|
||||
|
||||
#: src/strings.ts:1668
|
||||
msgid "Fix it"
|
||||
msgstr ""
|
||||
@@ -3010,6 +3014,10 @@ msgstr ""
|
||||
msgid "GNU GENERAL PUBLIC LICENSE Version 3"
|
||||
msgstr ""
|
||||
|
||||
#: src/strings.ts:2595
|
||||
msgid "Go back"
|
||||
msgstr ""
|
||||
|
||||
#: src/strings.ts:2445
|
||||
msgid "Go back in tab"
|
||||
msgstr ""
|
||||
|
||||
@@ -2590,5 +2590,7 @@ Use this if changes from other devices are not appearing on this device. This wi
|
||||
t`You can change your subscription plan from the web app`,
|
||||
announcement: () => t`ANNOUNCEMENT`,
|
||||
cannotChangePlan: () =>
|
||||
t`Your current subscription does not allow changing plans`
|
||||
t`Your current subscription does not allow changing plans`,
|
||||
finishPurchaseInBrowser: () => t`Finish your purchase in the browser.`,
|
||||
goBack: () => t`Go back`
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user