Skip to content

Commit 713c78d

Browse files
committed
Release 3.0.0
1 parent 3931a57 commit 713c78d

17 files changed

+1230
-226
lines changed

RNSensorsAnalyticsModule.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Pod::Spec.new do |s|
33
s.name = "RNSensorsAnalyticsModule"
4-
s.version = "2.3.7"
4+
s.version = "3.0.0"
55
s.summary = "The official React Native SDK of Sensors Analytics."
66
s.description = <<-DESC
77
神策分析 RN 组件

android/src/main/java/com/sensorsdata/analytics/RNSensorsAnalyticsPackage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import java.util.List;
2929

3030
public class RNSensorsAnalyticsPackage implements ReactPackage {
31-
public static final String VERSION = "2.3.7";
31+
public static final String VERSION = "3.0.0";
3232

3333
@Override
3434
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/**
2+
* This code was generated by "react-native codegen-harmony"
3+
*
4+
* Do not edit this file as changes may cause incorrect behavior and will be
5+
* lost once the code is regenerated.
6+
*
7+
* @generatorVersion: 1
8+
*/
9+
10+
#include "NativeSensorsAnalyticsModule.h"
11+
12+
namespace rnoh {
13+
using namespace facebook;
14+
15+
NativeSensorsAnalyticsModule::NativeSensorsAnalyticsModule(const ArkTSTurboModule::Context ctx, const std::string name) : ArkTSTurboModule(ctx, name) {
16+
methodMap_ = {
17+
ARK_METHOD_METADATA(login, 1),
18+
ARK_METHOD_METADATA(logout, 0),
19+
ARK_METHOD_METADATA(profileSet, 1),
20+
ARK_METHOD_METADATA(profileSetOnce, 1),
21+
ARK_METHOD_METADATA(track, 2),
22+
ARK_METHOD_METADATA(trackTimerStart, 1),
23+
ARK_METHOD_METADATA(trackTimerEnd, 2),
24+
ARK_METHOD_METADATA(clearTrackTimer, 0),
25+
ARK_METHOD_METADATA(trackViewScreen, 2),
26+
ARK_METHOD_METADATA(profileIncrement, 2),
27+
ARK_METHOD_METADATA(profileAppend, 2),
28+
ARK_METHOD_METADATA(profileUnset, 1),
29+
ARK_METHOD_METADATA(profileDelete, 0),
30+
ARK_ASYNC_METHOD_METADATA(getDistinctIdPromise, 0),
31+
ARK_ASYNC_METHOD_METADATA(getAnonymousIdPromise, 0),
32+
ARK_METHOD_METADATA(registerSuperProperties, 1),
33+
ARK_METHOD_METADATA(unregisterSuperProperty, 1),
34+
ARK_METHOD_METADATA(clearSuperProperties, 0),
35+
ARK_METHOD_METADATA(flush, 0),
36+
ARK_METHOD_METADATA(deleteAll, 0),
37+
ARK_METHOD_METADATA(identify, 1),
38+
ARK_METHOD_METADATA(trackTimerPause, 1),
39+
ARK_METHOD_METADATA(trackTimerResume, 1),
40+
ARK_METHOD_METADATA(resetAnonymousId, 0),
41+
ARK_METHOD_METADATA(itemSet, 3),
42+
ARK_METHOD_METADATA(itemDelete, 2),
43+
ARK_ASYNC_METHOD_METADATA(getPresetPropertiesPromise, 0),
44+
ARK_ASYNC_METHOD_METADATA(getLoginIdPromise, 0),
45+
ARK_METHOD_METADATA(trackAppInstall, 1),
46+
ARK_METHOD_METADATA(setDynamicSuperProperties, 1),
47+
ARK_METHOD_METADATA(bind, 2),
48+
ARK_METHOD_METADATA(unbind, 2),
49+
ARK_METHOD_METADATA(init, 1),
50+
ARK_METHOD_METADATA(currentPlatform, 0),
51+
};
52+
}
53+
54+
} // namespace rnoh
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* This code was generated by "react-native codegen-harmony"
3+
*
4+
* Do not edit this file as changes may cause incorrect behavior and will be
5+
* lost once the code is regenerated.
6+
*
7+
* @generatorVersion: 1
8+
*/
9+
10+
#pragma once
11+
12+
#include "RNOH/ArkTSTurboModule.h"
13+
14+
namespace rnoh {
15+
16+
class JSI_EXPORT NativeSensorsAnalyticsModule : public ArkTSTurboModule {
17+
public:
18+
NativeSensorsAnalyticsModule(const ArkTSTurboModule::Context ctx, const std::string name);
19+
};
20+
21+
} // namespace rnoh
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/**
2+
* This code was generated by "react-native codegen-harmony"
3+
*
4+
* Do not edit this file as changes may cause incorrect behavior and will be
5+
* lost once the code is regenerated.
6+
*
7+
* @generatorVersion: 1
8+
*/
9+
10+
#pragma once
11+
12+
#include "RNOH/Package.h"
13+
#include "RNOH/ArkTSTurboModule.h"
14+
#include "sensorsdata/NativeSensorsAnalyticsModule.h"
15+
16+
namespace rnoh {
17+
18+
class RNOHGeneratedPackageTurboModuleFactoryDelegate : public TurboModuleFactoryDelegate {
19+
public:
20+
SharedTurboModule createTurboModule(Context ctx, const std::string &name) const override {
21+
if (name == "NativeSensorsAnalyticsModule") {
22+
return std::make_shared<NativeSensorsAnalyticsModule>(ctx, name);
23+
}
24+
return nullptr;
25+
};
26+
};
27+
28+
class GeneratedEventEmitRequestHandler : public EventEmitRequestHandler {
29+
public:
30+
void handleEvent(Context const &ctx) override {
31+
auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<facebook::react::EventEmitter>(ctx.tag);
32+
if (eventEmitter == nullptr) {
33+
return;
34+
}
35+
36+
std::vector<std::string> supportedEventNames = {
37+
};
38+
if (std::find(supportedEventNames.begin(), supportedEventNames.end(), ctx.eventName) != supportedEventNames.end()) {
39+
eventEmitter->dispatchEvent(ctx.eventName, ArkJS(ctx.env).getDynamic(ctx.payload));
40+
}
41+
}
42+
};
43+
44+
class RNOHGeneratedPackage : public Package {
45+
public:
46+
RNOHGeneratedPackage(Package::Context ctx) : Package(ctx){};
47+
48+
std::unique_ptr<TurboModuleFactoryDelegate> createTurboModuleFactoryDelegate() override {
49+
return std::make_unique<RNOHGeneratedPackageTurboModuleFactoryDelegate>();
50+
}
51+
52+
std::vector<facebook::react::ComponentDescriptorProvider> createComponentDescriptorProviders() override {
53+
return {
54+
};
55+
}
56+
57+
ComponentJSIBinderByString createComponentJSIBinderByName() override {
58+
return {
59+
};
60+
};
61+
62+
EventEmitRequestHandlers createEventEmitRequestHandlers() override {
63+
return {
64+
std::make_shared<GeneratedEventEmitRequestHandler>(),
65+
};
66+
}
67+
};
68+
69+
} // namespace rnoh
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
/**
2+
* This code was generated by "react-native codegen-harmony"
3+
*
4+
* Do not edit this file as changes may cause incorrect behavior and will be
5+
* lost once the code is regenerated.
6+
*
7+
* @generatorVersion: 1
8+
*/
9+
10+
export namespace NativeSensorsAnalyticsModule {
11+
export const NAME = 'NativeSensorsAnalyticsModule' as const
12+
13+
type SAPropertiesType = string | boolean | number | Array<string> | Date | Function;
14+
15+
export type SAPropertiesObjectType = { [key: string]: SAPropertiesType }
16+
17+
export type SAConfigOptions = {
18+
server_url: string, //数据接收地址,默认 ""
19+
show_log: boolean, //是否显示日志,默认 false
20+
harmony: { // HarmonyOS 端特有配置
21+
max_cache_size?: number //最大缓存条数,默认 10000
22+
},
23+
global_properties?: SAPropertiesObjectType, // 全局属性
24+
// auto_track: SAAutoTrackType,// 全埋点开关,默认不开启
25+
javascript_bridge: boolean, //H5 打通开关,默认 false
26+
flush_interval: number, //数据上报间隔,默认 15*1000 毫秒
27+
flush_bulksize: number, //数据缓存上报最大条数,默认 100 条
28+
}
29+
30+
enum SAAutoTrackType {
31+
START = 1,
32+
END = 2,
33+
CLICK = 4,
34+
VIEW_SCREEN = 8,
35+
}
36+
37+
export interface Spec {
38+
login(loginId: string): void;
39+
40+
logout(): void;
41+
42+
profileSet(profile: SAPropertiesObjectType): void;
43+
44+
profileSetOnce(profile: SAPropertiesObjectType): void;
45+
46+
track(event: string, properties: SAPropertiesObjectType): void;
47+
48+
trackTimerStart(event: string): void;
49+
50+
trackTimerEnd(event: string, properties: SAPropertiesObjectType): void;
51+
52+
clearTrackTimer(): void;
53+
54+
trackViewScreen(url: string, properties: SAPropertiesObjectType): void;
55+
56+
profileIncrement(property: string, value: number): void;
57+
58+
profileAppend(property: string, strList: string[]): void;
59+
60+
profileUnset(property: string): void;
61+
62+
profileDelete(): void;
63+
64+
getDistinctIdPromise(): Promise<string>;
65+
66+
getAnonymousIdPromise(): Promise<string>;
67+
68+
registerSuperProperties(properties: SAPropertiesObjectType): void;
69+
70+
unregisterSuperProperty(property: string): void;
71+
72+
clearSuperProperties(): void;
73+
74+
flush(): void;
75+
76+
deleteAll(): void;
77+
78+
identify(anonymousId: string): void;
79+
80+
trackTimerPause(eventName: string): void;
81+
82+
trackTimerResume(eventName: string): void;
83+
84+
resetAnonymousId(): void;
85+
86+
itemSet(itemType: string, itemId: string, properties: SAPropertiesObjectType): void;
87+
88+
itemDelete(itemType: string, itemId: string): void;
89+
90+
getPresetPropertiesPromise(): Promise<SAPropertiesObjectType>;
91+
92+
getLoginIdPromise(): Promise<string>;
93+
94+
trackAppInstall(properties: Object): void;
95+
96+
setDynamicSuperProperties(properties: SAPropertiesObjectType): void;
97+
98+
bind(key: string, value: string): void;
99+
100+
unbind(key: string, value: string): void;
101+
102+
init(config: SAConfigOptions): void;
103+
104+
currentPlatform(): string;
105+
}
106+
}
107+
108+
// export * from "./NativeSensorsAnalyticsModule"
109+
export * as SA from "./NativeSensorsAnalyticsModule"

0 commit comments

Comments
 (0)