diff --git a/pkgs/unified_analytics/CHANGELOG.md b/pkgs/unified_analytics/CHANGELOG.md index f3fd2c984..3d4c4f278 100644 --- a/pkgs/unified_analytics/CHANGELOG.md +++ b/pkgs/unified_analytics/CHANGELOG.md @@ -1,3 +1,6 @@ +## 8.0.1 +- Added `Event.flutterInjectDarwinPlugins` event for plugins injected into an iOS/macOS project. + ## 8.0.0 - Send `enabled_features` as an event parameter in all events rather than as a user property. diff --git a/pkgs/unified_analytics/lib/src/constants.dart b/pkgs/unified_analytics/lib/src/constants.dart index 7dcf8b6b2..c6ba7496e 100644 --- a/pkgs/unified_analytics/lib/src/constants.dart +++ b/pkgs/unified_analytics/lib/src/constants.dart @@ -87,7 +87,7 @@ const int kMaxLogFileSize = 25 * (1 << 20); const String kLogFileName = 'dart-flutter-telemetry.log'; /// The current version of the package, should be in line with pubspec version. -const String kPackageVersion = '8.0.0'; +const String kPackageVersion = '8.0.1'; /// The minimum length for a session. const int kSessionDurationMinutes = 30; diff --git a/pkgs/unified_analytics/lib/src/enums.dart b/pkgs/unified_analytics/lib/src/enums.dart index d67ab66a0..eff8205a5 100644 --- a/pkgs/unified_analytics/lib/src/enums.dart +++ b/pkgs/unified_analytics/lib/src/enums.dart @@ -74,7 +74,7 @@ enum DashEvent { ), codeSizeAnalysis( label: 'code_size_analysis', - description: 'Indicates when the "--analyize-size" command is run', + description: 'Indicates when the "--analyze-size" command is run', toolOwner: DashTool.flutterTool, ), commandUsageValues( @@ -98,6 +98,11 @@ enum DashEvent { description: 'Provides information about flutter commands that ran', toolOwner: DashTool.flutterTool, ), + flutterInjectDarwinPlugins( + label: 'flutter_inject_darwin_plugins', + description: 'Information on plugins injected into an iOS/macOS project', + toolOwner: DashTool.flutterTool, + ), hotReloadTime( label: 'hot_reload_time', description: 'Hot reload duration', diff --git a/pkgs/unified_analytics/lib/src/event.dart b/pkgs/unified_analytics/lib/src/event.dart index c451386ad..0071ebd84 100644 --- a/pkgs/unified_analytics/lib/src/event.dart +++ b/pkgs/unified_analytics/lib/src/event.dart @@ -557,6 +557,71 @@ final class Event { }, ); + /// Provides information about the plugins injected into an iOS or macOS + /// project. + /// + /// This event is not sent if a project has no plugins. + /// + /// [platform] - The project's platform. Either 'ios' or 'macos'. + /// + /// [isModule] - whether the project is an add-to-app Flutter module. + /// + /// [swiftPackageManagerUsable] - if `true`, Swift Package Manager can be used + /// for the project's plugins if any are Swift Package Manager compatible. + /// + /// [swiftPackageManagerFeatureEnabled] - if the Swift Package Manager feature + /// flag is on. If false, Swift Package Manager is off for all projects on + /// the development machine. + /// + /// [projectDisabledSwiftPackageManager] - if the project's .pubspec has + /// `disable-swift-package-manager: true`. This turns off Swift Package + /// Manager for a single project. + /// + /// [projectHasSwiftPackageManagerIntegration] - if the Xcode project has + /// Swift Package Manager integration. If `false`, the project needs to be + /// migrated. + /// + /// [pluginCount] - the total number of plugins for this project. A plugin + /// can be compatible with both Swift Package Manager and CocoaPods. Plugins + /// compatible with both will be counted in both [swiftPackageCount] and + /// [podCount]. Swift Package Manager was used to inject all plugins if + /// [pluginCount] is equal to [swiftPackageCount]. + /// + /// [swiftPackageCount] - the number of plugins compatible with Swift Package + /// Manager. This is less than or equal to [pluginCount]. If + /// [swiftPackageCount] is less than [pluginCount], the project uses CocoaPods + /// to inject plugins. + /// + /// [podCount] - the number of plugins compatible with CocoaPods. This is less + /// than or equal to [podCount]. + Event.flutterInjectDarwinPlugins({ + required String platform, + required bool isModule, + required bool swiftPackageManagerUsable, + required bool swiftPackageManagerFeatureEnabled, + required bool projectDisabledSwiftPackageManager, + required bool projectHasSwiftPackageManagerIntegration, + required int pluginCount, + required int swiftPackageCount, + required int podCount, + }) : this._( + eventName: DashEvent.flutterInjectDarwinPlugins, + eventData: { + 'platform': platform, + 'isModule': isModule, + 'swiftPackageManagerUsable': swiftPackageManagerUsable, + 'swiftPackageManagerFeatureEnabled': + swiftPackageManagerFeatureEnabled, + 'projectDisabledSwiftPackageManager': + projectDisabledSwiftPackageManager, + 'projectHasSwiftPackageManagerIntegration': + projectHasSwiftPackageManagerIntegration, + 'pluginCount': pluginCount, + 'swiftPackageCount': swiftPackageCount, + 'podCount': podCount, + }, + ); + // TODO: eliasyishak, remove this or replace once we have a generic // timing event that can be used by potentially more than one DashTool Event.hotReloadTime({required int timeMs}) diff --git a/pkgs/unified_analytics/pubspec.yaml b/pkgs/unified_analytics/pubspec.yaml index 65c5de46d..8bba46243 100644 --- a/pkgs/unified_analytics/pubspec.yaml +++ b/pkgs/unified_analytics/pubspec.yaml @@ -5,7 +5,7 @@ description: >- # LINT.IfChange # When updating this, keep the version consistent with the changelog and the # value in lib/src/constants.dart. -version: 8.0.0 +version: 8.0.1 # LINT.ThenChange(lib/src/constants.dart) repository: https://github.com/dart-lang/tools/tree/main/pkgs/unified_analytics issue_tracker: https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Aunified_analytics diff --git a/pkgs/unified_analytics/test/event_test.dart b/pkgs/unified_analytics/test/event_test.dart index 2db0b2a0b..e8a9f5696 100644 --- a/pkgs/unified_analytics/test/event_test.dart +++ b/pkgs/unified_analytics/test/event_test.dart @@ -400,6 +400,39 @@ void main() { expect(constructedEvent.eventData.length, 4); }); + test('Event.flutterInjectDarwinPlugins constructed', () { + Event generateEvent() => Event.flutterInjectDarwinPlugins( + platform: 'ios', + isModule: true, + swiftPackageManagerUsable: true, + swiftPackageManagerFeatureEnabled: true, + projectDisabledSwiftPackageManager: false, + projectHasSwiftPackageManagerIntegration: true, + pluginCount: 123, + swiftPackageCount: 456, + podCount: 678, + ); + + final constructedEvent = generateEvent(); + + expect(generateEvent, returnsNormally); + expect(constructedEvent.eventName, DashEvent.flutterInjectDarwinPlugins); + expect(constructedEvent.eventData['platform'], 'ios'); + expect(constructedEvent.eventData['isModule'], isTrue); + expect(constructedEvent.eventData['swiftPackageManagerUsable'], isTrue); + expect(constructedEvent.eventData['swiftPackageManagerFeatureEnabled'], + isTrue); + expect(constructedEvent.eventData['projectDisabledSwiftPackageManager'], + isFalse); + expect( + constructedEvent.eventData['projectHasSwiftPackageManagerIntegration'], + isTrue); + expect(constructedEvent.eventData['pluginCount'], 123); + expect(constructedEvent.eventData['swiftPackageCount'], 456); + expect(constructedEvent.eventData['podCount'], 678); + expect(constructedEvent.eventData.length, 9); + }); + test('Event.codeSizeAnalysis constructed', () { Event generateEvent() => Event.codeSizeAnalysis(platform: 'platform'); @@ -634,7 +667,7 @@ void main() { // Change this integer below if your PR either adds or removes // an Event constructor - final eventsAccountedForInTests = 27; + final eventsAccountedForInTests = 28; expect(eventsAccountedForInTests, constructorCount, reason: 'If you added or removed an event constructor, ' 'ensure you have updated '