From 6ac6fc8451b59bb9248f0f2c200e94b079dd38db Mon Sep 17 00:00:00 2001 From: ammarahm-ed Date: Thu, 24 Sep 2020 14:57:21 +0500 Subject: [PATCH] redesign premium dialog --- .../src/components/Premium/PremiumDialog.js | 296 ++++++++++-------- 1 file changed, 172 insertions(+), 124 deletions(-) diff --git a/apps/mobile/src/components/Premium/PremiumDialog.js b/apps/mobile/src/components/Premium/PremiumDialog.js index 5d4153492..a25ddd178 100644 --- a/apps/mobile/src/components/Premium/PremiumDialog.js +++ b/apps/mobile/src/components/Premium/PremiumDialog.js @@ -1,189 +1,237 @@ -import React from 'react'; -import {FlatList, Modal, Text, TouchableOpacity, View} from 'react-native'; -import * as Animatable from 'react-native-animatable'; +import React, {createRef} from 'react'; +import { + FlatList, + Modal, + ScrollView, + Text, + TouchableOpacity, + View, +} from 'react-native'; import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; import {opacity, pv, SIZE, WEIGHT} from '../../common/common'; import {eSendEvent} from '../../services/eventManager'; -import {eCloseSideMenu} from '../../services/events'; +import {eCloseSideMenu, eOpenLoginDialog} from '../../services/events'; import NavigationService from '../../services/NavigationService'; +import {db, getElevation, 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: false, + visible: true, animated: false, + user: null, + product: null, }; this.routeIndex = 0; this.count = 0; + this.actionSheetRef = createRef(); } open() { - this.setState({ - visible: true, - }); + this.actionSheetRef.current?._setModalVisible(); } close() { + this.actionSheetRef.current?._setModalVisible(false); + } + async componentDidMount() { + let u = await db.user.get(); + let prod = await RNIap.getSubscriptions(itemSkus); + console.log(prod); this.setState({ - visible: false, + user: u && u.Id ? u : null, + product: prod[0], }); + this.actionSheetRef.current?._setModalVisible(true); + } + componentDidUpdate() { + this.actionSheetRef.current?._setModalVisible(true); } render() { const {visible, animated} = this.state; const {colors} = this.props; return ( - - + - this.close()} + + Notesnook Pro + + + - - - - Unlock Premium Features - - - - 6.99 - + {[ + { + title: 'Sync Across Multiple Devices', + description: + 'Securely sync your notes on any device, Android, iOS, Windows, MacOS, Linux and Web!', + }, + { + title: 'Zero Knowledge', + description: + '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', + 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!', + }, + { + title: 'Export Notes', + description: + 'You can export your notes as PDF, Markdown, Plain text or HTML file.', + }, + { + title: 'Backup and Restore', + description: + 'Backup and restore your notes anytime into your phone storage. You can encrypt all your backups if required!', + }, + ].map((item) => ( + - /month - - - item} - renderItem={({item, index}) => ( - + - {item} + {item.title} {'\n'} + + {item.description} + - )} - /> + + ))} + + - + + + + {!this.state.user ? 'Try Now' : 'Upgrade Now'} + {'\n'} - BUY NOW + Start your 14 Day Free Trial (no credit card needed) - - - + + + {this.state.product?.localizedPrice} + + /mo + +