Skip to content

Commit 9add637

Browse files
committed
Release v4.2.0
1 parent fabdb01 commit 9add637

File tree

11 files changed

+36
-18
lines changed

11 files changed

+36
-18
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 4.2.0
2+
3+
* 修复 HarmonyOS $AppStart 全埋点采集失败问题
4+
5+
## 4.1.0
6+
7+
* 支持不依赖 HarmonyOS 埋点 SDK
8+
19
## 4.0.2
210

311
* 全埋点页面浏览事件采集标题支持 AppBar title

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
```yml
1717
dependencies:
1818
# 添加神策 flutter plugin
19-
sensors_analytics_flutter_plugin: ^4.0.2
19+
sensors_analytics_flutter_plugin: ^4.2.0
2020
```
2121
2222
执行 flutter packages get 命令安装插件

example/ohos/build-profile.json5

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
"name": "default",
66
"type": "HarmonyOS",
77
"material": {
8-
"certpath": "/Users/sdktest/.ohos/config/default_ohos_rwYtfdq-WBBUCHYmW7b_T-cB7h96zYChZXwYoUvNlso=.cer",
8+
"certpath": "/Users/chuqiangsheng/.ohos/config/default_ohos_cB7oaG-xCkvzKYohQvgIzulwnSFBJgrlG7eu77CHoLQ=.cer",
99
"keyAlias": "debugKey",
10-
"keyPassword": "0000001A7DD40FD24C07F7BCA4924F3B3D83981A3523D9CA6938B10A4D92FD1961D84795E39DB864483B",
11-
"profile": "/Users/sdktest/.ohos/config/default_ohos_rwYtfdq-WBBUCHYmW7b_T-cB7h96zYChZXwYoUvNlso=.p7b",
10+
"keyPassword": "0000001B0FAF69D00DD797B41C29DA9D0EEA04AA0C9785E8D07ED9D0C0CE3451047C93D66CE91BE9920B30",
11+
"profile": "/Users/chuqiangsheng/.ohos/config/default_ohos_cB7oaG-xCkvzKYohQvgIzulwnSFBJgrlG7eu77CHoLQ=.p7b",
1212
"signAlg": "SHA256withECDSA",
13-
"storeFile": "/Users/sdktest/.ohos/config/default_ohos_rwYtfdq-WBBUCHYmW7b_T-cB7h96zYChZXwYoUvNlso=.p12",
14-
"storePassword": "0000001A28624F45CD26DE3EA748B753E528B2F75498626F238F38A689ACC96A69D41CF76F41D3F5CA3D"
13+
"storeFile": "/Users/chuqiangsheng/.ohos/config/default_ohos_cB7oaG-xCkvzKYohQvgIzulwnSFBJgrlG7eu77CHoLQ=.p12",
14+
"storePassword": "0000001BBFF7F6756D3864C2C70210E5BAB6DBDFAB04B126A3020181482B2617FEEC41DF6C69C35CE89B05"
1515
}
1616
}
1717
],
@@ -40,6 +40,10 @@
4040
{
4141
"name": "SensorsAnalyticsSDK",
4242
"srcPath": "../../../sa-sdk-harmony-next/SensorsAnalyticsSDK"
43+
},
44+
{
45+
"name": "sensors_analytics_flutter_plugin",
46+
"srcPath": "../../../sensors_analytics_flutter_plugin/ohos"
4347
}
4448
]
4549
}

example/ohos/entry/oh-package.json5

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"author": "",
77
"license": "",
88
"dependencies": {
9-
"sensors_analytics_flutter_plugin": "file:../har/sensors_analytics_flutter_plugin.har"
9+
"sensors_analytics_flutter_plugin": "file:../har/sensors_analytics_flutter_plugin.har",
10+
// "sensors_analytics_flutter_plugin": "file:../../../../sensors_analytics_flutter_plugin/ohos",
11+
"@ohos/flutter_ohos": "har/flutter.har"
1012
}
1113
}

example/ohos/oh-package.json5

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@
1818
"@ohos/flutter_module": "file:./entry",
1919
"@sensorsdata/analytics": "file:../../../sa-sdk-harmony-next/SensorsAnalyticsSDK",
2020
"sensors_analytics_flutter_plugin": "file:./har/sensors_analytics_flutter_plugin.har"
21+
// "sensors_analytics_flutter_plugin": "file:../../../sensors_analytics_flutter_plugin/ohos"
2122
}
2223
}

