Skip to content

Commit

Permalink
feat: update to the latests native SDKs
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Update to the latest native SDKs
  • Loading branch information
Mercy811 committed Mar 7, 2024
1 parent ecb59df commit f23e3bb
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ jobs:
- name: Analyze
run: flutter analyze --no-fatal-infos

# - name: Test
# run: flutter test
- name: Test
run: flutter test

- name: Semantic Release --dry-run
if: ${{ github.event.inputs.dryRun == 'true'}}
Expand Down
10 changes: 8 additions & 2 deletions lib/amplitude.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ class Amplitude {
MethodChannel _channel = const MethodChannel("amplitude_flutter");

/// Returns an Amplitude instance
///
/// Call `init()` to initialize underlying SDKs on native platforms
/// ```
/// var amplitude = Amplitude(Configuration(apiKey: "apiKey"));
/// await amplitude.init();
/// ```
Amplitude(this.configuration);

/// Initializes an Amplitude instance
Expand Down Expand Up @@ -184,14 +190,14 @@ class Amplitude {
Map<String, String?> properties = {};
properties["setDeviceId"] = deviceId;

await await _channel.invokeMethod("setDeviceId", properties);
return await _channel.invokeMethod("setDeviceId", properties);
}

/// Resets userId to "null" and deviceId to a random UUID.
///
/// Note different devices on different platforms should have different device Ids.
Future<void> reset() async {
await await _channel.invokeMethod("reset");
return await _channel.invokeMethod("reset");
}

/// Flush events in storage.
Expand Down
14 changes: 8 additions & 6 deletions lib/configuration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ import 'constants.dart';
import 'tracking_options.dart';
import 'default_tracking.dart';

/// Configuration for Amplitude instance.
///
/// Before initializing Amplitude instance, create a Configuration instance
/// with your desired configuration and pass it to the Amplitude instance.
/// Note the Configuration is immutable (cannot be changed) after being passed to Amplitude.init()
/// `optOut` can be changed later by calling `setOptOut()`.
class Configuration {
String apiKey;
int flushQueueSize;
Expand Down Expand Up @@ -40,6 +34,14 @@ class Configuration {
bool useAppSetIdForDeviceId;
/// Web specific
String? appVersion;

/// Configuration for Amplitude instance.
///
/// Before initializing Amplitude instance, create a Configuration instance
/// with your desired configuration and pass it to the Amplitude instance.
///
/// Note the Configuration is immutable (cannot be changed) after being passed to Amplitude
/// `optOut` can be changed later by calling `setOptOut()`.
Configuration({
required this.apiKey,
this.flushQueueSize = Constants.flushQueueSize,
Expand Down
3 changes: 2 additions & 1 deletion release.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = {
"branches": [
"main"
"main",
{ "name": "beta", "prerelease": true },
],
"tagFormat": ["v${version}"],
"plugins": [
Expand Down

0 comments on commit f23e3bb

Please sign in to comment.