From 1404fa08faef498fd1403ea6f8dfc3a97187ec38 Mon Sep 17 00:00:00 2001 From: jiahao <283739569@qq.com> Date: Wed, 15 Apr 2020 09:39:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A8=E9=80=81/=E4=BA=BA=E5=B7=A5=E7=BF=BB?= =?UTF-8?q?=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/app/agconnect-services.json | 2 +- android/app/build.gradle | 6 ++-- ios/Flutter/flutter_export_environment.sh | 9 +++-- ios/Runner.xcodeproj/project.pbxproj | 24 ++++++------- ios/Runner/Info.plist | 4 +-- lib/home/IndexPage.dart | 4 +++ lib/home/homeMain.dart | 1 + lib/main.dart | 3 +- lib/models/ChatMsg.dart | 3 +- lib/utils/HttpUtil.dart | 4 +-- lib/utils/local_notification_util.dart | 41 ++++++++++++----------- pubspec.yaml | 2 +- 12 files changed, 55 insertions(+), 48 deletions(-) diff --git a/android/app/agconnect-services.json b/android/app/agconnect-services.json index 2e60b4b..43da8b1 100644 --- a/android/app/agconnect-services.json +++ b/android/app/agconnect-services.json @@ -24,4 +24,4 @@ }, "region":"SG", "configuration_version":"1.0" -} +} \ No newline at end of file diff --git a/android/app/build.gradle b/android/app/build.gradle index 1857de0..eaf4d92 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -56,9 +56,9 @@ android { // manifestPlaceholders = [ // AMAP_KEY : "1fd4e93e3b4b13747da41f484c955fe2", /// 高德地图key // ] - // ndk { - // abiFilters 'armeabi-v7a' - // } + ndk { + abiFilters 'armeabi-v7a' + } multiDexEnabled true manifestPlaceholders = [ JPUSH_PKGNAME : 'com.cyhd.henhoandroid', diff --git a/ios/Flutter/flutter_export_environment.sh b/ios/Flutter/flutter_export_environment.sh index e87fbfb..71409d3 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/hibok" -export "FLUTTER_TARGET=/Users/random/code/flutter/project/hibok/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_BUILD_NAME=1.1.1" -export "FLUTTER_BUILD_NUMBER=16" -export "TRACK_WIDGET_CREATION=true" +export "FLUTTER_FRAMEWORK_DIR=/Users/random/sdk/flutter_sdk/bin/cache/artifacts/engine/ios-release" +export "FLUTTER_BUILD_NAME=1.1.2" +export "FLUTTER_BUILD_NUMBER=17" diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 0faefc9..9438061 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -560,7 +560,7 @@ CODE_SIGN_ENTITLEMENTS = Runner/RunnerProfile.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 14; + CURRENT_PROJECT_VERSION = 15; DEVELOPMENT_TEAM = QJ9M3998Q6; EMBEDDED_CONTENT_CONTAINS_SWIFT_CODE = YES; ENABLE_BITCODE = NO; @@ -575,7 +575,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 1.1.0; + MARKETING_VERSION = 1.1.2; PRODUCT_BUNDLE_IDENTIFIER = com.chengyouhudong.hibok; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -598,7 +598,7 @@ CODE_SIGN_ENTITLEMENTS = "Share Extension/Share Extension.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 14; + CURRENT_PROJECT_VERSION = 15; DEVELOPMENT_TEAM = QJ9M3998Q6; EMBEDDED_CONTENT_CONTAINS_SWIFT_CODE = NO; ENABLE_BITCODE = YES; @@ -606,7 +606,7 @@ INFOPLIST_FILE = "Share Extension/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 1.1.0; + MARKETING_VERSION = 1.1.2; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; OTHER_LDFLAGS = ""; @@ -632,7 +632,7 @@ CODE_SIGN_ENTITLEMENTS = "Share Extension/Share Extension.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 14; + CURRENT_PROJECT_VERSION = 15; DEVELOPMENT_TEAM = QJ9M3998Q6; EMBEDDED_CONTENT_CONTAINS_SWIFT_CODE = NO; ENABLE_BITCODE = YES; @@ -640,7 +640,7 @@ INFOPLIST_FILE = "Share Extension/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 1.1.0; + MARKETING_VERSION = 1.1.2; MTL_FAST_MATH = YES; OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = com.chengyouhudong.hibok.share; @@ -664,7 +664,7 @@ CODE_SIGN_ENTITLEMENTS = "Share Extension/Share ExtensionProfile.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 14; + CURRENT_PROJECT_VERSION = 15; DEVELOPMENT_TEAM = QJ9M3998Q6; EMBEDDED_CONTENT_CONTAINS_SWIFT_CODE = NO; ENABLE_BITCODE = YES; @@ -672,7 +672,7 @@ INFOPLIST_FILE = "Share Extension/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 1.1.0; + MARKETING_VERSION = 1.1.2; MTL_FAST_MATH = YES; OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = com.chengyouhudong.hibok.share; @@ -802,7 +802,7 @@ CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 14; + CURRENT_PROJECT_VERSION = 15; DEVELOPMENT_TEAM = QJ9M3998Q6; EMBEDDED_CONTENT_CONTAINS_SWIFT_CODE = YES; ENABLE_BITCODE = NO; @@ -817,7 +817,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 1.1.0; + MARKETING_VERSION = 1.1.2; PRODUCT_BUNDLE_IDENTIFIER = com.chengyouhudong.hibok; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -837,7 +837,7 @@ CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 14; + CURRENT_PROJECT_VERSION = 15; DEVELOPMENT_TEAM = QJ9M3998Q6; EMBEDDED_CONTENT_CONTAINS_SWIFT_CODE = YES; ENABLE_BITCODE = NO; @@ -852,7 +852,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 1.1.0; + MARKETING_VERSION = 1.1.2; PRODUCT_BUNDLE_IDENTIFIER = com.chengyouhudong.hibok; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 06d12f7..287cee7 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -122,6 +122,8 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight + UISupportsDocumentBrowser + UIViewControllerBasedStatusBarAppearance UTExportedTypeDeclarations @@ -188,8 +190,6 @@ io.flutter.embedded_views_preview - UISupportsDocumentBrowser - kTCCServiceMediaLibrary App need your agree, can visit your music diff --git a/lib/home/IndexPage.dart b/lib/home/IndexPage.dart index 8241a49..782911b 100644 --- a/lib/home/IndexPage.dart +++ b/lib/home/IndexPage.dart @@ -1,5 +1,6 @@ import 'package:chat/data/UserData.dart'; import 'package:chat/generated/i18n.dart'; +import 'package:chat/utils/local_notification_util.dart'; import 'package:chat/utils/screen.dart'; import 'package:connectivity/connectivity.dart'; import 'package:flutter/cupertino.dart'; @@ -37,6 +38,9 @@ class _IndexPageState extends State { @override void initState() { super.initState(); + print('index page--'); + LocalNotificationUtil.instance.initJPush(); + LocalNotificationUtil.instance.initLocalPush(); fluwx.responseFromAuth.listen((data) { if (data.errCode == 0) { getLoginData(data.code); diff --git a/lib/home/homeMain.dart b/lib/home/homeMain.dart index 9c396dc..ebe9833 100644 --- a/lib/home/homeMain.dart +++ b/lib/home/homeMain.dart @@ -152,6 +152,7 @@ class _HomeMainState extends State { @override void initState() { + SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.light); super.initState(); LocalNotificationUtil.instance.initState(context); diff --git a/lib/main.dart b/lib/main.dart index 2a7467e..f4d516a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -71,8 +71,7 @@ initLocalData() async { void main() async { WidgetsFlutterBinding.ensureInitialized(); - LocalNotificationUtil.instance.initJPush(); - LocalNotificationUtil.instance.initLocalPush(); + await FileCacheMgr.initPathKey(); await SqlUtil.init(); diff --git a/lib/models/ChatMsg.dart b/lib/models/ChatMsg.dart index bcd307a..d08384a 100644 --- a/lib/models/ChatMsg.dart +++ b/lib/models/ChatMsg.dart @@ -285,7 +285,8 @@ class MsgModel { 'SendTime': DateUtils() .getFormartData(timeSamp: time, format: 'yyyy-MM-dd hh:mm:ss'), 'Content': base64Encode(utf8.encode(desc)), - 'UserId': from + 'UserId': from, + 'ChatType':msgType }; } } diff --git a/lib/utils/HttpUtil.dart b/lib/utils/HttpUtil.dart index 1f35c0c..df8f6c1 100644 --- a/lib/utils/HttpUtil.dart +++ b/lib/utils/HttpUtil.dart @@ -44,9 +44,9 @@ class HttpUtil { //static const String BaseUrl = 'http://192.168.0.223:7001/'; //static const String BaseUrl = 'http://192.168.0.207:9080/'; - static const String BaseUrl = 'http://120.79.107.63:9080/'; +// static const String BaseUrl = 'http://120.79.107.63:9080/'; //static const String BaseUrl = 'http://192.168.0.177:9016/'; - //static const String BaseUrl = 'https://datasm.chengyouhd.com/'; + static const String BaseUrl = 'https://datasm.chengyouhd.com/'; static HttpUtil _getInstance() { if (_instance == null) { diff --git a/lib/utils/local_notification_util.dart b/lib/utils/local_notification_util.dart index 1ea3828..807d508 100644 --- a/lib/utils/local_notification_util.dart +++ b/lib/utils/local_notification_util.dart @@ -36,7 +36,7 @@ class LocalNotificationUtil { /// date+@+节目id static const String PAYLOAD_OTHER = 'other'; - + JPush jpush = new JPush(); /// 其他 LocalNotificationUtil._internal() { @@ -58,7 +58,7 @@ class LocalNotificationUtil { BehaviorSubject selectNotificationSubject = BehaviorSubject(); void initJPush() { - JPush jpush = new JPush(); + ///ios一定要加这句 jpush.applyPushAuthority( @@ -117,7 +117,7 @@ class LocalNotificationUtil { jpush.setup( appKey: "13dd603952a6632d1dd3ac54", channel: "theChannel", - production: false, + production: true, debug: true, // 设置是否打印 debug 日志 ); jpush.getRegistrationID().then((rid) { @@ -126,24 +126,27 @@ class LocalNotificationUtil { } void setAlias() { - JPush jpush = new JPush(); print('flutter jpush setAlias ${UserData().basicInfo.userId.toString()}'); - jpush.setAlias(UserData().basicInfo.userId.toString()).then((map) {}); - jpush.addTags( - ["yueliao", 'yueliao_' + UserData().language.toString()], - ).then((map) {}); + try{ + jpush.setAlias(UserData().basicInfo.userId.toString()).then((map) {}); + jpush.addTags( + ["yueliao", 'yueliao_' + UserData().language.toString()], + ).then((map) {}); + + if (Platform.isIOS) { + jpush.getLaunchAppNotification().then((map) { + print('getLaunchAppNotification $map'); + Map jExtra = map['extras']; + String payload = getPayload(jExtra); + print('onOpenNotification payload:$payload'); + goPage(payload); + FlutterAppBadger.removeBadge(); + }).catchError((error) { + print('getLaunchAppNotificationerror $error'); + }); + } + }catch(e){ - if (Platform.isIOS) { - jpush.getLaunchAppNotification().then((map) { - print('getLaunchAppNotification $map'); - Map jExtra = map['extras']; - String payload = getPayload(jExtra); - print('onOpenNotification payload:$payload'); - goPage(payload); - FlutterAppBadger.removeBadge(); - }).catchError((error) { - print('getLaunchAppNotificationerror $error'); - }); } } diff --git a/pubspec.yaml b/pubspec.yaml index d34cf33..d190d37 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: chat description: A new Flutter project. #修改版本号后get-clean -version: 1.1.1+16 +version: 1.1.2+17 environment: sdk: ">=2.1.0 <3.0.0"