1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-02 12:47:41 +02:00

Mobile: Fixed proxy timeout setting UI

This commit is contained in:
Laurent Cozic 2023-01-03 19:42:26 +00:00
parent 9a9d51caaf
commit ff355b9f4d

View File

@ -1456,6 +1456,7 @@ class Setting extends BaseModel {
section: 'sync',
isGlobal: true,
public: true,
maximum: 60,
label: () => _('Proxy timeout (seconds)'),
storage: SettingStorage.File,
},
@ -1621,9 +1622,14 @@ class Setting extends BaseModel {
return this.metadata_;
}
private static isMobileSetting(md: SettingItem) {
return !md.appTypes || md.appTypes.includes(AppType.Mobile);
}
private static validateMetadata(md: SettingItems) {
for (const [k, v] of Object.entries(md)) {
if (v.isGlobal && v.storage !== SettingStorage.File) throw new Error(`Setting "${k}" is global but storage is not "file"`);
if (v.isGlobal && v.storage !== SettingStorage.File) throw new Error(`Setting "${k}": It is global but storage is not "file"`);
if (v.type === SettingItemType.Int && v.public && this.isMobileSetting(v) && !v.isEnum && !('maximum' in v)) throw new Error(`Setting "${k}": Public integer values must define a maximum value (minimum defaults to 0)`);
}
}