Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/v6-platform-opt-in-out.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"posthog_flutter": major
---

- **Breaking:** rename `enable()`/`disable()` to `optIn()`/`optOut()` on `PosthogFlutterPlatformInterface`, `PosthogFlutterIO` and `PosthogFlutterWeb`. Update direct calls to these platform classes, custom implementations, and test fakes/mocks. Calls to `Posthog().optIn()`/`optOut()` are unchanged
8 changes: 4 additions & 4 deletions api/posthog_flutter.api.json
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@
"isDeprecated": false,
"isExperimental": false,
"isStatic": false,
"name": "disable",
"name": "optOut",
"parameters": [],
"relativePath": "lib/src/posthog_flutter_platform_interface.dart",
"returnTypeName": "Future<void>",
Expand All @@ -577,7 +577,7 @@
"isDeprecated": false,
"isExperimental": false,
"isStatic": false,
"name": "enable",
"name": "optIn",
"parameters": [],
"relativePath": "lib/src/posthog_flutter_platform_interface.dart",
"returnTypeName": "Future<void>",
Expand Down Expand Up @@ -1526,7 +1526,7 @@
"isDeprecated": false,
"isExperimental": false,
"isStatic": false,
"name": "disable",
"name": "optOut",
"parameters": [],
"relativePath": "lib/src/posthog_flutter_platform_interface.dart",
"returnTypeName": "Future<void>",
Expand All @@ -1538,7 +1538,7 @@
"isDeprecated": false,
"isExperimental": false,
"isStatic": false,
"name": "enable",
"name": "optIn",
"parameters": [],
"relativePath": "lib/src/posthog_flutter_platform_interface.dart",
"returnTypeName": "Future<void>",
Expand Down
4 changes: 2 additions & 2 deletions posthog_flutter/lib/posthog_flutter_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,12 @@ class PosthogFlutterWeb extends PosthogFlutterPlatformInterface {
}

@override
Future<void> disable() async {
Future<void> optOut() async {
return handleWebMethodCall(const MethodCall('disable'));
}

@override
Future<void> enable() async {
Future<void> optIn() async {
return handleWebMethodCall(const MethodCall('enable'));
}

Expand Down
4 changes: 2 additions & 2 deletions posthog_flutter/lib/src/posthog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ class Posthog {
// Uninstall Flutter-specific integrations when opting out
_uninstallFlutterIntegrations();

return _posthog.disable();
return _posthog.optOut();
}

/// Opts the current user back in to data collection.
Expand All @@ -395,7 +395,7 @@ class Posthog {
_installFlutterIntegrations(config);
}

return _posthog.enable();
return _posthog.optIn();
}

/// Returns whether the current user has opted out of data collection.
Expand Down
4 changes: 2 additions & 2 deletions posthog_flutter/lib/src/posthog_flutter_io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ class PosthogFlutterIO extends PosthogFlutterPlatformInterface {
}

@override
Future<void> disable() async {
Future<void> optOut() async {
if (!isSupportedPlatform()) {
return;
}
Expand All @@ -488,7 +488,7 @@ class PosthogFlutterIO extends PosthogFlutterPlatformInterface {
}

@override
Future<void> enable() async {
Future<void> optIn() async {
if (!isSupportedPlatform()) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ abstract class PosthogFlutterPlatformInterface extends PlatformInterface {
throw UnimplementedError('reset() has not been implemented.');
}

Future<void> disable() {
throw UnimplementedError('disable() has not been implemented.');
Future<void> optOut() {
throw UnimplementedError('optOut() has not been implemented.');
}

Future<void> enable() {
throw UnimplementedError('enable() has not been implemented.');
Future<void> optIn() {
throw UnimplementedError('optIn() has not been implemented.');
}

Future<bool> isOptOut() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,10 @@ class PosthogFlutterPlatformFake extends PosthogFlutterPlatformInterface {
}

@override
Future<void> disable() async {}
Future<void> optOut() async {}

@override
Future<void> enable() async {}
Future<void> optIn() async {}

@override
Future<void> close() async {
Expand Down
Loading