Skip to content

Commit 7ce2946

Browse files
author
weiqiangliu
committed
Release 2.1.1
1 parent 5ad3134 commit 7ce2946

File tree

7 files changed

+79
-71
lines changed

7 files changed

+79
-71
lines changed

.idea/workspace.xml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.1.1
2+
3+
* 初始化方法支持 await 修饰
4+
15
## 2.1.0
26

37
* 支持 Flutter 项目延迟初始化 SDK

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
```yml
1818
dependencies:
1919
# 添加神策 flutter plugin
20-
sensors_analytics_flutter_plugin: ^2.1.0
20+
sensors_analytics_flutter_plugin: ^2.1.1
2121
```
2222
2323
执行 flutter packages get 命令安装插件

android/src/main/java/com/sensorsdata/analytics/sensorsanalyticsflutterplugin/SensorsAnalyticsFlutterPlugin.java

Lines changed: 69 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
174174
profileUnsetPushId(list);
175175
break;
176176
case "init":
177-
startWithConfig(list);
177+
startWithConfig(list, result);
178178
break;
179179
default:
180180
result.notImplemented();
@@ -490,86 +490,90 @@ private void profileUnsetPushId(List list) {
490490
SensorsDataAPI.sharedInstance().profileUnsetPushId((String) list.get(0));
491491
}
492492

