Skip to content

Commit cba2b1b

Browse files
authored
UPDATE flutter-hms-analytics 6.9.0+302
1 parent 29b6ea8 commit cba2b1b

File tree

19 files changed

+937
-733
lines changed

19 files changed

+937
-733
lines changed

flutter-hms-analytics/CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 6.9.0+302
2+
3+
- Added the **getDataUploadSiteInfo** API to the HiAnalyticsInstance class to support the Global Router Service (GRS) function.
4+
5+
- **Breaking Changes:**
6+
- Modified the internal structure of the plugin. Please use import **package:huawei_analytics/huawei_analytics.dart** not to get any errors.
7+
18
## 6.5.0+301
29

310
- **Breaking Change:** Added the `getInstance({String routePolicy})` method. With this version `getInstance` method must be called from the application to initialize plugin in iOS platform.

flutter-hms-analytics/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Please see [pub.dev](https://pub.dev/packages/huawei_analytics/install) and [App
4545

4646
### Additional Topics
4747

48-
- [Enabling HUAWEI Analytics Service](https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Guides/config-agc-0000001050171095#EN-US_TOPIC_0000001050171095__section118755594146?ha_source=hms1)
48+
- [Enabling Huawei Analytics Service](https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Guides/config-agc-0000001050171095#EN-US_TOPIC_0000001050171095__section118755594146?ha_source=hms1)
4949
- Setup
5050
- [Android Setup](https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Guides/android-setup-0000001058644236?ha_source=hms1)
5151
- [iOS Setup](https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Guides/ios-setup-0000001058804234?ha_source=hms1)

flutter-hms-analytics/android/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ android {
4141
}
4242

4343
dependencies {
44-
implementation 'com.huawei.hms:hianalytics:6.5.0.300'
44+
implementation 'com.huawei.hms:hianalytics:6.9.0.302'
4545
}

flutter-hms-analytics/android/src/main/java/com/huawei/hms/flutter/analytics/AnalyticsContentProvider.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2020-2022. Huawei Technologies Co., Ltd. All rights reserved.
2+
Copyright 2020-2023. Huawei Technologies Co., Ltd. All rights reserved.
33
44
Licensed under the Apache License, Version 2.0 (the "License")
55
you may not use this file except in compliance with the License.

flutter-hms-analytics/android/src/main/java/com/huawei/hms/flutter/analytics/AnalyticsPlugin.java

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2020-2022. Huawei Technologies Co., Ltd. All rights reserved.
2+
Copyright 2020-2023. Huawei Technologies Co., Ltd. All rights reserved.
33
44
Licensed under the Apache License, Version 2.0 (the "License")
55
you may not use this file except in compliance with the License.
@@ -27,17 +27,11 @@
2727
import io.flutter.embedding.engine.plugins.FlutterPlugin;
2828
import io.flutter.plugin.common.BinaryMessenger;
2929
import io.flutter.plugin.common.MethodChannel;
30-
import io.flutter.plugin.common.PluginRegistry;
3130

3231
public class AnalyticsPlugin implements FlutterPlugin {
3332
private HMSAnalyticsMethodCallHandler analyticsMethodCallHandler;
3433
private MethodChannel channel;
3534

36-
public static void registerWith(PluginRegistry.Registrar registrar) {
37-
final AnalyticsPlugin instance = new AnalyticsPlugin();
38-
instance.onAttachedToEngine(registrar.context(), registrar.messenger());
39-
}
40-
4135
@Override
4236
public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {
4337
onAttachedToEngine(flutterPluginBinding.getApplicationContext(), flutterPluginBinding.getBinaryMessenger());

flutter-hms-analytics/android/src/main/java/com/huawei/hms/flutter/analytics/HMSAnalyticsModule.java

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2020-2022. Huawei Technologies Co., Ltd. All rights reserved.
2+
Copyright 2020-2023. Huawei Technologies Co., Ltd. All rights reserved.
33
44
Licensed under the Apache License, Version 2.0 (the "License")
55
you may not use this file except in compliance with the License.
@@ -253,6 +253,10 @@ public void getInstance(MethodCall methodCall, Result result) {
253253
result.success(null);
254254
}
255255

256+
public void getDataUploadSiteInfo(Result result) {
257+
viewModel.getDataUploadSiteInfo(new HMSAnalyticsModule.HMSAnalyticsResultHandler<>(result, "getDataUploadSiteInfo", weakContext));
258+
}
259+
256260
/* Private Inner Class */
257261

258262
private Set<ReportPolicy> mapToSetReportPolicy(Map<String, Object> reportPolicies) {
@@ -317,9 +321,9 @@ private enum LogLevel {
317321
*/
318322
private static final class HMSAnalyticsResultHandler<Object>
319323
implements HMSAnalyticsContract.ResultListener<Object> {
320-
private Result mResult;
321-
private String mMethodName;
322-
private WeakReference<Context> mWeakContext;
324+
private final Result mResult;
325+
private final String mMethodName;
326+
private final WeakReference<Context> mWeakContext;
323327

324328
HMSAnalyticsResultHandler(final Result result, String methodName, WeakReference<Context> weakContext) {
325329
this.mResult = result;

flutter-hms-analytics/android/src/main/java/com/huawei/hms/flutter/analytics/handler/HMSAnalyticsMethodCallHandler.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2020-2022. Huawei Technologies Co., Ltd. All rights reserved.
2+
Copyright 2020-2023. Huawei Technologies Co., Ltd. All rights reserved.
33
44
Licensed under the Apache License, Version 2.0 (the "License")
55
you may not use this file except in compliance with the License.
@@ -159,6 +159,10 @@ public void onMethodCall(@NonNull MethodCall methodCall, @NonNull Result result)
159159
analyticsModule.getInstance(methodCall, result);
160160
HMSLogger.getInstance(weakContext.get()).sendSingleEvent(methodCall.method);
161161
break;
162+
case getDataUploadSiteInfo:
163+
analyticsModule.getDataUploadSiteInfo(result);
164+
HMSLogger.getInstance(weakContext.get()).sendSingleEvent(methodCall.method);
165+
break;
162166
default:
163167
result.error("platformError", "Not supported on Android platform", "");
164168
}
@@ -192,6 +196,7 @@ private enum Methods {
192196
setChannel,
193197
setPropertyCollection,
194198
setCustomReferrer,
195-
getInstance
199+
getInstance,
200+
getDataUploadSiteInfo
196201
}
197202
}

flutter-hms-analytics/android/src/main/java/com/huawei/hms/flutter/analytics/logger/HMSLogger.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2020-2022. Huawei Technologies Co., Ltd. All rights reserved.
2+
Copyright 2020-2023. Huawei Technologies Co., Ltd. All rights reserved.
33
44
Licensed under the Apache License, Version 2.0 (the "License")
55
you may not use this file except in compliance with the License.
@@ -38,7 +38,7 @@ public final class HMSLogger {
3838

3939
private static final String KIT = "Analytics";
4040
private static final String PLATFORM = "Flutter";
41-
private static final String VERSION = "6.5.0.301";
41+
private static final String VERSION = "6.9.0.302";
4242

4343
private static final String SERVICE = "Cross-Platform";
4444

flutter-hms-analytics/android/src/main/java/com/huawei/hms/flutter/analytics/presenter/HMSAnalyticsContract.java

+15-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2020-2022. Huawei Technologies Co., Ltd. All rights reserved.
2+
Copyright 2020-2023. Huawei Technologies Co., Ltd. All rights reserved.
33
44
Licensed under the Apache License, Version 2.0 (the "License")
55
you may not use this file except in compliance with the License.
@@ -23,14 +23,6 @@
2323
import java.util.Map;
2424
import java.util.Set;
2525

26-
import io.flutter.plugin.common.MethodCall;
27-
import io.flutter.plugin.common.MethodChannel;
28-
29-
/**
30-
* HMSAnalyticsContract defines a blueprint of {@link HMSAnalyticsModule} methods that will be exposed to Flutter Side.
31-
*
32-
* @since v.5.1.0
33-
*/
3426
public interface HMSAnalyticsContract {
3527
/**
3628
* Defines blueprints of {@link HMSAnalyticsViewModel} methods
@@ -174,20 +166,20 @@ interface Presenter {
174166
void getReportPolicyThreshold(final HMSAnalyticsContract.ResultListener<Long> resultListener, ReportPolicy reportPolicyType);
175167

176168
/**
177-
* Specifies whether to enable restriction of HUAWEI Analytics.
169+
* Specifies whether to enable restriction of Huawei Analytics.
178170
* <p>
179-
* The default value is false, which indicates that HUAWEI Analytics is enabled by default.
171+
* The default value is false, which indicates that Huawei Analytics is enabled by default.
180172
*
181-
* @param isEnabled: Indicates whether to enable restriction of HUAWEI Analytics.
173+
* @param isEnabled: Indicates whether to enable restriction of Huawei Analytics.
182174
*/
183175
void setRestrictionEnabled(final boolean isEnabled);
184176

185177
/**
186-
* Obtains the restriction status of HUAWEI Analytics.
178+
* Obtains the restriction status of Huawei Analytics.
187179
*
188180
* @param resultListener: In the success scenario, {@link HMSAnalyticsContract.ResultListener<Boolean>} instance
189181
* is returned via listener. {@param resultListener} that obtains the restriction status
190-
* of HUAWEI Analytics.
182+
* of Huawei Analytics.
191183
*/
192184
void isRestrictionEnabled(final HMSAnalyticsContract.ResultListener<Boolean> resultListener);
193185

@@ -262,6 +254,15 @@ interface Presenter {
262254
*/
263255
void enableLog();
264256

257+
/**
258+
* Obtains the app instance ID from AppGallery Connect.
259+
*
260+
* @param resultListener: In the success scenario, {@link HMSAnalyticsContract.ResultListener<String>} instance
261+
* is returned via listener. {@param resultListener} that obtains the processing location
262+
* of the uploaded data.
263+
*/
264+
void getDataUploadSiteInfo(final HMSAnalyticsContract.ResultListener<String> resultListener);
265+
265266
}
266267

267268
/**

flutter-hms-analytics/android/src/main/java/com/huawei/hms/flutter/analytics/utils/MapUtils.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2020-2022. Huawei Technologies Co., Ltd. All rights reserved.
2+
Copyright 2020-2023. Huawei Technologies Co., Ltd. All rights reserved.
33
44
Licensed under the Apache License, Version 2.0 (the "License")
55
you may not use this file except in compliance with the License.
@@ -120,7 +120,11 @@ public static Bundle mapToBundle(@Nullable Map<String, Object> map, boolean isNe
120120
Log.e(TAG, "Illegal value type. Key :" + key + ", only one nested bundle structure is allowed.");
121121
}
122122
} else if (val instanceof List) {
123-
handleList(bundle, key, (List<?>) val);
123+
if(((List<?>) val).size() != 0) {
124+
handleList(bundle, key, (List<?>) val);
125+
} else {
126+
Log.e(TAG, "Illegal value type. Key:" + key + ", must not be empty.");
127+
}
124128
} else {
125129
throw new IllegalArgumentException(
126130
"Illegal value type. Key :" + key + ", valueType : " + val.getClass().getSimpleName());

flutter-hms-analytics/android/src/main/java/com/huawei/hms/flutter/analytics/viewmodel/HMSAnalyticsViewModel.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2020-2022. Huawei Technologies Co., Ltd. All rights reserved.
2+
Copyright 2020-2023. Huawei Technologies Co., Ltd. All rights reserved.
33
44
Licensed under the Apache License, Version 2.0 (the "License")
55
you may not use this file except in compliance with the License.
@@ -29,11 +29,6 @@
2929
import java.util.Map;
3030
import java.util.Set;
3131

32-
/**
33-
* HMSAnalyticsViewModel works as a mediator between {@link HMSAnalyticsContract.Presenter} .
34-
*
35-
* @since v.5.1.0
36-
*/
3732
public class HMSAnalyticsViewModel implements HMSAnalyticsContract.Presenter {
3833

3934
// HiAnalytics instance
@@ -170,6 +165,10 @@ public void enableLog() {
170165
HiAnalyticsTools.enableLog();
171166
}
172167

168+
@Override
169+
public void getDataUploadSiteInfo(ResultListener<String> resultListener) {
170+
resultListener.onSuccess(analyticsInstance.getDataUploadSiteInfo());
171+
}
173172

174173
}
175174

flutter-hms-analytics/example/android/app/src/main/java/com/huawei/hms/flutter/analytics_example/MainActivity.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2020-2022. Huawei Technologies Co., Ltd. All rights reserved.
2+
Copyright 2020-2023. Huawei Technologies Co., Ltd. All rights reserved.
33
44
Licensed under the Apache License, Version 2.0 (the "License")
55
you may not use this file except in compliance with the License.

flutter-hms-analytics/example/android/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77

88
dependencies {
99
classpath 'com.android.tools.build:gradle:3.6.0'
10-
classpath 'com.huawei.agconnect:agcp:1.6.5.300'
10+
classpath 'com.huawei.agconnect:agcp:1.8.0.300'
1111
}
1212
}
1313

0 commit comments

Comments
 (0)