mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +01:00
prevent favorite items from being unfavorited.
This commit is contained in:
@@ -15,8 +15,7 @@ import {ACTIONS} from '../../provider/actions';
|
|||||||
import {w, ToastEvent, db} from '../../utils/utils';
|
import {w, ToastEvent, db} from '../../utils/utils';
|
||||||
import {eSendEvent} from '../../services/eventManager';
|
import {eSendEvent} from '../../services/eventManager';
|
||||||
import {eOpenMoveNoteDialog, eOpenSimpleDialog} from '../../services/events';
|
import {eOpenMoveNoteDialog, eOpenSimpleDialog} from '../../services/events';
|
||||||
|
import {TEMPLATE_DELETE} from '../DialogManager/templates';
|
||||||
import {TEMPLATE_DELETE} from '../DialogManager';
|
|
||||||
|
|
||||||
export const AnimatedSafeAreaView = Animatable.createAnimatableComponent(
|
export const AnimatedSafeAreaView = Animatable.createAnimatableComponent(
|
||||||
SafeAreaView,
|
SafeAreaView,
|
||||||
@@ -128,10 +127,10 @@ export const SelectionHeader = ({navigation}) => {
|
|||||||
let unFavCount = 0;
|
let unFavCount = 0;
|
||||||
if (selectedItemsList.length > 0) {
|
if (selectedItemsList.length > 0) {
|
||||||
selectedItemsList.forEach(async item => {
|
selectedItemsList.forEach(async item => {
|
||||||
if (item.favorite) {
|
if (!item.favorite) {
|
||||||
favCount += 1;
|
favCount += 1;
|
||||||
} else {
|
} else {
|
||||||
unFavCount += 1;
|
return;
|
||||||
}
|
}
|
||||||
await db.notes.note(item.id).favorite();
|
await db.notes.note(item.id).favorite();
|
||||||
dispatch({type: ACTIONS.NOTES});
|
dispatch({type: ACTIONS.NOTES});
|
||||||
@@ -143,10 +142,7 @@ export const SelectionHeader = ({navigation}) => {
|
|||||||
dispatch({type: ACTIONS.CLEAR_SELECTION});
|
dispatch({type: ACTIONS.CLEAR_SELECTION});
|
||||||
|
|
||||||
ToastEvent.show(
|
ToastEvent.show(
|
||||||
favCount +
|
favCount + ' notes added to favorites',
|
||||||
' notes added to favorites &' +
|
|
||||||
unFavCount +
|
|
||||||
'removed',
|
|
||||||
'success',
|
'success',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user