Ver código fonte

添加安卓系统分享

tags/0.0.1
Weller 4 anos atrás
pai
commit
8174ad8972
6 arquivos alterados com 125 adições e 6 exclusões
  1. +13
    -1
      .dart_tool/package_config.json
  2. +87
    -0
      example/android/app/build.gradle
  3. +3
    -0
      example/android/app/src/main/AndroidManifest.xml
  4. +2
    -0
      example/android/build.gradle
  5. +15
    -5
      lib/widgets/share/share_alert.dart
  6. +5
    -0
      pubspec.yaml

+ 13
- 1
.dart_tool/package_config.json Ver arquivo

@@ -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"
}

+ 87
- 0
example/android/app/build.gradle Ver arquivo

@@ -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}"
// }
//}

+ 3
- 0
example/android/app/src/main/AndroidManifest.xml Ver arquivo

@@ -29,4 +29,7 @@
android:name="flutterEmbedding"
android:value="2" />
</application>

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest>

+ 2
- 0
example/android/build.gradle Ver arquivo

@@ -6,6 +6,8 @@ buildscript {

dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'

classpath "com.mob.sdk:MobSDK:2018.0319.1724"
}
}



+ 15
- 5
lib/widgets/share/share_alert.dart Ver arquivo

@@ -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') {


+ 5
- 0
pubspec.yaml Ver arquivo

@@ -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


Carregando…
Cancelar
Salvar