update api9

Signed-off-by: zhuchengfeng <940848916@qq.com>
This commit is contained in:
zhuchengfeng 2022-04-24 10:09:18 +08:00
parent e4ff5dbf8a
commit 4130b6360a
198 changed files with 3124 additions and 1552 deletions

15
.gitattributes vendored
View File

@ -1,15 +0,0 @@
*.tgz filter=lfs diff=lfs merge=lfs -text
*.trp filter=lfs diff=lfs merge=lfs -text
*.apk filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.mp4 filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.asm filter=lfs diff=lfs merge=lfs -text
*.8svn filter=lfs diff=lfs merge=lfs -text
*.9svn filter=lfs diff=lfs merge=lfs -text
*.dylib filter=lfs diff=lfs merge=lfs -text
*.exe filter=lfs diff=lfs merge=lfs -text
*.a filter=lfs diff=lfs merge=lfs -text
*.so filter=lfs diff=lfs merge=lfs -text
*.bin filter=lfs diff=lfs merge=lfs -text
*.dll filter=lfs diff=lfs merge=lfs -text

17
.gitignore vendored
View File

@ -1,14 +1,5 @@
/product/phone/build
/product/pc/build
/common/build
/build/
/features/batterycomponent/build/
/features/datetimecomponent/build/
/features/shortcutcomponent/build/
/features/wallpapercomponent/build/
/features/noticeitem/build/
/features/screenlock/build/
/node_modules
/local.properties
/.idea
/.gradle
local.properties
tsconfig.json
**/build
/features/**/build

15
AppScope/app.json5 Normal file
View File

@ -0,0 +1,15 @@
{
"app": {
"bundleName": "com.ohos.screenlock",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"singleton": true,
"keepAlive":true,
"minAPIVersion": 9,
"targetAPIVersion": 9
}
}

View File

