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 */ 15 16import { SettingsModel } from '@ohos/common'; 17import { BaseModulePreLoader } from '@ohos/common'; 18import { layoutConfigManager } from '@ohos/common'; 19import { PageDesktopModeConfig } from '@ohos/common'; 20import RecentModePadConfig from './layoutconfig/RecentModePadConfig'; 21import RecentModeFeatureConfig from './layoutconfig/RecentModeFeatureConfig'; 22 23/** 24 * Common layer initialization loader. 25 */ 26class RecentMissionsPreLoader extends BaseModulePreLoader { 27 private mSettingsModel: SettingsModel | undefined = undefined; 28 29 /** 30 * Add configuration objects to layout configuration management class. 31 */ 32 protected loadConfig(): void { 33 layoutConfigManager.addConfigToManager(PageDesktopModeConfig.getInstance()); 34 this.mSettingsModel = SettingsModel.getInstance(); 35 if (this.mSettingsModel.getDevice() === 'phone') { 36 layoutConfigManager.addConfigToManager(RecentModeFeatureConfig.getInstance()); 37 } else { 38 layoutConfigManager.addConfigToManager(RecentModePadConfig.getInstance()); 39 } 40 } 41 42 /** 43 * Initialize load data. 44 */ 45 protected loadData(): void { 46 } 47 48 /** 49 * Release module config and data. 50 */ 51 releaseConfigAndData(): void { 52 } 53} 54 55const recentMissionsPreLoader = new RecentMissionsPreLoader(); 56export default recentMissionsPreLoader; 57