Update how assignment of general.enableClipboardPopups works (#583)
This commit is contained in:
parent
976a200ffc
commit
ce7f9dd09a
@ -36,25 +36,16 @@ class ClipboardPopupsController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async _onEnableClipboardPopupsChanged(e) {
|
async _onEnableClipboardPopupsChanged(e) {
|
||||||
const enableClipboardPopups = e.target.checked;
|
const checkbox = e.currentTarget;
|
||||||
const options = await this._settingsController.getOptionsMutable();
|
let value = checkbox.checked;
|
||||||
|
|
||||||
if (enableClipboardPopups) {
|
if (value) {
|
||||||
options.general.enableClipboardPopups = await new Promise((resolve) => {
|
value = await new Promise((resolve) => {
|
||||||
chrome.permissions.request(
|
chrome.permissions.request({permissions: ['clipboardRead']}, resolve);
|
||||||
{permissions: ['clipboardRead']},
|
|
||||||
(granted) => {
|
|
||||||
if (!granted) {
|
|
||||||
this._checkbox.checked = false;
|
|
||||||
}
|
|
||||||
resolve(granted);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
} else {
|
checkbox.checked = value;
|
||||||
options.general.enableClipboardPopups = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await this._settingsController.save();
|
await this._settingsController.setProfileSetting('general.enableClipboardPopups', value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user