From 70be741f8de27db8cb04faabd3455ea164cd8ad7 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Wed, 6 Dec 2023 19:11:15 -0800 Subject: [PATCH] [video_player] Unfork publish: for macOS (#5578) Now that `publish:` is avaiable for macOS on 3.16, remove the forking that compiled that call out for macOS. Fixes https://github.com/flutter/flutter/issues/135320 --- .../video_player_avfoundation/CHANGELOG.md | 4 ++++ .../darwin/Classes/FVPVideoPlayerPlugin.m | 4 ---- .../darwin/RunnerTests/VideoPlayerTests.m | 13 +++++++++++++ .../example/macos/Runner.xcodeproj/project.pbxproj | 6 +++--- .../video_player_avfoundation/pubspec.yaml | 6 +++--- 5 files changed, 23 insertions(+), 10 deletions(-) diff --git a/packages/video_player/video_player_avfoundation/CHANGELOG.md b/packages/video_player/video_player_avfoundation/CHANGELOG.md index e9c2bccc1591..23316e06354a 100644 --- a/packages/video_player/video_player_avfoundation/CHANGELOG.md +++ b/packages/video_player/video_player_avfoundation/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.5.3 + +* Publishes an instance of the plugin to the registrar on macOS, as on iOS. + ## 2.5.2 * Fixes flickering and seek-while-paused on macOS. diff --git a/packages/video_player/video_player_avfoundation/darwin/Classes/FVPVideoPlayerPlugin.m b/packages/video_player/video_player_avfoundation/darwin/Classes/FVPVideoPlayerPlugin.m index bece3f3ca9ae..654c63fc2b67 100644 --- a/packages/video_player/video_player_avfoundation/darwin/Classes/FVPVideoPlayerPlugin.m +++ b/packages/video_player/video_player_avfoundation/darwin/Classes/FVPVideoPlayerPlugin.m @@ -666,11 +666,7 @@ @interface FVPVideoPlayerPlugin () @implementation FVPVideoPlayerPlugin + (void)registerWithRegistrar:(NSObject *)registrar { FVPVideoPlayerPlugin *instance = [[FVPVideoPlayerPlugin alloc] initWithRegistrar:registrar]; -#if !TARGET_OS_OSX - // TODO(stuartmorgan): Remove the ifdef once >3.13 reaches stable. See - // https://github.com/flutter/flutter/issues/135320 [registrar publish:instance]; -#endif SetUpFVPAVFoundationVideoPlayerApi(registrar.messenger, instance); } diff --git a/packages/video_player/video_player_avfoundation/darwin/RunnerTests/VideoPlayerTests.m b/packages/video_player/video_player_avfoundation/darwin/RunnerTests/VideoPlayerTests.m index 00836192a5f1..bebcb71885fe 100644 --- a/packages/video_player/video_player_avfoundation/darwin/RunnerTests/VideoPlayerTests.m +++ b/packages/video_player/video_player_avfoundation/darwin/RunnerTests/VideoPlayerTests.m @@ -691,6 +691,19 @@ - (void)testHotReloadDoesNotCrash { handler:nil]; // No assertions needed. Lack of crash is a success. } +- (void)testPublishesInRegistration { + NSString *pluginKey = @"TestRegistration"; + NSObject *registry = GetPluginRegistry(); + NSObject *registrar = [registry registrarForPlugin:pluginKey]; + + [FVPVideoPlayerPlugin registerWithRegistrar:registrar]; + + id publishedValue = [registry valuePublishedByPlugin:pluginKey]; + + XCTAssertNotNil(publishedValue); + XCTAssertTrue([publishedValue isKindOfClass:[FVPVideoPlayerPlugin class]]); +} + #if TARGET_OS_IOS - (void)validateTransformFixForOrientation:(UIImageOrientation)orientation { AVAssetTrack *track = [[FakeAVAssetTrack alloc] initWithOrientation:orientation]; diff --git a/packages/video_player/video_player_avfoundation/example/macos/Runner.xcodeproj/project.pbxproj b/packages/video_player/video_player_avfoundation/example/macos/Runner.xcodeproj/project.pbxproj index 0fb67b609543..4a5c59db31f4 100644 --- a/packages/video_player/video_player_avfoundation/example/macos/Runner.xcodeproj/project.pbxproj +++ b/packages/video_player/video_player_avfoundation/example/macos/Runner.xcodeproj/project.pbxproj @@ -110,12 +110,12 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 331C80D6294CF71000263BE5 /* RunnerTests */ = { + 330B3F8E2B1F9C6A00E6DC3F /* RunnerTests */ = { isa = PBXGroup; children = ( 33683FF02ABCAC94007305E4 /* VideoPlayerTests.m */, ); - path = RunnerTests; + name = RunnerTests; sourceTree = ""; }; 33BA886A226E78AF003329D5 /* Configs */ = { @@ -134,7 +134,7 @@ children = ( 33FAB671232836740065AC1E /* Runner */, 33CEB47122A05771004F2AC0 /* Flutter */, - 331C80D6294CF71000263BE5 /* RunnerTests */, + 330B3F8E2B1F9C6A00E6DC3F /* RunnerTests */, 33CC10EE2044A3C60003C045 /* Products */, D73912EC22F37F3D000D13A0 /* Frameworks */, 628924301D1755B9EF85E51F /* Pods */, diff --git a/packages/video_player/video_player_avfoundation/pubspec.yaml b/packages/video_player/video_player_avfoundation/pubspec.yaml index e10c729efa1a..76a32f0a293f 100644 --- a/packages/video_player/video_player_avfoundation/pubspec.yaml +++ b/packages/video_player/video_player_avfoundation/pubspec.yaml @@ -2,11 +2,11 @@ name: video_player_avfoundation description: iOS and macOS implementation of the video_player plugin. repository: https://github.com/flutter/packages/tree/main/packages/video_player/video_player_avfoundation issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22 -version: 2.5.2 +version: 2.5.3 environment: - sdk: ">=3.1.0 <4.0.0" - flutter: ">=3.13.0" + sdk: ">=3.2.0 <4.0.0" + flutter: ">=3.16.0" flutter: plugin: