diff --git "a/ohos/docs/08_FAQ/web\351\227\252\345\261\217\350\247\243\345\206\263\346\226\271\346\241\210.md" "b/ohos/docs/08_FAQ/web\351\227\252\345\261\217\350\247\243\345\206\263\346\226\271\346\241\210.md" new file mode 100644 index 0000000000000000000000000000000000000000..2eb5301230bb810461f8762d0d9a37d6a7cf7a2e --- /dev/null +++ "b/ohos/docs/08_FAQ/web\351\227\252\345\261\217\350\247\243\345\206\263\346\226\271\346\241\210.md" @@ -0,0 +1,68 @@ +#### Web页面弹出键盘/收起键盘 闪屏问题解决方案: + +参考资料:https://www.modb.pro/db/638000 + +1,在最外面包一层`MediaQuery` + +2,自定义`useInheritedMediaQuery`属性为true + +3,使用`SafeArea`包裹web区域 + + + +```js +class MyApp extends StatelessWidget { + const MyApp({super.key}); + + @override + Widget build(BuildContext context) { + return MediaQuery( + data: MediaQueryData.fromWindow(WidgetsBinding.instance.window), + child: MaterialApp( + title: 'Flutter Demo', + useInheritedMediaQuery: true, + theme: ThemeData( + primarySwatch: Colors.blue, + ), + home: const WebPage(title: 'Flutter Demo Home Page'), + )); + } +} + +class WebPage extends StatefulWidget { + const WebPage({super.key, required this.title}); + + final String title; + + @override + State createState() => _WebPageState(); +} + +class _WebPageState extends State { + late final WebViewController controller; + + @override + void initState() { + super.initState(); + controller = WebViewController.fromPlatformCreationParams( + const PlatformWebViewControllerCreationParams(), + ); + controller.loadRequest(Uri.parse("https://www.baidu.cn/")); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + resizeToAvoidBottomInset: false, + body: SafeArea( + child: WebViewWidget( + controller: controller, + ), + ), + ); + } +} + + +``` + diff --git a/ohos/flutter_huawei_login/ohos/.gitignore b/ohos/flutter_huawei_login/ohos/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..6ca13b3170eec5dd5ac5ad7f1c4dd0118845f473 --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/.gitignore @@ -0,0 +1,19 @@ +/node_modules +/oh_modules +/local.properties +/.idea +**/build +/.hvigor +.cxx +/.clangd +/.clang-format +/.clang-tidy +**/.test +*.har +**/BuildProfile.ets +**/oh-package-lock.json5 + +**/src/main/resources/rawfile/flutter_assets/ +**/libs/arm64-v8a/libapp.so +**/libs/arm64-v8a/libflutter.so +**/libs/arm64-v8a/libvmservice_snapshot.so diff --git a/ohos/flutter_huawei_login/ohos/AppScope/app.json5 b/ohos/flutter_huawei_login/ohos/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..60648f6b9c67c83c79f882c532783dc6bd49c1cf --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.example.flutter_huawei_login", + "vendor": "example", + "versionCode": 1, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name" + } +} \ No newline at end of file diff --git a/ohos/flutter_huawei_login/ohos/AppScope/resources/base/element/string.json b/ohos/flutter_huawei_login/ohos/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..e8598b968a4a514080a6045d624ae1b47b9e698b --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "flutter_huawei_login" + } + ] +} diff --git a/ohos/flutter_huawei_login/ohos/AppScope/resources/base/media/app_icon.png b/ohos/flutter_huawei_login/ohos/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ohos/flutter_huawei_login/ohos/AppScope/resources/base/media/app_icon.png differ diff --git a/ohos/flutter_huawei_login/ohos/build-profile.json5 b/ohos/flutter_huawei_login/ohos/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..9ed24ebb4ca061604d7e38835679c7a1dd2dd124 --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/build-profile.json5 @@ -0,0 +1,41 @@ +{ + "app": { + "signingConfigs": [ + { + "name": "default", + "type": "HarmonyOS", + "material": { + "certpath": "C:\\Users\\Administrator\\.ohos\\config\\default_ohos_2Y17xMVGPKTpzqKZvfr6XtcmDTmnz0hx4sthSAEtulc=.cer", + "storePassword": "0000001B5C6BC016CBD2AB212777D88AD919CC1CE37A37E43714AD08F94CD5A6C0DBF01085CAC559BA3C44", + "keyAlias": "debugKey", + "keyPassword": "0000001B3151F6CF049269A0CB6F58969090238EECC1E0602353BD8A4C66E56E6530F1C353D670EC1A8C55", + "profile": "C:\\Users\\Administrator\\.ohos\\config\\default_ohos_2Y17xMVGPKTpzqKZvfr6XtcmDTmnz0hx4sthSAEtulc=.p7b", + "signAlg": "SHA256withECDSA", + "storeFile": "C:\\Users\\Administrator\\.ohos\\config\\default_ohos_2Y17xMVGPKTpzqKZvfr6XtcmDTmnz0hx4sthSAEtulc=.p12" + } + } + ], + "products": [ + { + "name": "default", + "signingConfig": "default", + "compatibleSdkVersion": "5.0.0(12)", + "runtimeOS": "HarmonyOS" + } + ] + }, + "modules": [ + { + "name": "entry", + "srcPath": "./entry", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/ohos/flutter_huawei_login/ohos/entry/.gitignore b/ohos/flutter_huawei_login/ohos/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..2795a1c5b1fe53659dd1b71d90ba0592eaf7e043 --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/entry/.gitignore @@ -0,0 +1,7 @@ + +/node_modules +/oh_modules +/.preview +/build +/.cxx +/.test \ No newline at end of file diff --git a/ohos/flutter_huawei_login/ohos/entry/build-profile.json5 b/ohos/flutter_huawei_login/ohos/entry/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..633d360fbc91a3186a23b66ab71b27e5618944cb --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/entry/build-profile.json5 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development 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": { + }, + "targets": [ + { + "name": "default", + "runtimeOS": "HarmonyOS" + }, + { + "name": "ohosTest", + } + ] +} \ No newline at end of file diff --git a/ohos/flutter_huawei_login/ohos/entry/hvigorfile.ts b/ohos/flutter_huawei_login/ohos/entry/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..894fc15c6b793f085e6c8506e43d719af658e8ff --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/entry/hvigorfile.ts @@ -0,0 +1,17 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development 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. +*/ + +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +export { hapTasks } from '@ohos/hvigor-ohos-plugin'; diff --git a/ohos/flutter_huawei_login/ohos/entry/oh-package.json5 b/ohos/flutter_huawei_login/ohos/entry/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..078610f17b4a9d75c48dc65508a230e5a4a552fb --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/entry/oh-package.json5 @@ -0,0 +1,10 @@ +{ + "name": "entry", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": { + } +} \ No newline at end of file diff --git a/ohos/flutter_huawei_login/ohos/entry/src/main/ets/entryability/EntryAbility.ets b/ohos/flutter_huawei_login/ohos/entry/src/main/ets/entryability/EntryAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..e3b264d82369431ab02c0d3f473a45b6cca28f73 --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/entry/src/main/ets/entryability/EntryAbility.ets @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development 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 { FlutterAbility, FlutterEngine } from '@ohos/flutter_ohos'; +import { GeneratedPluginRegistrant } from '../plugins/GeneratedPluginRegistrant'; +import { LoginPlugin } from './LoginPlugin'; + +export default class EntryAbility extends FlutterAbility { + configureFlutterEngine(flutterEngine: FlutterEngine) { + super.configureFlutterEngine(flutterEngine) + GeneratedPluginRegistrant.registerWith(flutterEngine) + this.addPlugin(new LoginPlugin()) + } +} diff --git a/ohos/flutter_huawei_login/ohos/entry/src/main/ets/entryability/ErrorCode.ets b/ohos/flutter_huawei_login/ohos/entry/src/main/ets/entryability/ErrorCode.ets new file mode 100644 index 0000000000000000000000000000000000000000..3c21e9a11b014a14fc7afa2d46d94e295e661861 --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/entry/src/main/ets/entryability/ErrorCode.ets @@ -0,0 +1,6 @@ +export enum ErrorCode { + ERROR_CODE_NETWORK_ERROR = 1001502005, + ERROR_CODE_AGREEMENT_STATUS_NOT_ACCEPTED = 1005300001, + ERROR_CODE_LOGIN_OUT = 1001502001, + ERROR_CODE_NOT_SUPPORTED = 1001500003 +} \ No newline at end of file diff --git a/ohos/flutter_huawei_login/ohos/entry/src/main/ets/entryability/LoginFactory.ets b/ohos/flutter_huawei_login/ohos/entry/src/main/ets/entryability/LoginFactory.ets new file mode 100644 index 0000000000000000000000000000000000000000..5756e2c948b2b7010813e63420b3245909e46ce7 --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/entry/src/main/ets/entryability/LoginFactory.ets @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development 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 { BinaryMessenger } from '@ohos/flutter_ohos/src/main/ets/plugin/common/BinaryMessenger'; +import MessageCodec from '@ohos/flutter_ohos/src/main/ets/plugin/common/MessageCodec'; +import PlatformViewFactory from '@ohos/flutter_ohos/src/main/ets/plugin/platform/PlatformViewFactory'; +import { LoginView } from './LoginView'; +import common from '@ohos.app.ability.common'; +import PlatformView from '@ohos/flutter_ohos/src/main/ets/plugin/platform/PlatformView'; + +export class LoginFactory extends PlatformViewFactory { + message: BinaryMessenger; + + constructor(message: BinaryMessenger, createArgsCodes: MessageCodec) { + super(createArgsCodes); + this.message = message; + } + + public create(context: common.Context, viewId: number, args: Object): PlatformView { + return new LoginView(context, viewId, args, this.message); + } +} \ No newline at end of file diff --git a/ohos/flutter_huawei_login/ohos/entry/src/main/ets/entryability/LoginPlugin.ets b/ohos/flutter_huawei_login/ohos/entry/src/main/ets/entryability/LoginPlugin.ets new file mode 100644 index 0000000000000000000000000000000000000000..9a6b449569750c33d821b99150b27aa887fd1a7d --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/entry/src/main/ets/entryability/LoginPlugin.ets @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development 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 { FlutterPlugin, + FlutterPluginBinding } from '@ohos/flutter_ohos/src/main/ets/embedding/engine/plugins/FlutterPlugin'; +import StandardMessageCodec from '@ohos/flutter_ohos/src/main/ets/plugin/common/StandardMessageCodec'; +import { LoginFactory } from './LoginFactory'; + +export class LoginPlugin implements FlutterPlugin { + getUniqueClassName(): string { + return 'LoginPlugin'; + } + + onAttachedToEngine(binding: FlutterPluginBinding): void { + binding.getPlatformViewRegistry()?. + registerViewFactory('com.example.flutter_login/loginView', new LoginFactory(binding.getBinaryMessenger(), StandardMessageCodec.INSTANCE)); + } + + onDetachedFromEngine(binding: FlutterPluginBinding): void {} +} \ No newline at end of file diff --git a/ohos/flutter_huawei_login/ohos/entry/src/main/ets/entryability/LoginView.ets b/ohos/flutter_huawei_login/ohos/entry/src/main/ets/entryability/LoginView.ets new file mode 100644 index 0000000000000000000000000000000000000000..63de7db97b6d366d8638dc1fd09804e576da4b95 --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/entry/src/main/ets/entryability/LoginView.ets @@ -0,0 +1,221 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development 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 MethodChannel, { + MethodCallHandler, + MethodResult +} from '@ohos/flutter_ohos/src/main/ets/plugin/common/MethodChannel'; +import PlatformView, { Params } from '@ohos/flutter_ohos/src/main/ets/plugin/platform/PlatformView'; +import common from '@ohos.app.ability.common'; +import { BinaryMessenger } from '@ohos/flutter_ohos/src/main/ets/plugin/common/BinaryMessenger'; +import StandardMethodCodec from '@ohos/flutter_ohos/src/main/ets/plugin/common/StandardMethodCodec'; +import MethodCall from '@ohos/flutter_ohos/src/main/ets/plugin/common/MethodCall'; +import { loginComponentManager, LoginWithHuaweiIDButton } from '@kit.AccountKit'; +import { BusinessError } from '@kit.BasicServicesKit'; +import { ErrorCode } from './ErrorCode'; +import { JSON } from '@kit.ArkTS'; +import { authentication } from '@kit.AccountKit'; + + +class LoginInfo { + private authCode: string; + private openID: string; + private unionID: string; + private idToken: string; + + constructor(authCode: string, openID: string, unionID: string, idToken: string) { + this.authCode = authCode; + this.openID = openID; + this.unionID = unionID; + this.idToken = idToken; + } +} + +AppStorage.setOrCreate('agreementStatus', false) +AppStorage.setOrCreate('agreementAndLogin', 0) + +@Component +struct ButtonComponent { + @StorageLink('agreementStatus') @Watch('setAgreementStatus') agreementStatus: boolean = false; + @StorageLink('agreementAndLogin') @Watch('setAgreementAndLogin') agreementAndLogin: number = 0; + @Prop params: Params + customView: LoginView = this.params.platformView as LoginView + @State bkColor: Color = Color.Red + // 控制登录中不可点击协议和复选框的状态变量 + @State enableStatus: boolean = true; + + // @Watch 回调 + setAgreementStatus(): void { + if (this.agreementStatus) { + this.controller.setAgreementStatus(loginComponentManager.AgreementStatus.ACCEPTED); + } else { + this.controller.setAgreementStatus(loginComponentManager.AgreementStatus.NOT_ACCEPTED); + } + } + + setAgreementAndLogin() { + this.enableStatus = false; + this.agreementStatus = true; + // 设置协议状态为ACCEPTED + this.controller.setAgreementStatus(loginComponentManager.AgreementStatus.ACCEPTED); + // 调用此方法,同意协议与登录一并完成,无需再次点击登录按钮 + this.controller.continueLogin((error: BusinessError) => { + + }); + } + + controller = + new loginComponentManager.LoginWithHuaweiIDButtonController() + // 需要用户同意协议才能完成华为账号登录,请先设置协议状态为NOT_ACCEPTED,当用户同意协议后设置协议状态为ACCEPTED,才可以完成华为账号登录 + .setAgreementStatus(loginComponentManager.AgreementStatus.NOT_ACCEPTED) + .onClickLoginWithHuaweiIDButton((error: BusinessError, response: loginComponentManager.HuaweiIDCredential) => { + // 处理用户点击一键登录按钮逻辑 + this.handleLoginWithHuaweiIDButton(error, response); + }); + + // 处理点击一键登录后的方法 + handleLoginWithHuaweiIDButton(error: BusinessError | undefined, + response: loginComponentManager.HuaweiIDCredential) { + this.enableStatus = false; + if (error) { + if (error.code === ErrorCode.ERROR_CODE_NETWORK_ERROR) { + this.customView.sendMessage(error.code.toString(), '网络未连接'); + } else if (error.code === ErrorCode.ERROR_CODE_AGREEMENT_STATUS_NOT_ACCEPTED) { + // 未同意协议,弹出协议弹框,推荐使用该回调方式 + this.customView.sendMessage(error.code.toString(), '未同意协议,弹出协议弹框,推荐使用该回调方式'); + } else if (error.code === ErrorCode.ERROR_CODE_LOGIN_OUT) { + // 提示华为账号未登录 + this.customView.sendMessage(error.code.toString(), '华为账号未登录'); + } else if (error.code === ErrorCode.ERROR_CODE_NOT_SUPPORTED) { + // 不支持该scopes或permissions提示 + this.customView.sendMessage(error.code.toString(), '不支持该scopes或permissions提示'); + } else { + // 当前提示系统或服务异常,可根据实际情况处理 + this.customView.sendMessage(error.code.toString(), '当前提示系统或服务异常,可根据实际情况处理'); + // TODO: 其他错误码处理,请参考API中的错误码查看详细错误原因 + } + this.enableStatus = true; + return; + } + // 登录成功 + let authCode = response.authorizationCode; + let openID = response.openID; + let unionID = response.unionID; + let idToken = response.idToken; + this.customView.sendMessage('loginSuccess', JSON.stringify(new LoginInfo(authCode, openID, unionID, idToken))); + this.enableStatus = true; + } + + build() { + Column() { + Column() { + LoginWithHuaweiIDButton({ + params: { + style: loginComponentManager.Style.BUTTON_RED, + loginType: loginComponentManager.LoginType.QUICK_LOGIN, + supportDarkMode: true + }, + controller: this.controller + }).id('login_with_huaweiId_button') + } + .backgroundColor(Color.White) + .height(40) + .width('100%') + } + .backgroundColor(Color.Red) + .alignItems(HorizontalAlign.Center) + .justifyContent(FlexAlign.Center) + .direction(Direction.Ltr) + .width('100%') + .height('100%') + } +} + +@Builder +function ButtonBuilder(params: Params) { + ButtonComponent({ params: params }) +} + + +@Observed +export class LoginView extends PlatformView implements MethodCallHandler { + methodChannel: MethodChannel; + index: number = 1; + + constructor(context: common.Context, viewId: number, args: ESObject, message: BinaryMessenger) { + super(); + // 注册消息通道 + this.methodChannel = + new MethodChannel(message, `com.example.flutter_login/loginView${viewId}`, StandardMethodCodec.INSTANCE); + this.methodChannel.setMethodCallHandler(this); + + this.getQuickLoginAnonymousPhone(); + } + + // 获取匿名手机号 + getQuickLoginAnonymousPhone() { + // 创建授权请求 + let authRequest = new authentication.HuaweiIDProvider().createAuthorizationWithHuaweiIDRequest(); + // 应用请求的用户信息 + authRequest.scopes = ['quickLoginAnonymousPhone', 'openid']; + // 一键登录场景下,forceAuthorization必须传false + authRequest.forceAuthorization = false; + let controller = new authentication.AuthenticationController(); + try { + controller.executeRequest(authRequest).then((response: authentication.AuthorizationWithHuaweiIDResponse) => { + // 获取到UnionID、匿名手机号,推荐开发者使用UnionID作为关联信息 + let unionID = response.data?.unionID; + let quickLoginAnonymousPhone = response.data?.extraInfo?.quickLoginAnonymousPhone as string; + + this.methodChannel.invokeMethod('quickLoginAnonymousPhone', quickLoginAnonymousPhone); + }).catch((error: BusinessError) => { + + }) + } catch (error) { + } + } + + onMethodCall(call: MethodCall, result: MethodResult): void { + // 接受Dart侧发来的消息 + let method: string = call.method; + switch (method) { + case 'setAgreementStatus': { + let value: boolean = call.args; + let link1: SubscribedAbstractProperty = AppStorage.link('agreementStatus'); + link1.set(value); + break; + } + case 'agreementAndLogin': { + let value: boolean = call.args; + let link1: SubscribedAbstractProperty = AppStorage.link('agreementAndLogin'); + link1.set(link1.get() + 1); + break; + } + } + } + + + public sendMessage = (method: string, data: string) => { + //向Dart侧发送消息 + this.methodChannel.invokeMethod(method, data); + } + + getView(): WrappedBuilder<[Params]> { + return new WrappedBuilder(ButtonBuilder); + } + + dispose(): void { + } +} \ No newline at end of file diff --git a/ohos/flutter_huawei_login/ohos/entry/src/main/ets/pages/Index.ets b/ohos/flutter_huawei_login/ohos/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..1125f9fdd95f4310a182c1c9e3680f37f73686c9 --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development 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 common from '@ohos.app.ability.common'; +import { FlutterPage } from '@ohos/flutter_ohos' + +let storage = LocalStorage.getShared() +const EVENT_BACK_PRESS = 'EVENT_BACK_PRESS' + +@Entry(storage) +@Component +struct Index { + private context = getContext(this) as common.UIAbilityContext + @LocalStorageLink('viewId') viewId: string = ""; + + build() { + Column() { + FlutterPage({ viewId: this.viewId }) + } + } + + onBackPress(): boolean { + this.context.eventHub.emit(EVENT_BACK_PRESS) + return true + } +} \ No newline at end of file diff --git a/ohos/flutter_huawei_login/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets b/ohos/flutter_huawei_login/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets new file mode 100644 index 0000000000000000000000000000000000000000..3b2432aa05bd7275d58e08fc21c125cc9523cb60 --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets @@ -0,0 +1,28 @@ +import { FlutterEngine, Log } from '@ohos/flutter_ohos'; +import FluttertoastPlugin from 'fluttertoast'; +import WebViewFlutterPlugin from 'webview_flutter_ohos'; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Ohos platform. + */ + +const TAG = "GeneratedPluginRegistrant"; + +export class GeneratedPluginRegistrant { + + static registerWith(flutterEngine: FlutterEngine) { + try { + flutterEngine.getPlugins()?.add(new FluttertoastPlugin()); + flutterEngine.getPlugins()?.add(new WebViewFlutterPlugin()); + } catch (e) { + Log.e( + TAG, + "Tried to register plugins with FlutterEngine (" + + flutterEngine + + ") failed."); + Log.e(TAG, "Received exception while registering", e); + } + } +} diff --git a/ohos/flutter_huawei_login/ohos/entry/src/main/module.json5 b/ohos/flutter_huawei_login/ohos/entry/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7bbf78b18f39991b1404061c7437538c7d532bb7 --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/entry/src/main/module.json5 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development 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", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ets", + "description": "$string:EntryAbility_desc", + "icon": "$media:icon", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "requestPermissions": [ + {"name" : "ohos.permission.INTERNET"}, + ] + } +} \ No newline at end of file diff --git a/ohos/flutter_huawei_login/ohos/entry/src/main/resources/base/element/color.json b/ohos/flutter_huawei_login/ohos/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ohos/flutter_huawei_login/ohos/entry/src/main/resources/base/element/string.json b/ohos/flutter_huawei_login/ohos/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..75001d101700e9b40d9db3e89039dd896afa72ef --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "flutter_huawei_login" + } + ] +} \ No newline at end of file diff --git a/ohos/flutter_huawei_login/ohos/entry/src/main/resources/base/media/icon.png b/ohos/flutter_huawei_login/ohos/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ohos/flutter_huawei_login/ohos/entry/src/main/resources/base/media/icon.png differ diff --git a/ohos/flutter_huawei_login/ohos/entry/src/main/resources/base/profile/main_pages.json b/ohos/flutter_huawei_login/ohos/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/ohos/flutter_huawei_login/ohos/entry/src/main/resources/en_US/element/string.json b/ohos/flutter_huawei_login/ohos/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..75001d101700e9b40d9db3e89039dd896afa72ef --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "flutter_huawei_login" + } + ] +} \ No newline at end of file diff --git a/ohos/flutter_huawei_login/ohos/entry/src/main/resources/zh_CN/element/string.json b/ohos/flutter_huawei_login/ohos/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..155070b48119580033efda1144f16cc301e22fc2 --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "flutter_huawei_login" + } + ] +} \ No newline at end of file diff --git a/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/ets/test/Ability.test.ets b/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..25d4c71ff3cd584f5d64f6f8c0ac864928c234c4 --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/ets/test/Ability.test.ets @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development 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 '@ohos.hilog'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +export default function abilityTest() { + describe('ActsAbilityTest', function () { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(function () { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(function () { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }) + afterEach(function () { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(function () { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + it('assertContain',0, function () { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + hilog.info(0x0000, 'testTag', '%{public}s', 'it begin'); + let a = 'abc' + let b = 'b' + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b) + expect(a).assertEqual(a) + }) + }) +} \ No newline at end of file diff --git a/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/ets/test/List.test.ets b/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f4140030e65d20df6af30a6bf51e464dea8f8aa6 --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development 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 abilityTest from './Ability.test' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/ets/testability/TestAbility.ets b/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/ets/testability/TestAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..4ca645e6013cfce8e7dbb728313cb8840c4da660 --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/ets/testability/TestAbility.ets @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development 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 UIAbility from '@ohos.app.ability.UIAbility'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; +import hilog from '@ohos.hilog'; +import { Hypium } from '@ohos/hypium'; +import testsuite from '../test/List.test'; +import window from '@ohos.window'; + +export default class TestAbility extends UIAbility { + onCreate(want, launchParam) { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); + hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); + hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage) { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); + windowStage.loadContent('testability/pages/Index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', + JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); + } + + onForeground() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); + } + + onBackground() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); + } +} \ No newline at end of file diff --git a/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets b/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..cef0447cd2f137ef82d223ead2e156808878ab90 --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development 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 '@ohos.hilog'; + +@Entry +@Component +struct Index { + aboutToAppear() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts b/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..1def08f2e9dcbfa3454a07b7a3b82b173bb90d02 --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development 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 '@ohos.hilog'; +import TestRunner from '@ohos.application.testRunner'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +async function onAbilityCreateCallback() { + hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err: any) { + hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); + } + + async onRun() { + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName + var debug = abilityDelegatorArguments.parameters['-D'] + if (debug == 'true') + { + cmd += ' -D' + } + hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); + }) + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); + } +} \ No newline at end of file diff --git a/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/module.json5 b/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..fab77ce2e0c61e3ad010bab5b27ccbd15f9a8c96 --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/module.json5 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development 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", + "type": "feature", + "description": "$string:module_test_desc", + "mainElement": "TestAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:test_pages", + "abilities": [ + { + "name": "TestAbility", + "srcEntry": "./ets/testability/TestAbility.ets", + "description": "$string:TestAbility_desc", + "icon": "$media:icon", + "label": "$string:TestAbility_label", + "exported": true, + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + } + ] + } +} diff --git a/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/resources/base/element/color.json b/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/resources/base/element/string.json b/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_test_desc", + "value": "test ability description" + }, + { + "name": "TestAbility_desc", + "value": "the test ability" + }, + { + "name": "TestAbility_label", + "value": "test label" + } + ] +} \ No newline at end of file diff --git a/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/resources/base/media/icon.png b/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/resources/base/media/icon.png differ diff --git a/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/resources/base/profile/test_pages.json b/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/resources/base/profile/test_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..b7e7343cacb32ce982a45e76daad86e435e054fe --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/entry/src/ohosTest/resources/base/profile/test_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "testability/pages/Index" + ] +} diff --git a/ohos/flutter_huawei_login/ohos/hvigor/hvigor-config.json5 b/ohos/flutter_huawei_login/ohos/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..541ba35711b75986f9295410ee38fdb8f2572878 --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/hvigor/hvigor-config.json5 @@ -0,0 +1,20 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development 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. +*/ + +{ + "modelVersion": "5.0.0", + "dependencies": { + } +} \ No newline at end of file diff --git a/ohos/flutter_huawei_login/ohos/hvigorfile.ts b/ohos/flutter_huawei_login/ohos/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..8f2d2aafe6d6a3a71a9944ebd0c91fbc308ac9d1 --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/hvigorfile.ts @@ -0,0 +1,21 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development 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 { + system: appTasks, /* 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/ohos/flutter_huawei_login/ohos/oh-package.json5 b/ohos/flutter_huawei_login/ohos/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..cab4e0d36b1abbf3ae8897fe19484f6e1c68842f --- /dev/null +++ b/ohos/flutter_huawei_login/ohos/oh-package.json5 @@ -0,0 +1,21 @@ +{ + "modelVersion": "5.0.0", + "name": "flutter_huawei_login", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": { + "@ohos/flutter_ohos": "file:./har/flutter.har" + }, + "devDependencies": { + "@ohos/hypium": "1.0.6" + }, + "overrides": { + "@ohos/flutter_ohos": "file:./har/flutter.har", + "fluttertoast": "file:./har/fluttertoast.har", + "webview_flutter_ohos": "file:./har/webview_flutter_ohos.har", + "@ohos/flutter_module": "file:./entry" + } +} \ No newline at end of file