1/**
2 * Copyright (c) 2023-2023 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 IncrementDataSource from './IncrementDataSource';
17import FormConstants from '../common/constants/FormConstants';
18
19const TAG = 'AppInstallDataSource';
20
21/**
22 * 推荐卡片资源池数据源:最新安装的应用中包含的卡片
23 */
24export default class AppInstallDataSource extends IncrementDataSource {
25  /**
26   * getInstance
27   *
28   * @return Instance
29   */
30  static getInstance(): AppInstallDataSource {
31    if (globalThis.AppInstallDataSource == null) {
32      globalThis.AppInstallDataSource = new AppInstallDataSource();
33    }
34    return globalThis.AppInstallDataSource;
35  }
36
37  /**
38   * 获取卡片资源池数据源名
39   *
40   * @return 卡片资源池数据源名
41   */
42  public getName(): string {
43    return FormConstants.FORM_DATA_SOURCE_POOL_NAME_APP_INSTALL;
44  }
45
46  /**
47   * 获取卡片资源池阈值
48   *
49   * @return 卡片资源池阈值
50   */
51  public getThreshold(): number {
52    return FormConstants.SERVICE_FORM_POOL_NEW_INSTALL_APP_THRESHOLD;
53  }
54
55  /**
56   * 获取卡片资源池缓存名
57   *
58   * @return 卡片资源池缓存名
59   */
60  public getCacheKey(): string {
61    return 'cache_new_install_ability_form';
62  }
63}
64