Skip to content

Commit 83dea53

Browse files
author
weiqiangliu
committed
Release 2.4.0
1 parent 43f8222 commit 83dea53

File tree

15 files changed

+121
-25
lines changed

15 files changed

+121
-25
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 2.4.0
2+
3+
* 异常处理优化
4+
* 支持页面离开事件采集
5+
16
## 2.3.1
27

38
* Release 模式下,延迟初始化后立即触发事件失败的问题

README.md

Lines changed: 2 additions & 2 deletions
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.3.1
20+
sensors_analytics_flutter_plugin: ^2.4.0
2121
```
2222
2323
执行 flutter packages get 命令安装插件
@@ -61,7 +61,7 @@ dependencies:
6161

6262
## License
6363

64-
Copyright 2015-2022 Sensors Data Inc.
64+
Copyright 2015-2023 Sensors Data Inc.
6565

6666
Licensed under the Apache License, Version 2.0 (the "License");
6767
you may not use this file except in compliance with the License.

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

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,25 @@ public void onReceive(Context context, Intent intent) {
5555
public synchronized void registerBroadcast(Context context) {
5656
SALog.i(TAG, "registerBroadcast:" + isRegister);
5757
if (!isRegister) {
58-
SALog.i(TAG, "registerBroadcast");
59-
IntentFilter filter = new IntentFilter();
60-
filter.addAction(FLUTTER_ACTION);
61-
context.registerReceiver(mDynamicReceiver, filter);
62-
isRegister = true;
58+
try {
59+
SALog.i(TAG, "registerBroadcast");
60+
IntentFilter filter = new IntentFilter();
61+
filter.addAction(FLUTTER_ACTION);
62+
context.registerReceiver(mDynamicReceiver, filter);
63+
isRegister = true;
64+
} catch (Exception e) {
65+
SALog.printStackTrace(e);
66+
}
6367
}
6468
}
6569

6670
public synchronized void unRegisterBroadcast(Context context) {
6771
SALog.i(TAG, "unRegisterBroadcast");
68-
context.unregisterReceiver(mDynamicReceiver);
72+
try {
73+
context.unregisterReceiver(mDynamicReceiver);
74+
} catch (Exception e) {
75+
SALog.printStackTrace(e);
76+
}
6977
isRegister = false;
7078
}
7179
}

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

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
204204
case "loginWithKey":
205205
loginWithKey(list, result);
206206
break;
207+
case "isAutoTrackEventTypeIgnored":
208+
isAutoTrackEventTypeIgnored(list, result);
209+
break;
207210
default:
208211
result.notImplemented();
209212
break;
@@ -356,7 +359,16 @@ private void trackInstallation(List list) {
356359
* track 事件
357360
*/
358361
private void track(List list) {
359-
SensorsDataAPI.sharedInstance().track(assertEventName((String) list.get(0)), assertProperties((Map) list.get(1)));
362+
try {
363+
String eventName = assertEventName((String) list.get(0));
364+
JSONObject properties = assertProperties((Map) list.get(1));
365+
if (properties != null && "$AppPageLeave".equals(eventName) && !properties.has("$referrer")) {
366+
properties.put("$referrer", SensorsDataAPI.sharedInstance().getLastScreenUrl());
367+
}
368+
SensorsDataAPI.sharedInstance().track(eventName, properties);
369+
} catch (Exception e) {
370+
SALog.printStackTrace(e);
371+
}
360372
}
361373

362374
/**
@@ -666,6 +678,16 @@ private void loginWithKey(List list, Result result) {
666678
}
667679
}
668680

681+
private void isAutoTrackEventTypeIgnored(List list, Result result) {
682+
try {
683+
int type = (int) list.get(0);
684+
boolean isIgnored = SensorsDataAPI.sharedInstance().isAutoTrackEventTypeIgnored(type);
685+
result.success(isIgnored);
686+
} catch (Exception e) {
687+
SALog.printStackTrace(e);
688+
}
689+
}
690+
669691
private JSONObject assertProperties(Map map) {
670692
if (map != null) {
671693
return new JSONObject(map);

example/ios/Flutter/AppFrameworkInfo.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
<key>CFBundleVersion</key>
2222
<string>1.0</string>
2323
<key>MinimumOSVersion</key>
24-
<string>8.0</string>
24+
<string>11.0</string>
2525
</dict>
2626
</plist>

example/ios/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Uncomment this line to define a global platform for your project
2-
platform :ios, '9.0'
2+
platform :ios, '11.0'
33

44
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
55
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 51;
6+
objectVersion = 54;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -166,7 +166,7 @@
166166
97C146E61CF9000F007C117D /* Project object */ = {
167167
isa = PBXProject;
168168
attributes = {
169-
LastUpgradeCheck = 1020;
169+
LastUpgradeCheck = 1300;
170170
ORGANIZATIONNAME = "";
171171
TargetAttributes = {
172172
97C146ED1CF9000F007C117D = {
@@ -209,6 +209,7 @@
209209
/* Begin PBXShellScriptBuildPhase section */
210210
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
211211
isa = PBXShellScriptBuildPhase;
212+
alwaysOutOfDate = 1;
212213
buildActionMask = 2147483647;
213214
files = (
214215
);
@@ -223,6 +224,7 @@
223224
};
224225
9740EEB61CF901F6004384FC /* Run Script */ = {
225226
isa = PBXShellScriptBuildPhase;
227+
alwaysOutOfDate = 1;
226228
buildActionMask = 2147483647;
227229
files = (
228230
);
@@ -350,7 +352,7 @@
350352
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
351353
GCC_WARN_UNUSED_FUNCTION = YES;
352354
GCC_WARN_UNUSED_VARIABLE = YES;
353-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
355+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
354356
MTL_ENABLE_DEBUG_INFO = NO;
355357
SDKROOT = iphoneos;
356358
SUPPORTED_PLATFORMS = iphoneos;
@@ -432,7 +434,7 @@
432434
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
433435
GCC_WARN_UNUSED_FUNCTION = YES;
434436
GCC_WARN_UNUSED_VARIABLE = YES;
435-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
437+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
436438
MTL_ENABLE_DEBUG_INFO = YES;
437439
ONLY_ACTIVE_ARCH = YES;
438440
SDKROOT = iphoneos;
@@ -481,7 +483,7 @@
481483
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
482484
GCC_WARN_UNUSED_FUNCTION = YES;
483485
GCC_WARN_UNUSED_VARIABLE = YES;
484-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
486+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
485487
MTL_ENABLE_DEBUG_INFO = NO;
486488
SDKROOT = iphoneos;
487489
SUPPORTED_PLATFORMS = iphoneos;

example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1020"
3+
LastUpgradeVersion = "1300"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

example/ios/Runner/Info.plist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,9 @@
5959
</array>
6060
<key>UIViewControllerBasedStatusBarAppearance</key>
6161
<false/>
62+
<key>CADisableMinimumFrameDurationOnPhone</key>
63+
<true/>
64+
<key>UIApplicationSupportsIndirectInputEvents</key>
65+
<true/>
6266
</dict>
6367
</plist>

0 commit comments

Comments
 (0)