determineAnalyticsSettings method
Determines the analytics settings based on configuration / settings. Called from run before any analytics events are sent and before any command is run.
globalConfiguration is set before this method is called.
By default it checks whether the onAnalyticsEvent callback is set
and the --analytics option.
Subclasses can override this method to customize the behavior,
e.g. to ask the user for permission.
Implementation
@override
Future<bool> determineAnalyticsSettings() async {
if (onAnalyticsEvent == null) {
return false;
}
final analyticsOptionValue = globalConfiguration.analytics;
if (analyticsOptionValue != null) {
// explicitly set via option for this run
return analyticsOptionValue;
}
if (!_isTenantUser()) {
return false;
}
final analyticsEnabled = await _getAnalyticsSetting();
return analyticsEnabled;
}