Skip to content

Commit

Permalink
Merge pull request #41 from spkersten/add-setEventUploadThreshold
Browse files Browse the repository at this point in the history
Add setEventUploadThreshold API
  • Loading branch information
haoliu-amp authored Mar 1, 2021
2 parents 9d78118 + 560bb49 commit f2f3c62
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 2.3.1
* Add `setEventUploadThreshold` API

## 2.3.0
* Add `regenerateDeviceId` API to enable regenerate a new deviceId.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ class AmplitudeFlutterPlugin : FlutterPlugin, MethodCallHandler {

result.success("setLibraryVersion called..")
}
"setEventUploadThreshold" -> {
val client = Amplitude.getInstance(instanceName)
client.setEventUploadThreshold(json.getInt("eventUploadThreshold"));

result.success("setEventUploadThreshold called..")
}
"trackingSessionEvents" -> {
val client = Amplitude.getInstance(instanceName)
client.trackSessionEvents(json.getBoolean("trackingSessionEvents"))
Expand Down
4 changes: 4 additions & 0 deletions ios/Classes/SwiftAmplitudeFlutterPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ import Amplitude
let libraryVersion = args["libraryVersion"] as! String
Amplitude.instance(withName: instanceName).libraryVersion = libraryVersion
result(true)
case "setEventUploadThreshold":
let eventUploadThreshold = args["eventUploadThreshold"] as! Int32
Amplitude.instance(withName: instanceName).eventUploadThreshold = eventUploadThreshold
result(true)
case "trackingSessionEvents":
let trackingSessionEvents = args["trackingSessionEvents"] as! Bool
Amplitude.instance(withName: instanceName).trackingSessionEvents = trackingSessionEvents
Expand Down
7 changes: 7 additions & 0 deletions lib/amplitude.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ class Amplitude extends _Amplitude {
return await _channel.invokeMethod('setServerUrl', jsonEncode(properties));
}

Future<void> setEventUploadThreshold(int value) async {
Map<String, dynamic> properties = _baseProperties();
properties['eventUploadThreshold'] = value;

await _channel.invokeMethod('setEventUploadThreshold', jsonEncode(properties));
}

/// Regenerates a new random deviceId for current user.
/// Note: this is not recommended unless you know what you are doing.
/// This can be used in conjunction with setUserId(null) to anonymize users after they log out.
Expand Down
2 changes: 1 addition & 1 deletion lib/constants.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Constants {
static const packageName = 'amplitude-flutter';
static const packageVersion = '2.3.0';
static const packageVersion = '2.3.1';
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: amplitude_flutter
description: Amplitude Flutter plugin
version: 2.3.0
version: 2.3.1
homepage: https://www.amplitude.com

environment:
Expand Down

0 comments on commit f2f3c62

Please sign in to comment.