Jelajahi Sumber

[new]增加bugly

zk 9 bulan lalu
induk
melakukan
bd8760d896
5 mengubah file dengan 51 tambahan dan 17 penghapusan
  1. 4 3
      lib/data/consts/build_config.dart
  2. 19 13
      lib/main.dart
  3. 16 0
      lib/sdk/bugly/bugly_helper.dart
  4. 8 0
      pubspec.lock
  5. 4 1
      pubspec.yaml

+ 4 - 3
lib/data/consts/build_config.dart

@@ -10,10 +10,11 @@ final class BuildConfig {
   static const String qiyuKEY = "09ea6e0a6d006e25462906fbf6758c99";
 }
 
-final class UmengConfig {
-  UmengConfig._();
+final class BuglyConfig {
+  BuglyConfig._();
 
-  static const String umengIosAppKey = '67e11e7565c707471a29602e';
+  static const String buglyAndroidAppId = "9d862c5217";
+  static const String buglyIosAppId = "38cc655743";
 }
 
 final class WechatConfig {

+ 19 - 13
lib/main.dart

@@ -1,6 +1,7 @@
 import 'dart:io';
 
 import 'package:flutter/material.dart';
+import 'package:flutter_bugly/flutter_bugly.dart';
 import 'package:flutter_localizations/flutter_localizations.dart';
 import 'package:flutter_screenutil/flutter_screenutil.dart';
 import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
@@ -10,6 +11,7 @@ import 'package:location/resource/colors.gen.dart';
 import 'package:location/resource/string.gen.dart';
 import 'package:location/resource/string_source.dart';
 import 'package:location/router/app_pages.dart';
+import 'package:location/sdk/bugly/bugly_helper.dart';
 import 'package:location/sdk/gravity/gravity_helper.dart';
 import 'package:location/sdk/map/map_helper.dart';
 import 'package:location/sdk/qiyu/qi_yu_helper.dart';
@@ -26,22 +28,24 @@ import 'data/consts/build_config.dart';
 import 'data/consts/constants.dart';
 import 'device/device_info_util.dart';
 
-void main() async {
-  WidgetsFlutterBinding.ensureInitialized();
+void main() {
+  FlutterBugly.postCatchedException(() async {
+    WidgetsFlutterBinding.ensureInitialized();
 
-  //必要初始化
-  await initRequired();
+    //必要初始化
+    await initRequired();
 
-  //非隐私相关
-  initCommon();
+    //非隐私相关
+    initCommon();
 
-  runApp(const MyApp());
+    runApp(const MyApp());
 
-  //隐私相关:系统参数&第三方sdk初始化
-  await PrivacyCompliance.ensurePolicyGranted(AppInitTask());
+    //隐私相关:系统参数&第三方sdk初始化
+    await PrivacyCompliance.ensurePolicyGranted(AppInitTask());
 
-  //檢查地址
-  checkEnv();
+    //檢查地址
+    checkEnv();
+  });
 }
 
 Future<void> initRequired() async {
@@ -68,8 +72,10 @@ class AppInitTask implements EnsurePolicyGrant {
     //初始化基础信息
     await appInfoUtil.init();
     await deviceInfoUtil.init();
-    //初始化其他sdk
-    await MapHelper.init();
+    //bugly
+    BuglyHelper.init();
+    //地图sdk
+    MapHelper.init();
     //引力引擎
     GravityHelper.init();
     //七鱼客服

+ 16 - 0
lib/sdk/bugly/bugly_helper.dart

@@ -0,0 +1,16 @@
+import 'package:flutter_bugly/flutter_bugly.dart';
+import 'package:location/data/consts/build_config.dart';
+
+import '../../device/atmob_platform_info.dart';
+
+class BuglyHelper {
+  BuglyHelper._();
+
+  static void init() {
+    FlutterBugly.init(
+      androidAppId: BuglyConfig.buglyAndroidAppId,
+      iOSAppId: BuglyConfig.buglyIosAppId,
+      channel: atmobPlatformInfo.channelName,
+    );
+  }
+}

+ 8 - 0
pubspec.lock

@@ -338,6 +338,14 @@ packages:
     description: flutter
     source: sdk
     version: "0.0.0"
+  flutter_bugly:
+    dependency: "direct main"
+    description:
+      name: flutter_bugly
+      sha256: e5e0b64a19a1482fe37fda905ed518513f73ceef8da4de7de25719efd1a3682f
+      url: "https://pub.dev"
+    source: hosted
+    version: "1.1.0"
   flutter_contacts:
     dependency: "direct main"
     description:

+ 4 - 1
pubspec.yaml

@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
 # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
 # In Windows, build-name is used as the major, minor, and patch parts
 # of the product and file versions while build-number is used as the build suffix.
-version: 3.2.1+321
+version: 1.0.0+100
 
 environment:
   sdk: ^3.5.0
@@ -121,6 +121,9 @@ dependencies:
   flutter_tool_android:
     path: plugins/flutter_tool_android
 
+  #bugly
+  flutter_bugly: 1.1.0
+
   ######################地图########################
   flutter_map:
     path: plugins/map