diff --git a/commons/commons/.gitignore b/commons/commons/.gitignore deleted file mode 100644 index e2713a2779c5a3e0eb879efe6115455592caeea5..0000000000000000000000000000000000000000 --- a/commons/commons/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -/node_modules -/oh_modules -/.preview -/build -/.cxx -/.test \ No newline at end of file diff --git a/commons/commons/Index.ets b/commons/commons/Index.ets deleted file mode 100644 index b4a404b4456fc0e5aed779fe890729f1cc32318d..0000000000000000000000000000000000000000 --- a/commons/commons/Index.ets +++ /dev/null @@ -1,2 +0,0 @@ -export { Logger } from './src/main/ets/utils/Logger'; -export { selectImagesFromAlbum } from './src/main/ets/utils/FileUtils' diff --git a/commons/commons/build-profile.json5 b/commons/commons/build-profile.json5 deleted file mode 100644 index 79961f96a6fe0507354b7952a378c3be2ae4bfab..0000000000000000000000000000000000000000 --- a/commons/commons/build-profile.json5 +++ /dev/null @@ -1,10 +0,0 @@ -{ - "apiType": "stageMode", - "buildOption": { - }, - "targets": [ - { - "name": "default" - } - ] -} diff --git a/commons/commons/hvigorfile.ts b/commons/commons/hvigorfile.ts deleted file mode 100644 index 805c5d7f6809c51cff0b4adcc1142979f8f864b6..0000000000000000000000000000000000000000 --- a/commons/commons/hvigorfile.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { harTasks } from '@ohos/hvigor-ohos-plugin'; - -export default { - system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ - plugins: [] /* Custom plugin to extend the functionality of Hvigor. */ -} \ No newline at end of file diff --git a/commons/commons/oh-package.json5 b/commons/commons/oh-package.json5 deleted file mode 100644 index d50184a32b1cf153f7dc71afeb97d601086fa6a7..0000000000000000000000000000000000000000 --- a/commons/commons/oh-package.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "commons", - "version": "1.0.0", - "description": "Please describe the basic information.", - "main": "Index.ets", - "author": "", - "license": "Apache-2.0", - "dependencies": {} -} diff --git a/commons/commons/src/main/ets/utils/FileUtils.ets b/commons/commons/src/main/ets/utils/FileUtils.ets deleted file mode 100644 index a9d38a383f9a4ce4566a1b725ff50fc72ff7cbed..0000000000000000000000000000000000000000 --- a/commons/commons/src/main/ets/utils/FileUtils.ets +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2025 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 { photoAccessHelper } from '@kit.MediaLibraryKit'; -import { BusinessError } from '@kit.BasicServicesKit'; -import { Logger } from './Logger'; - -const TAG_LOG = 'FileUtil'; - -/** - * Select a images from the album - * - * @returns {string[]} return selected image uris - */ -export function selectImagesFromAlbum(maxNumber: number = 5): Promise { - const photoPicker = new photoAccessHelper.PhotoViewPicker(); - const photoSelectOptions: photoAccessHelper.PhotoSelectOptions = { - MIMEType: photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE, - maxSelectNumber: maxNumber - }; - return photoPicker.select(photoSelectOptions).then(photoSelectResult => { - return photoSelectResult.photoUris; - }).catch((e: BusinessError) => { - Logger.error(TAG_LOG, `Failed to select images from album: ${e.code}, ${e.message}`); - return []; - }); -} \ No newline at end of file diff --git a/commons/commons/src/main/ets/utils/Logger.ets b/commons/commons/src/main/ets/utils/Logger.ets deleted file mode 100644 index c769a6076e62e5ec82a07d80992354b31e0b5702..0000000000000000000000000000000000000000 --- a/commons/commons/src/main/ets/utils/Logger.ets +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2025 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 { hilog } from '@kit.PerformanceAnalysisKit'; - -export class Logger { - private static readonly DOMAIN: number = 0xFF00; - private static readonly TAG: string = 'com.example.customcamera'; - private static readonly PREFIX: string = '[camera-log]'; - - public static debug(logTag: string, messageFormat: string, ...args: Object[]): void { - hilog.debug(Logger.DOMAIN, Logger.TAG, `${Logger.PREFIX} ${logTag}: ${messageFormat}`, args); - } - - public static info(logTag: string, messageFormat: string, ...args: Object[]): void { - hilog.info(Logger.DOMAIN, Logger.TAG, `${Logger.PREFIX} ${logTag}: ${messageFormat}`, args); - } - - public static warn(logTag: string, messageFormat: string, ...args: Object[]): void { - hilog.warn(Logger.DOMAIN, Logger.TAG, `${Logger.PREFIX} ${logTag}: ${messageFormat}`, args); - } - - public static error(logTag: string, messageFormat: string, ...args: Object[]): void { - hilog.error(Logger.DOMAIN, Logger.TAG, `${Logger.PREFIX} ${logTag}: ${messageFormat}`, args); - } - - public static fatal(logTag: string, messageFormat: string, ...args: Object[]): void { - hilog.fatal(Logger.DOMAIN, Logger.TAG, `${Logger.PREFIX} ${logTag}: ${messageFormat}`, args); - } - - private constructor() { - } -} diff --git a/commons/commons/src/main/module.json5 b/commons/commons/src/main/module.json5 deleted file mode 100644 index 1adf09bd6b0aa0969846d642a9e50eedf6cf31ee..0000000000000000000000000000000000000000 --- a/commons/commons/src/main/module.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - "module": { - "name": "commons", - "type": "har", - "deviceTypes": [ - "default" - ] - } -} diff --git a/commons/commons/src/main/resources/base/element/float.json b/commons/commons/src/main/resources/base/element/float.json deleted file mode 100644 index 33ea22304f9b1485b5f22d811023701b5d4e35b6..0000000000000000000000000000000000000000 --- a/commons/commons/src/main/resources/base/element/float.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "float": [ - { - "name": "page_text_font_size", - "value": "50fp" - } - ] -} diff --git a/commons/commons/src/main/resources/base/element/string.json b/commons/commons/src/main/resources/base/element/string.json deleted file mode 100644 index f51a9c8461a55f6312ef950344e3145b7f82d607..0000000000000000000000000000000000000000 --- a/commons/commons/src/main/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "page_show", - "value": "page from package" - } - ] -} diff --git a/features/home/oh-package.json5 b/features/home/oh-package.json5 index ddab6f1cb11d482c984f91e7bdd6aed385c3d2c2..3f480ab37f3c94d804a9741a33d4eb2ffb5b4d00 100644 --- a/features/home/oh-package.json5 +++ b/features/home/oh-package.json5 @@ -5,7 +5,5 @@ "main": "Index.ets", "author": "", "license": "Apache-2.0", - "dependencies": { - "commons": "file:../../commons/commons" - } + "dependencies": {} } diff --git a/features/home/src/main/ets/view/CommentKeyboard.ets b/features/home/src/main/ets/view/CommentKeyboard.ets index f3899b62a6365213de059f8752b094013bbcde60..49d091747e4b32521f4052b6423976517c6525cc 100644 --- a/features/home/src/main/ets/view/CommentKeyboard.ets +++ b/features/home/src/main/ets/view/CommentKeyboard.ets @@ -15,9 +15,6 @@ import { window } from "@kit.ArkUI"; import { NavigationDialog } from "./NavigationDialog"; -import { Logger, selectImagesFromAlbum } from 'commons' - -const TAG = 'CommentKeyboard'; interface OperateButton { icon: Resource @@ -62,8 +59,6 @@ export struct CommentKeyboard { @State isEmojiKeyboardVisible: boolean = false; @State isAtFriendListVisible: boolean = false; @Consume navDialogPageInfos: NavPathStack; - // When the photo picker is pulled up, the soft keyboard will also be dismissed, but no need to exit the comment page - @State isPhotoPickerVisible: boolean = false; // [Start comment_keyboard1] aboutToAppear(): void { @@ -84,7 +79,7 @@ export struct CommentKeyboard { addKeyboardHeightListener(win: window.Window) { win.on('keyboardHeightChange', height => { - Logger.info(TAG, 'keyboard height has changed', this.getUIContext().px2vp(height)); + console.info('keyboard height has changed', this.getUIContext().px2vp(height)); if (height !== 0) { this.keyboardHeight = this.getUIContext().px2vp(height); return; @@ -92,10 +87,8 @@ export struct CommentKeyboard { // [StartExclude comment_keyboard1] // if close keyboard, don't set keyboardHeight, avoid EmojiKeyboard height is 0 if (!this.isEmojiKeyboardVisible) { - // When the photo picker is pulled up, the soft keyboard will also be dismissed, but no need to exit the comment page - if (this.isPhotoPickerVisible) return; - // handle system keyboard close button click - Logger.info(TAG, 'click soft keyboard close button'); + // handle keyboard close button click + console.info('click soft keyboard close button'); this.navDialogPageInfos.pop(); } // [EndExclude comment_keyboard1] @@ -114,20 +107,11 @@ export struct CommentKeyboard { icon: this.isEmojiKeyboardVisible ? $r('app.media.keyboard_circle') : $r('app.media.face'), onClick: this.onEmojiButtonClick }, - { icon: $r('app.media.picture'), onClick: this.onPictureButtonClick }, + { icon: $r('app.media.picture') }, { icon: $r('app.media.paper_plane'), onClick: this.onSendComment } ]; } - onPictureButtonClick: () => void = () => { - this.isPhotoPickerVisible = true; - selectImagesFromAlbum(1).then(uris => { - Logger.info(TAG, JSON.stringify(uris)); - }).finally(() => { - this.isPhotoPickerVisible = false; - }); - } - // [Start comment_keyboard2] // features/home/src/main/ets/view/CommentKeyboard.ets onAtButtonClick: (event?: ClickEvent) => void = event => { @@ -178,7 +162,7 @@ export struct CommentKeyboard { richEditorSpans.push(richEditorSpan); }); // [StartExclude comment_keyboard4] - Logger.info(TAG, 'richEditorContent', JSON.stringify(richEditorSpans)); + console.info('richEditorContent', JSON.stringify(richEditorSpans)); this.navDialogPageInfos.pop(); this.navDialogPageInfos.pushPathByName('CommentSendDialog', richEditorSpans); // [EndExclude comment_keyboard4] diff --git a/oh-package.json5 b/oh-package.json5 index 0cec98259052cc175d04dbcf61780de4bc9785f4..bb12751b97530b9a3504e56e8ed09d8c9ba1fa52 100644 --- a/oh-package.json5 +++ b/oh-package.json5 @@ -3,5 +3,8 @@ "description": "Please describe the basic information.", "dependencies": { }, - "devDependencies": {} + "devDependencies": { + "@ohos/hypium": "1.0.19", + "@ohos/hamock": "1.0.0" + } }