mirror of
https://gitee.com/openharmony/security_privacy_center
synced 2024-11-27 01:40:23 +00:00
规范代码
This commit is contained in:
parent
876c6d17ef
commit
b70f79485c
@ -1,6 +1,21 @@
|
||||
/**
|
||||
* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
"app": {
|
||||
"bundleName": "com.ohos.security_privacy_center",
|
||||
"bundleName": "com.ohos.certmanager",
|
||||
"vendor": "example",
|
||||
"versionCode": 1000000,
|
||||
"versionName": "1.0.0",
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@ohos/hiview",
|
||||
"description": "Hiview is the module of OpenHarmony that provides toolkits for device maintenance across different platforms.",
|
||||
"version": "3.1",
|
||||
"version": "3.0",
|
||||
"license": "Apache License 2.0",
|
||||
"publishAs": "code-segment",
|
||||
"segment": {
|
||||
|
@ -1,3 +1,18 @@
|
||||
/**
|
||||
* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
"apiType": "stageMode",
|
||||
"buildOption": {
|
||||
|
@ -39,8 +39,8 @@ export abstract class BaseViewModel<M extends BaseModel, S extends BaseState> {
|
||||
return this._viewState;
|
||||
}
|
||||
|
||||
public async processIntent(intent: BaseIntent): Promise<ProcessResult> {
|
||||
Logger.info(TAG, 'start processIntent: ' + intent.getIntentTag());
|
||||
public async processIntent(intents: BaseIntent): Promise<ProcessResult> {
|
||||
Logger.info(TAG, 'start processIntent: ' + intents.getIntentTag());
|
||||
if (this._model === null || this._model === undefined) {
|
||||
this._model = this.initModel();
|
||||
}
|
||||
@ -49,9 +49,9 @@ export abstract class BaseViewModel<M extends BaseModel, S extends BaseState> {
|
||||
}
|
||||
if (this._model !== null && this._viewState !== null) {
|
||||
try {
|
||||
return await this.processIntentWithModel(intent, this._model, this._viewState);
|
||||
return await this.processIntentWithModel(intents, this._model, this._viewState);
|
||||
} catch (err) {
|
||||
Logger.error(TAG, 'error when process intent.' + intent.getIntentTag());
|
||||
Logger.error(TAG, 'error when process intents.' + intents.getIntentTag());
|
||||
}
|
||||
}
|
||||
return ProcessResult.FAIL;
|
||||
@ -61,5 +61,5 @@ export abstract class BaseViewModel<M extends BaseModel, S extends BaseState> {
|
||||
|
||||
protected abstract initViewState(): S;
|
||||
|
||||
protected abstract processIntentWithModel(intent: BaseIntent, model: M, viewState: S): Promise<ProcessResult>;
|
||||
protected abstract processIntentWithModel(intents: BaseIntent, model: M, viewState: S): Promise<ProcessResult>;
|
||||
}
|
@ -13,10 +13,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 接入应用metadata配置的security_privacy.json文件对应属性,详细内容可查询
|
||||
* https://wiki.huawei.com/domains/2308/wiki/9312/WIKI202308301913971
|
||||
*/
|
||||
export interface MenuConfig {
|
||||
businessId: string,
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
export default interface MenuInfo {
|
||||
businessId: string;
|
||||
intent: string;
|
||||
intents: string;
|
||||
|
||||
// 用户id
|
||||
userId: number;
|
||||
|
@ -29,7 +29,7 @@ export default class DataShareConstants {
|
||||
*/
|
||||
public static readonly ACCESS_TABLE: AccessTableTypedef = {
|
||||
tableName: 'functionAccessTable',
|
||||
sqlCreate: `CREATE TABLE IF NOT EXISTS functionAccessTable(intent TEXT PRIMARY KEY,
|
||||
sqlCreate: `CREATE TABLE IF NOT EXISTS functionAccessTable(intents TEXT PRIMARY KEY,
|
||||
userId INTEGER,
|
||||
iconBackgroundColorResource TEXT,
|
||||
priority INTEGER,
|
||||
@ -44,7 +44,7 @@ export default class DataShareConstants {
|
||||
dstBundleName TEXT,
|
||||
bundleName TEXT
|
||||
)`,
|
||||
columns: ['intent', 'userId', 'iconBackgroundColorResource',
|
||||
columns: ['intents', 'userId', 'iconBackgroundColorResource',
|
||||
'priority', 'isSupport', 'isClickable', 'displayedMode', 'iconResource',
|
||||
'mainTitleResource', 'subTitleResource', 'showControlAbility',
|
||||
'dstAbilityMode', 'dstAbilityName', 'dstBundleName', 'bundleName'
|
||||
@ -57,7 +57,7 @@ export default class DataShareConstants {
|
||||
tableName: 'auto_menu_table',
|
||||
sqlCreate: `CREATE TABLE IF NOT EXISTS auto_menu_table(
|
||||
businessId TEXT PRIMARY KEY,
|
||||
intent TEXT,
|
||||
intents TEXT,
|
||||
userId INTEGER,
|
||||
iconBackgroundColorResource TEXT,
|
||||
priority INTEGER,
|
||||
@ -73,7 +73,7 @@ export default class DataShareConstants {
|
||||
dstBundleName TEXT,
|
||||
bundleName TEXT
|
||||
)`,
|
||||
columns: ['businessId', 'intent', 'userId', 'iconBackgroundColorResource',
|
||||
columns: ['businessId', 'intents', 'userId', 'iconBackgroundColorResource',
|
||||
'priority', 'isSupport', 'isClickable', 'displayedMode', 'iconResource',
|
||||
'mainTitleResource', 'subTitleResource', 'showControlAbilityUri',
|
||||
'dstAbilityMode', 'dstAbilityName', 'dstBundleName', 'bundleName'
|
||||
|
@ -59,7 +59,7 @@ export class AutoMenuModel extends BaseModel {
|
||||
const subTitleResource: string = resultSet.getString(resultSet.getColumnIndex('subTitleResource'));
|
||||
const templeData: MenuInfo = {
|
||||
businessId: resultSet.getString(resultSet.getColumnIndex('businessId')),
|
||||
intent: resultSet.getString(resultSet.getColumnIndex('intent')),
|
||||
intents: resultSet.getString(resultSet.getColumnIndex('intents')),
|
||||
userId: resultSet.getDouble(resultSet.getColumnIndex('userId')),
|
||||
iconBackgroundColorResource: resultSet.getString(resultSet.getColumnIndex('iconBackgroundColorResource')),
|
||||
priority: resultSet.getDouble(resultSet.getColumnIndex('priority')),
|
||||
@ -164,7 +164,7 @@ export class AutoMenuModel extends BaseModel {
|
||||
const menuConfig: MenuConfig = menuConfigList[i];
|
||||
let menuInfo: MenuInfo = {
|
||||
businessId: menuConfig.businessId,
|
||||
intent: menuConfig.dstBundleName + '-' + menuConfig.dstAbilityName,
|
||||
intents: menuConfig.dstBundleName + '-' + menuConfig.dstAbilityName,
|
||||
userId: userId,
|
||||
iconBackgroundColorResource: '',
|
||||
isClickable: 1,
|
||||
@ -213,8 +213,8 @@ export class AutoMenuModel extends BaseModel {
|
||||
|
||||
private _generateBucket(menuInfo: MenuInfo): relationalStore.ValuesBucket {
|
||||
let obj: relationalStore.ValuesBucket = {};
|
||||
obj.businessId = menuInfo.intent;
|
||||
obj.intent = menuInfo.intent;
|
||||
obj.businessId = menuInfo.intents;
|
||||
obj.intents = menuInfo.intents;
|
||||
obj.userId = menuInfo.userId;
|
||||
obj.iconBackgroundColorResource = menuInfo.iconBackgroundColorResource;
|
||||
obj.priority = menuInfo.priority;
|
||||
|
@ -35,17 +35,17 @@ export class AutoMenuViewModel extends BaseViewModel<AutoMenuModel, AutoMenuView
|
||||
return new AutoMenuViewState();
|
||||
}
|
||||
|
||||
protected async processIntentWithModel(intent: BaseIntent, model: AutoMenuModel, viewStat: AutoMenuViewState): Promise<ProcessResult> {
|
||||
Logger.info(TAG, 'start processIntentWithModel: ' + intent.getIntentTag());
|
||||
if (intent instanceof AutoMenuInitIntent) {
|
||||
let menuInfoList: MenuInfo[] = await model.getMenuInfoListFromRdb(intent.context);
|
||||
protected async processIntentWithModel(intents: BaseIntent, model: AutoMenuModel, viewStat: AutoMenuViewState): Promise<ProcessResult> {
|
||||
Logger.info(TAG, 'start processIntentWithModel: ' + intents.getIntentTag());
|
||||
if (intents instanceof AutoMenuInitIntent) {
|
||||
let menuInfoList: MenuInfo[] = await model.getMenuInfoListFromRdb(intents.context);
|
||||
viewStat.listMenuList = menuInfoList.filter((item) => {
|
||||
return (DISPLAY_MODEL_LIST === item.displayedMode || DISPLAY_MODEL_CARD === item.displayedMode)
|
||||
})
|
||||
return ProcessResult.SUCCESS;
|
||||
}
|
||||
if (intent instanceof AutoMenuRefreshIntent) {
|
||||
let menuInfoList: MenuInfo[] = await model.getMenuInfoListFromBms(intent.context);
|
||||
if (intents instanceof AutoMenuRefreshIntent) {
|
||||
let menuInfoList: MenuInfo[] = await model.getMenuInfoListFromBms(intents.context);
|
||||
viewStat.listMenuList = menuInfoList.filter((item) => {
|
||||
return (DISPLAY_MODEL_LIST === item.displayedMode || DISPLAY_MODEL_CARD === item.displayedMode)
|
||||
})
|
||||
@ -53,11 +53,11 @@ export class AutoMenuViewModel extends BaseViewModel<AutoMenuModel, AutoMenuView
|
||||
Logger.info(TAG, 'viewState: ' + JSON.stringify(viewStat));
|
||||
return ProcessResult.SUCCESS;
|
||||
}
|
||||
if (intent instanceof AutoMenuClickIntent) {
|
||||
model.handleMenuClick(intent.menuInfo);
|
||||
if (intents instanceof AutoMenuClickIntent) {
|
||||
model.handleMenuClick(intents.menuInfo);
|
||||
return ProcessResult.SUCCESS;
|
||||
}
|
||||
Logger.error(TAG, 'undefined intent: ' + intent.getIntentTag());
|
||||
Logger.error(TAG, 'undefined intent: ' + intents.getIntentTag());
|
||||
return ProcessResult.FAIL;
|
||||
}
|
||||
}
|
@ -52,10 +52,8 @@ export default function LocationServiceTest() {
|
||||
expect(0).assertEqual(0)
|
||||
})
|
||||
it('LocationServiceTest_registerListener', 0, () => {
|
||||
let listener: ListenerBean = {
|
||||
'updateServiceState': () => {
|
||||
}
|
||||
}
|
||||
let listener: ListenerBean = new ListenerBean(() => {
|
||||
})
|
||||
LocationService.registerListener(listener)
|
||||
expect(0).assertEqual(0)
|
||||
})
|
||||
|
@ -74,7 +74,7 @@ export default function BundleInfoBeanTest() {
|
||||
.getAppContext(), $r('app.media.ic_back'))
|
||||
ResourceUtil.getBundleResourceManager('', abilityDelegatorRegistry.getAbilityDelegator().getAppContext())
|
||||
expect(ResourceUtil.getBundleResourceManager('', null)).assertNull()
|
||||
ResourceUtil.getBundleResourceManager('com.huawei.hmos.security.privacycenter', abilityDelegatorRegistry.getAbilityDelegator()
|
||||
ResourceUtil.getBundleResourceManager('com.example.test', abilityDelegatorRegistry.getAbilityDelegator()
|
||||
.getAppContext())
|
||||
})
|
||||
it('StringUtilTest', 0, () => {
|
||||
|
@ -1,3 +1,18 @@
|
||||
/**
|
||||
* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
"module": {
|
||||
"name": "entry_test",
|
||||
|
@ -1,3 +1,18 @@
|
||||
/**
|
||||
* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
"hvigorVersion": "3.0.9",
|
||||
"dependencies": {
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,3 +1,18 @@
|
||||
/**
|
||||
* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { appTasks } from '@ohos/hvigor-ohos-plugin';
|
||||
|
||||
export default {
|
||||
|
16
hvigorw
16
hvigorw
@ -1,3 +1,19 @@
|
||||
# Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
|
15
hvigorw.bat
15
hvigorw.bat
@ -1,3 +1,18 @@
|
||||
/**
|
||||
* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
|
Loading…
Reference in New Issue
Block a user