Commit 54a46488 authored by Steven Bennetts's avatar Steven Bennetts Committed by Commit Bot

Settings: Internet: Fix configuration of type properties

Bug: 1014671
Change-Id: Ia84e5de9664859c0f5ba53ad0b32e13ffc761451
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1863733Reviewed-by: default avatarToni Baržić <tbarzic@chromium.org>
Commit-Queue: Steven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706230}
parent adf5debb
......@@ -508,6 +508,16 @@ class OncMojo {
return 0;
}
/**
* @param {string} key
* @return {boolean}
*/
static isTypeKey(key) {
return key.startsWith('cellular') || key.startsWith('ethernet') ||
key.startsWith('tether') || key.startsWith('vpn') ||
key.startsWith('wifi');
}
/**
* This is a bit of a hack. To avoid adding 'typeProperties' to every type
* specific field name and translated string, we check for type specific
......@@ -516,9 +526,7 @@ class OncMojo {
* @return {string}
*/
static getManagedPropertyKey(key) {
if (key.startsWith('cellular') || key.startsWith('ethernet') ||
key.startsWith('tether') || key.startsWith('vpn') ||
key.startsWith('wifi')) {
if (OncMojo.isTypeKey(key)) {
key = 'typeProperties.' + key;
}
return key;
......@@ -763,6 +771,9 @@ class OncMojo {
* @param {boolean|number|string|!Object} value The property value
*/
static setConfigProperty(config, key, value) {
if (OncMojo.isTypeKey(key)) {
key = 'typeConfig.' + key;
}
while (true) {
const index = key.indexOf('.');
if (index < 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment