Fix settings permissions issues (#1360)

* Add missing warning indicator for the MeCab option

* Fix error handling of permissions requests
This commit is contained in:
toasted-nutbread 2021-02-08 19:37:36 -05:00 committed by GitHub
parent 0d031ab785
commit 0ed24347ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -71,10 +71,16 @@ class PermissionsToggleController {
if (value || !hasPermissionsSetting) { if (value || !hasPermissionsSetting) {
toggle.checked = valuePre; toggle.checked = valuePre;
const requiredPermissions = this._getRequiredPermissions(toggle);
try { try {
value = await this._settingsController.setPermissionsGranted(this._getRequiredPermissions(toggle), value); value = await this._settingsController.setPermissionsGranted(requiredPermissions, value);
} catch (error) { } catch (error) {
value = valuePre; value = valuePre;
try {
value = await this._settingsController.hasPermissions(requiredPermissions);
} catch (error2) {
// NOP
}
} }
toggle.checked = value; toggle.checked = value;
} }

View File

@ -1149,6 +1149,7 @@
<div class="settings-item advanced-only"> <div class="settings-item advanced-only">
<div class="settings-item-inner"> <div class="settings-item-inner">
<div class="settings-item-left"> <div class="settings-item-left">
<div class="settings-item-invalid-indicator"></div>
<div class="settings-item-label">Parse text using <a href="https://en.wikipedia.org/wiki/MeCab" target="_blank" rel="noopener noreferrer">MeCab</a></div> <div class="settings-item-label">Parse text using <a href="https://en.wikipedia.org/wiki/MeCab" target="_blank" rel="noopener noreferrer">MeCab</a></div>
<div class="settings-item-description"> <div class="settings-item-description">
Requires a native component to be installed that Yomichan will connect to. Requires a native component to be installed that Yomichan will connect to.