• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
16import Ability from '@ohos.app.ability.UIAbility';
17import AcCtrl from '@ohos.abilityAccessCtrl';
18import {Core} from 'deccjsunit/index';
19
20let AcManager = AcCtrl.createAtManager()
21export default class MainAbility extends Ability {
22    onCreate(want, launchParam) {
23        console.info('AceApplication onCreate');
24        const core = Core.getInstance()
25        core.init()
26        const configService = core.getDefaultService('config')
27        configService.setConfig(this)
28
29        console.info('Calc[IndexPage] grantPermission')
30        AcManager.requestPermissionsFromUser(this.context, ['ohos.permission.DISTRIBUTED_DATASYNC'], function (result) {
31            console.info('Calc[IndexPage] grantPermission,requestPermissionsFromUser')
32        })
33    }
34
35    onDestroy() {
36        console.info("onDestroy")
37    }
38
39    onWindowStageCreate(windowStage) {
40        // Main window is created, set main page for this ability
41        console.info("onWindowStageCreate")
42
43        windowStage.setUIContent(this.context, "pages/index", null)
44    }
45
46    onWindowStageDestroy() {
47        // Main window is destroyed, release UI related resources
48        console.info("onWindowStageDestroy")
49    }
50
51    onForeground() {
52        // Ability has brought to foreground
53        console.info("onForeground")
54    }
55
56    onBackground() {
57        // Ability has back to background
58        console.info("onBackground")
59    }
60
61};
62