diff --git a/apps/mobile/src/components/ActionSheetComponent/index.js b/apps/mobile/src/components/ActionSheetComponent/index.js
index a24a5bd8b..5f9242735 100644
--- a/apps/mobile/src/components/ActionSheetComponent/index.js
+++ b/apps/mobile/src/components/ActionSheetComponent/index.js
@@ -1,13 +1,13 @@
import React, {createRef, useEffect, useState} from 'react';
import {
ActivityIndicator,
+ Clipboard,
Dimensions,
StatusBar,
Text,
TextInput,
TouchableOpacity,
View,
- Clipboard,
} from 'react-native';
import Share from 'react-native-share';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
@@ -32,7 +32,6 @@ import {
eOpenMoveNoteDialog,
refreshNotesPage,
} from '../../services/events';
-import NavigationService from '../../services/NavigationService';
import {MMKV} from '../../utils/storage';
import {
db,
@@ -615,12 +614,11 @@ export const ActionSheetComponent = ({
dispatch({type: ACTIONS.USER, user: user});
await db.sync();
localRefresh();
- setRefreshing(false);
-
ToastEvent.show('Note synced', 'success', 'local');
} catch (e) {
- setRefreshing(false);
ToastEvent.show(e.message, 'error', 'local');
+ } finally {
+ setRefreshing(false);
}
dispatch({type: ACTIONS.ALL});
}
diff --git a/apps/mobile/src/components/Loading/index.js b/apps/mobile/src/components/Loading/index.js
index 892251f0e..f093c2b92 100644
--- a/apps/mobile/src/components/Loading/index.js
+++ b/apps/mobile/src/components/Loading/index.js
@@ -31,10 +31,14 @@ export const Loading = ({
]}>
{doneText}
+
+
+
+
>
) : (
<>
@@ -52,6 +56,7 @@ const styles = StyleSheet.create({
activityText: {
fontSize: SIZE.sm,
textAlign: 'center',
+ marginBottom:10
},
activityContainer: {
alignItems: 'center',
diff --git a/apps/mobile/src/components/Premium/PremiumDialog.js b/apps/mobile/src/components/Premium/PremiumDialog.js
index a25ddd178..14673cbd7 100644
--- a/apps/mobile/src/components/Premium/PremiumDialog.js
+++ b/apps/mobile/src/components/Premium/PremiumDialog.js
@@ -1,28 +1,18 @@
import React, {createRef} from 'react';
-import {
- FlatList,
- Modal,
- ScrollView,
- Text,
- TouchableOpacity,
- View,
-} from 'react-native';
+import {ScrollView, Text, View} from 'react-native';
+import * as RNIap from 'react-native-iap';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
-import {opacity, pv, SIZE, WEIGHT} from '../../common/common';
+import {SIZE, WEIGHT} from '../../common/common';
import {eSendEvent} from '../../services/eventManager';
-import {eCloseSideMenu, eOpenLoginDialog} from '../../services/events';
-import NavigationService from '../../services/NavigationService';
-import {db, getElevation, h, itemSkus, w} from '../../utils/utils';
+import {eOpenLoginDialog} from '../../services/events';
+import {db, h, itemSkus, w} from '../../utils/utils';
import ActionSheet from '../ActionSheet';
import {Button} from '../Button';
import Seperator from '../Seperator';
-import * as RNIap from 'react-native-iap';
class PremiumDialog extends React.Component {
constructor(props) {
super(props);
this.state = {
- visible: true,
- animated: false,
user: null,
product: null,
};
@@ -32,7 +22,7 @@ class PremiumDialog extends React.Component {
}
open() {
- this.actionSheetRef.current?._setModalVisible();
+ this.actionSheetRef.current?._setModalVisible(true);
}
close() {
@@ -46,14 +36,10 @@ class PremiumDialog extends React.Component {
user: u && u.Id ? u : null,
product: prod[0],
});
- this.actionSheetRef.current?._setModalVisible(true);
- }
- componentDidUpdate() {
- this.actionSheetRef.current?._setModalVisible(true);
}
+ componentDidUpdate() {}
render() {
- const {visible, animated} = this.state;
const {colors} = this.props;
return (
Notesnook Pro
@@ -95,7 +82,7 @@ class PremiumDialog extends React.Component {
showsVerticalScrollIndicator={false}>
{[
{
- title: 'Sync Across Multiple Devices',
+ title: 'Cross Platfrom Sync',
description:
'Securely sync your notes on any device, Android, iOS, Windows, MacOS, Linux and Web!',
},
@@ -105,14 +92,14 @@ class PremiumDialog extends React.Component {
'No sneaking, no stealing. We give all the keys for your data to you. Privacy is not just a word to us. We use industry-grade XChaChaPoly1305 and Argon2 which is miles ahead other solutions making sure your data is secure and private even a million years from now.',
},
{
- title: 'Organize Note Like Never Before',
+ title: 'Organize Notes Like Never Before',
description:
'Organize your notes using notebooks, tags and colors. Add notes to favorites for quick access. Pin most important notes and notebooks on top for quick access. You can also pin notes and notebooks to quickly access them!',
},
{
title: 'Full Rich Text Editor with Markdown',
description:
- 'Unleash the power of a complete Rich Text Editor in your notes app. You can add images,links and even embed videos! We have even added full markdown support!',
+ 'Unleash the power of a complete Rich Text Editor in your notes app. You can add images, links and even embed videos! We have even added full markdown support too!',
},
{
title: 'Export Notes',
@@ -169,7 +156,6 @@ class PremiumDialog extends React.Component {
))}
-
@@ -186,7 +172,7 @@ class PremiumDialog extends React.Component {
fontFamily: WEIGHT.bold,
color: colors.accent,
}}>
- {!this.state.user ? 'Try Now' : 'Upgrade Now'}
+ {!this.state.user ? 'Try it Now' : 'Upgrade Now'}
{'\n'}
{
switch (action.type) {
diff --git a/apps/mobile/src/services/events.js b/apps/mobile/src/services/events.js
index 8950b6ae1..c990da5ad 100644
--- a/apps/mobile/src/services/events.js
+++ b/apps/mobile/src/services/events.js
@@ -85,4 +85,9 @@ export const eClosePremiumDialog = '541'
export const eResetApp = '542'
export const eOpenExportDialog = '543';
-export const eCloseExportDialog = '544';
\ No newline at end of file
+
+export const eCloseExportDialog = '544';
+
+export const eOpenRecoveryKeyDialog = '545';
+
+export const eCloseRecoveryKeyDialog = '546';
\ No newline at end of file
diff --git a/apps/mobile/src/utils/storage.js b/apps/mobile/src/utils/storage.js
index dbbda942b..585c7dd35 100644
--- a/apps/mobile/src/utils/storage.js
+++ b/apps/mobile/src/utils/storage.js
@@ -1,13 +1,12 @@
import he from 'he';
-import {Platform} from 'react-native';
+import { Platform } from 'react-native';
import 'react-native-get-random-values';
import RNHTMLtoPDF from 'react-native-html-to-pdf';
import MMKVStorage from 'react-native-mmkv-storage';
-import {and} from 'react-native-reanimated';
-import {generateSecureRandom} from 'react-native-securerandom';
+import { generateSecureRandom } from 'react-native-securerandom';
import Sodium from 'react-native-sodium';
import RNFetchBlob from 'rn-fetch-blob';
-import {db, requestStoragePermission, ToastEvent} from './utils';
+import { db, requestStoragePermission, ToastEvent } from './utils';
export const MMKV = new MMKVStorage.Loader().initialize();
async function read(key, isArray = false) {
let data;
diff --git a/apps/mobile/src/views/Settings/index.js b/apps/mobile/src/views/Settings/index.js
index a9d2fc1a7..fdab4dedc 100644
--- a/apps/mobile/src/views/Settings/index.js
+++ b/apps/mobile/src/views/Settings/index.js
@@ -13,6 +13,7 @@ import {
View,
} from 'react-native';
import * as Animatable from 'react-native-animatable';
+import * as RNIap from 'react-native-iap';
import QRCode from 'react-native-qrcode-generator';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import {
@@ -35,11 +36,12 @@ import {ACTIONS} from '../../provider/actions';
import {eSendEvent} from '../../services/eventManager';
import {eOpenLoginDialog, eResetApp} from '../../services/events';
import NavigationService from '../../services/NavigationService';
-import storage, {MMKV} from '../../utils/storage';
+import {MMKV} from '../../utils/storage';
import {
db,
DDS,
hexToRGBA,
+ itemSkus,
RGB_Linear_Shade,
setSetting,
ToastEvent,
@@ -51,7 +53,11 @@ export const Settings = ({route, navigation}) => {
const {colors, user, settings} = state;
const [key, setKey] = useState('');
const [modalVisible, setModalVisible] = useState(false);
+ const [subscriptions, setSubscriptions] = useState([]);
const isFocused = useIsFocused();
+ let subsriptionSuccessListerner;
+ let subsriptionErrorListener;
+
function changeColorScheme(colors = COLOR_SCHEME, accent = ACCENT) {
let newColors = setColorScheme(colors, accent);
StatusBar.setBarStyle(colors.night ? 'light-content' : 'dark-content');
@@ -65,6 +71,43 @@ export const Settings = ({route, navigation}) => {
changeColorScheme();
}
+ useEffect(() => {
+ RNIap.getSubscriptions(itemSkus).then((subs) => {
+ setSubscriptions(subs);
+ });
+ subsriptionSuccessListerner = RNIap.purchaseUpdatedListener(
+ onSuccessfulSubscription,
+ );
+ subsriptionErrorListener = RNIap.purchaseErrorListener(onSubscriptionError);
+
+ return () => {
+ if (subsriptionSuccessListerner) {
+ subsriptionSuccessListerner.remove();
+ subsriptionSuccessListerner = null;
+ }
+
+ if (subsriptionErrorListener) {
+ subsriptionErrorListener.remove();
+ subsriptionErrorListener = null;
+ }
+ };
+ }, []);
+
+ const onSuccessfulSubscription = (
+ subscription: RNIap.SubscriptionPurchase,
+ ) => {
+ const receipt = subscription.transactionReceipt;
+ //console.log(JSON.stringify(subscription));
+ if (receipt) {
+ console.log(JSON.stringify(subscription));
+ }
+ };
+
+ const onSubscriptionError = (error: RNIap.PurchaseError) => {
+ console.log(error.message, 'Error');
+ ToastEvent.show(error.message);
+ };
+
useEffect(() => {
if (isFocused) {
dispatch({
@@ -314,7 +357,7 @@ export const Settings = ({route, navigation}) => {
style={{
paddingHorizontal: 0,
}}>
- {user ? (
+ {user && user.Id ? (
<>
{
},
{
name: 'Subscription status',
- func: () => {},
+ func: () => {
+ RNIap.requestSubscription(
+ subscriptions[0].productId,
+ undefined,
+ undefined,
+ undefined,
+ user.Id,
+ )
+ .then((r) => {
+ console.log(r);
+ })
+ .catch((e) => console.log(e));
+ return;
+ },
desc: 'Current status of your subscription',
},
{
@@ -757,7 +813,12 @@ export const Settings = ({route, navigation}) => {
desc: 'Restore backup from your phone.',
},
].map((item) => (
-
+
))}
{
desc: 'You are using the latest version of our app.',
},
].map((item) => (
-
+
))}