@@ -23,68 +23,17 @@ import 'user_property.dart';
23
23
import 'utils.dart' ;
24
24
25
25
abstract class Analytics {
26
- // TODO: (eliasyishak) enable again once revision has landed;
27
- // also remove all instances of [pddFlag]
28
-
29
- // /// The default factory constructor that will return an implementation
30
- // /// of the [Analytics] abstract class using the [LocalFileSystem]
31
- // factory Analytics({
32
- // required DashTool tool,
33
- // required String dartVersion,
34
- // String? flutterChannel,
35
- // String? flutterVersion,
36
- // }) {
37
- // // Create the instance of the file system so clients don't need
38
- // // resolve on their own
39
- // const FileSystem fs = LocalFileSystem();
40
-
41
- // // Resolve the OS using dart:io
42
- // final DevicePlatform platform;
43
- // if (io.Platform.operatingSystem == 'linux') {
44
- // platform = DevicePlatform.linux;
45
- // } else if (io.Platform.operatingSystem == 'macos') {
46
- // platform = DevicePlatform.macos;
47
- // } else {
48
- // platform = DevicePlatform.windows;
49
- // }
50
-
51
- // // Create the instance of the GA Client which will create
52
- // // an [http.Client] to send requests
53
- // final GAClient gaClient = GAClient(
54
- // measurementId: kGoogleAnalyticsMeasurementId,
55
- // apiSecret: kGoogleAnalyticsApiSecret,
56
- // );
57
-
58
- // return AnalyticsImpl(
59
- // tool: tool,
60
- // homeDirectory: getHomeDirectory(fs),
61
- // flutterChannel: flutterChannel,
62
- // flutterVersion: flutterVersion,
63
- // dartVersion: dartVersion,
64
- // platform: platform,
65
- // toolsMessageVersion: kToolsMessageVersion,
66
- // fs: fs,
67
- // gaClient: gaClient,
68
- // );
69
- // }
70
-
71
- // TODO: (eliasyishak) remove this contructor once revision has landed
72
-
73
- /// Prevents the unapproved files for logging and session handling
74
- /// from being saved on to the developer's disk until privacy revision
75
- /// has landed
26
+ /// The default factory constructor that will return an implementation
27
+ /// of the [Analytics] abstract class using the [LocalFileSystem]
76
28
factory Analytics ({
77
29
required DashTool tool,
78
30
required String dartVersion,
79
31
String ? flutterChannel,
80
32
String ? flutterVersion,
81
- FileSystem ? fsOverride,
82
- Directory ? homeOverride,
83
- DevicePlatform ? platformOverride,
84
33
}) {
85
34
// Create the instance of the file system so clients don't need
86
35
// resolve on their own
87
- final FileSystem fs = fsOverride ?? LocalFileSystem ();
36
+ const FileSystem fs = LocalFileSystem ();
88
37
89
38
// Resolve the OS using dart:io
90
39
final DevicePlatform platform;
@@ -98,27 +47,21 @@ abstract class Analytics {
98
47
99
48
// Create the instance of the GA Client which will create
100
49
// an [http.Client] to send requests
101
- //
102
- // When a [fsOverride] is passed in, we can assume to
103
- // use the fake Google Analytics client
104
- final GAClient gaClient = fsOverride != null
105
- ? FakeGAClient ()
106
- : GAClient (
107
- measurementId: kGoogleAnalyticsMeasurementId,
108
- apiSecret: kGoogleAnalyticsApiSecret,
109
- );
50
+ final GAClient gaClient = GAClient (
51
+ measurementId: kGoogleAnalyticsMeasurementId,
52
+ apiSecret: kGoogleAnalyticsApiSecret,
53
+ );
110
54
111
55
return AnalyticsImpl (
112
56
tool: tool,
113
- homeDirectory: homeOverride ?? getHomeDirectory (fs),
57
+ homeDirectory: getHomeDirectory (fs),
114
58
flutterChannel: flutterChannel,
115
59
flutterVersion: flutterVersion,
116
60
dartVersion: dartVersion,
117
- platform: platformOverride ?? platform,
61
+ platform: platform,
118
62
toolsMessageVersion: kToolsMessageVersion,
119
63
fs: fs,
120
64
gaClient: gaClient,
121
- pddFlag: true ,
122
65
);
123
66
}
124
67
@@ -295,7 +238,6 @@ class AnalyticsImpl implements Analytics {
295
238
required this .toolsMessageVersion,
296
239
required this .fs,
297
240
required gaClient,
298
- bool pddFlag = false ,
299
241
}) : _gaClient = gaClient {
300
242
// Initialize date formatting for `package:intl` within constructor
301
243
// so clients using this package won't need to
@@ -309,7 +251,6 @@ class AnalyticsImpl implements Analytics {
309
251
tool: tool.label,
310
252
homeDirectory: homeDirectory,
311
253
toolsMessageVersion: toolsMessageVersion,
312
- pddFlag: pddFlag,
313
254
);
314
255
initializer.run ();
315
256
_showMessage = initializer.firstRun;
@@ -345,21 +286,12 @@ class AnalyticsImpl implements Analytics {
345
286
homeDirectory.path, kDartToolDirectoryName, kClientIdFileName))
346
287
.readAsStringSync ();
347
288
348
- // Create the session instance that will be responsible for managing
349
- // all the sessions across every client tool using this pakage
350
- final Session session;
351
- if (pddFlag) {
352
- session = NoopSession ();
353
- } else {
354
- session = Session (homeDirectory: homeDirectory, fs: fs);
355
- }
356
-
357
289
// Initialize the user property class that will be attached to
358
290
// each event that is sent to Google Analytics -- it will be responsible
359
291
// for getting the session id or rolling the session if the duration
360
292
// exceeds [kSessionDurationMinutes]
361
293
userProperty = UserProperty (
362
- session: session ,
294
+ session: Session (homeDirectory : homeDirectory, fs : fs) ,
363
295
flutterChannel: flutterChannel,
364
296
host: platform.label,
365
297
flutterVersion: flutterVersion,
@@ -368,11 +300,7 @@ class AnalyticsImpl implements Analytics {
368
300
);
369
301
370
302
// Initialize the log handler to persist events that are being sent
371
- if (pddFlag) {
372
- _logHandler = NoopLogHandler ();
373
- } else {
374
- _logHandler = LogHandler (fs: fs, homeDirectory: homeDirectory);
375
- }
303
+ _logHandler = LogHandler (fs: fs, homeDirectory: homeDirectory);
376
304
}
377
305
378
306
@override
0 commit comments