Send analytics on 'build ios' and 'build ipa' for plist impeller value (#135193)

This analytics event only records the value of the plist entry on
`build` commands. This will give an idea of the proportion of users who
are disabling Impeller when shipping apps.
This commit is contained in:
Zachary Anderson
2023-09-21 11:49:29 -07:00
committed by GitHub
parent c627dbfbc6
commit 30a9f99bc8
4 changed files with 148 additions and 1 deletions

View File

@@ -20,6 +20,7 @@ import '../globals.dart' as globals;
import '../ios/application_package.dart';
import '../ios/mac.dart';
import '../ios/plist_parser.dart';
import '../reporting/reporting.dart';
import '../runner/flutter_command.dart';
import 'build.dart';
@@ -724,6 +725,21 @@ abstract class _BuildIOSSubCommand extends BuildSubCommand {
if (result.output != null) {
globals.printStatus('Built ${result.output}.');
// When an app is successfully built, record to analytics whether Impeller
// is enabled or disabled.
final BuildableIOSApp app = await buildableIOSApp;
final String plistPath = app.project.infoPlist.path;
final bool? impellerEnabled = globals.plistParser.getValueFromFile<bool>(
plistPath, PlistParser.kFLTEnableImpellerKey,
);
BuildEvent(
impellerEnabled == false
? 'plist-impeller-disabled'
: 'plist-impeller-enabled',
type: 'ios',
flutterUsage: globals.flutterUsage,
).send();
return FlutterCommandResult.success();
}

View File

@@ -31,6 +31,7 @@ class PlistParser {
static const String kCFBundleVersionKey = 'CFBundleVersion';
static const String kCFBundleDisplayNameKey = 'CFBundleDisplayName';
static const String kCFBundleNameKey = 'CFBundleName';
static const String kFLTEnableImpellerKey = 'FLTEnableImpeller';
static const String kMinimumOSVersionKey = 'MinimumOSVersion';
static const String kNSPrincipalClassKey = 'NSPrincipalClass';