493-
private void startWithConfig(List list) {
494-
Map map = (Map) list.get(0);
495-
Object serverUrl = map.get("serverUrl");
496-
497-
SAConfigOptions configOptions = new SAConfigOptions(serverUrl == null ? "" : serverUrl.toString());
498-
Object autotrackTypes = map.get("autotrackTypes");
499-
if (autotrackTypes != null) {
500-
configOptions.setAutoTrackEventType((Integer) autotrackTypes);
501-
}
502-
503-
Object networkTypes = map.get("networkTypes");
504-
if (networkTypes != null) {
505-
configOptions.setNetworkTypePolicy((Integer) networkTypes);
506-
}
507-
508-
Object flushInterval = map.get("flushInterval");
509-
if (flushInterval != null) {
510-
configOptions.setFlushInterval((Integer) flushInterval);
511-
}
493+
private void startWithConfig(List list, Result result) {
494+
try {
495+
Map map = (Map) list.get(0);
496+
Object serverUrl = map.get("serverUrl");
512497

513-
Object flushBulkSize = map.get("flushBulkSize");
514-
if (flushBulkSize != null) {
515-
configOptions.setFlushBulkSize((Integer) flushBulkSize);
516-
}
498+
SAConfigOptions configOptions = new SAConfigOptions(serverUrl == null ? "" : serverUrl.toString());
499+
Object autotrackTypes = map.get("autotrackTypes");
500+
if (autotrackTypes != null) {
501+
configOptions.setAutoTrackEventType((Integer) autotrackTypes);
502+
}
517503

518-
Object enableLog = map.get("enableLog");
519-
if (enableLog != null) {
520-
configOptions.enableLog((Boolean) enableLog);
521-
}
504+
Object networkTypes = map.get("networkTypes");
505+
if (networkTypes != null) {
506+
configOptions.setNetworkTypePolicy((Integer) networkTypes);
507+
}
522508

523-
Object encrypt = map.get("encrypt");
524-
if (encrypt != null) {
525-
configOptions.enableEncrypt((Boolean) encrypt);
526-
}
509+
Object flushInterval = map.get("flushInterval");
510+
if (flushInterval != null) {
511+
configOptions.setFlushInterval((Integer) flushInterval);
512+
}
527513

528-
Object heatMap = map.get("heatMap");
529-
if (heatMap != null) {
530-
configOptions.enableHeatMap((Boolean) heatMap);
531-
}
514+
Object flushBulkSize = map.get("flushBulkSize");
515+
if (flushBulkSize != null) {
516+
configOptions.setFlushBulkSize((Integer) flushBulkSize);
517+
}
532518

533-
Object androidConfig = map.get("android");
534-
boolean jellybean = false;
535-
if (androidConfig != null) {
536-
Map androidConfigMap = (Map) androidConfig;
537-
Object maxCacheSize = androidConfigMap.get("maxCacheSize");
538-
if (maxCacheSize != null) {
539-
configOptions.setMaxCacheSize(Long.parseLong(maxCacheSize.toString()));
519+
Object enableLog = map.get("enableLog");
520+
if (enableLog != null) {
521+
configOptions.enableLog((Boolean) enableLog);
540522
}
541523

542-
Object jellybeanObj = androidConfigMap.get("jellybean");
543-
if (jellybeanObj != null) {
544-
jellybean = (boolean) jellybeanObj;
524+
Object encrypt = map.get("encrypt");
525+
if (encrypt != null) {
526+
configOptions.enableEncrypt((Boolean) encrypt);
545527
}
546-
Object subProcessFlush = androidConfigMap.get("subProcessFlush");
547-
if (subProcessFlush != null && (boolean) subProcessFlush) {
548-
configOptions.enableSubProcessFlushData();
528+
529+
Object heatMap = map.get("heatMap");
530+
if (heatMap != null) {
531+
configOptions.enableHeatMap((Boolean) heatMap);
549532
}
550-
}
551533

552-
Object javaScriptBridge = map.get("javaScriptBridge");
553-
if (javaScriptBridge != null && (boolean) javaScriptBridge) {
554-
configOptions.enableJavaScriptBridge(jellybean);
555-
}
534+
Object androidConfig = map.get("android");
535+
boolean jellybean = false;
536+
if (androidConfig != null) {
537+
Map androidConfigMap = (Map) androidConfig;
538+
Object maxCacheSize = androidConfigMap.get("maxCacheSize");
539+
if (maxCacheSize != null) {
540+
configOptions.setMaxCacheSize(Long.parseLong(maxCacheSize.toString()));
541+
}
556542

557-
Object visualizedConfig = map.get("visualized");
558-
if (visualizedConfig != null) {
559-
Map visualizedConfigMap = (Map) visualizedConfig;
560-
Object autoTrack = visualizedConfigMap.get("autoTrack");
561-
if (autoTrack != null) {
562-
configOptions.enableVisualizedAutoTrack((Boolean) autoTrack);
543+
Object jellybeanObj = androidConfigMap.get("jellybean");
544+
if (jellybeanObj != null) {
545+
jellybean = (boolean) jellybeanObj;
546+
}
547+
Object subProcessFlush = androidConfigMap.get("subProcessFlush");
548+
if (subProcessFlush != null && (boolean) subProcessFlush) {
549+
configOptions.enableSubProcessFlushData();
550+
}
563551
}
564552

565-
Object properties = visualizedConfigMap.get("properties");
566-
if (properties != null) {
567-
configOptions.enableVisualizedProperties((Boolean) properties);
553+
Object javaScriptBridge = map.get("javaScriptBridge");
554+
if (javaScriptBridge != null && (boolean) javaScriptBridge) {
555+
configOptions.enableJavaScriptBridge(jellybean);
568556
}
569-
}
570557

558+
Object visualizedConfig = map.get("visualized");
559+
if (visualizedConfig != null) {
560+
Map visualizedConfigMap = (Map) visualizedConfig;
561+
Object autoTrack = visualizedConfigMap.get("autoTrack");
562+
if (autoTrack != null) {
563+
configOptions.enableVisualizedAutoTrack((Boolean) autoTrack);
564+
}
571565

572-
SensorsDataAPI.startWithConfigOptions(mActivity, configOptions);
566+
Object properties = visualizedConfigMap.get("properties");
567+
if (properties != null) {
568+
configOptions.enableVisualizedProperties((Boolean) properties);
569+
}
570+
}
571+
572+
SensorsDataAPI.startWithConfigOptions(mActivity, configOptions);
573+
} catch (Exception e) {
574+
SALog.printStackTrace(e);
575+
}
576+
result.success(null);
573577
}
574578

575579
private JSONObject assertProperties(Map map) {

ios/sensors_analytics_flutter_plugin.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
Pod::Spec.new do |s|
55
s.name = 'sensors_analytics_flutter_plugin'
6-
s.version = '2.1.0'
6+
s.version = '2.1.1'
77
s.summary = 'A new flutter plugin project.'
88
s.description = <<-DESC
99
A new flutter plugin project.

lib/sensors_analytics_flutter_plugin.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class VisualizedConfig {
3737

3838
// This is the official Flutter Plugin for Sensors Analytics.
3939
class SensorsAnalyticsFlutterPlugin {
40-
static const String FLUTTER_PLUGIN_VERSION = "2.1.0";
40+
static const String FLUTTER_PLUGIN_VERSION = "2.1.1";
4141
static bool hasAddedFlutterPluginVersion = false;
4242

4343
static const MethodChannel _channel = const MethodChannel('sensors_analytics_flutter_plugin');

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: sensors_analytics_flutter_plugin
22
description: This is the official flutter plugin for Sensors Analytics,with this plugin you can easily collect your app data on Android and iOS.
3-
version: 2.1.0
3+
version: 2.1.1
44
homepage: "https://github.com/sensorsdata/sensors_analytics_flutter_plugin"
55

66
environment:

0 commit comments

Comments
 (0)