1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OHOS_APPLICATION_CONFIGURATION_MANAGER_H
17 #define OHOS_APPLICATION_CONFIGURATION_MANAGER_H
18 
19 #include <cstdint>
20 #include <string>
21 #include <vector>
22 
23 namespace OHOS {
24 namespace AbilityRuntime {
25 enum class SetLevel : uint8_t {
26     // system level, only color mode have SA level
27     System,
28     SA,
29     // application level
30     Application,
31     SetLevelCount,
32 };
33 
34 class ApplicationConfigurationManager {
35     ApplicationConfigurationManager() = default;
36     ~ApplicationConfigurationManager() = default;
37 public:
38     static ApplicationConfigurationManager& GetInstance();
39     void SetLanguageSetLevel(SetLevel languageSetLevel);
40     void SetfontSetLevel(SetLevel fontSetLevel);
41     SetLevel GetLanguageSetLevel() const;
42     SetLevel GetFontSetLevel() const;
43     std::string SetColorModeSetLevel(SetLevel colorModeSetLevel, const std::string &value);
44     SetLevel GetColorModeSetLevel() const;
45     bool ColorModeHasSetByApplication() const;
46 
47 private:
48     SetLevel languageSetLevel_ = SetLevel::System;
49     SetLevel colorModeSetLevel_ = SetLevel::System;
50     SetLevel fontSetLevel_ = SetLevel::System;
51     std::vector<std::string> colorModeVal_ = std::vector<std::string>(static_cast<uint8_t>(SetLevel::SetLevelCount));
52 };
53 } // namespace AbilityRuntime
54 } // namespace OHOS
55 #endif