From b1caca4dd2a4434893ff6adbb748d9783bae4dd2 Mon Sep 17 00:00:00 2001 From: GeJiaXiang <353358601@qq.com> Date: Mon, 18 Mar 2024 14:28:46 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=B7=BB=E5=8A=A0apk=E5=91=BD=E4=BB=A42?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- star_lock/android/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/star_lock/android/.gitignore b/star_lock/android/.gitignore index b0d3c96a..6b39c5de 100644 --- a/star_lock/android/.gitignore +++ b/star_lock/android/.gitignore @@ -13,3 +13,4 @@ GeneratedPluginRegistrant.java #key.properties #**/*.keystore #**/*.jks +/bundletool.jar From 7cc1e40b365855dbf6d970061a12ead81ce69265 Mon Sep 17 00:00:00 2001 From: Daisy <> Date: Tue, 19 Mar 2024 18:26:07 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=9B=B4=E6=8D=A2=E4=B8=BA=E6=9E=81?= =?UTF-8?q?=E5=85=89=E6=8E=A8=E9=80=81=EF=BC=88=E5=AE=89=E5=8D=93=E5=89=8D?= =?UTF-8?q?=E5=8F=B0=E6=94=B6=E6=B6=88=E6=81=AF=E6=B5=8B=E8=AF=95=E9=80=9A?= =?UTF-8?q?=E8=BF=87=E3=80=81iOS=E5=89=8D=E5=90=8E=E5=8F=B0=E9=83=BD?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E9=80=9A=E8=BF=87=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- star_lock/android/app/build.gradle | 26 ++- .../android/app/src/main/AndroidManifest.xml | 85 ++++++---- .../kotlin/com/skychip/lock/MainActivity.kt | 21 +-- star_lock/android/build.gradle | 17 +- star_lock/ios/Podfile | 1 + .../ios/Runner/AliyunEmasServices-Info.plist | 20 +-- star_lock/ios/Runner/AppDelegate.h | 7 +- star_lock/ios/Runner/AppDelegate.m | 38 +++-- star_lock/ios/Runner/Info.plist | 160 +++++++++--------- star_lock/lib/app.dart | 52 +++--- star_lock/lib/tools/jpush_flutter.dart | 33 ++++ star_lock/lib/tools/xs_aliyunPush.dart | 2 + star_lock/pubspec.yaml | 1 + 13 files changed, 263 insertions(+), 200 deletions(-) create mode 100644 star_lock/lib/tools/jpush_flutter.dart diff --git a/star_lock/android/app/build.gradle b/star_lock/android/app/build.gradle index 93273b5f..4370f69c 100644 --- a/star_lock/android/app/build.gradle +++ b/star_lock/android/app/build.gradle @@ -23,7 +23,7 @@ if (flutterVersionName == null) { } apply plugin: 'com.android.application' -apply plugin: 'com.aliyun.ams.emas-services' // 引用emas-services插件 +// apply plugin: 'com.aliyun.ams.emas-services' // 引用emas-services插件 apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" @@ -114,7 +114,7 @@ android { } defaultConfig { - + applicationId "com.skychip.lock" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. minSdkVersion 25 @@ -129,6 +129,18 @@ android { //设置支持的SO库架构(开发者可以根据需要,选择一个或多个平台的so) abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86","x86_64" } + + manifestPlaceholders = [ + JPUSH_PKGNAME : "com.skychip.lock", + //JPush 上注册的包名对应的 Appkey. + JPUSH_APPKEY : "7ff37d174c1a568a89e98dad", + //暂时填写默认值即可. + JPUSH_CHANNEL : "flutter_channel", + + //若不集成厂商通道,可直接跳过以下配置 + XIAOMI_APPID : "MI-2882303761520287291", + XIAOMI_APPKEY : "MI-5352028744291", + ] splits { abi { enable true @@ -140,6 +152,7 @@ android { } } } + buildTypes { release { // 高德地图导致release编译模式下应用闪退,根据:[高德地图在Debug模式下运行正常但是打Release包时则闪退解决办法](https://blog.csdn.net/weixin_39370093/article/details/109631210) @@ -163,7 +176,10 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation('com.amap.api:location:5.6.0') implementation('com.amap.api:3dmap:8.1.0') - implementation 'com.aliyun.ams:alicloud-android-push:3.8.7' - //小米依赖 - implementation 'com.aliyun.ams:alicloud-android-third-push-xiaomi:3.8.7' +// implementation 'com.aliyun.ams:alicloud-android-push:3.8.7' +// //小米依赖 +// implementation 'com.aliyun.ams:alicloud-android-third-push-xiaomi:3.8.7' +// implementation 'cn.jiguang.sdk:jpush:4.0.9' +// implementation 'cn.jiguang.sdk:jcore:2.8.2' +// implementation 'cn.jiguang.sdk.plugin:xiaomi:4.0.9'//版本号和对应的JPush版本号相同 } diff --git a/star_lock/android/app/src/main/AndroidManifest.xml b/star_lock/android/app/src/main/AndroidManifest.xml index 25941a2b..112101d3 100644 --- a/star_lock/android/app/src/main/AndroidManifest.xml +++ b/star_lock/android/app/src/main/AndroidManifest.xml @@ -1,4 +1,4 @@ - + @@ -18,10 +18,6 @@ - - - - @@ -35,7 +31,10 @@ - + + @@ -49,36 +48,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -94,5 +64,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/star_lock/android/app/src/main/kotlin/com/skychip/lock/MainActivity.kt b/star_lock/android/app/src/main/kotlin/com/skychip/lock/MainActivity.kt index f3c4205b..33902047 100644 --- a/star_lock/android/app/src/main/kotlin/com/skychip/lock/MainActivity.kt +++ b/star_lock/android/app/src/main/kotlin/com/skychip/lock/MainActivity.kt @@ -16,9 +16,7 @@ import com.alibaba.sdk.android.push.register.MiPushRegister class MainActivity: FlutterActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - initAliyunPushService() - - MiPushRegister.register(applicationContext, "2882303761520287291", "5352028744291"); +// initJPushService() GeneratedPluginRegistrant.registerWith(flutterEngine!!) MethodChannel(flutterEngine?.dartExecutor!!.binaryMessenger, "starLockFlutterSend").setMethodCallHandler { call, result -> @@ -63,23 +61,6 @@ class MainActivity: FlutterActivity() { startActivity(Intent.createChooser(shareIntent, null)) } - private fun initAliyunPushService() { - PushServiceFactory.init(applicationContext) - val pushService = PushServiceFactory.getCloudPushService() - - val callback = object : CommonCallback, com.alibaba.sdk.android.push.CommonCallback { - override fun onSuccess(response: String?) { - Log.e("TAG","success $response") - } - - override fun onFailed(errorCode: String?, errorMessage: String?) { - Log.e("TAG","error $errorMessage") - } - } - - pushService.register(applicationContext,callback) - } - override fun configureFlutterEngine(flutterEngine: FlutterEngine) { GeneratedPluginRegistrant.registerWith(flutterEngine); MethodChannel(flutterEngine.dartExecutor.binaryMessenger, "starLockFlutterSend").setMethodCallHandler { diff --git a/star_lock/android/build.gradle b/star_lock/android/build.gradle index bb5a7cca..67d2c573 100644 --- a/star_lock/android/build.gradle +++ b/star_lock/android/build.gradle @@ -4,16 +4,17 @@ buildscript { google() mavenCentral() mavenLocal() - maven { // 添加Maven仓库地址 - url 'https://maven.aliyun.com/nexus/content/repositories/releases/' - } +// maven { // 添加Maven仓库地址 +// url 'https://maven.aliyun.com/nexus/content/repositories/releases/' +// } } dependencies { classpath 'com.android.tools.build:gradle:7.1.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // 添加emas-services插件 - classpath 'com.aliyun.ams:emas-services:1.0.4' +// classpath 'com.aliyun.ams:emas-services:1.0.4' + // classpath "cn.jiguang.sdk:jpush:4.0.9" } } @@ -21,11 +22,11 @@ buildscript { allprojects { repositories { google() -// mavenCentral() + mavenCentral() jcenter() - maven { // 添加Maven仓库地址 - url 'https://maven.aliyun.com/nexus/content/repositories/releases/' - } +// maven { // 添加Maven仓库地址 +// url 'https://maven.aliyun.com/nexus/content/repositories/releases/' +// } } } diff --git a/star_lock/ios/Podfile b/star_lock/ios/Podfile index fc1e6a3b..f60e3f48 100644 --- a/star_lock/ios/Podfile +++ b/star_lock/ios/Podfile @@ -36,6 +36,7 @@ end source 'https://github.com/CocoaPods/Specs.git' source 'https://github.com/aliyun/aliyun-specs.git' pod 'AlicloudPush', '~> 1.9.9' +pod 'JPush' post_install do |installer| installer.pods_project.targets.each do |target| diff --git a/star_lock/ios/Runner/AliyunEmasServices-Info.plist b/star_lock/ios/Runner/AliyunEmasServices-Info.plist index ea7823a7..4b1af180 100644 --- a/star_lock/ios/Runner/AliyunEmasServices-Info.plist +++ b/star_lock/ios/Runner/AliyunEmasServices-Info.plist @@ -5,23 +5,23 @@ config emas.appKey - 333904046 + 334068745 emas.appSecret - 3eead09a7fc7416cb4082319aa6f48c6 + bee9c200835e4951a85dc8709c319560 emas.bundleId cn.star-lock.starLock hotfix.idSecret - 333904046-2 + 334068745-2 hotfix.rsaSecret - MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCS0i6gEzmEoaXFe0gDcur1sdkE2ecWXRay3h+O11F0FmoNfQx+V4i+pt2se+KDAx/GQq8Axj4DnjzE4KT0TeVmrutI1FF4h2Tv5Ge9KT0yuCayiQPW5gkqTDxaehkRDyCzGkwaLkVslN2kFqammWsODTQw2a0/lziMrNpQU8bnjjYbKS1eIQUPM9s6smwN2A4RErAP7X1knsT1tCHoCgfgjZf1nddQSMw4vy9FBpKZDYD1gjdo5+U93VopVLpMqcbOVXbQeUwpArURNnY/dbSkrGsC2TXAfaYa+sVXPchy0pZ7C2wU2/6INkFBpw2QjFQ4uAcNXwoEn5x5iBw4VbnPAgMBAAECggEAfoowLT7kf+9iFIZgVrig0QlrZcb4aEnq2lafFFl3lnoLBX0VW37OGKNwwswzOX9jz1iBxEUYBb5H2ddT1Euev5Vaq/ZyEVOAJ1HQJzR3zlLw50c3y+uPUqlKCyDYod9L65FqrdXbd+4F6Pqsv0HTBtVSehfiPcBzuKrxrfHGqKKWx4C620SxPqtpNaYXaENyqfZ3qyKw+xtWGJtxjQ8DFkeWJ1C8O7ZxJ33SpwpEb9UIJpDtPcaKbwccLn/w5214kYAqE7m5aTmLUTFRYay2Hez1gPUKVirt/QDfEfHRv6xbv5jePl0snXWK0VwgoR3hL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Bq7/yfR+q+GX21e6bn6EGxtnFxWRmw/eJ1ja1AoGASDCRPeo/qTv8wIOatCFm0XVuBjjN6FgLAU8kpmicZxG2Vqoct8NkDaOajNnHNJbdG0yatc5DlIh9MO4/Eevbw27/bzS+4x1dM3DyehXaiEdCW6VGSBSFIPQXtsLCE/51BrQoucGDt0S5ZtWn147Wd1v+OEB9rMOc1NbFvVL1+o0CgYEApnA58wOgtxJGggaa4LS6T+VTsx73mzz3YP8AAHsgePeFCqS/MdDwaoLlAKBRkDm07KkaRh0/Nofn3jSRs7zlFHSOUmhsAI0htEQx1x4f3MoBIuDtozv/eMT/XbGrNsP2i696TN39stnczrV3ZD7jzFvveEHRARaF4MvuLcRBrdQ= httpdns.accountId - 125761 + 100674 httpdns.secretKey - f77f39c6f0e66d7c169aa7e8d87dfe13 + 6cd4984095d53f6f311424cc9299257b appmonitor.tlog.rsaSecret - MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCSlqdpwcdPniL1ahrYfTy47aD8Ay7D7qLyKO5QeXy64V+CQ0UvYwyTtfPRzvlXbwmc2ONjwKHq2B7SRhwHuBwURZNp5Iw1XaGCmqPPMOpL9UnYEIO90x3sFebIRHmXscyRVniGhmmdOXpVaP6BA3RWK1uwH/FBetzom6H+dcNMPQIDAQAB + MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCku9yUXBjd9m7V8fflC6XTwJEc8D8GSe5KzgXQZXk12S3KaZrx82Cu6/nOD7RNtZvsxrYd69bzkrG84tvIwwVSefWuPiDAiY2uiigpSXXda0FjQXZ0xHPJGcsrbI67y/2xFeK0pD9542Y4FBYPq6BcslAYFUVFD8bN+K/GBXkJRwIDAQAB appmonitor.rsaSecret - MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCSlqdpwcdPniL1ahrYfTy47aD8Ay7D7qLyKO5QeXy64V+CQ0UvYwyTtfPRzvlXbwmc2ONjwKHq2B7SRhwHuBwURZNp5Iw1XaGCmqPPMOpL9UnYEIO90x3sFebIRHmXscyRVniGhmmdOXpVaP6BA3RWK1uwH/FBetzom6H+dcNMPQIDAQAB + MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCku9yUXBjd9m7V8fflC6XTwJEc8D8GSe5KzgXQZXk12S3KaZrx82Cu6/nOD7RNtZvsxrYd69bzkrG84tvIwwVSefWuPiDAiY2uiigpSXXda0FjQXZ0xHPJGcsrbI67y/2xFeK0pD9542Y4FBYPq6BcslAYFUVFD8bN+K/GBXkJRwIDAQAB services @@ -65,7 +65,7 @@ status 1 version - 1.2.0 + 1.2.0-no-memory man_service @@ -79,7 +79,7 @@ status 1 version - 2.0.4 + 1.9.9.1-notnull diff --git a/star_lock/ios/Runner/AppDelegate.h b/star_lock/ios/Runner/AppDelegate.h index bb4ca173..582d3c3b 100644 --- a/star_lock/ios/Runner/AppDelegate.h +++ b/star_lock/ios/Runner/AppDelegate.h @@ -9,9 +9,14 @@ #import #import +#import "JPUSHService.h" +#import + +#import "JPUSHService.h" +#import -@interface AppDelegate : FlutterAppDelegate +@interface AppDelegate : FlutterAppDelegate @property (strong, nonatomic) UIWindow *window; diff --git a/star_lock/ios/Runner/AppDelegate.m b/star_lock/ios/Runner/AppDelegate.m index 56817721..557f519a 100644 --- a/star_lock/ios/Runner/AppDelegate.m +++ b/star_lock/ios/Runner/AppDelegate.m @@ -7,6 +7,7 @@ #import + @interface AppDelegate() @end @@ -18,6 +19,18 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { +// //【注册通知】通知回调代理(可选) +// JPUSHRegisterEntity * entity = [[JPUSHRegisterEntity alloc] init]; +// entity.types = JPAuthorizationOptionAlert|JPAuthorizationOptionBadge|JPAuthorizationOptionSound|JPAuthorizationOptionProvidesAppNotificationSettings; +// [JPUSHService registerForRemoteNotificationConfig:entity delegate:self]; +// +// //【初始化sdk】 +// // notice: 2.1.5 版本的 SDK 新增的注册方法,改成可上报 IDFA,如果没有使用 IDFA 直接传 nil +// [JPUSHService setupWithOption:launchOptions appKey:@"7ff37d174c1a568a89e98dad" +// channel:@"flutter_channel" +// apsForProduction:NO +// advertisingIdentifier:nil]; + // [self initCloudPush]; // [CloudPushSDK sendNotificationAck:launchOptions]; XSFlutterManager *VC = [[XSFlutterManager alloc] init]; @@ -29,7 +42,7 @@ - (void)initCloudPush { // SDK初始化 - [CloudPushSDK asyncInit:@"333904046" appSecret:@"3eead09a7fc7416cb4082319aa6f48c6" callback:^(CloudPushCallbackResult *res) { + [CloudPushSDK asyncInit:@"334068745" appSecret:@"bee9c200835e4951a85dc8709c319560" callback:^(CloudPushCallbackResult *res) { if (res.success) { NSLog(@"Push SDK init success, deviceId: %@.", [CloudPushSDK getDeviceId]); } else { @@ -62,13 +75,16 @@ * 苹果推送注册成功回调,将苹果返回的deviceToken上传到CloudPush服务器 */ - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { - [CloudPushSDK registerDevice:deviceToken withCallback:^(CloudPushCallbackResult *res) { - if (res.success) { - NSLog(@"Register deviceToken success."); - } else { - NSLog(@"Register deviceToken failed, error: %@", res.error); - } - }]; +// [CloudPushSDK registerDevice:deviceToken withCallback:^(CloudPushCallbackResult *res) { +// if (res.success) { +// NSLog(@"Register deviceToken success."); +// } else { +// NSLog(@"Register deviceToken failed, error: %@", res.error); +// } +// }]; + //sdk注册DeviceToken + [JPUSHService registerDeviceToken:deviceToken]; + } /* * 苹果推送注册失败回调 @@ -98,12 +114,6 @@ NSLog(@"Receive message title: %@, content: %@.", title, body); } -//- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { -// // 点击通知将App从关闭状态启动时,将通知打开回执上报 -// // [CloudPushSDK handleLaunching:launchOptions];(Deprecated from v1.8.1) -// [CloudPushSDK sendNotificationAck:launchOptions]; -// return YES; -//} /* * App处于启动状态时,通知打开回调 */ diff --git a/star_lock/ios/Runner/Info.plist b/star_lock/ios/Runner/Info.plist index 6484c6e2..33b2277b 100644 --- a/star_lock/ios/Runner/Info.plist +++ b/star_lock/ios/Runner/Info.plist @@ -1,82 +1,84 @@ - - CADisableMinimumFrameDurationOnPhone - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleDisplayName - $(BUNDLE_DISPLAY_NAME) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(BUNDLE_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - $(FLUTTER_BUILD_NAME) - CFBundleSignature - ???? - CFBundleVersion - $(FLUTTER_BUILD_NUMBER) - LSRequiresIPhoneOS - - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - - NSBluetoothAlwaysUsageDescription - The app uses bluetooth to find, connect and transfer data between different devices - NSBluetoothPeripheralUsageDescription - The app uses bluetooth to find, connect and transfer data between different devices - NSCameraUsageDescription - 照片 - NSContactsUsageDescription - Reason we need access to the contact list - NSLocationAlwaysAndWhenInUseUsageDescription - 应用在前台和后台的时候可以搜到更新的位置信息 - NSLocationAlwaysUsageDescription - 应用在后台的时候可以搜到更新的位置信息 - NSLocationWhenInUseUsageDescription - 应用在前台的时候可以搜到更新的位置信息 - NSMicrophoneUsageDescription - 应用请求麦克风用来通话 - NSPhotoLibraryUsageDescription - 用于相册 - UIApplicationSceneManifest - - UISceneConfigurations - - - UIApplicationSupportsIndirectInputEvents - - UIBackgroundModes - - remote-notification - - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - UIInterfaceOrientationPortrait - - UIViewControllerBasedStatusBarAppearance - - io.flutter.embedded_views_preview - - - \ No newline at end of file + + CADisableMinimumFrameDurationOnPhone + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + $(BUNDLE_DISPLAY_NAME) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(BUNDLE_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + + NSBluetoothAlwaysUsageDescription + The app uses bluetooth to find, connect and transfer data between different devices + NSBluetoothPeripheralUsageDescription + The app uses bluetooth to find, connect and transfer data between different devices + NSCameraUsageDescription + 照片 + NSContactsUsageDescription + Reason we need access to the contact list + NSLocationAlwaysAndWhenInUseUsageDescription + 应用在前台和后台的时候可以搜到更新的位置信息 + NSLocationAlwaysUsageDescription + 应用在后台的时候可以搜到更新的位置信息 + NSLocationWhenInUseUsageDescription + 应用在前台的时候可以搜到更新的位置信息 + NSMicrophoneUsageDescription + 应用请求麦克风用来通话 + NSPhotoLibraryUsageDescription + 用于相册 + UIApplicationSceneManifest + + UISceneConfigurations + + + UIApplicationSupportsIndirectInputEvents + + UIBackgroundModes + + remote-notification + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + UIInterfaceOrientationPortrait + + UIViewControllerBasedStatusBarAppearance + + NSUserTrackingUsageDescription + 需要访问您的隐私数据,以提供个性化的体验。 + io.flutter.embedded_views_preview + + + diff --git a/star_lock/lib/app.dart b/star_lock/lib/app.dart index ff5793ef..27fa403e 100644 --- a/star_lock/lib/app.dart +++ b/star_lock/lib/app.dart @@ -1,15 +1,16 @@ -import 'package:aliyun_push/aliyun_push.dart'; +// import 'package:aliyun_push/aliyun_push.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:jpush_flutter/jpush_flutter.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:star_lock/flavors.dart'; import 'package:star_lock/tools/app_manager.dart'; import 'package:star_lock/tools/bindings/app_binding.dart'; -import 'package:star_lock/tools/storage.dart'; -import 'package:star_lock/tools/xs_aliyunPush.dart'; +// import 'package:star_lock/tools/storage.dart'; +// import 'package:star_lock/tools/xs_aliyunPush.dart'; import 'package:star_lock/translations/app_dept.dart'; import 'package:star_lock/translations/trans_lib.dart'; @@ -30,6 +31,8 @@ class MyApp extends StatefulWidget { // final RouteObserver routeObserver = RouteObserver(); class _MyAppState extends State with WidgetsBindingObserver, BaseWidget { + final JPush jpush = JPush(); + @override Widget build(BuildContext context) { return ScreenUtilInit( @@ -101,7 +104,7 @@ class _MyAppState extends State with WidgetsBindingObserver, BaseWidget { void initState() { super.initState(); WidgetsBinding.instance.addObserver(this); - initFlutterAliyunPush(); + initJPushService(); } @override @@ -109,6 +112,24 @@ class _MyAppState extends State with WidgetsBindingObserver, BaseWidget { WidgetsBinding.instance.removeObserver(this); super.dispose(); } + + Future initJPushService() async { + jpush.setup( + appKey: "7ff37d174c1a568a89e98dad", + channel: "flutter_channel", + production: false, + debug: true, + ); + jpush.applyPushAuthority( + const NotificationSettingsIOS(sound: true, alert: true, badge: true)); + // jpush.setChannelAndSound( + // channel: "flutter_channel", channelID: "115700", sound: "default"); + + // Platform messages may fail, so we use a try/catch PlatformException. + jpush.getRegistrationID().then((rid) { + print("flutter get registration id : $rid"); + }); + } } void openBlueScan() { @@ -146,26 +167,3 @@ Future getMicrophonePermission() async { } return false; } - -//初始化阿里云推送 -Future initFlutterAliyunPush() async { - final data = await Storage.getString(saveUserLoginData); - if (data != null) { - final aliyunPush = AliyunPush(); - XSAliyunPushProvider().init(aliyunPush); - XSAliyunPushProvider().initAliyunPush(); - - if (Platform.isAndroid) { - XSAliyunPushProvider().initAliyunThirdPush(); - } - - //暂使用DeviceID推送 - aliyunPush.getDeviceId().then((deviceId) async { - print('得到的DeviceId$deviceId'); - if (deviceId.isNotEmpty) { - XSAliyunPushProvider() - .pushBindDeviceID(deviceId, Platform.isAndroid ? 10 : 20); - } - }); - } -} diff --git a/star_lock/lib/tools/jpush_flutter.dart b/star_lock/lib/tools/jpush_flutter.dart new file mode 100644 index 00000000..fda3ee01 --- /dev/null +++ b/star_lock/lib/tools/jpush_flutter.dart @@ -0,0 +1,33 @@ +import 'package:jpush_flutter/jpush_flutter.dart'; + +class JPushProvider { + final JPush jpush = JPush(); + + Future initJPush() async { + jpush.setup( + appKey: "7ff37d174c1a568a89e98dad", + channel: "flutter_channel", + production: false, + debug: true, + ); + + jpush.applyPushAuthority(const NotificationSettingsIOS( + sound: true, + alert: true, + badge: true, + )); + + // // Add event handler + // jpush.addEventHandler( + // onReceiveNotification: (Map message) { + // print("Receive notification: $message"); + // }, + // onOpenNotification: (Map message) { + // print("Open notification: $message"); + // }, + // onReceiveMessage: (Map message) { + // print("Receive message: $message"); + // }, + // ); + } +} diff --git a/star_lock/lib/tools/xs_aliyunPush.dart b/star_lock/lib/tools/xs_aliyunPush.dart index 600dfc94..4a922ebb 100644 --- a/star_lock/lib/tools/xs_aliyunPush.dart +++ b/star_lock/lib/tools/xs_aliyunPush.dart @@ -1,3 +1,4 @@ +/* import 'dart:io'; import 'package:aliyun_push/aliyun_push.dart'; @@ -133,3 +134,4 @@ class XSAliyunPushProvider { if (entity.errorCode!.codeIsSuccessful) {} } } +*/ \ No newline at end of file diff --git a/star_lock/pubspec.yaml b/star_lock/pubspec.yaml index 54a0eb76..8a654d9e 100644 --- a/star_lock/pubspec.yaml +++ b/star_lock/pubspec.yaml @@ -114,6 +114,7 @@ dependencies: cached_network_image: ^3.2.0 webview_flutter: ^4.2.3 aliyun_push: ^0.1.6 + jpush_flutter: ^2.5.1 #视频播放器 video_player: ^2.7.1 From 2eb79288c07df36fb35455ac1664f3832bbf0d86 Mon Sep 17 00:00:00 2001 From: GeJiaXiang <353358601@qq.com> Date: Wed, 20 Mar 2024 10:42:12 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E5=AE=8C=E6=88=90=E6=9E=81=E5=85=89?= =?UTF-8?q?=E6=8E=A8=E9=80=81-=E5=B0=8F=E7=B1=B3=E9=80=9A=E9=81=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../android/app/aliyun-emas-services.json | 49 ------------- star_lock/android/app/build.gradle | 12 ++-- .../android/app/src/main/AndroidManifest.xml | 59 +-------------- .../kotlin/com/skychip/lock/MainActivity.kt | 5 -- .../com/skychip/lock/MyMessageReceiver.kt | 72 ------------------- .../com/skychip/lock/PopupPushActivity.kt | 25 ------- star_lock/android/build.gradle | 20 +++--- star_lock/lib/app.dart | 14 ++++ star_lock/lib/tools/jpush_flutter.dart | 33 --------- star_lock/pubspec.yaml | 1 - 10 files changed, 31 insertions(+), 259 deletions(-) delete mode 100644 star_lock/android/app/aliyun-emas-services.json delete mode 100644 star_lock/android/app/src/main/kotlin/com/skychip/lock/MyMessageReceiver.kt delete mode 100644 star_lock/android/app/src/main/kotlin/com/skychip/lock/PopupPushActivity.kt delete mode 100644 star_lock/lib/tools/jpush_flutter.dart diff --git a/star_lock/android/app/aliyun-emas-services.json b/star_lock/android/app/aliyun-emas-services.json deleted file mode 100644 index 66605471..00000000 --- a/star_lock/android/app/aliyun-emas-services.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "config": { - "emas.appKey":"334068743", - "emas.appSecret":"64de537f14984159a66ada10e54c6b63", - "emas.packageName":"com.skychip.lock", - "hotfix.idSecret":"334068743-1", - "hotfix.rsaSecret":"MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCrcYP7FeYbeYakUMBa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OFCXXU2XyjNh4+iJKGNRk3UhgR+RCQEAqixGnjrG+kQNREre2+XdjhIPAcg1QEmev9K5i97MwezC6FIB0jtx2Gdgq+zqKKVHSD6yd0KfCTRwyHTH/pdn1Z2rNQKBgHeF/nmdvUeoUqhW0ZhWvAztMO3Tg5kisLoIaMg/Bt2JUNfoZxvE/4lCG1HceCvgBHM7bJnSUbV6vJs52lITuVXbzYg+0bEZlZ6XCd0mjdZmV30Zh5ASFOEQsES+y+drBG/I5fYhDVFNYHHPt0bywEZrA6D20uiSW/GKuez6sM3vAoGATm3cLmUCauphKbaVjUB8bh6w9fvgFJnU5c12wytCy9D6TyxtHO6vL1r/KN51ejp5Ht6MuqOBTJztDcXjLbQMBvmw/SRSqQfeiBzAnUDt9MTy2c8GH135jlhBxgSF6JpeQ56uIXc4/rdM5XH5M5qmM7HJtKcLjlC7GCDIhWEvZM0=", - "httpdns.accountId":"100674", - "httpdns.secretKey":"6cd4984095d53f6f311424cc9299257b", - "appmonitor.tlog.rsaSecret":"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCW084k+HG1OOaSY2B2N6aj4AOz8RhInqlaFr7BbQrqmPwzHC2Co0N/jmbBbxGP7oPsy7yF9zn/hJiuvzlQfjtK85IXAYUKj7IcLashQUT5lrGYlObCznH2qOPkw8OP+cboP51uWIeXFMYatwXRR05vtWVLEeUhaFE1onzQtcG0YwIDAQAB", - "appmonitor.rsaSecret":"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCW084k+HG1OOaSY2B2N6aj4AOz8RhInqlaFr7BbQrqmPwzHC2Co0N/jmbBbxGP7oPsy7yF9zn/hJiuvzlQfjtK85IXAYUKj7IcLashQUT5lrGYlObCznH2qOPkw8OP+cboP51uWIeXFMYatwXRR05vtWVLEeUhaFE1onzQtcG0YwIDAQAB" -}, - "services": { - "hotfix_service":{ - "status":1, - "version":"3.4.0" - }, - "ha-adapter_service":{ - "status":1, - "version":"1.2.3.0-open" - }, - "feedback_service":{ - "status":1, - "version":"3.4.2" - }, - "tlog_service":{ - "status":1, - "version":"1.1.7.0-open" - }, - "httpdns_service":{ - "status":1, - "version":"2.3.5" - }, - "apm_service":{ - "status":1, - "version":"1.1.3.0-open" - }, - "man_service":{ - "status":1, - "version":"1.2.7" - }, - "cps_service":{ - "status":1, - "version":"3.8.8.1" - } -}, - "use_maven":true, - "proguard_keeplist":"\n#httpdns\n-keep class com.taobao.** {*;}\n-keep class com.alibaba.** {*;}\n-keep class com.ta.**{*;}\n-keep class com.ut.**{*;}\n-dontwarn com.taobao.**\n-dontwarn com.alibaba.**\n-dontwarn com.ta.**\n-dontwarn com.ut.**\n\n#cps\n-keep class com.taobao.** {*;}\n-keep class com.alibaba.** {*;}\n-keep class com.ta.**{*;}\n-keep class com.ut.**{*;}\n-dontwarn com.taobao.**\n-dontwarn com.alibaba.**\n-dontwarn com.ta.**\n-dontwarn com.ut.**\n-keepclasseswithmembernames class ** {\nnative ;\n}\n-keepattributes Signature\n-keep class sun.misc.Unsafe { *; }\n-keep class com.alipay.** {*;}\n-dontwarn com.alipay.**\n-keep class anet.**{*;}\n-keep class org.android.spdy.**{*;}\n-keep class org.android.agoo.**{*;}\n-dontwarn anet.**\n-dontwarn org.android.spdy.**\n-dontwarn org.android.agoo.**\n\n#hotfix\n#基线包使用,生成mapping.txt\n-printmapping mapping.txt\n#生成的mapping.txt在app/buidl/outputs/mapping/release路径下,移动到/app路径下\n#修复后的项目使用,保证混淆结果一致\n#-applymapping mapping.txt\n#hotfix\n-keep class com.taobao.sophix.**{*;}\n-keep class com.ta.utdid2.device.**{*;}\n#防止inline\n-dontoptimize\n\n#man\n-keep class com.taobao.** {*;}\n-keep class com.alibaba.** {*;}\n-keep class com.ta.**{*;}\n-keep class com.ut.**{*;}\n-dontwarn com.taobao.**\n-dontwarn com.alibaba.**\n-dontwarn com.ta.**\n-dontwarn com.ut.**\n\n#feedback\n-keep class com.taobao.** {*;}\n-keep class com.alibaba.** {*;}\n-keep class com.ta.**{*;}\n-keep class com.ut.**{*;}\n-dontwarn com.taobao.**\n-dontwarn com.alibaba.**\n-dontwarn com.ta.**\n-dontwarn com.ut.**\n" -} \ No newline at end of file diff --git a/star_lock/android/app/build.gradle b/star_lock/android/app/build.gradle index 4370f69c..5d2c322e 100644 --- a/star_lock/android/app/build.gradle +++ b/star_lock/android/app/build.gradle @@ -23,7 +23,6 @@ if (flutterVersionName == null) { } apply plugin: 'com.android.application' -// apply plugin: 'com.aliyun.ams.emas-services' // 引用emas-services插件 apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" @@ -176,10 +175,9 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation('com.amap.api:location:5.6.0') implementation('com.amap.api:3dmap:8.1.0') -// implementation 'com.aliyun.ams:alicloud-android-push:3.8.7' -// //小米依赖 -// implementation 'com.aliyun.ams:alicloud-android-third-push-xiaomi:3.8.7' -// implementation 'cn.jiguang.sdk:jpush:4.0.9' -// implementation 'cn.jiguang.sdk:jcore:2.8.2' -// implementation 'cn.jiguang.sdk.plugin:xiaomi:4.0.9'//版本号和对应的JPush版本号相同 + + implementation 'cn.jiguang.sdk:jpush:5.2.3' + implementation 'com.huawei.hms:push:6.12.0.300' + + implementation 'cn.jiguang.sdk.plugin:xiaomi:5.2.3' } diff --git a/star_lock/android/app/src/main/AndroidManifest.xml b/star_lock/android/app/src/main/AndroidManifest.xml index 112101d3..6ec34a31 100644 --- a/star_lock/android/app/src/main/AndroidManifest.xml +++ b/star_lock/android/app/src/main/AndroidManifest.xml @@ -48,64 +48,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + diff --git a/star_lock/android/app/src/main/kotlin/com/skychip/lock/MainActivity.kt b/star_lock/android/app/src/main/kotlin/com/skychip/lock/MainActivity.kt index 33902047..0237e5c7 100644 --- a/star_lock/android/app/src/main/kotlin/com/skychip/lock/MainActivity.kt +++ b/star_lock/android/app/src/main/kotlin/com/skychip/lock/MainActivity.kt @@ -4,20 +4,15 @@ import android.content.Intent import android.net.Uri import android.os.Bundle import android.util.Log -import com.alibaba.sdk.android.push.noonesdk.PushServiceFactory -import com.aliyun.ams.emas.push.CommonCallback import io.flutter.embedding.android.FlutterActivity import io.flutter.plugin.common.MethodChannel import io.flutter.embedding.engine.FlutterEngine; import io.flutter.plugins.GeneratedPluginRegistrant import android.bluetooth.BluetoothAdapter; -import com.alibaba.sdk.android.push.register.MiPushRegister class MainActivity: FlutterActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) -// initJPushService() - GeneratedPluginRegistrant.registerWith(flutterEngine!!) MethodChannel(flutterEngine?.dartExecutor!!.binaryMessenger, "starLockFlutterSend").setMethodCallHandler { call, result -> if (call.method == "loadNativeShare") { diff --git a/star_lock/android/app/src/main/kotlin/com/skychip/lock/MyMessageReceiver.kt b/star_lock/android/app/src/main/kotlin/com/skychip/lock/MyMessageReceiver.kt deleted file mode 100644 index 4b58b259..00000000 --- a/star_lock/android/app/src/main/kotlin/com/skychip/lock/MyMessageReceiver.kt +++ /dev/null @@ -1,72 +0,0 @@ -package com.skychip.lock - -import android.content.Context -import android.util.Log -import com.alibaba.sdk.android.push.MessageReceiver -import com.alibaba.sdk.android.push.notification.CPushMessage - - -class MyMessageReceiver : MessageReceiver() { - override fun onNotification( - context: Context?, - title: String, - summary: String, - extraMap: Map - ) { - // TODO处理推送通知 - Log.e( - "MyMessageReceiver", - "Receive notification, title: $title, summary: $summary, extraMap: $extraMap" - ) - } - - override fun onMessage(context: Context?, cPushMessage: CPushMessage) { - Log.e( - "MyMessageReceiver", - "onMessage, messageId: " + cPushMessage.getMessageId() + ", title: " + cPushMessage.getTitle() + ", content:" + cPushMessage.getContent() - ) - } - - override fun onNotificationOpened(context: Context?, title: String, summary: String, extraMap: String) { - Log.e( - "MyMessageReceiver", - "onNotificationOpened, title: $title, summary: $summary, extraMap:$extraMap" - ) - } - - protected override fun onNotificationClickedWithNoAction( - context: Context?, - title: String, - summary: String, - extraMap: String - ) { - Log.e( - "MyMessageReceiver", - "onNotificationClickedWithNoAction, title: $title, summary: $summary, extraMap:$extraMap" - ) - } - - protected override fun onNotificationReceivedInApp( - context: Context?, - title: String, - summary: String, - extraMap: Map, - openType: Int, - openActivity: String, - openUrl: String - ) { - Log.e( - "MyMessageReceiver", - "onNotificationReceivedInApp, title: $title, summary: $summary, extraMap:$extraMap, openType:$openType, openActivity:$openActivity, openUrl:$openUrl" - ) - } - - protected override fun onNotificationRemoved(context: Context?, messageId: String?) { - Log.e("MyMessageReceiver", "onNotificationRemoved") - } - - companion object { - // 消息接收部分的LOG_TAG - const val REC_TAG = "receiver" - } -} \ No newline at end of file diff --git a/star_lock/android/app/src/main/kotlin/com/skychip/lock/PopupPushActivity.kt b/star_lock/android/app/src/main/kotlin/com/skychip/lock/PopupPushActivity.kt deleted file mode 100644 index 85442a7b..00000000 --- a/star_lock/android/app/src/main/kotlin/com/skychip/lock/PopupPushActivity.kt +++ /dev/null @@ -1,25 +0,0 @@ -import android.os.Bundle -import android.util.Log -import com.alibaba.sdk.android.push.AndroidPopupActivity - -class PopupPushActivity : AndroidPopupActivity() { - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - } - - /** - * 实现通知打开回调方法,获取通知相关信息 - * @param title 标题 - * @param summary 内容 - * @param extMap 额外参数 - */ - override fun onSysNoticeOpened(title: String, summary: String, extMap: Map) { - Log.e( - "PopupPushActivity", - "OnMiPushSysNoticeOpened, title: $title, content: $summary, extMap: $extMap" - ) } - - companion object { - const val TAG = "PopupPushActivity" - } -} \ No newline at end of file diff --git a/star_lock/android/build.gradle b/star_lock/android/build.gradle index 67d2c573..43480df7 100644 --- a/star_lock/android/build.gradle +++ b/star_lock/android/build.gradle @@ -4,17 +4,19 @@ buildscript { google() mavenCentral() mavenLocal() -// maven { // 添加Maven仓库地址 -// url 'https://maven.aliyun.com/nexus/content/repositories/releases/' -// } + // hms, 若不集成华为厂商通道,可直接跳过 + maven { url 'https://developer.huawei.com/repo/'} + // fcm, 若不集成 FCM 通道,可直接跳过 + maven { url "https://maven.google.com" } } dependencies { classpath 'com.android.tools.build:gradle:7.1.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - // 添加emas-services插件 -// classpath 'com.aliyun.ams:emas-services:1.0.4' - // classpath "cn.jiguang.sdk:jpush:4.0.9" + // fcm,若不集成 FCM 通道,可直接跳过 + classpath 'com.google.gms:google-services:4.3.8' + // hms,若不集成华为厂商通道,可直接跳过 + classpath 'com.huawei.agconnect:agcp:1.6.0.300' } } @@ -24,9 +26,9 @@ allprojects { google() mavenCentral() jcenter() -// maven { // 添加Maven仓库地址 -// url 'https://maven.aliyun.com/nexus/content/repositories/releases/' -// } + // 配置HMS Core SDK的Maven仓地址。 + maven {url 'https://developer.huawei.com/repo/'} + } } diff --git a/star_lock/lib/app.dart b/star_lock/lib/app.dart index 27fa403e..898ee6c8 100644 --- a/star_lock/lib/app.dart +++ b/star_lock/lib/app.dart @@ -114,6 +114,20 @@ class _MyAppState extends State with WidgetsBindingObserver, BaseWidget { } Future initJPushService() async { + jpush.addEventHandler( + // 接收通知回调方法。 + onReceiveNotification: (Map message) async { + print("flutter onReceiveNotification: $message"); + }, + // 点击通知回调方法。 + onOpenNotification: (Map message) async { + print("flutter onOpenNotification: $message"); + }, + // 接收自定义消息回调方法。 + onReceiveMessage: (Map message) async { + print("flutter onReceiveMessage: $message"); + }, + ); jpush.setup( appKey: "7ff37d174c1a568a89e98dad", channel: "flutter_channel", diff --git a/star_lock/lib/tools/jpush_flutter.dart b/star_lock/lib/tools/jpush_flutter.dart deleted file mode 100644 index fda3ee01..00000000 --- a/star_lock/lib/tools/jpush_flutter.dart +++ /dev/null @@ -1,33 +0,0 @@ -import 'package:jpush_flutter/jpush_flutter.dart'; - -class JPushProvider { - final JPush jpush = JPush(); - - Future initJPush() async { - jpush.setup( - appKey: "7ff37d174c1a568a89e98dad", - channel: "flutter_channel", - production: false, - debug: true, - ); - - jpush.applyPushAuthority(const NotificationSettingsIOS( - sound: true, - alert: true, - badge: true, - )); - - // // Add event handler - // jpush.addEventHandler( - // onReceiveNotification: (Map message) { - // print("Receive notification: $message"); - // }, - // onOpenNotification: (Map message) { - // print("Open notification: $message"); - // }, - // onReceiveMessage: (Map message) { - // print("Receive message: $message"); - // }, - // ); - } -} diff --git a/star_lock/pubspec.yaml b/star_lock/pubspec.yaml index 8a654d9e..9d0689a5 100644 --- a/star_lock/pubspec.yaml +++ b/star_lock/pubspec.yaml @@ -113,7 +113,6 @@ dependencies: #网络图片缓存 cached_network_image: ^3.2.0 webview_flutter: ^4.2.3 - aliyun_push: ^0.1.6 jpush_flutter: ^2.5.1 #视频播放器 From dd1deb6ce111957a7a483004ee6711fb82208908 Mon Sep 17 00:00:00 2001 From: Daisy <> Date: Wed, 20 Mar 2024 10:57:20 +0800 Subject: [PATCH 4/6] =?UTF-8?q?1=EF=BC=8C=E4=BF=AE=E6=94=B9=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E5=90=8E=E5=88=9D=E5=A7=8B=E5=8C=96=E6=9E=81=E5=85=89?= =?UTF-8?q?=E6=8E=A8=E9=80=81=202=EF=BC=8C=E4=BF=AE=E6=94=B9=E5=BA=9F?= =?UTF-8?q?=E5=BC=83=E7=9A=84=E6=89=93=E5=BC=80URL=E7=9A=84=E6=96=B9?= =?UTF-8?q?=E6=B3=95=203=EF=BC=8C=E4=BF=AE=E5=A4=8D=E5=90=8C=E6=84=8F?= =?UTF-8?q?=E9=9A=90=E7=A7=81=E5=8D=8F=E8=AE=AE=E5=89=8D=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E4=BA=86=E8=AE=BE=E5=A4=87=E4=BF=A1=E6=81=AF=E7=9A=84=E4=B8=8A?= =?UTF-8?q?=E6=9E=B6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- star_lock/lib/app.dart | 33 ++++--- .../starLockApplication.dart | 13 ++- star_lock/lib/tools/appFirstEnterHandle.dart | 7 +- .../lib/versionUndate/versionUndateTool.dart | 92 ++++++++++--------- 4 files changed, 78 insertions(+), 67 deletions(-) diff --git a/star_lock/lib/app.dart b/star_lock/lib/app.dart index 27fa403e..be4495c4 100644 --- a/star_lock/lib/app.dart +++ b/star_lock/lib/app.dart @@ -9,6 +9,7 @@ import 'package:permission_handler/permission_handler.dart'; import 'package:star_lock/flavors.dart'; import 'package:star_lock/tools/app_manager.dart'; import 'package:star_lock/tools/bindings/app_binding.dart'; +import 'package:star_lock/tools/storage.dart'; // import 'package:star_lock/tools/storage.dart'; // import 'package:star_lock/tools/xs_aliyunPush.dart'; @@ -104,6 +105,7 @@ class _MyAppState extends State with WidgetsBindingObserver, BaseWidget { void initState() { super.initState(); WidgetsBinding.instance.addObserver(this); + initJPushService(); } @@ -114,21 +116,24 @@ class _MyAppState extends State with WidgetsBindingObserver, BaseWidget { } Future initJPushService() async { - jpush.setup( - appKey: "7ff37d174c1a568a89e98dad", - channel: "flutter_channel", - production: false, - debug: true, - ); - jpush.applyPushAuthority( - const NotificationSettingsIOS(sound: true, alert: true, badge: true)); - // jpush.setChannelAndSound( - // channel: "flutter_channel", channelID: "115700", sound: "default"); + final data = await Storage.getString(saveUserLoginData); + if (data != null && data.isNotEmpty) { + jpush.setup( + appKey: "7ff37d174c1a568a89e98dad", + channel: "flutter_channel", + production: false, + debug: true, + ); + jpush.applyPushAuthority( + const NotificationSettingsIOS(sound: true, alert: true, badge: true)); + // jpush.setChannelAndSound( + // channel: "flutter_channel", channelID: "115700", sound: "default"); - // Platform messages may fail, so we use a try/catch PlatformException. - jpush.getRegistrationID().then((rid) { - print("flutter get registration id : $rid"); - }); + // Platform messages may fail, so we use a try/catch PlatformException. + jpush.getRegistrationID().then((rid) { + print("flutter get registration id : $rid"); + }); + } } } diff --git a/star_lock/lib/starLockApplication/starLockApplication.dart b/star_lock/lib/starLockApplication/starLockApplication.dart index 2c4dbd7f..3bbce837 100644 --- a/star_lock/lib/starLockApplication/starLockApplication.dart +++ b/star_lock/lib/starLockApplication/starLockApplication.dart @@ -3,7 +3,6 @@ import 'package:star_lock/login/login/starLock_login_page.dart'; import 'package:star_lock/tools/appFirstEnterHandle.dart'; import 'package:star_lock/tools/storage.dart'; -import '../blue/blue_manage.dart'; import '../main/lockMian/lockMain/lockMain_page.dart'; class StarLockApplication extends StatefulWidget { @@ -14,8 +13,6 @@ class StarLockApplication extends StatefulWidget { } class _StarLockApplicationState extends State { - - @override void initState() { // TODO: implement initState @@ -27,7 +24,8 @@ class _StarLockApplicationState extends State { Widget build(BuildContext context) { print("StarLockApplication build"); AppFirstEnterHandle().getAppFirstEnter(context, isAgreePrivacy); - AppFirstEnterHandle().getAppFirstEnter(context, isShowUpdateVersion); + getAgreePrivacyShowUpdate(); + return FutureBuilder( future: getLoginStatus(), builder: (context, snapshot) { @@ -57,4 +55,11 @@ class _StarLockApplicationState extends State { } return false; } + + Future getAgreePrivacyShowUpdate() async { + final data = await Storage.getString(isAgreePrivacy); + if (data == isAgreePrivacy) { + AppFirstEnterHandle().getAppFirstEnter(context, isShowUpdateVersion); + } + } } diff --git a/star_lock/lib/tools/appFirstEnterHandle.dart b/star_lock/lib/tools/appFirstEnterHandle.dart index 65fff2eb..57ac9153 100644 --- a/star_lock/lib/tools/appFirstEnterHandle.dart +++ b/star_lock/lib/tools/appFirstEnterHandle.dart @@ -1,20 +1,14 @@ import 'dart:io'; -import 'package:device_info_plus/device_info_plus.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -import 'package:package_info_plus/package_info_plus.dart'; import 'package:star_lock/appRouters.dart'; import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/tools/storage.dart'; -import '../network/api_repository.dart'; -import '../translations/trans_lib.dart'; import '../versionUndate/versionUndateTool.dart'; -import '../versionUndate/versionUndate_entity.dart'; class AppFirstEnterHandle { Future getAppFirstEnter(BuildContext widgetContext, String flagStr) async { @@ -116,6 +110,7 @@ class AppFirstEnterHandle { onPressed: () { Storage.setString(isAgreePrivacy, isAgreePrivacy); Navigator.of(context).pop(); + getAppFirstEnter(context, isShowUpdateVersion); }, ), ], diff --git a/star_lock/lib/versionUndate/versionUndateTool.dart b/star_lock/lib/versionUndate/versionUndateTool.dart index 78310e17..9eafd463 100644 --- a/star_lock/lib/versionUndate/versionUndateTool.dart +++ b/star_lock/lib/versionUndate/versionUndateTool.dart @@ -1,4 +1,3 @@ - import 'dart:io'; import 'package:device_info_plus/device_info_plus.dart'; @@ -17,7 +16,7 @@ import 'versionUndate_entity.dart'; class VersionUndateTool { static VersionUndateTool? _manager; - VersionUndateTool._init(){ + VersionUndateTool._init() { // _initLoadUpdateVersionData(); } @@ -32,7 +31,6 @@ class VersionUndateTool { VersionUndateTool? get manager => shareManager(); void _initLoadUpdateVersionData() { - getVersionData(); } @@ -68,7 +66,7 @@ class VersionUndateTool { currentVersion: version, ); if (entity.errorCode! == 0) { - if(entity.data!.isUpdate! == 1){ + if (entity.data!.isUpdate! == 1) { showUpdateAlertDialog(entity); } } @@ -82,52 +80,60 @@ class VersionUndateTool { content: Column( children: [ Container( - // color: AppColors.mainColor, + // color: AppColors.mainColor, alignment: Alignment.topCenter, height: 50.h, - child: Text('版本更新', style: TextStyle(fontSize: 28.sp, color: Colors.blue),) - ), + child: Text( + '版本更新', + style: TextStyle(fontSize: 28.sp, color: Colors.blue), + )), Container( - padding: EdgeInsets.only(left:20.w, right: 20.w, top: 10.h), + padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h), alignment: Alignment.centerLeft, - child: Text(versionUndateEntity.data!.description!, textAlign:TextAlign.start, style: TextStyle(fontSize: 20.sp)) - ), + child: Text(versionUndateEntity.data!.description!, + textAlign: TextAlign.start, + style: TextStyle(fontSize: 20.sp))), ], ), - actions: versionUndateEntity.data!.isForceUpdate == 0 ? - [ - CupertinoDialogAction( - child: Text("下次再说"), - onPressed: () { - Navigator.pop(context); - Storage.setString(isShowUpdateVersion, isShowUpdateVersion); - }, - ), - CupertinoDialogAction( - child: Text(TranslationLoader.lanKeys!.sure!.tr), - onPressed: () async { - if (await canLaunch(versionUndateEntity.data!.appDownloadUrl!)) { - await launch(versionUndateEntity.data!.appDownloadUrl!); - } else { - throw 'Could not launch ${versionUndateEntity.data!.appDownloadUrl}'; - } - }, - ), - ]: - [ - CupertinoDialogAction( - child: Text(TranslationLoader.lanKeys!.sure!.tr), - onPressed: () async { - if (await canLaunch(versionUndateEntity.data!.appDownloadUrl!)) { - await launch(versionUndateEntity.data!.appDownloadUrl!); - } else { - throw 'Could not launch ${versionUndateEntity.data!.appDownloadUrl}'; - } - }, - ), - ], + actions: versionUndateEntity.data!.isForceUpdate == 0 + ? [ + CupertinoDialogAction( + child: Text("下次再说"), + onPressed: () { + Navigator.pop(context); + Storage.setString( + isShowUpdateVersion, isShowUpdateVersion); + }, + ), + CupertinoDialogAction( + child: Text(TranslationLoader.lanKeys!.sure!.tr), + onPressed: () async { + if (await canLaunchUrl(Uri.parse( + versionUndateEntity.data!.appDownloadUrl!))) { + await launchUrl(Uri.parse( + versionUndateEntity.data!.appDownloadUrl!)); + } else { + throw 'Could not launch ${versionUndateEntity.data!.appDownloadUrl}'; + } + }, + ), + ] + : [ + CupertinoDialogAction( + child: Text(TranslationLoader.lanKeys!.sure!.tr), + onPressed: () async { + if (await canLaunchUrl(Uri.parse( + versionUndateEntity.data!.appDownloadUrl!))) { + await launchUrl(Uri.parse( + versionUndateEntity.data!.appDownloadUrl!)); + } else { + throw 'Could not launch ${versionUndateEntity.data!.appDownloadUrl}'; + } + }, + ), + ], ); }, ); } -} \ No newline at end of file +} From 63cd1f19b981445bb158a53a6947fc23d42fee8b Mon Sep 17 00:00:00 2001 From: GeJiaXiang <353358601@qq.com> Date: Wed, 20 Mar 2024 11:16:40 +0800 Subject: [PATCH 5/6] =?UTF-8?q?1.0.18+2024032001=EF=BC=9A=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=90=8C=E6=84=8F=E9=9A=90=E7=A7=81=E6=94=BF=E7=AD=96?= =?UTF-8?q?=E5=89=8D=E8=8E=B7=E5=8F=96SN?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- star_lock/pubspec.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/star_lock/pubspec.yaml b/star_lock/pubspec.yaml index 9d0689a5..a61eeaee 100644 --- a/star_lock/pubspec.yaml +++ b/star_lock/pubspec.yaml @@ -17,8 +17,9 @@ 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: 1.0.15+2024031501 +# 版本说明: +# 1.0.18+2024032001:修复同意隐私政策前获取SN +version: 1.0.18+2024032001 environment: sdk: '>=2.12.0 <3.0.0' From 438d294cbabd13678a6228d1607841dd79a7401a Mon Sep 17 00:00:00 2001 From: Daisy <> Date: Wed, 20 Mar 2024 14:22:15 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=8B=B9=E6=9E=9C?= =?UTF-8?q?=E4=B8=8A=E6=9E=B6=E9=97=AE=E9=A2=98=EF=BC=9A=E7=85=A7=E7=89=87?= =?UTF-8?q?=E5=BA=93=E5=92=8C=E7=9B=B8=E6=9C=BA=20=E7=94=A8=E9=80=94?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2=E4=B8=8D=E6=98=8E=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- star_lock/ios/Runner/Info.plist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/star_lock/ios/Runner/Info.plist b/star_lock/ios/Runner/Info.plist index 33b2277b..3251cc22 100644 --- a/star_lock/ios/Runner/Info.plist +++ b/star_lock/ios/Runner/Info.plist @@ -36,7 +36,7 @@ NSBluetoothPeripheralUsageDescription The app uses bluetooth to find, connect and transfer data between different devices NSCameraUsageDescription - 照片 + 应用请求相机,以便于拍摄照片,用于头像上传 NSContactsUsageDescription Reason we need access to the contact list NSLocationAlwaysAndWhenInUseUsageDescription @@ -48,7 +48,7 @@ NSMicrophoneUsageDescription 应用请求麦克风用来通话 NSPhotoLibraryUsageDescription - 用于相册 + 应用请求相册用于头像上传 UIApplicationSceneManifest UISceneConfigurations