From 367a7e7a14d03436997a6bd5b2a8ede04eb691cb Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Thu, 11 Mar 2021 16:01:20 -0300 Subject: [PATCH] feat: show protected content when chip is selected --- src/screens/Notes/NoteCell.tsx | 7 ++++++- src/screens/Notes/NoteList.tsx | 2 ++ src/screens/Notes/Notes.tsx | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/screens/Notes/NoteCell.tsx b/src/screens/Notes/NoteCell.tsx index 72111760..d8350db0 100644 --- a/src/screens/Notes/NoteCell.tsx +++ b/src/screens/Notes/NoteCell.tsx @@ -28,6 +28,7 @@ type Props = { hideDates: boolean; hidePreviews: boolean; sortType: CollectionSort; + showProtectedContent: boolean; }; export const NoteCell = ({ @@ -37,6 +38,7 @@ export const NoteCell = ({ sortType, hideDates, hidePreviews, + showProtectedContent, }: Props) => { // Context const application = useContext(ApplicationContext); @@ -185,7 +187,10 @@ export const NoteCell = ({ }; const padding = 14; - const showPreview = !hidePreviews && !note.protected && !note.hidePreview; + const showPreview = + !hidePreviews && + (!note.protected || showProtectedContent) && + !note.hidePreview; const hasPlainPreview = !isNullOrUndefined(note.preview_plain) && note.preview_plain.length > 0; const showDetails = !note.errorDecrypting && (!hideDates || note.protected); diff --git a/src/screens/Notes/NoteList.tsx b/src/screens/Notes/NoteList.tsx index ccbd476d..5ffafa63 100644 --- a/src/screens/Notes/NoteList.tsx +++ b/src/screens/Notes/NoteList.tsx @@ -42,6 +42,7 @@ type Props = { onPress: () => void; label: string; }[]; + showProtectedContents: boolean; onPressItem: (noteUuid: SNNote['uuid']) => void; selectedNoteId: string | undefined; sortType: CollectionSort; @@ -140,6 +141,7 @@ export const NoteList = (props: Props) => { hideDates={props.hideDates} hidePreviews={props.hidePreviews} highlighted={item.uuid === props.selectedNoteId} + showProtectedContent={props.showProtectedContents} /> ); }; diff --git a/src/screens/Notes/Notes.tsx b/src/screens/Notes/Notes.tsx index 72a14388..53258f5a 100644 --- a/src/screens/Notes/Notes.tsx +++ b/src/screens/Notes/Notes.tsx @@ -563,6 +563,7 @@ export const Notes = React.memo( : undefined } searchOptions={searchOptions} + showProtectedContents={includeProtectedNoteText} />