Make SettingsHandler truly abstract

pull/21833/head
Travis Ralston 2020-07-30 08:50:36 -06:00
parent 648c3c7796
commit bb48ee669b
1 changed files with 4 additions and 14 deletions

View File

@ -28,10 +28,7 @@ export default abstract class SettingsHandler {
* @param {String} roomId The room ID to read from, may be null. * @param {String} roomId The room ID to read from, may be null.
* @returns {*} The setting value, or null if not found. * @returns {*} The setting value, or null if not found.
*/ */
public getValue(settingName: string, roomId: string): any { public abstract getValue(settingName: string, roomId: string): any;
console.error("Invalid operation: getValue was not overridden");
return null;
}
/** /**
* Sets the value for a particular setting at this level for a particular room. * Sets the value for a particular setting at this level for a particular room.
@ -44,10 +41,7 @@ export default abstract class SettingsHandler {
* @param {*} newValue The new value for the setting, may be null. * @param {*} newValue The new value for the setting, may be null.
* @returns {Promise} Resolves when the setting has been saved. * @returns {Promise} Resolves when the setting has been saved.
*/ */
public setValue(settingName: string, roomId: string, newValue: any): Promise<void> { public abstract setValue(settingName: string, roomId: string, newValue: any): Promise<void>;
console.error("Invalid operation: setValue was not overridden");
return Promise.reject(new Error("Invalid operation: setValue was not overridden"));
}
/** /**
* Determines if the current user is able to set the value of the given setting * Determines if the current user is able to set the value of the given setting
@ -56,15 +50,11 @@ export default abstract class SettingsHandler {
* @param {String} roomId The room ID to check in, may be null * @param {String} roomId The room ID to check in, may be null
* @returns {boolean} True if the setting can be set by the user, false otherwise. * @returns {boolean} True if the setting can be set by the user, false otherwise.
*/ */
public canSetValue(settingName: string, roomId: string): boolean { public abstract canSetValue(settingName: string, roomId: string): boolean;
return false;
}
/** /**
* Determines if this level is supported on this device. * Determines if this level is supported on this device.
* @returns {boolean} True if this level is supported on the current device. * @returns {boolean} True if this level is supported on the current device.
*/ */
public isSupported(): boolean { public abstract isSupported(): boolean;
return false;
}
} }