diff --git a/entry/obfuscation-rules.txt b/entry/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b --- /dev/null +++ b/entry/obfuscation-rules.txt @@ -0,0 +1,23 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5 + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope + +-enable-property-obfuscation +-enable-toplevel-obfuscation +-enable-filename-obfuscation +-enable-export-obfuscation \ No newline at end of file diff --git a/entry/src/main/ets/common/utils/Camera.ets b/entry/src/main/ets/common/utils/Camera.ets index a588ab0671b1b9007f48e27b92e0fa450597c76b..d9e771f8eb6b0c28cda7e19e550177350b4946e0 100644 --- a/entry/src/main/ets/common/utils/Camera.ets +++ b/entry/src/main/ets/common/utils/Camera.ets @@ -21,7 +21,7 @@ import Logger from './Logger'; import CommonConstants from '../constants/CommonConstants'; const TAG: string = '[CameraModel]'; - +const context: common.UIAbilityContext = AppStorage.get("context") as common.UIAbilityContext; export default class Camera { private cameraMgr: camera.CameraManager | undefined = undefined; private cameraDevice: camera.CameraDevice | undefined = undefined; @@ -35,7 +35,7 @@ export default class Camera { private imgReceive: Function | undefined = undefined; async initCamera(surfaceId: string): Promise { - this.cameraMgr = camera.getCameraManager(getContext(this) as common.UIAbilityContext); + this.cameraMgr = camera.getCameraManager(context); let cameraArray = this.getCameraDevices(this.cameraMgr); this.cameraDevice = cameraArray[CommonConstants.INPUT_DEVICE_INDEX]; this.cameraInput = this.getCameraInput(this.cameraDevice, this.cameraMgr) as camera.CameraInput; @@ -81,7 +81,6 @@ export default class Camera { if (canIUse('SystemCapability.AI.OCR.TextRecognition')) { await textRecognition.recognizeText(visionInfo, textConfiguration).then((TextRecognitionResult) => { if (TextRecognitionResult.value === '') { - let context = getContext(this) as common.UIAbilityContext recognitionString = context.resourceManager.getStringSync($r('app.string.unrecognizable').id); } else { recognitionString = TextRecognitionResult.value; @@ -90,7 +89,6 @@ export default class Camera { pixelMapInstance.release(); imageResource.release(); } else { - let context = getContext(this) as common.UIAbilityContext recognitionString = context.resourceManager.getStringSync($r('app.string.Device_not_support').id); Logger.error(TAG, `device not support`); } diff --git a/entry/src/main/ets/common/utils/PermissionUtils.ets b/entry/src/main/ets/common/utils/PermissionUtils.ets index 37c7e76b0dfd67849301d93852dccab2830af803..b181247f583c5f9ba92573614be803aa67d1abd8 100644 --- a/entry/src/main/ets/common/utils/PermissionUtils.ets +++ b/entry/src/main/ets/common/utils/PermissionUtils.ets @@ -21,7 +21,7 @@ const PERMISSIONS: Array = [ 'ohos.permission.CAMERA' ]; -const context = getContext(this) as common.UIAbilityContext; +const context: common.UIAbilityContext = AppStorage.get("context") as common.UIAbilityContext; export default async function grantPermission(): Promise { try {