Skip to content

Commit

Permalink
Merge branch 'staging' of github.com:Countly/countly-sdk-flutter-brid…
Browse files Browse the repository at this point in the history
…ge into staging-np
  • Loading branch information
turtledreams committed Apr 2, 2024
2 parents 87962c5 + 6603b6b commit 875f808
Show file tree
Hide file tree
Showing 7 changed files with 134 additions and 107 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## xx.x.x
* Fixed an issue where the 'reportFeedbackWidgetManually' function would await indefinitely on iOS
* Resolved an issue where nonfatal exceptions were treated as fatal and vice versa

* Underlying Android SDK version is 24.1.1
* Underlying iOS SDK version is 24.1.0

## xx.x.x-np
* Fixed an issue where the 'reportFeedbackWidgetManually' function would await indefinitely on iOS
* Resolved an issue where nonfatal exceptions were treated as fatal and vice versa

* Underlying Android SDK version is 24.1.1
* Underlying iOS SDK version is 24.1.0

## 24.1.1
* Added a new metric for detecting whether or not a device has a hinge for Android

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,16 +384,16 @@ public void callback(RequestResult downloadResult, String error, boolean fullVal
result.success("addCrashLog success!");
} else if ("logException".equals(call.method)) {
String exceptionString = args.getString(0);
boolean fatal = args.getBoolean(1);
boolean nonfatal = args.getBoolean(1);
Exception exception = new Exception(exceptionString);
Map<String, Object> segments = new HashMap<>();
for (int i = 2, il = args.length(); i < il; i += 2) {
segments.put(args.getString(i), args.getString(i + 1));
}
if (fatal) {
Countly.sharedInstance().crashes().recordUnhandledException(exception, segments);
} else {
if (nonfatal) {
Countly.sharedInstance().crashes().recordHandledException(exception, segments);
} else {
Countly.sharedInstance().crashes().recordUnhandledException(exception, segments);
}

result.success("logException success!");
Expand Down Expand Up @@ -467,10 +467,10 @@ public void run() {
result.success("endSession!");

} else if ("manualSessionHandling".equals(call.method)) {
result.success("deafult!");
result.success("manualSessionHandling!");

} else if ("updateSessionPeriod".equals(call.method)) {
result.success("default!");
result.success("updateSessionPeriod!");

} else if ("updateSessionInterval".equals(call.method)) {
int sessionInterval = Integer.parseInt(args.getString(0));
Expand All @@ -480,15 +480,16 @@ public void run() {
} else if ("eventSendThreshold".equals(call.method)) {
int queueSize = Integer.parseInt(args.getString(0));
this.config.setEventQueueSizeToSend(queueSize);
result.success("default!");
result.success("eventSendThreshold!");

} else if ("storedRequestsLimit".equals(call.method)) {
int queueSize = Integer.parseInt(args.getString(0));
result.success("default!");
result.success("storedRequestsLimit!");

} else if ("startEvent".equals(call.method)) {
String startEvent = args.getString(0);
Countly.sharedInstance().events().startEvent(startEvent);
result.success("startEvent for: " + startEvent);
} else if ("endEvent".equals(call.method)) {
String key = args.getString(0);
int count = Integer.parseInt(args.getString(1));
Expand Down Expand Up @@ -690,7 +691,7 @@ else if ("setRequiresConsent".equals(call.method)) {
features[i] = args.getString(i);
}
this.config.setConsentEnabled(features);
result.success("giveConsent!");
result.success("giveConsentInit!");

} else if ("giveConsent".equals(call.method)) {
String[] features = new String[args.length()];
Expand Down Expand Up @@ -1109,7 +1110,7 @@ public void onFinished(List<CountlyFeedbackWidget> retrievedWidgets, String erro

CountlyFeedbackWidget feedbackWidget = getFeedbackWidget(widgetId);
if (feedbackWidget == null) {
String errorMessage = "No feedbackWidget is found against widget id : '" + widgetId + "' , always call 'getFeedbackWidgets' to get updated list of feedback widgets.";
String errorMessage = "[presentFeedbackWidget], No feedbackWidget is found against widget id : '" + widgetId + "' , always call 'getFeedbackWidgets' to get updated list of feedback widgets.";
log(errorMessage, LogLevel.WARNING);
result.error("presentFeedbackWidget", errorMessage, null);
} else {
Expand All @@ -1134,7 +1135,7 @@ public void onClosed() {
String widgetId = args.getString(0);
CountlyFeedbackWidget feedbackWidget = getFeedbackWidget(widgetId);
if (feedbackWidget == null) {
String errorMessage = "No feedbackWidget is found against widget id : '" + widgetId + "' , always call 'getFeedbackWidgets' to get updated list of feedback widgets.";
String errorMessage = "[getFeedbackWidgetData], No feedbackWidget is found against widget id : '" + widgetId + "' , always call 'getFeedbackWidgets' to get updated list of feedback widgets.";
log(errorMessage, LogLevel.WARNING);
result.error("getFeedbackWidgetData", errorMessage, null);
feedbackWidgetDataCallback(null, errorMessage);
Expand Down Expand Up @@ -1171,7 +1172,7 @@ public void onFinished(JSONObject retrievedWidgetData, String error) {

CountlyFeedbackWidget feedbackWidget = getFeedbackWidget(widgetId);
if (feedbackWidget == null) {
String errorMessage = "No feedbackWidget is found against widget id : '" + widgetId + "' , always call 'getFeedbackWidgets' to get updated list of feedback widgets.";
String errorMessage = "[reportFeedbackWidgetManually], No feedbackWidget is found against widget id : '" + widgetId + "' , always call 'getFeedbackWidgets' to get updated list of feedback widgets.";
log(errorMessage, LogLevel.WARNING);
result.error("reportFeedbackWidgetManually", errorMessage, null);
} else {
Expand Down Expand Up @@ -1234,14 +1235,14 @@ public void onFinished(JSONObject retrievedWidgetData, String error) {
Countly.sharedInstance().attribution().recordIndirectAttribution(attributionMap);
result.success("recordIndirectAttribution: success");
} else {
result.error("iaAttributionFailed", "recordIndirectAttribution: failure, no attribution values provided", null);
result.error("recordIndirectAttribution Failed", "No attribution values provided", null);
}
} else if ("recordDirectAttribution".equals(call.method)) {
String campaignType = args.getString(0);
String campaignData = args.getString(1);

Countly.sharedInstance().attribution().recordDirectAttribution(campaignType, campaignData);
result.success("recordIndirectAttribution: success");
result.success("recordDirectAttribution: success");
} else if ("stopViewWithID".equals(call.method)) {
String viewId = args.getString(0);
Map<String, Object> segmentation = toMap(args.getJSONObject(1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:flutter_foreground_task/flutter_foreground_task.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import '../utils.dart';
import 'dart:io';

/// Goal of this test is to check if F/B tracking is working correctly
/// 2 apm requests should be sent
Expand All @@ -20,16 +21,20 @@ void main() {
// go foreground and background
// TODO: this automation is Android only, iOS automation is not supported yet
FlutterForegroundTask.minimizeApp();
print('waiting for 2 seconds, go to background');
await tester.pump(Duration(seconds: 2));
if (Platform.isIOS) {
printMessageMultipleTimes('will now go to background, get ready to go foreground manually', 3);
}
await tester.pump(Duration(seconds: 3));

// foreground apm request should be sent
List<String> apmReqs = await getAndPrintWantedElementsWithParamFromAllQueues('apm');
expect(apmReqs.length, 1);

FlutterForegroundTask.launchApp();
print('waiting for 2 seconds, go to foreground');
await tester.pump(Duration(seconds: 2));
if (Platform.isIOS) {
printMessageMultipleTimes('waiting for 3 seconds, now go to foreground', 3);
}
await tester.pump(Duration(seconds: 3));

// background apm request should be sent
apmReqs = await getAndPrintWantedElementsWithParamFromAllQueues('apm');
Expand Down
2 changes: 1 addition & 1 deletion example/integration_test/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const MethodChannel _channelTest = MethodChannel('countly_flutter');

// Base config options for tests
final String SERVER_URL = 'https://xxx.count.ly';
final String APP_KEY = 'YOUR_APP_KEY'; // change this for ios tests
final String APP_KEY = 'FOR_IOS_THIS_SHOULD_NOT_BE_YOUR_APP_KEY';

/// Get request queue from native side (list of strings)
Future<List<String>> getRequestQueue() async {
Expand Down
Loading

0 comments on commit 875f808

Please sign in to comment.