Skip to content

Commit a1dba2b

Browse files
authored
UPDATE react-native-hms-analytics 5.2.0-301 (#107)
* UPDATE react-native-hms-analytics 5.2.0-301
1 parent 4545776 commit a1dba2b

33 files changed

Lines changed: 1100 additions & 6667 deletions

react-native-hms-analytics/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<p align="center">
77
<a href="https://www.npmjs.com/package/@hmscore/react-native-hms-analytics"><img src="https://img.shields.io/npm/dm/@hmscore/react-native-hms-analytics?color=%23007EC6&style=for-the-badge" alt="downloads"></a>
88
<a href="https://www.npmjs.com/package/@hmscore/react-native-hms-analytics"><img src="https://img.shields.io/npm/v/@hmscore/react-native-hms-analytics?color=%23ed2a1c&style=for-the-badge" alt="NPM version"></a>
9-
<a href="/LICENCE"><img src="https://img.shields.io/npm/l/@hmscore/react-native-hms-analytics.svg?color=%3bcc62&style=for-the-badge" alt="Licence"></a>
9+
<a href="./LICENCE"><img src="https://img.shields.io/npm/l/@hmscore/react-native-hms-analytics.svg?color=%3bcc62&style=for-the-badge" alt="Licence"></a>
1010
</p>
1111

1212
----
@@ -21,7 +21,7 @@ By integrating the React-Native HMS Analytics plugin, you can:
2121
- Set a maximum of 25 user attributes.
2222
- Automate event logging and session calculation with predefined event IDs and parameters.
2323

24-
[> Learn More](https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Guides/introduction-0000001050157956)
24+
[> Learn More](https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Guides/introduction-0000001050157956?ha_source=hms1)
2525

2626
## Installation
2727

@@ -31,20 +31,20 @@ $ npm i @hmscore/react-native-hms-analytics
3131

3232
## Documentation
3333

34-
- [Quick Start](https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Guides/preparedevenv-0000001051387084)
35-
- [Reference](https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-References/overview-0000001053026463)
34+
- [Quick Start](https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Guides/preparedevenv-0000001051387084?ha_source=hms1)
35+
- [Reference](https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-References/overview-0000001053026463?ha_source=hms1)
3636

3737
### Additional Topics
38-
- [Accessing HUAWEI Analytics](https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/android-accessing-0000001050161888)
38+
39+
- [Accessing HUAWEI Analytics](https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/android-accessing-0000001050161888?ha_source=hms1)
3940

4041
## Questions or Issues
4142

4243
If you have questions about how to use HMS samples, try the following options:
43-
- [Stack Overflow](https://stackoverflow.com/questions/tagged/huawei-mobile-services) is the best place for any programming questions. Be sure to tag your question with
44-
**huawei-mobile-services**.
44+
- [Stack Overflow](https://stackoverflow.com/questions/tagged/huawei-mobile-services) is the best place for any programming questions. Be sure to tag your question with **huawei-mobile-services**.
4545
- [Github](https://github.com/HMS-Core/hms-react-native-plugin) is the official repository for these plugins, You can open an issue or submit your ideas.
46-
- [Huawei Developer Forum](https://forums.developer.huawei.com/forumPortal/en/home?fid=0101187876626530001) HMS Core Module is great for general questions, or seeking recommendations and opinions.
47-
- [Huawei Developer Docs](https://developer.huawei.com/consumer/en/doc/overview/HMS-Core-Plugin) is place to official documentation for all HMS Core Kits, you can find detailed documentations in there.
46+
- [Huawei Developer Forum](https://forums.developer.huawei.com/forumPortal/en/home?fid=0101187876626530001&ha_source=hms1) HMS Core Module is great for general questions, or seeking recommendations and opinions.
47+
- [Huawei Developer Docs](https://developer.huawei.com/consumer/en/doc/overview/HMS-Core-Plugin?ha_source=hms1) is place to official documentation for all HMS Core Kits, you can find detailed documentations in there.
4848

4949
If you run into a bug in our samples, please submit an issue to the [GitHub repository](https://github.com/HMS-Core/hms-react-native-plugin).
5050

react-native-hms-analytics/android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ android {
1919
compileSdkVersion 29
2020
buildToolsVersion "29.0.3"
2121
defaultConfig {
22-
minSdkVersion 19
22+
minSdkVersion 18
2323
targetSdkVersion 29
2424
versionCode 1
2525
versionName "1.0"
@@ -45,5 +45,5 @@ repositories {
4545

4646
dependencies {
4747
implementation 'com.facebook.react:react-native:+' // From node_modules
48-
implementation 'com.huawei.hms:hianalytics:5.1.0.300'
48+
implementation 'com.huawei.hms:hianalytics:5.2.0.301'
4949
}

react-native-hms-analytics/android/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<application>
77
<provider
88
android:authorities="${applicationId}.hmsAnalyticsProvider"
9-
android:name="com.huawei.hms.rn.analytics.HmsAnalyticsProvider"
9+
android:name="com.huawei.hms.rn.analytics.HMSAnalyticsProvider"
1010
android:exported="false"/>
1111
</application>
1212
</manifest>

react-native-hms-analytics/android/src/main/java/com/huawei/hms/rn/analytics/HmsAnalyticsModule.java renamed to react-native-hms-analytics/android/src/main/java/com/huawei/hms/rn/analytics/HMSAnalyticsModule.java

Lines changed: 12 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,31 @@
1616

1717
package com.huawei.hms.rn.analytics;
1818

19-
import android.util.Log;
20-
2119
import com.facebook.react.bridge.Promise;
2220
import com.facebook.react.bridge.ReactApplicationContext;
23-
import com.facebook.react.bridge.ReactContext;
2421
import com.facebook.react.bridge.ReactContextBaseJavaModule;
2522
import com.facebook.react.bridge.ReactMethod;
2623
import com.facebook.react.bridge.ReadableArray;
2724
import com.facebook.react.bridge.ReadableMap;
28-
import com.huawei.hms.analytics.HiAnalytics;
29-
import com.huawei.hms.analytics.type.ReportPolicy;
30-
import com.huawei.hms.rn.analytics.logger.HMSLogger;
3125

3226
import java.lang.ref.WeakReference;
33-
import java.util.ArrayList;
3427

28+
import javax.annotation.Nonnull;
3529

36-
public class HmsAnalyticsModule extends ReactContextBaseJavaModule {
30+
public class HMSAnalyticsModule extends ReactContextBaseJavaModule {
3731

38-
private HmsAnalyticsWrapper hmsAnalyticsWrapper;
39-
private WeakReference<ReactContext> weakContext;
32+
private final HMSAnalyticsWrapper hmsAnalyticsWrapper;
4033

41-
public HmsAnalyticsModule(ReactApplicationContext reactContext) {
34+
public HMSAnalyticsModule(ReactApplicationContext reactContext) {
4235
super(reactContext);
43-
44-
weakContext = new WeakReference<>(reactContext);
45-
hmsAnalyticsWrapper = new HmsAnalyticsWrapper(reactContext);
36+
new WeakReference<>(reactContext);
37+
hmsAnalyticsWrapper = new HMSAnalyticsWrapper(reactContext);
4638
}
4739

40+
@Nonnull
4841
@Override
4942
public String getName() {
50-
return "HmsAnalyticsModule";
43+
return "HMSAnalyticsModule";
5144
}
5245

5346
@ReactMethod
@@ -125,72 +118,34 @@ public void deleteUserProfile(String name, Promise promise) {
125118
hmsAnalyticsWrapper.setUserProfile(name, null, promise);
126119
}
127120

128-
/**
129-
* Specifies whether to enable restriction of HUAWEI Analytics. The default value is false, which indicates that HUAWEI Analytics is enabled by default.
130-
* @param enabled: Indicates whether to enable restriction of HUAWEI Analytics. The default value is false, which indicates that HUAWEI Analytics is enabled by default.
131-
* - true: Enables restriction of HUAWEI Analytics.
132-
* - false: Disables restriction of HUAWEI Analytics.
133-
* @param promise: Promise instance.
134-
*/
135121
@ReactMethod
136122
public void setRestrictionEnabled(Boolean enabled, Promise promise) {
137123
hmsAnalyticsWrapper.setRestrictionEnabled(enabled, promise);
138124
}
139125

140-
/**
141-
* Obtains the restriction status of HUAWEI Analytics.
142-
* @param promise: Promise instance.
143-
*/
144126
@ReactMethod
145127
public void isRestrictionEnabled(Promise promise) {
146128
hmsAnalyticsWrapper.isRestrictionEnabled(promise);
147129
}
148130

149-
/**
150-
* Sets the automatic event reporting policy.
151-
*
152-
* @param array: Policy for data reporting.
153-
* @param promise: Promise instance.
154-
*/
155131
@ReactMethod
156-
public void setReportPolicies(ReadableArray array, Promise promise){
132+
public void setReportPolicies(ReadableArray array, Promise promise) {
157133
hmsAnalyticsWrapper.setReportPolicies(array, promise);
158134
}
159135

160-
/**
161-
* Obtains the threshold for event reporting.
162-
*
163-
* @param reportPolicyType: Event reporting policy name.
164-
* @param promise: Promise instance.
165-
*/
166136
@ReactMethod
167-
public void getReportPolicyThreshold(String reportPolicyType, Promise promise){
137+
public void getReportPolicyThreshold(String reportPolicyType, Promise promise) {
168138
hmsAnalyticsWrapper.getReportPolicyThreshold(reportPolicyType, promise);
169139
}
170140

171-
/**
172-
* Enables HMSLogger logging functions.
173-
*/
174141
@ReactMethod
175142
public void enableLogger(Promise promise) {
176-
HMSLogger.getInstance(getContext()).enableLogger();
177-
promise.resolve(true);
143+
hmsAnalyticsWrapper.enableLogger(promise);
178144
}
179145

180-
/**
181-
* Disables HMSLogger logging functions.
182-
*/
183146
@ReactMethod
184147
public void disableLogger(Promise promise) {
185-
HMSLogger.getInstance(getContext()).disableLogger();
186-
promise.resolve(true);
148+
hmsAnalyticsWrapper.disableLogger(promise);
187149
}
188150

189-
/**
190-
* Returns context instance.
191-
* @return Context
192-
*/
193-
private ReactContext getContext(){
194-
return weakContext.get();
195-
}
196151
}

react-native-hms-analytics/android/src/main/java/com/huawei/hms/rn/analytics/HmsAnalyticsPackage.java renamed to react-native-hms-analytics/android/src/main/java/com/huawei/hms/rn/analytics/HMSAnalyticsPackage.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,14 @@
2121
import java.util.List;
2222

2323
import com.facebook.react.ReactPackage;
24-
import com.facebook.react.bridge.JavaScriptModule;
2524
import com.facebook.react.bridge.NativeModule;
2625
import com.facebook.react.bridge.ReactApplicationContext;
2726
import com.facebook.react.uimanager.ViewManager;
2827

29-
public class HmsAnalyticsPackage implements ReactPackage {
28+
public class HMSAnalyticsPackage implements ReactPackage {
3029
@Override
3130
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
32-
return Arrays.<NativeModule>asList(new HmsAnalyticsModule(reactContext));
31+
return Arrays.<NativeModule>asList(new HMSAnalyticsModule(reactContext));
3332
}
3433

3534

react-native-hms-analytics/android/src/main/java/com/huawei/hms/rn/analytics/HmsAnalyticsProvider.java renamed to react-native-hms-analytics/android/src/main/java/com/huawei/hms/rn/analytics/HMSAnalyticsProvider.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
import com.huawei.hms.analytics.HiAnalytics;
2525
import com.huawei.hms.analytics.HiAnalyticsInstance;
2626

27-
public class HmsAnalyticsProvider extends ContentProvider {
27+
public class HMSAnalyticsProvider extends ContentProvider {
2828

29-
private String TAG = HmsAnalyticsProvider.class.getSimpleName();
29+
private String TAG = HMSAnalyticsProvider.class.getSimpleName();
3030

3131
@Override
3232
public boolean onCreate() {

0 commit comments

Comments
 (0)