From 0cd39a74f7a5471e81e0a5acd919f01109655f4a Mon Sep 17 00:00:00 2001 From: PH2 <1293456824@qq.com> Date: Tue, 18 May 2021 14:24:18 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81Bugly=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/models/app_config_model.dart | 33 +++++++++++++++++++++++++++++--- lib/register.dart | 14 ++++++++++++++ pubspec.yaml | 7 +++++++ 3 files changed, 51 insertions(+), 3 deletions(-) diff --git a/lib/models/app_config_model.dart b/lib/models/app_config_model.dart index 04da54b..823f428 100644 --- a/lib/models/app_config_model.dart +++ b/lib/models/app_config_model.dart @@ -76,9 +76,10 @@ class AppConfigKeyModel { AppConfigKeyItemModel jdIos; AppConfigKeyItemModel jdAndroid; AppConfigKeyItemModel taobao; + AppConfigKeyItemModel bugly; GDModel gd; - AppConfigKeyModel({this.weibo, this.qq, this.weixin, this.jdIos, this.jdAndroid,this.taobao}); + AppConfigKeyModel({this.weibo, this.qq, this.weixin, this.jdIos, this.jdAndroid, this.taobao, this.bugly}); AppConfigKeyModel.fromJson(Map json) { weibo = json['weibo'] != null ? new AppConfigKeyItemModel.fromJson(json['weibo']) : null; @@ -88,6 +89,7 @@ class AppConfigKeyModel { jdAndroid = json['jd_android'] != null ? new AppConfigKeyItemModel.fromJson(json['jd_android']) : null; taobao = json['taobao'] != null ? new AppConfigKeyItemModel.fromJson(json['taobao']) : null; gd = json['gd'] != null ? GDModel.fromJson(json['gd']) : null; + bugly = json['bugly_list'] != null ? new AppConfigKeyItemModel.fromJson(json['bugly_list']) : null; } Map toJson() { @@ -113,6 +115,9 @@ class AppConfigKeyModel { if (this.gd != null) { data['gd'] = this.gd.toJson(); } + if (this.bugly != null) { + data['bugly_list'] = this.bugly.toJson(); + } return data; } @@ -189,8 +194,22 @@ class AppConfigKeyItemModel { String universalLink; String androidKey; String iosKey; - - AppConfigKeyItemModel({this.appkey, this.secret, this.redirectUrl,this.androidKey,this.iosKey}); + String androidAppId; + String androidAppKey; + String iosAppId; + String iosAppKey; + + AppConfigKeyItemModel({ + this.appkey, + this.secret, + this.redirectUrl, + this.androidKey, + this.iosKey, + this.androidAppId, + this.androidAppKey, + this.iosAppId, + this.iosAppKey + }); AppConfigKeyItemModel.fromJson(Map json) { appId = json['app_id']; @@ -200,6 +219,10 @@ class AppConfigKeyItemModel { iosKey = json['ios_key']; redirectUrl = json['redirect_url']; universalLink = json['universal_link']; + androidAppId = json['android_appid']; + androidAppKey = json['android_appkey']; + iosAppId = json['ios_appid']; + iosAppKey = json['ios_appkey']; } Map toJson() { @@ -211,6 +234,10 @@ class AppConfigKeyItemModel { data['android_key'] = this.androidKey; data['ios_key'] = this.iosKey; data['universal_link'] = this.universalLink; + data['android_appid'] = this.androidAppId; + data['android_appkey'] = this.androidAppKey; + data['ios_appid'] = this.iosAppId; + data['ios_appkey'] = this.iosAppKey; return data; } } diff --git a/lib/register.dart b/lib/register.dart index 59e91a5..18104f6 100644 --- a/lib/register.dart +++ b/lib/register.dart @@ -104,6 +104,8 @@ import 'package:zhiying_comm/util/mob_util/mob_util.dart'; import 'package:zhiying_comm/util/taobao/taobao_auth.dart'; import 'package:package_info/package_info.dart'; import 'package:flutter_alibc/flutter_alibc.dart'; +import 'package:flutter_bugly/flutter_bugly.dart'; + class BaseWidgetRegister { /// 初始化方法 @@ -173,6 +175,18 @@ class BaseWidgetRegister { FlutterAlibc.initAlibc(version: "", appName: "").then((result) async { Logger.debug('初始化百川sdk ${result.errorCode} ${result.errorMessage}'); }); + + // bugly初始化 4a25b7aff3 3ff389c35d + if (!EmptyUtil.isEmpty(config?.keys?.bugly)) { + if (Platform.isAndroid && !EmptyUtil.isEmpty(config?.keys?.bugly?.androidAppId)) { + Logger.log('Bugly Android 初始化 = ' + config?.keys?.bugly?.toJson()?.toString()); + FlutterBugly.init(androidAppId: config?.keys?.bugly?.androidAppId, iOSAppId: config?.keys?.bugly?.iosAppId, autoCheckUpgrade: false); + } else if (Platform.isIOS && !EmptyUtil.isEmpty(config?.keys?.bugly?.iosAppId)) { + Logger.log('Bugly IOS 初始化 = ' + config?.keys?.bugly?.toJson()?.toString()); + FlutterBugly.init(androidAppId: config?.keys?.bugly?.androidAppId, iOSAppId: config?.keys?.bugly?.iosAppId, autoCheckUpgrade: false); + } + } + }); return null; diff --git a/pubspec.yaml b/pubspec.yaml index e158ecd..bd95e5e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -61,6 +61,13 @@ dependencies: flutter_user_agent: ^1.2.2 + # bug 奔溃收集 + flutter_bugly: + git: + ref: 0.0.1 + url: http://192.168.0.138:3000/FnuoOS_ZhiYing/flutter_bugly.git +# ath: ../flutter_bugly + zhiying_flutter_webview: git: url: http://192.168.0.138:3000/FnuoOS_ZhiYing/zhiying_flutter_webview.git