mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +01:00
lock items for free-user
This commit is contained in:
@@ -27,7 +27,8 @@ import {ACTIONS} from '../../provider/actions';
|
|||||||
import NavigationService from '../../services/NavigationService';
|
import NavigationService from '../../services/NavigationService';
|
||||||
import {timeConverter, ToastEvent, DDS, db} from '../../utils/utils';
|
import {timeConverter, ToastEvent, DDS, db} from '../../utils/utils';
|
||||||
import {openVault, eSendEvent} from '../../services/eventManager';
|
import {openVault, eSendEvent} from '../../services/eventManager';
|
||||||
import {refreshNotesPage} from '../../services/events';
|
import {refreshNotesPage, eOpenPremiumDialog} from '../../services/events';
|
||||||
|
import {PremiumTag} from '../Premium/PremiumTag';
|
||||||
|
|
||||||
const w = Dimensions.get('window').width;
|
const w = Dimensions.get('window').width;
|
||||||
const h = Dimensions.get('window').height;
|
const h = Dimensions.get('window').height;
|
||||||
@@ -42,7 +43,7 @@ export const ActionSheetComponent = ({
|
|||||||
columnItems = [],
|
columnItems = [],
|
||||||
}) => {
|
}) => {
|
||||||
const [state, dispatch] = useTracked();
|
const [state, dispatch] = useTracked();
|
||||||
const {colors, tags, currentEditingNote} = state;
|
const {colors, tags, premiumUser} = state;
|
||||||
const [focused, setFocused] = useState(false);
|
const [focused, setFocused] = useState(false);
|
||||||
const [note, setNote] = useState(
|
const [note, setNote] = useState(
|
||||||
item
|
item
|
||||||
@@ -299,6 +300,12 @@ export const ActionSheetComponent = ({
|
|||||||
name: 'Pin',
|
name: 'Pin',
|
||||||
icon: 'tag-outline',
|
icon: 'tag-outline',
|
||||||
func: async () => {
|
func: async () => {
|
||||||
|
if (!premiumUser) {
|
||||||
|
eSendEvent(eOpenPremiumDialog);
|
||||||
|
close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!note.id) return;
|
if (!note.id) return;
|
||||||
if (note.type === 'note') {
|
if (note.type === 'note') {
|
||||||
await db.notes.note(note.id).pin();
|
await db.notes.note(note.id).pin();
|
||||||
@@ -316,6 +323,11 @@ export const ActionSheetComponent = ({
|
|||||||
name: 'Favorite',
|
name: 'Favorite',
|
||||||
icon: 'star',
|
icon: 'star',
|
||||||
func: async () => {
|
func: async () => {
|
||||||
|
if (!premiumUser) {
|
||||||
|
eSendEvent(eOpenPremiumDialog);
|
||||||
|
close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!note.id) return;
|
if (!note.id) return;
|
||||||
if (note.type === 'note') {
|
if (note.type === 'note') {
|
||||||
await db.notes.note(note.id).favorite();
|
await db.notes.note(note.id).favorite();
|
||||||
@@ -333,6 +345,11 @@ export const ActionSheetComponent = ({
|
|||||||
name: 'Add to Vault',
|
name: 'Add to Vault',
|
||||||
icon: 'shield',
|
icon: 'shield',
|
||||||
func: () => {
|
func: () => {
|
||||||
|
if (!premiumUser) {
|
||||||
|
eSendEvent(eOpenPremiumDialog);
|
||||||
|
close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!note.id) return;
|
if (!note.id) return;
|
||||||
|
|
||||||
if (note.locked) {
|
if (note.locked) {
|
||||||
@@ -532,15 +549,25 @@ export const ActionSheetComponent = ({
|
|||||||
) : (
|
) : (
|
||||||
undefined
|
undefined
|
||||||
)}
|
)}
|
||||||
{item.check ? (
|
<View
|
||||||
<Icon
|
style={{
|
||||||
name={
|
flexDirection: 'row',
|
||||||
item.on ? 'check-circle-outline' : 'checkbox-blank-circle-outline'
|
alignItems: 'center',
|
||||||
}
|
}}>
|
||||||
color={item.on ? colors.accent : colors.icon}
|
<PremiumTag pro={false} />
|
||||||
size={SIZE.lg + 2}
|
|
||||||
/>
|
{item.check ? (
|
||||||
) : null}
|
<Icon
|
||||||
|
name={
|
||||||
|
item.on
|
||||||
|
? 'check-circle-outline'
|
||||||
|
: 'checkbox-blank-circle-outline'
|
||||||
|
}
|
||||||
|
color={item.on ? colors.accent : colors.icon}
|
||||||
|
size={SIZE.lg + 2}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
</View>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
) : null;
|
) : null;
|
||||||
|
|
||||||
@@ -732,7 +759,11 @@ export const ActionSheetComponent = ({
|
|||||||
fontSize: SIZE.xs,
|
fontSize: SIZE.xs,
|
||||||
color: colors.accent,
|
color: colors.accent,
|
||||||
}}>
|
}}>
|
||||||
Suggestions:{' '}
|
{tags.filter(
|
||||||
|
o => o.count > 1 && !note.tags.find(t => t === o.title),
|
||||||
|
).length === 0
|
||||||
|
? ''
|
||||||
|
: 'Suggestions '}
|
||||||
</Text>
|
</Text>
|
||||||
{tags
|
{tags
|
||||||
.filter(o => o.count > 1 && !note.tags.find(t => t === o.title))
|
.filter(o => o.count > 1 && !note.tags.find(t => t === o.title))
|
||||||
@@ -797,17 +828,36 @@ export const ActionSheetComponent = ({
|
|||||||
borderWidth: 1.5,
|
borderWidth: 1.5,
|
||||||
borderColor: focused ? colors.accent : colors.nav,
|
borderColor: focused ? colors.accent : colors.nav,
|
||||||
paddingVertical: 5,
|
paddingVertical: 5,
|
||||||
|
alignItems: 'center',
|
||||||
}}>
|
}}>
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
|
if (!premiumUser) {
|
||||||
|
eSendEvent(eOpenPremiumDialog);
|
||||||
|
close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
tagsInputRef.current?.focus();
|
tagsInputRef.current?.focus();
|
||||||
}}
|
}}
|
||||||
style={{
|
style={{
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
height: '100%',
|
height: '100%',
|
||||||
}}
|
justifyContent: 'flex-start',
|
||||||
/>
|
alignItems: 'flex-end',
|
||||||
|
}}>
|
||||||
|
{!premiumUser ? (
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
color: colors.accent,
|
||||||
|
fontFamily: WEIGHT.regular,
|
||||||
|
fontSize: 10,
|
||||||
|
marginRight: 5,
|
||||||
|
}}>
|
||||||
|
PRO
|
||||||
|
</Text>
|
||||||
|
) : null}
|
||||||
|
</TouchableOpacity>
|
||||||
{note && note.tags ? note.tags.map(_renderTag) : null}
|
{note && note.tags ? note.tags.map(_renderTag) : null}
|
||||||
<TextInput
|
<TextInput
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
Reference in New Issue
Block a user