mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 00:52:55 +00:00
refactor(setting): adjust setting module to new core translation
Closes #53
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* Copyright (C) 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
SCSettingValue,
|
||||
SCSettingValues,
|
||||
} from '@openstapps/core';
|
||||
import * as deepMerge from 'deepmerge';
|
||||
import deepmerge from 'deepmerge';
|
||||
import {ConfigProvider} from '../config/config.provider';
|
||||
import {StorageProvider} from '../storage/storage.provider';
|
||||
|
||||
@@ -64,7 +64,6 @@ export interface SettingValueContainer {
|
||||
|
||||
/**
|
||||
* Provider for app settings
|
||||
*
|
||||
*/
|
||||
@Injectable()
|
||||
export class SettingsProvider {
|
||||
@@ -161,7 +160,7 @@ export class SettingsProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param storage TODO
|
||||
* @param configProvider TODO
|
||||
* @param geoLocation TODO
|
||||
@@ -340,7 +339,7 @@ export class SettingsProvider {
|
||||
*
|
||||
* @throws Exception if setting is not provided
|
||||
*/
|
||||
public async getValue(category: string, name: string): Promise<any> {
|
||||
public async getValue(category: string, name: string): Promise<unknown> {
|
||||
await this.init();
|
||||
if (this.settingExists(category, name)) {
|
||||
// return a copy of the settings value
|
||||
@@ -396,7 +395,7 @@ export class SettingsProvider {
|
||||
const savedSettingsValues: SettingValuesContainer =
|
||||
await this.storage.get<SettingValuesContainer>(STORAGE_KEY_SETTING_VALUES);
|
||||
const cacheSettingsValues = this.getSettingValuesFromCache();
|
||||
const mergedSettingValues = deepMerge(savedSettingsValues, cacheSettingsValues);
|
||||
const mergedSettingValues = deepmerge(savedSettingsValues, cacheSettingsValues);
|
||||
await this.storage
|
||||
.put<SettingValuesContainer>(STORAGE_KEY_SETTING_VALUES, mergedSettingValues);
|
||||
} else {
|
||||
@@ -416,7 +415,7 @@ export class SettingsProvider {
|
||||
* Sets a valid value of a setting and persists changes in storage
|
||||
* @param category Category key name
|
||||
* @param name Setting key name
|
||||
* @param value Value to be set
|
||||
* @param value Value to be set
|
||||
*
|
||||
* @throws Exception if setting is not provided or value not valid to the settings inputType
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user