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 84145da25..b2e176a7b 100644 Binary files a/dist/assets/ionicons.eot and b/dist/assets/ionicons.eot differ 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" /> + + +