From 2087dff32d09dccf5595ef7e369e77dddf2c480f Mon Sep 17 00:00:00 2001 From: Jan Haider <127390328+JanLHai@users.noreply.github.com> Date: Thu, 3 Sep 2026 14:41:16 +0200 Subject: [PATCH] fix(tvos): eliminate runtime and project build warnings (#2228) --- pubspec.lock | 4 ++-- pubspec.yaml | 2 +- tvos/Runner.xcodeproj/project.pbxproj | 9 ++++++--- tvos/Runner/AppDelegate.swift | 5 ++--- tvos/scripts/test_wire_top_shelf.rb | 19 +++++++++++++++---- tvos/scripts/wire_top_shelf.rb | 3 ++- tvos/scripts/xcode_appletv.sh | 4 ---- 7 files changed, 28 insertions(+), 18 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index e5e4f42d6..aa1464e16 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -751,8 +751,8 @@ packages: dependency: "direct main" description: path: "." - ref: "75556a968a4a1ebc42fbb8c31942c2418d4326e1" - resolved-ref: "75556a968a4a1ebc42fbb8c31942c2418d4326e1" + ref: "a27208e641790029ac54d825b97508575caee1a7" + resolved-ref: "a27208e641790029ac54d825b97508575caee1a7" url: "https://github.com/edde746/media_controls" source: git version: "0.3.0" diff --git a/pubspec.yaml b/pubspec.yaml index 702335be4..6f301b19b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -38,7 +38,7 @@ dependencies: os_media_controls: git: url: https://github.com/edde746/media_controls - ref: 75556a968a4a1ebc42fbb8c31942c2418d4326e1 + ref: a27208e641790029ac54d825b97508575caee1a7 rate_limiter: ^1.0.0 wakelock_plus: path: packages/wakelock_plus diff --git a/tvos/Runner.xcodeproj/project.pbxproj b/tvos/Runner.xcodeproj/project.pbxproj index 6edb48e2a..87e37c7b0 100644 --- a/tvos/Runner.xcodeproj/project.pbxproj +++ b/tvos/Runner.xcodeproj/project.pbxproj @@ -506,6 +506,7 @@ /* Begin PBXShellScriptBuildPhase section */ 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -559,6 +560,7 @@ }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -595,6 +597,7 @@ }; E2B5A6D75C9F4D1B9E8C7A63 /* Sync Version */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -864,7 +867,7 @@ SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/Runner"; - TVOS_DEPLOYMENT_TARGET = 15.0; + TVOS_DEPLOYMENT_TARGET = 17.0; VALIDATE_PRODUCT = YES; }; name = Release; @@ -1098,7 +1101,7 @@ SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/Runner"; - TVOS_DEPLOYMENT_TARGET = 15.0; + TVOS_DEPLOYMENT_TARGET = 17.0; VALIDATE_PRODUCT = YES; }; name = Profile; @@ -1117,7 +1120,7 @@ SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/Runner"; - TVOS_DEPLOYMENT_TARGET = 15.0; + TVOS_DEPLOYMENT_TARGET = 17.0; }; name = Debug; }; diff --git a/tvos/Runner/AppDelegate.swift b/tvos/Runner/AppDelegate.swift index 5889c4464..682a19aeb 100644 --- a/tvos/Runner/AppDelegate.swift +++ b/tvos/Runner/AppDelegate.swift @@ -118,13 +118,12 @@ import wakelock_plus _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { - // Set the long-form profile before activation so Dolby capabilities are - // available before playback. + // Configure the long-form profile before playback. The media controls + // plugin claims the session when playback actually starts. do { let session = AVAudioSession.sharedInstance() try session.setCategory( .playback, mode: .default, policy: .longFormAudio, options: []) - try session.setActive(true) } catch { print("Failed to configure long-form audio session: \(error)") do { diff --git a/tvos/scripts/test_wire_top_shelf.rb b/tvos/scripts/test_wire_top_shelf.rb index 7b2405d08..0bd9b04e7 100644 --- a/tvos/scripts/test_wire_top_shelf.rb +++ b/tvos/scripts/test_wire_top_shelf.rb @@ -61,18 +61,23 @@ class WireTopShelfTest < Minitest::Test runner_tests, runner_configuration.name, expected_team, - "#{expected_bundle}.RunnerTests" + "#{expected_bundle}.RunnerTests", + '17.0' ) assert_generated_configuration( top_shelf, runner_configuration.name, expected_team, - "#{expected_bundle}.TopShelfExtension" + "#{expected_bundle}.TopShelfExtension", + '15.0' ) end assert_equal 1, project.targets.count { |candidate| candidate.name == 'RunnerTests' } assert_equal 1, project.targets.count { |candidate| candidate.name == 'TopShelfExtension' } + assert_always_out_of_date(runner, 'Run Script') + assert_always_out_of_date(runner, 'Thin Binary') + assert_always_out_of_date(top_shelf, 'Sync Version') end private @@ -91,7 +96,13 @@ class WireTopShelfTest < Minitest::Test assert status.success?, output end - def assert_generated_configuration(target, name, expected_team, expected_bundle) + def assert_always_out_of_date(target, phase_name) + phase = target.shell_script_build_phases.find { |candidate| candidate.name == phase_name } + refute_nil phase, "#{target.name} has no #{phase_name} build phase" + assert_equal '1', phase.always_out_of_date + end + + def assert_generated_configuration(target, name, expected_team, expected_bundle, deployment_target) configuration = target.build_configurations.find { |candidate| candidate.name == name } refute_nil configuration, "#{target.name} has no #{name} configuration" @@ -102,6 +113,6 @@ class WireTopShelfTest < Minitest::Test assert_nil settings['DEVELOPMENT_TEAM'] end assert_equal expected_bundle, settings['PRODUCT_BUNDLE_IDENTIFIER'] - assert_equal '15.0', settings['TVOS_DEPLOYMENT_TARGET'] + assert_equal deployment_target, settings['TVOS_DEPLOYMENT_TARGET'] end end diff --git a/tvos/scripts/wire_top_shelf.rb b/tvos/scripts/wire_top_shelf.rb index c76606901..6eb6d8d5b 100644 --- a/tvos/scripts/wire_top_shelf.rb +++ b/tvos/scripts/wire_top_shelf.rb @@ -60,6 +60,7 @@ def ensure_shell_script(target, name, script) phase.shell_path = '/bin/sh' phase.shell_script = script + phase.always_out_of_date = '1' phase end @@ -130,7 +131,7 @@ test_target.build_configurations.each do |config| settings['SWIFT_VERSION'] = '5.0' settings['TARGETED_DEVICE_FAMILY'] = '3' settings['TEST_HOST'] = '$(BUILT_PRODUCTS_DIR)/Runner.app/Runner' - settings['TVOS_DEPLOYMENT_TARGET'] = '15.0' + settings['TVOS_DEPLOYMENT_TARGET'] = '17.0' end event_delivery_ref = ensure_file(runner_group, 'TvosEventDeliveryCoordinator.swift') diff --git a/tvos/scripts/xcode_appletv.sh b/tvos/scripts/xcode_appletv.sh index 4fd5c19bd..a073962b1 100755 --- a/tvos/scripts/xcode_appletv.sh +++ b/tvos/scripts/xcode_appletv.sh @@ -473,8 +473,6 @@ BuildAppDebug() { -o "$OUTDIR/App.framework/App" - fi - strip "$OUTDIR/App.framework/App" - echo " └─copy frameworks" CopyAppFrameworkInfoPlist "$OUTDIR/App.framework/Info.plist" "$tvos_deployment_target" @@ -631,8 +629,6 @@ BuildAppRelease() { -o "$OUTDIR/App.framework/App" \ "$OUTDIR/snapshot_assembly.o" - strip "$OUTDIR/App.framework/App" - CopyAppFrameworkInfoPlist "$OUTDIR/App.framework/Info.plist" "$tvos_deployment_target" echo " └─copy frameworks"