Skip to content

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

merge develop branch

ammarahm-ede313a8afcd7a
diff --git a/apps/mobile/src/components/ActionSheetComponent/BouncingView.js b/apps/mobile/src/components/ActionSheetComponent/BouncingView.js
index d2cddfc81..08fbf5994 100644
--- a/apps/mobile/src/components/ActionSheetComponent/BouncingView.js
+++ b/apps/mobile/src/components/ActionSheetComponent/BouncingView.js
@@ -5,13 +5,14 @@ export const BouncingView = ({
children,
style,
duration = 600,
- animated = true
+ animated = true,
+ initialScale = 0.9
}) => {
- const scale = Animated.useValue(!animated ? 1 : 0.9);
+ const scale = Animated.useValue(!animated ? 1 : initialScale);
useEffect(() => {
if (!animated) return;
- scale.setValue(0.9);
+ scale.setValue(initialScale);
timing(scale, {
toValue: 1,
duration: duration,
@@ -19,7 +20,7 @@ export const BouncingView = ({
}).start();
return () => {
if (!animated) return;
- scale.setValue(0.9);
+ scale.setValue(initialScale);
};
}, []);
diff --git a/apps/mobile/src/components/AddNotebookDialog/index.js b/apps/mobile/src/components/AddNotebookDialog/index.js
index 4d7ba17aa..127ec3443 100644
--- a/apps/mobile/src/components/AddNotebookDialog/index.js
+++ b/apps/mobile/src/components/AddNotebookDialog/index.js
@@ -400,6 +400,11 @@ export class AddNotebookDialog extends React.Component {
type="accent"
onPress={this.addNewNotebook}
/>
+ <View
+ style={{
+ height:35
+ }}
+ />
</View>
<Toast context="local" />
diff --git a/apps/mobile/src/components/Announcements/announcement.js b/apps/mobile/src/components/Announcements/announcement.js
index 378597431..b86fb0950 100644
--- a/apps/mobile/src/components/Announcements/announcement.js
+++ b/apps/mobile/src/components/Announcements/announcement.js
@@ -49,7 +49,7 @@ export const Announcement = ({color}) => {
marginTop: 15
}}
data={announcement?.body.filter(item =>
- allowedOnPlatform(item.platform)
+ allowedOnPlatform(item.platforms)
)}
renderItem={({item, index}) =>
renderItem({item: item, index: index, color: colors[color],inline:true})
diff --git a/apps/mobile/src/components/Announcements/cta.js b/apps/mobile/src/components/Announcements/cta.js
index bd2a10900..d7fa4e8d2 100644
--- a/apps/mobile/src/components/Announcements/cta.js
+++ b/apps/mobile/src/components/Announcements/cta.js
@@ -1,22 +1,21 @@
import React from 'react';
-import { View } from 'react-native';
-import { useTracked } from '../../provider';
-import { eSendEvent, presentSheet } from '../../services/EventManager';
-import { eCloseAnnouncementDialog, eOpenPremiumDialog } from '../../utils/Events';
-import { openLinkInBrowser } from '../../utils/functions';
-import { SIZE } from '../../utils/SizeUtils';
-import { sleep } from '../../utils/TimeUtils';
+import {View} from 'react-native';
+import {useTracked} from '../../provider';
+import {eSendEvent, presentSheet} from '../../services/EventManager';
+import {eCloseAnnouncementDialog} from '../../utils/Events';
+import {openLinkInBrowser} from '../../utils/functions';
+import {SIZE} from '../../utils/SizeUtils';
+import {sleep} from '../../utils/TimeUtils';
import SettingsBackupAndRestore from '../../views/Settings/backup-restore';
-import { Button } from '../Button';
-import { allowedOnPlatform, getStyle } from './functions';
+import {Button} from '../Button';
+import GeneralSheet from '../GeneralSheet';
+import {PricingPlans} from '../Premium/pricing-plans';
+import {allowedOnPlatform, getStyle} from './functions';
-export const Cta = ({actions, style = {}, color,inline}) => {
+export const Cta = ({actions, style = {}, color, inline}) => {
const [state] = useTracked();
const colors = state.colors;
- let buttons =
- actions.filter(item =>
- allowedOnPlatform(item.platforms)
- ) || [];
+ let buttons = actions.filter(item => allowedOnPlatform(item.platforms)) || [];
const onPress = async item => {
if (!inline) {
@@ -28,9 +27,18 @@ export const Cta = ({actions, style = {}, color,inline}) => {
await openLinkInBrowser(item.data, colors);
} catch (e) {}
} else if (item.type === 'promo') {
- eSendEvent(eOpenPremiumDialog, {
- promoCode: item.data,
- text: item.title
+ presentSheet({
+ component: (
+ <PricingPlans
+ marginTop={1}
+ promo={{
+ promoCode: item.data,
+ text: item.title
+ }}
+ />
+ ),
+ noIcon: true,
+ noProgress: true
});
} else if (item.type === 'backup') {
presentSheet({
@@ -48,6 +56,7 @@ export const Cta = ({actions, style = {}, color,inline}) => {
paddingHorizontal: 12,
...getStyle(style)
}}>
+ <GeneralSheet context="premium_cta" />
{buttons.length > 0 &&
buttons.slice(0, 1).map(item => (
<Button
diff --git a/apps/mobile/src/components/Announcements/functions.js b/apps/mobile/src/components/Announcements/functions.js
index 7ad010b12..45bd4fdbd 100644
--- a/apps/mobile/src/components/Announcements/functions.js
+++ b/apps/mobile/src/components/Announcements/functions.js
@@ -1,4 +1,4 @@
-import React from 'react';
+import React, { Fragment } from 'react';
import {View} from 'react-native';
import {allowedPlatforms} from '../../provider/stores';
import {ProFeatures} from '../ResultDialog/pro-features';
@@ -47,6 +47,7 @@ const renderItems = {
title: Title,
description: Description,
body: Body,
+ text:Body,
image: Photo,
list: List,
subheading: SubHeading,
@@ -55,7 +56,7 @@ const renderItems = {
};
export const renderItem = ({item, index, color,inline}) => {
- const Item = renderItems[item.type];
+ const Item = renderItems[item.type] || Fragment
return <Item key={item.text || item.src || item.type} {...item} index={index} color={color} inline={inline} />;
};
diff --git a/apps/mobile/src/components/Announcements/index.js b/apps/mobile/src/components/Announcements/index.js
index 4ccf4c705..0c8fbf344 100644
--- a/apps/mobile/src/components/Announcements/index.js
+++ b/apps/mobile/src/components/Announcements/index.js
@@ -2,13 +2,14 @@ import React, {useEffect, useState} from 'react';
import {FlatList, View} from 'react-native';
import {useTracked} from '../../provider';
import {useMessageStore} from '../../provider/stores';
+import {DDS} from '../../services/DeviceDetection';
import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';
import {
eCloseAnnouncementDialog,
eOpenAnnouncementDialog
} from '../../utils/Events';
import BaseDialog from '../Dialog/base-dialog';
-import {renderItem} from './functions';
+import {allowedOnPlatform, renderItem} from './functions';
export const AnnouncementDialog = () => {
const [state] = useTracked();
@@ -28,7 +29,6 @@ export const AnnouncementDialog = () => {
const open = data => {
setInfo(data);
- console.log(info);
setVisible(true);
};
@@ -49,15 +49,18 @@ export const AnnouncementDialog = () => {
visible={visible}>
<View
style={{
- width: '100%',
+ width: DDS.isTab ? 600 : '100%',
backgroundColor: colors.bg,
- maxHeight: '100%'
+ maxHeight: DDS.isTab ? '90%' : '100%',
+ borderRadius: DDS.isTab ? 10 : 0,
+ overflow: 'hidden',
+ marginBottom: DDS.isTab ? 20 : 0
}}>
<FlatList
style={{
width: '100%'
}}
- data={info?.body}
+ data={info?.body.filter(item => allowedOnPlatform(item.platforms))}
renderItem={renderItem}
/>
diff --git a/apps/mobile/src/components/AppLoader/index.js b/apps/mobile/src/components/AppLoader/index.js
index 397819e03..023a22667 100644
--- a/apps/mobile/src/components/AppLoader/index.js
+++ b/apps/mobile/src/components/AppLoader/index.js
@@ -5,6 +5,7 @@ import AnimatedProgress from 'react-native-reanimated-progress-bar';
import {useTracked} from '../../provider';
import {
useFavoriteStore,
+ useMessageStore,
useNoteStore,
useSettingStore,
useUserStore
@@ -23,7 +24,11 @@ import PremiumService from '../../services/PremiumService';
import {editing} from '../../utils';
import {COLOR_SCHEME_DARK} from '../../utils/Colors';
import {db} from '../../utils/database';
-import {eOpenLoginDialog, eOpenRateDialog} from '../../utils/Events';
+import {
+ eOpenAnnouncementDialog,
+ eOpenLoginDialog,
+ eOpenRateDialog
+} from '../../utils/Events';
import {MMKV} from '../../utils/mmkv';
import {tabBarRef} from '../../utils/Refs';
import {SIZE} from '../../utils/SizeUtils';
@@ -51,6 +56,7 @@ const AppLoader = ({onLoad}) => {
const verifyUser = useUserStore(state => state.verifyUser);
const setVerifyUser = useUserStore(state => state.setVerifyUser);
const deviceMode = useSettingStore(state => state.deviceMode);
+ const isIntroCompleted = useSettingStore(state => state.isIntroCompleted);
const pwdInput = useRef();
const load = async value => {
@@ -86,6 +92,7 @@ const AppLoader = ({onLoad}) => {
eSendEvent(eOpenLoginDialog, 4);
return;
}
+
let settingsStore = useSettingStore.getState();
if (await Backup.checkBackupRequired(settingsStore.settings.reminder)) {
await Backup.checkAndRun();
@@ -93,7 +100,15 @@ const AppLoader = ({onLoad}) => {
}
if (await checkForRateAppRequest()) return;
if (await checkNeedsBackup()) return;
- PremiumService.getRemainingTrialDaysStatus();
+ if (await PremiumService.getRemainingTrialDaysStatus()) return;
+
+ await useMessageStore.getState().setAnnouncement();
+ if (isIntroCompleted) {
+ let dialogs = useMessageStore.getState().dialogs;
+ if (dialogs.length > 0) {
+ eSendEvent(eOpenAnnouncementDialog, dialogs[0]);
+ }
+ }
})();
}
}, [_loading]);
diff --git a/apps/mobile/src/components/Dialog/BaseDialog.js b/apps/mobile/src/components/Dialog/BaseDialog.js
index e16a9f599..649ea14a2 100644
--- a/apps/mobile/src/components/Dialog/BaseDialog.js
+++ b/apps/mobile/src/components/Dialog/BaseDialog.js
@@ -7,9 +7,8 @@ import {
StyleSheet,
TouchableOpacity
} from 'react-native';
-import {useTracked} from '../../provider';
import useIsFloatingKeyboard from '../../utils/use-is-floating-keyboard';
-import {BouncingView} from '../ActionSheetComponent/BouncingView';
+import { BouncingView } from '../ActionSheetComponent/BouncingView';
const BaseDialog = ({
visible,
diff --git a/apps/mobile/src/components/Dialog/index.js b/apps/mobile/src/components/Dialog/index.js
index 13f17303b..286de1c78 100644
--- a/apps/mobile/src/components/Dialog/index.js
+++ b/apps/mobile/src/components/Dialog/index.js
@@ -1,15 +1,14 @@
-import React, {useEffect, useRef, useState} from 'react';
-import {View} from 'react-native';
-import {useTracked} from '../../provider';
-import {DDS} from '../../services/DeviceDetection';
-import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';
-import {getElevation} from '../../utils';
-import {eCloseSimpleDialog, eOpenSimpleDialog} from '../../utils/Events';
-import {ph, pv} from '../../utils/SizeUtils';
-import {sleep} from '../../utils/TimeUtils';
+import React, { useEffect, useRef, useState } from 'react';
+import { View } from 'react-native';
+import { useTracked } from '../../provider';
+import { DDS } from '../../services/DeviceDetection';
+import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
+import { getElevation } from '../../utils';
+import { eCloseSimpleDialog, eOpenSimpleDialog } from '../../utils/Events';
+import { sleep } from '../../utils/TimeUtils';
import Input from '../Input';
import Seperator from '../Seperator';
-import {Toast} from '../Toast';
+import { Toast } from '../Toast';
import BaseDialog from './base-dialog';
import DialogButtons from './dialog-buttons';
import DialogHeader from './dialog-header';
diff --git a/apps/mobile/src/components/Header/index.js b/apps/mobile/src/components/Header/index.js
index dba5a97ea..b3d6167ea 100644
--- a/apps/mobile/src/components/Header/index.js
+++ b/apps/mobile/src/components/Header/index.js
@@ -12,7 +12,7 @@ import {HeaderRightMenu} from './HeaderRightMenu';
import {Title} from './title';
export const Header = React.memo(
- ({root, title, screen, isBack, color, action, rightButtons}) => {
+ ({root, title, screen, isBack, color, action, rightButtons,notebook}) => {
const [state] = useTracked();
const {colors} = state;
const insets = useSafeAreaInsets();
@@ -52,6 +52,7 @@ export const Header = React.memo(
{screen !== 'Search' ? (
<Title
+ notebook={notebook}
headerColor={color}
heading={title}
screen={screen}
diff --git a/apps/mobile/src/components/Header/title.js b/apps/mobile/src/components/Header/title.js
index 7206e3bd0..72b8659e2 100644
--- a/apps/mobile/src/components/Header/title.js
+++ b/apps/mobile/src/components/Header/title.js
@@ -1,12 +1,57 @@
-import React from 'react';
+import React, {useEffect, useState} from 'react';
import {View} from 'react-native';
import {useTracked} from '../../provider';
-import { SIZE } from '../../utils/SizeUtils';
+import {
+ eSendEvent,
+ eSubscribeEvent,
+ eUnSubscribeEvent
+} from '../../services/EventManager';
+import Navigation from '../../services/Navigation';
+import {eOnNewTopicAdded, eScrollEvent} from '../../utils/Events';
+import {SIZE} from '../../utils/SizeUtils';
import Heading from '../Typography/Heading';
+import Paragraph from '../Typography/Paragraph';
-export const Title = ({heading, headerColor}) => {
+export const Title = ({heading, headerColor, screen, notebook}) => {
const [state] = useTracked();
const {colors} = state;
+ const [hide, setHide] = useState(screen === 'Notebook' ? true : false);
+
+ const onScroll = data => {
+ if (screen !== 'Notebook') {
+ setHide(false);
+ return;
+ }
+ if (data.y > 150) {
+ setHide(false);
+ } else {
+ setHide(true);
+ }
+ };
+
+ useEffect(() => {
+ eSubscribeEvent(eScrollEvent, onScroll);
+ return () => {
+ eUnSubscribeEvent(eScrollEvent, onScroll);
+ };
+ }, []);
+
+ function navigateToNotebook() {
+ if (!notebook) return;
+ let routeName = 'Notebook';
+ let params = {
+ menu: false,
+ notebook: notebook,
+ title: notebook.title
+ };
+ let headerState = {
+ heading: notebook.title,
+ id: notebook.id,
+ type: notebook.type
+ };
+ eSendEvent(eOnNewTopicAdded, params);
+ Navigation.navigate(routeName, params, headerState);
+ }
return (
<View
@@ -15,17 +60,27 @@ export const Title = ({heading, headerColor}) => {
flexShrink: 1,
flexDirection: 'row'
}}>
- <Heading
- numberOfLines={1}
- style={{
- flexWrap: 'wrap'
- }}
- color={headerColor}>
- <Heading color={colors.accent}>
- {heading.slice(0, 1) === '#' ? '#' : null}
+ {!hide ? (
+ <Heading
+ onPress={navigateToNotebook}
+ numberOfLines={notebook ? 2 : 1}
+ size={notebook ? SIZE.md + 2 : SIZE.xl}
+ style={{
+ flexWrap: 'wrap'
+ }}
+ color={headerColor}>
+ {notebook && (
+ <Paragraph numberOfLines={1} size={SIZE.xs + 2}>
+ {notebook?.title}
+ {'\n'}
+ </Paragraph>
+ )}
+ <Heading color={colors.accent}>
+ {heading.slice(0, 1) === '#' ? '#' : null}
+ </Heading>
+ {heading.slice(0, 1) === '#' ? heading.slice(1) : heading}
</Heading>
- {heading.slice(0, 1) === '#' ? heading.slice(1) : heading}
- </Heading>
+ ) : null}
</View>
);
};
diff --git a/apps/mobile/src/components/NoteItem/index.js b/apps/mobile/src/components/NoteItem/index.js
index 478bd1872..ed18d3224 100644
--- a/apps/mobile/src/components/NoteItem/index.js
+++ b/apps/mobile/src/components/NoteItem/index.js
@@ -16,23 +16,17 @@ import {TimeSince} from '../Menu/TimeSince';
import Heading from '../Typography/Heading';
import Paragraph from '../Typography/Paragraph';
-function navigateToNotebook(item) {
- let notebook = item;
- let routeName = 'Notebook';
- let params = {
- menu: false,
- notebook: notebook,
- title: notebook.title
- };
-
+const navigateToTopic = topic => {
+ let routeName = 'NotesPage';
+ let params = {...topic, menu: false, get: 'topics'};
let headerState = {
- heading: notebook.title,
- id: notebook.id,
- type: notebook.type
+ heading: topic.title,
+ id: topic.id,
+ type: topic.type
};
- eSendEvent(eOnNewTopicAdded, params);
+ eSendEvent(refreshNotesPage, params);
Navigation.navigate(routeName, params, headerState);
-}
+};
function navigateToTag(item) {
let tags = db.tags.all;
@@ -84,6 +78,26 @@ const NoteItem = ({item, isTrash, tags}) => {
const compactMode = settings.notesListMode === 'compact';
const allTags = useTagStore(state => state.tags);
+ function getNotebook() {
+ if (isTrash || !item.notebooks) return [];
+ let item_notebook = item.notebooks?.slice(0, 1)[0];
+
+ notebook = db.notebooks.notebook(item_notebook.id);
+
+ if (!notebook) return [];
+ let topic = notebook.topics.topic(item_notebook.topics[0])?._topic;
+
+ notebook = notebook.data;
+
+ return [
+ {
+ title: `${notebook?.title} › ${topic?.title}`,
+ notebook: notebook,
+ topic: topic
+ }
+ ];
+ }
+
return (
<>
<View
diff --git a/apps/mobile/src/components/NotebookItem/index.js b/apps/mobile/src/components/NotebookItem/index.js
index bcf00e638..e98c608b3 100644
--- a/apps/mobile/src/components/NotebookItem/index.js
+++ b/apps/mobile/src/components/NotebookItem/index.js
@@ -1,17 +1,17 @@
import React from 'react';
-import { View } from 'react-native';
+import {View} from 'react-native';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
-import { notesnook } from '../../../e2e/test.ids';
-import { useTracked } from '../../provider';
-import { useSettingStore } from '../../provider/stores';
-import { eSendEvent } from '../../services/EventManager';
+import {notesnook} from '../../../e2e/test.ids';
+import {useTracked} from '../../provider';
+import {useSettingStore} from '../../provider/stores';
+import {eSendEvent} from '../../services/EventManager';
import Navigation from '../../services/Navigation';
-import { getTotalNotes, history } from '../../utils';
-import { eOnNewTopicAdded, refreshNotesPage } from '../../utils/Events';
-import { SIZE } from '../../utils/SizeUtils';
-import { ActionIcon } from '../ActionIcon';
-import { Button } from '../Button';
-import { ActionSheetEvent } from '../DialogManager/recievers';
+import {getTotalNotes, history} from '../../utils';
+import {eOnNewTopicAdded, refreshNotesPage} from '../../utils/Events';
+import {SIZE} from '../../utils/SizeUtils';
+import {ActionIcon} from '../ActionIcon';
+import {Button} from '../Button';
+import {ActionSheetEvent} from '../DialogManager/recievers';
import Heading from '../Typography/Heading';
import Paragraph from '../Typography/Paragraph';
@@ -47,7 +47,6 @@ export const NotebookItem = ({item, isTopic = false, notebookID, isTrash}) => {
};
eSendEvent(refreshNotesPage, params);
Navigation.navigate(routeName, params, headerState);
-
};
return (
@@ -87,10 +86,10 @@ export const NotebookItem = ({item, isTopic = false, notebookID, isTrash}) => {
<Button
title={topic.title}
key={topic.id}
- height={SIZE.xl}
+ height={null}
textStyle={{
fontWeight: 'normal',
- fontFamily: null,
+ fontFamily: null
}}
type="grayBg"
fontSize={SIZE.xs + 1}
@@ -103,10 +102,11 @@ export const NotebookItem = ({item, isTopic = false, notebookID, isTrash}) => {
borderRadius: 5,
maxWidth: 120,
borderWidth: 0.5,
+ paddingVertical:2.5,
borderColor: colors.icon,
paddingHorizontal: 6,
- marginVertical:5,
- marginRight:5
+ marginVertical: 5,
+ marginRight: 5
}}
onPress={() => navigateToTopic(topic)}
/>
diff --git a/apps/mobile/src/components/Premium/component.js b/apps/mobile/src/components/Premium/component.js
index d10d1facf..251362f64 100644
--- a/apps/mobile/src/components/Premium/component.js
+++ b/apps/mobile/src/components/Premium/component.js
@@ -1,24 +1,24 @@
-import React, {useState} from 'react';
-import {Image, ScrollView, View} from 'react-native';
-import {LAUNCH_ROCKET} from '../../assets/images/assets';
-import {useTracked} from '../../provider';
-import {useUserStore} from '../../provider/stores';
-import {DDS} from '../../services/DeviceDetection';
-import {eSendEvent, presentSheet} from '../../services/EventManager';
-import {getElevation} from '../../utils';
-import {eOpenLoginDialog} from '../../utils/Events';
-import {SIZE} from '../../utils/SizeUtils';
-import {ActionIcon} from '../ActionIcon';
-import {Button} from '../Button';
+import React, { useState } from 'react';
+import { ScrollView, View } from 'react-native';
+import { LAUNCH_ROCKET } from '../../assets/images/assets';
+import { useTracked } from '../../provider';
+import { useUserStore } from '../../provider/stores';
+import { DDS } from '../../services/DeviceDetection';
+import { eSendEvent, presentSheet } from '../../services/EventManager';
+import { getElevation } from '../../utils';
+import { eOpenLoginDialog } from '../../utils/Events';
+import { SIZE } from '../../utils/SizeUtils';
+import { ActionIcon } from '../ActionIcon';
+import { Button } from '../Button';
import GeneralSheet from '../GeneralSheet';
-import {SvgToPngView} from '../ListPlaceholders';
+import { SvgToPngView } from '../ListPlaceholders';
import Seperator from '../Seperator';
-import {Toast} from '../Toast';
+import { Toast } from '../Toast';
import Heading from '../Typography/Heading';
import Paragraph from '../Typography/Paragraph';
-import {features} from './features';
-import {Group} from './group';
-import {PricingPlans} from './pricing-plans';
+import { features } from './features';
+import { Group } from './group';
+import { PricingPlans } from './pricing-plans';
export const Component = ({close, promo, getRef}) => {
const [state, dispatch] = useTracked();
@@ -84,6 +84,8 @@ export const Component = ({close, promo, getRef}) => {
style={{
paddingHorizontal: DDS.isTab ? DDS.width / 5 : 0
}}
+ keyboardDismissMode="none"
+ keyboardShouldPersistTaps="always"
onScroll={onScroll}>
<View
style={{
diff --git a/apps/mobile/src/components/Premium/pricingplans.js b/apps/mobile/src/components/Premium/pricingplans.js
index 38c8d7711..37f9f8417 100644
--- a/apps/mobile/src/components/Premium/pricingplans.js
+++ b/apps/mobile/src/components/Premium/pricingplans.js
@@ -1,5 +1,5 @@
import React, {useEffect, useState} from 'react';
-import {ActivityIndicator, Platform, View} from 'react-native';
+import {ActivityIndicator, Platform, Text, View} from 'react-native';
import * as RNIap from 'react-native-iap';
import {useTracked} from '../../provider';
import {useUserStore} from '../../provider/stores';
@@ -13,6 +13,7 @@ import {db} from '../../utils/database';
import {
eClosePremiumDialog,
eCloseProgressDialog,
+ eCloseSimpleDialog,
eOpenLoginDialog
} from '../../utils/Events';
import {openLinkInBrowser} from '../../utils/functions';
@@ -51,10 +52,12 @@ export const PricingPlans = ({
const [products, setProducts] = useState([]);
const [offers, setOffers] = useState(null);
const [buying, setBuying] = useState(false);
+ const [loading, setLoading] = useState(false);
const getSkus = async () => {
try {
- let products = PremiumService.getProducts();
+ setLoading(true);
+ let products = await PremiumService.getProducts();
if (products.length > 0) {
let offers = {
monthly: products.find(
@@ -70,34 +73,48 @@ export const PricingPlans = ({
}
setProducts(products);
}
+ setLoading(false);
} catch (e) {
+ setLoading(false);
console.log('error getting sku', e);
}
};
- const getPromo = async productId => {
- await sleep(500);
- let products = PremiumService.getProducts();
- let product = products.find(p => p.productId === productId);
- if (!product) return;
- let isMonthly = product.productId.indexOf('.mo') > -1;
- let cycleText = isMonthly
- ? promoCyclesMonthly[
- product.introductoryPriceCyclesAndroid ||
- product.introductoryPriceNumberOfPeriodsIOS
- ]
- : promoCyclesYearly[
- product.introductoryPriceCyclesAndroid ||
- product.introductoryPriceNumberOfPeriodsIOS
- ];
+ const getPromo = async code => {
+ try {
+ let productId;
+ if (code.startsWith('com.streetwriters.notesnook')) {
+ productId = code;
+ } else {
+ productId = await db.offers.getCode(code.split(':')[0], Platform.OS);
+ }
- setProduct({
- type: 'promo',
- offerType: isMonthly ? 'monthly' : 'yearly',
- data: product,
- cycleText: cycleText,
- info: 'Pay monthly, cancel anytime'
- });
+ let products = await PremiumService.getProducts();
+ let product = products.find(p => p.productId === productId);
+ if (!product) return false;
+ let isMonthly = product.productId.indexOf('.mo') > -1;
+ let cycleText = isMonthly
+ ? promoCyclesMonthly[
+ product.introductoryPriceCyclesAndroid ||
+ product.introductoryPriceNumberOfPeriodsIOS
+ ]
+ : promoCyclesYearly[
+ product.introductoryPriceCyclesAndroid ||
+ product.introductoryPriceNumberOfPeriodsIOS
+ ];
+
+ setProduct({
+ type: 'promo',
+ offerType: isMonthly ? 'monthly' : 'yearly',
+ data: product,
+ cycleText: cycleText,
+ info: 'Pay monthly, cancel anytime'
+ });
+ return true;
+ } catch (e) {
+ console.log('PROMOCODE ERROR:', code, e);
+ return false;
+ }
};
useEffect(() => {
@@ -140,7 +157,17 @@ export const PricingPlans = ({
}
};
- return (
+ return loading ? (
+ <View
+ style={{
+ paddingHorizontal: 12,
+ justifyContent: 'center',
+ alignItems: 'center',
+ height: 100
+ }}>
+ <ActivityIndicator color={colors.accent} size={25} />
+ </View>
+ ) : (
<View
style={{
paddingHorizontal: 12
@@ -234,23 +261,19 @@ export const PricingPlans = ({
positivePress: async value => {
if (!value) return;
console.log(value);
+ eSendEvent(eCloseSimpleDialog);
+ setBuying(true);
try {
- let productId = await db.offers.getCode(value, Platform.OS);
- if (productId) {
- getPromo(productId);
- ToastEvent.show({
- heading: 'Discount applied!',
- type: 'success',
- context: 'local'
- });
- } else {
- ToastEvent.show({
- heading: 'Promo code invalid or expired',
- type: 'error',
- context: 'local'
- });
- }
+ if (!(await getPromo(value)))
+ throw new Error('Error applying promo code');
+ ToastEvent.show({
+ heading: 'Discount applied!',
+ type: 'success',
+ context: 'local'
+ });
+ setBuying(false);
} catch (e) {
+ setBuying(false);
ToastEvent.show({
heading: 'Promo code invalid or expired',
message: e.message,
@@ -269,32 +292,63 @@ export const PricingPlans = ({
) : (
<View>
{!user ? (
- <Button
- onPress={() => {
- eSendEvent(eClosePremiumDialog);
- setTimeout(() => {
- eSendEvent(eOpenLoginDialog, 1);
- }, 400);
- }}
- title={'Try free for 14 days'}
- type="accent"
- style={{
- paddingHorizontal: 24,
- marginTop: 20,
- marginBottom: 10
- }}
- />
+ <>
+ <Button
+ onPress={() => {
+ eSendEvent(eClosePremiumDialog);
+ eSendEvent(eCloseProgressDialog);
+ setTimeout(() => {
+ eSendEvent(eOpenLoginDialog, 1);
+ }, 400);
+ }}
+ title={'Try free for 14 days'}
+ type="accent"
+ style={{
+ paddingHorizontal: 24,
+ marginTop: 20,
+ marginBottom: 10
+ }}
+ />
+ {promo &&
+ !promo.promoCode.startsWith('com.streetwriters.notesnook') ? (
+ <Paragraph
+ size={SIZE.md}
+ textBreakStrategy="balanced"
+ style={{
+ alignSelf: 'center',
+ justifyContent: 'center',
+ textAlign: 'center'
+ }}>
+ Use promo code{' '}
+ <Text
+ style={{
+ fontFamily: 'OpenSans-SemiBold'
+ }}>
+ {promo.promoCode}
+ </Text>{' '}
+ at checkout
+ </Paragraph>
+ ) : null}
+ </>
) : (
<>
- <PricingItem
- product={product}
+ <Button
onPress={() => buySubscription(product.data)}
+ height={40}
+ width="50%"
+ type="accent"
+ title="Subscribe now"
/>
+
<Button
onPress={() => {
setProduct(null);
}}
+ style={{
+ marginTop: 5
+ }}
height={30}
+ fontSize={13}
type="errorShade"
title="Cancel promo code"
/>
diff --git a/apps/mobile/src/components/SelectionWrapper/backfill.js b/apps/mobile/src/components/SelectionWrapper/backfill.js
index 0513f13b5..80369b65a 100644
--- a/apps/mobile/src/components/SelectionWrapper/backfill.js
+++ b/apps/mobile/src/components/SelectionWrapper/backfill.js
@@ -1,11 +1,8 @@
import React from 'react';
-import {View} from 'react-native';
-import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
-import {useTracked} from '../../provider';
+import { View } from 'react-native';
+import { useTracked } from '../../provider';
import { useEditorStore } from '../../provider/stores';
-import {hexToRGBA} from '../../utils/ColorUtils';
-import {SIZE} from '../../utils/SizeUtils';
-import Heading from '../Typography/Heading';
+import { hexToRGBA } from '../../utils/ColorUtils';
export const Filler = ({item, background}) => {
const [state] = useTracked();
diff --git a/apps/mobile/src/components/SelectionWrapper/index.js b/apps/mobile/src/components/SelectionWrapper/index.js
index e7adff2f5..8b710c4da 100644
--- a/apps/mobile/src/components/SelectionWrapper/index.js
+++ b/apps/mobile/src/components/SelectionWrapper/index.js
@@ -1,13 +1,12 @@
-import React, {useEffect, useState} from 'react';
-import {useWindowDimensions} from 'react-native';
-import {useTracked} from '../../provider';
+import React, { useEffect, useState } from 'react';
+import { useTracked } from '../../provider';
import { useSettingStore } from '../../provider/stores';
-import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';
-import {history} from '../../utils';
-import {PressableButton} from '../PressableButton';
-import {ActionStrip} from './action-strip';
-import {Filler} from './back-fill';
-import {SelectionIcon} from './selection';
+import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
+import { history } from '../../utils';
+import { PressableButton } from '../PressableButton';
+import { ActionStrip } from './action-strip';
+import { Filler } from './back-fill';
+import { SelectionIcon } from './selection';
const SelectionWrapper = ({
children,
@@ -55,7 +54,7 @@ const SelectionWrapper = ({
testID={testID}
onLongPress={_onLongPress}
onPress={_onPress}
- customSelectedColor={colors.nav}
+ customSelectedColor={colors.transGray}
customAlpha={!colors.night ? -0.02 : 0.02}
customOpacity={1}
customStyle={{
diff --git a/apps/mobile/src/components/SimpleList/header.js b/apps/mobile/src/components/SimpleList/header.js
index e47047cea..db8f92c3d 100644
--- a/apps/mobile/src/components/SimpleList/header.js
+++ b/apps/mobile/src/components/SimpleList/header.js
@@ -1,17 +1,15 @@
-import React, { useEffect } from 'react';
-import {View} from 'react-native';
-import {useTracked} from '../../provider';
-import {useMessageStore} from '../../provider/stores';
-import {COLORS_NOTE} from '../../utils/Colors';
-import {hexToRGBA} from '../../utils/ColorUtils';
-import {normalize, SIZE} from '../../utils/SizeUtils';
-import {Button} from '../Button';
-import {Placeholder} from '../ListPlaceholders';
+import React from 'react';
+import { View } from 'react-native';
+import { useTracked } from '../../provider';
+import { useMessageStore } from '../../provider/stores';
+import { COLORS_NOTE } from '../../utils/Colors';
+import { hexToRGBA } from '../../utils/ColorUtils';
+import { normalize, SIZE } from '../../utils/SizeUtils';
+import { Announcement } from '../Announcements/announcement';
+import { Button } from '../Button';
+import { Placeholder } from '../ListPlaceholders';
import Heading from '../Typography/Heading';
-import {Announcement} from '../Announcements/announcement';
-import {Card} from './card';
-import { eSendEvent } from '../../services/EventManager';
-import { eOpenAnnouncementDialog } from '../../utils/Events';
+import { Card } from './card';
export const Header = React.memo(
({
@@ -30,13 +28,7 @@ export const Header = React.memo(
const [state] = useTracked();
const {colors} = state;
const announcements = useMessageStore(state => state.announcements);
- const dialogs = useMessageStore(state => state.dialogs);
- useEffect(() => {
- if (dialogs.length > 0) {
- eSendEvent(eOpenAnnouncementDialog,dialogs[0]);
- }
- },[dialogs])
return announcements.length !== 0 && !noAnnouncement ? (
<Announcement color={color || colors.accent} />
) : type === 'search' ? null : !shouldShow ? (
diff --git a/apps/mobile/src/components/SimpleList/index.js b/apps/mobile/src/components/SimpleList/index.js
index 44b763969..b327fdc19 100644
--- a/apps/mobile/src/components/SimpleList/index.js
+++ b/apps/mobile/src/components/SimpleList/index.js
@@ -41,7 +41,8 @@ const SimpleList = ({
headerProps = {
heading: 'Home'
},
- screen
+ screen,
+ ListHeader
}) => {
const [state] = useTracked();
const {colors} = state;
@@ -103,10 +104,10 @@ const SimpleList = ({
let styles = {
height: '100%',
- backgroundColor: colors.bg,
width: '100%',
minHeight: 1,
- minWidth: 1
+ minWidth: 1,
+ backgroundColor:colors.bg
};
const _keyExtractor = item => item.id || item.title;
@@ -147,15 +148,19 @@ const SimpleList = ({
ListFooterComponent={<Footer />}
ListHeaderComponent={
<>
- <Header
- title={headerProps.heading}
- paragraph={headerProps.paragraph}
- onPress={headerProps.onPress}
- icon={headerProps.icon}
- color={headerProps.color}
- type={type}
- screen={screen}
- />
+ {ListHeader ? (
+ ListHeader
+ ) : (
+ <Header
+ title={headerProps.heading}
+ paragraph={headerProps.paragraph}
+ onPress={headerProps.onPress}
+ icon={headerProps.icon}
+ color={headerProps.color}
+ type={type}
+ screen={screen}
+ />
+ )}
</>
}
/>
diff --git a/apps/mobile/src/provider/stores.ts b/apps/mobile/src/provider/stores.ts
index 1f1674cb4..ea1320f3c 100644
--- a/apps/mobile/src/provider/stores.ts
+++ b/apps/mobile/src/provider/stores.ts
@@ -364,9 +364,11 @@ export const useMessageStore = create<MessageStore>((set, get) => ({
announcements = [];
}
} catch (e) {
+ console.log("ERROR",e);
set({announcements: []});
} finally {
let all = await getFiltered(announcements);
+ console.log("all", all)
set({
announcements: all.filter(a => a.type === 'inline'),
dialogs: all.filter(a => a.type === 'dialog')
@@ -421,7 +423,6 @@ async function shouldShowAnnouncement(announcement) {
}
if (!show) return false;
-
const subStatus = PremiumService.getUser()?.subscription?.type;
show = announcement.userTypes.some(userType => {
switch (userType) {
@@ -432,22 +433,15 @@ async function shouldShowAnnouncement(announcement) {
case 'trialExpired':
return subStatus === SUBSCRIPTION_STATUS.BASIC;
case 'loggedOut':
- show = !PremiumService.getUser();
- break;
+ return !PremiumService.getUser();
case 'verified':
- show = PremiumService.getUser()?.isEmailVerified;
- break;
+ return PremiumService.getUser()?.isEmailVerified;
case 'loggedIn':
- show = !!PremiumService.getUser();
- break;
+ return !!PremiumService.getUser();
case 'unverified':
- show = !PremiumService.getUser()?.isEmailVerified;
- break;
+ return !PremiumService.getUser()?.isEmailVerified;
case 'proExpired':
- show =
- subStatus === SUBSCRIPTION_STATUS.PREMIUM_EXPIRED ||
- subStatus === SUBSCRIPTION_STATUS.PREMIUM_CANCELED;
- break;
+ return subStatus === SUBSCRIPTION_STATUS.PREMIUM_EXPIRED || subStatus === SUBSCRIPTION_STATUS.PREMIUM_CANCELED;
case 'any':
default:
return true;
diff --git a/apps/mobile/src/services/PremiumService.js b/apps/mobile/src/services/PremiumService.js
index f2aa2bf41..19d0b8993 100644
--- a/apps/mobile/src/services/PremiumService.js
+++ b/apps/mobile/src/services/PremiumService.js
@@ -1,20 +1,20 @@
-import {CHECK_IDS} from 'notes-core/common';
+import { CHECK_IDS } from 'notes-core/common';
import React from 'react';
import * as RNIap from 'react-native-iap';
import DialogHeader from '../components/Dialog/dialog-header';
-import {CompactFeatures} from '../components/Premium/compact-features';
-import {PricingPlans} from '../components/Premium/pricing-plans';
+import { CompactFeatures } from '../components/Premium/compact-features';
+import { PricingPlans } from '../components/Premium/pricing-plans';
import Seperator from '../components/Seperator';
-import {useMessageStore, useUserStore} from '../provider/stores';
-import {itemSkus, SUBSCRIPTION_STATUS} from '../utils';
-import {db} from '../utils/database';
+import { useUserStore } from '../provider/stores';
+import { itemSkus, SUBSCRIPTION_STATUS } from '../utils';
+import { db } from '../utils/database';
import {
eOpenPremiumDialog,
eOpenTrialEndingDialog,
eShowGetPremium
} from '../utils/Events';
-import {MMKV} from '../utils/mmkv';
-import {eSendEvent, presentSheet, ToastEvent} from './EventManager';
+import { MMKV } from '../utils/mmkv';
+import { eSendEvent, presentSheet, ToastEvent } from './EventManager';
let premiumStatus = 0;
let products = [];
@@ -39,7 +39,6 @@ async function setPremiumStatus() {
} catch (e) {
premiumStatus = 0;
} finally {
- useMessageStore.getState().setAnnouncement();
if (get()) {
await subscriptions.clear();
}
@@ -65,7 +64,10 @@ function getMontlySub() {
return _product;
}
-function getProducts() {
+async function getProducts() {
+ if (!products || products.length === 0) {
+ products = await RNIap.getSubscriptions(itemSkus);
+ }
return products;
}
@@ -280,7 +282,7 @@ const subscriptions = {
async function getRemainingTrialDaysStatus() {
let user = await db.user.getUser();
- if (!user) return;
+ if (!user) return false;
let premium = user.subscription.type !== SUBSCRIPTION_STATUS.BASIC;
let isTrial = user.subscription.type === SUBSCRIPTION_STATUS.TRIAL;
let total = user.subscription.expiry - user.subscription.start;
@@ -296,7 +298,7 @@ async function getRemainingTrialDaysStatus() {
extend: false
});
MMKV.setItem('lastTrialDialogShownAt', 'ending');
- return;
+ return true;
}
if (!premium && lastTrialDialogShownAt !== 'expired') {
@@ -306,7 +308,9 @@ async function getRemainingTrialDaysStatus() {
extend: false
});
MMKV.setItem('lastTrialDialogShownAt', 'expired');
+ return true;
}
+ return false;
}
const features_list = [
diff --git a/apps/mobile/src/utils/database.js b/apps/mobile/src/utils/database.js
index 8068b7d4a..a78d6c610 100644
--- a/apps/mobile/src/utils/database.js
+++ b/apps/mobile/src/utils/database.js
@@ -14,15 +14,15 @@ export const db = new Database(
db.host(
__DEV__
? {
- // API_HOST: 'https://api.notesnook.com',
- // AUTH_HOST: 'https://auth.streetwriters.co',
- // SSE_HOST: 'https://events.streetwriters.co',
- // SUBSCRIPTIONS_HOST: 'https://subscriptions.streetwriters.co'
- API_HOST: 'http://192.168.10.29:5264',
- AUTH_HOST: 'http://192.168.10.29:8264',
- SSE_HOST: 'http://192.168.10.29:7264',
- SUBSCRIPTIONS_HOST: 'http://192.168.10.29:9264',
- ISSUES_HOST: 'http://192.168.10.29:2624'
+ API_HOST: 'https://api.notesnook.com',
+ AUTH_HOST: 'https://auth.streetwriters.co',
+ SSE_HOST: 'https://events.streetwriters.co',
+ SUBSCRIPTIONS_HOST: 'https://subscriptions.streetwriters.co'
+ // API_HOST: 'http://192.168.10.29:5264',
+ // AUTH_HOST: 'http://192.168.10.29:8264',
+ // SSE_HOST: 'http://192.168.10.29:7264',
+ // SUBSCRIPTIONS_HOST: 'http://192.168.10.29:9264',
+ // ISSUES_HOST: 'http://192.168.10.29:2624'
}
: {
API_HOST: 'https://api.notesnook.com',
diff --git a/apps/mobile/src/utils/useAppEvents.js b/apps/mobile/src/utils/useAppEvents.js
index a17589edc..35df3fc6f 100644
--- a/apps/mobile/src/utils/useAppEvents.js
+++ b/apps/mobile/src/utils/useAppEvents.js
@@ -112,7 +112,6 @@ export const useAppEvents = () => {
EV.subscribe(EVENTS.userSessionExpired, onSessionExpired);
EV.subscribe(EVENTS.userCheckStatus, PremiumService.onUserStatusCheck);
EV.subscribe(EVENTS.userSubscriptionUpdated, onAccountStatusChange);
- EV.subscribe(EVENTS.noteRemoved, onNoteRemoved);
EV.subscribe(EVENTS.mediaAttachmentDownloaded, onMediaDownloaded);
EV.subscribe(EVENTS.attachmentsLoading, onLoadingAttachment);
@@ -133,7 +132,6 @@ export const useAppEvents = () => {
EV.unsubscribe(EVENTS.databaseSyncRequested, partialSync);
EV.unsubscribe(EVENTS.userLoggedOut, onLogout);
EV.unsubscribe(EVENTS.userEmailConfirmed, onEmailVerified);
- EV.unsubscribe(EVENTS.noteRemoved, onNoteRemoved);
EV.unsubscribe(EVENTS.mediaAttachmentDownloaded, onMediaDownloaded);
EV.subscribe(EVENTS.attachmentsLoading, onLoadingAttachment);
EV.unsubscribe(EVENTS.userCheckStatus, PremiumService.onUserStatusCheck);
@@ -159,7 +157,8 @@ export const useAppEvents = () => {
Navigation.routeNames.Trash,
Navigation.routeNames.Notebook
]);
- eSendEvent(eClearEditor);
+ eSendEvent(eClearEditor, id);
+
} catch (e) {}
};
@@ -205,6 +204,7 @@ export const useAppEvents = () => {
try {
if (url.startsWith('https://app.notesnook.com/account/verified')) {
await onEmailVerified();
+
} else {
return;
}
diff --git a/apps/mobile/src/views/Editor/EditorHeader.js b/apps/mobile/src/views/Editor/EditorHeader.js
index da773b9fe..63d749e9d 100644
--- a/apps/mobile/src/views/Editor/EditorHeader.js
+++ b/apps/mobile/src/views/Editor/EditorHeader.js
@@ -1,3 +1,4 @@
+import {EV, EVENTS} from 'notes-core/common';
import React, {useEffect, useRef} from 'react';
import {
BackHandler,
@@ -169,12 +170,29 @@ const EditorHeader = () => {
useEffect(() => {
eSubscribeEvent(eOnLoadNote, load);
eSubscribeEvent(eClearEditor, onCallClear);
+ EV.subscribe(EVENTS.noteRemoved, onNoteRemoved);
return () => {
+ EV.unsubscribe(EVENTS.noteRemoved, onNoteRemoved);
eUnSubscribeEvent(eClearEditor, onCallClear);
eUnSubscribeEvent(eOnLoadNote, load);
};
}, []);
+ const onNoteRemoved = async id => {
+ try {
+ console.log('NOTE REMOVED', id);
+ await db.notes.remove(id);
+ if (id !== getNote().id) return;
+ Navigation.setRoutesToUpdate([
+ Navigation.routeNames.Favorites,
+ Navigation.routeNames.Notes,
+ Navigation.routeNames.NotesPage,
+ Navigation.routeNames.Trash,
+ Navigation.routeNames.Notebook
+ ]);
+ } catch (e) {}
+ };
+
useEffect(() => {
if (fullscreen && DDS.isTab) {
handleBack.current = BackHandler.addEventListener(
@@ -294,11 +312,15 @@ const EditorHeader = () => {
name="crown"
color={colors.yellow}
customStyle={{
- marginLeft: 10,
- borderRadius: 5
+ marginLeft: 10
}}
top={50}
- onPress={() => {
+ onPress={async () => {
+ let note = getNote();
+ clearEditor(true, true, true);
+ await loadNote(note);
+
+ return;
if (editing.isFocused) {
safeKeyboardDismiss();
editing.isFocused = true;
@@ -312,8 +334,7 @@ const EditorHeader = () => {
name="cloud-upload-outline"
color={colors.pri}
customStyle={{
- marginLeft: 10,
- borderRadius: 5
+ marginLeft: 10
}}
top={50}
onPress={publishNote}
@@ -325,8 +346,7 @@ const EditorHeader = () => {
name="attachment"
color={colors.pri}
customStyle={{
- marginLeft: 10,
- borderRadius: 5
+ marginLeft: 10
}}
top={50}
onPress={picker.pick}
diff --git a/apps/mobile/src/views/Editor/EditorOverlay.js b/apps/mobile/src/views/Editor/EditorOverlay.js
index 8919c9313..840c1a95a 100644
--- a/apps/mobile/src/views/Editor/EditorOverlay.js
+++ b/apps/mobile/src/views/Editor/EditorOverlay.js
@@ -44,7 +44,6 @@ const EditorOverlay = () => {
easing: Easing.in(Easing.ease)
}).start();
timerClosing = setTimeout(() => {
- console.log('clearing now');
opacity.setValue(1);
setLoading(null);
}, 150);
diff --git a/apps/mobile/src/views/Editor/tiny/tiny.js b/apps/mobile/src/views/Editor/tiny/tiny.js
index 30ff7471a..a3222e41d 100644
--- a/apps/mobile/src/views/Editor/tiny/tiny.js
+++ b/apps/mobile/src/views/Editor/tiny/tiny.js
@@ -14,6 +14,7 @@ info = document.querySelector(infoBar);
info.querySelector('#infosaved').innerText = "";
info.querySelector('#infodate').innerText = "";
info.querySelector('#infowords').innerText = ""
+updateInfoBar()
document.activeElement.blur();
window.blur();
`;
@@ -72,6 +73,7 @@ const updateDateEdited = value => `
(function() {
info = document.querySelector(infoBar);
info.querySelector('#infodate').innerText = "${value}";
+ updateInfoBar()
})();
`;
@@ -79,6 +81,7 @@ const updateSavingState = value => `
(function() {
info = document.querySelector(infoBar);
info.querySelector('#infosaved').innerText = "${value}";
+ updateInfoBar()
})();
`;
diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/config.js b/apps/mobile/src/views/Editor/tiny/toolbar/config.js
index 943de8b77..75b7ef9e2 100644
--- a/apps/mobile/src/views/Editor/tiny/toolbar/config.js
+++ b/apps/mobile/src/views/Editor/tiny/toolbar/config.js
@@ -59,7 +59,7 @@ export const IMAGE_TOOLTIP_CONFIG = {
default: null,
type: 'imageoptions',
pageX: 0
-}
+};
export const TOOLBAR_CONFIG = [
[
@@ -93,6 +93,7 @@ export const TOOLBAR_CONFIG = [
type: 'tooltip',
valueIcon: 'alignleft',
fullname: 'Text Alignment',
+ premium: true,
group: [
{
format: 'alignleft',
@@ -385,7 +386,7 @@ export const TOOLBAR_CONFIG = [
}
],
[
- /* {
+ /* {
format: 'filepicker',
type: 'format',
fullname: 'Attach file',
diff --git a/apps/mobile/src/views/Notebook/index.js b/apps/mobile/src/views/Notebook/index.js
index 39c320ff2..7d44d31ff 100644
--- a/apps/mobile/src/views/Notebook/index.js
+++ b/apps/mobile/src/views/Notebook/index.js
@@ -5,6 +5,7 @@ import { ContainerTopSection } from '../../components/Container/ContainerTopSect
import { Header } from '../../components/Header';
import SelectionHeader from '../../components/SelectionHeader';
import SimpleList from '../../components/SimpleList';
+import { NotebookHeader } from '../../components/SimpleList/notebook-header';
import {
eSendEvent,
eSubscribeEvent,
@@ -27,6 +28,7 @@ export const Notebook = ({route, navigation}) => {
db.settings.getGroupOptions('topics')
)
);
+ console.log('params',route?.params.notebook?.topics)
const params = useRef(route?.params);
const onLoad = data => {
@@ -92,20 +94,13 @@ export const Notebook = ({route, navigation}) => {
return (
<>
<SelectionHeader screen="Notebook" />
+
<ContainerTopSection>
<Header
title={params.current.title}
isBack={!params.current.menu}
screen="Notebook"
action={_onPressBottomButton}
- rightButtons={[
- {
- icon: 'pencil',
- title: 'Edit notebook',
- func: () =>
- eSendEvent(eOpenAddNotebookDialog, params.current.notebook)
- }
- ]}
/>
</ContainerTopSection>
<SimpleList
@@ -123,6 +118,15 @@ export const Notebook = ({route, navigation}) => {
},
icon: 'pencil'
}}
+ ListHeader={
+ <NotebookHeader
+ onEditNotebook={() => {
+ eSendEvent(eOpenAddNotebookDialog, params.current.notebook);
+ }}
+ onPress={_onPressBottomButton}
+ notebook={params.current.notebook}
+ />
+ }
focused={() => navigation.isFocused()}
placeholderData={{
heading: params.current.notebook.title,
diff --git a/apps/mobile/src/views/Notes/index.js b/apps/mobile/src/views/Notes/index.js
index fb8049c59..50f29a27a 100644
--- a/apps/mobile/src/views/Notes/index.js
+++ b/apps/mobile/src/views/Notes/index.js
@@ -24,7 +24,7 @@ import {
} from '../../utils/Events';
import {openLinkInBrowser} from '../../utils/functions';
import {tabBarRef} from '../../utils/Refs';
-import { getNote } from '../Editor/Functions';
+import {getNote} from '../Editor/Functions';
const getNotes = params => {
if (!params) return [];
@@ -170,7 +170,7 @@ export const Notes = ({route, navigation}) => {
eSendEvent(eOnLoadNote, {type: 'new'});
editing.currentlyEditing = true;
editing.movedAway = false;
- }
+ }
tabBarRef.current?.goToPage(1);
} else {
eSendEvent(eOnLoadNote, {type: 'new'});
@@ -190,7 +190,7 @@ export const Notes = ({route, navigation}) => {
onPress: () => {
if (params.current?.type !== 'topic') return;
eSendEvent(eOpenAddTopicDialog, {
- notebookId: params.current?.notebookId,
+ notebookId: params.current?.notebookId,
toEdit: params.current
});
},
@@ -253,6 +253,10 @@ export const Notes = ({route, navigation}) => {
isBack={!params.current?.menu}
screen="NotesPage"
action={_onPressBottomButton}
+ notebook={
+ params.current?.notebookId &&
+ db.notebooks?.notebook(params.current?.notebookId).data
+ }
rightButtons={
params.current?.type !== 'topic' ? null : headerRightButtons
}