fix: update snjs & protection code

This commit is contained in:
Laurent Senta
2021-12-29 10:15:54 +01:00
parent 88404609cc
commit 6c0d78fbaf
3 changed files with 56 additions and 41 deletions

View File

@@ -27,7 +27,7 @@
"@react-navigation/native": "^5.9.3",
"@react-navigation/stack": "^5.14.3",
"@standardnotes/sncrypto-common": "1.5.2",
"@standardnotes/snjs": "2.20.3",
"@standardnotes/snjs": "2.30.0",
"js-base64": "^3.5.2",
"moment": "^2.29.1",
"react": "17.0.1",

View File

@@ -81,16 +81,23 @@ export const Notes = React.memo(
const [searchText, setSearchText] = useState('');
const [editor, setEditor] = useState<Editor | undefined>(undefined);
const [searchOptions, setSearchOptions] = useState<SearchOptions>([]);
const areNotesCurrentlyProtected = useCallback(() => {
if (!application) {
return true;
}
return (
application.hasProtectionSources() &&
!application.hasUnprotectedAccessSession()
);
}, [application]);
const [
includeProtectedNoteText,
setIncludeProtectedNoteText,
] = useState<boolean>(
() =>
!(
application!.hasProtectionSources() &&
application!.areProtectionsEnabled()
)
);
] = useState<boolean>(!areNotesCurrentlyProtected());
const [includeArchivedNotes, setIncludeArchivedNotes] = useState<boolean>(
false
);
@@ -105,10 +112,7 @@ export const Notes = React.memo(
// Ref
const haveDisplayOptions = useRef(false);
const protectionsEnabled = useRef(
application!.hasProtectionSources() &&
application!.areProtectionsEnabled()
);
const protectionsEnabled = useRef(areNotesCurrentlyProtected());
const reloadTitle = useCallback(
(newNotes?: SNNote[], newFilter?: string) => {
@@ -321,13 +325,11 @@ export const Notes = React.memo(
}, [includeTrashedNotes, reloadNotesDisplayOptions]);
const reloadSearchOptions = useCallback(() => {
const protections =
application?.hasProtectionSources() &&
application?.areProtectionsEnabled();
const currentlyProtected = areNotesCurrentlyProtected();
if (protections !== protectionsEnabled.current) {
protectionsEnabled.current = !!protections;
setIncludeProtectedNoteText(!protections);
if (currentlyProtected !== protectionsEnabled.current) {
protectionsEnabled.current = !!currentlyProtected;
setIncludeProtectedNoteText(!currentlyProtected);
}
const selectedTag = application?.getAppState().selectedTag;
@@ -361,6 +363,7 @@ export const Notes = React.memo(
includeProtectedNoteText,
includeArchivedNotes,
includeTrashedNotes,
areNotesCurrentlyProtected,
toggleIncludeProtected,
toggleIncludeArchived,
toggleIncludeTrashed,

View File

@@ -1625,6 +1625,13 @@
dependencies:
"@sinonjs/commons" "^1.7.0"
"@standardnotes/auth@3.8.1":
version "3.8.1"
resolved "https://registry.yarnpkg.com/@standardnotes/auth/-/auth-3.8.1.tgz#4197fb2f7e223c6bd13a870a3feac3c73294fb3c"
integrity sha512-Q2/81dgFGIGuYlQ4VnSjGRsDB0Qw0tQP/qsiuV+DQj+wdp5Wy5WX3Q4g+p2PNvoyEAYgbuduEHZfWuTLAaIdyw==
dependencies:
"@standardnotes/common" "^1.2.1"
"@standardnotes/auth@3.8.3", "@standardnotes/auth@^3.8.1":
version "3.8.3"
resolved "https://registry.yarnpkg.com/@standardnotes/auth/-/auth-3.8.3.tgz#6e627c1a1a9ebf91d97f52950d099bf7704382e3"
@@ -1632,47 +1639,52 @@
dependencies:
"@standardnotes/common" "^1.2.1"
"@standardnotes/common@1.2.1":
version "1.2.1"
resolved "https://registry.yarnpkg.com/@standardnotes/common/-/common-1.2.1.tgz#9db212db86ccbf08b347da02549b3dbe4bedbb02"
integrity sha512-HilBxS50CBlC6TJvy1mrnhGVDzOH63M/Jf+hyMxQ0Vt1nYzpd0iyxVEUrgMh7ZiyO1b9CLnCDED99Jy9rnZWVQ==
"@standardnotes/common@^1.2.1":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@standardnotes/common/-/common-1.3.0.tgz#d3376ebe146cbe43577a0980fc09ea01fd18eb3a"
integrity sha512-ePyxHHG+AswmDSemh4AEGtDL8hvlW1KOnUSweGBtLbgSuh2CrhexuoYp7Juf9Bzli7s+Zl+2EZI0EEBqoE8iyg==
"@standardnotes/domain-events@^2.5.1":
version "2.5.2"
resolved "https://registry.yarnpkg.com/@standardnotes/domain-events/-/domain-events-2.5.2.tgz#fa3279c156ab21546c4e5fbd0efea599403bbae8"
integrity sha512-krXYWmdyTbor8zicV1svx2efnn+4iYcO0YIv59EdGt6SPt5was6WdIJyYZOGgOsCcOuTkLk8Rj/zAfSUxDBDxw==
"@standardnotes/domain-events@2.5.1":
version "2.5.1"
resolved "https://registry.yarnpkg.com/@standardnotes/domain-events/-/domain-events-2.5.1.tgz#e6433e940ae616683d1c24f76133c70755504c44"
integrity sha512-p0VB4Al/ZcVqcj9ztU7TNqzc3jjjG6/U7x9lBW/QURHxpB+PnwJq3kFU5V5JA9QpCOYlXLT71CMERMf/O5QX6g==
dependencies:
"@standardnotes/auth" "^3.8.1"
"@standardnotes/features@^1.10.2":
version "1.10.2"
resolved "https://registry.yarnpkg.com/@standardnotes/features/-/features-1.10.2.tgz#a0783f66c00e21cb7692edc0cea95ec25a0253a5"
integrity sha512-Zh6EMjli4mL6jlXEhMyU3qYIKFJj5kuhbxtHXiErUGIDy+s1hHY+THFFO53Jdga2+8wgcATWlmSBY7dieVA8uA==
"@standardnotes/features@1.11.0":
version "1.11.0"
resolved "https://registry.yarnpkg.com/@standardnotes/features/-/features-1.11.0.tgz#66e960a20358c5f58b6be4e19226b34df6f4efbf"
integrity sha512-KMP60C1lf5C141s5VVOs7mISS1IUCioJfYsbsxtPycx9Q1mgbDB3xJv/GuCK/avsQOiGrB7QN06CQJ7fw4XV3Q==
dependencies:
"@standardnotes/auth" "3.8.3"
"@standardnotes/common" "^1.2.1"
"@standardnotes/settings@^1.2.1":
version "1.2.1"
resolved "https://registry.yarnpkg.com/@standardnotes/settings/-/settings-1.2.1.tgz#4c7656ea86d784a2f77c70acc89face5d28da024"
integrity sha512-EhCDtQKcVzY6cJ6qXCkAiA3sJ3Wj/q0L0ZVYq+tCXd0jaxmZ8fSk5YNqdwJfjmNXsqtuh7xq6eA2dcXd1fD9VQ==
"@standardnotes/settings@^1.8.0":
version "1.8.0"
resolved "https://registry.yarnpkg.com/@standardnotes/settings/-/settings-1.8.0.tgz#d7bd1f35c3b500d12ba73f5f385b1019baae3efc"
integrity sha512-gszghenDHFHoEeIGW7fHtIOJw35WpuaOdTD6UNMrH71xEduAr0JtzaLwrFXJ7XIp62zY7CSY1V6Npxo6HTGn+w==
"@standardnotes/sncrypto-common@1.5.2", "@standardnotes/sncrypto-common@^1.5.2":
"@standardnotes/sncrypto-common@1.5.2":
version "1.5.2"
resolved "https://registry.yarnpkg.com/@standardnotes/sncrypto-common/-/sncrypto-common-1.5.2.tgz#be9404689d94f953c68302609a4f76751eaa82cd"
integrity sha512-+OQ6gajTcVSHruw33T52MHyBDKL1vRCfQBXQn4tt4+bCfBAe+PFLkEQMHp35bg5twCfg9+wUf2KhmNNSNyBBZw==
"@standardnotes/snjs@2.20.3":
version "2.20.3"
resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.20.3.tgz#11fe962dfb017be459e856b9fbc6311c5046a0b0"
integrity sha512-FHog3p3SuMvTXsEl76UenbjY8PS6VL/b6MjaC9whJR5ZwsvmLwE0G16dWZ+z+izm+CsRaHMWU8R2cy7RG7HjZg==
"@standardnotes/snjs@2.30.0":
version "2.30.0"
resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.30.0.tgz#12abda65e8069273347bbf6786d6a99203260023"
integrity sha512-0s7NYtO8edvY3/MNwx/Ic+fIDXiSnaVhdBWlaIOreVHwUl15LkHyN8mptR8QLtHOjOhvaguew+KCvmXXmkNjTA==
dependencies:
"@standardnotes/auth" "^3.8.1"
"@standardnotes/common" "^1.2.1"
"@standardnotes/domain-events" "^2.5.1"
"@standardnotes/features" "^1.10.2"
"@standardnotes/settings" "^1.2.1"
"@standardnotes/sncrypto-common" "^1.5.2"
"@standardnotes/auth" "3.8.1"
"@standardnotes/common" "1.2.1"
"@standardnotes/domain-events" "2.5.1"
"@standardnotes/features" "1.11.0"
"@standardnotes/settings" "^1.8.0"
"@standardnotes/sncrypto-common" "1.5.2"
"@types/babel__core@^7.0.0", "@types/babel__core@^7.1.7":
version "7.1.10"