Skip to content

Commit 468aa51

Browse files
author
weiqiangliu
committed
Release 2.2.0
1 parent 7ce2946 commit 468aa51

File tree

16 files changed

+306
-80
lines changed

16 files changed

+306
-80
lines changed

.idea/workspace.xml

Lines changed: 1 addition & 3 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.2.0
2+
3+
* 延迟初始化支持配置全局属性
4+
15
## 2.1.1
26

37
* 初始化方法支持 await 修饰

README.md

Lines changed: 3 additions & 3 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.1.1
20+
sensors_analytics_flutter_plugin: ^2.2.0
2121
```
2222
2323
执行 flutter packages get 命令安装插件
@@ -27,7 +27,7 @@ dependencies:
2727

2828
## 集成文档
2929

30-
请参考神策官网 [Flutter 插件集成文档](https://www.sensorsdata.cn/manual/sdk_flutter.html)
30+
请参考神策官网 [Flutter 插件集成文档](https://manual.sensorsdata.cn/sa/latest/flutter-1574005.html)
3131

3232

3333
## 贡献
@@ -61,7 +61,7 @@ dependencies:
6161

6262
## License
6363

64-
Copyright 2015-2021 Sensors Data Inc.
64+
Copyright 2015-2022 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/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ android {
3333
}
3434

3535
dependencies {
36-
api 'com.sensorsdata.analytics.android:SensorsAnalyticsSDK:6.4.1'
36+
api 'com.sensorsdata.analytics.android:SensorsAnalyticsSDK:6.5.1'
3737
//implementation 'org.json:json:20220320'
3838
}

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@
55

66
import androidx.annotation.NonNull;
77

8+
import com.sensorsdata.analytics.android.sdk.PropertyBuilder;
89
import com.sensorsdata.analytics.android.sdk.SAConfigOptions;
910
import com.sensorsdata.analytics.android.sdk.SALog;
1011
import com.sensorsdata.analytics.android.sdk.SensorsDataAPI;
12+
import com.sensorsdata.analytics.android.sdk.plugin.property.SAPropertyPlugin;
13+
import com.sensorsdata.analytics.android.sdk.plugin.property.SAPropertyPluginPriority;
14+
import com.sensorsdata.analytics.android.sdk.plugin.property.beans.SAPropertiesFetcher;
1115

1216
import org.json.JSONArray;
17+
import org.json.JSONException;
1318
import org.json.JSONObject;
1419

1520
import java.util.ArrayList;
@@ -568,7 +573,34 @@ private void startWithConfig(List list, Result result) {
568573
configOptions.enableVisualizedProperties((Boolean) properties);
569574
}
570575
}
576+
final Map globalProperties = (Map) map.get("globalProperties");
577+
if (globalProperties != null && globalProperties.size() > 0) {
578+
configOptions.registerPropertyPlugin(new SAPropertyPlugin() {
571579

580+
@Override
581+
public SAPropertyPluginPriority priority() {
582+
return SAPropertyPluginPriority.LOW;
583+
}
584+
585+
@Override
586+
public String getName() {
587+
return "SAFlutterGloblePropertyPlugin";
588+
}
589+
590+
@Override
591+
public void properties(SAPropertiesFetcher fetcher) {
592+
Iterator iterator = globalProperties.entrySet().iterator();
593+
while (iterator.hasNext()) {
594+
Map.Entry entry = (Map.Entry) iterator.next();
595+
try {
596+
fetcher.getProperties().put((String) entry.getKey(), entry.getValue());
597+
} catch (JSONException e) {
598+
SALog.printStackTrace(e);
599+
}
600+
}
601+
}
602+
});
603+
}
572604
SensorsDataAPI.startWithConfigOptions(mActivity, configOptions);
573605
} catch (Exception e) {
574606
SALog.printStackTrace(e);

example/ios/Podfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ flutter_ios_podfile_setup
2929

3030
target 'Runner' do
3131
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
32+
3233
end
3334

3435
post_install do |installer|

example/ios/Podfile.lock

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,43 @@
11
PODS:
22
- Flutter (1.0.0)
3-
- sensors_analytics_flutter_plugin (2.0.4):
3+
- sensors_analytics_flutter_plugin (2.1.1):
44
- Flutter
5-
- SensorsAnalyticsSDK (>= 4.0.0)
6-
- SensorsAnalyticsSDK (4.3.4):
7-
- SensorsAnalyticsSDK/Core (= 4.3.4)
8-
- SensorsAnalyticsSDK/__Store (4.3.4)
9-
- SensorsAnalyticsSDK/AutoTrack (4.3.4):
5+
- SensorsAnalyticsSDK (>= 4.4.0)
6+
- SensorsAnalyticsSDK (4.4.4):
7+
- SensorsAnalyticsSDK/Core (= 4.4.4)
8+
- SensorsAnalyticsSDK/__Store (4.4.4)
9+
- SensorsAnalyticsSDK/AutoTrack (4.4.4):
1010
- SensorsAnalyticsSDK/Common
11-
- SensorsAnalyticsSDK/Base (4.3.4):
11+
- SensorsAnalyticsSDK/Base (4.4.4):
1212
- SensorsAnalyticsSDK/__Store
13-
- SensorsAnalyticsSDK/Common (4.3.4):
13+
- SensorsAnalyticsSDK/Common (4.4.4):
1414
- SensorsAnalyticsSDK/Extension
15-
- SensorsAnalyticsSDK/Core (4.3.4):
15+
- SensorsAnalyticsSDK/Core (4.4.4):
1616
- SensorsAnalyticsSDK/Common
1717
- SensorsAnalyticsSDK/Visualized
18-
- SensorsAnalyticsSDK/Extension (4.3.4):
18+
- SensorsAnalyticsSDK/Extension (4.4.4):
1919
- SensorsAnalyticsSDK/Base
20-
- SensorsAnalyticsSDK/Visualized (4.3.4):
20+
- SensorsAnalyticsSDK/Visualized (4.4.4):
2121
- SensorsAnalyticsSDK/AutoTrack
2222

2323
DEPENDENCIES:
2424
- Flutter (from `Flutter`)
2525
- sensors_analytics_flutter_plugin (from `.symlinks/plugins/sensors_analytics_flutter_plugin/ios`)
26-
27-
SPEC REPOS:
28-
trunk:
29-
- SensorsAnalyticsSDK
26+
- SensorsAnalyticsSDK (from `~/Documents/Gitlab_SensorsData/sa-sdk-ios`)
3027

3128
EXTERNAL SOURCES:
3229
Flutter:
3330
:path: Flutter
3431
sensors_analytics_flutter_plugin:
3532
:path: ".symlinks/plugins/sensors_analytics_flutter_plugin/ios"
33+
SensorsAnalyticsSDK:
34+
:path: "~/Documents/Gitlab_SensorsData/sa-sdk-ios"
3635

3736
SPEC CHECKSUMS:
3837
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
39-
sensors_analytics_flutter_plugin: 3c172b37f8b6883c8ed3cb08ae19a49b84810faf
40-
SensorsAnalyticsSDK: 159263992e8bf2e61b18fff55939db826050764c
38+
sensors_analytics_flutter_plugin: 54ef22a4462601d14ae540726ae9364d21ec0cba
39+
SensorsAnalyticsSDK: 4277a63f9cd4797a9e311328fdedd3ad0d8b4576
4140

42-
PODFILE CHECKSUM: 3aaee2e660a2a825e7c3beecb0e4a334b934f851
41+
PODFILE CHECKSUM: 08cf5346de1bcc701f8332abbfc7cfc38ccb4b41
4342

4443
COCOAPODS: 1.11.2

example/ios/Runner/AppDelegate.m

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,32 @@
55
@implementation AppDelegate
66

77
- (BOOL)application:(UIApplication *)application
8-
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
9-
// [SensorsAnalyticsSDK sharedInstanceWithServerURL:@"http://sdk-test.cloud.sensorsdata.cn:8006/sa?project=default&token=95c73ae661f85aa0" andLaunchOptions:launchOptions andDebugMode:SensorsAnalyticsDebugAndTrack];
10-
// [SensorsAnalyticsSDK.sharedInstance enableLog:YES];
11-
// [[SensorsAnalyticsSDK sharedInstance] enableAutoTrack:SensorsAnalyticsEventTypeAppStart |
12-
// SensorsAnalyticsEventTypeAppEnd |
13-
// SensorsAnalyticsEventTypeAppClick|SensorsAnalyticsEventTypeAppViewScreen];
14-
// [GeneratedPluginRegistrant registerWithRegistry:self];
15-
// // Override point for customization after application launch.
16-
// return [super application:application didFinishLaunchingWithOptions:launchOptions];
17-
//
8+
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
9+
// [SensorsAnalyticsSDK sharedInstanceWithServerURL:@"http://sdk-test.cloud.sensorsdata.cn:8006/sa?project=default&token=95c73ae661f85aa0" andLaunchOptions:launchOptions andDebugMode:SensorsAnalyticsDebugAndTrack];
10+
// [SensorsAnalyticsSDK.sharedInstance enableLog:YES];
11+
// [[SensorsAnalyticsSDK sharedInstance] enableAutoTrack:SensorsAnalyticsEventTypeAppStart |
12+
// SensorsAnalyticsEventTypeAppEnd |
13+
// SensorsAnalyticsEventTypeAppClick|SensorsAnalyticsEventTypeAppViewScreen];
14+
// [GeneratedPluginRegistrant registerWithRegistry:self];
15+
// // Override point for customization after application launch.
16+
// return [super application:application didFinishLaunchingWithOptions:launchOptions];
17+
//
1818

1919

20-
[GeneratedPluginRegistrant registerWithRegistry:self];
20+
[GeneratedPluginRegistrant registerWithRegistry:self];
2121

22-
// 初始化配置
23-
SAConfigOptions *options = [[SAConfigOptions alloc] initWithServerURL:@"http://sdkdebugtest.datasink.sensorsdata.cn/sa?project=default&token=cfb8b60e42e0ae9b" launchOptions:launchOptions];
24-
// 开启全埋点
25-
options.autoTrackEventType = SensorsAnalyticsEventTypeAppStart |
26-
SensorsAnalyticsEventTypeAppEnd |
27-
SensorsAnalyticsEventTypeAppClick |
28-
SensorsAnalyticsEventTypeAppViewScreen;
29-
options.enableLog = YES;
30-
[SensorsAnalyticsSDK startWithConfigOptions:options];
31-
return [super application:application didFinishLaunchingWithOptions:launchOptions];;
22+
// 初始化配置
23+
SAConfigOptions *options = [[SAConfigOptions alloc] initWithServerURL:@"http://sdkdebugtest.datasink.sensorsdata.cn/sa?project=default&token=cfb8b60e42e0ae9b" launchOptions:launchOptions];
24+
// 开启全埋点
25+
options.autoTrackEventType = SensorsAnalyticsEventTypeAppStart |
26+
SensorsAnalyticsEventTypeAppEnd |
27+
SensorsAnalyticsEventTypeAppClick |
28+
SensorsAnalyticsEventTypeAppViewScreen;
29+
options.enableLog = YES;
30+
31+
// 在 Flutter 中初始化 SDK
32+
// [SensorsAnalyticsSDK startWithConfigOptions:options];
33+
return [super application:application didFinishLaunchingWithOptions:launchOptions];;
3234
}
3335

3436
@end

0 commit comments

Comments
 (0)