feat: show protected content when chip is selected

This commit is contained in:
Antonella Sgarlatta
2021-03-11 16:01:20 -03:00
parent a1dd895a06
commit 367a7e7a14
3 changed files with 9 additions and 1 deletions

View File

@@ -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);

View File

@@ -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}
/>
);
};

View File

@@ -563,6 +563,7 @@ export const Notes = React.memo(
: undefined
}
searchOptions={searchOptions}
showProtectedContents={includeProtectedNoteText}
/>
<FAB
// @ts-ignore style prop does not exist in types