@ -0,0 +1,8 @@
{
"string": [
{
"name": "app_name",
"value": "ScreenLock"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

90
build-profile.json5 Normal file
View File

@ -0,0 +1,90 @@
{
"app": {
"compileSdkVersion": 9,
"compatibleSdkVersion": 9,
"products": [
{
"name": "default",
"signingConfig": "default",
}
]
},
"modules": [
{
"name": "entry",
"srcPath": "./entry",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
},
{
"name": "pc",
"srcPath": "./product/pc",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
},
{
"name": "phone",
"srcPath": "./product/phone",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
},
{
"name": "batterycomponent",
"srcPath": "./features/batterycomponent"
},
{
"name": "clockcomponent",
"srcPath": "./features/clockcomponent"
},
{
"name": "datetimecomponent",
"srcPath": "./features/datetimecomponent"
},
{
"name": "noticeitem",
"srcPath": "./features/noticeitem"
},
{
"name": "screenlock",
"srcPath": "./features/screenlock"
},
{
"name": "shortcutcomponent",
"srcPath": "./features/shortcutcomponent"
},
{
"name": "signalcomponent",
"srcPath": "./features/signalcomponent"
},
{
"name": "wallpapercomponent",
"srcPath": "./features/wallpapercomponent"
},
{
"name": "wificomponent",
"srcPath": "./features/wificomponent"
},
{
"name": "common",
"srcPath": "./common"
}
]
}

View File

@ -1,40 +0,0 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply plugin: 'com.huawei.ohos.app'
apply from: "./infra/config_exts.gradle"
ohos {
compileSdkVersion rootProject.ext.version.compileSdk
defaultConfig {
compatibleSdkVersion rootProject.ext.version.compatibleSdk
}
supportSystem "standard"
}
buildscript {
repositories {
maven {
url 'https://mirrors.huaweicloud.com/repository/maven/'
}
maven {
url 'https://developer.huawei.com/repo/'
}
maven {
url 'http://repo.ark.tools.huawei.com/artifactory/maven-public/'
allowInsecureProtocol = true
}
}
dependencies {
classpath 'com.huawei.ohos:hap:3.0.5.2'
}
}
allprojects {
repositories {
maven {
url 'https://mirrors.huaweicloud.com/repository/maven/'
}
maven {
url 'https://developer.huawei.com/repo/'
}
}
}

3
common/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/node_modules
/.preview
/build

View File

@ -0,0 +1,5 @@
{
"apiType": "stageMode",
"buildOption": {
}
}

View File

@ -1,21 +0,0 @@
apply plugin: 'com.huawei.ohos.library'
//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510
ohos {
compileSdkVersion rootProject.ext.version.compileSdk
defaultConfig {
compatibleSdkVersion rootProject.ext.version.compatibleSdk
}
buildTypes {
release {
proguardOpt {
proguardEnabled false
rulesFiles 'proguard-rules.pro'
}
}
}
entryModules "phone"
}
dependencies {
}

3
common/hvigorfile.js Normal file
View File

@ -0,0 +1,3 @@
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
module.exports = require('@ohos/hvigor-ohos-plugin').harTasks

1
common/index.ets Normal file
View File

@ -0,0 +1 @@
export { MainPage } from './src/main/ets/components/MainPage/MainPage'

5
common/package-lock.json generated Normal file
View File

@ -0,0 +1,5 @@
{
"name": "@ohos/common",
"version": "1.0.0",
"lockfileVersion": 1
}

14
common/package.json Normal file
View File

@ -0,0 +1,14 @@
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/common",
"description": "a npm package which contains arkUI2.0 page",
"ohos": {
"org": ""
},
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -1,24 +0,0 @@
{
"app": {
"bundleName": "com.ohos.screenlock",
"vendor": "ohos",
"version": {
"code": 1000000,
"name": "1.0.0"
}
},
"deviceConfig": {
},
"module": {
"package": "com.ohos.screenlock.common",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "common",
"moduleType": "har"
},
"srcPath": "default"
}
}

View File

@ -0,0 +1,17 @@
@Entry
@Component
export struct MainPage {
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}

View File

@ -80,31 +80,31 @@ class TimeManager {
Log.showInfo(TAG, "initTimeFormat");
this.mSettingsHelper = featureAbility.acquireDataAbilityHelper(context, URI_VAR);
const handleTimeFormatChange = () => {
if (!this.mSettingsHelper) {
Log.showError(TAG, `Can't get dataAbility helper.`);
return;
}
let timeString = settings.getValueSync(this.mSettingsHelper, TIME_FORMAT_KEY, "24");
Log.showDebug(TAG, `timeFormat change: ${timeString}`);
this.mUse24hFormat = timeString == "24";
this.notifyTimeChange();
};
try {
this.mSettingsHelper.on("dataChange", settings.getUriSync(TIME_FORMAT_KEY), (err) => {
if (err.code !== 0) {
Log.showError(TAG, `failed to getAbilityWant, code: ${err.code}.`);
return;
}
handleTimeFormatChange();
});
} catch (e) {
Log.showError(TAG, `Can't listen timeformate change.`);
}
handleTimeFormatChange();
this.handleTimeFormatChange();
}
private handleTimeFormatChange() {
Log.showInfo(TAG, "handleTimeFormatChange")
if (!this.mSettingsHelper) {
Log.showError(TAG, `Can't get dataAbility helper.`);
return;
}
let timeString = settings.getValueSync(this.mSettingsHelper, TIME_FORMAT_KEY, "24");
Log.showDebug(TAG, `timeFormat change: ${timeString}`);
this.mUse24hFormat = timeString == "24";
this.notifyTimeChange();
};
private notifyTimeChange() {
Log.showInfo(TAG, "notifyTimeChange");
let args: TimeEventArgs = {

View File

@ -0,0 +1,11 @@
{
"module": {
"name": "common",
"type": "har",
"deviceTypes": [
"phone",
"tablet"
],
"uiSyntax": "ets"
}
}

3
entry/.gitignore vendored
View File

@ -1,2 +1,3 @@
/build
/node_modules
/.preview
/build

13
entry/build-profile.json5 Normal file
View File

@ -0,0 +1,13 @@
{
"apiType": 'stageMode',
"buildOption": {
},
"targets": [
{
"name": "default",
},
{
"name": "ohosTest",
}
]
}

View File

@ -1,22 +0,0 @@
apply plugin: 'com.huawei.ohos.hap'
//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510
ohos {
compileSdkVersion rootProject.ext.version.compileSdk
defaultConfig {
compatibleSdkVersion rootProject.ext.version.compatibleSdk
}
buildTypes {
release {
proguardOpt {
proguardEnabled false
rulesFiles 'proguard-rules.pro'
}
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
}

2
entry/hvigorfile.js Normal file
View File

@ -0,0 +1,2 @@
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
module.exports = require('@ohos/hvigor-ohos-plugin').hapTasks

5
entry/package-lock.json generated Normal file
View File

@ -0,0 +1,5 @@
{
"name": "entry",
"version": "1.0.0",
"lockfileVersion": 1
}

14
entry/package.json Normal file
View File

@ -0,0 +1,14 @@
{
"license": "ISC",
"devDependencies": {},
"name": "entry",
"ohos": {
"org": "huawei",
"directoryLevel": "module",
"buildTool": "hvigor"
},
"description": "example description",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -1 +0,0 @@
# config module specific ProGuard rules here.

View File

@ -1,64 +0,0 @@
{
"app": {
"bundleName": "com.ohos.screenlock",
"vendor": "ohos",
"version": {
"code": 1000000,
"name": "1.0.0"
}
},
"deviceConfig": {},
"module": {
"package": "com.ohos.screenlock",
"name": ".MyApplication",
"deviceType": [
"phone","tablet"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"visible": true,
"name": "com.ohos.screenlock.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard",
"srcPath": "MainAbility",
"srcLanguage": "ets"
}
],
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": "MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"srcPath": "MainAbility"
}
}

View File

@ -1,25 +0,0 @@
/*
* Copyright (c) 2022 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 AbilityStage from "@ohos.application.AbilityStage"
import Log from '../../../../common/src/main/ets/default/Log'
const TAG = "MainAbilityStage"
export default class MainAbilityStage extends AbilityStage {
onCreate() {
Log.showInfo(TAG, "onCreate")
}
}

View File

@ -0,0 +1,7 @@
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}

View File

@ -1,43 +1,34 @@
/*
* Copyright (c) 2022 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 Ability from "@ohos.application.Ability"
import Ability from '@ohos.application.Ability'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.info('API8 A onCreate')
}
onWindowStageCreate(windowStage) {
console.info('API8 A onWindowStageCreate')
windowStage.setUIContent(this.content, "pages/index", null)
}
onForeground() {
console.info('API8 A onForeground')
}
onBackground() {
console.info('API8 A onBackground')
}
onWindowStageDestroy() {
console.info('API8 A onWindowStageDestroy')
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
}
onDestroy() {
console.info('API8 A onDestroy')
console.log("[Demo] MainAbility onDestroy")
}
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};

View File

@ -1,23 +0,0 @@
/*
* Copyright (c) 2022 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.
*/
export default {
onCreate() {
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
}

View File

@ -1,28 +0,0 @@
/*
* Copyright (c) 2022 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.
*/
@Entry
@Component
struct Index {
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('Hello World API8 A')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,17 @@
@Entry
@Component
struct Index {
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}

View File

@ -0,0 +1,37 @@
{
"module": {
"name": "entry",
"type": "entry",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:entry_desc",
"mainElement": "MainAbility",
"deviceTypes": [
"phone",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"uiSyntax": "ets",
"abilities": [
{
"name": "MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
]
}
}

View File

@ -1,12 +1,16 @@
{
"string": [
{
"name": "entry_MainAbility",
"value": "entry_MainAbility"
"name": "entry_desc",
"value": "description"
},
{
"name": "mainability_description",
"value": "eTS_Empty Ability"
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
}
]
}

View File

@ -0,0 +1,5 @@
{
"src": [
"pages/index"
]
}

View File

@ -1 +1,3 @@
/build
/node_modules
/.preview
/build

View File

@ -0,0 +1,5 @@
{
"apiType": "stageMode",
"buildOption": {
}
}

View File

@ -1,19 +0,0 @@
apply plugin: 'com.huawei.ohos.library'
ohos {
compileSdkVersion rootProject.ext.version.compileSdk
defaultConfig {
compatibleSdkVersion rootProject.ext.version.compatibleSdk
}
buildTypes {
release {
proguardOpt {
proguardEnabled false
rulesFiles 'proguard-rules.pro'
}
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
}

View File

@ -0,0 +1,3 @@
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
module.exports = require('@ohos/hvigor-ohos-plugin').harTasks

View File

@ -0,0 +1 @@
export { MainPage } from './src/main/ets/components/MainPage/MainPage'

View File

@ -0,0 +1,5 @@
{
"name": "@ohos/batterycomponent",
"version": "1.0.0",
"lockfileVersion": 1
}

View File

@ -0,0 +1,14 @@
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/batterycomponent",
"description": "a npm package which contains arkUI2.0 page",
"ohos": {
"org": ""
},
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -1,23 +0,0 @@
{
"app": {
"bundleName": "com.ohos.systemui",
"vendor": "ohos",
"version": {
"code": 1000000,
"name": "1.0.0"
}
},
"deviceConfig": {},
"module": {
"package": "com.ohos.systemui.batterycomponent",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "batterycomponent",
"moduleType": "har"
},
"srcPath": "default"
}
}

View File

@ -0,0 +1,17 @@
@Entry
@Component
export struct MainPage {
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}

View File

@ -1,23 +0,0 @@
/*
* Copyright (c) 2021 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.
*/
export default {
onCreate() {
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
}

View File

@ -0,0 +1,11 @@
{
"module": {
"name": "batterycomponent",
"type": "har",
"deviceTypes": [
"phone",
"tablet"
],
"uiSyntax": "ets"
}
}

View File

@ -1 +1,3 @@
build
/node_modules
/.preview
/build

View File

@ -0,0 +1,5 @@
{
"apiType": "stageMode",
"buildOption": {
}
}

View File

@ -1,19 +0,0 @@
apply plugin: 'com.huawei.ohos.library'
ohos {
compileSdkVersion rootProject.ext.version.compileSdk
defaultConfig {
compatibleSdkVersion rootProject.ext.version.compatibleSdk
}
buildTypes {
release {
proguardOpt {
proguardEnabled false
rulesFiles 'proguard-rules.pro'
}
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
}

View File

@ -0,0 +1,3 @@
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
module.exports = require('@ohos/hvigor-ohos-plugin').harTasks

View File

@ -0,0 +1 @@
export { MainPage } from './src/main/ets/components/MainPage/MainPage'

View File

@ -0,0 +1,5 @@
{
"name": "@ohos/clockcomponent",
"version": "1.0.0",
"lockfileVersion": 1
}

View File

@ -0,0 +1,14 @@
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/clockcomponent",
"description": "a npm package which contains arkUI2.0 page",
"ohos": {
"org": ""
},
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -1,23 +0,0 @@
{
"app": {
"bundleName": "com.ohos.systemui",
"vendor": "ohos",
"version": {
"code": 1000000,
"name": "1.0.0"
}
},
"deviceConfig": {},
"module": {
"package": "com.ohos.systemui.clockcomponent",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "clockcomponent",
"moduleType": "har"
},
"srcPath": "default"
}
}

View File

@ -0,0 +1,17 @@
@Entry
@Component
export struct MainPage {
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}

View File

@ -14,7 +14,7 @@
*/
import Log from '../../../../../../../common/src/main/ets/default/Log'
import StyleConfiguration from '../common/StyleConfiguration'
import StyleConfiguration from '../common/styleconfiguration'
import StyleConfigurationCommon from '../../../../../../../common/src/main/ets/default/StyleConfiguration'
import {StatusBarGroupComponentData} from '../../../../../../screenlock/src/main/ets/com/ohos/common/Constants'
import StatusBarVM from '../../../../../../screenlock/src/main/ets/com/ohos/vm/StatusBarVM'

View File

@ -0,0 +1,11 @@
{
"module": {
"name": "clockcomponent",
"type": "har",
"deviceTypes": [
"phone",
"tablet"
],
"uiSyntax": "ets"
}
}

3
features/datetimecomponent/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/node_modules
/.preview
/build

View File

@ -0,0 +1,5 @@
{
"apiType": "stageMode",
"buildOption": {
}
}

View File

@ -1,21 +0,0 @@
apply plugin: 'com.huawei.ohos.library'
//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510
ohos {
compileSdkVersion rootProject.ext.version.compileSdk
defaultConfig {
compatibleSdkVersion rootProject.ext.version.compatibleSdk
}
buildTypes {
release {
proguardOpt {
proguardEnabled false
rulesFiles 'proguard-rules.pro'
}
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
implementation project(':common')
}

View File

@ -0,0 +1,3 @@
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
module.exports = require('@ohos/hvigor-ohos-plugin').harTasks

View File

@ -0,0 +1 @@
export { MainPage } from './src/main/ets/components/MainPage/MainPage'

View File

@ -0,0 +1,5 @@
{
"name": "@ohos/datetimecomponent",
"version": "1.0.0",
"lockfileVersion": 1
}

View File

@ -0,0 +1,14 @@
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/datetimecomponent",
"description": "a npm package which contains arkUI2.0 page",
"ohos": {
"org": ""
},
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -1,23 +0,0 @@
{
"app": {
"bundleName": "com.ohos.screenlock",
"vendor": "ohos",
"version": {
"code": 1000000,
"name": "1.0.0"
}
},
"deviceConfig": {},
"module": {
"package": "com.ohos.screenlock.datetimecomponent",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "datetimecomponent",
"moduleType": "har"
},
"srcPath": "default"
}
}

View File

@ -46,17 +46,22 @@ export default class DateTimeViewModel {
ViewModelInit(): void{
Log.showInfo(TAG, 'ViewModelInit');
this.setDateTime.bind(this)()
this.getAndSetDateTime.bind(this)()
commonEvent.createSubscriber(mCommonEventSubscribeInfo, this.createSubscriberCallBack.bind(this));
this.unSubscriber = EventManager.subscribe(TIME_CHANGE_EVENT, (args: TimeEventArgs) => {
this.setDateTime()
this.setDateTime(args.date)
});
Log.showInfo(TAG, 'ViewModelInit end');
}
private setDateTime() {
private getAndSetDateTime() {
Log.showInfo(TAG, `getAndSetDateTime`)
this.setDateTime(new Date())
}
private setDateTime(date: Date) {
Log.showInfo(TAG, `setDateTime`)
this.timeVal = sTimeManager.formatTime(new Date())
this.timeVal = sTimeManager.formatTime(date)
this.dateVal = DateTimeCommon.getSystemDate()
this.weekVal = DateTimeCommon.getSystemWeek()
}
@ -64,7 +69,7 @@ export default class DateTimeViewModel {
private createSubscriberCallBack(err, data) {
Log.showInfo(TAG, "start createSubscriberCallBack " + JSON.stringify(data))
mEventSubscriber = data
commonEvent.subscribe(data, this.setDateTime.bind(this));
commonEvent.subscribe(data, this.getAndSetDateTime.bind(this));
Log.showInfo(TAG, "start createSubscriberCallBack finish")
}

View File

@ -0,0 +1,17 @@
@Entry
@Component
export struct MainPage {
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}

View File

@ -0,0 +1,11 @@
{
"module": {
"name": "datetimecomponent",
"type": "har",
"deviceTypes": [
"phone",
"tablet"
],
"uiSyntax": "ets"
}
}

3
features/noticeitem/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/node_modules
/.preview
/build

View File

@ -0,0 +1,5 @@
{
"apiType": "stageMode",
"buildOption": {
}
}

View File

@ -1,19 +0,0 @@
apply plugin: 'com.huawei.ohos.library'
ohos {
compileSdkVersion rootProject.ext.version.compileSdk
defaultConfig {
compatibleSdkVersion rootProject.ext.version.compatibleSdk
}
buildTypes {
release {
proguardOpt {
proguardEnabled false
rulesFiles 'proguard-rules.pro'
}
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
}

View File

@ -0,0 +1,3 @@
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
module.exports = require('@ohos/hvigor-ohos-plugin').harTasks

View File

@ -0,0 +1 @@
export { MainPage } from './src/main/ets/components/MainPage/MainPage'

5
features/noticeitem/package-lock.json generated Normal file
View File

@ -0,0 +1,5 @@
{
"name": "@ohos/noticeitem",
"version": "1.0.0",
"lockfileVersion": 1
}

View File

@ -0,0 +1,14 @@
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/noticeitem",
"description": "a npm package which contains arkUI2.0 page",
"ohos": {
"org": ""
},
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -1,24 +0,0 @@
{
"app": {
"bundleName": "com.ohos.systemui",
"vendor": "ohos",
"version": {
"code": 1000000,
"name": "1.0.0"
}
},
"deviceConfig": {
},
"module": {
"package": "com.ohos.noticeItem",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "noticeitem",
"moduleType": "har"
},
"srcPath": "default"
}
}

View File

@ -23,7 +23,7 @@ const TAG = 'NoticeItem-Confirm';
*/
@CustomDialog
export default struct ConfirmDialog {
private title: string
private title: string | Resource
private bundleName: string
public controller: CustomDialogController
public action: () => void

View File

@ -0,0 +1,17 @@
@Entry
@Component
export struct MainPage {
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}

View File

@ -0,0 +1,11 @@
{
"module": {
"name": "noticeitem",
"type": "har",
"deviceTypes": [
"phone",
"tablet"
],
"uiSyntax": "ets"
}
}

3
features/screenlock/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/node_modules
/.preview
/build

View File

@ -0,0 +1,5 @@
{
"apiType": "stageMode",
"buildOption": {
}
}

View File

@ -1,26 +0,0 @@
apply plugin: 'com.huawei.ohos.library'
//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510
ohos {
compileSdkVersion rootProject.ext.version.compileSdk
defaultConfig {
compatibleSdkVersion rootProject.ext.version.compatibleSdk
}
buildTypes {
release {
proguardOpt {
proguardEnabled false
rulesFiles 'proguard-rules.pro'
}
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
implementation project(':common')
implementation project(':features:batterycomponent')
implementation project(':features:clockcomponent')
implementation project(':features:wificomponent')
implementation project(':features:signalcomponent')
}

View File

@ -0,0 +1,3 @@
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
module.exports = require('@ohos/hvigor-ohos-plugin').harTasks

View File

@ -0,0 +1 @@
export { MainPage } from './src/main/ets/components/MainPage/MainPage'

5
features/screenlock/package-lock.json generated Normal file
View File

@ -0,0 +1,5 @@
{
"name": "@ohos/screenlock",
"version": "1.0.0",
"lockfileVersion": 1
}

View File

@ -0,0 +1,14 @@
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/screenlock",
"description": "a npm package which contains arkUI2.0 page",
"ohos": {
"org": ""
},
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -1,23 +0,0 @@
{
"app": {
"bundleName": "com.ohos.screenlock",
"vendor": "ohos",
"version": {
"code": 1000000,
"name": "1.0.0"
}
},
"deviceConfig": {},
"module": {
"package": "com.ohos.screenlock",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "screenlock",
"moduleType": "har"
},
"srcPath": "default"
}
}

View File

@ -1,70 +0,0 @@
/*
* Copyright (c) 2021 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.
*/
export default class Constants {
static WIN_NAME = "ScreenLockWindow"
//Shortcut params
static SHORTCUT_CIRCLE_WIDTH = '80px'
static SHORTCUT_CIRCLE_HEIGHT = '80px'
static SHORTCUT_TEXT_SIZE = '24px'
static SHORTCUT_TEXT_WIDTH = '48px'
static SHORTCUT_TEXT_HEIGHT = '34px'
static SHORTCUT_BLOCK_HEIGHT = '10px'
static SHORTCUT_HEIGHT = '150px'
//layout params - Pic
static FULL_CONTAINER_WIDTH = '100%'
static FULL_CONTAINER_HEIGHT = '100%'
static HALF_CONTAINER_WIDTH = '50%'
//The refresh interval
static INTERVAL = 1000
//digitalpssword mask diameter
static DIGITALPSD_IC_DIAMETER = 12
//digitalpssword keybord background diameter
static DIGITALPSD_BUTTON_DIAMETER = 60
//digitalpssword keybord background diameter
static DIGITALPSD_BUTTON_RECT_WH = 100
static DIGITALPSD_BUTTON_RECT_HH = 50
//digital keybord
static CALL_PHONE = -1
static DEL_PWD = -2
static GO_BACK = -3
static NUMKEY_BOARD = [{index: 0, row1: '1', row2: ' ', value: 1, bkg: false},
{index: 1, row1: '2', row2: 'ABC', value: 2, bkg: false},
{index: 2, row1: '3', row2: 'DEF', value: 3, bkg: false},
{index: 3, row1: '4', row2: 'GHI', value: 4, bkg: false},
{index: 4, row1: '5', row2: 'JKL', value: 5, bkg: false},
{index: 5, row1: '6', row2: 'MNO', value: 6, bkg: false},
{index: 6, row1: '7', row2: 'PQRS', value: 7, bkg: false},
{index: 7, row1: '8', row2: 'TUV', value: 8, bkg: false},
{index: 8, row1: '9', row2: 'WXYZ', value: 9, bkg: false},
{index: 9, row1: $r('app.string.emergency_call'), row2: '', value: Constants.CALL_PHONE, bkg: false},
{index: 10,row1: '0', row2: '+', value: 0, bkg: false},
{index: 11,row1: $r('app.string.back'), row2: '', value: Constants.GO_BACK, bkg: false}];
//max password length
static PASSWORD_MAX_LEN = 32
static ACCOUNT_SPACE = 24
}
export class StatusBarGroupComponentData {
backgroundColor: string = "#00000000";
contentColor: string = "#FFFFFFFF";
}

View File

@ -0,0 +1,142 @@
/*
* Copyright (c) 2021 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.
*/
export default class Constants {
static WIN_NAME = "ScreenLockWindow"
//Shortcut params
static SHORTCUT_CIRCLE_WIDTH = '80px'
static SHORTCUT_CIRCLE_HEIGHT = '80px'
static SHORTCUT_TEXT_SIZE = '24px'
static SHORTCUT_TEXT_WIDTH = '48px'
static SHORTCUT_TEXT_HEIGHT = '34px'
static SHORTCUT_BLOCK_HEIGHT = '10px'
static SHORTCUT_HEIGHT = '150px'
//layout params - Pic
static FULL_CONTAINER_WIDTH = '100%'
static FULL_CONTAINER_HEIGHT = '100%'
static HALF_CONTAINER_WIDTH = '50%'
//The refresh interval
static INTERVAL = 1000
//digitalpssword mask diameter
static DIGITALPSD_IC_DIAMETER = 12
//digitalpssword keybord background diameter
static DIGITALPSD_BUTTON_DIAMETER = 60
//digitalpssword keybord background diameter
static DIGITALPSD_BUTTON_RECT_WH = 100
static DIGITALPSD_BUTTON_RECT_HH = 50
//digital keybord
static CALL_PHONE = -1
static DEL_PWD = -2
static GO_BACK = -3
static NUMKEY_BOARD = [{
index: 0,
row1: '1',
row2: ' ',
value: 1,
bkg: false
},
{
index: 1,
row1: '2',
row2: 'ABC',
value: 2,
bkg: false
},
{
index: 2,
row1: '3',
row2: 'DEF',
value: 3,
bkg: false
},
{
index: 3,
row1: '4',
row2: 'GHI',
value: 4,
bkg: false
},
{
index: 4,
row1: '5',
row2: 'JKL',
value: 5,
bkg: false
},
{
index: 5,
row1: '6',
row2: 'MNO',
value: 6,
bkg: false
},
{
index: 6,
row1: '7',
row2: 'PQRS',
value: 7,
bkg: false
},
{
index: 7,
row1: '8',
row2: 'TUV',
value: 8,
bkg: false
},
{
index: 8,
row1: '9',
row2: 'WXYZ',
value: 9,
bkg: false
},
{
index: 9,
row1: $r('app.string.emergency_call'),
row2: '',
value: Constants.CALL_PHONE,
bkg: false
},
{
index: 10,
row1: '0',
row2: '+',
value: 0,
bkg: false
},
{
index: 11,
row1: $r('app.string.back'),
row2: '',
value: Constants.GO_BACK,
bkg: false
}];
//max password length
static PASSWORD_MAX_LEN = 32
static ACCOUNT_SPACE = 24
}
export class StatusBarGroupComponentData {
backgroundColor: string = "#00000000";
contentColor: string = "#FFFFFFFF";
}

View File

@ -21,20 +21,32 @@ import { Callback } from 'basic';
const TAG = 'ScreenLock-ScreenLockModel';
export default class ScreenLockModel {
eventListener(typeName: string, callback:Callback<void>) {
eventListener(typeName: string, callback: Callback<void>) {
Log.showInfo(TAG, `eventListener:typeName ${typeName}`);
ScreenLockMar.on(typeName, (err, data) => {
Log.showInfo(TAG, `eventListener:callback err:${JSON.stringify(err)} data:${JSON.stringify(data)}`);
callback();
})
switch (typeName) {
case "endScreenOn":
case "unlockScreen":
ScreenLockMar.on(typeName, () => {
Log.showInfo(TAG, `eventListener:callback`);
callback();
})
break;
case "beginSleep":
ScreenLockMar.on(typeName, (userId: number) => {
Log.showInfo(TAG, `eventListener:callback userId:${userId}`);
callback();
})
break;
default:
Log.showError(TAG, `eventListener:typeName ${typeName}`)
}
Log.showInfo(TAG, `eventListener:typeName ${typeName} finish`);
}
eventCancelListener(typeName: string) {
Log.showInfo(TAG, `eventCancleListener:typeName ${typeName}`);
ScreenLockMar.off(typeName, (err, data) => {
Log.showInfo(TAG, `eventCancleListener:callback err:${JSON.stringify(err)} data:${JSON.stringify(data)}`);
})
// As off has some problem and there is no case to cancel, do nothing
}
sendScreenLockEvent(typeName: string, typeNo: number, callback) {
@ -45,7 +57,7 @@ export default class ScreenLockModel {
})
}
showScreenLockWindow(callback:Callback<void>) {
showScreenLockWindow(callback: Callback<void>) {
Log.showInfo(TAG, 'showScreenLockWindow');
windowManager.find(Constants.WIN_NAME).then((win) => {
Log.showInfo(TAG, 'find window finish');
@ -56,7 +68,7 @@ export default class ScreenLockModel {
})
}
hiddenScreenLockWindow(callback:Callback<void>) {
hiddenScreenLockWindow(callback: Callback<void>) {
Log.showInfo(TAG, 'hiddenScreenLockWindow');
windowManager.find(Constants.WIN_NAME).then((win) => {
Log.showInfo(TAG, 'find window finish');

View File

@ -294,7 +294,6 @@ export class ScreenLockService {
destroy() {
this.screenLockModel.eventCancelListener(EVENT_END_SCREEN_ON);
this.screenLockModel.eventCancelListener(EVENT_BEGIN_SLEEP);
this.screenLockModel.eventCancelListener(EVENT_CHANGE_USER);
this.screenLockModel.eventCancelListener(EVENT_UNLOCK_SCREEN);
this.accountModel.eventCancelListener(ACTIVATING_TYPE, ACTIVATING_EVENT);
this.accountModel.eventCancelListener(ACTIVATE_TYPE, ACTIVATE_EVENT)

View File

@ -15,8 +15,8 @@
import Log from '../../../../../../../../../common/src/main/ets/default/Log'
import Constants from '../../common/constants'
import NumkeyBoard from './numkeyBoard.ets'
import ViewModel , {AuthType} from '../../vm/customPSDViewModel'
import NumkeyBoard from './numkeyBoard'
import ViewModel from '../../vm/customPSDViewModel'
const TAG = 'ScreenLock-CustomPSD'
@ -27,7 +27,7 @@ export default struct CustomPSD {
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear`)
this.mViewModel.checkFreezingTime(AuthType.PIN, (data) => {
this.mViewModel.checkFreezingTime(() => {
Log.showInfo(TAG, `onClick callback is called`)
});
}

View File

@ -15,8 +15,8 @@
import Log from '../../../../../../../../../common/src/main/ets/default/Log'
import Constants from '../../common/constants'
import NumkeyBoard from './numkeyBoard.ets'
import ViewModel, {AuthType} from '../../vm/digitalPSDViewModel'
import NumkeyBoard from './numkeyBoard'
import ViewModel from '../../vm/digitalPSDViewModel'
const TAG = 'ScreenLock-DigitalPSD'
@ -27,7 +27,7 @@ export default struct DigitalPSD {
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear`)
this.mViewModel.checkFreezingTime(AuthType.PIN, (data) => {
this.mViewModel.checkFreezingTime(() => {
Log.showInfo(TAG, `onClick callback is called`)
});
}

View File

@ -15,7 +15,7 @@
import Log from '../../../../../../../../../common/src/main/ets/default/Log'
import Constants from '../../common/constants'
import ViewModel, {AuthType}from '../../vm/mixedPSDViewModel'
import ViewModel from '../../vm/mixedPSDViewModel'
const TAG = 'ScreenLock-MixedPSD'
@ -25,7 +25,7 @@ export default struct MixedPSD {
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear`)
this.mViewModel.checkFreezingTime(AuthType.PIN, (data) => {
this.mViewModel.checkFreezingTime(() => {
Log.showInfo(TAG, `onClick callback is called`)
});
}

View File

@ -100,7 +100,7 @@ export default struct NumkeyBoard {
}
.onClick(() => {
Log.showInfo(TAG, `onClick:${item.index}`)
setTimeout(this.onKeypress.bind(this), 0, item.index, (data) => {
setTimeout(this.onKeypress.bind(this), 0, item.index, () => {
Log.showInfo(TAG, `onClick callback is called`)
});
})

View File

@ -16,6 +16,7 @@
import Log from '../../../../../../../../common/src/main/ets/default/Log'
import Constants from '../common/constants'
import service, {UnlockResult, AuthType, AuthSubType} from '../model/screenLockService'
import {Callback} from 'basic';
const TAG = 'ScreenLock-BaseViewModel'
const MINUTE_NM = '分钟'
@ -27,8 +28,6 @@ export {service, UnlockResult, AuthType, AuthSubType}
export default class BaseViewModel {
prompt: Resource | string;
inhibitInput: boolean = false;
countdownHandle: number = -1;
freezingMillisecond: number = 0;
constructor() {
this.ViewModelInit()
@ -39,42 +38,42 @@ export default class BaseViewModel {
this.prompt = $r('app.string.input');
}
countdown(callback) {
countdown() {
Log.showInfo(TAG, `countdown`)
let promptText: Resource | string = '';
this.freezingMillisecond -= Constants.INTERVAL;
Log.showInfo(TAG, `countdown freezingMillisecond:${this.freezingMillisecond}`)
if (this.freezingMillisecond > 0) {
promptText = this.getFreezingTimeNm();
promptText += TRY_AGAIN;
} else {
Log.showInfo(TAG, `countdown clearInterval`)
clearInterval(this.countdownHandle)
this.countdownHandle = -1
this.inhibitInput = false
promptText = $r('app.string.input');
}
Log.showInfo(TAG, `countdown promptText:${promptText}`)
this.prompt = promptText;
this.updateStorage(callback)
service.getAuthProperty(AuthType.PIN, (properties) => {
let promptText: Resource | string = '';
let freezingMillisecond = properties.freezingTime;
Log.showInfo(TAG, `countdown freezingMillisecond:${freezingMillisecond}`)
if (freezingMillisecond > 0) {
promptText = this.getFreezingTimeNm(freezingMillisecond);
promptText += TRY_AGAIN;
setTimeout(this.countdown.bind(this), Constants.INTERVAL)
} else {
Log.showInfo(TAG, `countdown clearInterval`)
this.inhibitInput = false
promptText = $r('app.string.input');
}
Log.showInfo(TAG, `countdown promptText:${promptText}`)
this.prompt = promptText;
})
}
changePrompt(remainTimes, freezingTime, callback) {
changePrompt(remainTimes, freezingTime, callback: Callback<void>) {
Log.showInfo(TAG, `changePrompt remainTimes:${remainTimes} freezingTime:${freezingTime}`)
let promptText: Resource | string = $r('app.string.incorrect');
this.freezingMillisecond = freezingTime
if (0 < remainTimes && remainTimes <= 2) {
if (!!this.freezingMillisecond && this.freezingMillisecond != 0) {
promptText = $r('app.string.incorrect_promp_freezing', remainTimes, this.getFreezingTimeNm());
if (freezingTime > 0) {
let freezingTimeNm = this.getFreezingTimeNm(freezingTime)
promptText = $r('app.string.incorrect_promp_freezing', remainTimes, freezingTimeNm);
} else {
promptText = $r('app.string.incorrect_promp_times', remainTimes);
}
} else if (0 == remainTimes) {
if (!!this.freezingMillisecond && this.freezingMillisecond != 0) {
if (freezingTime > 0) {
this.inhibitInput = true
promptText = $r('app.string.input_promp', this.getFreezingTimeNm());
this.countdownHandle = setInterval(this.countdown.bind(this), Constants.INTERVAL, callback);
promptText = $r('app.string.input_promp', this.getFreezingTimeNm(freezingTime));
setTimeout(this.countdown.bind(this), Constants.INTERVAL)
}
}
this.prompt = promptText;
@ -84,11 +83,11 @@ export default class BaseViewModel {
Log.showInfo(TAG, `changePrompt end`)
}
getFreezingTimeNm(): string {
getFreezingTimeNm(freezingMillisecond: number): string {
Log.showInfo(TAG, `getFreezingTimeNm start`)
let minute = Math.floor(this.freezingMillisecond / (60 * 1000));
let minute = Math.floor(freezingMillisecond / (60 * 1000));
Log.showInfo(TAG, `getFreezingTimeNm minute:${minute}`)
let second = Math.round((this.freezingMillisecond % (60 * 1000)) / 1000);
let second = Math.round((freezingMillisecond % (60 * 1000)) / 1000);
Log.showInfo(TAG, `getFreezingTimeNm second:${second}`)
let timeName = '';
if (minute != 0) {
@ -106,14 +105,12 @@ export default class BaseViewModel {
callback()
}
checkFreezingTime(authType, callback?) {
let callBackFun = Function;
if (callback) callBackFun = callback;
service.getAuthProperty(authType, (properties) => {
checkFreezingTime(callback: Callback<void>) {
service.getAuthProperty(AuthType.PIN, (properties) => {
if (properties.freezingTime > 0) {
this.inhibitInput = true
//Clear the entered password
this.changePrompt(properties.remainTimes, properties.freezingTime, callBackFun)
this.changePrompt(properties.remainTimes, properties.freezingTime, callback)
}
})
}

View File

@ -15,10 +15,10 @@
import Log from '../../../../../../../../common/src/main/ets/default/Log'
import Constants from '../common/constants'
import BaseViewModel, {service, UnlockResult,AuthType, AuthSubType} from './baseViewModel'
import BaseViewModel, {service, AuthType, AuthSubType} from './baseViewModel'
import {Callback} from 'basic';
const TAG = 'ScreenLock-CustomPSDViewModel'
export {AuthType}
export default class CustomPSDViewModel extends BaseViewModel {
passwordArr: any[] = [];
@ -61,7 +61,7 @@ export default class CustomPSDViewModel extends BaseViewModel {
Log.showInfo(TAG, 'onCallPhone');
}
onAuthPassword(callback) {
onAuthPassword(callback: Callback<void>) {
Log.showInfo(TAG, `onAuthPassword`);
if (this.passwordArr.length == 0 || this.inhibitInput) {
this.updateStorage(callback);

View File

@ -1,72 +0,0 @@
/**
* Copyright (c) 2021-2022 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 Log from '../../../../../../../../common/src/main/ets/default/Log'
import DateTimeCommon from '../../../../../../../../common/src/main/ets/default/DateTimeCommon'
import Constants from '../common/constants'
import {ScreenLockStatus} from '../../../../../../../../common/src/main/ets/default/ScreenLockCommon'
import ScreenLockModel from '../model/screenLockModel'
const TAG = 'ScreenLock-DateTimeViewModel'
/**
* DateTimeViewModel class
*/
export default class DateTimeViewModel {
timeVal: string = ''
dateVal: any = {}
weekVal: any = {}
setDateTimeHandle: number = -1
isUsing24hFormat: boolean= false
ViewModelInit(): void{
Log.showInfo(TAG, 'ViewModelInit');
this.setDateTime.bind(this)()
this.setDateTimeHandle = setInterval(this.setDateTime.bind(this), Constants.INTERVAL);
Log.showInfo(TAG, 'ViewModelInit end');
}
setDateTime() {
Log.showInfo(TAG, `setDateTime`)
this.timeVal = DateTimeCommon.getSystemTime(this.isUsing24hFormat)
this.dateVal = DateTimeCommon.getSystemDate()
this.weekVal = DateTimeCommon.getSystemWeek()
}
stopPolling() {
Log.showInfo(TAG, `stopPolling start`)
Log.showInfo(TAG, `stopPolling setDateTimeHandle:${this.setDateTimeHandle}`);
if (this.setDateTimeHandle > 0) {
clearInterval(this.setDateTimeHandle)
this.setDateTimeHandle = -1
Log.showInfo(TAG, `stopPolling setDateTimeHandle new :${this.setDateTimeHandle}`);
}
Log.showInfo(TAG, `stopPolling end`)
}
onStatusChange(lockStatus: ScreenLockStatus): void {
Log.showInfo(TAG, `onStatusChange lockStatus:${lockStatus}`);
Log.showInfo(TAG, `onStatusChange setDateTimeHandle:${this.setDateTimeHandle}`);
if (lockStatus == ScreenLockStatus.Locking) {
if (this.setDateTimeHandle <= 0) {
this.setDateTimeHandle = setInterval(this.setDateTime.bind(this), Constants.INTERVAL);
Log.showInfo(TAG, `onStatusChange setDateTimeHandle new:${this.setDateTimeHandle}`);
}
} else {
this.stopPolling();
}
}
}

View File

@ -15,15 +15,13 @@
import Log from '../../../../../../../../common/src/main/ets/default/Log'
import Constants from '../common/constants'
import BaseViewModel, {service, UnlockResult, AuthType, AuthSubType} from './baseViewModel'
import BaseViewModel, {service, AuthType, AuthSubType} from './baseViewModel'
import {Callback} from 'basic';
const TAG = 'ScreenLock-DigitalPSDViewModel'
const PW_LEN = 6
export {AuthType}
export default class DigitalPSDViewModel extends BaseViewModel {
password: number[]= []
passwdMaskArr: any[];
@ -39,7 +37,7 @@ export default class DigitalPSDViewModel extends BaseViewModel {
super.ViewModelInit();
}
onKeyPress(index, callback) {
onKeyPress(index, callback: Callback<void>) {
Log.showInfo(TAG, `onKeyPress start param: ${index}`)
let keyValue = this.numKeyboard[index].value;
if (keyValue >= 0 && !this.inhibitInput) {

View File

@ -14,10 +14,10 @@
*/
import Log from '../../../../../../../../common/src/main/ets/default/Log'
import BaseViewModel, {service, UnlockResult,AuthType, AuthSubType} from './baseViewModel'
import BaseViewModel, {service, AuthType, AuthSubType} from './baseViewModel'
import {Callback} from 'basic';
const TAG = 'ScreenLock-MixedPSDViewModel'
export {AuthType}
export default class MixedPSDViewModel extends BaseViewModel {
password: string= '';
@ -40,7 +40,7 @@ export default class MixedPSDViewModel extends BaseViewModel {
Log.showInfo(TAG, 'onCallPhone');
}
onAuthPassword(callback) {
onAuthPassword(callback: Callback<void>) {
Log.showInfo(TAG, `onAuthPassword`);
if (!this.password || this.inhibitInput) {
callback();

Some files were not shown because too many files have changed in this diff Show More