From 8174ad897264ae98b45568953866bb000e6c1982 Mon Sep 17 00:00:00 2001 From: Weller <1812208341@qq.com> Date: Wed, 30 Sep 2020 15:07:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AE=89=E5=8D=93=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E5=88=86=E4=BA=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dart_tool/package_config.json | 14 ++- example/android/app/build.gradle | 87 +++++++++++++++++++ .../android/app/src/main/AndroidManifest.xml | 3 + example/android/build.gradle | 2 + lib/widgets/share/share_alert.dart | 20 +++-- pubspec.yaml | 5 ++ 6 files changed, 125 insertions(+), 6 deletions(-) diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json index b85826b..478c315 100644 --- a/.dart_tool/package_config.json +++ b/.dart_tool/package_config.json @@ -325,6 +325,18 @@ "packageUri": "lib/", "languageVersion": "2.1" }, + { + "name": "permission_handler", + "rootUri": "file:///Users/fnuser/.pub-cache/git/permission_handler-b8c45c4c20221ac39fe083113fc360cc632f33a4/", + "packageUri": "lib/", + "languageVersion": "2.7" + }, + { + "name": "permission_handler_platform_interface", + "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/permission_handler_platform_interface-2.0.1", + "packageUri": "lib/", + "languageVersion": "2.6" + }, { "name": "petitparser", "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/petitparser-2.4.0", @@ -602,7 +614,7 @@ "languageVersion": "2.1" } ], - "generated": "2020-09-29T09:31:08.197502Z", + "generated": "2020-09-30T07:04:49.977484Z", "generator": "pub", "generatorVersion": "2.7.2" } diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index e3844e8..483f92d 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -1,3 +1,5 @@ +// 添加插件 + def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -59,3 +61,88 @@ dependencies { androidTestImplementation 'androidx.test:runner:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' } + + +// 注册SecVerify的相关信息 +//MobSDK { +//// appKey "2ed488d929488" +//// appSecret "53d4a16298d283828f2444cdd6d6548a" +// //手机验证登录 +// SecVerify {} +// +// //短信 +// SMSSDK {} +// +// //调用MobPush,推送 +//// MobPush { +//// //设置角标开关(不需要可不设置) +////// badge true +//// //集成其他推送通道(可选) +//// devInfo { +//// //华为推送配置信息 +//// HUAWEI { +//// appId "${HUAWEI_PUSH_ID}" +//// } +//// //魅族推送配置信息 +//// MEIZU { +//// appId "${MEIZHU_PUSH_APPID}" +//// appKey "${MEIZHU_PUSH_APPKEY}" +//// } +//// //小米推送配置信息 +//// XIAOMI { +//// appId "${XIAOMI_PUSH_APPID}" +//// appKey "${XIAOMI_PUSH_APPKEY}" +//// } +//// //FCM推送通道配置 +////// FCM { +//// //设置默认推送通知显示图标 +////// iconRes "@mipmap/ic_launcher" +////// } +//// //OPPO推送配置信息 +//// OPPO { +//// appKey "${OPPO_PUSH_APPKEY}" +//// appSecret "${OPPO_PUSH_APPSECRET}" +//// } +//// //VIVO推送配置信息 +//// VIVO { +//// appId "${VIVO_PUSH_APPID}" +//// appKey "${VIVO_PUSH_APPKEY}" +//// } +//// } +//// } +// +// //分享 +// ShareSDK { +// loopShare true +// devInfo { +// SinaWeibo { +// enable true +// } +// Wechat { +//// appId "${Wechat_appid}" +//// appSecret "${Wechat_appSecret}" +// enable true +// withShareTicket true +// bypassApproval false +// } +// QQ { +// enable true +// } +// WechatMoments { +// enable true +// } +// WechatFavorite { +// enable true +// } +// QZone { +// enable true +// } +// } +// } +// +// //网页打开app,接受邀请码 +// MobLink { +//// uriScheme "${uri_Scheme}" +//// appLinkHost "${app_LinkHost}" +// } +//} \ No newline at end of file diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index e8fcd71..82ca805 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -29,4 +29,7 @@ android:name="flutterEmbedding" android:value="2" /> + + + diff --git a/example/android/build.gradle b/example/android/build.gradle index e0d7ae2..36dc0b4 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -6,6 +6,8 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:3.5.0' + + classpath "com.mob.sdk:MobSDK:2018.0319.1724" } } diff --git a/lib/widgets/share/share_alert.dart b/lib/widgets/share/share_alert.dart index 87a4595..ca6e837 100644 --- a/lib/widgets/share/share_alert.dart +++ b/lib/widgets/share/share_alert.dart @@ -10,6 +10,8 @@ import 'package:zhiying_base_widget/widgets/share/models/share_data_model.dart'; import 'package:zhiying_base_widget/widgets/share/models/share_icon_model.dart'; import 'package:zhiying_comm/zhiying_comm.dart'; +import 'package:permission_handler/permission_handler.dart'; + class ShareAlert extends StatelessWidget { final String skipIdentifier; final Widget child; @@ -62,10 +64,10 @@ class _ShareAlertContentState extends State<_ShareAlertContent> { void initState() { NetUtil.request('/api/v1/mod/${widget.skipIdentifier}', method: NetMethod.GET, onCache: (data) { - _parseData(data); - }, onSuccess: (data) { - _parseData(data); - }, onError: (err) {}); + _parseData(data); + }, onSuccess: (data) { + _parseData(data); + }, onError: (err) {}); super.initState(); } @@ -117,7 +119,7 @@ class _ShareAlertContentState extends State<_ShareAlertContent> { ), Container( margin: - EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), + EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), child: _createIcons(), ), GestureDetector( @@ -186,6 +188,14 @@ class _ShareAlertContentState extends State<_ShareAlertContent> { ), ), onTap: () { + //检查是否有存储权限 + var status = await Permission.storage.status; + if (!status.isGranted) { + status = await Permission.storage.request(); + print(status); + return; + } + if (item.type == 'wx') { _shareByMob(ShareSDKPlatforms.wechatSession); } else if (item.type == 'pyq') { diff --git a/pubspec.yaml b/pubspec.yaml index 39e6f7e..7576b9a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -32,6 +32,11 @@ dependencies: #字符检测 string_validator: 0.1.4 intl: 0.15.7 + permission_handler: + git: + ref: 0.0.1 + url: http://192.168.0.138:3000/FnuoOS_Flutter_Components/permission_handler.git + zhiying_comm: path: ../zhiying_comm