forked from flutter/devtools
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path_analytics_stub.dart
More file actions
98 lines (80 loc) · 2.56 KB
/
_analytics_stub.dart
File metadata and controls
98 lines (80 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// Copyright 2020 The Flutter Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.
// Avoid unused parameters does not play well with conditional imports.
// ignore_for_file: avoid-unused-parameters
// ignore_for_file: avoid-redundant-async
import 'dart:async';
import 'package:logging/logging.dart';
import 'package:stack_trace/stack_trace.dart' as stack_trace;
import 'analytics_common.dart';
final _log = Logger('_analytics_stub');
/// The IDE that DevTools was launched from.
///
/// This is just a stub value so that we can access the [ideLaunched] field on
/// both web and desktop, and manipulate this value for tests running on the VM.
String ideLaunched = '';
void screen(String screenName, [int value = 0]) {
_log.fine('Event: screen(screenName:$screenName, value:$value)');
}
void timeStart(String screenName, String timedOperation) {}
void timeEnd(
String screenName,
String timedOperation, {
ScreenAnalyticsMetrics Function()? screenMetricsProvider,
}) {}
void cancelTimingOperation(String screenName, String timedOperation) {}
void timeSync(
String screenName,
String timedOperation, {
required void Function() syncOperation,
ScreenAnalyticsMetrics Function()? screenMetricsProvider,
}) {
// Execute the operation here so that the desktop app still functions without
// the real analytics call.
syncOperation();
}
Future<void> timeAsync(
String screenName,
String timedOperation, {
required Future<void> Function() asyncOperation,
ScreenAnalyticsMetrics Function()? screenMetricsProvider,
}) async {
// Execute the operation here so that the desktop app still functions without
// the real analytics call.
await asyncOperation();
}
void select(
String screenName,
String selectedItem, {
int value = 0,
bool nonInteraction = false,
ScreenAnalyticsMetrics Function()? screenMetricsProvider,
}) {
_log.fine(
'Event: select('
'screenName:$screenName, '
'selectedItem:$selectedItem, '
'value:$value, '
'nonInteraction:$nonInteraction)',
);
}
void impression(
String screenName,
String item, {
ScreenAnalyticsMetrics Function()? screenMetricsProvider,
}) {
_log.fine(
'Event: impression('
'screenName:$screenName, '
'item:$item)',
);
}
void reportError(
String errorMessage, {
stack_trace.Trace? stackTrace,
bool fatal = false,
}) {}
Future<void> setupDimensions() async {}
void setupUserApplicationDimensions() {}
Map<String, Object?> generateSurveyQueryParameters() => {};