example/pubspec.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ dependencies:
2525
# git:
2626
# url: [email protected]:sensors-analytics/sdk/sensors_analytics_flutter_plugin.git
2727
# ref: cqs_feature_suport_harmonyos
28+
29+
# sensors_analytics_flutter_plugin:
30+
# git:
31+
# url: https://github.com/sensorsdata/sensors_analytics_flutter_plugin.git
32+
# ref: no_ohos # 指定不包含鸿蒙支持分支
2833

2934
# When depending on this package from a real application you should use:
3035
# sensorsanalyticsflutterplugin: ^x.y.z

ios/sensors_analytics_flutter_plugin.podspec

Lines changed: 2 additions & 2 deletions
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 = '4.0.2'
6+
s.version = '4.2.0'
77
s.summary = 'The official flutter iOS plugin of Sensors Analytics.'
88
s.homepage = 'https://www.sensorsdata.cn/'
99
s.license = {
@@ -18,5 +18,5 @@ Pod::Spec.new do |s|
1818
s.dependency 'SensorsAnalyticsSDK', ">= 4.9.0"
1919
# Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported.
2020
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' }
21-
s.resource_bundle = { 'sensors_analytics_flutter_plugin' => 'Resources/**/*'}
21+
s.resource_bundle = { 'sensors_analytics_flutter_plugin_no_ohos' => 'Resources/**/*'}
2222
end

lib/sensors_analytics_flutter_plugin.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class HarmonyConfig {
6868

6969
// This is the official Flutter Plugin for Sensors Analytics.
7070
class SensorsAnalyticsFlutterPlugin {
71-
static const String FLUTTER_PLUGIN_VERSION = "4.0.2";
71+
static const String FLUTTER_PLUGIN_VERSION = "4.2.0";
7272
static bool hasAddedFlutterPluginVersion = false;
7373

7474
static Future<String?> get getDistinctId async {

ohos/oh-package.json5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"HarmonyOS 埋点",
88
"Flutter 埋点",
99
"Flutter 神策埋点",
10-
"Flutter 支持 HarmonyOS 埋点"
10+
"Flutter HarmonyOS 埋点"
1111
],
1212
"main": "index.ets",
1313
"author": "",

ohos/src/main/ets/components/SensorsAnalyticsFlutterPlugin.ets

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,9 @@ type SAFlutterPluginCallMap = Map<string, string | boolean | number | Array<stri
2121
/** SensorsAnalyticsFlutterPlugin **/
2222
export default class SensorsAnalyticsFlutterPlugin implements FlutterPlugin, MethodCallHandler {
2323
private channel: MethodChannel | null = null;
24-
private context: Context | null = null;
24+
private applicationContext: common.Context | null = null;
2525
private moduleManager: SAFlutterManager = new SAFlutterManager();
2626

27-
constructor() {
28-
}
29-
3027
getUniqueClassName(): string {
3128
return "SensorsAnalyticsFlutterPlugin"
3229
}
@@ -36,7 +33,7 @@ export default class SensorsAnalyticsFlutterPlugin implements FlutterPlugin, Met
3633
this.channel.setMethodCallHandler(this)
3734
// 调试出现过 getContext(this) 无法取到结果
3835
// 如果使用 ApplicationContext,原生 $AppEnd 和 $AppStart 全埋点点无法采集
39-
this.context = getContext(this) as common.UIAbilityContext ?? binding.getApplicationContext();
36+
this.applicationContext = binding.getApplicationContext();
4037
}
4138

4239
onDetachedFromEngine(binding: FlutterPluginBinding): void {
@@ -553,9 +550,10 @@ export default class SensorsAnalyticsFlutterPlugin implements FlutterPlugin, Met
553550
return map.get(key) as T | undefined;
554551
};
555552

553+
let uiContext = getContext(this) as common.UIAbilityContext ?? this.applicationContext;
556554
// 构建 InitPara 参数
557555
const initPara: global.InitPara = {
558-
context: this.context as object,
556+
context: uiContext,
559557
server_url: map.get('serverUrl') as string
560558
};
561559

0 commit comments

Comments
 (0)