Implement App-Scoped Security scoped bookmarks (#11711)
* implementation of security scoped bookmarks * option is now only available on mas builds
This commit is contained in:
parent
9f78ef0179
commit
d1d50a4c92
11 changed files with 226 additions and 42 deletions
|
@ -83,7 +83,7 @@ module.exports = {
|
|||
}
|
||||
}
|
||||
|
||||
let {buttonLabel, defaultPath, filters, properties, title, message} = options
|
||||
let {buttonLabel, defaultPath, filters, properties, title, message, securityScopedBookmarks = false} = options
|
||||
|
||||
if (properties == null) {
|
||||
properties = ['openFile']
|
||||
|
@ -126,10 +126,10 @@ module.exports = {
|
|||
throw new TypeError('Message must be a string')
|
||||
}
|
||||
|
||||
const wrappedCallback = typeof callback === 'function' ? function (success, result) {
|
||||
return callback(success ? result : void 0)
|
||||
const wrappedCallback = typeof callback === 'function' ? function (success, result, bookmarkData) {
|
||||
return success ? callback(result, bookmarkData) : callback()
|
||||
} : null
|
||||
const settings = {title, buttonLabel, defaultPath, filters, message, window}
|
||||
const settings = {title, buttonLabel, defaultPath, filters, message, securityScopedBookmarks, window}
|
||||
settings.properties = dialogProperties
|
||||
return binding.showOpenDialog(settings, wrappedCallback)
|
||||
},
|
||||
|
@ -145,7 +145,7 @@ module.exports = {
|
|||
}
|
||||
}
|
||||
|
||||
let {buttonLabel, defaultPath, filters, title, message, nameFieldLabel, showsTagField} = options
|
||||
let {buttonLabel, defaultPath, filters, title, message, securityScopedBookmarks = false, nameFieldLabel, showsTagField} = options
|
||||
|
||||
if (title == null) {
|
||||
title = ''
|
||||
|
@ -185,10 +185,10 @@ module.exports = {
|
|||
showsTagField = true
|
||||
}
|
||||
|
||||
const wrappedCallback = typeof callback === 'function' ? function (success, result) {
|
||||
return callback(success ? result : void 0)
|
||||
const wrappedCallback = typeof callback === 'function' ? function (success, result, bookmarkData) {
|
||||
return success ? callback(result, bookmarkData) : callback()
|
||||
} : null
|
||||
const settings = {title, buttonLabel, defaultPath, filters, message, nameFieldLabel, showsTagField, window}
|
||||
const settings = {title, buttonLabel, defaultPath, filters, message, securityScopedBookmarks, nameFieldLabel, showsTagField, window}
|
||||
return binding.showSaveDialog(settings, wrappedCallback)
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue