Skip to content

Commit

Permalink
Release 2.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
weiqiangliu committed Oct 18, 2021
1 parent 6f9ed65 commit 55e435f
Show file tree
Hide file tree
Showing 9 changed files with 206 additions and 167 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
SensorsAnalytics SDK 是国内第一家开源商用版用户行为采集 SDK,目前支持代码埋点、全埋点、App 点击图、可视化全埋点等。目前已累计有 1500 多家付费客户,2500+ 的 App 集成使用,作为 App 数据采集利器,致力于帮助客户挖掘更多的商业价值,为其精准运营和业务支撑提供了可靠的数据来源。其采集全面而灵活、性能良好,并一直保持稳定的迭代,经受住了时间和客户的考验。

## 基本要求
App 元素点击事件要求 React Native 0.23 ~ 0.63;
App 元素点击事件要求 React Native 0.23 ~ 0.66;
App 页面浏览事件要求 React Navigation ^2.0 ~ ^5.0;
App 可视化全埋点要求 React Native 0.46 ~ 0.63;
App 点击事件自定义属性要求 React Native 0.46 ~ 0.63。
App 可视化全埋点要求 React Native 0.46 ~ 0.66;
App 点击事件自定义属性要求 React Native 0.46 ~ 0.66。

## 集成方式
### 安装 React Native 模块
Expand Down
2 changes: 1 addition & 1 deletion RNSensorsAnalyticsModule.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Pod::Spec.new do |s|
s.name = "RNSensorsAnalyticsModule"
s.version = "2.1.4"
s.version = "2.1.5"
s.summary = "The official React Native SDK of Sensors Analytics."
s.description = <<-DESC
神策分析 RN 组件
Expand Down
316 changes: 166 additions & 150 deletions SensorsDataRNHook.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ public static void addView(View view, int index) {
SAViewProperties properties = viewPropertiesArray.get(view.getId());
if (properties != null) {
properties.setViewClickable(view);
properties.setViewTag(view);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import java.util.List;

public class RNSensorsAnalyticsPackage implements ReactPackage {
public static final String VERSION = "2.1.4";
public static final String VERSION = "2.1.5";
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
List<NativeModule> modules = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,53 @@

package com.sensorsdata.analytics.data;

import android.content.Context;
import android.view.View;
import android.widget.ScrollView;

import com.facebook.react.bridge.ReadableMap;
import com.sensorsdata.analytics.android.sdk.SALog;
import com.sensorsdata.analytics.utils.RNUtils;
import android.util.Log;

import org.json.JSONObject;

public class SAViewProperties {
private boolean clickable;
private final static String TAG = "SAViewProperties";
private boolean clickable;
public JSONObject properties;
private int tagKey = 0;
private boolean isSupportSDKVersion = true;

public SAViewProperties(boolean clickable, ReadableMap params){
public SAViewProperties(boolean clickable, ReadableMap params) {
this.clickable = clickable;
this.properties = RNUtils.convertToJSONObject(params);
}

public void setViewClickable(View view){
try{
if(view != null){
if(!(view instanceof ScrollView)){
view.setClickable(clickable);
public void setViewClickable(View view) {
try {
if (view != null && !(view instanceof ScrollView)) {
view.setClickable(clickable);
}
} catch (Exception e) {
SALog.i(TAG, "clickable error:" + e.getMessage());
}
}

public void setViewTag(View view) {
try {
if (view != null && isSupportSDKVersion) {
if (tagKey == 0) {
Context context = view.getContext();
tagKey = context.getResources().getIdentifier("sensors_analytics_tag_view_rn_key", "id", context.getPackageName());
}
if (tagKey != 0) {
view.setTag(tagKey, true);
} else {
isSupportSDKVersion = false;
}
}
}catch (Exception e){
Log.d("SAViewProperties clickable error:", e.getMessage());
} catch (Exception e) {
SALog.i(TAG, "RNView setTag error:" + e.getMessage());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public static void saveScreenAndTitle(String screenName, String title) {
screenProperties = new JSONObject();
screenProperties.put("$title", title);
screenProperties.put("$screen_name", screenName);
screenProperties.put("isSetRNViewTag", true);//标识当前页面已区分 RNView 和原生 View
} catch (Exception ignored) {

}
Expand Down
2 changes: 1 addition & 1 deletion ios/RNSensorsAnalyticsModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#import "SAReactNativeManager.h"
#import "SAReactNativeEventProperty.h"

NSString *const kSAReactNativePluginVersion = @"react_native:2.1.4";
NSString *const kSAReactNativePluginVersion = @"react_native:2.1.5";

@implementation RNSensorsAnalyticsModule

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sensorsdata-analytics-react-native",
"version": "2.1.4",
"version": "2.1.5",
"private": false,
"description": "神策分析 RN 组件",
"main": "index.js",
Expand Down

0 comments on commit 55e435f

Please sign in to comment.