From 0b20ed092709178248cd7cb5227ff9fe58702176 Mon Sep 17 00:00:00 2001 From: CYH <13923927013@163.com> Date: Tue, 10 Oct 2023 17:08:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0bugly=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=EF=BC=8C=E6=94=B6=E9=9B=86=E7=A8=8B=E5=BA=8Fbug=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- circle_app/android/app/build.gradle | 6 +++ circle_app/ios/Podfile.lock | 10 ++++ circle_app/lib/main.dart | 72 ++++++++++++++++------------- circle_app/pubspec.lock | 8 ++++ circle_app/pubspec.yaml | 4 +- 5 files changed, 67 insertions(+), 33 deletions(-) diff --git a/circle_app/android/app/build.gradle b/circle_app/android/app/build.gradle index d4b80e4..6f534dd 100644 --- a/circle_app/android/app/build.gradle +++ b/circle_app/android/app/build.gradle @@ -58,6 +58,12 @@ android { keyPassword 'leyuan' } } + + lintOptions { + // 如打包出现Failed to transform libs.jar to match attributes + checkReleaseBuilds false + } + defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.leyuan.app" diff --git a/circle_app/ios/Podfile.lock b/circle_app/ios/Podfile.lock index 6ccd188..604b3e1 100644 --- a/circle_app/ios/Podfile.lock +++ b/circle_app/ios/Podfile.lock @@ -1,6 +1,7 @@ PODS: - audioplayers_darwin (0.0.1): - Flutter + - Bugly (2.5.93) - camera_avfoundation (0.0.1): - Flutter - connectivity (0.0.1): @@ -51,6 +52,9 @@ PODS: - Flutter (1.0.0) - flutter_apns_only (0.0.1): - Flutter + - flutter_bugly (0.0.1): + - Bugly + - Flutter - flutter_image_compress (1.0.0): - Flutter - Mantle @@ -169,6 +173,7 @@ DEPENDENCIES: - file_picker (from `.symlinks/plugins/file_picker/ios`) - Flutter (from `Flutter`) - flutter_apns_only (from `.symlinks/plugins/flutter_apns_only/ios`) + - flutter_bugly (from `.symlinks/plugins/flutter_bugly/ios`) - flutter_image_compress (from `.symlinks/plugins/flutter_image_compress/ios`) - flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`) - flutter_plugin_record_plus (from `.symlinks/plugins/flutter_plugin_record_plus/ios`) @@ -199,6 +204,7 @@ DEPENDENCIES: SPEC REPOS: trunk: + - Bugly - DKImagePickerController - DKPhotoGallery - FMDB @@ -235,6 +241,8 @@ EXTERNAL SOURCES: :path: Flutter flutter_apns_only: :path: ".symlinks/plugins/flutter_apns_only/ios" + flutter_bugly: + :path: ".symlinks/plugins/flutter_bugly/ios" flutter_image_compress: :path: ".symlinks/plugins/flutter_image_compress/ios" flutter_native_splash: @@ -292,6 +300,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40 + Bugly: b8715e6ec4004b7f7fbffab0643ba80545aee3da camera_avfoundation: 3125e8cd1a4387f6f31c6c63abb8a55892a9eeeb connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467 device_info: d7d233b645a32c40dfdc212de5cf646ca482f175 @@ -303,6 +312,7 @@ SPEC CHECKSUMS: file_picker: ce3938a0df3cc1ef404671531facef740d03f920 Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 flutter_apns_only: 3d91c0ca9dbef4439874858590909a19f8ed06a4 + flutter_bugly: c9800f4d5bc5bdc27ffdde3417a26ba44266e0c3 flutter_image_compress: 5a5e9aee05b6553048b8df1c3bc456d0afaac433 flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef flutter_plugin_record_plus: 79b8e13ee7ed9a94f6c067018653599528cee1fc diff --git a/circle_app/lib/main.dart b/circle_app/lib/main.dart index 607d0a6..653042a 100644 --- a/circle_app/lib/main.dart +++ b/circle_app/lib/main.dart @@ -14,6 +14,7 @@ import 'package:circle_app/util/device.dart'; import 'package:circle_app/util/util.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_bugly/flutter_bugly.dart'; import 'package:flutter_native_splash/flutter_native_splash.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; @@ -36,14 +37,23 @@ final TUIChatSeparateViewModel chatSeparateViewModel = TUIChatSeparateViewModel(); void main() { + WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized(); FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding); - runApp(const MyApp()); + FlutterBugly.postCatchedException(() { + // 如果需要 ensureInitialized,请在这里运行。 + // WidgetsFlutterBinding.ensureInitialized(); + runApp(MyApp()); + FlutterBugly.init( + androidAppId: "8509314e11", + iOSAppId: "51e7b4e472", + ); + }); if (Platform.isAndroid) { getLostData(); } - } + Future getLostData() async { final ImagePicker picker = ImagePicker(); final LostDataResponse response = await picker.retrieveLostData(); @@ -57,14 +67,15 @@ Future getLostData() async { _handleError(response.exception); } } + void _handleLostFiles(List file) {} Future _handleError(dynamic error) async { // 处理错误,例如记录错误或显示错误消息 print('Error occurred: $error'); // 在界面上显示错误消息 showToast('内存异常,请重新上传'); - } + int IM_SDK_APP_ID = 1400799631; String IOS_APP_ID = ""; @@ -81,8 +92,12 @@ loginIM(String userId, String sig) async { .v2TIMManager .getMessageManager() .setC2CReceiveMessageOpt( - userIDList: ['qpqz_dev_10_10000000000','qpqz_prod_10_10000000000'], // 需要设置的用户id列表 - opt: ReceiveMsgOptEnum.V2TIM_RECEIVE_NOT_NOTIFY_MESSAGE); // 用户消息接收选项属性 + userIDList: [ + 'qpqz_dev_10_10000000000', + 'qpqz_prod_10_10000000000' + ], // 需要设置的用户id列表 + opt: ReceiveMsgOptEnum + .V2TIM_RECEIVE_NOT_NOTIFY_MESSAGE); // 用户消息接收选项属性 if (setC2CReceiveMessageOptRes.code == 0) { //设置成功 } @@ -98,12 +113,12 @@ logoutIM() async { //获取设备Token,获取成功后开启离线推送 void uploadBuzIDAndToken() async { bool isAgreemement = await getAgreemement(); - if(!isAgreemement){ + if (!isAgreemement) { return; } // if (Platform.isAndroid) { - initWxApi(); + initWxApi(); // } await ChannelPush.init((msg) {}); @@ -305,11 +320,10 @@ class _MyAppState extends State with WidgetsBindingObserver { initIM(); WidgetsBinding.instance.addObserver(this); - // uploadBuzIDAndToken(); loadBgImage(); super.initState(); - addPayNotifi(); + addPayNotifi(); } @override @@ -354,7 +368,6 @@ class _MyAppState extends State with WidgetsBindingObserver { @override Future setOfflinePushStatus( {required AppStatus status, int? totalCount}) { - if (status == AppStatus.foreground) { // 当应用status为前台时,上报doForeground() return TencentImSDKPlugin.v2TIMManager @@ -458,7 +471,6 @@ class _MyAppState extends State with WidgetsBindingObserver { await precacheImage(precacheImages(_guideList.last), context); await precacheImage(AssetImage(getCircleImage('circle_bg')), context, size: Size(Get.width, Get.height)); - } precacheImages(String image) { @@ -474,31 +486,29 @@ class _MyAppState extends State with WidgetsBindingObserver { minTextAdapt: true, splitScreenMode: true, builder: (context, child) { - return - RefreshConfiguration( - footerBuilder: () => CustomLoadFooter(), - child: OKToast( + return RefreshConfiguration( + footerBuilder: () => CustomLoadFooter(), + child: OKToast( // 2-A: wrap your app with OKToast - textStyle: const TextStyle(fontSize: 19.0, color: Colors.white), - backgroundColor: Colors.grey, - animationCurve: Curves.easeIn, - // animationBuilder: const Miui10AnimBuilder(), - animationDuration: const Duration(milliseconds: 200), - duration: const Duration(seconds: 2), - child: GetMaterialApp( - title: '微乐园', - initialBinding: SplashBinding(), - getPages: AppPages.routes, - home: SplashPage(), - builder: FlutterSmartDialog.init(), - debugShowCheckedModeBanner: false, - ))) - ; + textStyle: + const TextStyle(fontSize: 19.0, color: Colors.white), + backgroundColor: Colors.grey, + animationCurve: Curves.easeIn, + // animationBuilder: const Miui10AnimBuilder(), + animationDuration: const Duration(milliseconds: 200), + duration: const Duration(seconds: 2), + child: GetMaterialApp( + title: '微乐园', + initialBinding: SplashBinding(), + getPages: AppPages.routes, + home: SplashPage(), + builder: FlutterSmartDialog.init(), + debugShowCheckedModeBanner: false, + ))); }); } void addPayNotifi() { IOSPayment.instance.startSubscription(); } - } diff --git a/circle_app/pubspec.lock b/circle_app/pubspec.lock index ef9065f..0e83aa2 100644 --- a/circle_app/pubspec.lock +++ b/circle_app/pubspec.lock @@ -574,6 +574,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.7.0" + flutter_bugly: + dependency: "direct main" + description: + name: flutter_bugly + sha256: a2d13cb35bedb907cb020ea4862264dcc9044675a49a8313bb3ab2e61af79c77 + url: "https://pub.dev" + source: hosted + version: "0.4.4" flutter_cache_manager: dependency: "direct main" description: diff --git a/circle_app/pubspec.yaml b/circle_app/pubspec.yaml index 8250fca..15c9b68 100644 --- a/circle_app/pubspec.yaml +++ b/circle_app/pubspec.yaml @@ -106,8 +106,8 @@ dependencies: qr_flutter: ^4.0.0 #本地目录 path_provider: ^2.1.0 - #第三方分享平台 -# sharesdk_plugin: 1.3.6 + #腾讯bugly + flutter_bugly: ^0.4.4 dev_dependencies: flutter_test: