diff --git a/CHANGELOG.md b/CHANGELOG.md index c3beb64..ec7db64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.7.0 + +* 适配Null Safety + ## 0.0.1 -## iOS 2.6.6 -* TODO: Describe initial release. + + diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index f96dd21..5c68026 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -25,7 +25,7 @@ apply plugin: 'com.android.application' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 27 + compileSdkVersion 30 lintOptions { disable 'InvalidPackage' @@ -34,11 +34,10 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.growingio.plugin.fluttergrowingiotrackexample" - minSdkVersion 16 - targetSdkVersion 27 + minSdkVersion 17 + targetSdkVersion 29 versionCode flutterVersionCode.toInteger() versionName flutterVersionName - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" resValue("string", "growingio_project_id", "9926fc6c1189e2fb") resValue("string", "growingio_url_scheme", "growing.da7e6c2879469314") @@ -58,8 +57,8 @@ flutter { } dependencies { - testImplementation 'junit:junit:4.12' - androidTestImplementation 'com.android.support.test:runner:1.0.2' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' +// testImplementation 'junit:junit:4.12' +// androidTestImplementation 'com.android.support.test:runner:1.0.2' +// androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' implementation 'com.growingio.android:vds-android-agent:track-2.6.0' } diff --git a/example/android/build.gradle b/example/android/build.gradle index d4225c7..2e4ceaa 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,18 +1,22 @@ buildscript { repositories { google() + mavenCentral() jcenter() + maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/" } } dependencies { - classpath 'com.android.tools.build:gradle:3.1.2' + classpath 'com.android.tools.build:gradle:4.2.2' } } allprojects { repositories { google() + mavenCentral() jcenter() + maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/" } } } diff --git a/example/android/gradle.properties b/example/android/gradle.properties index 8bd86f6..4d3226a 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -1 +1,3 @@ org.gradle.jvmargs=-Xmx1536M +android.useAndroidX=true +android.enableJetifier=true \ No newline at end of file diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index 9372d0f..939efa2 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh index b7450fc..78a89e1 100755 --- a/example/ios/Flutter/flutter_export_environment.sh +++ b/example/ios/Flutter/flutter_export_environment.sh @@ -1,11 +1,14 @@ #!/bin/sh # This is a generated file; do not edit or check into version control. -export "FLUTTER_ROOT=/Users/growingio/Desktop/GIO/Flutter/flutter" -export "FLUTTER_APPLICATION_PATH=/Users/growingio/Desktop/GIO/flutter_growingio-track_2.6.3/flutter-growingio-track/example" -export "FLUTTER_TARGET=/Users/growingio/Desktop/GIO/flutter_growingio-track_2.6.3/flutter-growingio-track/example/lib/main.dart" +export "FLUTTER_ROOT=/Users/sheng/GrowIO/flutter" +export "FLUTTER_APPLICATION_PATH=/Users/sheng/GrowIO/git-public/flutter-growingio-track/example" +export "COCOAPODS_PARALLEL_CODE_SIGN=true" +export "FLUTTER_TARGET=lib/main.dart" export "FLUTTER_BUILD_DIR=build" export "SYMROOT=${SOURCE_ROOT}/../build/ios" -export "FLUTTER_FRAMEWORK_DIR=/Users/growingio/Desktop/GIO/Flutter/flutter/bin/cache/artifacts/engine/ios" export "FLUTTER_BUILD_NAME=1.0.0" export "FLUTTER_BUILD_NUMBER=1" -export "TRACK_WIDGET_CREATION=true" +export "DART_OBFUSCATION=false" +export "TRACK_WIDGET_CREATION=false" +export "TREE_SHAKE_ICONS=false" +export "PACKAGE_CONFIG=.packages" diff --git a/example/lib/main.dart b/example/lib/main.dart index b73a28b..b7892f0 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -17,9 +17,9 @@ class MyButton extends StatelessWidget { final String text; const MyButton({ - Key key, - @required this.text, - @required this.onPressed + Key? key, + required this.text, + required this.onPressed }): super(key: key); @override @@ -54,6 +54,7 @@ class _MyAppState extends State { } void _clickTrack(){ + GrowingIO.track(null); GrowingIO.track('eventId'); GrowingIO.track('testEventId', num: 23.0, variable: {'testKey': 'testValue', 'testNumKey': 233}); GrowingIO.track('eventId', num: 23.0); @@ -64,9 +65,11 @@ class _MyAppState extends State { GrowingIO.setEvar({ 'testKey': 'testValue', 'testNumKey': 2333.0 }); + GrowingIO.setEvar(null); } void _clickSetPeopleVariable(){ + GrowingIO.setPeopleVariable(null); GrowingIO.setPeopleVariable({ 'testKey': 'testValue', 'testNumKey': 2333.0 }); @@ -74,6 +77,7 @@ class _MyAppState extends State { void _clickSetUserId(){ GrowingIO.setUserId("testUserId"); + GrowingIO.setUserId(null); } void _clickClearUserId(){ @@ -81,6 +85,7 @@ class _MyAppState extends State { } void _clickSetVisitor(){ + GrowingIO.setVisitor(null); GrowingIO.setVisitor({ "visitorKey": 'key', "visitorValue": 34 }); diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 4df50b4..677e4f9 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -10,7 +10,7 @@ description: Demonstrates how to use the flutter_growingio_track plugin. version: 1.0.0+1 environment: - sdk: ">=2.0.0-dev.68.0 <3.0.0" + sdk: ">=2.12.0 <3.0.0" dependencies: flutter: diff --git a/lib/flutter_growingio_track.dart b/lib/flutter_growingio_track.dart index fcacb04..c48c8e1 100644 --- a/lib/flutter_growingio_track.dart +++ b/lib/flutter_growingio_track.dart @@ -1,13 +1,13 @@ import 'dart:async'; - import 'package:flutter/services.dart'; class GrowingIO { static const MethodChannel _channel = const MethodChannel('flutter_growingio_track'); - static Future track(String eventId, - {double num, Map variable}) async { + static Future track(String? eventId, + {double? num, Map? variable}) async { + if (eventId == null) return; Map args = {"eventId": eventId}; if (num != null) { args['num'] = num; @@ -18,15 +18,18 @@ class GrowingIO { return await _channel.invokeMethod("track", args); } - static Future setEvar(Map variable) async { + static Future setEvar(Map? variable) async { + if (variable == null) return; return await _channel.invokeMethod("setEvar", variable); } - static Future setPeopleVariable(Map variable) async { + static Future setPeopleVariable(Map? variable) async { + if (variable == null) return; return await _channel.invokeMethod("setPeopleVariable", variable); } - static Future setUserId(String userId) async { + static Future setUserId(String? userId) async { + if (userId == null) return; return await _channel.invokeMethod("setUserId", {"userId": userId}); } @@ -34,7 +37,8 @@ class GrowingIO { return await _channel.invokeMethod("clearUserId"); } - static Future setVisitor(Map variable) async { + static Future setVisitor(Map? variable) async { + if (variable == null) return; return await _channel.invokeMethod("setVisitor", variable); } } diff --git a/pubspec.yaml b/pubspec.yaml index 67fbe55..c045290 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,11 +1,11 @@ name: flutter_growingio_track -description: Flutter Plugin For GrowingIO SDK, is used for calling GrowingIO api in flutter. -version: 2.6.6 +description: Flutter Plugin For GrowingIO SDK, is used for calling GrowingIO api in flutter. +version: 2.7.0 homepage: https://github.com/growingio/flutter-growingio-track environment: - sdk: ">=2.0.0 <3.0.0" - flutter: ">=1.10.0 <2.0.0" + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.20.0" dependencies: flutter: