Skip to content

Commit 95232b1

Browse files
committed
Release 3.0.2
1 parent 5862080 commit 95232b1

17 files changed

+71
-170
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 = "3.0.0"
4+
s.version = "3.0.2"
55
s.summary = "The official React Native SDK of Sensors Analytics."
66
s.description = <<-DESC
77
神策分析 RN 组件

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

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
/*
22
* Created by chenru on 2019/08/27.
3-
* Copyright 2015-2021 Sensors Data Inc.
4-
*
5-
* Licensed under the Apache License, Version 2.0 (the "License");
6-
* you may not use this file except in compliance with the License.
7-
* You may obtain a copy of the License at
8-
*
9-
* http://www.apache.org/licenses/LICENSE-2.0
10-
*
11-
* Unless required by applicable law or agreed to in writing, software
12-
* distributed under the License is distributed on an "AS IS" BASIS,
13-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
* See the License for the specific language governing permissions and
15-
* limitations under the License.
3+
* Copyright 2015-2025 Sensors Data Inc.
164
*/
175

186
package com.sensorsdata.analytics;
@@ -36,24 +24,29 @@
3624
import org.json.JSONObject;
3725

3826
import java.lang.reflect.Field;
27+
import java.lang.ref.WeakReference;
3928
import java.util.WeakHashMap;
4029

4130
public class RNAgent {
42-
private static final WeakHashMap jsTouchDispatcherViewGroupWeakHashMap = new WeakHashMap();
31+
private static final WeakHashMap<JSTouchDispatcher, WeakReference<ViewGroup>> jsTouchDispatcherViewGroupWeakHashMap = new WeakHashMap<>();
4332
private static SparseArray<SAViewProperties> viewPropertiesArray = new SparseArray();
4433
private static JSONObject mDynamicSuperProperties;
4534

4635
public static void handleTouchEvent(
4736
JSTouchDispatcher jsTouchDispatcher, MotionEvent event, EventDispatcher eventDispatcher) {
4837
try {
4938
if (event.getAction() == MotionEvent.ACTION_DOWN) { // ActionDown
50-
ViewGroup viewGroup = (ViewGroup) jsTouchDispatcherViewGroupWeakHashMap.get(jsTouchDispatcher);
39+
WeakReference<ViewGroup> weakViewGroupRef = jsTouchDispatcherViewGroupWeakHashMap.get(jsTouchDispatcher);
40+
ViewGroup viewGroup = weakViewGroupRef != null ? weakViewGroupRef.get() : null;
5141
if (viewGroup == null) {
5242
try {
5343
Field viewGroupField = jsTouchDispatcher.getClass().getDeclaredField("mRootViewGroup");
5444
viewGroupField.setAccessible(true);
5545
viewGroup = (ViewGroup) viewGroupField.get(jsTouchDispatcher);
56-
jsTouchDispatcherViewGroupWeakHashMap.put(jsTouchDispatcher, viewGroup);
46+
// 解决内存泄漏:存入 WeakReference
47+
if (viewGroup != null) {
48+
jsTouchDispatcherViewGroupWeakHashMap.put(jsTouchDispatcher, new WeakReference<>(viewGroup));
49+
}
5750
} catch (Exception e) {
5851
SALog.printStackTrace(e);
5952
}

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

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
/*
22
* Created by chenru on 2019/08/27.
3-
* Copyright 2015-2021 Sensors Data Inc.
4-
*
5-
* Licensed under the Apache License, Version 2.0 (the "License");
6-
* you may not use this file except in compliance with the License.
7-
* You may obtain a copy of the License at
8-
*
9-
* http://www.apache.org/licenses/LICENSE-2.0
10-
*
11-
* Unless required by applicable law or agreed to in writing, software
12-
* distributed under the License is distributed on an "AS IS" BASIS,
13-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
* See the License for the specific language governing permissions and
15-
* limitations under the License.
3+
* Copyright 2015-2025 Sensors Data Inc.
164
*/
175

186
package com.sensorsdata.analytics;

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

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
/*
22
* Created by yang on 2017/4/6.
3-
* Copyright 2015-2021 Sensors Data Inc.
4-
*
5-
* Licensed under the Apache License, Version 2.0 (the "License");
6-
* you may not use this file except in compliance with the License.
7-
* You may obtain a copy of the License at
8-
*
9-
* http://www.apache.org/licenses/LICENSE-2.0
10-
*
11-
* Unless required by applicable law or agreed to in writing, software
12-
* distributed under the License is distributed on an "AS IS" BASIS,
13-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
* See the License for the specific language governing permissions and
15-
* limitations under the License.
3+
* Copyright 2015-2025 Sensors Data Inc.
164
*/
175

186
package com.sensorsdata.analytics;
@@ -28,7 +16,7 @@
2816
import java.util.List;
2917

3018
public class RNSensorsAnalyticsPackage implements ReactPackage {
31-
public static final String VERSION = "3.0.0";
19+
public static final String VERSION = "3.0.2";
3220

3321
@Override
3422
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {

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

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
/*
22
* Created by yang on 2017/4/5
3-
* Copyright 2015-2021 Sensors Data Inc.
4-
*
5-
* Licensed under the Apache License, Version 2.0 (the "License");
6-
* you may not use this file except in compliance with the License.
7-
* You may obtain a copy of the License at
8-
*
9-
* http://www.apache.org/licenses/LICENSE-2.0
10-
*
11-
* Unless required by applicable law or agreed to in writing, software
12-
* distributed under the License is distributed on an "AS IS" BASIS,
13-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
* See the License for the specific language governing permissions and
15-
* limitations under the License.
3+
* Copyright 2015-2025 Sensors Data Inc.
164
*/
175

186
package com.sensorsdata.analytics;

android/src/main/java/com/sensorsdata/analytics/data/SAViewProperties.java

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
/*
22
* Created by chenru on 2020/04/22.
3-
* Copyright 2015-2021 Sensors Data Inc.
4-
*
5-
* Licensed under the Apache License, Version 2.0 (the "License");
6-
* you may not use this file except in compliance with the License.
7-
* You may obtain a copy of the License at
8-
*
9-
* http://www.apache.org/licenses/LICENSE-2.0
10-
*
11-
* Unless required by applicable law or agreed to in writing, software
12-
* distributed under the License is distributed on an "AS IS" BASIS,
13-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
* See the License for the specific language governing permissions and
15-
* limitations under the License.
3+
* Copyright 2015-2025 Sensors Data Inc.
164
*/
175

186
package com.sensorsdata.analytics.data;

android/src/main/java/com/sensorsdata/analytics/property/LibMethodInterceptor.java

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
/*
22
* Created by chenru on 2021/01/05.
3-
* Copyright 2015-2021 Sensors Data Inc.
4-
*
5-
* Licensed under the Apache License, Version 2.0 (the "License");
6-
* you may not use this file except in compliance with the License.
7-
* You may obtain a copy of the License at
8-
*
9-
* http://www.apache.org/licenses/LICENSE-2.0
10-
*
11-
* Unless required by applicable law or agreed to in writing, software
12-
* distributed under the License is distributed on an "AS IS" BASIS,
13-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
* See the License for the specific language governing permissions and
15-
* limitations under the License.
3+
* Copyright 2015-2025 Sensors Data Inc.
164
*/
175

186
package com.sensorsdata.analytics.property;

android/src/main/java/com/sensorsdata/analytics/property/PluginVersionInterceptor.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
/*
22
* Created by chenru on 2020/12/27.
3-
* Copyright 2015-2021 Sensors Data Inc.
4-
*
5-
* Licensed under the Apache License, Version 2.0 (the "License");
6-
* you may not use this file except in compliance with the License.
7-
* You may obtain a copy of the License at
8-
*
9-
* http://www.apache.org/licenses/LICENSE-2.0
10-
*
11-
* Unless required by applicable law or agreed to in writing, software
12-
* distributed under the License is distributed on an "AS IS" BASIS,
13-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
* See the License for the specific language governing permissions and
15-
* limitations under the License.
3+
* Copyright 2015-2025 Sensors Data Inc.
164
*/
175

186
package com.sensorsdata.analytics.property;
@@ -44,4 +32,4 @@ public JSONObject proceed(JSONObject properties, boolean isAuto){
4432
}
4533
return properties;
4634
}
47-
}
35+
}
Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,18 @@
11
/*
22
* Created by chenru on 2020/12/27.
3-
* Copyright 2015-2021 Sensors Data Inc.
4-
*
5-
* Licensed under the Apache License, Version 2.0 (the "License");
6-
* you may not use this file except in compliance with the License.
7-
* You may obtain a copy of the License at
8-
*
9-
* http://www.apache.org/licenses/LICENSE-2.0
10-
*
11-
* Unless required by applicable law or agreed to in writing, software
12-
* distributed under the License is distributed on an "AS IS" BASIS,
13-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
* See the License for the specific language governing permissions and
15-
* limitations under the License.
3+
* Copyright 2015-2025 Sensors Data Inc.
164
*/
175

186
package com.sensorsdata.analytics.property;
197

208
import org.json.JSONObject;
219

22-
import java.util.ArrayList;
10+
import java.util.Vector;
2311
import java.util.List;
2412

2513
public class RNPropertyManager {
2614

27-
public static List<Interceptor> interceptors = new ArrayList<>();
15+
public static Vector<Interceptor> interceptors = new Vector<>();
2816

2917
public static void addInterceptor(Interceptor interceptor){
3018
interceptors.add(interceptor);
@@ -44,4 +32,4 @@ public static JSONObject mergeProperty(JSONObject properties, boolean isAuto){
4432
interface Interceptor{
4533
JSONObject proceed(JSONObject properties, boolean isAuto);
4634
}
47-
}
35+
}

android/src/main/java/com/sensorsdata/analytics/utils/RNUtils.java

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
/*
22
* Created by chenru on 2019/08/27.
3-
* Copyright 2015-2021 Sensors Data Inc.
4-
*
5-
* Licensed under the Apache License, Version 2.0 (the "License");
6-
* you may not use this file except in compliance with the License.
7-
* You may obtain a copy of the License at
8-
*
9-
* http://www.apache.org/licenses/LICENSE-2.0
10-
*
11-
* Unless required by applicable law or agreed to in writing, software
12-
* distributed under the License is distributed on an "AS IS" BASIS,
13-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
* See the License for the specific language governing permissions and
15-
* limitations under the License.
3+
* Copyright 2015-2025 Sensors Data Inc.
164
*/
175

186
package com.sensorsdata.analytics.utils;

0 commit comments

Comments
 (0)