Skip to content

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

mobile: open web purchase in browser.

Ammar Ahmed641eb28ce78b
diff --git a/apps/mobile/app/components/sheets/buy-plan/index.tsx b/apps/mobile/app/components/sheets/buy-plan/index.tsx
index 6a33f1982..0692a2312 100644
--- a/apps/mobile/app/components/sheets/buy-plan/index.tsx
+++ b/apps/mobile/app/components/sheets/buy-plan/index.tsx
@@ -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;
}
diff --git a/apps/mobile/native/android/app/src/main/AndroidManifest.xml b/apps/mobile/native/android/app/src/main/AndroidManifest.xml
index 7bbf71bca..581386ac3 100644
--- a/apps/mobile/native/android/app/src/main/AndroidManifest.xml
+++ b/apps/mobile/native/android/app/src/main/AndroidManifest.xml
@@ -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>
diff --git a/packages/intl/locale/en.po b/packages/intl/locale/en.po
index f0f0e9b0f..2b3128cf2 100644
--- a/packages/intl/locale/en.po
+++ b/packages/intl/locale/en.po
@@ -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"
diff --git a/packages/intl/locale/pseudo-LOCALE.po b/packages/intl/locale/pseudo-LOCALE.po
index 2263d5d40..8f77b4ae9 100644
--- a/packages/intl/locale/pseudo-LOCALE.po
+++ b/packages/intl/locale/pseudo-LOCALE.po
@@ -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 ""
diff --git a/packages/intl/src/strings.ts b/packages/intl/src/strings.ts
index 01a4c1aa9..ffb3f375b 100644
--- a/packages/intl/src/strings.ts
+++ b/packages/intl/src/strings.ts
@@ -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`
};