1/** 2 * Copyright (c) 2021-2022 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 */ 15import { CommonConstants } from '@ohos/common'; 16import { RecentsModeConfig } from '@ohos/common'; 17 18/** 19 * Recent missions layout mode configuration. 20 */ 21export default class RecentModeFeatureConfig extends RecentsModeConfig { 22 23 protected constructor() { 24 super(); 25 } 26 27 /** 28 * The json string corresponding to the current configuration. 29 */ 30 protected getPersistConfigJson(): string { 31 const persistConfig = JSON.parse(super.getPersistConfigJson()); 32 return JSON.stringify(persistConfig); 33 } 34 35 /** 36 * Get recent mode configuration instance. 37 * 38 * @return {object} RecentModeFeatureConfig singleton 39 */ 40 static getInstance(): RecentModeFeatureConfig { 41 if (globalThis.RecentModeFeatureConfigInstance == null) { 42 globalThis.RecentModeFeatureConfigInstance = new RecentModeFeatureConfig(); 43 globalThis.RecentModeFeatureConfigInstance.initConfig(); 44 } 45 return globalThis.RecentModeFeatureConfigInstance; 46 } 47 48 /** 49 * Init recent mode configuration. 50 */ 51 initConfig(): void { 52 super.initConfig(); 53 } 54 55 /** 56 * Get recent mode configuration level. 57 * 58 * @return {string} feature-level layout configuration 59 */ 60 getConfigLevel(): string { 61 return CommonConstants.LAYOUT_CONFIG_LEVEL_FEATURE; 62 } 63}