From 49fc4fe8a8bc86ea9208aba9837ed38458baf932 Mon Sep 17 00:00:00 2001 From: jiahao <283739569@qq.com> Date: Mon, 23 Mar 2020 16:29:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=8D=A2=E5=9B=BE=E7=89=87=E5=8E=8B?= =?UTF-8?q?=E7=BC=A9=EF=BC=8C=E4=BF=AE=E5=A4=8D=E7=BC=A9=E7=95=A5=E5=9B=BE?= =?UTF-8?q?=E8=BF=87=E5=A4=A7=E6=B6=88=E6=81=AF=E5=8F=91=E9=80=81=E5=B4=A9?= =?UTF-8?q?=E6=BA=83=E8=A2=AB=E8=B8=A2=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .flutter-plugins-dependencies | 2 +- ios/Flutter/flutter_export_environment.sh | 5 ++-- ios/Podfile.lock | 18 +++++---------- lib/chat/util_keyboard.dart | 14 +++++++++--- lib/home/ConversActionPage.dart | 2 +- lib/home/homeMain.dart | 18 +-------------- lib/utils/image_util.dart | 28 +++++++++++++++-------- lib/utils/msgHandler.dart | 15 ++++++++---- lib/utils/screen_shot.dart | 16 +++++++++---- lib/utils/upload_util.dart | 1 + pubspec.lock | 14 ++++++------ pubspec.yaml | 4 ++-- 12 files changed, 73 insertions(+), 64 deletions(-) diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 3616769..10f2431 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -1 +1 @@ -{"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"agora_rtc_engine","dependencies":[]},{"name":"amap_location","dependencies":[]},{"name":"android_intent","dependencies":[]},{"name":"app_installer","dependencies":[]},{"name":"apple_sign_in","dependencies":[]},{"name":"audioplayer","dependencies":[]},{"name":"auto_orientation","dependencies":[]},{"name":"city_pickers","dependencies":[]},{"name":"connectivity","dependencies":[]},{"name":"easy_contact_picker","dependencies":[]},{"name":"file_picker","dependencies":[]},{"name":"flutter_app_badger","dependencies":[]},{"name":"flutter_audio_recorder","dependencies":[]},{"name":"flutter_bugly","dependencies":[]},{"name":"flutter_facebook_login","dependencies":[]},{"name":"flutter_ijkplayer","dependencies":[]},{"name":"flutter_image_compress","dependencies":[]},{"name":"flutter_inapp_purchase","dependencies":[]},{"name":"flutter_local_notifications","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"flutter_qr_reader","dependencies":["image_picker"]},{"name":"flutter_webview_plugin","dependencies":[]},{"name":"fluwx_no_pay","dependencies":[]},{"name":"geolocator","dependencies":["google_api_availability","location_permissions"]},{"name":"google_api_availability","dependencies":[]},{"name":"google_maps_flutter","dependencies":[]},{"name":"image_cropper","dependencies":[]},{"name":"image_gallery_saver","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"jpush_flutter","dependencies":[]},{"name":"keyboard_utils","dependencies":[]},{"name":"location","dependencies":[]},{"name":"location_permissions","dependencies":[]},{"name":"open_file","dependencies":[]},{"name":"package_info","dependencies":[]},{"name":"path_provider","dependencies":[]},{"name":"permission_handler","dependencies":[]},{"name":"photo_manager","dependencies":[]},{"name":"receive_sharing_intent","dependencies":[]},{"name":"share","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"sqflite","dependencies":[]},{"name":"url_launcher","dependencies":[]},{"name":"video_player","dependencies":[]},{"name":"video_thumbnail","dependencies":[]},{"name":"wifi_info_plugin","dependencies":[]}]} \ No newline at end of file +{"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"agora_rtc_engine","dependencies":[]},{"name":"amap_location","dependencies":[]},{"name":"android_intent","dependencies":[]},{"name":"app_installer","dependencies":[]},{"name":"apple_sign_in","dependencies":[]},{"name":"audioplayer","dependencies":[]},{"name":"auto_orientation","dependencies":[]},{"name":"city_pickers","dependencies":[]},{"name":"connectivity","dependencies":[]},{"name":"easy_contact_picker","dependencies":[]},{"name":"file_picker","dependencies":[]},{"name":"flutter_app_badger","dependencies":[]},{"name":"flutter_audio_recorder","dependencies":[]},{"name":"flutter_bugly","dependencies":[]},{"name":"flutter_facebook_login","dependencies":[]},{"name":"flutter_ijkplayer","dependencies":[]},{"name":"flutter_inapp_purchase","dependencies":[]},{"name":"flutter_local_notifications","dependencies":[]},{"name":"flutter_native_image","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"flutter_qr_reader","dependencies":["image_picker"]},{"name":"flutter_webview_plugin","dependencies":[]},{"name":"fluwx_no_pay","dependencies":[]},{"name":"geolocator","dependencies":["google_api_availability","location_permissions"]},{"name":"google_api_availability","dependencies":[]},{"name":"google_maps_flutter","dependencies":[]},{"name":"image_cropper","dependencies":[]},{"name":"image_gallery_saver","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"jpush_flutter","dependencies":[]},{"name":"keyboard_utils","dependencies":[]},{"name":"location","dependencies":[]},{"name":"location_permissions","dependencies":[]},{"name":"open_file","dependencies":[]},{"name":"package_info","dependencies":[]},{"name":"path_provider","dependencies":[]},{"name":"permission_handler","dependencies":[]},{"name":"photo_manager","dependencies":[]},{"name":"receive_sharing_intent","dependencies":[]},{"name":"share","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"sqflite","dependencies":[]},{"name":"url_launcher","dependencies":[]},{"name":"video_player","dependencies":[]},{"name":"video_thumbnail","dependencies":[]},{"name":"wifi_info_plugin","dependencies":[]}]} \ No newline at end of file diff --git a/ios/Flutter/flutter_export_environment.sh b/ios/Flutter/flutter_export_environment.sh index 4496333..ddb942e 100755 --- a/ios/Flutter/flutter_export_environment.sh +++ b/ios/Flutter/flutter_export_environment.sh @@ -2,10 +2,9 @@ # This is a generated file; do not edit or check into version control. export "FLUTTER_ROOT=/Users/random/sdk/flutter_sdk" export "FLUTTER_APPLICATION_PATH=/Users/random/code/flutter/project/qunliao" -export "FLUTTER_TARGET=/Users/random/code/flutter/project/qunliao/lib/main.dart" +export "FLUTTER_TARGET=lib/main.dart" export "FLUTTER_BUILD_DIR=build" export "SYMROOT=${SOURCE_ROOT}/../build/ios" -export "FLUTTER_FRAMEWORK_DIR=/Users/random/sdk/flutter_sdk/bin/cache/artifacts/engine/ios" +export "FLUTTER_FRAMEWORK_DIR=/Users/random/sdk/flutter_sdk/bin/cache/artifacts/engine/ios-release" export "FLUTTER_BUILD_NAME=1.0.5" export "FLUTTER_BUILD_NUMBER=6" -export "TRACK_WIDGET_CREATION=true" diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 291308e..7e8bdbd 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -54,13 +54,12 @@ PODS: - flutter_ijkplayer (0.0.1): - Flutter - FlutterIJK (~> 0.1.0) - - flutter_image_compress (0.0.1): - - Flutter - - Mantle - flutter_inapp_purchase (0.0.1): - Flutter - flutter_local_notifications (0.0.1): - Flutter + - flutter_native_image (0.0.1): + - Flutter - flutter_plugin_android_lifecycle (0.0.1): - Flutter - flutter_qr_reader (0.0.1): @@ -113,9 +112,6 @@ PODS: - Flutter - location_permissions (2.0.3): - Flutter - - Mantle (2.1.0): - - Mantle/extobjc (= 2.1.0) - - Mantle/extobjc (2.1.0) - open_file (0.0.1): - Flutter - package_info (0.0.1): @@ -169,9 +165,9 @@ DEPENDENCIES: - flutter_bugly (from `.symlinks/plugins/flutter_bugly/ios`) - flutter_facebook_login (from `.symlinks/plugins/flutter_facebook_login/ios`) - flutter_ijkplayer (from `.symlinks/plugins/flutter_ijkplayer/ios`) - - flutter_image_compress (from `.symlinks/plugins/flutter_image_compress/ios`) - flutter_inapp_purchase (from `.symlinks/plugins/flutter_inapp_purchase/ios`) - flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`) + - flutter_native_image (from `.symlinks/plugins/flutter_native_image/ios`) - flutter_plugin_android_lifecycle (from `.symlinks/plugins/flutter_plugin_android_lifecycle/ios`) - flutter_qr_reader (from `.symlinks/plugins/flutter_qr_reader/ios`) - flutter_webview_plugin (from `.symlinks/plugins/flutter_webview_plugin/ios`) @@ -216,7 +212,6 @@ SPEC REPOS: - JCore - JPush - libwebp - - Mantle - Reachability - TOCropViewController @@ -255,12 +250,12 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/flutter_facebook_login/ios" flutter_ijkplayer: :path: ".symlinks/plugins/flutter_ijkplayer/ios" - flutter_image_compress: - :path: ".symlinks/plugins/flutter_image_compress/ios" flutter_inapp_purchase: :path: ".symlinks/plugins/flutter_inapp_purchase/ios" flutter_local_notifications: :path: ".symlinks/plugins/flutter_local_notifications/ios" + flutter_native_image: + :path: ".symlinks/plugins/flutter_native_image/ios" flutter_plugin_android_lifecycle: :path: ".symlinks/plugins/flutter_plugin_android_lifecycle/ios" flutter_qr_reader: @@ -344,9 +339,9 @@ SPEC CHECKSUMS: flutter_bugly: c9800f4d5bc5bdc27ffdde3417a26ba44266e0c3 flutter_facebook_login: cfb5659f686b1c575ef205c6b6fd20db9679d3c4 flutter_ijkplayer: ef9006131553deb6d8ae6d7fbd3bcbf93b135930 - flutter_image_compress: f69d0e0e078ce52b4810695593bc861ee319ae7d flutter_inapp_purchase: 5c6a1ac3f11b11d0c8c0321c0c41c1f05805e4c8 flutter_local_notifications: 9e4738ce2471c5af910d961a6b7eadcf57c50186 + flutter_native_image: 9c0b7451838484458e5b0fae007b86a4c2d4bdfe flutter_plugin_android_lifecycle: 47de533a02850f070f5696a623995e93eddcdb9b flutter_qr_reader: 254fd9eea45a65ef461e050d6607daf9cfb753e8 flutter_webview_plugin: ed9e8a6a96baf0c867e90e1bce2673913eeac694 @@ -367,7 +362,6 @@ SPEC CHECKSUMS: libwebp: 057912d6d0abfb6357d8bb05c0ea470301f5d61e location: 3a2eed4dd2fab25e7b7baf2a9efefe82b512d740 location_permissions: 195ff2a1182fa9029ef3f2653156961ee5a1e40b - Mantle: 2fa750afa478cd625a94230fbf1c13462f29395b open_file: 02eb5cb6b21264bd3a696876f5afbfb7ca4f4b7d package_info: 48b108e75b8802c2d5e126f208ef540561c98aef path_provider: fb74bd0465e96b594bb3b5088ee4a4e7bb1f2a9d diff --git a/lib/chat/util_keyboard.dart b/lib/chat/util_keyboard.dart index a08eeac..94b843f 100644 --- a/lib/chat/util_keyboard.dart +++ b/lib/chat/util_keyboard.dart @@ -16,12 +16,14 @@ import 'package:chat/utils/HttpUtil.dart'; import 'package:chat/data/constants.dart'; import 'package:chat/utils/app_navigator.dart'; import 'package:chat/utils/blacklist_mgr.dart'; +import 'package:chat/utils/file_cache_mgr.dart'; import 'package:chat/utils/image_util.dart'; import 'package:chat/utils/msgHandler.dart'; import 'package:chat/utils/screen.dart'; import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_image_compress/flutter_image_compress.dart'; +import 'package:flutter_native_image/flutter_native_image.dart'; +//import 'package:flutter_image_compress/flutter_image_compress.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:image_picker/image_picker.dart'; import 'package:oktoast/oktoast.dart'; @@ -387,8 +389,14 @@ class _UtilKeyboardState extends State { if (thumbnail.length > ImgSizeLimit) { print('图片较大 ${thumbnail.length}'); - thumbnail = - await FlutterImageCompress.compressWithList(thumbnail, quality: 10); + File file =await FileCacheMgr().writeFile(DateTime.now().millisecondsSinceEpoch.toString(),thumbnail); + + File compressedFile = await FlutterNativeImage.compressImage(file.path, + quality: 20, percentage: 10); + thumbnail =compressedFile.readAsBytesSync().toList(); + + +// thumbnail = await FlutterImageCompress.compressWithList(thumbnail, quality: 10); print('压缩后 ${thumbnail.length}'); } diff --git a/lib/home/ConversActionPage.dart b/lib/home/ConversActionPage.dart index 21ed261..cf6b1e0 100644 --- a/lib/home/ConversActionPage.dart +++ b/lib/home/ConversActionPage.dart @@ -876,7 +876,7 @@ class _ConversActionPageState extends State @override Widget build(BuildContext context) { - List groupList = GroupInfoMgr().groupInfoList; +// List groupList = GroupInfoMgr().groupInfoList; return Scaffold( backgroundColor: Colors.white, diff --git a/lib/home/homeMain.dart b/lib/home/homeMain.dart index a46312c..ad5aa6d 100644 --- a/lib/home/homeMain.dart +++ b/lib/home/homeMain.dart @@ -368,14 +368,6 @@ class _HomeMainState extends State { // ]; _navigationViews = [ -// NavigationIconView( -// title: _titles[2], -// icon: IconData( -// 0xe67c, -// fontFamily: 'iconfont', -// ), -// isShowdot: true, -// iconSize: 29), NavigationIconView( title: _titles[1], isShowdot: true, @@ -403,15 +395,6 @@ class _HomeMainState extends State { ), isCenter: true, iconSize: 31), -// NavigationIconView( -// title: _titles[1], -// isShowdot: true, -// icon: IconData( -// 0xe60b, -// fontFamily: 'iconfont', -// ), -// type: 6, -// iconSize: 26.5), NavigationIconView( title: _titles[3], @@ -420,6 +403,7 @@ class _HomeMainState extends State { fontFamily: 'iconfont', ), type: 4, + isShowdot: true, iconSize: 26.5), NavigationIconView( diff --git a/lib/utils/image_util.dart b/lib/utils/image_util.dart index 0c1fc00..fed7671 100644 --- a/lib/utils/image_util.dart +++ b/lib/utils/image_util.dart @@ -9,7 +9,8 @@ import 'package:chat/utils/screen.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/widgets.dart'; -import 'package:flutter_image_compress/flutter_image_compress.dart'; +//import 'package:flutter_image_compress/flutter_image_compress.dart'; +import 'package:flutter_native_image/flutter_native_image.dart'; import '../r.dart'; import 'file_cache_mgr.dart'; @@ -67,16 +68,23 @@ class WidgetUtil { } static getCompressImg(String imgPath) async { - var compressImg = await FlutterImageCompress.compressWithFile(imgPath, - quality: 20, minWidth: Screen.width.toInt()); - print('图片压缩完毕 : ${compressImg.length}'); - if (compressImg.length > ImgSizeLimit) { - //仍大于,再压缩一次 - compressImg = await FlutterImageCompress.compressWithFile(imgPath, - quality: 20, minWidth: (Screen.width * 0.5).toInt()); - } - return compressImg; + File compressedFile = await FlutterNativeImage.compressImage(imgPath, + quality: 20, percentage: 10); + var k =compressedFile.readAsBytesSync().toList(); + print('A图片压缩完毕 : ${k.length}'); +// compressedFile. + +// var compressImg = await FlutterImageCompress.compressWithFile(imgPath, +// quality: 20, minWidth: Screen.width.toInt()); +// print('B图片压缩完毕 : ${compressImg.length}'); +// if (compressImg.length > ImgSizeLimit) { +// //仍大于,再压缩一次 +// compressImg = await FlutterImageCompress.compressWithFile(imgPath, +// quality: 20, minWidth: (Screen.width * 0.5).toInt()); +// } + + return k; } ///Get the coordinates of the widget on the screen.Widgets must be rendered completely. diff --git a/lib/utils/msgHandler.dart b/lib/utils/msgHandler.dart index ace074f..f661f0c 100644 --- a/lib/utils/msgHandler.dart +++ b/lib/utils/msgHandler.dart @@ -251,7 +251,8 @@ class MsgHandler { NetWork().sendMsg(ComId.Chat, 5, seq); } - static int tempGroupId=0; +// static int tempGroupId=0; +// static int receivedCount=0; static handlerReceiveMsg(PushChat chat) async { bool isGroup = false; if (chat.channelType == ChatChannelType.Group) { @@ -432,6 +433,8 @@ class MsgHandler { // receivedCount++; + + int sessionId = chat.targetId; print('sessionId $sessionId'); if (isGroup) { @@ -442,8 +445,8 @@ class MsgHandler { if (groupInfo != null) { showGroup = groupInfo.messageFree == 0; } - if (showGroup && tempGroupId!=sessionId) { - tempGroupId = sessionId; + if (showGroup ) { +// tempGroupId = sessionId; LocalNotificationUtil.instance.show( I18n.of(context).notice, I18n.of(context).new_chat_msg, id: sessionId > 1000 @@ -460,8 +463,12 @@ class MsgHandler { chat.contentBuff, chat.sendTime.toInt(), chat.targetId, channelType: chat.channelType.value); -// String content =utf8.decode(msgModel.msgContent); +// if (chat.cType == ChatType.TextChatType){ +// String content =utf8.decode(msgModel.msgContent); // print('当前收到消息条数$receivedCount $content'); +// } + + if (chat.hasTencentTranslate()) { msgModel.translateContent = chat.tencentTranslate; diff --git a/lib/utils/screen_shot.dart b/lib/utils/screen_shot.dart index 2ecf27d..ee13c20 100644 --- a/lib/utils/screen_shot.dart +++ b/lib/utils/screen_shot.dart @@ -3,8 +3,10 @@ import 'dart:io'; import 'package:chat/map/location_result.dart'; import 'package:chat/utils/screen.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_image_compress/flutter_image_compress.dart'; +import 'package:flutter_native_image/flutter_native_image.dart'; +//import 'package:flutter_image_compress/flutter_image_compress.dart'; import 'MessageMgr.dart'; +import 'file_cache_mgr.dart'; class ScreenShot { static const MethodChannel _channel = const MethodChannel('make.photo.screen.hibok'); @@ -15,10 +17,16 @@ class ScreenShot { Map args = {}; Uint8List bytes = await _channel.invokeMethod('makePhotoScreen', args); - var compressImg = await FlutterImageCompress.compressWithList(bytes, - quality: 20, minWidth: (Screen.width).toInt()); + File file =await FileCacheMgr().writeFile(DateTime.now().millisecondsSinceEpoch.toString(),bytes); + File compressedFile = await FlutterNativeImage.compressImage(file.path, + quality: 20, percentage: 80); + var compressImg =compressedFile.readAsBytesSync().toList(); - print('地图大小${bytes.length}'); + +// var compressImg = await FlutterImageCompress.compressWithList(bytes, +// quality: 20, minWidth: (Screen.width).toInt()); + + print('地图大小${bytes.length} 压缩后${compressImg.length} '); return compressImg; } diff --git a/lib/utils/upload_util.dart b/lib/utils/upload_util.dart index 701a160..fb0ffde 100644 --- a/lib/utils/upload_util.dart +++ b/lib/utils/upload_util.dart @@ -140,6 +140,7 @@ class UploadUtil { streamController.close(); streamMap.remove(msg.extraFile); print('uploadFile response $response'); + print('###msgContent ${msg.msgContent.length}'); if (response.data['code'] == 0) { var data = response.data['data']; diff --git a/pubspec.lock b/pubspec.lock index db16726..665fcff 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -405,13 +405,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.3.5+1" - flutter_image_compress: - dependency: "direct main" - description: - name: flutter_image_compress - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.6.3" flutter_inapp_purchase: dependency: "direct main" description: @@ -431,6 +424,13 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_native_image: + dependency: "direct main" + description: + name: flutter_native_image + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.0.5+2" flutter_page_indicator: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 5005238..c894576 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -38,8 +38,8 @@ dependencies: oktoast: ^2.1.9 #压缩 - flutter_image_compress: ^0.6.3 - +# flutter_image_compress: ^0.6.3 + flutter_native_image: ^0.0.5 #视频封面 video_thumbnail: ^0.1.6