Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove screenViews #185

Merged
merged 1 commit into from
Apr 5, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ class AmplitudeFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
sessions = (map["sessions"] as? Boolean) ?: true,
appLifecycles = (map["appLifecycles"] as? Boolean) ?: false,
deepLinks = (map["deepLinks"] as? Boolean) ?: false,
screenViews = (map["screenViews"] as? Boolean) ?: false
// Set false to disable screenViews on Android
// screenViews is implemented in Flutter
screenViews = false
)
}
call.argument<Map<String, Any>>("trackingOptions")?.let { map ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class AmplitudeFlutterPluginTest {
"defaultTracking" to JSONObject(mapOf(
"sessions" to true,
"appLifecycles" to false,
"screenViews" to false,
"deepLinks" to false,
"attribution" to true,
"pageViews" to true,
Expand Down
4 changes: 3 additions & 1 deletion ios/Classes/SwiftAmplitudeFlutterPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ import AmplitudeSwift
if let defaultTrackingDict = args["defaultTracking"] as? [String: Bool] {
let sessions = defaultTrackingDict["sessions"] ?? true
let appLifecycles = defaultTrackingDict["appLifecycles"] ?? false
let screenViews = defaultTrackingDict["screenViews"] ?? false
// Set false to disable screenViews on iOS
// screenViews is implemented in Flutter
let screenViews = false
configuration.defaultTracking = DefaultTrackingOptions(
sessions: sessions,
appLifecycles: appLifecycles,
Expand Down
12 changes: 6 additions & 6 deletions lib/default_tracking.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ class DefaultTrackingOptions {
final bool sessions;
/// Mobile (iOS and Android) specific
final bool appLifecycles;
/// Mobile (iOS and Android) specific
final bool screenViews;
// TODO(xinyi): implement screenViews in Flutter
// /// Mobile (iOS and Android) specific
// final bool screenViews;
/// Android specific
final bool deepLinks;
/// Web specific
Expand All @@ -26,7 +27,7 @@ class DefaultTrackingOptions {
const DefaultTrackingOptions({
this.sessions = true,
this.appLifecycles = false,
this.screenViews = false,
// this.screenViews = false,
this.deepLinks = false,
this.attribution = true,
this.pageViews = true,
Expand All @@ -41,7 +42,7 @@ class DefaultTrackingOptions {
return const DefaultTrackingOptions(
sessions: true,
appLifecycles: true,
screenViews: true,
// screenViews: true,
deepLinks: true,
attribution: true,
pageViews: true,
Expand All @@ -55,7 +56,7 @@ class DefaultTrackingOptions {
return const DefaultTrackingOptions(
sessions: false,
appLifecycles: false,
screenViews: false,
// screenViews: false,
deepLinks: false,
attribution: false,
pageViews: false,
Expand All @@ -68,7 +69,6 @@ class DefaultTrackingOptions {
return {
'sessions': sessions,
'appLifecycles': appLifecycles,
'screenViews': screenViews,
'deepLinks': deepLinks,
'attribution': attribution,
'pageViews': pageViews,
Expand Down
1 change: 0 additions & 1 deletion test/amplitude_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ void main() {
'defaultTracking': {
'sessions': true,
'appLifecycles': false,
'screenViews': false,
'deepLinks': false,
'attribution': true,
'pageViews': true,
Expand Down
4 changes: 2 additions & 2 deletions test/default_tracking_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ void main(){

expect(defaultTrackingOptions.sessions, true);
expect(defaultTrackingOptions.appLifecycles, true);
expect(defaultTrackingOptions.screenViews, true);
// expect(defaultTrackingOptions.screenViews, true);
expect(defaultTrackingOptions.deepLinks, true);
expect(defaultTrackingOptions.attribution, true);
expect(defaultTrackingOptions.pageViews, true);
Expand All @@ -21,7 +21,7 @@ void main(){

expect(defaultTrackingOptions.sessions, false);
expect(defaultTrackingOptions.appLifecycles, false);
expect(defaultTrackingOptions.screenViews, false);
// expect(defaultTrackingOptions.screenViews, false);
expect(defaultTrackingOptions.deepLinks, false);
expect(defaultTrackingOptions.attribution, false);
expect(defaultTrackingOptions.pageViews, false);
Expand Down
Loading