From 0e4a6d718bc942c82aea268bd76cf8ef7b28e0ce Mon Sep 17 00:00:00 2001 From: Mo Bitar Date: Thu, 13 Dec 2018 13:03:25 -0600 Subject: [PATCH] Distinguish between locked and protected notes --- .../javascripts/app/controllers/editor.js | 5 +++++ .../javascripts/app/controllers/notes.js | 4 ++-- .../javascripts/app/services/authManager.js | 2 +- .../app/services/privilegesManager.js | 16 ++++++++-------- .../app/services/storageManager.js | 4 ++++ app/assets/stylesheets/app/_ionicons.scss | 11 ++++++++++- app/assets/stylesheets/app/_notes.scss | 9 ++++++--- .../privileges-management-modal.html.haml | 4 ++-- app/assets/templates/editor.html.haml | 1 + app/assets/templates/notes.html.haml | 8 +++++--- dist/assets/ionicons.eot | Bin 2090 -> 2978 bytes dist/assets/ionicons.svg | 18 +++++++++++++++--- dist/assets/ionicons.ttf | Bin 1912 -> 2800 bytes dist/assets/ionicons.woff | Bin 1348 -> 1944 bytes 14 files changed, 59 insertions(+), 23 deletions(-) diff --git a/app/assets/javascripts/app/controllers/editor.js b/app/assets/javascripts/app/controllers/editor.js index 986584343..5855c2a0a 100644 --- a/app/assets/javascripts/app/controllers/editor.js +++ b/app/assets/javascripts/app/controllers/editor.js @@ -422,6 +422,11 @@ angular.module('app') this.changesMade({dontUpdateClientModified: true, dontUpdatePreviews: true}); } + this.toggleProtectNote = function() { + this.note.content.protected = !this.note.content.protected; + this.changesMade({dontUpdateClientModified: true, dontUpdatePreviews: true}); + } + this.toggleNotePreview = function() { this.note.content.hidePreview = !this.note.content.hidePreview; this.changesMade({dontUpdateClientModified: true, dontUpdatePreviews: true}); diff --git a/app/assets/javascripts/app/controllers/notes.js b/app/assets/javascripts/app/controllers/notes.js index 068a40362..0247d0088 100644 --- a/app/assets/javascripts/app/controllers/notes.js +++ b/app/assets/javascripts/app/controllers/notes.js @@ -218,8 +218,8 @@ angular.module('app') }) } - if(note.locked && await privilegesManager.actionRequiresPrivilege(PrivilegesManager.ActionViewLockedNotes)) { - privilegesManager.presentPrivilegesModal(PrivilegesManager.ActionViewLockedNotes, () => { + if(note.content.protected && await privilegesManager.actionRequiresPrivilege(PrivilegesManager.ActionViewProtectedNotes)) { + privilegesManager.presentPrivilegesModal(PrivilegesManager.ActionViewProtectedNotes, () => { run(); }); } else { diff --git a/app/assets/javascripts/app/services/authManager.js b/app/assets/javascripts/app/services/authManager.js index 3e4381e1f..d92e9d1e5 100644 --- a/app/assets/javascripts/app/services/authManager.js +++ b/app/assets/javascripts/app/services/authManager.js @@ -44,7 +44,7 @@ class AuthManager extends SFAuthManager { this.storageManager.setItemsMode(StorageManager.Ephemeral); } else { this.storageManager.setModelStorageMode(StorageManager.Fixed); - this.storageManager.setItemsMode(this.storageManager.hasPasscode() ? StorageManager.FixedEncrypted : StorageManager.Fixed); + this.storageManager.setItemsMode(this.storageManager.bestStorageMode()); this.storageManager.setItem("ephemeral", JSON.stringify(false), StorageManager.Fixed); } } diff --git a/app/assets/javascripts/app/services/privilegesManager.js b/app/assets/javascripts/app/services/privilegesManager.js index 97d489338..1d9028f9e 100644 --- a/app/assets/javascripts/app/services/privilegesManager.js +++ b/app/assets/javascripts/app/services/privilegesManager.js @@ -16,7 +16,7 @@ class PrivilegesManager { PrivilegesManager.ActionManageExtensions = "ActionManageExtensions"; PrivilegesManager.ActionManageBackups = "ActionManageBackups"; - PrivilegesManager.ActionViewLockedNotes = "ActionViewLockedNotes"; + PrivilegesManager.ActionViewProtectedNotes = "ActionViewProtectedNotes"; PrivilegesManager.ActionManagePrivileges = "ActionManagePrivileges"; PrivilegesManager.ActionManagePasscode = "ActionManagePasscode"; PrivilegesManager.ActionDeleteNote = "ActionDeleteNote"; @@ -34,7 +34,7 @@ class PrivilegesManager { PrivilegesManager.ActionManageExtensions, PrivilegesManager.ActionManageBackups, PrivilegesManager.ActionManagePasscode, - PrivilegesManager.ActionViewLockedNotes, + PrivilegesManager.ActionViewProtectedNotes, PrivilegesManager.ActionDeleteNote ] @@ -174,8 +174,8 @@ class PrivilegesManager { label: "Download/Import Backups" }; - metadata[PrivilegesManager.ActionViewLockedNotes] = { - label: "View Locked Notes" + metadata[PrivilegesManager.ActionViewProtectedNotes] = { + label: "View Protected Notes" }; metadata[PrivilegesManager.ActionManagePrivileges] = { @@ -224,8 +224,8 @@ class PrivilegesManager { let expiresAt = addToNow(length); return Promise.all([ - this.storageManager.setItem(PrivilegesManager.SessionExpiresAtKey, JSON.stringify(expiresAt), StorageManager.FixedEncrypted), - this.storageManager.setItem(PrivilegesManager.SessionLengthKey, JSON.stringify(length), StorageManager.FixedEncrypted), + this.storageManager.setItem(PrivilegesManager.SessionExpiresAtKey, JSON.stringify(expiresAt), this.storageManager.bestStorageMode()), + this.storageManager.setItem(PrivilegesManager.SessionLengthKey, JSON.stringify(length), this.storageManager.bestStorageMode()), ]) } @@ -234,7 +234,7 @@ class PrivilegesManager { } async getSelectedSessionLength() { - let length = await this.storageManager.getItem(PrivilegesManager.SessionLengthKey, StorageManager.FixedEncrypted); + let length = await this.storageManager.getItem(PrivilegesManager.SessionLengthKey, this.storageManager.bestStorageMode()); if(length) { return JSON.parse(length); } else { @@ -243,7 +243,7 @@ class PrivilegesManager { } async getSessionExpirey() { - let expiresAt = await this.storageManager.getItem(PrivilegesManager.SessionExpiresAtKey, StorageManager.FixedEncrypted); + let expiresAt = await this.storageManager.getItem(PrivilegesManager.SessionExpiresAtKey, this.storageManager.bestStorageMode()); if(expiresAt) { return new Date(JSON.parse(expiresAt)); } else { diff --git a/app/assets/javascripts/app/services/storageManager.js b/app/assets/javascripts/app/services/storageManager.js index 908490747..87b46eb56 100644 --- a/app/assets/javascripts/app/services/storageManager.js +++ b/app/assets/javascripts/app/services/storageManager.js @@ -174,6 +174,10 @@ class StorageManager extends SFStorageManager { return this.getItemSync("encryptedStorage", StorageManager.Fixed) !== null; } + bestStorageMode() { + return this.hasPasscode() ? StorageManager.FixedEncrypted : StorageManager.Fixed; + } + /* Model Storage diff --git a/app/assets/stylesheets/app/_ionicons.scss b/app/assets/stylesheets/app/_ionicons.scss index 70647fb73..6390e6f48 100644 --- a/app/assets/stylesheets/app/_ionicons.scss +++ b/app/assets/stylesheets/app/_ionicons.scss @@ -17,7 +17,10 @@ .ion-bookmark:before, .ion-locked:before, .ion-arrow-return-left:before, -.ion-arrow-return-right:before +.ion-arrow-return-right:before, +.ion-key:before, +.ion-lock-combination:before, +.ion-eye-disabled:before { display: inline-block; font-family: "Ionicons"; speak: none; font-style: normal; font-weight: normal; font-variant: normal; text-transform: none; text-rendering: auto; line-height: 1; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } @@ -32,4 +35,10 @@ .ion-arrow-return-right:before { content: "\f266"; } +.ion-key:before { content: "\f296"; } + +.ion-lock-combination:before { content: "\f4d4"; } + +.ion-eye-disabled:before { content: "\f306"; } + /*# sourceMappingURL=ionicons.css.map */ diff --git a/app/assets/stylesheets/app/_notes.scss b/app/assets/stylesheets/app/_notes.scss index d087ca044..06adfc630 100644 --- a/app/assets/stylesheets/app/_notes.scss +++ b/app/assets/stylesheets/app/_notes.scss @@ -153,13 +153,16 @@ opacity: 0.6; } + .note-flag { + color: var(--sn-stylekit-info-color); + } + .note-flags { display: flex; flex-direction: row; align-items: center; - .pinned, .archived { - color: var(--sn-stylekit-info-color); + .note-flag { margin-right: 10px; } } @@ -181,7 +184,7 @@ background-color: var(--sn-stylekit-info-color); color: var(--sn-stylekit-info-contrast-color); - .pinned, .archived { + .note-flag { color: var(--sn-stylekit-info-contrast-color); } diff --git a/app/assets/templates/directives/privileges-management-modal.html.haml b/app/assets/templates/directives/privileges-management-modal.html.haml index 03a4bfb11..95e897156 100644 --- a/app/assets/templates/directives/privileges-management-modal.html.haml +++ b/app/assets/templates/directives/privileges-management-modal.html.haml @@ -24,8 +24,8 @@ %input{"type" => "checkbox", "ng-disabled" => "!credentialDisplayInfo[credential].availability", "ng-checked" => "isCredentialRequiredForAction(action, credential)", "ng-click" => "checkboxValueChanged(action, credential)"} .sk-panel-section{"ng-if" => "sessionExpirey && !sessionExpired"} - .sk-p You will not be asked to authenticate until {{sessionExpirey}}. - %a.sk-a {"ng-click" => "clearSession()"} Clear Session + .sk-p.sk-panel-row You will not be asked to authenticate until {{sessionExpirey}}. + %a.sk-a.sk-panel-row.info{"ng-click" => "clearSession()"} Clear Session .sk-panel-footer .sk-h2 About Privileges .sk-panel-section.no-bottom-pad diff --git a/app/assets/templates/editor.html.haml b/app/assets/templates/editor.html.haml index 70ceb1b4e..593cdb990 100644 --- a/app/assets/templates/editor.html.haml +++ b/app/assets/templates/editor.html.haml @@ -34,6 +34,7 @@ %menu-row{"label" => "ctrl.note.pinned ? 'Unpin' : 'Pin'", "action" => "ctrl.selectedMenuItem(true); ctrl.togglePin()", "desc" => "'Pin or unpin a note from the top of your list'"} %menu-row{"label" => "ctrl.note.archived ? 'Unarchive' : 'Archive'", "action" => "ctrl.selectedMenuItem(true); ctrl.toggleArchiveNote()", "desc" => "'Archive or unarchive a note from your Archived system tag'"} %menu-row{"label" => "ctrl.note.locked ? 'Unlock' : 'Lock'", "action" => "ctrl.selectedMenuItem(true); ctrl.toggleLockNote()", "desc" => "'Locking notes prevents unintentional editing'"} + %menu-row{"label" => "ctrl.note.content.protected ? 'Unprotect' : 'Protect'", "action" => "ctrl.selectedMenuItem(true); ctrl.toggleProtectNote()", "desc" => "'Protecting a note will require credentials to view it (Manage Privileges via Account menu)'"} %menu-row{"label" => "'Preview'", "circle" => "ctrl.note.content.hidePreview ? 'danger' : 'success'", "circle-align" => "'right'", "action" => "ctrl.selectedMenuItem(true); ctrl.toggleNotePreview()", "desc" => "'Hide or unhide the note preview from the list of notes'"} %menu-row{"label" => "'Delete'", "action" => "ctrl.selectedMenuItem(); ctrl.deleteNote()", "desc" => "'Delete this note permanently from all your devices'"} diff --git a/app/assets/templates/notes.html.haml b/app/assets/templates/notes.html.haml index fc27d7772..cdccad9e2 100644 --- a/app/assets/templates/notes.html.haml +++ b/app/assets/templates/notes.html.haml @@ -50,11 +50,11 @@ %strong.red.medium-text{"ng-if" => "note.errorDecrypting"} Unable to Decrypt .note-flags - .pinned{"ng-if" => "note.pinned"} + .pinned.note-flag{"ng-if" => "note.pinned"} %i.icon.ion-bookmark %strong.medium-text Pinned - .archived{"ng-if" => "note.archived && !ctrl.tag.isSmartTag()"} + .archived.note-flag{"ng-if" => "note.archived && !ctrl.tag.isSmartTag()"} %i.icon.ion-ios-box %strong.medium-text Archived @@ -62,8 +62,10 @@ .faded {{note.savedTagsString || note.tagsString()}} .name{"ng-if" => "note.title"} - %span.locked.tinted{"ng-if" => "note.locked", "ng-class" => "{'tinted-selected' : ctrl.selectedNote == note}"} + %span.note-flag{"ng-show" => "note.locked"} %i.icon.ion-locked.medium-text + %span.note-flag{"ng-show" => "note.content.protected"} + %i.icon.ion-eye-disabled {{note.title}} .note-preview{"ng-if" => "!ctrl.hideNotePreview && !note.content.hidePreview && !note.locked"} diff --git a/dist/assets/ionicons.eot b/dist/assets/ionicons.eot index 84145da254ce268171db6307fcd2fa877cb740d3..b2e176a7b4fbe8726f42c8236b3514c5e8f69143 100644 GIT binary patch delta 1437 zcmZ8hO>7%Q6rS0g-PzsodYxsxYbSQn+9WOr*(=itutMs>Y8@(x1UE(h(1`j2NH ztN{KAXl44X)ibCKgI?r%a-(*;esY3Du>TIQa%17`xm?u?K)(v=z4_VNOxu;CmqE7& z6wHG_{0hGdzAV6x&o8bvSo3Gp27<3a@YKTcbWMC9&4Yti0H+pfjXJuDz6E^+@R_CB z;_Nq{_V2)6;|K}3zI=Q2R({|D1TX>m2ExFBrtci=yk_+OftUaSgnp>Jxcu*YvW;N? zRuHJ4;|gwsw@gtfeT3vl!ad_iRz<}~Lh$%zTo{Z!+Wp5>b#qcE z-bCBnJ5Uv94evTHlGBfEjulasBxy_NAwFO?X@SRf)M zFhn8|0+Xu769%S2m@&J%&tEJ`R04A$)k5ZD zL`+yO4E_op%uK6XP(~=Ajh;aLP)gg0lYFi~3t>-T5SLvibR^3OA+g{BmXrK5pOYQ8 z8Tej-+GRI{yt#pmCrf=PD=3`Lx=)TdBc0Dy=gt?4W6tqGqC@Jm6$O`_Y`6bXx1VrD zNz*#*xR!BnuIo~}RkAG`Y?5P_FFMaVpLe7>RKxDlm?XMw!CKIrNtH3Bc9+}%ea+9g zce5^qP3RhEyfx?p1EtYfNMQqg$dmZ{EFfyvPUe$=>-fCFW~xsp^U}sHmnAqnbsT2?nN0 zB^ntpkqJx`PFpB(Dl0KVi77mi5<**_N!@}2cPIR%0v0gucL~cFS{bXGd$fDV?F;Ce jORrxp_qOIs7bENqd)x~C-M?-O01tnA|4W!oT}yugPfPRS delta 522 zcmYLG!AcuZ6g~INBpDNprc?#ZA`6>E3n|zlE<%h%cWQ;Yuu`x?8k15-2Mi_M)GUg) zm07wl2!gl`f-BK~NWq1KanaI+t60H>Fg-J^c;UXe=bX9so%i1U;89=rxdGH7JK-^X zqSbbH^4~W{EgL0pP$K~3s@lX4JV<)KVCF2q&n!VbUxo)^Jc-i z^skOCUwyAZEs03e@^OPvjM3<0+om}i$=+$%qaK6Qc IqK|j*7dmHa_y7O^ diff --git a/dist/assets/ionicons.svg b/dist/assets/ionicons.svg index 16f73af22..41ab5a832 100755 --- a/dist/assets/ionicons.svg +++ b/dist/assets/ionicons.svg @@ -5,7 +5,7 @@ --> -Created by FontForge 20170925 at Thu Dec 13 12:01:05 2018 +Created by FontForge 20170925 at Thu Dec 13 12:46:07 2018 By mo Copyright (c) 2018, mo @@ -19,16 +19,28 @@ Copyright (c) 2018, mo panose-1="2 0 5 3 0 0 0 0 0 0" ascent="448" descent="-64" - bbox="0 -32 384 416" + bbox="0 -64 448 448" underline-thickness="25.6" underline-position="-51.2" - unicode-range="U+F200-F3EC" + unicode-range="U+F200-F4D4" /> + + + 7%Q6rQ&`yR$!Dud}Ro?Z!@8o5ZC;c3AI^(>94w(?lqQ2Gy!sC~2+yG(djb zG$3 z#J^x)o_crXDCq!{i(F2x)o(QR_Rtd1en6~Tn}2UMSM@`bub}wB+)RDCl%pbRhl?@$>UbQ+4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